/usr/share/elmerfront/tcl/ecif_tk_procsPanel.tcl is in elmer-common 6.1.0.svn.5396.dfsg2-4ubuntu4.
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 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 | #/*****************************************************************************/
# *
# * Elmer, A Finite Element Software for Multiphysical Problems
# *
# * Copyright 1st April 1995 - , CSC - IT Center for Science Ltd., Finland
# *
# * 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 version 2
# * of the License, 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 (in file fem/GPL-2); if not, write to the
# * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
# * Boston, MA 02110-1301, USA.
# *
# *****************************************************************************/
#***********************************************************************
#Program: ELMER Front
#Module: ecif_tk_procsPanel.tcl
#Language: Tcl
#Date: 29.06.99
#Version: 1.00
#Author(s): Martti Verho
#Revisions:
#
#Abstract: Generic proc for panels
#
#************************************************************************
# Get panel (array's) menu name (used mainly for
# user friendly messages!)
#
proc Panel::panelNameGuiToMenu {globArray} {
global Common
upvar #0 $globArray theArray
if { [info exist theArray(menuName)] } {
return $theArray(menuName)
} else {
return $globArray
}
}
# =====================
# Fields handling stuff
# =====================
# Backup fields
# =============
# Store old values and reset states for argument field
#
proc Panel::backupField {globArray fld} {
upvar #0 $globArray theArray
set theArray($fld,old) $theArray($fld)
set theArray($fld,prev) $theArray($fld)
set theArray($fld,err) 0
set theArray($fld,mod) 0
}
# Store old values and reset states for all case fields
#
proc Panel::backupFields {globArray {fields ""} } {
upvar #0 $globArray theArray
if { $fields == "" } {
set fields $theArray(allFields)
}
foreach fld $fields {
# Backup only current target fields
if { ![info exists theArray($fld,trg)] || !$theArray($fld,trg) } {
continue
}
# Backup only output fields, other are just
# reset to normal status
#
if { ![Panel::isOutputField $globArray $fld] } {
set theArray($fld,err) 0
set theArray($fld,mod) 0
continue
}
Panel::backupField $globArray $fld
if { [info exists theArray($fld,file)] } {
Panel::backupField $globArray $fld,file
}
if { [info exists theArray($fld,proc)] } {
Panel::backupField $globArray $fld,proc
}
if { [info exists theArray($fld,table)] } {
Panel::backupField $globArray $fld,table
}
}
}
# Reset fields
# ============
# Reset one field
#
proc Panel::resetField {globArray fld} {
global $globArray
upvar #0 $globArray theArray
set theArray($fld,err) 0
set theArray($fld,mod) 0
set theArray($fld,proc) 0
set theArray($fld,table) 0
# Remove all possible data value type fields
catch { unset theArray($fld,dataSize) }
catch { unset theArray($fld,variables) }
catch { unset theArray($fld,nofEntries) }
catch { unset theArray($fld,valueData) }
catch { unset theArray($fld,procData) }
catch { unset theArray($fld,procData,dataSize) }
catch { unset theArray($fld,procData,variables) }
catch { unset theArray($fld,procData,nofEntries) }
catch { unset theArray($fld,tableData) }
catch { unset theArray($fld,tableData,dataSize) }
catch { unset theArray($fld,tableData,variables) }
catch { unset theArray($fld,tableData,nofEntries) }
# Value-data is the "default" data type
#
set theArray($fld) ""
set theArray($fld,valueData) ""
set theArray($fld,firstInstance) 1
}
# Reset list of fields
#
proc Panel::resetFields {globArray {fields ""} } {
global Common
upvar #0 $globArray theArray
if { $fields == "" } {
set fields $theArray(allFields)
}
foreach fld $fields {
Panel::resetField $globArray $fld
# Init also group members!
if { [Panel::isGroupField $globArray $fld] } {
foreach gfld $Common($theArray(parameterType),$fld,group) {
Panel::resetField $globArray $gfld
}
}
}
}
# Init fields
# ===========
# Init single field
#
proc Panel::initField {globArray fld {force_initial 0} {system_index ""} } {
global Common Model
upvar #0 $globArray theArray
set always_initialize [DataField::getFieldProperty $globArray $fld AlwaysInitialize $system_index]
if { $force_initial || $always_initialize } {
Panel::resetField $globArray $fld
}
set prb_mask [Panel::getProblemMask $globArray]
set trg_mask [Panel::getTargetMask $globArray]
set def_dsp [DataField::getFieldProperty $globArray $fld Display $system_index]
#-No data entry if no model defined (except UserSetting)!
if { $Model(GEOMETRY_DIMENSION) == "" &&
$globArray != $Common(panelArray,US)
} {
set def_act 0
#-Otherwise field property value decides
} else {
set def_act [DataField::getFieldProperty $globArray $fld InitiallyActive $system_index]
}
# NOTE: 'Positive' attitude here. Panels should
# turn off these flags when needed!
#
set theArray($fld,prb) 1 ;# Belongs to the problem
set theArray($fld,trg) 1 ;# Belongs to the current case
set theArray($fld,out) 1 ;# Is output field
# Field is displayed (packed) by default, if not
# explicitely defined something else
if { !$def_dsp } {
set theArray($fld,dsp) 0
set theArray($fld,scr) 0
} else {
set theArray($fld,dsp) 1
set theArray($fld,scr) 1
}
# NOTE: Field is active (def_act=1), if not
# explicitely defined something else
#
if { !$def_act } {
set theArray($fld,act) 0
} else {
set theArray($fld,act) 1
}
set theArray($fld,err) 0 ;# Error status
set theArray($fld,mod) 0 ;# Modified status
if {1 == [DataField::getFieldProperty $globArray $fld HasAbsCheckBox "" 0]} {
set theArray($fld,Abs,err) 0
set theArray($fld,Abs,mod) 0
}
if {1 == [DataField::getFieldProperty $globArray $fld HasUseCheckBox "" 0]} {
set theArray($fld,Use,err) 0
set theArray($fld,Use,mod) 0
}
#--If field does not belong to the problem
if { $prb_mask != "" &&
![DataField::fieldProblemMaskMatches $globArray $fld $prb_mask]
} {
set theArray($fld,prb) 0
set theArray($fld,dsp) 0
set theArray($fld,trg) 0
set theArray($fld,scr) 0
set theArray($fld,act) 0
}
#--If field does not belong to current case
if { $theArray($fld,prb) &&
$trg_mask != "" &&
![DataField::fieldTargetMaskMatches $globArray $fld $trg_mask]
} {
set theArray($fld,trg) 0
set theArray($fld,act) 0
}
#--Field is not a screen field
if { $theArray($fld,prb) &&
![Panel::isScreenField $globArray $fld]
} {
set theArray($fld,scr) 0
set theArray($fld,dsp) 0
}
# If any initializing allowed
#
if { $force_initial != -1 } {
# Pick proper default value
if { [info exist theArray($fld,default)] &&
$theArray($fld,default) != ""
} {
set def_value $theArray($fld,default)
} else {
set def_value [DataField::getInitialValue $globArray $fld $system_index]
}
set drop_initial [DataField::getFieldProperty $globArray $fld DropInitialValued]
# Initialize field value
#
# NOTE: Do not initialize a non-forced field if would be dropped
# as initial valued. Otherwise the model file would always seem
# to changed when loaded!!!
#
if { $force_initial ||
$always_initialize ||
( !$drop_initial &&
(![info exists theArray($fld)] || $theArray($fld) == "")
)
} {
set theArray($fld) $def_value
set theArray($fld,valueData) $def_value
}
}
# If field not defined, stop!
#
if { ![info exists theArray($fld)] } {
return
}
set theArray($fld,old) $theArray($fld)
set theArray($fld,prev) $theArray($fld)
}
# Init fields
#
proc Panel::initFields {globArray {fields ""} {force_initial 0} {system_index ""} } {
global Common
upvar #0 $globArray theArray
if { $fields == "" } {
set fields $theArray(allFields)
}
foreach fld $fields {
Panel::initField $globArray $fld $force_initial $system_index
# Init also group members!
if { [Panel::isGroupField $globArray $fld] } {
foreach gfld $Common($theArray(parameterType),$fld,group) {
Panel::initField $globArray $gfld $force_initial $system_index
}
}
}
}
# Init values area fields
#
proc Panel::initValuesAreaFields {globArray {fields ""} {force_initial 0} {system_index ""} } {
global Common
upvar #0 $globArray theArray
if { $fields == "" } {
set fields $theArray(allFields)
}
# We skip frame area 0 here, for Equation also
# the equalion list frmame (1)
#
if { $globArray == $Common(panelArray,EQ) } {
set min_frame 2
} else {
set min_frame 1
}
foreach fld $fields {
set fld_frame [DataField::getFieldProperty $globArray $fld SubPanel $system_index]
if { $fld_frame < $min_frame } {
continue
}
Panel::initField $globArray $fld $force_initial $system_index
# Init also group members!
if { [Panel::isGroupField $globArray $fld] } {
foreach gfld $Common($theArray(parameterType),$fld,group) {
Panel::initField $globArray $gfld $force_initial $system_index
}
}
}
}
# Init new (added) fields in the panel
#
proc Panel::initNewPanelFields {globArray {force_initial 0} {system_index ""} } {
global $globArray
upvar #0 $globArray theArray
# Collect panel fields
set fields ""
foreach fld $theArray(allFields) {
# Init only new fields
if { ![info exist theArray($fld,trg)] } {
lappend fields $fld
}
}
Panel::initFields $globArray $fields $force_initial $system_index
}
# Init fields in the currently visible panel (pane)
#
proc Panel::initCurrentPanelFields {globArray {force_initial 0} {system_index ""} } {
global $globArray
upvar #0 $globArray theArray
# Collect panel fields
set fields ""
foreach fld $theArray(allFields) {
# Init all problem fields
if { $theArray($fld,trg) } {
lappend fields $fld
}
}
Panel::initFields $globArray $fields $force_initial $system_index
}
# Init all panel fields (for all panes)
#
proc Panel::initAllPanelFields {globArray {force_initial 0} {system_index ""} } {
global $globArray
upvar #0 $globArray theArray
# Collect panel fields
set fields ""
foreach fld $theArray(allFields) {
# Init all problem fields
if { $theArray($fld,prb) } {
lappend fields $fld
}
}
Panel::initFields $globArray $fields $force_initial $system_index
}
# Restore fields
# ==============
# Restore current target fields
#
proc Panel::restoreFields {globArray {fields ""} } {
upvar #0 $globArray theArray
if { $fields == "" } {
set fields $theArray(allFields)
}
foreach fld $fields {
if { !$theArray($fld,trg) } {
continue
}
set theArray($fld) $theArray($fld,old)
}
}
# Unset array fields
# =====================
#
proc Panel::unsetFields {globArray {fields ""} } {
upvar #0 $globArray theArray
if { $fields == "" } {
set fields $theArray(allFields)
}
foreach fld $fields {
Panel::unsetField $globArray "$fld"
Panel::unsetField $globArray "$fld,old"
Panel::unsetField $globArray "$fld,prev"
Panel::unsetField $globArray "$fld,file"
Panel::unsetField $globArray "$fld,file,old"
Panel::unsetField $globArray "$fld,file,prev"
Panel::unsetField $globArray "$fld,procedure"
Panel::unsetField $globArray "$fld,procedure,old"
Panel::unsetField $globArray "$fld,procedure,prev"
Panel::unsetField $globArray "$fld,prb"
Panel::unsetField $globArray "$fld,trg"
Panel::unsetField $globArray "$fld,dsp"
Panel::unsetField $globArray "$fld,scr"
Panel::unsetField $globArray "$fld,act"
Panel::unsetField $globArray "$fld,out"
Panel::unsetField $globArray "$fld,err"
Panel::unsetField $globArray "$fld,mod"
Panel::unsetField $globArray "$fld,dataSize"
Panel::unsetField $globArray "$fld,valueData"
Panel::unsetField $globArray "$fld,procData"
Panel::unsetField $globArray "$fld,tableData"
Panel::unsetField $globArray "$fld,variables"
Panel::unsetField $globArray "$fld,wframe"
}
}
proc Panel::unsetAllFieldData {globArray {fields ""} } {
upvar #0 $globArray theArray
if { $fields == "" } {
set fields $theArray(allFields)
}
foreach fld $fields {
Panel::unsetField $globArray $fld
Panel::unsetField $globArray "$fld,*"
}
}
# Unset one array field
# (remove all variables related to array variable "fld")
#
proc Panel::unsetField {globArray fld } {
upvar #0 $globArray theArray
Util::unsetArrayVariables $globArray $fld
}
# Set field states (mod etc.)
#
proc Panel::setFieldStates {globArray {fields ""}} {
upvar #0 $globArray theArray
if { $fields == "" } {
set fields $theArray(allFields)
}
foreach fld $fields {
Widget::configureField $globArray $fld
}
}
# Field select procs
####################
# Set proper fields to be displayed for the
# current problem (system) on the panel.
# Problem mask is used as the criterium.
#
# NOTE: Display of the field is controlled by the globArray(fld,dsp)
# variable which is updated here!!!
#
proc Panel::selectDisplayFields {globArray} {
global Equation Info
upvar #0 $globArray theArray
if { $theArray(panelsByEquation) &&
$theArray(hasMaskedFields)
} {
if { ![info exists theArray(equationIndex)] ||
$theArray(equationIndex) == "" ||
$theArray(equationIndex) < 0
} {
return
}
set theArray(displayMask) [Equation::getEquationMask $theArray(equationIndex)]
} else {
set theArray(displayMask) ""
}
#--Select fields which match display mask
set pnames ""
foreach fld $theArray(allFields) {
set theArray($fld,dsp) 0
# Only problem screen fields can be
# display fields!
if { !$theArray($fld,prb) ||
!$theArray($fld,scr)
} {
continue
}
# Skip index variables like DIFFUSION (only their derivatives
# like <Oxygen>DIFFUSION are included!)
#
if { "" != [DataField::getFieldProperty $globArray $fld IndexVariable] } {
continue
}
# Display field
if { [DataField::fieldDisplayMaskMatches $globArray $fld $theArray(displayMask)] } {
set theArray($fld,dsp) 1
}
}
}
# Select fields for the array starting from the given
# source-fields list and the given problem-mask
#
proc Panel::selectFields {globArray source_fields {problem_mask ""} } {
global Info
upvar #0 $globArray theArray
set fnames ""
foreach fld $source_fields {
#--Should we pick the field
if { $problem_mask != "" &&
![DataField::fieldProblemMaskMatches $globArray $fld $problem_mask]
} {
continue
}
#--Is it an active (normal, non-disabled) field
if { $problem_mask != "" &&
![DataField::fieldTargetMaskMatches $globArray $fld $problem_mask]
} {
set theArray($fld,act) 0
} else {
set theArray($fld,act) 1
}
#--Add field to the result list
lappend fnames $fld
#MSG "Array=$globArray fld=$fld"
}
return $fnames
}
# Select variables for the case using the given mask as the criterium
# NOTE: Inactive fields are also selected, if Info(keepInactiveFields)
# flag is on
#
proc Panel::selectFields2 {globArray fld_names problem_mask} {
global Info
upvar #0 $globArray theArray
set vnames ""
foreach fld $fld_names {
if { $problemMask != "" &&
![DataField::fieldProblemMaskMatches $globArray $fld $problem_mask]
} {
set active 0
} else {
set active 1
}
set theArray($fld,act) $active
if { [Panel::isGroupField $globArray $fld] } {
Panel::setGroupMembersValue $globArray $fld "active" $active
}
# Keep also inactive fields if the flag is on
#
if { $theArray($fld,act) || $Info(keepInactiveFields) } {
lappend vnames $fld
}
}
return $vnames
}
proc Panel::getProblemMask {globArray} {
global Common Equation Info
#-Equation panel accepts all defined fields, otherwise
# we could not add new equations!
if { $globArray == $Common(panelArray,EQ) } {
#return $Equation(totalMask)
return ""
#-In other panels we are more restrictive
# GridParameter specific
} elseif { $globArray == $Common(panelArray,GR) } {
return $Equation(dimgType)
# GridH (density) specific
} elseif { $globArray == $Common(panelArray,GH) } {
return $Equation(dimgType)
# Solver
} elseif { $globArray == $Common(panelArray,SL) } {
return $Equation(problemMask)
# Other arries
} else {
# These arries follow equation mask
if { 1 == [Util::getArrayValue $globArray hasMaskedTarget] } {
#return $Equation(problemMask)
return ""
# These arries could have some array specific value defined, but
# normally the default value blank is returned here!
} else {
return [Util::getArrayValue $globArray problemMask]
}
}
}
proc Panel::getTargetMask {globArray} {
global Common Equation Info
upvar #0 $globArray theArray
#-In equation panel we accept all defined fields, otherwise
# we could not add new equations!
if { $globArray == $Common(panelArray,EQ) } {
#return $Equation(problemMask)
return $Equation(targetMask)
# GridParameter
} elseif { $globArray == $Common(panelArray,GR) } {
return $Equation(dimgType)
# GridH
} elseif { $globArray == $Common(panelArray,GH) } {
return $Equation(dimgType)
#-In other panels we are more restrictive
} else {
return [Util::getArrayValue $globArray targetMask]
}
}
proc Panel::getSystemIndex {globArray pid} {
global Common SolverSystem
upvar #0 $globArray theArray
if { $globArray != $Common(panelArray,SL) } {
return ""
}
# Find system index by equation name
#
set eq_name [DataField::getFieldValue Solver $pid EQUATION]
foreach idx $SolverSystem(indices) {
if { [string equal -nocase $eq_name $SolverSystem($idx,outName)] } {
return $idx
}
}
# Nothing found, Error for Solver!
if { $globArray == $Common(panelArray,SL) } {
return -1
# Other panels,ok
} else {
return ""
}
}
# =========================
# Parameters handling stuff
# =========================
# Check all input parameters in all arries given in the argument
# Remove non-input fields from each parameter
#
proc Panel::checkInputParameters { array_list vnames_name} {
# Loop argument arries
# ====================
foreach globArray $array_list {
upvar #0 $globArray theArray
if { ![info exists theArray(ids)] ||
$theArray(ids) == ""
} {
continue
}
# Loop all parameter entries
# ==========================
foreach id $theArray(ids) {
if { ![info exists theArray($id,data)] } continue
set new_data [DataField::compressParameterInputData $globArray $id $vnames_name]
set theArray($id,data) $new_data
}
}
}
# Check all masked parameters
#
proc Panel::checkMaskedParameters {modified_flag {save_modified_data 1} } {
global Common
upvar $modified_flag modified
Panel::checkParameters $Common(maskedParameters) modified $save_modified_data
}
# Check all parameters in arries given in the array_list argument
# Argument "data_modified" is a reference variable to indicate if data was modifeid
#
# NOTE: Normally modified data will be saved, but if this proc is called ex.
# during Equation::ok processing for checking Equation-parameters themselves, it
# may not make sense to save here, because Equation will save its own stuff
# anyway
#
proc Panel::checkParameters { array_list data_modified {save_modified_data 1} { force_initial 0} } {
global Common Info Equation ObjectTable
upvar $data_modified modified
set modified 0
set detached 0
# Loop argument arries
# ====================
foreach globArray $array_list {
upvar #0 $globArray theArray
if { ![info exists theArray(ids)] ||
$theArray(ids) == ""
} {
continue
}
#MSG "array=$globArray"
# Loop all parameter entries
# ==========================
set new_param_list ""
set new_problem_list ""
set amodified 0
foreach pid $theArray(ids) {
set new_mask ""
#-Pick mask for the parameters from parent objects
if { $theArray(hasMaskedParameter) } {
set oid $theArray($pid,oid)
set new_mask [StdPanelExec::getTargetMask $globArray $oid]
#-Or just use current mask (if exists)
} elseif { [info exists theArray($pid,mask)] } {
set new_mask $theArray($pid,mask)
}
#-Form checked parameter data line
set pmodified 0
set system_index [Panel::getSystemIndex $globArray $pid]
#set new_data $theArray($pid,data)
# If something wrong with data, remove it!
#
if { $system_index == -1 } {
set new_data ""
Message::showMessage "WARNING! Incorrect parameter definition ($globArray $pid) removed!" $Info(wrnMsgColor)
# Data Ok
# NOTE: DataField::checkParameterData takes time!!!
#
} else {
#set new_data $theArray($pid,data)
set new_data [DataField::checkParameterData $globArray $pid pmodified $new_mask $system_index $force_initial]
}
if { $pmodified } {
set amodified 1
}
# If result was an empty parameter, delete it
if { $new_data == "" } {
StdPanelExec::deleteParameterById $globArray $pid
set dmodified 1
# Otherwise update (possibly) modified parameter
} else {
set dmodified 0
set theArray($pid,data) $new_data
# NOTE: Do not set Equation mask here! It is NOT
# concluded from body masks!!!
#
if { $theArray(hasMaskedParameter) } {
set theArray($pid,mask) $new_mask
StdPanelExec::detachInconsistentAttachments $globArray $pid dmodified
}
}
if { $dmodified } {
set amodified 1
set detached 1
}
} ;# For each pid
# Update modified array
# =====================
if { $amodified && $save_modified_data } {
set modified 1
StdPanelExec::compressParameterIds $globArray
StdPanelExec::panelSave $globArray
}
} ; # For each array
if {$detached} {
set msg [list "NOTE: Equation definition(s) were changed and inconsistent parameter\n" \
"attachments were detached. Check warnings in the message area and\n" \
"and correct parameter attachments (Model menu)!"]
set Info(messageIcon) warning
Message::dispOkMessage $msg
}
# Make current parameter selected if panel was visible
if { [Util::panelExists $globArray] } {
if { [info exists theArray(parameterId)] } {
StdPanelExec::parameterSelected $globArray
}
}
}
# Make parameter ids consequtive ie. 1 2 3 ...
# Relevant when parameters have been deleted!
# NOTE: This is different from corresponding
# proc in StdPanelExec:: !!!
# These parameters do not have targets like bodies or
# boundaries
# Used for: Solver, Timestep etc.
#
proc Panel::compressParameterIds {globArray} {
global Info
upvar #0 $globArray theArray
# Update also current parameter id!
if { [info exists theArray(parameterId)] } {
set old_current_id $theArray(parameterId)
} else {
set old_current_id $Info(NO_INDEX)
}
set new_current_id $Info(NO_INDEX)
# NOTE: Sort as integers, This is important, because we delete
# the old-id data if id-number was "compressed", and for this
# it is important that we go through the old-ids in increading
# order!!!
#
set theArray(ids) [lsort -integer $theArray(ids)]
set new_ids ""
# Form updated parameter data list where parameter
# ids are replaced with the "compressed" ids
#
set counter 1
foreach old_id $theArray(ids) {
# New id
set new_id $counter
if { $new_id != $old_id } {
set theArray($new_id,data) $theArray($old_id,data)
set theArray($new_id,name) $theArray($old_id,name)
#--Check if this was current
if { $old_current_id == $old_id } {
set new_current_id $new_id
}
#--Check if old name was an "automatic" name, if so, it will
# be also "renumbered"!!!
#
set old_def_name [Panel::defaultParameterName $globArray $old_id]
set new_def_name [Panel::defaultParameterName $globArray $new_id]
if { [string equal $theArray($old_id,name) $old_def_name] } {
set theArray($new_id,name) $new_def_name
}
# Remove old-id vars
Util::unsetArrayIdVariables $globArray $old_id
}
lappend new_ids $new_id
incr counter
}
set theArray(ids) $new_ids
set theArray(nextNewParameterId) $counter
if { $new_current_id != $Info(NO_INDEX) } {
set theArray(parameterId) $new_current_id
}
}
# Remove non-output fields from all parameters in the array before saving to cpp
# NOTE: Do not loose (...,uncompressed) data before using uncompress proc!!!
#
proc Panel::compressParameters {globArray modified_flag} {
upvar #0 $globArray theArray
upvar $modified_flag modified
#-In cpp we use compressed (excluding empty fields etc.) data
foreach id $theArray(ids) {
set amodified 0
set tmp [DataField::compressParameterOutputData $globArray $id amodified]
#print "comp=$tmp"
set theArray($id,data,uncompressed) $theArray($id,data)
set theArray($id,data) $tmp
if {$amodified} {
set modified 1
}
}
}
# Restore all fields for all parameters in the array after saving to cpp
# NOTE: Do not loose (...,uncompressed) data before using this proc!!!
#
proc Panel::uncompressParameters {globArray} {
upvar #0 $globArray theArray
#-In workspace we use uncompressed (including empty fields etc.) data
foreach id $theArray(ids) {
set theArray($id,data) $theArray($id,data,uncompressed)
unset theArray($id,data,uncompressed)
}
}
proc Panel::createDefaultParameterLine {globArray {system_index ""} } {
global $globArray Info
upvar #0 $globArray theArray
#-Data separator
set sep $Info(dispListSeparatorOut)
Panel::initFields $globArray "" 1 $system_index
set result ""
# Create field values for the current target
#
foreach fld $theArray(allFields) {
if { !$theArray($fld,trg) } {
continue
}
set tmp [DataField::formInitialParameterLineValue $globArray $fld $system_index]
if { $tmp == "" } {
continue
}
append result $tmp$sep
}
set result [string trimright $result $sep]
return $result
}
# Set array variable value for field's group members
#
proc Panel::setGroupMembersValue {globArray fld variable_name value} {
global Common
upvar #0 $globArray theArray
if { ![info exists Common($theArray(parameterType),$fld,group)] } {
return
}
foreach gv $Common($theArray(parameterType),$fld,group) {
set theArray($gv,$variable_name) $value
}
}
# Return needed-level:
# 0 <--> missing value: accepted
# 1 <--> missing value: warning
# 2 <--> missing value: error
#
proc Panel::getFieldNeededLevel {globArray fld} {
upvar #0 $globArray theArray
set ndl [DataField::getFieldProperty $globArray $fld NeededLevel]
# No NeededLevel defined
# Missing value accepted
if { $ndl == "" || $ndl == 0 } {
return 0
}
# If field's NeededLevel value is <= 2 and a parameter file given
# Missing value accepted
if { $ndl <= 2 && [Panel::isActiveField $globArray INCLUDE] } {
return 0
# Missing value ==> warning!
} elseif { $ndl == 1 } {
return 1
# Missing value ==> error!
} else {
return 2
}
}
# Construct a list pair of the currently matching
# (by object mask) problem variables
# 1.pair list of internal names like "COORDINATE_1"
# 2.pair list of external names like "Coordinate 1"
#
proc Panel::getCurrentVariables {object_mask {accept_array 0} } {
global Common Model Timestep Variables
set var_list1 ""
set var_list2 ""
set dim $Model(SIMULATION_DIMENSION)
if { $Timestep(SIMULATION_TYPE) == "Transient" } {
#set object_mask [Util::combineMasks $object_mask $Common(timeMask)]
set object_mask [Util::combineMasks $object_mask ¤T]
}
foreach fld $Variables(allFields) {
# Pick only variables for the current case
#
if { !$Variables($fld,trg) } {
continue
}
if { $object_mask != "" &&
![DataField::fieldTargetMaskMatches Variables $fld $object_mask] } {
continue
}
# Pick only variables who have proper dimension
# NOTE: This is used to drop non-scalar variables from table entries!
#
# Check if field is an array
if { "Array" == [DataField::getFieldProperty Variables $fld FieldDataType] } {
set is_array 1
} else {
set is_array 0
}
if { $is_array && !$accept_array } {
continue
}
set name [DataField::getSifName Variables $fld]
# Note: Not in use!
set coord_index [DataField::getFieldProperty Variables $fld CoordinateIndex]
if { $coord_index > 0 } {
if { $coord_index == 3 && $dim == "2D" } {
;#continue
} else {
;#append name " $coord_index"
}
}
#
lappend var_list1 $fld
lappend var_list2 $name
}
return [list $var_list1 $var_list2]
}
# Create an option menu button
#
proc Panel::createOptionMenuWidget {widget fld values } {
append om "tk_optionMenu $widget $fld "
# Make a 'flat' list of values: "A" "B" "C" ...
#
set values [join $values "\" \""]
set values "\"$values\""
append om $values
# Create widget
return [eval $om]
}
# CLEAR ENTRY button
#
proc Panel::clearEntryButtonCommandProc {globArray} {
global Info
upvar #0 $globArray theArray
set fld $theArray(currentEntryField)
if { $fld == "" } {
return
}
set label [string toupper [DataField::getFieldProperty $globArray $fld Label]]
set msg "Are you sure to delete the contents of the $label entry!"
if { $theArray($fld) != "" && ![Message::verifyAction $Info(noviceUser) $msg question] } {
return
}
# Current is proc
if { $theArray($fld,proc) } {
set theArray($fld,proc) 0
set theArray($fld,procData) ""
# Current is table
} elseif { $theArray($fld,table) } {
set theArray($fld,table) 0
set theArray($fld,tableData) ""
# Current is scalar (value)
} else {
set theArray($fld,valueData) ""
}
# Next is always the scalar (value)!
set theArray($fld) $theArray($fld,valueData)
# Check need of an initial value
set force_initial 0
Panel::initField $globArray $fld $force_initial
}
# CLEAR PANEL button
# Clears all fields in current panel
# E.g. all Heat Equation initial condition fields
#
proc Panel::clearPanelButtonCommandProc {globArray} {
global Info
upvar #0 $globArray theArray
set msg "Are you sure to delete the contents of all entry fields in the panel!"
if { ![Message::verifyAction $Info(noviceUser) $msg ok question] } {
return
}
Panel::initCurrentPanelFields $globArray 1
}
# CLEAR PANELS button
# Clears all fields in all panes
# E.g. Navier-Stokes, Heat Equation etc. initial condition fields
#
proc Panel::clearPanelsButtonCommandProc {globArray} {
global Info
upvar #0 $globArray theArray
set msg "Are you sure to delete the contents of all entries in all $globArray panels!"
if { ![Message::verifyAction $Info(advancedUser) $msg ok question] } {
return
}
Panel::initAllPanelFields $globArray 1
if { $theArray(hasParameters) } {
set theArray(parameterName) ""
}
}
# EDIT button
#
proc Panel::editButtonCommandProc {globArray} {
upvar #0 $globArray theArray
set fld $theArray(currentEntryField)
if { $fld == "" } {
return
}
set wdg $theArray(allWidgets,$fld)
Widget::entryDouble-1 $globArray $fld $wdg
}
# ================================
# Table and Procedure button stuff
# ================================
proc Panel::procedureCheckBoxCommandProc {globArray} {
global Info
upvar #0 $globArray theArray
if { $theArray(currentEntryField) != "" } {
set fld $theArray(currentEntryField)
} else {
return
}
# Store normal data, if it was active
if { $theArray($fld,proc) &&
(![info exists theArray($fld,table)] || !$theArray($fld,table))
} {
set theArray($fld,valueData) $theArray($fld)
}
# Proc checked on
if { $theArray($fld,proc) } {
set theArray($fld,table) 0
if { [info exist theArray($fld,procData)] } {
set theArray($fld) $theArray($fld,procData)
set theArray($fld,dataSize) $theArray($fld,procData,dataSize)
set theArray($fld,variables) $theArray($fld,procData,variables)
} else {
set theArray($fld) ""
catch { unset theArray($fld,dataSize) }
catch { unset theArray($fld,variables) }
Widget::entryDouble-1 $globArray $fld $theArray(allWidgets,$fld)
}
# Proc checked off
} else {
if { [info exist theArray($fld,valueData)] } {
set theArray($fld) $theArray($fld,valueData)
} else {
set theArray($fld) ""
}
catch { unset theArray($fld,dataSize) }
catch { unset theArray($fld,variables) }
}
}
proc Panel::tableCheckBoxCommandProc {globArray} {
global Info
upvar #0 $globArray theArray
if { $theArray(currentEntryField) != "" } {
set fld $theArray(currentEntryField)
} else {
return
}
# Store normal data, if it was active
if { $theArray($fld,table) &&
(![info exists theArray($fld,proc)] || !$theArray($fld,proc))
} {
set theArray($fld,valueData) $theArray($fld)
}
# Table checked on
if { $theArray($fld,table) } {
set theArray($fld,proc) 0
if { [info exist theArray($fld,tableData)] } {
set theArray($fld) $theArray($fld,tableData)
set theArray($fld,dataSize) $theArray($fld,tableData,dataSize)
set theArray($fld,variables) $theArray($fld,tableData,variables)
} else {
set theArray($fld) ""
catch { unset theArray($fld,dataSize) }
catch { unset theArray($fld,variables) }
Widget::entryDouble-1 $globArray $fld $theArray(allWidgets,$fld)
}
# Table checked off
} else {
if { [info exist theArray($fld,valueData)] } {
set theArray($fld) $theArray($fld,valueData)
} else {
set theArray($fld) ""
}
catch { unset theArray($fld,dataSize) }
catch { unset theArray($fld,variables) }
}
}
# Used eg. when parameter name field is entered
#
proc Panel::setProcAndTableButtonStates {globArray proc_state table_state } {
upvar #0 $globArray theArray
if { $theArray(hasProcButton) } {
Widget::configureS $theArray(allWidgets,PROCEDURE_BUTTON) $proc_state
}
if { $theArray(hasTableButton) } {
Widget::configureS $theArray(allWidgets,TABLE_BUTTON) $table_state
}
}
proc Panel::editArray {globArray fld wdg} {
global Info
upvar #0 $globArray theArray
#-Create qualified name for the result
# NOTE This is needed because dispDataEntry proc
# uses button commands which are in their own scope!
namespace eval MyNs {
variable result ""
}
Widget::dispDataEntry ::MyNs::result $theArray($fld) "Entry data window" "Enter values"
tkwait variable ::MyNs::result
set entry_result $::MyNs::result
#-If cancel button was pressed
if { $entry_result == "!cancel!" } {
return
}
#-Set new value
$wdg delete 0 end
$wdg insert 0 $entry_result
}
# Proc creates a data entry panel for an entry field
#
proc Panel::editTable {globArray fld wdg} {
global Info
upvar #0 $globArray theArray
set theArray(isActive) 0
set theArray(hasFocus) 0
#-Create a data entry widget
set de_id [TableEntryPanel::create $globArray $fld Panel::tableEntryPanelCallback]
# Store entry panel id
lappend theArray(tableEntryPanelIds) $de_id
}
# Proc is the entry field update callback for a data entry panel
#
proc Panel::tableEntryPanelCallback {de_id globArray fld} {
global Info
upvar #0 $globArray theArray
set entry_result [set TableEntryPanel::result$de_id]
set entry_list [split $entry_result $Info(dataListSeparator)]
if { 1 == [set TableEntryPanel::updated$de_id] } {
Panel::panelDataModified 1 $globArray ""
}
#--Update field data
#
set sz1 [set TableEntryPanel::dataSize1$de_id]
set sz2 [set TableEntryPanel::dataSize2$de_id]
set ez [set TableEntryPanel::nofEntries$de_id]
set vn [set TableEntryPanel::variableName$de_id]
if { $sz1 == "N" } {
set sz1 [llength [lindex $entry_list 0]]
}
if { $sz2 == "N" } {
set sz2 [llength $entry_list]
}
if { $vn == "none" } {
set vn ""
}
set theArray($fld) $entry_result
set theArray($fld,tableData) $entry_result
set theArray($fld,dataSize) [list $sz1 $sz2]
set theArray($fld,tableData,dataSize) [list $sz1 $sz2]
set theArray($fld,nofEntries) $ez
set theArray($fld,tableData,nofEntries) $ez
set theArray($fld,variables) $vn
set theArray($fld,tableData,variables) $vn
#--Set new values to entry
set wdg $theArray(allWidgets,$fld)
if {[winfo exists $wdg]} {
$wdg delete 0 end
$wdg insert 0 $entry_result
}
#--Clear the data entry instance
TableEntryPanel::delete $de_id
#--Remove entry panel id from the list of active panels
set tmp ""
foreach id $theArray(tableEntryPanelIds) {
if { $id != $de_id } {
lappend tmp $id
}
}
set theArray(tableEntryPanelIds) $tmp
}
# Proc creates a procedure entry panel for an entry field
#
proc Panel::editProcedure {globArray fld wdg} {
global Info
upvar #0 $globArray theArray
set theArray(isActive) 0
set theArray(hasFocus) 0
#-Create a procedure entry widget and get the result
set pe_id [ProcedureEntryPanel::create $globArray $fld Panel::procedureEntryPanelCallback]
# Store procedure panel id
lappend theArray(procedureEntryPanelIds) $pe_id
}
# Proc is the panel entry field update callback for a procedure entry panel
#
proc Panel::procedureEntryPanelCallback { pe_id globArray fld} {
global Info
upvar #0 $globArray theArray
set entry_result [set ProcedureEntryPanel::result$pe_id]
if { 1 == [set ProcedureEntryPanel::updated$pe_id] } {
Panel::panelDataModified 1 $globArray ""
}
set theArray($fld) $entry_result
set theArray($fld,procData) $entry_result
set theArray($fld,variables) [set ProcedureEntryPanel::variableName$pe_id]
if { [string equal -nocase "none" $theArray($fld,variables)] } {
set theArray($fld,variables) ""
}
set theArray($fld,procData,variables) [set ProcedureEntryPanel::variableName$pe_id]
set theArray($fld,dataSize) [list 1 1]
set theArray($fld,procData,dataSize) [list 1 1]
set theArray($fld,nofEntries) 1
set theArray($fld,procData,nofEntries) 1
#-Set new value to entry
set wdg $theArray(allWidgets,$fld)
if {[winfo exists $wdg]} {
$wdg delete 0 end
$wdg insert 0 $entry_result
}
#-Clear the procedure entry panel
ProcedureEntryPanel::delete $pe_id
#--Remove entry panel id from the list of active panels
set tmp ""
foreach id $theArray(procedureEntryPanelIds) {
if { $id != $pe_id } {
lappend tmp $id
}
}
set theArray(procedureEntryPanelIds) $tmp
}
# ============================
# PANEL MODIFIED/CHANGED PROCS
# ============================
# Dirty when: panel data entry was touched but not "used"
# Updaters should reset this flag!!!
# NOTE: This is used for entries like timestep-entry, where you
# have to add data with "sub-add" buttons, which is different from
# parameter add-button!
#
proc Panel::panelDataDirty { is_dirty globArray {widget ""} {event_info ""} } {
upvar #0 $globArray theArray
if { $event_info != "" &&
![Widget::isEditingEvent $event_info]
} {
return
}
if { $widget != "" &&
"disabled" == [$widget cget -state]
} {
return
}
set theArray(dataDirty) $is_dirty
}
# Panel data was modified but not "applied"
# Updaters should reset this flag!!!
#
proc Panel::panelDataModified { is_modified globArray {widget ""} {event_info ""} } {
global Common Info Model
upvar #0 $globArray theArray
if { $Model(GEOMETRY_DIMENSION) == "" &&
$globArray != $Common(panelArray,US)
} {
return
}
if { $event_info != "" &&
![Widget::isEditingEvent $event_info]
} {
return
}
if { $widget != "" &&
"disabled" == [$widget cget -state]
} {
return
}
set theArray(dataModified) $is_modified
# Set state for the panel Update-button, if such
# exists and the array has something to update!
# NOTE: If argument is the button itself, do not
# change it state (to disabled), because it would block
# -command option scripts for the button!!!
set has_update_button 0
set has_add_button 0
if { [info exists theArray(panelUpdateButton)] &&
[winfo exists $theArray(panelUpdateButton)] &&
$widget != $theArray(panelUpdateButton)
} {
set has_update_button 1
}
if { [info exists theArray(panelAddButton)] &&
[winfo exists $theArray(panelAddButton)] &&
$widget != $theArray(panelAddButton)
} {
set has_add_button 1
}
# Is update or add currently allowed in the panel
set accept_update 1
set accept_add 1
if { [info exists theArray(updateAllowed)] &&
!$theArray(updateAllowed)
} {
set accept_update 0
}
if { [info exists theArray(addAllowed)] &&
!$theArray(addAllowed)
} {
set accept_add 0
}
set has_data 1
if { [info exist theArray(ids)] && $theArray(ids) == ""} {
set has_data 1
}
# Set Update-button state
#
if { $has_update_button && $has_data } {
# If Update-button should be highlighted
#
if { $is_modified && $accept_update } {
Widget::configure1 $theArray(panelUpdateButton) -state normal
#Widget::configure1 $theArray(panelUpdateButton) -relief raised
Widget::configure1 $theArray(panelUpdateButton) -fg $Info(en_mod_color)
} else {
Widget::configure1 $theArray(panelUpdateButton) -state disabled
#Widget::configure1 $theArray(panelUpdateButton) -relief raised
Widget::configure1 $theArray(panelUpdateButton) -fg $Info(en_nmod_color)
}
}
# Set Add-button state
#
if { $has_add_button && $has_data } {
# If Add-button should be highlighted
#
if { $is_modified && !$accept_update && $accept_add } {
Widget::configure1 $theArray(panelAddButton) -fg $Info(en_mod_color)
} else {
Widget::configure1 $theArray(panelAddButton) -fg $Info(en_nmod_color)
}
}
if { $is_modified && !$has_update_button } {
set is_changed 1
} else {
set is_changed $theArray(dataChanged)
}
Panel::panelDataChanged $is_changed $globArray $widget $event_info
}
# Modified data was "applied"
# Savers should reset this flag!!!
#
proc Panel::panelDataChanged {is_changed globArray {widget ""} {event_info ""} } {
global Common Info Model
upvar #0 $globArray theArray
if { $Model(GEOMETRY_DIMENSION) == "" &&
$globArray != $Common(panelArray,US)
} {
return
}
if { $event_info != "" &&
![Widget::isEditingEvent $event_info]
} {
return
}
if { $widget != "" &&
"disabled" == [$widget cget -state]
} {
return
}
# Set changed/modified status
set theArray(dataChanged) $is_changed
if { !$theArray(dataChanged) } {
#set theArray(dataModified) 0
}
# Mark window updated
#
if { [info exists theArray(winName)] &&
[info exists theArray(winTitle)] &&
[winfo exists $theArray(winName)]
} {
#--Panel(s) modfied and update(s) done ("deep modify")
if { $theArray(dataChanged) && $theArray(dataModified) } {
wm title $theArray(winName) "$theArray(winTitle)(*)"
#--Panel(s) modfied and update(s) done ("deep modify")
} elseif { $theArray(dataChanged) } {
wm title $theArray(winName) "$theArray(winTitle)*"
#--Visible panel (pane) was modified, but no update yet ("ligh modify")
} elseif { $theArray(dataModified) } {
wm title $theArray(winName) "$theArray(winTitle)(*)"
#--No unsaved changes
} else {
wm title $theArray(winName) "$theArray(winTitle)"
}
}
# Activate/Deactivate cancel-button
# NOTE: currently defaultCancelState is normal!, MVe 04.10.00
#
if { [info exists theArray(cancelButton)] &&
[winfo exists $theArray(cancelButton)]
} {
if {$is_changed} {
Widget::configureS $theArray(cancelButton) normal
} else {
Widget::configureS $theArray(cancelButton) $Info(defaultCancelState)
}
}
# Activate/Deactivate apply-button
if { [info exists theArray(applyButton)] &&
[winfo exists $theArray(applyButton)]
} {
if { $theArray(dataModified) || $theArray(dataChanged) } {
Widget::configureS $theArray(applyButton) normal
#Widget::configure1 $theArray(applyButton) -fg $Info(en_mod_color)
} else {
Widget::configureS $theArray(applyButton) $Info(defaultApplyState)
#Widget::configure1 $theArray(applyButton) -fg $Info(en_nmod_color)
}
}
}
# Check is any field is modified
#
proc Panel::panelHasModifiedStatus {globArray} {
upvar #0 $globArray theArray
foreach fld $theArray(allFields) {
# Only case variables are interesting
if { !$theArray($fld,trg) } {
continue
}
if { $theArray($fld,mod) } {
return 1
}
}
return 0
}
# Check is any field is in error state
#
proc Panel::panelHasErrorStatus {globArray} {
upvar #0 $globArray theArray
foreach fld $theArray(allFields) {
# Only case variables are interesting
if { !$theArray($fld,trg) } {
continue
}
if { $theArray($fld,err) } {
return 1
}
}
return 0
}
# Check if panel data values were changed
#
proc Panel::panelValuesChanged {globArray} {
upvar #0 $globArray theArray
foreach fld $theArray(allFields) {
# Only case variables are interesting
if { !$theArray($fld,trg) } {
continue
}
if { [Panel::isNumericField $globArray $fld] } {
if { [expr $theArray($fld)] != [expr $theArray($fld,old)] } {
return 1
}
} else {
if { $theArray($fld)] != $theArray($fld,old) } {
return 1
}
}
}
return 0
}
# ===========
# OTHER STUFF
# ===========
# OK in a window.
# This is a general version which is currently
# just the same as cancel!
#
proc Panel::ok { arguments } {
global Info
set argc [llength $arguments]
if { $argc == 0} {
destroy $Info(thisWindow)
} else {
destroy $arguments
}
}
# Check that new parameter name does not already exists or
# what to do when it is empty
#
proc Panel::checkParameterName {globArray pid name add_mode} {
global Info
upvar #0 $globArray theArray
# Default ("autmatic") name
set default_name [Panel::defaultParameterName $globArray]
# Empty name
# ==========
if { $name == "" } {
set msg [list "NOTE: Parameter name is missing!\n" \
"Press Ok to use the default name: \n\n$default_name" ]
if { ![Message::verifyAction $Info(noviceUser) $msg ] } {
return 0
} else {
set theArray(parameterName) $default_name
return 1
}
}
set is_like_default [Panel::isLikeDefaultParameterName $globArray $name]
set name_exists 0
# Check against existing names
# ============================
foreach id $theArray(ids) {
if { $id != $pid && $name == $theArray($id,name) } {
set name_exists 1
break
}
}
# What to do, if name already exist
# =================================
if {$name_exists} {
# Current name is like adefault name and we are adding
# parameter, just generate the autoamtic name!!!
#
if { $add_mode && $is_like_default } {
set theArray(parameterName) $default_name
return 1
#-ERROR: Name already exists, is is NOT accepted
#
} else {
if { [info exists theArray(parameterEntryName)] } {
set pname $theArray(parameterEntryName)
} else {
set pname "A parameter"
}
set msg [list "ERROR: $pname already exists with the name: \n\n$name"]
set Info(messageIcon) error
Message::dispOkMessage $msg
return 0
}
}
# All ok
# ======
return 1
}
# Form default parameter name
#
proc Panel::defaultParameterName {globArray {pid ""} } {
upvar #0 $globArray theArray
if { $pid == "" } {
set pid $theArray(nextNewParameterId)
}
return $theArray(defaultName)$pid
}
# Check if parameter name is like a autoamtically
# generated name (like Contraint123)
#
proc Panel::isLikeDefaultParameterName {globArray name} {
upvar #0 $globArray theArray
set name [string trim $name]
# Form test-pattern like Constraint1234...
#
set pat $theArray(defaultName)
append pat "\[0-9\]*"
# Check if there is nothing else but numbers
# after the default parameter name
#
regsub $pat $name "" rest
if { $rest == "" } {
return 1
} else {
return 0
}
}
# Check if it is ok to select a new parameter, when
# data in the panel was modified, but not updated
#
proc Panel::verifyParameter {globArray} {
global Info
upvar #0 $globArray theArray
set msg [list "Panel data has been modified but is not updated!\n\n" \
$Info(anywayOk) ]
set Info(messageIcon) warning
if { "cancel" == [Message::dispOkCancelMessage $msg] } {
return 0
}
return 1
}
#-Verifies that Save (OK or Apply) is all right if the
# panel data has been "modified" but not applied
# Returns:
# 0 <--> do not continue
# 1 <--> it is ok to continue
#
proc Panel::verifySave {globArray} {
global Info
upvar #0 $globArray theArray
#--Verify first that there are no non-applied
# data entry sub-panels for the panel
#
if { ![Panel::verifyEntryPanels $globArray] } {
return 0
}
#--Panel name to be used in messages
if { [info exists theArray(winTitle)] } {
set pname $theArray(winTitle)
} else {
set pname $globArray
}
# NOTE: UPDATE has higher priority than ADD!
# ==========================================
set updateDone 0
set addDone 0
#--If panel data was modified, but not updated --> add or update!!!
if { [info exists theArray(dataModified)] && $theArray(dataModified) } {
# Check update
if { !$updateDone &&
[info exists theArray(panelUpdateButton)] &&
[winfo exists $theArray(panelUpdateButton)]
} {
set wdg $theArray(panelUpdateButton)
set cmd [$wdg cget -command]
set sta [$wdg cget -state]
set rc ""
# Activate update command if button active!
if { $sta == "normal" && $cmd != "" } {
set rc [eval $cmd]
set updateDone 1
}
# Id update button returned something and
# it was equal to zero, update not succesful!
#
if { $rc != "" && !$rc } {
return 0
}
}
# Check next auto add, will be don only if
# update was not done!
if { !$updateDone &&
[info exists theArray(autoAdd)] &&
$theArray(autoAdd) &&
[info exists theArray(panelAddButton)] &&
[winfo exists $theArray(panelAddButton)]
} {
set wdg $theArray(panelAddButton)
set cmd [$wdg cget -command]
set sta [$wdg cget -state]
set rc ""
# Activate add command if button active!
if { $sta == "normal" && $cmd != "" } {
set rc [eval $cmd]
set addDone 1
}
# Id add button returned something and
# it was equal to zero, update not succesful!
#
if { $rc != "" && !$rc } {
return 0
}
}
}
#--If non applied data (like non-attached added parameters) inform
# (novice) user
#
if { $Info(userLevel) == $Info(noviceUser) } {
if { $theArray(dataModified) ||
([info exists theArray(dataDirty)] && $theArray(dataDirty))
} {
set msg [list "NOTE: $pname\n\n" \
"Panel data was changed, but the new data was not used!\n\n" \
$Info(anywayOk) ]
set Info(messageIcon) question
if { "cancel" == [Message::dispCancelOkMessage $msg] } {
return 0
}
}
}
return 1
}
#-Verifies that cancel is all right if the
# panel data has changed ("modified" or "changed")
# Returns:
# 0 <--> do not cancel
# 1 <--> it is ok to cancel
#
proc Panel::verifyCancel {globArray} {
upvar #0 $globArray theArray
global Info
# NEW VERSION
# Do not verify, just accepts cancel!!!
# =====================================
Panel::panelDataChanged 0 $globArray
return 1
# OLD VERSION
# Verify chnages!!!
# =================
#--Verify first possibly only modified data
if { ![verifySave $globArray] } {
return 0
}
if { [info exists theArray(winTitle)] } {
set pname $theArray(winTitle)
} else {
set pname $globArray
}
#--Then verify applied, but not saved data
if { [info exists theArray(dataChanged)] } {
if { $theArray(dataChanged) } {
set msg [list "NOTE: $pname\nPanel data was changed, but not saved!\n\n" \
$Info(anywayOk) ]
set Info(messageIcon) warning
if { "cancel" == [ Message::dispOkCancelMessage $msg ] } {
return 0
}
}
}
return 1
}
#-Verifies that cancel/ok/apply is all right if there
# are entry panels opnen which have "modified" but not applied
# Returns:
# 0 <--> do not continue
# 1 <--> it is ok to continue
#
proc Panel::verifyEntryPanels {globArray} {
upvar #0 $globArray theArray
global Info
# Check table entry panels
if { [info exists theArray(tableEntryPanelIds)] } {
foreach id $theArray(tableEntryPanelIds) {
if { [info exist TableEntryPanel::updated$id] &&
[set TableEntryPanel::updated$id]
} {
set fld [set TableEntryPanel::fieldName$id]
set msg [list "NOTE: Data entry for $fld was changed, but not applied!\n\n" \
$Info(anywayOk) ]
set Info(messageIcon) warning
if { "cancel" == [ Message::dispOkCancelMessage $msg ] } {
return 0
}
}
}
}
# Check procedure entry panels
if { [info exists theArray(procedureEntryPanelIds)] } {
foreach id $theArray(procedureEntryPanelIds) {
if { [set ProcedureEntryPanel::updated$id] } {
set fld [set ProcedureEntryPanel::fieldName$id]
set msg [list "NOTE: Procedure entry for $fld was changed, but not applied!\n\n" \
$Info(anywayOk) ]
set Info(messageIcon) warning
if { "cancel" == [ Message::dispOkCancelMessage $msg ] } {
return 0
}
}
}
}
return 1
}
#-Closes all open entry panels for the main panel
#
proc Panel::closeEntryPanels {globArray} {
upvar #0 $globArray theArray
global Info
if { [info exists theArray(tableEntryPanelIds)] } {
foreach id $theArray(tableEntryPanelIds) {
TableEntryPanel::cancel $id
}
}
if { [info exists theArray(procedureEntryPanelIds)] } {
foreach id $theArray(procedureEntryPanelIds) {
ProcedureEntryPanel::cancel $id
}
}
}
# CANCEL in a window
# Destroys the window
#
proc Panel::cancel { {arguments ""} } {
global Info gMW
if { $arguments == ""} {
destroy $Info(thisWindow)
} else {
global $arguments
destroy $arguments
}
set tmp ""
foreach row $Info(windowList) {
set w [winfo atomname [lindex $row 1]]
if {[winfo exists $w]} {
lappend tmp $row
}
}
set Info(windowList) $tmp
MenuBuild::createWindowListMenu $gMW(Window,windowList)
}
# ============#
# FIELD TYPES #
# ============#
# Checks if the array field is currently active
#
proc Panel::isActiveField { globArray fld } {
upvar #0 $globArray theArray
if { ![info exists theArray($fld,act)] ||
!$theArray($fld,act)
} {
return 0
} else {
return 1
}
}
# Check is the array field is a data entry which must be checked
#
proc Panel::isCheckableDataField {globArray fld} {
global Common $globArray
upvar #0 $globArray theArray
set wclass [DataField::getFieldProperty $globArray $fld WidgetClass ]
set wtype [DataField::getFieldProperty $globArray $fld WidgetType]
set dsp [DataField::getFieldProperty $globArray $fld Display]
#-When IS NOT checkable entry
if { !$dsp ||
$wclass == "Parent" ||
( $wtype != "BrowsableFile" &&
$wtype != "Entry" &&
$wtype != "IncludeFile" &&
$wtype != "Text")
} {
return 0
}
return 1
}
# Check if the array field is a data (fileable data)
#
proc Panel::isSimpleDataField {globArray fld} {
global Common $globArray
upvar #0 $globArray theArray
set wtype [DataField::getFieldProperty $globArray $fld WidgetType]
#-When NOT data entry
if { $wtype == "GroupScreen" ||
$wtype == "Label" ||
$wtype == "Separator" ||
$wtype == "Button" ||
$wtype == "ListBox" ||
$wtype == "SelectionBox"
} {
return 0
}
return 1
}
# Check is the array field is a grouping entry
#
proc Panel::isGroupField {globArray fld} {
global Common $globArray
upvar #0 $globArray theArray
set wtype [DataField::getFieldProperty $globArray $fld WidgetType]
#-When IS group entry
if { $wtype == "GroupData" ||
$wtype == "GroupDataAndScreen" ||
$wtype == "GroupScreen"
} {
return 1
}
return 0
}
# Check is the array field is a grouping entry
#
proc Panel::isGroupMemberField {globArray fld} {
global Common $globArray
upvar #0 $globArray theArray
set wclass [DataField::getFieldProperty $globArray $fld WidgetType]
#-When IS group member
if { $wclass == "MemberOutputField" ||
$wclass == "MemeberField"
} {
return 1
}
return 0
}
# Check if the array field should be read from model file
#
proc Panel::isInputField {globArray fld} {
global Common $globArray
upvar #0 $globArray theArray
set fclass [DataField::getFieldProperty $globArray $fld FieldClass ]
#-When NOT data entry
if { $fclass == "OutputOnly" } {
return 0
}
return 1
}
# Check if the array field should be output to cpp side
#
proc Panel::isOutputField {globArray fld} {
global Common $globArray
upvar #0 $globArray theArray
set wclass [DataField::getFieldProperty $globArray $fld WidgetClass]
if { ![Panel::isSimpleDataField $globArray $fld] } {
return 0
}
if { $wclass == "PanelField" ||
$wclass == "WorkField"
} {
return 0
}
# Output status can ve controlled also by
# the save flag
if { [info exist theArray($fld,save)] &&
!$theArray($fld,save)
} {
return 0
}
return 1
}
# Check if the array field is a screen entry (affecting panels)
#
proc Panel::isScreenField {globArray fld} {
global Common $globArray
upvar #0 $globArray theArray
set wclass [DataField::getFieldProperty $globArray $fld WidgetClass]
set wtype [DataField::getFieldProperty $globArray $fld WidgetType]
set dsp [DataField::getFieldProperty $globArray $fld Display]
#-When NOT screen entry
if { !$dsp ||
$wclass == "ParentField" ||
$wclass == "WorkField" ||
$wtype == "GroupData"
} {
return 0
}
return 1
}
# Check if the array field is a sif-field (SolverInputFile field)
#
proc Panel::isSifField {globArray fld} {
global Common $globArray
upvar #0 $globArray theArray
# Must be at least an output field
if { ![Panel::isOutputField $globArray $fld] } {
return 0
}
if { 1 == [DataField::getFieldProperty $globArray $fld ExcludeFromSif] } {
return 0
}
if { $globArray != $Common(panelArray,EQ) } {
return 1
}
# Equation panel need special handling, because mask-system is not
# controlling field's activity, so we use this to control equation
# fields output to sif!!!
# NOTE: We check field's target (panel activity) mask against problem mask!!!
#
set tmask $Equation(problemMask)
if { ![DataField::fieldTargetMaskMatches Equation $fld $tmask] } {
return 0
}
return 1
}
# Check if the array field is a radio-button type
#
proc Panel::isRadioButtonField {globArray fld} {
global Common $globArray
upvar #0 $globArray theArray
set wclass [DataField::getFieldProperty $globArray $fld WidgetClass ]
set wtype [DataField::getFieldProperty $globArray $fld WidgetType]
#-When IS radio-button type entry
if { $wclass == "RadioButtonsContainer" ||
$wtype == "RadioButton"
} {
return 1
}
return 0
}
# ===================#
# FIELD ACCESS PROCS #
# ===================#
# Pick group fields for a group widget
#
proc Panel::getGroupFields {globArray fld} {
global Common $globArray
upvar #0 $globArray theArray
set panel $theArray(parameterType)
return $Common($panel,$fld,group)
}
# Pick group labels for a group widget
# Returns "" if label not defined
#
proc Panel::getGroupLabels {globArray fld} {
global Common $globArray Coordinate
upvar #0 $globArray theArray
set coord_index [DataField::getFieldProperty $globArray $fld CoordinateIndex]
set result ""
if {$coord_index > 0} {
catch { set result [lindex $Common(CoordinateSymbols) $Coordinate(coordinateLabelIndex)] }
} else {
catch { set result [DataField::getFieldProperty $globArray $fld Label] }
}
return $result
}
# Pick proper label for a field.
# Returns "" if label not defined
#
proc Panel::getCommonLabel {globArray fld is_group} {
global Common $globArray Coordinate
upvar #0 $globArray theArray
set label [DataField::getFieldProperty $globArray $fld Label]
set coord_index [DataField::getFieldProperty $globArray $fld CoordinateIndex]
# If variable is coordinate dependent (like velocity)
if {$coord_index > 0 && $is_group == 0} {
catch { set symbols [lindex $Common(CoordinateSymbols) $Coordinate(coordinateLabelIndex)]
set symbol [lindex $symbols $coord_index]
set label [append label $symbol]
}
}
return $label
}
# ============
# OLD VERSIONS
# ============
# Panel data was modified but not "applied"
# Updaters should reset this flag!!!
#
proc Panel::panelDataModified_old { is_modified globArray {widget ""} {event_info ""} } {
upvar #0 $globArray theArray
if { $event_info != "" &&
![Widget::isEditingEvent $event_info]
} {
return
}
if { $widget != "" &&
"disabled" == [$widget cget -state]
} {
return
}
set theArray(dataModified) $is_modified
# Set state for the panel Update-button, if such
# exists and the array has something to update!
# NOTE: If argument is the button itself, do not
# change it state (to disabled), because it would block
# -command option scripts for the button!!!
set has_button 0
if { [info exists theArray(panelUpdateButton)] &&
[winfo exists $theArray(panelUpdateButton)] &&
$widget != $theArray(panelUpdateButton)
} {
set has_button 1
}
# Is update currently allowed in the panel
set accept_update 1
if { [info exists theArray(updateAllowed)] &&
!$theArray(updateAllowed)
} {
set accept_update 0
}
set has_data 1
if { [info exist theArray(ids)] && $theArray(ids) == ""} {
set has_data 0
}
if { $has_button && $has_data } {
if { $is_modified && $accept_update } {
Widget::configure1 $theArray(panelUpdateButton) -state normal
Widget::configure1 $theArray(panelUpdateButton) -relief raised
} else {
Widget::configure1 $theArray(panelUpdateButton) -state disabled
Widget::configure1 $theArray(panelUpdateButton) -relief raised
}
}
if { $is_modified && $accept_update } {
set is_changed 1
} else {
set is_changed $theArray(dataChanged)
}
Panel::panelDataChanged $is_changed $globArray $widget $event_info
}
# ===========
# Modified data was "applied"
# Savers should reset this flag!!!
#
proc Panel::panelDataChanged_old {is_changed globArray {widget ""} {event_info ""} } {
global Info
upvar #0 $globArray theArray
if { $event_info != "" &&
![Widget::isEditingEvent $event_info]
} {
return
}
if { $widget != "" &&
"disabled" == [$widget cget -state]
} {
return
}
# Set changed/modified status
set theArray(dataChanged) $is_changed
if { !$theArray(dataChanged) } {
set theArray(dataModified) 0
}
# Mark window updated
#
if { [info exists theArray(winName)] &&
[info exists theArray(winTitle)] &&
[winfo exists $theArray(winName)]
} {
if {$is_changed} {
wm title $theArray(winName) "$theArray(winTitle)*"
} else {
wm title $theArray(winName) "$theArray(winTitle)"
}
}
# Activate/Deactivate cancel-button
if { [info exists theArray(cancelButton)] &&
[winfo exists $theArray(cancelButton)]
} {
if {$is_changed} {
Widget::configureS $theArray(cancelButton) normal
} else {
Widget::configureS $theArray(cancelButton) $Info(defaultCancelState)
}
}
# Activate/Deactivate apply-button
if { [info exists theArray(applyButton)] &&
[winfo exists $theArray(applyButton)]
} {
if {$is_changed} {
Widget::configureS $theArray(applyButton) normal
} else {
Widget::configureS $theArray(applyButton) $Info(defaultApplyState)
}
}
}
# end ecif_tk_procsPanel.tcl
# ********************
|