/usr/share/ftools/POW/powEdit.tcl is in ftools-pow 5.3+dfsg-4.
This file is owned by root:root, with mode 0o644.
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 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 | ###########################################################################
# #
# Routines for new edit graph motif #
# #
###########################################################################
proc powEditGraphDlg { gn } {
global powbg currgn
global powDWP
global g_titleFont
set w ${powDWP}gEdit
if {[winfo exists $w]} {
raise $w
focus $w
$w.btns.reset invoke
return
}
powToplevel $w .pow "-bg $powbg"
bind $w <<CloseWindow>> "powEditExitDlg"
catch {wm title $w "Edit Graph"}
label $w.graphCont -text "Graph Contents:" -fg black -bg yellow -font g_titleFont
frame $w.graphList -bg $powbg
scrollbar $w.graphList.scrolly -orient vertical -takefocus 0\
-command {${powDWP}gEdit.graphList.lst yview} -bg $powbg
listbox $w.graphList.lst -bg $powbg -width 25 -height 6 \
-selectmode browse -exportselection 0 -takefocus 0 \
-yscrollcommand "$w.graphList.scrolly set " -font g_titleFont
bind $w.graphList.lst <ButtonRelease-1> \
{ powEditBuildOptions }
grid $w.graphList.lst -in $w.graphList \
-row 1 -column 1 -sticky news
grid $w.graphList.scrolly -in $w.graphList \
-row 1 -column 2 -sticky news
grid rowconfigure $w.graphList 1 -weight 1
grid columnconfigure $w.graphList 1 -weight 1
label $w.elemCont -text "Available Objects:" \
-fg black -bg yellow -font g_titleFont
frame $w.elemList -bg $powbg
scrollbar $w.elemList.scrolly -orient vertical -takefocus 0 \
-command {${powDWP}gEdit.elemList.lst yview} -bg $powbg
listbox $w.elemList.lst -bg $powbg -width 25 -height 6 \
-selectmode browse -exportselection 0 -takefocus 0 \
-yscrollcommand "$w.elemList.scrolly set " -font g_titleFont
grid $w.elemList.lst -row 1 -column 1 -sticky news
grid $w.elemList.scrolly -row 1 -column 2 -sticky news
grid rowconfigure $w.elemList 1 -weight 1
grid columnconfigure $w.elemList 1 -weight 1
button $w.help -bg $powbg -text "Help" \
-command {powHelp EditGraphs.html} -takefocus 0 -font g_titleFont
grid $w.graphCont -row 1 -column 1 -sticky w -padx 5 -pady 5
grid $w.graphList -row 2 -column 1 -sticky news
grid $w.help -row 1 -column 2
grid $w.elemCont -row 1 -column 3 -sticky w -padx 5 -pady 5
grid $w.elemList -row 2 -column 3 -sticky news
frame $w.elemButt -bg $powbg
button $w.elemButt.add -text "<-- Add" -bg $powbg -takefocus 0 \
-command {powEditAddElems} -font g_titleFont
button $w.elemButt.remove -text "--> Remove" -bg $powbg -takefocus 0 \
-command {powEditRemoveElems} -font g_titleFont
pack $w.elemButt.add -fill x -padx 5 -pady 2
pack $w.elemButt.remove -fill x -padx 5 -pady 2
grid $w.elemButt -row 2 -column 2
button $w.editObj -text "Edit Objects" -bg $powbg -takefocus 0 \
-command {powEditObjectDlg} -font g_titleFont
grid $w.editObj -row 3 -column 3 -padx 5 -pady 5
frame $w.btns -bg $powbg
button $w.btns.apply -text "Apply" -bg $powbg \
-command { powEditApplyToGraph } -font g_titleFont
button $w.btns.reset -text "Reset" -bg $powbg \
-command { powEditResetDialog } -font g_titleFont
button $w.btns.exit -text "Exit" -bg $powbg \
-command "powEditExitDlg" -font g_titleFont
pack $w.btns.apply -side left -padx 5 -pady 2
pack $w.btns.reset -side left -padx 5 -pady 2
pack $w.btns.exit -side left -padx 5 -pady 2
grid $w.btns -row 6 -column 1 -columnspan 3 -pady 5
grid rowconfigure $w 2 -weight 1
grid rowconfigure $w 5 -weight 1
grid columnconfigure $w 1 -weight 1
grid columnconfigure $w 3 -weight 1
powEditResetDialog
}
proc powEditExitDlg { } {
global powDWP
destroy ${powDWP}gEdit
}
proc powEditApplyToGraph { } {
global powEditGraphname powPlotParam
powEditUpdateVariables
set gn $powEditGraphname
powEraseGraph $gn 1
powCreateGraph $gn $powPlotParam(curves,$gn) $powPlotParam(images,$gn) \
$powPlotParam(xunits,$gn) $powPlotParam(yunits,$gn) \
$powPlotParam(xlabel,$gn) $powPlotParam(ylabel,$gn) \
$powPlotParam(xdimdisp,$gn) $powPlotParam(ydimdisp,$gn) \
$powPlotParam(xBot,$gn) $powPlotParam(yBot,$gn) \
$powPlotParam(xTop,$gn) $powPlotParam(yTop,$gn)
}
proc powEditResetDialog { } {
global currgn powDWP powEditGraphname
if { [winfo exists ${powDWP}gEdit] } {
set powEditGraphname $currgn
powEditInitVariables
if { $currgn=="powDef" } {
set powEditGraphname [powEditCreateNewGraphName]
}
powEditBuildOptions
}
}
proc powEditCreateNewGraphName { } {
set i 1
set gn "powGraph_$i"
while { [powListGraphs $gn] } {
incr i
set gn "powGraph_$i"
}
return $gn
}
proc powEditCreateNewGraph { gn } {
global powPlotParam powEditGraphname
global powWCS powFitsHeader powFitsHeaderCnt xCount yCount
if { $gn!="" } {
set powEditGraphname $gn
} else {
set powEditGraphname "powDef"
}
powEditInitVariables
set powEditGraphname [powEditCreateNewGraphName]
set powWCS($powEditGraphname) $powWCS($gn)
set powFitsHeader($powEditGraphname) $powFitsHeader($gn)
set powFitsHeaderCnt($powEditGraphname) $powFitsHeaderCnt($gn)
set powWCS(${powEditGraphname}scope) $powWCS($gn)
set powFitsHeader(${powEditGraphname}scope) $powFitsHeader($gn)
set powFitsHeaderCnt(${powEditGraphname}scope) $powFitsHeaderCnt($gn)
set xCount($powEditGraphname) 0
set yCount($powEditGraphname) 0
set xCount(${powEditGraphname}scope) 0
set yCount(${powEditGraphname}scope) 0
powEditApplyToGraph
}
proc powEditSelectPage { p } {
global powDWP
set note ${powDWP}gEdit.nBook
Notebook:raise $note $p
}
########################################################################
#
# Build Option Pages
#
########################################################################
proc powEditBuildOptions { } {
global powDWP powbg
set note ${powDWP}gEdit.nBook
if { ![winfo exists $note] } {
Notebook:create $note -pages {Graph Fonts Ticks Points Lines Image} \
-pad 4 -bg $powbg
grid $note -in ${powDWP}gEdit -row 5 -column 1 \
-padx 15 -pady 0 -columnspan 3 -sticky nwes
}
set w [Notebook:frame $note Graph]
powEditBuildGraphOptions $w
set w [Notebook:frame $note Fonts]
powEditBuildFontOptions $w
set w [Notebook:frame $note Ticks]
powEditBuildTickOptions $w
set w [Notebook:frame $note Points]
set itemNo [${powDWP}gEdit.graphList.lst curselection]
if { $itemNo == "" } {
set item "none none"
} else {
set item [${powDWP}gEdit.graphList.lst get $itemNo]
}
foreach {name type} [split $item { }] {}
if { $type == "(curve)" } {
powEditBuildCurveOptions1 $w $name
set w [Notebook:frame $note Lines]
powEditBuildCurveOptions2 $w $name
} else {
powEditBuildEmptyOptions $w "Curve Not Selected"
set w [Notebook:frame $note Lines]
powEditBuildEmptyOptions $w "Curve Not Selected"
}
set w [Notebook:frame $note Image]
if { $type == "(image)" } {
powEditBuildImageOptions $w $name
} else {
powEditBuildEmptyOptions $w "Image Not Selected"
}
Notebook:resize $note
}
##################
#
# Setup Page: Empty
#
##################
proc powEditBuildEmptyOptions { frame str } {
global powbg
global g_titleFont
if {[winfo exists $frame]} {
foreach i [winfo children $frame] {
destroy $i
}
} else {
frame $frame -bg $powbg
}
label $frame.lab -bg $powbg -text $str -font g_titleFont
# Use pack instead of grid to destroy any pre-existing grid
# configuration from nonEmpty frames
pack $frame.lab -side top -fill both -anchor center -expand 1
}
##################
#
# Setup Page: POW
#
##################
proc powEditBuildPOWOptions { frame } {
global powEditAppParam powbg
global g_titleFont
if {[winfo exists $frame]} {
foreach i [winfo children $frame] {
destroy $i
}
} else {
frame $frame -bg $powbg
}
set row 1
grid rowconfigure $frame $row -minsize 5
incr row
# Setup POW Application Options
#
# Cursor:
#
label $frame.cursor -bg $powbg -text "Cursor:" -font g_titleFont
grid $frame.cursor -row $row -column 2 -sticky ne
set col 3
foreach [list lab val] [list "Cross Hairs" crosshair \
"Left Arrow" top_left_arrow "Right Arrow" right_ptr \
"Gumby" gumby "Star Trek" trek] {
if {$col==6} {set col 3; incr row}
radiobutton $frame.cStyle$val -bg $powbg -text $lab \
-variable powEditAppParam(cursor,new) -value $val \
-highlightthickness 0 -takefocus 0 \
-command "$frame configure -cursor $val" -font g_titleFont
grid $frame.cStyle$val -row $row -column $col -sticky nw -padx 4
incr col
}
incr row
grid rowconfigure $frame $row -minsize 7
incr row
#
# GUI position:
#
label $frame.gui -bg $powbg -text "GUI Position:" -font g_titleFont
grid $frame.gui -row $row -column 2 -sticky ne
set col 3
foreach [list lab val] [list Top top Left left Right right Bottom bottom \
"Hidden" none] {
if {$col==6} {set col 3; incr row}
radiobutton $frame.gPos$val -bg $powbg -text $lab \
-variable powEditAppParam(GUIposition,new) -value $val \
-highlightthickness 0 -takefocus 0 -font g_titleFont
grid $frame.gPos$val -row $row -column $col -sticky nw -padx 4
incr col
}
incr row
grid rowconfigure $frame $row -minsize 7
incr row
#
# Scopebox Size:
#
label $frame.scope -bg $powbg -text "Scopebox Size:" -font g_titleFont
grid $frame.scope -row $row -column 2 -sticky ne
set col 3
foreach [list lab val] [list None [list 0 0] 100x100 [list 100 100] 150x150 [list 150 150]\
200x200 [list 200 200] ] {
if {$col==6} {set col 3; incr row}
radiobutton $frame.sb$lab -bg $powbg -text $lab \
-variable powEditAppParam(ScopeSize,new) -value $val \
-highlightthickness 0 -takefocus 0 -font g_titleFont
grid $frame.sb$lab -row $row -column $col -sticky nw -padx 4
incr col
}
incr row
grid rowconfigure $frame $row -minsize 7
incr row
#
# Resize Main:
#
label $frame.rszMain -bg $powbg -text "Resize Window:" -font g_titleFont
grid $frame.rszMain -row $row -column 2 -sticky ne
set col 3
foreach [list lab val] [list "To Fit Contents" 1 "Never" 0] {
if {$col==6} {set col 3; incr row}
radiobutton $frame.rs$val -bg $powbg -text $lab \
-variable powEditAppParam(ResizeMain,new) -value $val \
-highlightthickness 0 -takefocus 0 -font g_titleFont
grid $frame.rs$val -row $row -column $col -sticky nw -padx 4
incr col
}
incr row
grid rowconfigure $frame $row -minsize 7
incr row
#
# Background Color:
#
label $frame.bg -bg $powbg -text "Background Color:" -font g_titleFont
grid $frame.bg -row $row -column 2 -sticky e
powColorFrame $frame.bgColors powEditAppParam(bg,new)
grid $frame.bgColors -row $row -column 3 -columnspan 3 \
-sticky w -padx 8
incr row
grid rowconfigure $frame $row -minsize 7
incr row
grid columnconfigure $frame 0 -minsize 5
grid columnconfigure $frame [list 3 4 5 6] -weight 1
}
##################
#
# Setup Page: Graph
#
##################
proc powEditBuildGraphOptions { frame } {
global powbg powEditPlotParam powEditCurveParam powEditGraphname
global powPlotParam
global currgn
global g_titleFont
global powLutButton
global powROIButton
global buttonWndw
global buttonSelection
if {[winfo exists $frame]} {
foreach i [winfo children $frame] {
destroy $i
}
} else {
frame $frame -bg $powbg
}
set buttonWndw $frame
set row 1
grid rowconfigure $frame $row -minsize 5
incr row
if { $powEditGraphname != "powDef" } {
# Don't do this if we are editting defaults...
# ... these data are not relvnt
label $frame.title -bg $powbg -text "Graph Title:" -font g_titleFont
entry $frame.etitle -bg $powbg \
-textvariable powEditPlotParam(titleString,new) -takefocus 1 -font g_titleFont
grid $frame.title -in $frame -row $row -column 1 -sticky e \
-padx 5
grid $frame.etitle -in $frame -row $row -column 2 -sticky ew \
-padx 5 -columnspan 2
incr row
grid rowconfigure $frame $row -minsize 5
incr row
}
# Setup Bbox options
label $frame.x -bg $powbg -text "X Axis" -font g_titleFont
label $frame.y -bg $powbg -text "Y Axis" -font g_titleFont
grid $frame.x -in $frame -row $row -column 2 -sticky ew
grid $frame.y -in $frame -row $row -column 3 -sticky ew
incr row
if { $powEditGraphname == "powDef" } {
set labelsAndValues [list Size: dimdisp]
} else {
# Don't do this if we are editting defaults...
# ... these data are not relvnt
set labelsAndValues [list Label: label Min: Bot Max: Top \
Units: units Size: dimdisp ]
}
foreach {lbl val} $labelsAndValues {
label $frame.l$val -bg $powbg -text $lbl -font g_titleFont
entry $frame.ex$val -bg $powbg \
-textvariable powEditPlotParam(x$val,new) -takefocus 1 -font g_titleFont
entry $frame.ey$val -bg $powbg \
-textvariable powEditPlotParam(y$val,new) -takefocus 1 -font g_titleFont
grid $frame.l$val -in $frame -row $row -column 1 -sticky e \
-padx 5
grid $frame.ex$val -in $frame -row $row -column 2 -sticky w \
-padx 5
grid $frame.ey$val -in $frame -row $row -column 3 -sticky w \
-padx 5
incr row
}
# Axis Scaling
label $frame.tickScale -bg $powbg -text "Scaling:" -font g_titleFont
grid $frame.tickScale -in $frame -row $row -column 1 -sticky ne -padx 5
frame $frame.scaleX -bg $powbg
frame $frame.scaleY -bg $powbg
radiobutton $frame.scaleX.log -bg $powbg -text Log \
-variable powEditPlotParam(xTickScal,new) -value log \
-highlightthickness 0 -takefocus 0 -font g_titleFont
radiobutton $frame.scaleX.lin -bg $powbg -text Linear \
-variable powEditPlotParam(xTickScal,new) -value linear \
-highlightthickness 0 -takefocus 0 -font g_titleFont
radiobutton $frame.scaleY.log -bg $powbg -text Log \
-variable powEditPlotParam(yTickScal,new) -value log \
-highlightthickness 0 -takefocus 0 -font g_titleFont
radiobutton $frame.scaleY.lin -bg $powbg -text Linear \
-variable powEditPlotParam(yTickScal,new) -value linear \
-highlightthickness 0 -takefocus 0 -font g_titleFont
pack $frame.scaleX.lin -padx 5 -side left -anchor w
pack $frame.scaleX.log -padx 5 -side left -anchor w
pack $frame.scaleY.lin -padx 5 -side left -anchor w
pack $frame.scaleY.log -padx 5 -side left -anchor w
grid $frame.scaleX -row $row -column 2 -sticky we -padx 5
grid $frame.scaleY -row $row -column 3 -sticky we -padx 5
incr row
label $frame.mouse -bg $powbg -text "Mouse:" -font g_titleFont
grid $frame.mouse -in $frame -row $row -column 1 -sticky ne -padx 5
frame $frame.buttonSelection -bg $powbg
set buttonWndw $frame.buttonSelection
radiobutton $frame.buttonSelection.leftZoom \
-font g_titleFont \
-text "Normal: left zoom, right brightnesss/contrast" \
-variable buttonSelection -value leftZoom \
-command {powButtonSelection ${buttonWndw}.leftZoom ${buttonWndw}.leftBright Right}
radiobutton $frame.buttonSelection.leftBright \
-font g_titleFont \
-text "Reversed: left brightnesss/contrast, right zoom" \
-variable buttonSelection -value leftBright \
-command {powButtonSelection ${buttonWndw}.leftZoom ${buttonWndw}.leftBright Left}
grid $frame.buttonSelection.leftZoom -row 0 -column 1 -sticky w -padx 5
grid $frame.buttonSelection.leftBright -row 1 -column 1 -sticky w -padx 5
grid $frame.buttonSelection -row $row -column 2 -sticky w -padx 5 -rowspan 3 -columnspan 2
grid rowconfigure $frame $row -minsize 5
incr row 3
if { $powLutButton == 3 } {
$frame.buttonSelection.leftZoom select
powButtonSelection ${buttonWndw}.leftZoom ${buttonWndw}.leftBright Right
} else {
$frame.buttonSelection.leftBright select
powButtonSelection ${buttonWndw}.leftZoom ${buttonWndw}.leftBright Left
}
if { $powEditGraphname != "powDef" } {
# Don't do this if we are editting defaults...
# ... these data are not relvnt
checkbutton $frame.scaleData -bg $powbg -text "Scale curve data to axes" \
-variable powEditPlotParam(scalData,new) -onvalue Yes -offvalue No \
-highlightthickness 0 -takefocus 0 -font g_titleFont
grid $frame.scaleData -row $row -column 2 -columnspan 2 -sticky we -padx 5
incr row
grid rowconfigure $frame $row -minsize 7
incr row
}
# Reset Button
if { $powEditGraphname != "powDef" } {
# Don't do this if we are editting defaults...
# ... these data are not relvnt
button $frame.reset -bg $powbg -text "Reset Min/Max" -takefocus 0 \
-command {
foreach par [list xBot yBot xTop yTop] {
set powEditPlotParam($par,new) NULL
}
} -font g_titleFont
grid $frame.reset -in $frame -row $row -column 2 \
-columnspan 2 -sticky {} -padx 5 -pady 5
incr row
}
grid rowconfigure $frame $row -minsize 5
incr row
grid columnconfigure $frame [list 0 4] -weight 1 -minsize 5
}
##################
#
# Setup Page: Fonts
#
##################
proc powEditBuildFontOptions { frame } {
global powbg powEditFontParam powEditGraphname powFontParam
global g_titleFont
if {[winfo exists $frame]} {
foreach i [winfo children $frame] {
destroy $i
}
} else {
frame $frame -bg $powbg
}
set row 1
grid rowconfigure $frame $row -minsize 5
incr row
label $frame.family -text "Font Family" -bg $powbg -font g_titleFont
label $frame.size -text "Size (pt)" -bg $powbg -font g_titleFont
label $frame.style -text "Style" -bg $powbg -font g_titleFont
label $frame.color -text "Color" -bg $powbg -font g_titleFont
grid $frame.family -row $row -column 2 -sticky s
grid $frame.size -row $row -column 3 -sticky s
grid $frame.style -row $row -column 4 -sticky s -columnspan 2
grid $frame.color -row $row -column 6 -sticky s
incr row
grid rowconfigure $frame $row -minsize 5
incr row
foreach {tLbl lbl} [list \
"Title:" title "Axis Labels:" axis \
"Tick Labels:" tick "Text Labels:" note] {
label $frame.lbl$lbl -text $tLbl -bg $powbg -font g_titleFont
checkbutton $frame.bld$lbl -text Bold -onvalue bold -offvalue normal \
-bg $powbg -variable powEditFontParam(${lbl}Weight,new) \
-highlightthickness 0 -font g_titleFont
checkbutton $frame.itl$lbl -text Italic -onvalue italic -offvalue roman \
-bg $powbg -variable powEditFontParam(${lbl}Slant,new) \
-highlightthickness 0 -font g_titleFont
set mnu [eval tk_optionMenu $frame.fnt$lbl \
powEditFontParam(${lbl}Font,new) $powFontParam(allFonts,powDef)]
$frame.fnt$lbl configure -bg $powbg -highlightthickness 0 -width 20 -font g_titleFont
$mnu configure -bg $powbg -font g_titleFont
set mnu [tk_optionMenu $frame.siz$lbl powEditFontParam(${lbl}Size,new) \
7 9 12 14 16 18 24 32 40]
$frame.siz$lbl configure -bg $powbg -highlightthickness 0 -width 3 -font g_titleFont
$mnu configure -bg $powbg -font g_titleFont
button $frame.clr$lbl -textvariable powEditFontParam(${lbl}Color,new) \
-bg $powbg -highlightthickness 0 -width 7 \
-command "powSelectColor powEditFontParam(${lbl}Color,new)" -font g_titleFont
grid $frame.lbl$lbl -row $row -column 1 -padx 3 -sticky e
grid $frame.fnt$lbl -row $row -column 2 -padx 3
grid $frame.siz$lbl -row $row -column 3 -padx 3
grid $frame.bld$lbl -row $row -column 4 -padx 3
grid $frame.itl$lbl -row $row -column 5 -padx 3
grid $frame.clr$lbl -row $row -column 6 -padx 3
incr row
grid rowconfigure $frame $row -minsize 5
incr row
}
}
##################
#
# Setup Page: Tick
#
##################
proc powEditBuildTickOptions { frame } {
global powbg powEditPlotParam
global g_titleFont
if {[winfo exists $frame]} {
foreach i [winfo children $frame] {
destroy $i
}
} else {
frame $frame -bg $powbg
}
set row 1
grid rowconfigure $frame $row -minsize 5
incr row
# Setup Tick Options
label $frame.nXTicks -bg $powbg -text "# of X Ticks:" -font g_titleFont
grid $frame.nXTicks -in $frame -row $row -column 2 -sticky ne
frame $frame.xTickSlide -bg $powbg
label $frame.xTickSlide.few -text "None" -bg $powbg -font g_titleFont
label $frame.xTickSlide.lots -text "Many" -bg $powbg -font g_titleFont
scale $frame.xTickSlide.slide -from 0 -to 12 \
-orient horizontal -variable powEditPlotParam(xNumTicks,new) \
-highlightbackground $powbg -bg $powbg \
-showvalue 0 -takefocus 0 -font g_titleFont
pack $frame.xTickSlide.few -in $frame.xTickSlide -side left
pack $frame.xTickSlide.slide -in $frame.xTickSlide -side left \
-expand 1 -fill x
pack $frame.xTickSlide.lots -in $frame.xTickSlide -side right
grid $frame.xTickSlide -in $frame -row $row -column 3 -columnspan 3 \
-sticky ew -padx 5
incr row
label $frame.nYTicks -bg $powbg -text "# of Y Ticks:" -font g_titleFont
grid $frame.nYTicks -in $frame -row $row -column 2 -sticky ne
frame $frame.yTickSlide -bg $powbg
label $frame.yTickSlide.few -text "None" -bg $powbg -font g_titleFont
label $frame.yTickSlide.lots -text "Many" -bg $powbg -font g_titleFont
scale $frame.yTickSlide.slide -from 0 -to 12 \
-orient horizontal -variable powEditPlotParam(yNumTicks,new) \
-highlightbackground $powbg -bg $powbg \
-showvalue 0 -takefocus 0 -font g_titleFont
pack $frame.yTickSlide.few -in $frame.yTickSlide -side left
pack $frame.yTickSlide.slide -in $frame.yTickSlide -side left \
-expand 1 -fill x
pack $frame.yTickSlide.lots -in $frame.yTickSlide -side right
grid $frame.yTickSlide -in $frame -row $row -column 3 -columnspan 3 \
-sticky ew -padx 5
incr row
label $frame.xTicks -bg $powbg -text "X Ticks:" -font g_titleFont
grid $frame.xTicks -in $frame -row $row -column 2 -sticky ne
frame $frame.xTickButt -bg $powbg
radiobutton $frame.xTickButt.in -bg $powbg -text In \
-variable powEditPlotParam(xTickLength,new) \
-value [list -10 -10 -10 -10] \
-highlightthickness 0 -takefocus 0 -font g_titleFont
radiobutton $frame.xTickButt.out -bg $powbg -text Out \
-variable powEditPlotParam(xTickLength,new) \
-value [list 10 10 10 10] \
-highlightthickness 0 -takefocus 0 -font g_titleFont
checkbutton $frame.xTickButt.lab -bg $powbg -text "Labeled?"\
-variable powEditPlotParam(xLabelTicks,new) \
-onvalue [list Yes No No Yes] \
-offvalue [list No No No No] \
-highlightthickness 0 -takefocus 0 -font g_titleFont
pack $frame.xTickButt.in -side left -padx 4
pack $frame.xTickButt.out -side left -padx 4
pack $frame.xTickButt.lab -side left -padx 20
grid $frame.xTickButt -row $row -column 3 -sticky w -padx 0 -columnspan 3
incr row
label $frame.yTicks -bg $powbg -text "Y Ticks:" -font g_titleFont
grid $frame.yTicks -in $frame -row $row -column 2 -sticky ne
frame $frame.yTickButt -bg $powbg
radiobutton $frame.yTickButt.in -bg $powbg -text In \
-variable powEditPlotParam(yTickLength,new) \
-value [list -10 -10 -10 -10] \
-highlightthickness 0 -takefocus 0 -font g_titleFont
radiobutton $frame.yTickButt.out -bg $powbg -text Out \
-variable powEditPlotParam(yTickLength,new) \
-value [list 10 10 10 10] \
-highlightthickness 0 -takefocus 0 -font g_titleFont
checkbutton $frame.yTickButt.lab -bg $powbg -text "Labeled?"\
-variable powEditPlotParam(yLabelTicks,new) \
-onvalue [list Yes No No Yes] \
-offvalue [list No No No No] \
-highlightthickness 0 -takefocus 0 -font g_titleFont
pack $frame.yTickButt.in -side left -padx 4
pack $frame.yTickButt.out -side left -padx 4
pack $frame.yTickButt.lab -side left -padx 20
grid $frame.yTickButt -row $row -column 3 -sticky w -padx 0 -columnspan 3
incr row
# Tick Labeling
label $frame.tickLabel -bg $powbg -text "Tick Labels:" -font g_titleFont
grid $frame.tickLabel -in $frame -row $row -column 2 -sticky ne
set col 3
foreach {lab val} [list Decimal decimal "Base 60 (deg)" degrees] {
if {$col==5} {set col 3; incr row}
radiobutton $frame.label$val -bg $powbg -text $lab \
-variable powEditPlotParam(tickLabels,new) -value $val \
-highlightthickness 0 -takefocus 0 -font g_titleFont
grid $frame.label$val -in $frame \
-row $row -column $col -sticky nw -padx 5
incr col
}
incr row
grid rowconfigure $frame $row -minsize 7
incr row
# Add a separator line
frame $frame.sep -bg $powbg -relief ridge -height 2 -bd 2
grid $frame.sep -row $row -column 3 -columnspan 3 -sticky ew
grid rowconfigure $frame $row -minsize 10 -weight 1
incr row
# Setup Grid Options
checkbutton $frame.grid -bg $powbg -text "Grid Lines -" \
-variable powEditPlotParam(GridLines,new) \
-highlightthickness 0 -onvalue Yes -offvalue No -font g_titleFont
grid $frame.grid -in $frame -row $row -column 1 -sticky w -columnspan 6
incr row
# Line Style
label $frame.style -bg $powbg -text "Style:" -font g_titleFont
grid $frame.style -in $frame -row $row -column 2 -sticky ne
set col 3
foreach {style val} \
{Solid " " "Sm Dash" 10 "Lg Dash" 20 \
"Dotted" "4 4" "Dot Dash" "15 10 4 10"} {
regsub -all { } $style {_} cln
if {$col==6} {set col 3; incr row}
radiobutton $frame.lStyle$cln -bg $powbg -text $style \
-variable powEditPlotParam(GridDash,new) -value $val \
-highlightthickness 0 -takefocus 0 -font g_titleFont
grid $frame.lStyle$cln -in $frame \
-row $row -column $col -sticky nw -padx 4
incr col
}
incr row
grid rowconfigure $frame $row -minsize 7
incr row
# Color
label $frame.gridColor -bg $powbg -text "Color:" -font g_titleFont
grid $frame.gridColor -in $frame -row $row -column 2 -sticky e
powColorFrame $frame.gColors powEditPlotParam(GridColor,new)
grid $frame.gColors -in $frame -row $row -column 3 -columnspan 3 \
-sticky w -padx 8
incr row
grid rowconfigure $frame $row -minsize 5
incr row
grid columnconfigure $frame 0 -minsize 5
grid columnconfigure $frame [list 3 4 5 6] -weight 1
}
##################
#
# Setup Page: Points
#
##################
proc powEditBuildCurveOptions1 { frame curve } {
global powbg powEditCurveParam
global g_titleFont
# If frame already exists delete its contents
if {[winfo exists $frame]} {
foreach i [winfo children $frame] {
destroy $i
}
} else {
frame $frame -bg $powbg
}
# Set default values if not defined for this curve
powEditCurveDefOptions $curve
# Build widgets
set row 1
grid rowconfigure $frame $row -minsize 5
incr row
#
# Setup Points Options
#
# Point Display
checkbutton $frame.pDisp -bg $powbg -text "Points -" \
-variable powEditCurveParam(pDisp${curve},new) \
-highlightthickness 0 -onvalue Yes -offvalue No -font g_titleFont
grid $frame.pDisp -in $frame -row $row -column 1 -sticky w -columnspan 2
incr row
grid rowconfigure $frame $row -minsize 10
incr row
# Shape
label $frame.shape -bg $powbg -text "Shape:" -font g_titleFont
grid $frame.shape -in $frame -row $row -column 2 -sticky ne
set col 3
set cnt 1
foreach shape {Dot Cross Diamond Box Octagon Triangle "Inv. Triangle"} {
if {$col>=7} {set col 3; incr row}
radiobutton $frame.pShape$cnt -bg $powbg -text $shape \
-variable powEditCurveParam(pShape${curve},new) -value $shape \
-highlightthickness 0 -takefocus 0 -font g_titleFont
grid $frame.pShape$cnt -in $frame \
-row $row -column $col -sticky nw -padx 4
if { $shape=="Inv. Triangle" } {
grid configure $frame.pShape$cnt -columnspan 2
incr col
}
incr col
incr cnt
}
incr row
grid rowconfigure $frame $row -minsize 7
incr row
# Size
label $frame.size -bg $powbg -text "Size:" -font g_titleFont
grid $frame.size -in $frame -row $row -column 2 -sticky ne
frame $frame.pSize -bg $powbg
radiobutton $frame.pSize.fixed -bg $powbg -text "Fixed... " \
-variable powEditCurveParam(pSizeErr${curve},new) -value No \
-highlightthickness 0 -takefocus 0 -font g_titleFont
label $frame.pSize.text -bg $powbg -width 2 \
-textvariable powEditCurveParam(pSize${curve},new) -font g_titleFont
label $frame.pSize.pt -bg $powbg -width 2 -text pt -font g_titleFont
scale $frame.pSize.slide -from 2 -to 12 -orient horizontal \
-variable powEditCurveParam(pSize${curve},new) \
-highlightbackground $powbg -bg $powbg \
-showvalue 0 -takefocus 0 -font g_titleFont
grid $frame.pSize.fixed -in $frame.pSize -row 1 -column 1 -sticky nw -padx 3
grid $frame.pSize.text -in $frame.pSize -row 1 -column 2 -sticky ne
grid $frame.pSize.pt -in $frame.pSize -row 1 -column 3 -sticky nw
grid $frame.pSize.slide -in $frame.pSize -row 1 -column 4 -sticky new \
-padx 4
grid columnconfigure $frame.pSize 4 -weight 1
grid $frame.pSize -in $frame -row $row -column 3 -columnspan 3 \
-sticky new
incr row
radiobutton $frame.pSizeError -bg $powbg -text Errorbars \
-variable powEditCurveParam(pSizeErr${curve},new) -value Yes \
-highlightthickness 0 -takefocus 0 -font g_titleFont
grid $frame.pSizeError -in $frame \
-row $row -column 3 -sticky nw -padx 4
incr row
grid rowconfigure $frame $row -minsize 7
incr row
# Point Filling
label $frame.fill -bg $powbg -text "Fill:" -font g_titleFont
grid $frame.fill -in $frame -row $row -column 2 -sticky ne
set col 3
foreach {lab val} {Yes Yes No No} {
if {$col==7} {set col 3; incr row}
radiobutton $frame.pFill$val -bg $powbg -text $lab \
-variable powEditCurveParam(pFill${curve},new) -value $val \
-highlightthickness 0 -takefocus 0 -font g_titleFont
grid $frame.pFill$val -in $frame \
-row $row -column $col -sticky nw -padx 4
incr col
}
incr row
grid rowconfigure $frame $row -minsize 7
incr row
# Colors
label $frame.pcolor -bg $powbg -text "Color:" -font g_titleFont
grid $frame.pcolor -in $frame -row $row -column 1 -sticky e -columnspan 2
powColorFrame $frame.pColors powEditCurveParam(pColor${curve},new)
grid $frame.pColors -in $frame -row $row -column 3 -columnspan 3 \
-sticky w -padx 8
incr row
# Add a separator line
frame $frame.sep -bg $powbg -relief ridge -height 2 -bd 2
grid $frame.sep -row $row -column 3 -columnspan 4 -sticky ew
grid rowconfigure $frame $row -minsize 10 -weight 1
incr row
# Data Transform
label $frame.lLog -bg $powbg -text "Transform:" -font g_titleFont
grid $frame.lLog -in $frame -row $row -column 2 -sticky ne
checkbutton $frame.xLog -bg $powbg -text "Log X" \
-variable powEditCurveParam(logX${curve},new) \
-highlightthickness 0 -onvalue Yes -offvalue No -font g_titleFont
checkbutton $frame.yLog -bg $powbg -text "Log Y" \
-variable powEditCurveParam(logY${curve},new) \
-highlightthickness 0 -onvalue Yes -offvalue No -font g_titleFont
grid $frame.xLog -in $frame -row $row -column 3 -sticky w -padx 4
grid $frame.yLog -in $frame -row $row -column 4 -sticky w -padx 4
incr row
grid rowconfigure $frame $row -minsize 5
incr row
grid columnconfigure $frame 1 -minsize 10
grid columnconfigure $frame 0 -minsize 5
grid columnconfigure $frame [list 3 4 5 6] -weight 1
}
##################
#
# Setup Page: Lines
#
##################
proc powEditBuildCurveOptions2 { frame curve } {
global powbg powEditCurveParam
global g_titleFont
# If frame already exists delete its contents
if {[winfo exists $frame]} {
foreach i [winfo children $frame] {
destroy $i
}
} else {
frame $frame -bg $powbg
}
# Set default values if not defined for this curve
powEditCurveDefOptions $curve
# Build widgets
set row 1
grid rowconfigure $frame $row -minsize 5
incr row
#
# Setup Lines Options
#
# Line Display
checkbutton $frame.lDisp -bg $powbg -text "Lines -" \
-variable powEditCurveParam(lDisp${curve},new) \
-highlightthickness 0 -onvalue Yes -offvalue No -font g_titleFont
grid $frame.lDisp -in $frame -row $row -column 1 -sticky w -columnspan 2
incr row
grid rowconfigure $frame $row -minsize 10
incr row
# Style
label $frame.style -bg $powbg -text "Style:" -font g_titleFont
grid $frame.style -in $frame -row $row -column 2 -sticky ne
set col 3
foreach {style val} \
{Solid " " "Sm Dash" 10 "Lg Dash" 20 \
"Dotted" "4 4" "Dot Dash" "15 10 4 10"} {
regsub -all { } $style {_} cln
if {$col==6} {set col 3; incr row}
radiobutton $frame.lStyle$cln -bg $powbg -text $style \
-variable powEditCurveParam(lStyle${curve},new) -value $val \
-highlightthickness 0 -takefocus 0 -font g_titleFont
grid $frame.lStyle$cln -in $frame \
-row $row -column $col -sticky nw -padx 4
incr col
}
incr row
grid rowconfigure $frame $row -minsize 7
incr row
# Line Width
label $frame.width -bg $powbg -text "Width:" -font g_titleFont
grid $frame.width -in $frame -row $row -column 2 -sticky ne
set col 3
foreach {size val} {Thin 1 Medium 2 Thick 3} {
if {$col==6} {set col 3; incr row}
radiobutton $frame.lWidth$size -bg $powbg -text $size \
-variable powEditCurveParam(lWidth${curve},new) -value $val \
-highlightthickness 0 -takefocus 0 -font g_titleFont
grid $frame.lWidth$size -in $frame \
-row $row -column $col -sticky nw -padx 4
incr col
}
incr row
grid rowconfigure $frame $row -minsize 7
incr row
# Histogram???
label $frame.step -bg $powbg -text "Connect:" -font g_titleFont
grid $frame.step -in $frame -row $row -column 2 -sticky ne
set col 3
foreach {style val} {"Normal" No "Histogram" Yes} {
if {$col==6} {set col 3; incr row}
radiobutton $frame.lStep$val -bg $powbg -text $style \
-variable powEditCurveParam(lStep${curve},new) -value $val \
-highlightthickness 0 -takefocus 0 -font g_titleFont
grid $frame.lStep$val -in $frame \
-row $row -column $col -sticky nw -padx 4
incr col
}
checkbutton $frame.lBoxFill -bg $powbg -text "Fill Boxes" \
-variable powEditCurveParam(lBoxFill${curve},new) \
-onvalue Yes -offvalue No \
-highlightthickness 0 -takefocus 0 -font g_titleFont
grid $frame.lBoxFill -row $row -column $col -sticky nw -padx 4
incr row
grid rowconfigure $frame $row -minsize 7
incr row
# Color
label $frame.color -bg $powbg -text "Color:" -font g_titleFont
grid $frame.color -in $frame -row $row -column 1 -sticky e -columnspan 2
powColorFrame $frame.lColors powEditCurveParam(lColor${curve},new)
grid $frame.lColors -in $frame -row $row -column 3 -columnspan 3 \
-sticky w -padx 8
incr row
# Add a separator line
frame $frame.sep -bg $powbg -relief ridge -height 2 -bd 2
grid $frame.sep -row $row -column 3 -columnspan 3 -sticky ew
grid rowconfigure $frame $row -minsize 10 -weight 1
incr row
# Data Transform
label $frame.lLog -bg $powbg -text "Transform:" -font g_titleFont
grid $frame.lLog -in $frame -row $row -column 2 -sticky ne
checkbutton $frame.xLog -bg $powbg -text "Log X" \
-variable powEditCurveParam(logX${curve},new) \
-highlightthickness 0 -onvalue Yes -offvalue No -font g_titleFont
checkbutton $frame.yLog -bg $powbg -text "Log Y" \
-variable powEditCurveParam(logY${curve},new) \
-highlightthickness 0 -onvalue Yes -offvalue No -font g_titleFont
grid $frame.xLog -in $frame -row $row -column 3 -sticky w -padx 4
grid $frame.yLog -in $frame -row $row -column 4 -sticky w -padx 4
incr row
grid rowconfigure $frame $row -minsize 5
incr row
grid columnconfigure $frame 1 -minsize 10
grid columnconfigure $frame 0 -minsize 5
grid columnconfigure $frame [list 3 4 5] -weight 1
}
##################
#
# Setup Page: Images
#
##################
proc powEditBuildImageOptions { frame image } {
global powbg powEditImageParam powImageParam powRBmin powRBmax
global g_titleFont
# If frame already exists delete its contents
if {[winfo exists $frame]} {
foreach i [winfo children $frame] {
destroy $i
}
} else {
frame $frame -bg $powbg
}
# Set default values if not defined for this curve
powEditImageDefOptions $image
# Build widgets
set row 1
grid rowconfigure $frame $row -minsize 5
incr row
#
# Setup Image Options
#
# Colormap
label $frame.cmap -bg $powbg -text "Colormap:" -font g_titleFont
grid $frame.cmap -in $frame -row $row -column 2 -sticky ne
foreach colorGrp $powImageParam(allMaps,powDef) {
set col 3
foreach cmap [lrange $colorGrp 1 end] {
if {$col>=7} {set col 3; incr row}
radiobutton $frame.cmap$cmap -bg $powbg -text $cmap \
-variable powEditImageParam(colormap${image},new) -value $cmap \
-highlightthickness 0 -takefocus 0 -font g_titleFont
grid $frame.cmap$cmap -in $frame \
-row $row -column $col -sticky nw -padx 4
incr col
}
incr row
}
grid rowconfigure $frame $row -minsize 7
incr row
# Inverted?
label $frame.inv -bg $powbg -text "Invert:" -font g_titleFont
grid $frame.inv -in $frame -row $row -column 2 -sticky ne
radiobutton $frame.invOn -bg $powbg -text Yes \
-variable powEditImageParam(invert${image},new) -value Yes \
-highlightthickness 0 -takefocus 0 -font g_titleFont
radiobutton $frame.invOff -bg $powbg -text No \
-variable powEditImageParam(invert${image},new) -value No \
-highlightthickness 0 -takefocus 0 -font g_titleFont
grid $frame.invOn -in $frame \
-row $row -column 3 -sticky nw -padx 4
grid $frame.invOff -in $frame \
-row $row -column 4 -sticky nw -padx 4
incr row
grid rowconfigure $frame $row -minsize 7
incr row
# Scaling
label $frame.scale -bg $powbg -text "Scaling:" -font g_titleFont
grid $frame.scale -in $frame -row $row -column 2 -sticky ne
set col 3
foreach {lab val} [list Linear linear Square-Root sqrt Logarithmic log \
"Histo Equalize" histo] {
if {$col>=7} {set col 3; incr row}
radiobutton $frame.scale$val -bg $powbg -text $lab \
-variable powEditImageParam(scale${image},new) -value $val \
-highlightthickness 0 -takefocus 0 -font g_titleFont
grid $frame.scale$val -in $frame \
-row $row -column $col -sticky nw -padx 4
incr col
}
incr row
if { $image != "" } {
grid rowconfigure $frame $row -minsize 7
incr row
# Intensity range
label $frame.range -bg $powbg -text "Range:" -font g_titleFont
grid $frame.range -in $frame -row $row -column 2 -sticky e
frame $frame.rng -bg $powbg
entry $frame.rng.min -relief sunken -bg $powbg -width 12 \
-textvariable powEditImageParam(RBmin${image},new) -font g_titleFont
label $frame.rng.to -bg $powbg -text "-" -font g_titleFont
entry $frame.rng.max -relief sunken -bg $powbg -width 12 \
-textvariable powEditImageParam(RBmax${image},new) -font g_titleFont
button $frame.rng.reset -bg $powbg \
-text "Reset to [format "%.6g-%.6g" $powRBmin($image) \
$powRBmax($image)]" \
-command "
set powEditImageParam(RBmin${image},new) $powRBmin($image)
set powEditImageParam(RBmax${image},new) $powRBmax($image)
" -font g_titleFont
# label $frame.rng.orig -bg $powbg \
# -text "Orig:
pack $frame.rng.min -side left
pack $frame.rng.to -side left
pack $frame.rng.max -side left
pack $frame.rng.reset -side left -padx 10
grid $frame.rng -in $frame -row $row -column 3 -columnspan 4\
-sticky news -padx 4
}
grid rowconfigure $frame $row -minsize 5
incr row
grid columnconfigure $frame 1 -minsize 10
grid columnconfigure $frame 0 -minsize 5
grid columnconfigure $frame [list 3 4 5 6] -weight 1
}
########################################################################
#
# Listbox manipulation
#
proc powEditAddElems { } {
global powEditGraphname
global powEditPlotParam powEditCurveParam
global powDWP
set elemNo [${powDWP}gEdit.elemList.lst curselection]
if { $elemNo != "" } {
set item [${powDWP}gEdit.elemList.lst get $elemNo]
${powDWP}gEdit.elemList.lst delete $elemNo
if { [${powDWP}gEdit.elemList.lst size]<=$elemNo } {
${powDWP}gEdit.elemList.lst selection set end
} else {
${powDWP}gEdit.elemList.lst selection set $elemNo
}
${powDWP}gEdit.graphList.lst insert end $item
${powDWP}gEdit.graphList.lst selection clear 0 end
${powDWP}gEdit.graphList.lst selection set end
foreach {name type} [split $item { }] {}
if { $type=="(curve)" } {
if { $powEditPlotParam(curves,new)=="NULL" } {
set powEditPlotParam(curves,new) $name
} else {
lappend powEditPlotParam(curves,new) $name
}
} else {
if { $powEditPlotParam(images,new)=="NULL" } {
set powEditPlotParam(images,new) $name
} else {
lappend powEditPlotParam(images,new) $name
}
}
}
powEditBuildOptions
}
proc powEditRemoveElems { } {
global powEditGraphname
global powEditPlotParam powEditCurveParam
global powDWP
set graphNo [${powDWP}gEdit.graphList.lst curselection]
if { $graphNo=="" } return
if { $graphNo != "" } {
set item [${powDWP}gEdit.graphList.lst get $graphNo]
${powDWP}gEdit.graphList.lst delete $graphNo
if { [${powDWP}gEdit.graphList.lst size]<=$graphNo } {
${powDWP}gEdit.graphList.lst selection set end
} else {
${powDWP}gEdit.graphList.lst selection set $graphNo
}
${powDWP}gEdit.elemList.lst insert end $item
${powDWP}gEdit.elemList.lst selection clear 0 end
${powDWP}gEdit.elemList.lst selection set end
foreach {name type} [split $item { }] {}
if { $type=="(curve)" } {
set i [lsearch -exact $powEditPlotParam(curves,new) $name]
if { [llength $powEditPlotParam(curves,new)]==1 } {
set powEditPlotParam(curves,new) NULL
} else {
set powEditPlotParam(curves,new) \
[lreplace $powEditPlotParam(curves,new) $i $i]
}
} else {
set i [lsearch -exact $powEditPlotParam(images,new) $name]
if { [llength $powEditPlotParam(images,new)]==1 } {
set powEditPlotParam(images,new) NULL
} else {
set powEditPlotParam(images,new) \
[lreplace $powEditPlotParam(images,new) $i $i]
}
}
}
powEditBuildOptions
}
proc powEditUpdateListboxes { } {
global powEditGraphname
global powEditPlotParam powEditCurveParam
global powDWP
${powDWP}gEdit.graphList.lst delete 0 end
${powDWP}gEdit.elemList.lst delete 0 end
set curves ""
set images ""
foreach item $powEditPlotParam(curves,new) {
if {$item!="NULL"} {
${powDWP}gEdit.graphList.lst insert end "${item} (curve)"
lappend curves $item
}
}
foreach item $powEditPlotParam(images,new) {
if {$item!="NULL"} {
${powDWP}gEdit.graphList.lst insert end "${item} (image)"
lappend images $item
}
}
foreach item [powListCurves] {
if { [lsearch -exact $curves $item]==-1 } {
${powDWP}gEdit.elemList.lst insert end "${item} (curve)"
}
}
foreach item [powListImages] {
if { [lsearch -exact $images $item]==-1 } {
${powDWP}gEdit.elemList.lst insert end "${item} (image)"
}
}
if { [${powDWP}gEdit.elemList.lst size]>0 } {
${powDWP}gEdit.elemList.lst selection set 0
}
if { [${powDWP}gEdit.graphList.lst size]>0 } {
${powDWP}gEdit.graphList.lst selection set 0
}
}
########################################################################
#
# Variable management
#
proc powEditInitVariables { } {
global powEditGraphname powDWP
global powPlotParam powCurveParam powImageParam powFontParam
global powEditPlotParam powEditCurveParam powEditImageParam
global powEditFontParam
# Start fresh
catch {unset powEditPlotParam}
catch {unset powEditCurveParam}
catch {unset powEditImageParam}
catch {unset powEditFontParam}
foreach el [array names powPlotParam] {
set p1 [lindex [split $el ,] 0]
set p2 [lindex [split $el ,] 1]
if { $p2 == $powEditGraphname } {
set powEditPlotParam($p1,old) $powPlotParam($p1,$p2)
set powEditPlotParam($p1,new) $powPlotParam($p1,$p2)
}
}
set powEditPlotParam(scalData,new) No
# Hide some plot parameters
foreach el [list xo yo handletext FixedAspect regions] {
catch {unset powEditPlotParam($el,new)}
}
foreach el [array names powCurveParam] {
set p1 [lindex [split $el ,] 0]
set p2 [lindex [split $el ,] 1]
if { $p2 == $powEditGraphname } {
set powEditCurveParam($p1,old) $powCurveParam($p1,$p2)
set powEditCurveParam($p1,new) $powCurveParam($p1,$p2)
}
}
foreach el [array names powImageParam] {
set p1 [lindex [split $el ,] 0]
set p2 [lindex [split $el ,] 1]
if { $p2 == $powEditGraphname } {
set powEditImageParam($p1,old) $powImageParam($p1,$p2)
set powEditImageParam($p1,new) $powImageParam($p1,$p2)
}
}
foreach el [array names powFontParam] {
set p1 [lindex [split $el ,] 0]
set p2 [lindex [split $el ,] 1]
if { $p2 == $powEditGraphname } {
set powEditFontParam($p1,old) $powFontParam($p1,$p2)
set powEditFontParam($p1,new) $powFontParam($p1,$p2)
}
}
if { [winfo exists ${powDWP}gEdit] } {
powEditUpdateListboxes
}
}
proc powEditUpdateVariables { } {
global powEditGraphname
global powPlotParam powCurveParam powImageParam powFontParam
global powEditPlotParam powEditCurveParam powEditImageParam
global powEditFontParam
global powWCSLabel powEditObject
# Set default values of graph's curves if not already defined
# Must do this before updating powPlotParam
# because powEditCurveDefOptions references it
foreach crv $powEditPlotParam(curves,new) {
powEditCurveDefOptions $crv
}
foreach img $powEditPlotParam(images,new) {
powEditImageDefOptions $img
}
####
# Now update the global hashes for the modified graph
####
foreach el [array names powEditFontParam] {
set p1 [lindex [split $el ,] 0]
set p2 [lindex [split $el ,] 1]
if { $p2 == "new" } {
set powFontParam($p1,$powEditGraphname) $powEditFontParam($p1,new)
}
}
powEditConvertToAxes
foreach el [array names powEditPlotParam] {
set p1 [lindex [split $el ,] 0]
set p2 [lindex [split $el ,] 1]
if { $p2 == "new" } {
set powPlotParam($p1,$powEditGraphname) $powEditPlotParam($p1,new)
set powPlotParam($p1,${powEditGraphname}scope) $powEditPlotParam($p1,new)
switch $p1 {
"xunits" -
"yunits" -
"xlabel" -
"ylabel" {
set target $p1
if { [string first "unit" $p1] >= 0 } {
set target [string range $p1 0 4]
}
set powWCSLabel($target,$powEditGraphname,DEFAULT) $powEditPlotParam($p1,new)
}
}
}
}
unset powPlotParam(scalData,$powEditGraphname)
foreach el [array names powEditCurveParam] {
set p1 [lindex [split $el ,] 0]
set p2 [lindex [split $el ,] 1]
if { $p2 == "new" } {
set powCurveParam($p1,$powEditGraphname) $powEditCurveParam($p1,new)
set powCurveParam($p1,${powEditGraphname}scope) \
$powEditCurveParam($p1,new)
}
}
foreach img $powEditPlotParam(images,new) {
if { $img == "NULL" } continue
# Check for new colormap scaling
if { [info exists powImageParam(lut$img,$powEditGraphname)] \
&& $powImageParam(scale$img,$powEditGraphname) \
!= $powEditImageParam(scale$img,new) } {
unset powImageParam(lut$img,$powEditGraphname)
}
foreach {gn2 img2} [powGetColorbarLink $powEditGraphname $img] {}
foreach opt [eval list $powImageParam(allOpts,powDef) RBmin RBmax] {
set powImageParam(${opt}${img},$powEditGraphname) \
$powEditImageParam(${opt}${img},new)
set powImageParam(${opt}${img},${powEditGraphname}scope) \
$powEditImageParam(${opt}${img},new)
if { $gn2 != "" } {
set powImageParam(${opt}${img2},${gn2}) \
$powEditImageParam(${opt}${img},new)
set powImageParam(${opt}${img2},${gn2}scope) \
$powEditImageParam(${opt}${img},new)
}
}
if { $gn2 != "" } {
powSetColorTable $gn2 $img2
powReditherImage $gn2 $img2
}
}
}
########################################################################
proc powEditConvertToAxes {} {
global powEditPlotParam powEditCurveParam
if { $powEditPlotParam(scalData,new) } {
foreach crv $powEditPlotParam(curves,new) {
if { $crv=="NULL" } continue
if { $powEditPlotParam(xTickScal,new)=="log" } {
set powEditCurveParam(logX${crv},new) Yes
} else {
set powEditCurveParam(logX${crv},new) No
}
if { $powEditPlotParam(yTickScal,new)=="log" } {
set powEditCurveParam(logY${crv},new) Yes
} else {
set powEditCurveParam(logY${crv},new) No
}
}
}
}
########################################################################
proc powEditCurveDefOptions { curve } {
global powEditCurveParam powCurveParam powPlotParam
if { $curve == "NULL" || $curve == "" } return
set crvGraph ""
foreach opt $powCurveParam(allOpts,powDef) {
if {! [info exists powEditCurveParam(${opt}${curve},new)]} {
if { $crvGraph=="" } {
set crvGraph powDef
foreach grph [powListGraphs] {
if { [regexp "scope$" $grph] } continue
if { [lsearch -exact $powPlotParam(curves,$grph) $curve] \
!= -1 } {
set crvGraph $grph
}
}
}
if { $crvGraph=="powDef" } {
set powEditCurveParam(${opt}${curve},new) \
$powCurveParam(${opt},powDef)
set powEditCurveParam(${opt}${curve},old) \
$powCurveParam(${opt},powDef)
} else {
set powEditCurveParam(${opt}${curve},new) \
$powCurveParam(${opt}${curve},$crvGraph)
set powEditCurveParam(${opt}${curve},old) \
$powCurveParam(${opt}${curve},$crvGraph)
}
}
}
}
proc powEditImageDefOptions { image } {
global powEditImageParam powImageParam powPlotParam
global powRBmin powRBmax
if { $image == "NULL" || $image == "" } return
set imgGraph ""
foreach opt $powImageParam(allOpts,powDef) {
if {! [info exists powEditImageParam(${opt}${image},new)]} {
if { $imgGraph=="" } {
set imgGraph powDef
foreach grph [powListGraphs] {
if { [regexp "scope$" $grph] } continue
if { [lsearch -exact $powPlotParam(images,$grph) $image] \
!= -1 } {
set imgGraph $grph
}
}
}
if { $imgGraph=="powDef" } {
set powEditImageParam(${opt}${image},new) \
$powImageParam(${opt},powDef)
set powEditImageParam(${opt}${image},old) \
$powImageParam(${opt},powDef)
} else {
set powEditImageParam(${opt}${image},new) \
$powImageParam(${opt}${image},$imgGraph)
set powEditImageParam(${opt}${image},old) \
$powImageParam(${opt}${image},$imgGraph)
}
}
}
# Must also worry about RBmin and RBmax which don't have powDef defaults
if {! [info exists powEditImageParam(RBmin${image},new)]} {
if { $imgGraph=="" || $imgGraph=="powDef" } {
set powEditImageParam(RBmin${image},new) \
$powRBmin($image)
set powEditImageParam(RBmin${image},old) \
$powRBmin($image)
set powEditImageParam(RBmax${image},new) \
$powRBmax($image)
set powEditImageParam(RBmax${image},old) \
$powRBmax($image)
} else {
set powEditImageParam(RBmin${image},new) \
$powImageParam(RBmin${image},$imgGraph)
set powEditImageParam(RBmin${image},old) \
$powImageParam(RBmin${image},$imgGraph)
set powEditImageParam(RBmax${image},new) \
$powImageParam(RBmax${image},$imgGraph)
set powEditImageParam(RBmax${image},old) \
$powImageParam(RBmax${image},$imgGraph)
}
}
}
###########################################################################
# #
# Routines for editting Objects #
# #
###########################################################################
proc powEditObjectDlg { } {
global powPlotParam powCurveParam powbg
global powEditObject
global powDWP
global g_titleFont
if {[winfo exists ${powDWP}object]} {destroy ${powDWP}object}
powToplevel ${powDWP}object .pow "-bg $powbg"
bind ${powDWP}object <<CloseWindow>> "powEditExitObjDlg"
catch {wm title ${powDWP}object "Edit Objects"}
label ${powDWP}object.objectCont -text "All Objects:" -fg black -bg yellow -font g_titleFont
frame ${powDWP}object.objectList -bg $powbg
scrollbar ${powDWP}object.objectList.scrolly -orient vertical -takefocus 0 \
-command {${powDWP}object.objectList.lst yview} -bg $powbg
listbox ${powDWP}object.objectList.lst -bg $powbg -width 25 -height 6 \
-selectmode browse -exportselection 0 -takefocus 0 \
-yscrollcommand {${powDWP}object.objectList.scrolly set } -font g_titleFont
bind ${powDWP}object.objectList.lst <ButtonRelease-1> \
{ powEditUpdateObject }
grid ${powDWP}object.objectList.lst -in ${powDWP}object.objectList \
-row 1 -column 1 -sticky news
grid ${powDWP}object.objectList.scrolly -in ${powDWP}object.objectList \
-row 1 -column 2 -sticky news
grid rowconfigure ${powDWP}object.objectList 1 -weight 1
grid columnconfigure ${powDWP}object.objectList 1 -weight 1
label ${powDWP}object.dataCont -text "All Data:" -fg black -bg yellow -font g_titleFont
frame ${powDWP}object.dataList -bg $powbg
scrollbar ${powDWP}object.dataList.scrolly -orient vertical -takefocus 0 \
-command {${powDWP}object.dataList.lst yview} -bg $powbg
listbox ${powDWP}object.dataList.lst -bg $powbg -width 25 -height 6 \
-selectmode browse -exportselection 0 -takefocus 0 \
-yscrollcommand {${powDWP}object.dataList.scrolly set } -font g_titleFont
grid ${powDWP}object.dataList.lst -in ${powDWP}object.dataList -row 1 -column 1 \
-sticky news
grid ${powDWP}object.dataList.scrolly -in ${powDWP}object.dataList -row 1 -column 2 \
-sticky news
grid rowconfigure ${powDWP}object.dataList 1 -weight 1
grid columnconfigure ${powDWP}object.dataList 1 -weight 1
button ${powDWP}object.help -bg $powbg -text "Help" \
-command {powHelp EditObjects.html} -takefocus 0 -font g_titleFont
grid ${powDWP}object.objectCont -in ${powDWP}object -row 1 -column 1 -sticky w \
-padx 5 -pady 5
grid ${powDWP}object.objectList -in ${powDWP}object -row 2 -column 1 -sticky news
grid ${powDWP}object.help -in ${powDWP}object -row 1 -column 2
grid ${powDWP}object.dataCont -in ${powDWP}object -row 1 -column 3 -sticky w \
-padx 5 -pady 5
grid ${powDWP}object.dataList -in ${powDWP}object -row 2 -column 3 -sticky news
button ${powDWP}object.editData -text "Edit Data" -bg $powbg -takefocus 0 \
-command {
if { [info exists powDontPush] } {
puts "I told you not to push that button again."
} else {
puts "Don't push that button again."
set powDontPush 1
}
} -font g_titleFont
grid ${powDWP}object.editData -in ${powDWP}object -row 3 -column 3 -sticky n -pady 2
frame ${powDWP}object.objectName -bg $powbg
label ${powDWP}object.objectName.lab -bg yellow -fg black -text "Object Name:" -font g_titleFont
entry ${powDWP}object.objectName.ent -textvariable powEditObject(name) \
-bg $powbg -font g_titleFont
pack ${powDWP}object.objectName.lab -in ${powDWP}object.objectName -side left
pack ${powDWP}object.objectName.ent -in ${powDWP}object.objectName -side left -padx 5
grid ${powDWP}object.objectName -in ${powDWP}object -row 3 -column 1 \
-columnspan 2 -sticky w -padx 18
frame ${powDWP}object.objectType -bg $powbg -relief ridge -bd 3
label ${powDWP}object.objectType.lab -bg yellow -fg black -text "Object Type:" -font g_titleFont
radiobutton ${powDWP}object.objectType.curve -bg $powbg -text Curve \
-variable powEditObject(type) -value "(curve)" \
-highlightthickness 0 -takefocus 0 -font g_titleFont
radiobutton ${powDWP}object.objectType.image -bg $powbg -text Image \
-variable powEditObject(type) -value "(image)" \
-highlightthickness 0 -takefocus 0 -font g_titleFont
set powEditObject(type) "(curve)"
pack ${powDWP}object.objectType.lab -in ${powDWP}object.objectType -side left
pack ${powDWP}object.objectType.curve -in ${powDWP}object.objectType \
-side left -padx 10
pack ${powDWP}object.objectType.image -in ${powDWP}object.objectType \
-side left -padx 10
grid ${powDWP}object.objectType -in ${powDWP}object -row 4 -column 1 -sticky sew \
-columnspan 3 -padx 15
frame ${powDWP}object.btns -bg $powbg
button ${powDWP}object.btns.create -text "Create Object" -bg $powbg \
-command {powEditCreateObject} -font g_titleFont
button ${powDWP}object.btns.reload -text "Reload Info" -bg $powbg \
-command {powEditLoadObjects; powEditBuildObject} -font g_titleFont
button ${powDWP}object.btns.exit -text "Exit" -bg $powbg \
-command powEditExitObjDlg -font g_titleFont
pack ${powDWP}object.btns.create -in ${powDWP}object.btns -side left \
-padx 5 -pady 2
pack ${powDWP}object.btns.reload -in ${powDWP}object.btns -side left \
-padx 5 -pady 2
pack ${powDWP}object.btns.exit -in ${powDWP}object.btns -side left \
-padx 5 -pady 2
grid ${powDWP}object.btns -in ${powDWP}object -row 6 -column 1 -columnspan 3 \
-pady 5
grid rowconfigure ${powDWP}object 2 -weight 1
grid rowconfigure ${powDWP}object 5 -weight 1
grid columnconfigure ${powDWP}object 1 -weight 1
grid columnconfigure ${powDWP}object 3 -weight 1
powEditLoadObjects
powEditBuildObject
trace variable powEditObject(type) w powChangeBuildObject
}
proc powEditExitObjDlg { } {
global powDWP
destroy ${powDWP}object
}
proc powEditLoadObjects { {init 1} } {
global powDWP
${powDWP}object.objectList.lst delete 0 end
${powDWP}object.dataList.lst delete 0 end
set last "NULL (curve)"
foreach itm [powListCurves] {
set last "$itm (curve)"
${powDWP}object.objectList.lst insert end $last
}
foreach itm [powListImages] {
set last "$itm (image)"
${powDWP}object.objectList.lst insert end $last
}
foreach itm [powListData] {
${powDWP}object.dataList.lst insert end "$itm ([powFetchDataLength $itm])"
}
${powDWP}object.dataList.lst insert end "NULL (0)"
${powDWP}object.dataList.lst selection set 0
if {$init} {
${powDWP}object.objectList.lst selection set end
eval [concat powEditInitObject $last]
}
}
proc powEditInitObject { obj typ } {
global powEditObject powWCS
global powRotation
if {$typ == "(curve)"} {
set loc [lsearch -exact [powListCurves] $obj]
} else {
set loc [lsearch -exact [powListImages] $obj]
}
set powEditObject(name) $obj
set powEditObject(type) $typ
# Initialize all the entries to standard default NULLS or values
foreach el [list xdata xedata xunits ydata yedata yunits \
zdata zedata zunits] {
set powEditObject($el) NULL
}
foreach el [list xdim ydim xorigin yorigin xinc yinc] {
set powEditObject($el) 1
}
set powEditObject(wcs) 0
foreach el [list xref yref xrefpix yrefpix xinc yinc rot ctype] {
set powEditObject(wcs$el) " "
}
if ![info exists powRotation($obj)] {
set powRotation($obj) 0.0
#powChangeFitsHeaderKeyWordValue $obj {"CROAT2"} "X" $powRotation($obj)
}
set powEditObject(wcsrot) $powRotation($obj)
# Now fill in the known quantities
if { $obj!="NULL" && $loc!=-1 } {
if { $typ=="(image)" } {
array set powEditObject [powFetchImageInfoHash $obj]
set powEditObject(xdata) $powEditObject(data)
set powEditObject(xdim) $powEditObject(width)
set powEditObject(ydim) $powEditObject(height)
} else {
array set powEditObject [powFetchCurveInfoHash $obj]
foreach {vec lc} {X x Y y XE xe YE ye} {
if { $powEditObject($vec) != "NULL" } {
array set tmpArray \
[powFetchVectorInfoHash $powEditObject($vec)]
set powEditObject(${lc}data) $tmpArray(data)
set powEditObject(${lc}units) $tmpArray(units)
} else {
set powEditObject(${lc}data) NULL
set powEditObject(${lc}units) NULL
}
}
}
if {[info exists powWCS($obj)] && $powWCS($obj) != "" } {
set powEditObject(wcs) 1
set wcslist $powWCS($obj)
# wcsinfo : {xrefvalue yrefvalue} {xrefpix yrefpix} {cdelt} {unit} {type}
set powEditObject(wcsxref) [lindex [lindex $wcslist 0] 0]
set powEditObject(wcsyref) [lindex [lindex $wcslist 0] 1]
set powEditObject(wcsxrefpix) [lindex [lindex $wcslist 1] 0]
set powEditObject(wcsyrefpix) [lindex [lindex $wcslist 1] 1]
set powEditObject(wcsxinc) [lindex [lindex $wcslist 2] 0]
set powEditObject(wcsxrot_cal) [lindex [lindex $wcslist 2] 1]
set powEditObject(wcsyrot_cal) [lindex [lindex $wcslist 2] 2]
set powEditObject(wcsyinc) [lindex [lindex $wcslist 2] 3]
set powEditObject(wcsxunit) [lindex [lindex $wcslist 3] 0]
set powEditObject(wcsyunit) [lindex [lindex $wcslist 3] 1]
set powEditObject(wcsctype) [lindex [lindex $wcslist 4] 0]
}
}
}
proc powEditCreateObject { } {
global powEditObject powWCS powFitsHeader powFitsHeaderCnt
global powDWP g_magification powPlotParam powRotation
global xCount yCount
set obj $powEditObject(name)
set wcslist {}
if { $powEditObject(wcs) } {
set wcsxinc $powEditObject(wcsxinc)
set wcsyinc $powEditObject(wcsyinc)
if { $powRotation($obj) != 0.0 } {
# restore xinc yinc back to rotation 0.0 degree
set wcsxinc [expr $powEditObject(wcsxrot_cal) / cos($powRotation($obj))]
set wcsyinc [expr $powEditObject(wcsyrot_cal) / sin($powRotation($obj))]
}
# get user input rotation
set powRotation($obj) $powEditObject(wcsrot)
set powEditObject(wcsxrot_cal) [expr $wcsxinc * cos($powRotation($obj))]
set powEditObject(wcsyrot_cal) [expr $wcsyinc * sin($powRotation($obj))]
lappend wcslist [list $powEditObject(wcsxref) $powEditObject(wcsyref)]
lappend wcslist [list $powEditObject(wcsxrefpix) $powEditObject(wcsyrefpix)]
lappend wcslist [list $powEditObject(wcsxinc) $powEditObject(wcsxrot_cal) \
$powEditObject(wcsyrot_cal) $powEditObject(wcsyinc)]
lappend wcslist [list $powEditObject(wcsxunit) $powEditObject(wcsyunit)]
lappend wcslist [list $powEditObject(wcsctype) $powEditObject(wcsctype)]
set graphHandle $obj
if { $powEditObject(type)=="(curve)" } {
# get rid of "c1_" for curve
set graphHandle [string range $obj 3 end]
}
powChangeFitsHeaderKeyWordValue $graphHandle {"CTYPE1" "CTYPE2" "CDELT1" "CDELT2" "CROTA2" } \
"X" \
[list [format "RA--%s" $powEditObject(wcsctype)] \
[format "DEC-%s" $powEditObject(wcsctype)] \
$powEditObject(wcsxinc) \
$powEditObject(wcsyinc) \
$powRotation($obj)] \
[list $powEditObject(wcsxref) $powEditObject(wcsyref)]
set powFitsHeader($obj) $powFitsHeader($graphHandle)
set powFitsHeaderCnt($obj) $powFitsHeaderCnt($graphHandle)
}
set powFitsHeader(${obj}scope) $powFitsHeader($obj)
set powFitsHeaderCnt(${obj}scope) $powFitsHeaderCnt($obj)
set powWCS($obj) $wcslist
set powWCS(${obj}scope) $wcslist
if { $powEditObject(type)=="(curve)" } {
set powFitsHeaderStr $powFitsHeader($obj)
set powFitsHeaderCntValue $powFitsHeaderCnt($obj)
catch { powDeleteGraph $graphHandle NOPROMPT
powDeleteImage $graphHandle $graphHandle
powDeleteCurve $graphHandle curve }
set powWCS($obj) $wcslist
set powWCS($graphHandle) $wcslist
set powWCS(${graphHandle}scope) $wcslist
set powFitsHeader($obj) $powFitsHeaderStr
set powFitsHeaderCnt($obj) $powFitsHeaderCntValue
set powFitsHeader(${graphHandle}scope) $powFitsHeaderStr
set powFitsHeaderCnt(${graphHandle}scope) $powFitsHeaderCntValue
set powFitsHeader($graphHandle) $powFitsHeader($obj)
set powFitsHeaderCnt($graphHandle) $powFitsHeaderCnt($obj)
set powPlotParam(graphType,$obj) "binary"
set powPlotParam(graphType,${obj}scope) "binary"
set powPlotParam(graphType,$graphHandle) "binary"
set powPlotParam(graphType,${graphHandle}scope) "binary"
set powPlotParam(zoomed,${graphHandle}) 0
set powPlotParam(zoomed,${graphHandle}scope) 0
set powPlotParam(zoomed,${obj}) 0
set powPlotParam(zoomed,${obj}scope) 0
set xCount(${obj}) 0
set yCount(${obj}) 0
set xCount(${obj}scope) 0
set yCount(${obj}scope) 0
set xCount(${graphHandle}) 0
set yCount(${graphHandle}) 0
set xCount(${graphHandle}scope) 0
set yCount(${graphHandle}scope) 0
set vectors ""
foreach vec { x xe y ye } {
if { $powEditObject(${vec}data) == "NULL" } {
lappend vectors NULL
} else {
powCreateVector ${obj}_${vec}data $powEditObject(${vec}data) 0 \
NULL $powEditObject(${vec}units)
lappend vectors ${obj}_${vec}data
}
}
eval [concat powCreateCurve $obj $vectors]
eval [concat powCreateGraph $graphHandle $obj NULL \
NULL NULL \
$powPlotParam(xlabel,$graphHandle) \
$powPlotParam(ylabel,$graphHandle) \
[lindex $fvPref::graphDispSize 0] \
[lindex $fvPref::graphDispSize 1]]
} else {
if { $powEditObject(wcs) } {
powCreateImage $obj $powEditObject(xdata) \
0 0 \
$powEditObject(xdim) $powEditObject(ydim) \
1 1 1 1 \
$powEditObject(xunits) $powEditObject(yunits) \
$powEditObject(zunits)
} else {
powCreateImage $obj $powEditObject(xdata) \
0 0 \
$powEditObject(xdim) $powEditObject(ydim) \
$powEditObject(xorigin) $powEditObject(xinc) \
$powEditObject(yorigin) $powEditObject(yinc) \
$powEditObject(xunits) $powEditObject(yunits) \
$powEditObject(zunits)
}
powEndROI 1
}
powEditLoadObjects 0
set elem "$obj $powEditObject(type)"
set num [lsearch -exact [${powDWP}object.objectList.lst get 0 end] $elem]
${powDWP}object.objectList.lst selection set $num
eval [concat powEditInitObject $elem]
}
proc powEditUpdateObject { } {
global powDWP
set itm [${powDWP}object.objectList.lst curselection]
if {$itm==""} {
powEditInitObject NULL "(curve)"
} else {
eval [concat powEditInitObject [${powDWP}object.objectList.lst get $itm]]
}
powEditBuildObject
}
proc powChangeBuildObject { a b c } {
powEditBuildObject
}
proc powEditBuildObject { } {
global powEditObject powbg
global powDWP
if { $powEditObject(type)=="(curve)" } {
powEditBuildCurve ${powDWP}object.curveFrame
${powDWP}object.curveFrame configure -borderwidth 3 -relief ridge
grid ${powDWP}object.curveFrame -in ${powDWP}object -row 5 -column 1 \
-padx 15 -pady 5 -columnspan 3 -sticky news
catch {grid remove ${powDWP}object.imageFrame}
} else {
powEditBuildImage ${powDWP}object.imageFrame
${powDWP}object.imageFrame configure -borderwidth 3 -relief ridge
grid ${powDWP}object.imageFrame -in ${powDWP}object -row 5 -column 1 \
-padx 15 -pady 5 -columnspan 3 -sticky news
catch {grid remove ${powDWP}object.curveFrame}
}
}
proc powEditUpdateDataButton { btn var } {
global powEditObject
global powDWP
set elem [${powDWP}object.dataList.lst curselection]
if { $elem=="" } return
set data [lindex [${powDWP}object.dataList.lst get $elem] 0]
set powEditObject($var) $data
$btn configure -text $data
}
proc powEditBuildCurve { frame } {
global powEditObject powbg
global g_titleFont
if { [winfo exists $frame] } {
foreach {lbl var} [list Data: data Error: edata] {
$frame.bx$var configure -text $powEditObject(x$var)
$frame.by$var configure -text $powEditObject(y$var)
}
return
}
frame $frame -bg $powbg
set row 1
grid columnconfigure $frame 1 -minsize 10
grid columnconfigure $frame 4 -minsize 10
label $frame.x -bg $powbg -text X -font g_titleFont
label $frame.y -bg $powbg -text Y -font g_titleFont
grid $frame.x -in $frame -row $row -column 3 -sticky s
grid $frame.y -in $frame -row $row -column 5 -sticky s
incr row
# Create data buttons
foreach {lbl var} [list Data: data Error: edata] {
label $frame.l$var -bg $powbg -text $lbl -font g_titleFont
grid $frame.l$var -in $frame -row $row -column 2 -sticky e -padx 10
button $frame.bx$var -bg $powbg -text $powEditObject(x$var) \
-command "powEditUpdateDataButton $frame.bx$var x$var" -font g_titleFont
button $frame.by$var -bg $powbg -text $powEditObject(y$var) \
-command "powEditUpdateDataButton $frame.by$var y$var" -font g_titleFont
grid $frame.bx$var -in $frame -row $row -column 3 -sticky news
grid $frame.by$var -in $frame -row $row -column 5 -sticky news
incr row
}
foreach {lbl var} [list Units: units] {
label $frame.l$var -bg $powbg -text $lbl -font g_titleFont
grid $frame.l$var -in $frame -row $row -column 2 -sticky e -padx 10
entry $frame.ex$var -bg $powbg -textvariable powEditObject(x$var) \
-takefocus 1 -font g_titleFont
entry $frame.ey$var -bg $powbg -textvariable powEditObject(y$var) \
-takefocus 1 -font g_titleFont
grid $frame.ex$var -in $frame -row $row -column 3 -sticky news
grid $frame.ey$var -in $frame -row $row -column 5 -sticky news
incr row
}
grid rowconfigure $frame $row -minsize 10
incr row
powEditBuildWCS $frame $row
}
proc powEditBuildImage { frame } {
global powEditObject powbg
global g_titleFont
if { [winfo exists $frame] } {
$frame.bdata configure -text $powEditObject(xdata)
return
}
frame $frame -bg $powbg
set row 1
grid columnconfigure $frame 1 -minsize 10
grid columnconfigure $frame 4 -minsize 10
label $frame.ldata -bg $powbg -text "Data:" -font g_titleFont
grid $frame.ldata -in $frame -row $row -column 2 -sticky e -padx 10
button $frame.bdata -bg $powbg -text $powEditObject(xdata) \
-command "powEditUpdateDataButton $frame.bdata xdata;
set powEditObject(ydim) 1;
set powEditObject(xdim) \
\[powFetchDataLength \$powEditObject(xdata)\]" -font g_titleFont
grid $frame.bdata -in $frame -row $row -column 3 -sticky w -columnspan 3
incr row
label $frame.lzunits -bg $powbg -text "Units:" -font g_titleFont
grid $frame.lzunits -in $frame -row $row -column 2 -sticky e -padx 10
entry $frame.ezunits -bg $powbg -textvariable powEditObject(zunits) \
-takefocus 1 -font g_titleFont
grid $frame.ezunits -in $frame -row $row -column 3 -sticky w
incr row
grid rowconfigure $frame $row -minsize 10
incr row
label $frame.x -bg $powbg -text X -font g_titleFont
label $frame.y -bg $powbg -text Y -font g_titleFont
grid $frame.x -in $frame -row $row -column 3 -sticky s
grid $frame.y -in $frame -row $row -column 5 -sticky s
incr row
foreach {lbl var} \
[list Dimensions: dim Origin: origin "Pixel Size:" inc Units: units] {
label $frame.l$var -bg $powbg -text $lbl -font g_titleFont
grid $frame.l$var -in $frame -row $row -column 2 -sticky e -padx 10
entry $frame.ex$var -bg $powbg -textvariable powEditObject(x$var) \
-takefocus 1 -font g_titleFont
entry $frame.ey$var -bg $powbg -textvariable powEditObject(y$var) \
-takefocus 1 -font g_titleFont
grid $frame.ex$var -in $frame -row $row -column 3 -sticky news
grid $frame.ey$var -in $frame -row $row -column 5 -sticky news
incr row
}
grid rowconfigure $frame $row -minsize 10
incr row
powEditBuildWCS $frame $row
}
proc powEditBuildWCS { frame row } {
global powEditObject powbg
global g_titleFont
# Build WCS entries
checkbutton $frame.wcs -bg $powbg -text "WCS Info -" \
-highlightthickness 0 -takefocus 0 \
-variable powEditObject(wcs) -font g_titleFont
grid $frame.wcs -in $frame -row $row -column 1 -columnspan 2 -sticky w
incr row
foreach {lbl var} \
[list "Ref Value:" ref "Ref Pixel:" refpix "Pixel Scale:" inc] {
label $frame.lw$var -bg $powbg -text $lbl -font g_titleFont
grid $frame.lw$var -in $frame -row $row -column 2 -sticky e -padx 10
entry $frame.ewx$var -bg $powbg -textvariable powEditObject(wcsx$var) \
-takefocus 1 -font g_titleFont
entry $frame.ewy$var -bg $powbg -textvariable powEditObject(wcsy$var) \
-takefocus 1 -font g_titleFont
grid $frame.ewx$var -in $frame -row $row -column 3 -sticky news
grid $frame.ewy$var -in $frame -row $row -column 5 -sticky news
incr row
}
label $frame.lrot -bg $powbg -text "Rotation:" -font g_titleFont
grid $frame.lrot -in $frame -row $row -column 2 -sticky e -padx 10
entry $frame.erot -bg $powbg -textvariable powEditObject(wcsrot) \
-takefocus 1 -font g_titleFont
grid $frame.erot -in $frame -row $row -column 3 -sticky news
incr row
label $frame.lproj -bg $powbg -text "Projection:" -font g_titleFont
grid $frame.lproj -in $frame -row $row -column 2 -sticky ne -padx 10
set pcol 1
set prow 1
frame $frame.projType -bg $powbg
foreach {lbl val} \
{AZP "-AZP" SZP "-SZP" TAN "-TAN" STG "-STG" SIN "-SIN" ARC "-ARC" ZPN "-ZPN" \
ZEA "-ZEA" AIR "-AIR" CYP "-CYP" CEA "-CEA" CAR "-CAR" MER "-MER" COP "-COP" \
COE "-COE" COD "-COD" COO "-COO" SFL "-SFL" PAR "-PAR" MOL "-MOL" AIT "-AIT" \
BON "-BON" PCO "-PCO" TSC "-TSC" CSC "-CSC" QSC "-QSC" HPX "-HPX" NCP "-NCP"} {
if {$pcol==5} {set pcol 1; incr prow}
radiobutton $frame.projType.p$lbl -bg $powbg -text $lbl \
-variable powEditObject(wcsctype) -value $val \
-highlightthickness 0 -takefocus 0 -font g_titleFont
grid $frame.projType.p$lbl -in $frame.projType \
-row $prow -column $pcol -sticky nw -padx 6
incr pcol
}
grid $frame.projType -in $frame -row $row -column 3 -columnspan 3 -sticky w
incr row
}
########################################################################
# #
# Functions to set Default Display Options #
# #
########################################################################
proc powDefaultOptions { } {
global currgn powbg
global powPlotParam powEditPlotParam powEditGraphname
global powCurveParam powEditCurveParam
global powImageParam powEditImageParam
global powDWP
global g_titleFont
if {[winfo exists ${powDWP}default]} {destroy ${powDWP}default}
powToplevel ${powDWP}default .pow "-bg $powbg"
bind ${powDWP}default <<CloseWindow>> "powEditExitDefDlg"
catch {wm title ${powDWP}default "POW Preferences"}
set powEditGraphname powDef
powEditInitDefVariables
set note ${powDWP}default.nBook
Notebook:create $note -pages {POW Graph Fonts Ticks Points Lines Images} \
-pad 4 -bg $powbg
set w [Notebook:frame $note POW]
powEditBuildPOWOptions $w
set w [Notebook:frame $note Graph]
powEditBuildGraphOptions $w
set w [Notebook:frame $note Fonts]
powEditBuildFontOptions $w
set w [Notebook:frame $note Ticks]
powEditBuildTickOptions $w
set w [Notebook:frame $note Points]
powEditBuildCurveOptions1 $w ""
set w [Notebook:frame $note Lines]
powEditBuildCurveOptions2 $w ""
set w [Notebook:frame $note Images]
powEditBuildImageOptions $w ""
# Setup Buttons
button ${powDWP}default.help -text "Help" \
-command {powHelp DefaultOptions.html} \
-bg $powbg -takefocus 0 -font g_titleFont
frame ${powDWP}default.buttons -bg $powbg
button ${powDWP}default.buttons.save -text "Save" -bg $powbg \
-command {powEditUpdateDefVariables; powSaveConfig} -font g_titleFont
button ${powDWP}default.buttons.curr -text "Get Current" -bg $powbg \
-command {powEditGetCurrVariables} -font g_titleFont
button ${powDWP}default.buttons.reset -text "Reset" -bg $powbg \
-command powEditInitDefVariables -font g_titleFont
button ${powDWP}default.buttons.exit -text "Exit" -bg $powbg \
-command { powEditExitDefDlg } -font g_titleFont
pack ${powDWP}default.buttons.save -side left -padx 4 -pady 3
pack ${powDWP}default.buttons.curr -side left -padx 4 -pady 3
pack ${powDWP}default.buttons.reset -side left -padx 4 -pady 3
pack ${powDWP}default.buttons.exit -side left -padx 4 -pady 3
label ${powDWP}default.lab -bg $powbg \
-text "Default options for new graphs:" -font g_titleFont
# Place everything into dialog
grid ${powDWP}default.help -in ${powDWP}default -row 1 -column 1 -sticky ne
grid ${powDWP}default.lab -in ${powDWP}default -row 2 -column 1
grid ${powDWP}default.nBook -in ${powDWP}default -row 3 -column 1 \
-sticky news -padx 15 -pady 10
grid ${powDWP}default.buttons -in ${powDWP}default -row 4 -column 1 -pady 8
Notebook:resize $note
}
proc powEditExitDefDlg { } {
global powDWP
powEditUpdateDefVariables
destroy ${powDWP}default
}
proc powEditInitDefVariables {} {
global powPlotParam powEditPlotParam
global powCurveParam powEditCurveParam
global powImageParam powEditImageParam
global powFontParam powEditFontParam
global powEditAppParam
foreach opt $powPlotParam(allOpts,powDef) {
set powEditPlotParam(${opt},new) $powPlotParam(${opt},powDef)
}
foreach opt $powCurveParam(allOpts,powDef) {
set powEditCurveParam(${opt},new) $powCurveParam(${opt},powDef)
}
foreach opt $powImageParam(allOpts,powDef) {
set powEditImageParam(${opt},new) $powImageParam(${opt},powDef)
}
foreach opt $powFontParam(allOpts,powDef) {
foreach lbl $powFontParam(allTypes,powDef) {
set powEditFontParam(${lbl}${opt},new) \
$powFontParam(${lbl}${opt},powDef)
}
}
foreach opt [list bg cursor ResizeMain GUIposition ScopeSize ] {
set powEditAppParam(${opt},new) [subst \$::pow$opt]
}
}
proc powEditGetCurrVariables {} {
global powPlotParam powEditPlotParam currgn currimg
global powCurveParam powEditCurveParam
global powImageParam powEditImageParam
global powFontParam powEditFontParam
if { ![info exists currgn] || $currgn=="powDef" } return
foreach opt $powPlotParam(allOpts,powDef) {
set powEditPlotParam(${opt},new) $powPlotParam(${opt},$currgn)
}
if { [info exists currimg] && $currimg != "" } {
foreach opt $powImageParam(allOpts,powDef) {
set powEditImageParam(${opt},new) \
$powImageParam(${opt}${currimg},$currgn)
}
}
set crv [lindex $powPlotParam(curves,$currgn) 0]
if { $crv != "NULL" } {
foreach opt $powCurveParam(allOpts,powDef) {
set powEditCurveParam(${opt},new) \
$powCurveParam(${opt}${crv},$currgn)
}
}
foreach opt $powFontParam(allOpts,powDef) {
foreach lbl $powFontParam(allTypes,powDef) {
set powEditFontParam(${lbl}${opt},new) \
$powFontParam(${lbl}${opt},$currgn)
}
}
}
proc powEditUpdateDefVariables {} {
global powPlotParam powEditPlotParam
global powCurveParam powEditCurveParam
global powImageParam powEditImageParam
global powFontParam powEditFontParam
global powEditAppParam
foreach opt $powPlotParam(allOpts,powDef) {
set powPlotParam(${opt},powDef) $powEditPlotParam(${opt},new)
}
foreach opt $powCurveParam(allOpts,powDef) {
set powCurveParam(${opt},powDef) $powEditCurveParam(${opt},new)
}
foreach opt $powImageParam(allOpts,powDef) {
set powImageParam(${opt},powDef) $powEditImageParam(${opt},new)
}
foreach opt $powFontParam(allOpts,powDef) {
foreach lbl $powFontParam(allTypes,powDef) {
set powFontParam(${lbl}${opt},powDef) \
$powEditFontParam(${lbl}${opt},new)
}
}
foreach opt [list bg cursor ResizeMain GUIposition ScopeSize ] {
if { [subst \$::pow$opt] != $powEditAppParam(${opt},new) } {
powSetGlobal_$opt $powEditAppParam(${opt},new)
}
}
}
########################################################################
####
#### Color Frame "Widget"
####
########################################################################
proc powColorFrame { frame varName } {
global powbg
global g_titleFont
upvar #0 $varName var
set hex [list "00" "99" "FF"]
set nClr [llength $hex]
frame $frame -bg $powbg
frame $frame.grid -relief ridge -bd 3 -bg $powbg
for { set i 0 } { $i<$nClr } { incr i 1 } {
for { set j 0 } { $j<$nClr } { incr j 1 } {
for { set k 0 } { $k<$nClr } { incr k 1 } {
set color "[lindex $hex $i][lindex $hex $j][lindex $hex $k]"
frame $frame.grid.c$color -width 24 -height 24 -bg "#$color" \
-bd 4 -relief flat -takefocus 0
grid $frame.grid.c$color -row $k -column [expr $j + $i*$nClr]
bind $frame.grid.c$color <ButtonPress-1> \
"powUpdateColorFrame $frame #$color $varName"
}
}
}
button $frame.clrbtn -textvariable $varName \
-bg $powbg -highlightthickness 0 -width 7 \
-font g_titleFont \
-command "powUpdateColorFrame $frame \
\[powSelectAndReturnColor \$$varName\] $varName"
if { ![info exists var] } {
# Set initial value to black
set var "#000000"
}
grid $frame.grid -row 1 -column 1
grid $frame.clrbtn -row 1 -column 2 -padx 7
powUpdateColorFrame $frame $var $varName
trace variable ::$varName w "powColorVarHasChanged $frame"
}
proc powColorVarHasChanged { f varName varIndex op } {
if { $varName=="var" } return
if { $varIndex != "" } {
set varName ${varName}($varIndex)
}
if { [winfo exists $f.grid] } {
foreach c [winfo child $f.grid] {
$c configure -relief flat
}
}
powUpdateColorFrame $f [subst \$::$varName] $varName
}
proc powSelectAndReturnColor { c } {
set newClr [tk_chooseColor -initialcolor $c]
if { $newClr != "" } {
set c $newClr
}
return $c
}
proc powUpdateColorFrame { f color varName } {
upvar #0 $varName var
set lvar [string range $var 1 end]
if { [winfo exists $f.grid.c$lvar] } {
$f.grid.c$lvar configure -relief flat
}
set var "$color"
set lvar [string range $var 1 end]
if { [winfo exists $f.grid.c$lvar] } {
$f.grid.c$lvar configure -relief raised
}
if { [winfo exists $f.clrbtn] } {
$f.clrbtn configure -bg $color
}
}
|