File: procs.tcl

package info (click to toggle)
xpvm 1.2.5-11
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 1,368 kB
  • ctags: 1,509
  • sloc: ansic: 22,799; tcl: 7,750; makefile: 101; csh: 11; sh: 10
file content (5528 lines) | stat: -rw-r--r-- 96,494 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
#
# $Id: procs.tcl,v 4.50 1998/04/09 21:12:41 kohl Exp $
#

#
#         XPVM version 1.1:  A Console and Monitor for PVM
#           Oak Ridge National Laboratory, Oak Ridge TN.
#           Authors:  James Arthur Kohl and G. A. Geist
#                   (C) 1994 All Rights Reserved
#
#                              NOTICE
#
# Permission to use, copy, modify, and distribute this software and
# its documentation for any purpose and without fee is hereby granted
# provided that the above copyright notice appear in all copies and
# that both the copyright notice and this permission notice appear
# in supporting documentation.
#
# Neither the Institution, Oak Ridge National Laboratory, nor the
# Authors make any representations about the suitability of this
# software for any purpose.  This software is provided ``as is''
# without express or implied warranty.
#
# XPVM was funded by the U.S. Department of Energy.
#


puts -nonewline "\[procs.tcl\]"
flush stdout


#
# XPVM TCL Procs
#

proc canvas_handle { view action x y } \
{
	#debug_proc canvas_handle entry

	global st_help_label_query
	global st_canvas_height
	global ut_canvas_height
	global st_highlight_id
	global st_labels_width
	global correlate_help
	global correlate_keep
	global correlate_lock
	global st_query_keep
	global st_help_enter
	global ut_help_enter
	global st_help_query
	global st_help_label
	global qc_info_mode
	global st_help_zoom
	global ut_help_zoom
	global border_space
	global frame_border
	global st_label_ht
	global scale_stack
	global timeid_prim
	global main_width
	global st_cheight
	global st_cwidth
	global stl_yview
	global ut_cwidth
	global zoom_lock
	global fg_color
	global zoom_x1
	global zoom_x2
	global zoomid
	global scale

	global FRAME_OFFSET

	global ST
	global ST_L
	global ST_C

	global UT_C

	set STQ .xpvm.st_label_query

	if { $view == "ST" } \
	{
		global st_xview
		global stc_yview

		set canvx [ expr $x + $st_xview ]
		set canvy [ expr $y + $stc_yview ]
		set lcanvy [ expr $y + ( $stl_yview * $st_label_ht ) ]

		set PRIM_C $ST_C

		set ALT_C $UT_C

		set zoom_height $st_canvas_height

		set timeid_prim "ST"

		set prim_cwidth $st_cwidth

		set prim_help_enter $st_help_enter
		set prim_help_zoom $st_help_zoom
	} \
\
	elseif { $view == "UT" } \
	{
		global ut_xview

		set canvx [ expr $x + $ut_xview ]
		set canvy $y

		set PRIM_C $UT_C

		set ALT_C $ST_C

		set zoom_height $ut_canvas_height

		set timeid_prim "UT"

		set prim_cwidth $ut_cwidth

		set prim_help_enter $ut_help_enter
		set prim_help_zoom $ut_help_zoom
	}

	#
	# Calculate Canvas Time
	#

	set canvt [ expr $canvx \
		- ( $frame_border * ( 1 + $FRAME_OFFSET ) ) ]

	#
	# Process Action
	#

	if { $action == "query_press" } \
	{
		if { $qc_info_mode == "query" } \
		{
			if { $view == "UT" } \
				{ return }

			timeid_proc destroy -1 -1 -1

			if { $st_query_keep == "FALSE" } \
				{ set_query_time -1 }

			set id [ $ST_C find closest $canvx $canvy ]

			set tindex1 [ expr ( $canvy - ($st_label_ht / 2) \
					- $border_space ) \
				/ $st_label_ht ]

			set tindex2 [ expr ( $canvy + ($st_label_ht / 2) \
					- $border_space ) \
				/ $st_label_ht ]

			st_query_info $id $tindex1 $tindex2 1

			setTmpMsg "Help" $st_help_query
		} \
\
		elseif { $qc_info_mode == "correlate" } \
		{
			if { $correlate_keep == "TRUE" } \
				{ timeid_proc move $canvx 2 orange }

			set correlate_lock TRUE

			set dblclk [ double_click ]

			if { $dblclk == "1" } \
				{ set correlate_keep TRUE } \
\
			else \
				{ set correlate_keep FALSE }

			timeid_proc modify -1 2 orange

			correlate_views $canvt

			setTmpMsg "Help" $correlate_help
		}
	} \
\
	elseif { $action == "query_motion" } \
	{
		if { $qc_info_mode == "query" } \
		{
			if { $view == "UT" } \
			{
				timeid_proc move $canvx 1 blue

				if { $st_query_keep == "FALSE" } \
					{ set_query_time $canvt }

				return
			}

			if { $x >= 0 && $x < $st_cwidth \
				&& $y >= 0 && $y < $st_cheight } \
			{
				set id [ $ST_C find closest $canvx $canvy ]

				set tindex1 [ expr ( $canvy - ($st_label_ht / 2) \
					- $border_space ) / $st_label_ht ]

				set tindex2 [ expr ( $canvy + ($st_label_ht / 2) \
					- $border_space ) / $st_label_ht ]

				st_query_info $id $tindex1 $tindex2 0
			} \
\
			else \
			{
				st_query_info -1 -1 -1 0
			}
		} \
\
		elseif { $qc_info_mode == "correlate" } \
		{
			timeid_proc move $canvx 2 orange

			correlate_views $canvt
		}
	} \
\
	elseif { $action == "query_release" } \
	{
		if { $qc_info_mode == "query" } \
		{
			if { $view == "UT" } \
				{ return }

			st_query_info -1 -1 -1 0

			if { $st_highlight_id == -1 } \
				{ set st_query_keep FALSE }

			timeid_proc create $canvx 1 blue

			if { $st_query_keep == "FALSE" } \
				{ set_query_time $canvt }

			setTmpMsg "Help" $prim_help_enter
		} \
\
		elseif { $qc_info_mode == "correlate" } \
		{
			if { $correlate_keep == "FALSE" } \
			{
				timeid_proc modify -1 1 blue

				correlate_views -1

				set_query_time $canvt

				set correlate_lock FALSE

				setTmpMsg "Help" $prim_help_enter
			}
		}
	} \
\
	elseif { $action == "enter" } \
	{
		if { $correlate_lock == "TRUE" || $correlate_keep == "TRUE" } \
			{ return }

		timeid_proc create $canvx 1 blue

		if { $st_query_keep == "FALSE" } \
			{ set_query_time $canvt }

		setTmpMsg "Help" $prim_help_enter
	} \
\
	elseif { $action == "time" } \
	{
		if { $correlate_keep == "TRUE" } \
			{ return }

		timeid_proc move $canvx 1 blue

		if { $st_query_keep == "FALSE" } \
			{ set_query_time $canvt }

		if { $prim_help_enter != [ tmpMsg ] } \
			{ setTmpMsg "Help" $prim_help_enter }
	} \
\
	elseif { $action == "leave" } \
	{
		if { $correlate_lock == "TRUE" || $correlate_keep == "TRUE" } \
			{ return }

		timeid_proc destroy -1 -1 -1

		if { $st_query_keep == "FALSE" } \
			{ set_query_time -1 }

		popMsg
	} \
\
	elseif { $action == "zoom_press" } \
	{
		set zoom_x1 $canvx
		set zoom_x2 $canvx

		if { $view == "ST" } \
		{
			set zoomid [ $PRIM_C create rectangle \
				$canvx 0 $canvx $zoom_height \
				-outline blue -fill blue ]

			$PRIM_C lower $zoomid
		} \
\
		else \
		{
			set zoomid [ $PRIM_C create rectangle \
				$canvx 0 $canvx $zoom_height -outline blue ]
		}

		setTmpMsg "Help" $prim_help_zoom
	} \
\
	elseif { $action == "zoom_motion" } \
	{
		set zoom_x2 $canvx

		if { $zoom_x1 < $zoom_x2 } \
		{
			set x1 $zoom_x1
			set x2 $zoom_x2
		} \
\
		else \
		{
			set x1 $zoom_x2
			set x2 $zoom_x1
		}

		$PRIM_C coords $zoomid $x1 0 $x2 $zoom_height
	} \
\
	elseif { $action == "zoom_release" } \
	{
		$PRIM_C delete $zoomid

		if { $zoom_lock == 1 } \
		{
			bell

			return
		}

		set zoom_lock 1

		set lq [ interface_lock query ]

		if { $lq == "locked" } \
		{
			set zoom_lock 0

			bell

			return
		}

		interface_lock lock

		setMsg { Zooming... }

		set zoom_x2 $canvx

		if { $zoom_x1 != $zoom_x2 } \
		{
			if { $zoom_x1 < $zoom_x2 } \
			{
				set x1 $zoom_x1
				set x2 $zoom_x2
			} \
\
			else \
			{
				set x1 $zoom_x2
				set x2 $zoom_x1
			}

			set t1 [ expr $x1 * $scale ]
			set t2 [ expr $x2 * $scale ]

			set new_scale [ expr ( $t2 - $t1 ) / $prim_cwidth ]

			if { $new_scale == 0 } \
			{
				if { $scale == 1 } \
				{
					setMsg { Error: Maximum Zoom Already Achieved! }

					interface_lock unlock

					set zoom_lock 0

					return
				} \
\
				else \
				{
					set new_scale 1

					setMsg { Warning: Zoom Factor Limited... }
				}
			}

			zoomScrollingViews $new_scale $t1 $view

			set scale_stack [ linsert $scale_stack 0 $scale ]

			set scale $new_scale

			if { $view == "ST" } \
				{ set newx [ expr $x + $st_xview ] } \
\
			elseif { $view == "UT" } \
				{ set newx [ expr $x + $ut_xview ] }

			set newt [ expr $newx \
				- ( $frame_border * ( 1 + $FRAME_OFFSET ) ) ]

			timeid_proc move $newx 1 blue

			if { $qc_info_mode == "query" } \
			{
				set st_query_keep FALSE

				st_query_info -1 -1 -1 1
			} \
\
			elseif { $qc_info_mode == "correlate" } \
			{
				set correlate_keep FALSE

				timeid_proc modify -1 1 blue

				correlate_views -1
			}

			set_query_time $newt

			setMsg { Zooming Done. }
		} \
\
		else \
		{
			setMsg { Error - Infinite Zoom }
		}

		popMsg

		interface_lock unlock

		set zoom_lock 0
	} \
\
	elseif { $action == "unzoom" } \
	{
		if { $zoom_lock == 1 } \
		{
			bell
			
			return
		}

		set zoom_lock 1

		set lq [ interface_lock query ]

		if { $lq == "locked" } \
		{
			set zoom_lock 0

			bell

			return
		}

		interface_lock lock

		setMsg { Unzooming... }

		set new_scale [ lindex $scale_stack 0 ]

		if { $new_scale != "empty" } \
		{
			set scale_stack [ lreplace $scale_stack 0 0 ]
		} \
\
		else \
		{
			set new_scale [ expr 2 * $scale ]
		}

		set ckmax [ check_max_scale $new_scale ]

		if { $ckmax == 0 } \
		{
			setMsg { Error: Maximum Unzoom Achieved. }

			interface_lock unlock

			set zoom_lock 0

			return
		}

		set start_time [ expr ( $canvt * $scale ) \
			- ( $prim_cwidth * $new_scale / 2 ) ]

		if { $start_time < 0 } \
			{ set start_time 0 }

		zoomScrollingViews $new_scale $start_time $view

		set scale $new_scale

		if { $view == "ST" } \
			{ set newx [ expr $x + $st_xview ] } \
\
		elseif { $view == "UT" } \
			{ set newx [ expr $x + $ut_xview ] }

		set newt [ expr $newx \
			- ( $frame_border * ( 1 + $FRAME_OFFSET ) ) ]

		timeid_proc move $newx 1 blue

		if { $qc_info_mode == "query" } \
		{
			set st_query_keep FALSE

			st_query_info -1 -1 -1 1
		} \
\
		elseif { $qc_info_mode == "correlate" } \
		{
			set correlate_keep FALSE

			timeid_proc modify -1 1 blue

			correlate_views -1
		}

		set_query_time $newt

		setMsg { Unzooming Done. }

		interface_lock unlock

		set zoom_lock 0
	} \
\
	elseif { $action == "label_enter" } \
	{
		if { $st_help_label_query != [ tmpMsg ] } \
			{ setTmpMsg "Help" $st_help_label }
	} \
\
	elseif { $action == "label_press" } \
	{
		global st_label_yoff

		set tindex [ expr 10 \
			* ( $lcanvy - $border_space - $frame_border ) \
			/ $st_label_ht ]

		set tlstr [ taskLabel press $tindex ]

		set tindex [ expr $tindex - ( $tindex % 10 ) ]

		set custom [ lindex $tlstr 0 ]
		set str [ lindex $tlstr 1 ]

		set st_label_yoff 0

		if { $str != "" } \
		{
			set lck [ winfo exists $STQ ]

			if { $lck == 1 } \
				{ destroy $STQ }

			label $STQ -text $str \
				-bd 2 -relief raised -foreground $fg_color

			restrict_bindings $STQ "Label"

			set lx [ expr [winfo x $ST_L] + [winfo x $ST] \
				+ $border_space - $frame_border ]

			set ly [ expr [winfo y $ST_L] + [winfo y $ST] \
				+ ( $tindex * $st_label_ht / 10 ) \
				+ ( $st_label_ht / 2 ) + $border_space \
				+ ( 2 * $frame_border ) \
				- ( $stl_yview * $st_label_ht ) ]

			place $STQ -x $lx -y $ly -anchor w

			if { $custom == "TRUE" } \
				{ set st_label_yoff [ expr $ly - $lcanvy ] }
		}
	} \
\
	elseif { $action == "label_motion" } \
	{
		if { $y >= 0 && $y < $st_cheight \
			&& $x >= 0 && $x < $st_labels_width } \
		{
			global st_label_yoff

			set tindex \
				[ expr 10 \
					* ( $lcanvy - $border_space - $frame_border ) \
					/ $st_label_ht ]

			set tlstr [ taskLabel move $tindex ]

			set tindex [ expr $tindex - ( $tindex % 10 ) ]

			set custom [ lindex $tlstr 0 ]
			set str [ lindex $tlstr 1 ]

			if { $str != "" } \
			{
				set upck [ winfo exists $STQ ]

				if { $upck == 1 } \
					{ $STQ configure -text $str } \
\
				else \
				{
					label $STQ -text $str \
						-bd 2 -relief raised -foreground $fg_color

					restrict_bindings $STQ "Label"
				}

				set lx [ expr [winfo x $ST_L] + [winfo x $ST] \
					+ $border_space - $frame_border ]

				if { $st_label_yoff == 0 } \
				{
					set ly [ expr [winfo y $ST_L] + [winfo y $ST] \
						+ ( $tindex * $st_label_ht / 10 ) \
						+ ( $st_label_ht / 2 ) + $border_space \
						+ ( 2 * $frame_border ) \
						- ( $stl_yview * $st_label_ht ) ]
				} \
\
				else \
					{ set ly [ expr $lcanvy + $st_label_yoff ] }

				place $STQ -x $lx -y $ly -anchor w
			} \
\
			else \
			{
				set upck [ winfo exists $STQ ]

				if { $upck == 1 } \
					{ destroy $STQ }
			}
		} \
\
		else \
		{
			set upck [ winfo exists $STQ ]

			if { $upck == 1 } \
				{ destroy $STQ }
		}

		setTmpMsg Help $st_help_label_query
	} \
\
	elseif { $action == "label_release" } \
	{
		if { $y >= 0 && $y < $st_cheight \
			&& $x >= 0 && $x < $st_labels_width } \
		{
			set tindex \
				[ expr 10 \
					* ( $lcanvy - $border_space - $frame_border ) \
					/ $st_label_ht ]

			taskLabel release $tindex
		}

		set upck [ winfo exists $STQ ]

		if { $upck == 1 } \
			{ destroy $STQ }

		setTmpMsg "Help" $st_help_label
	} \
\
	elseif { $action == "label_leave" } \
	{
		set upck [ winfo exists $STQ ]

		if { $upck == 0 } \
			{ popMsg } \
\
		else \
			{ setTmpMsg "Help" $st_help_label_query }
	}

	#debug_proc canvas_handle exit
}


proc timeid_proc { op x wt color } \
{
	#debug_proc timeid_proc entry

	global st_canvas_height
	global ut_canvas_height
	global st_timeid
	global ut_timeid

	global ST_C
	global UT_C

	if { $op == "create" } \
	{
		if { $st_timeid != -1 } \
			{ $ST_C delete $st_timeid }

		if { $ut_timeid != -1 } \
			{ $UT_C delete $ut_timeid }

		set st_timeid [ $ST_C create line \
			$x 0 $x $st_canvas_height -width $wt -fill $color ]

		set ut_timeid [ $UT_C create line \
			$x 0 $x $ut_canvas_height -width $wt -fill $color ]
	} \
\
	elseif { $op == "modify" } \
	{
		if { $st_timeid != -1 } \
			{ $ST_C itemconfigure $st_timeid -width $wt -fill $color }

		if { $ut_timeid != -1 } \
			{ $UT_C itemconfigure $ut_timeid -width $wt -fill $color }
	} \
\
	elseif { $op == "move" } \
	{
		if { $st_timeid != -1 } \
		{
			$ST_C coords $st_timeid $x 0 $x $st_canvas_height
			$ST_C raise $st_timeid
		} \
\
		else \
		{
			set st_timeid [ $ST_C create line \
				$x 0 $x $st_canvas_height -width $wt -fill $color ]
		}

		if { $ut_timeid != -1 } \
		{
			$UT_C coords $ut_timeid $x 0 $x $ut_canvas_height
			$UT_C raise $ut_timeid
		} \
\
		else \
		{
			set ut_timeid [ $UT_C create line \
				$x 0 $x $ut_canvas_height -width $wt -fill $color ]
		}
	} \
\
	elseif { $op == "destroy" } \
	{
		if { $st_timeid != -1 } \
		{
			$ST_C delete $st_timeid

			set st_timeid -1
		}

		if { $ut_timeid != -1 } \
		{
			$UT_C delete $ut_timeid

			set ut_timeid -1
		}
	} \
\
	else \
		{ puts "Error in timeid_proc{}:  Unknown Op = <$op>." }

	#debug_proc timeid_proc exit
}


proc st_query_info { id tindex1 tindex2 press } \
{
	#debug_proc st_query_info entry

	global st_highlight_id
	global st_query_keep
	global st_query_text

	global ST

	#
	# Button Release
	#

	if { $id == -1 } \
	{
		if { $st_query_keep == "FALSE" } \
		{
			st_unhighlight_query noreset

			$ST.query_frame.query configure -text {View Info:}

			set st_query_text ""
		}

		return
	}

	#
	# Check for Double Click
	#

	if { $press == 1 } \
	{
		set dblclk [ double_click ]

		if { $id == $st_highlight_id && $dblclk == "1" } \
			{ set st_query_keep TRUE } \
\
		else \
			{ set st_query_keep FALSE }
	} \
\
	else \
	{
		if { $id != $st_highlight_id } \
			{ st_unhighlight_query noreset }
	}

	#
	# Un-Highlight Query
	#

	if { $st_query_keep == "FALSE" } \
		{ st_unhighlight_query noreset }

	#
	# Search for Query Item & Dump Info String
	#

	set found [ taskQuery $id $tindex1 $tindex2 ]

	if { $found == 0 } \
	{
		#
		# Search Communication Lines
		#

		set found [ commQuery $id ]

		if { $found == 0 } \
		{
			st_unhighlight_query reset

			$ST.query_frame.query configure -text {View Info:}

			set st_query_text ""
		}
	}

	#debug_proc st_query_info exit
}


proc st_unhighlight_query { reset } \
{
	#debug_proc st_unhighlight_query entry

	global st_highlight_type
	global st_highlight_id

	global ST

	if { $st_highlight_id == -1 } \
		{ return }

	if { $st_highlight_type == "state" } \
	{
		$ST.canvas itemconfigure $st_highlight_id -width 1
	} \
\
	elseif { $st_highlight_type == "comm" } \
	{
		$ST.canvas itemconfigure $st_highlight_id -arrow none -width 1
	}

	set st_highlight_type ""

	if { $reset == "reset" } \
		{ set st_highlight_id -1 }

	#debug_proc st_unhighlight_query exit
}


proc st_info_scroll { event x } \
{
	#debug_proc st_info_scroll entry

	global st_query_text_scroll
	global st_query_text_index
	global st_query_text

	if { $st_query_text == "" } \
		{ return }

	global ST

	if { $event == "enter" } \
		{ set st_query_text_index $x } \
\
	elseif { $event == "motion" } \
	{
		if { $st_query_text_index == -1 } \
			{ return }

		set delta [ expr $x - $st_query_text_index ]

		set st_query_text_index $x

		if { $delta < 0 } \
		{
			#
			# Scroll Right
			#

			set st_query_text_scroll \
				[ expr $st_query_text_scroll + $delta ]

			if { $st_query_text_scroll < 0 } \
				{ set st_query_text_scroll 0 }

			set str [ string range $st_query_text \
				$st_query_text_scroll end ]

			$ST.query_frame.query configure -text "View Info:   $str"
		} \
\
		elseif { $delta > 0 } \
		{
			#
			# Scroll Left
			#

			set fwt [ winfo width $ST.query_frame ]

			set qwt [ winfo width $ST.query_frame.query ]

			if { $qwt > $fwt } \
			{
				#
				# Limit Delta
				#

				set limit [ expr $fwt / 100 ]

				if { $delta > $limit } \
					{ set delta $limit }

				#
				# Scroll Text
				#

				set st_query_text_scroll \
					[ expr $st_query_text_scroll + $delta ]

				set str [ string range $st_query_text \
					$st_query_text_scroll end ]

				$ST.query_frame.query configure \
					-text "View Info:   $str"
			}
		}
	} \
\
	elseif { $event == "leave" } \
		{ set st_query_text_index -1 } \
\
	else \
		{ puts "Error in st_info_scroll{}:  unknown event \"$event\"" }

	#debug_proc st_info_scroll exit
}


proc zoomScrollingViews { new_scale start_time view } \
{
	#debug_proc zoomScrollingViews entry

	global frame_border
	global st_cwidth
	global ut_cwidth
	global st_xview
	global ut_xview
	global timex

	global FRAME_OFFSET

	global ST_C
	global ST_SBH

	global UT_C
	global UT_SBH

	set fo [ expr $FRAME_OFFSET * $frame_border ]

	#
	# Re-Position Space-Time State Rectangles
	#

	taskZoom $new_scale

	#
	# Re-Position Space-Time Comm Lines
	#

	commZoom $new_scale

	#
	# Re-Position Utilization Rectangles
	#

	utZoom $new_scale

	#
	# Adjust Time Parameters
	#

	timeZoom $new_scale

	#
	# Align Canvases to Proper Starting Time
	#

	set x1 [ expr $start_time / $new_scale ]

	if { $view == "ST" } \
	{
		set maxvalue [ expr $timex - $st_cwidth + (2 * $frame_border) \
			+ $fo ]

		if { $maxvalue > 0 } \
		{
			if { $x1 > $maxvalue } \
				{ set x1 $maxvalue } \
\
			elseif { $x1 < 0 } \
				{ set x1 0 }
		} \
\
		else \
			{ set x1 0 }

		do_xview $ST_C $x1

		set st_xview $x1

		scrollSet $ST_SBH $timex $st_cwidth 1 $x1

		#
		# Align Other View's Canvas
		#

		if { $timex != $st_cwidth } \
		{
			set utx1 [ expr $x1 \
				- ( $x1 * ( $ut_cwidth - $st_cwidth ) \
					/ ( $timex - $st_cwidth ) ) ]
		} \
\
		else \
		{
			set utx1 [ expr $x1 \
				- ( $x1 * ( $ut_cwidth - $st_cwidth ) ) ]
		}

		do_xview $UT_C $utx1

		set ut_xview $utx1

		scrollSet $UT_SBH $timex $ut_cwidth 1 $utx1
	} \
\
	elseif { $view == "UT" } \
	{
		set maxvalue [ expr $timex - $ut_cwidth + (2 * $frame_border) \
			+ $fo ]

		if { $maxvalue > 0 } \
		{
			if { $x1 > $maxvalue } \
				{ set x1 $maxvalue } \
\
			elseif { $x1 < 0 } \
				{ set x1 0 }
		} \
\
		else \
			{ set x1 0 }

		do_xview $UT_C $x1

		set ut_xview $x1

		scrollSet $UT_SBH $timex $ut_cwidth 1 $x1

		#
		# Align Other View's Canvas
		#

		if { $timex != $ut_cwidth } \
		{
			set stx1 [ expr $x1 \
				+ ( $x1 * ( $ut_cwidth - $st_cwidth) \
					/ ( $timex - $ut_cwidth ) ) ]
		} \
\
		else \
		{
			set stx1 [ expr $x1 \
				+ ( $x1 * ( $ut_cwidth - $st_cwidth ) ) ]
		}

		do_xview $ST_C $stx1

		set st_xview $stx1

		scrollSet $ST_SBH $timex $st_cwidth 1 $stx1
	}

	update_scroll_marks

	#debug_proc zoomScrollingViews exit
}


proc network_handle { action x y } \
{
	#debug_proc network entry

	global net_help_enter
	global net_cheight
	global net_cwidth
	global net_scroll
	global net_xview
	global net_yview
	global net_size

	global NET_C

	set ns2 [ expr $net_size / 2 ]

	set canvx [ expr $x + ( $net_xview * $net_scroll ) - $ns2 ]
	set canvy [ expr $y + ( $net_yview * $net_scroll ) - $ns2 ]

	if { $action == "query_press" } \
	{
		set id [ $NET_C find closest $canvx $canvy ]

		set str [ netHostFind $id $canvx $canvy ]

		if { $str != "" } \
		{
			if { $str != [ tmpMsg ] } \
				{ setTmpMsg "Network View Info" $str }
		}
	} \
\
	elseif { $action == "query_motion" } \
	{
		if { $y >= 0 && $y < $net_cheight \
			&& $x >= 0 && $x < $net_cwidth } \
		{
			set id [ $NET_C find closest $canvx $canvy ]

			set str [ netHostFind $id $canvx $canvy ]

			if { $str != "" } \
			{
				if { $str != [ tmpMsg ] } \
					{ setTmpMsg "Network View Info" $str }
			} \
\
			else \
				{ setTmpMsg "Help" $net_help_enter }
		} \
\
		else \
			{ setTmpMsg "Help" $net_help_enter }
	} \
\
	elseif { $action == "query_release" } \
	{
		if { $y >= 0 && $y < $net_cheight \
			&& $x >= 0 && $x < $net_cwidth } \
		{
			setTmpMsg "Help" $net_help_enter
		} \
\
		else \
			{ popMsg }
	} \
\
	elseif { $action == "enter" } \
		{ setTmpMsg "Help" $net_help_enter } \
\
	elseif { $action == "leave" } \
		{ popMsg }

	#debug_proc network exit
}


proc toggle_netkey { } \
{
	#debug_proc toggle_netkey entry

	global NK

	set cknk [ winfo ismapped $NK ]

	if { $cknk == 1 } \
		{ wm withdraw $NK } \
\
	else \
		{ wm deiconify $NK }

	#debug_proc toggle_netkey exit
}


proc mq_canvas_handle { action x y } \
{
	#debug_proc mq_canvas_handle entry

	global mq_query_index_type
	global mq_query_index
	global mq_query_keep
	global mq_query_text
	global mq_help_enter
	global mq_help_query
	global border_space
	global frame_border
	global mq_task_wt
	global mq_cheight
	global mq_cwidth
	global mq_xview
	global fg_color

	global MQ_F

	set canvx [ expr $x + ( $mq_xview * $mq_task_wt ) ]

	set str ""

	if { $action == "query_press" } \
	{
		set dblclk [ double_click ]

		set ret [ mqQuery query $canvx $y ]

		set id		[ lindex $ret 0 ]
		set type	[ lindex $ret 1 ]
		set str		[ lindex $ret 2 ]

		if { $id == $mq_query_index && $dblclk == "1" } \
			{ set mq_query_keep TRUE } \
\
		else \
			{ set mq_query_keep FALSE }

		if { $id != $mq_query_index } \
			{ mq_unhighlight noreset }

		set mq_query_index $id
		set mq_query_index_type $type

		mq_highlight

		setTmpMsg "Help" $mq_help_query
	} \
\
	elseif { $action == "query_motion" } \
	{
		set ret [ mqQuery query $canvx $y ]

		set id		[ lindex $ret 0 ]
		set type	[ lindex $ret 1 ]
		set str		[ lindex $ret 2 ]

		if { $id != $mq_query_index } \
			{ mq_unhighlight noreset }

		set mq_query_index $id
		set mq_query_index_type $type

		mq_highlight
	} \
\
	elseif { $action == "query_release" } \
	{
		if { $mq_query_keep == "TRUE" } \
		{
			if { $mq_query_index != 0 } \
				{ return } \
\
			else \
				{ set mq_query_keep FALSE }
		}

		set ret [ mqQuery entry $canvx $y ]

		set id		[ lindex $ret 0 ]
		set type	[ lindex $ret 1 ]
		set str		[ lindex $ret 2 ]

		mq_unhighlight noreset

		if { $y >= 0 && $y < $mq_cheight \
			&& $x >= 0 && $x < $mq_cwidth } \
		{
			setTmpMsg "Help" $mq_help_enter
		} \
\
		else \
			{ popMsg }
	} \
\
	elseif { $action == "enter" } \
	{
		if { $mq_query_keep == "TRUE" } \
			{ return }

		set ret [ mqQuery entry $canvx $y ]

		set id		[ lindex $ret 0 ]
		set type	[ lindex $ret 1 ]
		set str		[ lindex $ret 2 ]

		setTmpMsg "Help" $mq_help_enter
	} \
\
	elseif { $action == "move" } \
	{
		if { $mq_query_keep == "TRUE" } \
			{ return }

		set ret [ mqQuery entry $canvx $y ]

		set id		[ lindex $ret 0 ]
		set type	[ lindex $ret 1 ]
		set str		[ lindex $ret 2 ]
	} \
\
	elseif { $action == "leave" } \
	{
		if { $mq_query_keep == "TRUE" } \
			{ return }

		popMsg
	}

	#
	# Set New Query Text
	#

	$MQ_F.query_frame.query configure -text "View Info:   $str"

	set mq_query_text $str

	#debug_proc mq_canvas_handle exit
}


proc mq_highlight { } \
{
	#debug_proc mq_highlight entry

	global mq_query_index_type
	global mq_query_index

	global MQ_C

	if { $mq_query_index != 0 } \
	{
		if { $mq_query_index_type == "rect" } \
			{ $MQ_C itemconfigure $mq_query_index -width 3 } \
\
		elseif { $mq_query_index_type == "text" } \
			{ $MQ_C itemconfigure $mq_query_index -fill red }
	}

	#debug_proc mq_highlight exit
}


proc mq_unhighlight { reset } \
{
	#debug_proc mq_unhighlight entry

	global mq_query_index_type
	global mq_query_index

	global fg_color

	global MQ_C

	if { $mq_query_index != 0 } \
	{
		if { $mq_query_index_type == "rect" } \
			{ $MQ_C itemconfigure $mq_query_index -width 1 } \
\
		elseif { $mq_query_index_type == "text" } \
			{ $MQ_C itemconfigure $mq_query_index -fill $fg_color }

		if { $reset == "reset" } \
		{
			set mq_query_index 0
			set mq_query_index_type none
		}
	}

	#debug_proc mq_unhighlight exit
}


proc mq_info_scroll { event x } \
{
	#debug_proc mq_info_scroll entry

	global mq_query_text_scroll
	global mq_query_text_index
	global mq_query_text

	if { $mq_query_text == "" } \
		{ return }

	global MQ_F

	if { $event == "enter" } \
		{ set mq_query_text_index $x } \
\
	elseif { $event == "motion" } \
	{
		if { $mq_query_text_index == -1 } \
			{ return }

		set delta [ expr $x - $mq_query_text_index ]

		set mq_query_text_index $x

		if { $delta < 0 } \
		{
			#
			# Scroll Right
			#

			set mq_query_text_scroll \
				[ expr $mq_query_text_scroll + $delta ]

			if { $mq_query_text_scroll < 0 } \
				{ set mq_query_text_scroll 0 }

			set str [ string range $mq_query_text \
				$mq_query_text_scroll end ]

			$MQ_F.query_frame.query configure -text "View Info:   $str"
		} \
\
		elseif { $delta > 0 } \
		{
			#
			# Scroll Left
			#

			set fwt [ winfo width $MQ_F.query_frame ]

			set qwt [ winfo width $MQ_F.query_frame.query ]

			if { $qwt > $fwt } \
			{
				#
				# Limit Delta
				#

				set limit [ expr $fwt / 100 ]

				if { $delta > $limit } \
					{ set delta $limit }

				#
				# Scroll Text
				#

				set mq_query_text_scroll \
					[ expr $mq_query_text_scroll + $delta ]

				set str [ string range $mq_query_text \
					$mq_query_text_scroll end ]

				$MQ_F.query_frame.query configure \
					-text "View Info:   $str"
			}
		}
	} \
\
	elseif { $event == "leave" } \
		{ set mq_query_text_index -1 } \
\
	else \
		{ puts "Error in mq_info_scroll{}:  unknown event \"$event\"" }

	#debug_proc mq_info_scroll exit
}


proc ct_canvas_handle { action x y } \
{
	#debug_proc ct_canvas_handle entry

	global ct_help_label_query
	global ct_labels_width
	global ct_query_index
	global ct_help_enter
	global ct_help_label
	global border_space
	global frame_border
	global st_label_ht
	global ct_cheight
	global ct_cwidth
	global ct_yview
	global fg_color

	global CT_F
	global CT_L
	global CT_C

	set CTQ $CT_F.label_query

	set canvy [ expr $y + ( $ct_yview * $st_label_ht ) ]

	if { $action == "query_press" } \
	{
		set tindex [ expr ( $canvy - $border_space - $frame_border ) \
			/ $st_label_ht ]

		set str [ taskCTQuery $tindex ]

		if { $str != "" } \
		{
			$CT_F.query configure -text $str

			set ct_query_index $tindex
		}
	} \
\
	elseif { $action == "query_motion" } \
	{
		set tindex [ expr ( $canvy - $border_space - $frame_border ) \
			/ $st_label_ht ]

		if { $y >= 0 && $y < $ct_cheight \
			&& $x >= 0 && $x < $ct_cwidth } \
		{
			set str [ taskCTQuery $tindex ]

			if { $str != "" } \
			{
				$CT_F.query configure -text $str

				set ct_query_index $tindex
			} \
\
			else \
			{
				$CT_F.query configure -text ""

				set ct_query_index -1
			}
		} \
\
		else \
		{
			$CT_F.query configure -text ""

			set ct_query_index -1
		}
	} \
\
	elseif { $action == "query_release" } \
	{
		$CT_F.query configure -text ""

		set ct_query_index -1
	} \
\
	elseif { $action == "enter" } \
		{ setTmpMsg "Help" $ct_help_enter } \
\
	elseif { $action == "leave" } \
		{ popMsg } \
\
	elseif { $action == "label_press" } \
	{
		global ct_label_yoff

		set tindex [ expr 10 \
			* ( $canvy - $border_space - $frame_border ) \
			/ $st_label_ht ]

		set tlstr [ taskLabel press $tindex ]

		set tindex [ expr $tindex - ( $tindex % 10 ) ]

		set custom [ lindex $tlstr 0 ]
		set str [ lindex $tlstr 1 ]

		set ct_label_yoff 0

		if { $str != "" } \
		{
			set lck [ winfo exists $CTQ ]

			if { $lck == 1 } \
				{ destroy $CTQ }

			label $CTQ -text $str \
				-bd 2 -relief raised -foreground $fg_color

			restrict_bindings $CTQ "Label"

			set lx [ expr [ winfo x $CT_L ] \
				+ $border_space - $frame_border ]

			set ly [ expr [ winfo y $CT_L ] \
				+ ( $tindex * $st_label_ht / 10 ) \
				+ ( $st_label_ht / 2 ) + $border_space \
				+ ( 2 * $frame_border ) \
				- ( $ct_yview * $st_label_ht ) ]

			place $CTQ -x $lx -y $ly -anchor w

			if { $custom == "TRUE" } \
				{ set ct_label_yoff [ expr $ly - $canvy ] }
		}

		setTmpMsg "Help" $ct_help_label_query
	} \
\
	elseif { $action == "label_motion" } \
	{
		if { $y >= 0 && $y < $ct_cheight \
			&& $x >= 0 && $x < $ct_labels_width } \
		{
			global ct_label_yoff

			set tindex \
				[ expr 10 \
					* ( $canvy - $border_space - $frame_border ) \
					/ $st_label_ht ]

			set tlstr [ taskLabel move $tindex ]

			set tindex [ expr $tindex - ( $tindex % 10 ) ]

			set custom [ lindex $tlstr 0 ]
			set str [ lindex $tlstr 1 ]

			if { $str != "" } \
			{
				set upck [ winfo exists $CTQ ]

				if { $upck == 1 } \
					{ $CTQ configure -text $str } \
\
				else \
				{
					label $CTQ -text $str \
						-bd 2 -relief raised -foreground $fg_color

					restrict_bindings $CTQ "Label"
				}

				set lx [ expr [ winfo x $CT_L ] \
					+ $border_space - $frame_border ]

				if { $ct_label_yoff == 0 } \
				{
					set ly [ expr [ winfo y $CT_L ] \
						+ ( $tindex * $st_label_ht / 10 ) \
						+ ( $st_label_ht / 2 ) + $border_space \
						+ ( 2 * $frame_border ) \
						- ( $ct_yview * $st_label_ht ) ]
				} \
\
				else \
					{ set ly [ expr $canvy + $ct_label_yoff ] }

				place $CTQ -x $lx -y $ly -anchor w
			} \
\
			else \
			{
				set upck [ winfo exists $CTQ ]

				if { $upck == 1 } \
					{ destroy $CTQ }
			}
		} \
\
		else \
		{
			set upck [ winfo exists $CTQ ]

			if { $upck == 1 } \
				{ destroy $CTQ }
		}
	} \
\
	elseif { $action == "label_release" } \
	{
		if { $y >= 0 && $y < $ct_cheight \
			&& $x >= 0 && $x < $ct_labels_width } \
		{
			set tindex \
				[ expr 10 \
					* ( $canvy - $border_space - $frame_border ) \
					/ $st_label_ht ]

			taskLabel release $tindex
		}

		set upck [ winfo exists $CTQ ]

		if { $upck == 1 } \
			{ destroy $CTQ }

		setTmpMsg "Help" $ct_help_label
	} \
\
	elseif { $action == "label_enter" } \
	{
		if { $ct_help_label_query != [ tmpMsg ] } \
			{ setTmpMsg "Help" $ct_help_label }
	} \
\
	elseif { $action == "label_leave" } \
	{
		set upck [ winfo exists $CTQ ]

		if { $upck == 0 } \
			{ popMsg } \
\
		else \
			{ setTmpMsg "Help" $ct_help_label_query }
	}

	#debug_proc ct_canvas_handle exit
}


proc active { tf } \
{
	#debug_proc active entry

	if { $tf == "TRUE" } \
		{ .xpvm.active configure -text "*" } \
\
	elseif { $tf == "CLEANUP" } \
		{ .xpvm.active configure -text "(*)" } \
\
	else \
		{ .xpvm.active configure -text " " }

	#debug_proc active exit
}


proc set_output_file { } \
{
	#debug_proc set_output_file entry

	global output_file

	global TO_F

	global OF

	set ckof [ winfo ismapped $OF ]

	if { $ckof == 1 } \
		{ return }

	set file [ $TO_F.file_entry get ]

	if { $file != $output_file } \
	{
		set output_file $file

		output_file_handle $output_file new
	}

	#debug_proc set_output_file exit
}


proc set_output_filter { } \
{
	#debug_proc set_output_filter entry

	global output_filter

	global TO_F

	set filter [ $TO_F.filter_entry get ]

	if { "x$filter" != "x$output_filter" } \
	{
		set output_filter $filter

		output_filter_handle $output_filter new
	}

	#debug_proc set_output_filter exit
}


proc set_output_search { } \
{
	#debug_proc set_output_search entry

	global TO_F

	output_search_handle [ $TO_F.search_entry get ]

	#debug_proc set_output_search exit
}


proc set_tevhist_filter { } \
{
	#debug_proc set_tevhist_filter entry

	global tevhist_filter

	global TV_F

	set filter [ $TV_F.filter_entry get ]

	if { "x$filter" != "x$tevhist_filter" } \
	{
		set tevhist_filter $filter

		tevhist_filter_handle $tevhist_filter
	}

	#debug_proc set_tevhist_filter exit
}


proc set_tevhist_search { } \
{
	#debug_proc set_tevhist_search entry

	global TV_F

	tevhist_search_handle [ $TV_F.search_entry get ]

	#debug_proc set_tevhist_search exit
}


proc prompt_file_overwrite { file cmd } \
{
	#debug_proc prompt_file_overwrite entry

	global file_overwrite_cmd
	global border_space

	global OF

	$OF.file configure -text $file

	set file_overwrite_cmd $cmd

	update

	set lwt [ winfo width $OF.label ]
	set fwt [ winfo width $OF.file ]

	if { $lwt > $fwt } \
		{ set wt $lwt } \
\
	else \
		{ set wt $fwt }

	set wt [ expr $wt + (2 * $border_space) ]

	set ht [ expr [ winfo y $OF.yes ] + [ winfo height $OF.yes ] \
		+ $border_space ]

	place $OF -x 25 -y 25 -width $wt -height $ht

	raise $OF

	#debug_proc prompt_file_overwrite exit
}


proc do_file_overwrite_result { result } \
{
	#debug_proc do_file_overwrite_result entry

	global file_overwrite_cmd

	file_overwrite_result $result $file_overwrite_cmd

	#debug_proc do_file_overwrite_result exit
}


proc do_spawn { init } \
{
	#debug_proc do_spawn entry

	global spawn_close_on_start
	global spawn_flags_debug
	global spawn_flags_trace
	global spawn_flags_front
	global spawn_flags_compl
	global spawn_init_save
	global spawn_where
	global tasks_subs

	global SP

	focus .xpvm

	if { $spawn_close_on_start == "ON" } \
	{
		set cksd [ winfo ismapped $SP ]

		if { $cksd == 1 } \
		{
			raiseMenu .xpvm.tasks_menu .xpvm.tasks .xpvm \
				$tasks_subs
		}
	}

	if { $init == "again" } \
		{ set init $spawn_init_save } \
\
	else \
		{ set spawn_init_save $init }

	set cmd [ $SP.cmd_entry get ]

	if { $cmd == "" } \
		{ return }

	set name [ lindex $cmd 0 ]

	set args [ lreplace $cmd 0 0 ]

	set buf [ $SP.buf_entry get ]

	if { $buf == "" } \
		{ set buf 1 }

	set ntasks [ $SP.ntasks_entry get ]

	if { $ntasks == "" } \
		{ set ntasks 1 }

	set cmd \
		[ list pvm_tasks spawn $init $name $args $buf $ntasks ]

	set loc [ $SP.loc_entry get ]

	if { $loc != "" } \
	{
		if { $spawn_where == "Host" } \
			{ set cmd [ concat $cmd [ list host $loc ] ] } \
\
		elseif { $spawn_where == "Arch" } \
			{ set cmd [ concat $cmd [ list arch $loc ] ] }
	}

	if { $spawn_flags_debug == "ON" } \
		{ lappend cmd "debug" }

	if { $spawn_flags_trace == "ON" } \
		{ lappend cmd "trace" }

	if { $spawn_flags_front == "ON" } \
		{ lappend cmd "front" }

	if { $spawn_flags_compl == "ON" } \
		{ lappend cmd "compl" }

	eval $cmd

	#debug_proc do_spawn exit
}


proc checkSpawnWhere { } \
{
	#debug_proc checkSpawnWhere entry

	global spawn_host_string
	global spawn_arch_string
	global last_spawn_where
	global spawn_where

	global SP

	set str [ $SP.loc_entry get ]

	if { $last_spawn_where == "Host" } \
		{ set spawn_host_string $str } \
\
	elseif { $last_spawn_where == "Arch" } \
		{ set spawn_arch_string $str }

	$SP.loc_entry delete 0 end

	if { $spawn_where == "Host" } \
		{ $SP.loc_entry insert 0 $spawn_host_string } \
\
	elseif { $spawn_where == "Arch" } \
		{ $SP.loc_entry insert 0 $spawn_arch_string }

	set last_spawn_where $spawn_where

	layout_spawn_dialog

	#debug_proc checkSpawnWhere exit
}


proc set_trace_format { tfmt } \
{
	#debug_proc set_trace_format entry

	global trace_format
	global tm33_subs
	global tm_subs

	global OTF

	global SP

	#
	# Lower Any Trace Mask Menus
	#

	place forget .xpvm.trace_mask_menu

	foreach i $tm_subs \
		{ place forget $i }

	place forget .xpvm.trace33_mask_menu

	foreach i $tm33_subs \
		{ place forget $i }

	#
	# Set Up Correct Trace Mask Menu
	#

	set trace_format $tfmt

	if { $tfmt == "3.3" } \
	{
		set menu .xpvm.trace33_mask_menu

		set cmd [ list raiseMenuIndirect $menu trace_mask_button \
			$SP.trace_mask .xpvm $tm33_subs ]

		$SP.trace_mask configure -command $cmd

		set cmd [ list raiseMenuIndirect $menu trace_mask_button \
			$OTF.trace_mask .xpvm $tm33_subs ]

		$OTF.trace_mask configure -command $cmd
	} \
\
	elseif { $tfmt == "3.4" } \
	{
		set menu .xpvm.trace_mask_menu

		set cmd [ list raiseMenuIndirect $menu trace_mask_button \
			$SP.trace_mask .xpvm $tm_subs ]

		$SP.trace_mask configure -command $cmd

		set cmd [ list raiseMenuIndirect $menu trace_mask_button \
			$OTF.trace_mask .xpvm $tm33_subs ]

		$OTF.trace_mask configure -command $cmd
	} \
\
	else \
		{ puts "Error: Unknown Tracing Format" }

	layout_spawn_dialog

	#debug_proc set_trace_format exit
}


proc trace_mask { index label menuvar setflag } \
{
	#debug_proc trace_mask entry

	global $menuvar

	set state [ set $menuvar ]

	pvm_trace_mask $index $state

	#debug_proc trace_mask exit
}


proc trace_mask_result { result } \
{
	#debug_proc trace_mask_result entry

	global trace_format

	if { $trace_format == "3.3" } \
		{ set prefix "trace33_mask" } \
\
	elseif { $trace_format == "3.4" } \
		{ set prefix "trace_mask" } \
\
	else \
	{
		puts "Error: Unknown Tracing Format"

		return
	}

	foreach ev $result \
	{
		set index [ lindex $ev 0 ]
		set onoff [ lindex $ev 1 ]

		set menuvar "${prefix}_state_$index"

		global $menuvar

		set $menuvar $onoff
	}

	#debug_proc trace_mask_result exit
}


proc do_trace_buffer { } \
{
	#debug_proc do_trace_buffer entry

	global SP

	set tbuf [ $SP.buf_entry get ]

	set_trace_buffer $tbuf

	#debug_proc do_trace_buffer exit
}


proc do_otf { index } \
{
	#debug_proc do_otf entry

	global tracing_status
	global border_space
	global otf_tasklist
	global otf_lasty
	global row_height

	if { $index == "refresh" } \
		{ refresh_tasks otf } \
\
	elseif { $index == "all" } \
	{
		pvm_tasks otf 0 $tracing_status

		refresh_tasks otf
	} \
\
	else \
	{
		if { $index > 0 && $index < $otf_lasty } \
		{
			set i [ expr ( $index - $border_space ) / $row_height ]

			set max [ llength $otf_tasklist ]

			set t [ lindex $otf_tasklist [ expr $max - $i - 2 ] ]

			set name [ lindex $t 1 ]
			set tid [ lindex $t 2 ]

			pvm_tasks otf $tid $tracing_status

			refresh_tasks otf
		}
	}

	#debug_proc do_otf exit
}


proc do_kill { index } \
{
	#debug_proc do_kill entry

	global kill_tasklist
	global border_space
	global kill_lasty
	global row_height

	if { $index == "refresh" } \
		{ refresh_tasks kill } \
\
	elseif { $index == "all" } \
	{
		pvm_tasks kill 0 all

		refresh_tasks kill
	} \
\
	else \
	{
		if { $index > 0 && $index < $kill_lasty } \
		{
			set i [ expr ( $index - $border_space ) / $row_height ]

			set max [ llength $kill_tasklist ]

			set t [ lindex $kill_tasklist [ expr $max - $i - 2 ] ]

			set name [ lindex $t 1 ]
			set tid [ lindex $t 2 ]

			pvm_tasks kill $tid $name

			refresh_tasks kill
		}
	}

	#debug_proc do_kill exit
}


proc do_signal { index } \
{
	#debug_proc do_signal entry

	global signal_selected
	global signal_tasklist
	global signal_lasty
	global border_space
	global row_height

	if { $index == "refresh" } \
		{ refresh_tasks signal } \
\
	elseif { $index == "all" } \
	{
		pvm_tasks signal 0 $signal_selected

		refresh_tasks signal
	} \
\
	else \
	{
		if { $index > 0 && $index < $signal_lasty } \
		{
			set i [ expr ( $index - $border_space ) / $row_height ]

			set max [ llength $signal_tasklist ]

			set t [ lindex $signal_tasklist [ expr $max - $i - 2 ] ]

			set tid [ lindex $t 2 ]

			pvm_tasks signal $tid $signal_selected

			refresh_tasks signal
		}
	}

	#debug_proc do_signal exit
}


proc systasks { index label menuvar setflag } \
{
	#debug_proc systasks entry

	global $menuvar

	set state [ set $menuvar ]

	eval "pvm_tasks systasks $index $state"

	#debug_proc systasks exit
}


proc reset { index label menuvar setflag } \
{
	#debug_proc reset entry

	if { $index == "pvm" } \
		{ reset_pvm } \
\
	elseif { $index == "views" } \
		{ reset_views } \
\
	elseif { $index == "trace_file" } \
		{ reset_trace_file } \
\
	elseif { $index == "all" } \
	{
		#
		# Reset PVM after interface & trace file
		#     - to get group servers, etc, if desired.
		#
		# Reset Views after Trace File to insure that
		#     TRACE_PENDING is cleared immediately.
		#

		reset_trace_file
		reset_views
		reset_pvm
	}

	#debug_proc reset exit
}


proc handleTraceFileStatus { } \
{
	#debug_proc handleTraceFileStatus entry

	global trace_file_status

	global OV

	trace_file_status_handle $trace_file_status

	if { $trace_file_status == "PlayBack" } \
	{
		set ckov [ winfo ismapped $OV ]

		if { $ckov == 1 } \
		{
			place forget $OV
		}
	}

	#debug_proc handleTraceFileStatus exit
}


proc set_trace_file { } \
{
	#debug_proc set_trace_file entry

	global trace_file

	global CTRL

	set file [ $CTRL.file_entry get ]

	if { $file != $trace_file } \
	{
		set trace_file $file

		trace_file_handle $trace_file
	}

	#debug_proc set_trace_file exit
}


proc prompt_trace_overwrite { file } \
{
	#debug_proc prompt_trace_overwrite entry

	global border_space

	global OV

	$OV.file configure -text $file

	update

	set lwt [ winfo width $OV.label ]
	set fwt [ winfo width $OV.file ]

	if { $lwt > $fwt } \
		{ set wt $lwt } \
\
	else \
		{ set wt $fwt }

	set wt [ expr $wt + (2 * $border_space) ]

	set ht [ expr [ winfo y $OV.yes ] + [ winfo height $OV.yes ] \
		+ $border_space ]

	place $OV -x 175 -y 200 -width $wt -height $ht

	raise $OV

	#debug_proc prompt_trace_overwrite exit
}


proc reset_interface { } \
{
	#debug_proc reset_interface entry

	global st_canvas_height
	global frame_border
	global st_timeline
	global to_lasty
	global tv_lasty
	global timex

	global FRAME_OFFSET

	global ST_C

	global CTRL

	#
	# Reset Network Host States
	#

	netReset

	#
	# Clear All Tasks
	#

	taskReset

	#
	# Task Output Scroll Size
	#

	set to_lasty $frame_border

	#
	# Trace Event History Scroll Size
	#

	set tv_lasty $frame_border

	#
	# Re-Initialize Time / Space-Time
	#

	$CTRL.time configure -text {Time: 0.000000}

	set timex [ expr $frame_border * ( 1 + $FRAME_OFFSET ) ]

	$ST_C coords $st_timeline $timex 0 $timex $st_canvas_height

	#
	# Clear Utilization Rectangles
	#

	utReset

	#
	# Clear Message Queue Rectangles
	#

	mqReset

	#
	# Reset Scrollbars / Canvases
	#

	scrollReset

	#debug_proc reset_interface exit
}


proc scrollReset {} \
{
	#debug_proc scrollReset entry

	global ct_canvas_width
	global to_canvas_width
	global tv_canvas_width
	global tasks_height
	global st_label_ht
	global net_cheight
	global net_hheight
	global net_cwidth
	global net_hwidth
	global row_height
	global net_scroll
	global st_cheight
	global ct_cheight
	global to_cheight
	global tv_cheight
	global st_cwidth
	global ut_cwidth
	global ct_cwidth
	global to_cwidth
	global tv_cwidth
	global to_lasty
	global tv_lasty
	global net_size

	global NET_C
	global NET_SBH
	global NET_SBV

	global ST_L
	global ST_C
	global ST_SBH
	global ST_SBV

	global UT_C
	global UT_SBH

	global CT_L
	global CT_C
	global CT_SBH
	global CT_SBV

	global TO_C
	global TO_SBH
	global TO_SBV

	global TV_C
	global TV_SBH
	global TV_SBV

	scrollInit $NET_C $NET_SBH $net_size $net_hwidth $net_cwidth \
		net_xview HORIZ center $net_scroll

	scrollInit $NET_C $NET_SBV $net_size $net_hheight $net_cheight \
		net_yview VERT center $net_scroll

	scrollInit $ST_C $ST_SBH -1 $st_cwidth $st_cwidth st_xview \
		HORIZ low 1

	scrollInit $ST_C $ST_SBV -1 $tasks_height $st_cheight stc_yview \
		VERT low 1

	scrollInit $ST_L $ST_SBV -1 $tasks_height $st_cheight stl_yview \
		VERT low $st_label_ht

	scrollInit $UT_C $UT_SBH -1 $ut_cwidth $ut_cwidth ut_xview \
		HORIZ low 1

	scrollInit $CT_C $CT_SBH -1 $ct_canvas_width $ct_cwidth ct_xview \
		HORIZ low 1

	scrollInit $CT_L $CT_SBV -1 $tasks_height $ct_cheight ct_yview \
		VERT low $st_label_ht

	scrollInit $CT_C $CT_SBV -1 $tasks_height $ct_cheight ct_yview \
		VERT low $st_label_ht

	scrollInit $TO_C $TO_SBH -1 $to_canvas_width $to_cwidth to_xview \
		HORIZ low $row_height

	scrollInit $TO_C $TO_SBV -1 $to_lasty $to_cheight to_yview \
		VERT low $row_height

	scrollInit $TV_C $TV_SBH -1 $tv_canvas_width $tv_cwidth tv_xview \
		HORIZ low $row_height

	scrollInit $TV_C $TV_SBV -1 $tv_lasty $tv_cheight tv_yview \
		VERT low $row_height

	#debug_proc scrollReset exit
}


proc do_pvm_hosts { index label menuvar setflag } \
{
	#debug_proc do_pvm_hosts entry

	global border_space

	if { $menuvar == "none" } \
	{
		if { $label == "Add All Hosts" } \
		{
			#
			# Add All Hosts
			#

			pvm_hosts $index
		} \
\
		elseif { $label == "Other Hosts..." } \
		{
			#
			# Add Other Host
			#

			global OH

			set ckmpd [ winfo ismapped $OH ]

			if { $ckmpd == 0 } \
			{
				place $OH -x 150 -y 175 \
					-width [ expr [ winfo width $OH.label ] \
						+ (2 * $border_space) ] \
					-height [ expr [ winfo height $OH.label ] \
						+ [ winfo height $OH.host_entry ] \
						+ [ winfo height $OH.accept ] \
						+ (3 * $border_space) ]

				raise $OH

				focus $OH.host_entry
			} \
\
			else \
				{ place forget $OH }
		}
	} \
\
	else \
	{
		#
		# Add / Delete Specific Host
		#

		global $menuvar

		set state [ set $menuvar ]

		if { $setflag == "TRUE" } \
		{
			if { $state == "ON" } \
			{
				set $menuvar OFF

				set state OFF
			} \
\
			else \
			{
				set $menuvar ON

				set state ON
			}
		}

		pvm_hosts $index
	}

	#debug_proc do_pvm_hosts exit
}


proc do_pvm_other_host { } \
{
	#debug_proc do_pvm_other_host entry

	global OH

	set new_host [ $OH.host_entry get ]

	place forget $OH

	$OH.host_entry delete 0 end

	set strlen [ string length $new_host ]

	if { $strlen > 0 } \
		{ pvm_hosts 1 $new_host }

	#debug_proc do_pvm_other_host exit
}


proc refreshHostsMenu { } \
{
	#debug_proc refreshHostsMenu entry

	#
	# Destroy Existing Menu Hierarchy
	#

	set name .xpvm.hosts_menu

	set wck [ winfo exists $name ]

	if { $wck == 0 } \
		{ return }

	set wup [ winfo ismapped $name ]

	destroy $name

	#
	# Clear Globals
	#

	set root [ rootName $name ]

	set cmil "${root}_cmd_list"

	global $cmil

	set $cmil ""

	set hmil "${root}_hosts_list"

	global $hmil

	set $hmil ""

	#
	# Re-Generate Hosts Menu
	#

	global hosts_subs

	set cmd [ list raiseMenu .xpvm.hosts_menu .xpvm.hosts .xpvm \
		$hosts_subs ]

	makeHostsMenu .xpvm.hosts_menu do_pvm_hosts \
		[ get_hosts_menu_list ] $cmd $hosts_subs none

	#
	# Raise Menu
	#

	if { $wup == 1 } \
	{
		eval $cmd

		update
	}

	#debug_proc refreshHostsMenu exit
}


proc setNetworkView { } \
{
	#debug_proc setNetworkView entry

	global net_cheight
	global net_hheight
	global net_cwidth
	global net_hwidth
	global net_scroll
	global net_xview
	global net_yview
	global net_size

	global NET_C
	global NET_SBH
	global NET_SBV

	#
	# Set Network View Location
	#

	set scroll_yview [ expr $net_yview \
		- [ scrollCenterValue $net_size $net_hheight $net_scroll ] ]

	set max_yview \
		[ scrollMaxValue $net_hheight $net_cheight $net_scroll ]

	if { $scroll_yview < 0 || $max_yview < 0 || \
		( $max_yview >= 0 && $scroll_yview > $max_yview ) } \
	{
		set net_yview \
			[ scrollCenterValue $net_size $net_cheight $net_scroll ]

		do_yview $NET_C $net_yview
	}

	set scroll_xview [ expr $net_xview \
		- [ scrollCenterValue $net_size $net_hwidth $net_scroll ] ]

	set max_xview \
		[ scrollMaxValue $net_hwidth $net_cwidth $net_scroll ]

	if { $scroll_xview < 0 || $max_xview < 0 || \
		( $max_xview >= 0 && $scroll_xview > $max_xview ) } \
	{
		set net_xview \
			[ scrollCenterValue $net_size $net_cwidth $net_scroll ]

		do_xview $NET_C $net_xview
	}

	#
	# Set Network Scrollbars
	#

	if { $net_hheight < $net_cheight } \
		{ set yview 0 } \
\
	else \
	{
		set yview [ expr $net_yview \
			- ( ( ($net_size / 2) - ($net_hheight / 2) ) \
				/ $net_scroll ) ]

		if { $yview < 0 } { set yview 0 }
	}

	if { $net_hwidth < $net_cwidth } \
		{ set xview 0 } \
\
	else \
	{
		set xview [ expr $net_xview \
			- ( ( ($net_size / 2) - ($net_hwidth / 2) ) \
				/ $net_scroll ) ]

		if { $xview < 0 } { set xview 0 }
	}

	scrollSet $NET_SBV $net_hheight $net_cheight $net_scroll $yview

	scrollSet $NET_SBH $net_hwidth $net_cwidth $net_scroll $xview

	#debug_proc setNetworkView exit
}


proc fileHandle { cmd label menuvar setflag } \
{
	#debug_proc fileHandle entry

	if { $cmd == "quit" } \
	{
		pvm_quit
	} \
\
	elseif { $cmd == "halt" } \
	{
		pvm_halt
	}

	#debug_proc fileHandle exit
}


proc viewSelect { view label menuvar setflag } \
{
	#debug_proc viewSelect entry

	global $menuvar

	global min_main_height
	global min_main_width
	global min_net_height
	global min_st_height
	global height_left
	global net_active
	global net_height
	global net_width
	global mq_active
	global ct_active
	global to_active
	global tv_active
	global st_active
	global ut_active
	global st_height
	global st_width
	global scale

	global UT
	global MQ
	global CT
	global TO
	global TV

	set state [ set $menuvar ]

	if { $setflag == "TRUE" } \
	{
		if { $state == "ON" } \
		{
			set $menuvar OFF

			set state OFF
		} \
\
		else \
		{
			set $menuvar ON

			set state ON
		}
	}

	if { $view == "network" } \
	{
		if { $state == "ON" } \
		{
			set min_main_height \
				[ expr $min_main_height + $min_net_height ]

			checkMainHeight

			set net_active TRUE

			if { $st_active == "TRUE" } \
			{
				set net_height [ expr $height_left / 2 ]

				if { $net_height < $min_net_height } \
					{ set net_height $min_net_height }

				set st_height [ expr $height_left - $net_height ]

				if { $st_height < $min_st_height } \
				{
					set net_height [ expr $net_height - \
						( $min_st_height - $st_height ) ]

					set st_height $min_st_height
				}
			} \
\
			else \
				{ set net_height $height_left }

			netUpdate
		} \
\
		else \
		{
			set net_active FALSE

			set net_height 2

			if { $st_active == "TRUE" } \
				{ set st_height $height_left }

			set min_main_height \
				[ expr $min_main_height - $min_net_height ]
		}

		layout_main_panel

		wm minsize .xpvm $min_main_width $min_main_height
	} \
\
	elseif { $view == "space_time" } \
	{
		if { $state == "ON" } \
		{
			set min_main_height \
				[ expr $min_main_height + $min_st_height ]

			checkMainHeight

			set st_active TRUE

			if { $net_active == "TRUE" } \
			{
				set net_height [ expr $height_left / 2 ]

				if { $net_height < $min_net_height } \
					{ set net_height $min_net_height }

				set st_height [ expr $height_left - $net_height ]

				if { $st_height < $min_st_height } \
				{
					set net_height [ expr $net_height - \
						( $min_st_height - $st_height ) ]

					set st_height $min_st_height
				}
			} \
\
			else \
				{ set st_height $height_left }

			taskSTUpdate

			timeZoom $scale

			if { $ut_active == "TRUE" } \
				{ rescrollViews UT }
		} \
\
		else \
		{
			set st_active FALSE

			set st_height 0

			if { $net_active == "TRUE" } \
				{ set net_height $height_left }

			set min_main_height \
				[ expr $min_main_height - $min_st_height ]
		}

		layout_main_panel

		wm minsize .xpvm $min_main_width $min_main_height
	} \
\
	elseif { $view == "utilization" } \
	{
		if { $state == "ON" } \
		{
			wm deiconify $UT

			set ut_active TRUE

			utUpdate

			timeZoom $scale

			if { $st_active == "TRUE" } \
				{ rescrollViews ST }
		} \
\
		else \
		{
			wm withdraw $UT

			set ut_active FALSE
		}
	} \
\
	elseif { $view == "msgq" } \
	{
		if { $state == "ON" } \
		{
			wm deiconify $MQ

			set mq_active TRUE

			mqUpdate
		} \
\
		else \
		{
			wm withdraw $MQ

			set mq_active FALSE
		}
	} \
\
	elseif { $view == "call_trace" } \
	{
		if { $state == "ON" } \
		{
			wm deiconify $CT

			set ct_active TRUE

			taskCTUpdate
		} \
\
		else \
		{
			wm withdraw $CT

			set ct_active FALSE
		}
	} \
\
	elseif { $view == "task_output" } \
	{
		if { $state == "ON" } \
		{
			wm deiconify $TO

			set to_active TRUE

			toUpdate
		} \
\
		else \
		{
			wm withdraw $TO

			set to_active FALSE
		}
	} \
\
	elseif { $view == "task_tevhist" } \
	{
		if { $state == "ON" } \
		{
			wm deiconify $TV

			set tv_active TRUE

			tvUpdate
		} \
\
		else \
		{
			wm withdraw $TV

			set tv_active FALSE
		}
	}

	#debug_proc viewSelect exit
}


proc optionsHandle { cmd label menuvar setflag } \
{
	#debug_proc fileHandle entry

	global correlate_keep
	global correlate_lock
	global st_query_keep

	if { $cmd == "query" } \
	{
		#
		# Clean Up Any Correlate Stuff
		#

		timeid_proc modify -1 1 blue

		set correlate_lock FALSE

		set correlate_keep FALSE

		correlate_views -1
	} \
\
	elseif { $cmd == "correlate" } \
	{
		#
		# Clean Up Any Query
		#

		set st_query_keep FALSE

		st_query_info -1 -1 -1 0

		set_query_time -1
	} \
\
	elseif { $cmd == "alpha" } \
	{
		set_task_sort alpha
	} \
\
	elseif { $cmd == "tid" } \
	{
		set_task_sort tid
	} \
\
	elseif { $cmd == "custom" } \
	{
		set_task_sort custom
	}

	#debug_proc fileHandle exit
}


proc raiseFastForwardFrames { } \
{
	#debug_proc raiseFastForwardFrames entry

	global FF_LIST

	global border_space

	set bs2 [ expr 2 * $border_space ]

	foreach ff $FF_LIST \
	{
		set name [ lindex $ff 0 ]

		set ht [ expr [ winfo height $name.label ] + $bs2 ]
		set wt [ expr [ winfo width $name.label ] + $bs2 ]

		set canvas [ lindex $ff 1 ]

		set cht [ winfo height $canvas ]
		set cwt [ winfo width $canvas ]

		set x [ expr [ winfo x $canvas ] + ( $cwt / 2 ) - ( $wt / 2 ) ]
		set y [ expr [ winfo y $canvas ] + ( $cht / 2 ) - ( $ht / 2 ) ]

		place $name -x $x -y $y -width $wt -height $ht
	}

	#debug_proc raiseFastForwardFrames exit
}


proc lowerFastForwardFrames { } \
{
	#debug_proc lowerFastForwardFrames entry

	global FF_LIST

	foreach ff $FF_LIST \
	{
		set name [ lindex $ff 0 ]

		place forget $name
	}

	#debug_proc lowerFastForwardFrames exit
}


proc checkMainHeight { } \
{
	#debug_proc checkMainHeight entry

	global min_main_height
	global start_main_y
	global height_left
	global main_height
	global ctrl_height

	set ht [ winfo height .xpvm ]

	if { $ht < $min_main_height } \
	{
		set wt [ winfo width .xpvm ]

		set geom "[ expr $wt ]x[ expr $min_main_height ]"

		wm geometry .xpvm $geom

		update

		set height_left \
			[ expr $main_height - $start_main_y - $ctrl_height ]
	}

	#debug_proc checkMainHeight exit
}


proc adjust_main_panel { action y } \
{
	#debug_proc adjust_main_panel entry

	global min_net_height
	global min_st_height
	global hold_motion
	global net_active
	global net_height
	global st_active
	global st_height
	global adjust_y
	global nest_y

	if { $net_active != "TRUE" || $st_active != "TRUE" } \
		{ return }

	global ADJ

	if { $action == "press" } \
	{
		$ADJ configure -state active -relief sunken

		set hold_motion 0

		set nest_y NONE

		set adjust_y $y
	} \
\
	elseif { $action == "release" } \
	{
		$ADJ configure -state normal -relief raised
	} \
\
	elseif { $action == "motion" } \
	{
		if { $hold_motion == 0 } \
		{
			set hold_motion 1

			set first 1

			while { $first == 1 || $nest_y != "NONE" } \
			{
				if { $first == 1 } \
					{ set first 0 } \
\
				else \
				{
					set ry $nest_y

					set nest_y NONE

					set rooty [ winfo rooty $ADJ ]

					set y [ expr $ry - $rooty ]
				}

				set delta_y [ expr $y - $adjust_y ]

				if { $delta_y != 0 } \
				{
					set rooty [ winfo rooty $ADJ ]

					set ry [ expr $y + $rooty ]

					set net_height [ expr $net_height + $delta_y ]

					if { $net_height < $min_net_height } \
					{
						set delta_y [ expr $delta_y + \
							( $min_net_height - $net_height ) ]

						set net_height $min_net_height
					}

					set st_height [ expr $st_height - $delta_y ]

					if { $st_height < $min_st_height } \
					{
						set delta_y [ expr $delta_y - \
							( $min_st_height - $st_height ) ]

						set net_height [ expr $net_height - \
							( $min_st_height - $st_height ) ]

						set st_height $min_st_height
					}

					layout_main_panel

					set rooty [ winfo rooty $ADJ ]

					set adjust_y [ expr $ry - [ winfo rooty $ADJ ] ]
				}
			}

			set hold_motion 0
		} \
\
		else \
		{
			set rooty [ winfo rooty $ADJ ]

			set nest_y [ expr $rooty + $y ]
		}
	}

	#debug_proc adjust_main_panel exit
}


proc change_st_height { way } \
{
	#debug_proc change_st_height entry

	global change_st_height_lock
	global st_label_ht
	global st_rect_ht

	global ST

	if { $change_st_height_lock == 0 } \
	{
		set change_st_height_lock 1

		set lq [ interface_lock query ]

		if { $lq == "locked" } \
		{
			set change_st_height_lock 0

			bell

			return
		}

		interface_lock lock

		if { $way == "shrink" } \
		{
			setMsg { Shrinking Task Height... }

			set st_label_ht [ expr $st_label_ht - 1 ]
		} \
\
		elseif { $way == "grow" } \
		{
			setMsg { Growing Task Height... }

			set st_label_ht [ expr $st_label_ht + 1 ]
		} \
\
		elseif { $way == "set" } \
		{
			setMsg { Setting Task Height... }

			set new_ht [ $ST.task_height_entry get ]

			set ck [ scan $new_ht "%d" new_ht_val ]

			if { $ck == 0 || $new_ht_val <= 0 } \
			{
				$ST.task_height_entry delete 0 end

				$ST.task_height_entry insert 0 $st_label_ht

				set change_st_height_lock 0

				bell

				return
			}

			set st_label_ht $new_ht_val
		}

		set st_rect_ht [ expr ( 8 * $st_label_ht ) / 20 ]

		if { $st_label_ht < 4 } \
			{ set st_label_ht 4 }

		if { $st_rect_ht < 3 } \
			{ set st_rect_ht 3 }

		#
		# Update Entry Text
		#

		$ST.task_height_entry delete 0 end

		$ST.task_height_entry insert 0 $st_label_ht

		#
		# Fix Scroll Stuff
		#

		global stl_yview

		global XSCROLLINCREMENT
		global YSCROLLINCREMENT

		global ST_L
		global ST_C
		global ST_SBV

		global CT_L
		global CT_C
		global CT_SBH
		global CT_SBV

		$ST_L configure $YSCROLLINCREMENT $st_label_ht

		$CT_L configure $YSCROLLINCREMENT $st_label_ht
		$CT_C configure $XSCROLLINCREMENT $st_label_ht \
			$YSCROLLINCREMENT $st_label_ht

		set cmd_sv [ list scrollTwoCanvases $ST_L $ST_C $ST_SBV \
			-1 tasks_height st_cheight stl_yview stc_yview VERT low \
			$st_label_ht 1 ]

		$ST_SBV configure -command $cmd_sv

		set cmd_ch [ list scrollCanvas $CT_C $CT_SBH \
			-1 ct_canvas_width ct_cwidth ct_xview HORIZ low \
			$st_label_ht ]

		$CT_SBH configure -command $cmd_ch

		set cmd_cv [ list scrollTwoCanvases $CT_L $CT_C $CT_SBV \
			-1 tasks_height ct_cheight ct_yview ct_yview VERT low \
			$st_label_ht $st_label_ht ]

		$CT_SBV configure -command $cmd_cv

		taskArrange

		eval "$cmd_sv $stl_yview"

		setMsg { Task Height Adjusted. }

		interface_lock unlock

		set change_st_height_lock 0
	} \
\
	else \
		{ bell }

	#debug_proc change_st_height exit
}


proc resize_main_panel { } \
{
	#debug_proc resize_main_panel entry

	global min_net_height
	global min_st_height
	global start_main_y
	global height_left
	global ctrl_height
	global main_height
	global ctrl_width
	global main_width
	global net_active
	global net_height
	global net_width
	global st_active
	global st_height
	global st_width

	set ht [ winfo height .xpvm ]
	set wt [ winfo width .xpvm ]

	if { $main_width != $wt || $main_height != $ht } \
	{
		set main_height $ht
		set main_width $wt

		set height_left \
			[ expr $main_height - $start_main_y - $ctrl_height ]

		if { $net_active == "TRUE" } \
		{
			set net_height [ expr ( $net_height * $height_left ) \
				/ ( $net_height + $st_height ) ]

			if { $net_height < $min_net_height } \
				{ set net_height $min_net_height }
		} \
\
		else \
			{ set net_height 2 }

		if { $st_active == "TRUE" } \
		{
			set st_height [ expr $height_left - $net_height ]

			if { $st_height < $min_st_height } \
			{
				set net_height [ expr $net_height + \
					( $min_st_height - $st_height ) ]

				set st_height $min_st_height
			}
		} \
\
		else \
			{ set st_height 0 }

		set ctrl_width $wt
		set net_width $wt
		set st_width $wt

		layout_main_panel

		fix_menus_resize
	}

	#debug_proc resize_main_panel exit
}


proc layout_main_panel { } \
{
	#debug_proc layout_main_panel entry

	global st_labels_width
	global border_space
	global scroll_width
	global main_height
	global ctrl_height
	global main_width
	global ctrl_width
	global net_active
	global net_height
	global net_width
	global st_active
	global st_height
	global st_width
	global ctrl_x
	global ctrl_y
	global net_y
	global st_y

	global CTRL

	global NET

	global ST

	#
	# Status Message Label
	#

	set msg_wt [ expr $main_width - (2 * $border_space) ]

	place .xpvm.message -width $msg_wt

	place .xpvm.tmp_msg -width $msg_wt

	#
	# Set View Positions
	#

	set ctrl_y [ expr $net_y + $net_height ]

	set st_y [ expr $ctrl_y + $ctrl_height ]

	#
	# Layout Network View
	#

	if { $net_active == "TRUE" } \
	{
		layout_net_panel

		setNetworkView
	} \
\
	else \
		{ place forget $NET }

	#
	# Layout View Select & Playback Controls
	#

	set x [ expr $ctrl_width - $border_space ]

	place $CTRL.overwrite -x $x

	update

	set x [ expr [ left $CTRL.overwrite ] - $border_space ]

	place $CTRL.playback -x $x

	update

	set fewt [ expr [ left $CTRL.playback ] \
		- [ winfo x $CTRL.file ] - [ winfo width $CTRL.file ] \
		- $border_space ]

	place $CTRL.file_entry -width $fewt

	place $CTRL -x $ctrl_x -y $ctrl_y \
		-width $ctrl_width -height $ctrl_height

	#
	# Layout Space-Time View
	#

	if { $st_active == "TRUE" } \
	{
		layout_st_panel
	} \
\
	else \
		{ place forget $ST }

	update

	#debug_proc layout_main_panel exit
}


proc layout_net_panel { } \
{
	#debug_proc layout_net_panel entry

	global frame_border
	global border_space
	global scroll_width
	global net_cheight
	global net_hheight
	global net_cwidth
	global net_hwidth
	global net_scroll
	global net_active
	global net_height
	global net_width
	global net_xview
	global net_yview
	global net_size
	global depth
	global net_x
	global net_y

	global NET
	global NET_C
	global NET_SBH
	global NET_SBV

	#
	# Top Titles
	#

	place $NET -x $net_x -y $net_y \
		-width $net_width -height $net_height

	place $NET.title -relx 0.5 -y 0 -anchor n

	#
	# Bottom Buttons
	#

	set kly [ expr $net_height - ($border_space / 2) ]

	place $NET.close -x $border_space -y $kly -anchor sw

	set kky [ expr $kly - $frame_border ]

	if { $depth != 1 } \
	{
		place $NET.active_label -relx 0.23 -y $kky -anchor s
		place $NET.system_label -relx 0.43 -y $kky -anchor s
		place $NET.empty_label -relx 0.65 -y $kky -anchor s

		place $NET.netkey \
			-x [ expr $net_width - $border_space ] -y $kly -anchor se
	} \
\
	else \
	{
		place $NET.active_label -relx 0.21 -y $kky -anchor sw
		place $NET.system_label -relx 0.44 -y $kky -anchor sw
		place $NET.empty_label -relx 0.70 -y $kky -anchor sw
	}

	update

	set sz [ expr [ winfo height $NET.active_label ] - 2 ]

	set kky [ expr $kky - 2 ]

	place $NET.active_box \
		-x [ right $NET.active_label ] -y $kky -anchor sw \
		-width $sz -height $sz

	place $NET.system_box \
		-x [ right $NET.system_label ] -y $kky -anchor sw \
		-width $sz -height $sz

	place $NET.empty_box \
		-x [ right $NET.empty_label ] -y $kky -anchor sw \
		-width $sz -height $sz

	update

	#
	# Canvas & Scrollbars
	#

	set net_cy [ below $NET.title ]

	set net_cheight [ expr [ above $NET.close ] - $net_cy \
		- $scroll_width - ($border_space / 2) ]

	set net_cwidth [ expr $net_width - $scroll_width \
		- (2 * $border_space)]

	set net_sbx $border_space

	place $NET_SBV -x $net_sbx -y $net_cy \
		-width $scroll_width -height $net_cheight

	if { $net_hheight < $net_cheight } \
		{ set yview 0 } \
\
	else \
	{
		set yview [ expr $net_yview \
			- ( ( ($net_size / 2) - ($net_hheight / 2) ) \
				/ $net_scroll ) ]

		if { $yview < 0 } { set yview 0 }
	}

	scrollSet $NET_SBV $net_hheight $net_cheight $net_scroll $yview

	set net_cx [ expr $net_sbx + $scroll_width ]

	place $NET_C -x $net_cx -y $net_cy \
		-width $net_cwidth -height $net_cheight

	set net_sby [ expr $net_cy + $net_cheight ]

	place $NET_SBH -x $net_cx -y $net_sby \
		-width $net_cwidth -height $scroll_width

	if { $net_hheight < $net_cheight } \
		{ set xview 0 } \
\
	else \
	{
		set xview [ expr $net_xview \
			- ( ( ($net_size / 2) - ($net_hwidth / 2) ) \
				/ $net_scroll ) ]

		if { $xview < 0 } { set xview 0 }
	}

	scrollSet $NET_SBH $net_hwidth $net_cwidth $net_scroll $xview

	update

	#debug_proc layout_net_panel exit
}


proc resize_nk_panel { } \
{
	#debug_proc resize_nk_panel entry

	global nk_height
	global nk_width

	global NK

	set ht [ winfo height $NK ]
	set wt [ winfo width $NK ]

	if { $nk_width != $wt || $nk_height != $ht } \
	{
		set nk_height $ht
		set nk_width $wt

		layout_nk_panel

		update
	}

	#debug_proc resize_nk_panel exit
}


proc layout_nk_panel { } \
{
	#debug_proc layout_nk_panel entry

	global net_volume_color_size
	global border_space
	global frame_border
	global nk_height
	global nk_width

	global NK_F

	#
	# Place Top Titles
	#

	place $NK_F -x 0 -y 0 -width $nk_width -height $nk_height

	set nkx [ expr $border_space / 2 ]
	set nky [ expr $border_space / 2 ]

	place $NK_F.title -relx 0.50 -y $nky -anchor n

	update

	set nky [ below $NK_F.title ]

	place $NK_F.label -x $nkx -y $nky -anchor nw

	update

	set nky [ below $NK_F.label ]

	#
	# Place Close Button
	#

	place $NK_F.close -x $nkx -y [ expr $nk_height - $nkx ] -anchor sw

	update

	set lht [ expr ( ( [ above $NK_F.close ] - $nky ) \
		/ $net_volume_color_size ) - (2 * $frame_border) ]

	#
	# Place Level Labels
	#

	set nkcx 0

	for { set i 0 } { $i < $net_volume_color_size } \
		{ set i [ expr $i + 1 ] } \
	{
		place $NK_F.label$i -x $nkx -y $nky -anchor nw \
			-height $lht

		update

		set wt [ winfo width $NK_F.label$i ]

		if { $wt > $nkcx } \
			{ set nkcx $wt }

		set nky [ expr [ below $NK_F.label$i ] + (2 * $frame_border) ]
	}

	set nkcx [ expr $nkx + $nkcx ]

	set cwt [ expr $nk_width - $nkcx - $border_space ]

	#
	# Place Color Labels
	#

	set nky [ below $NK_F.label ]

	for { set i 0 } { $i < $net_volume_color_size } \
		{ set i [ expr $i + 1 ] } \
	{
		place $NK_F.label$i -x $nkcx -y $nky -anchor ne

		place $NK_F.key$i -x $nkcx -y $nky -anchor nw \
			-width $cwt -height $lht

		set nky [ expr [ below $NK_F.label$i ] + (2 * $frame_border) ]
	}

	#debug_proc layout_nk_panel exit
}


proc layout_st_panel { } \
{
	#debug_proc layout_st_panel entry

	global st_labels_width
	global tasks_height
	global frame_border
	global border_space
	global scroll_width
	global st_label_ht
	global st_cheight
	global st_cwidth
	global st_lwidth
	global st_active
	global st_height
	global st_width
	global st_xview
	global stl_yview
	global timex
	global st_x
	global st_y

	global ST
	global ST_L
	global ST_C
	global ST_SBH
	global ST_SBV

	#
	# Top Titles
	#

	set st_lwidth [ expr $st_labels_width + $scroll_width ]

	place $ST -x $st_x -y $st_y -width $st_width -height $st_height

	set stx $border_space
	set sty [ expr $border_space / 2 ]

	place $ST.title -relx 0.50 -y $sty -anchor n

	#
	# Bottom Buttons
	#

	set kly [ expr $st_height - ($border_space / 2) ]

	place $ST.computing_label -relx 0.10 -y $kly -anchor s
	place $ST.user_defined_label -relx 0.32 -y $kly -anchor s
	place $ST.overhead_label -relx 0.52 -y $kly -anchor s
	place $ST.waiting_label -relx 0.69 -y $kly -anchor s
	place $ST.message_label -relx 0.86 -y $kly -anchor s

	update

	set sz [ winfo height $ST.computing_label ]

	set kky [ expr $kly - ( $sz / 2 ) ]

	place $ST.computing_box \
		-x [ right $ST.computing_label ] -y $kky -anchor w \
		-width $sz -height [ expr $sz / 2 ]

	place $ST.user_defined_box \
		-x [ right $ST.user_defined_label ] -y $kky -anchor w \
		-width $sz -height [ expr $sz / 2 ]

	place $ST.overhead_box \
		-x [ right $ST.overhead_label ] -y $kky -anchor w \
		-width $sz -height [ expr $sz / 2 ]

	place $ST.waiting_box \
		-x [ right $ST.waiting_label ] -y $kky -anchor w \
		-width $sz -height [ expr $sz / 2 ]

	place $ST.message_box \
		-x [ right $ST.message_label ] -y $kky -anchor w \
		-width $sz -height 2

	update

	set stmy [ expr [ above $ST.computing_label ] \
		- ($border_space / 2) ]

	place $ST.query_frame -x $border_space -y $stmy -anchor sw \
		-width [ expr $st_width - (2 * $border_space) ] \
		-height [ expr $sz + (2 * $frame_border) ]

	place $ST.query_frame.query -x 0 -y 0 -anchor nw -height $sz

	update

	set stcby [ expr [ above $ST.query_frame ] - ( $border_space / 2 ) ]

	place $ST.close -x $border_space -y $stcby -anchor sw

	update

	set cbx [ expr $border_space + [ winfo width $ST.close ] ]

	set cbwt [ expr $border_space + $st_lwidth - $cbx ]

	set shrinkx [ expr $cbx + ( $cbwt / 5 ) ]

	place $ST.shrink -x $shrinkx -y $stcby -anchor s

	set growx [ expr $cbx + ( 2 * $cbwt / 5 ) ]

	place $ST.grow -x $growx -y $stcby -anchor s

	update

	set setx [ expr $cbx + ( 3.5 * $cbwt / 5 ) ]

	place $ST.task_height_entry -x $setx -y $stcby -anchor s \
		-width [ expr 2 * [ winfo width $ST.shrink ] ]

	update

	#
	# Canvases & Scrollbars
	#

	set st_cy [ below $ST.title ]

	set st_cheight [ expr [ above $ST.close ] - $st_cy \
		- ($border_space / 2) ]

	set st_cwidth [ expr $st_width - $st_lwidth \
		- (2 * $border_space) ]

	place $ST_SBV -x $stx -y $st_cy \
		-width $scroll_width -height $st_cheight

	scrollSet $ST_SBV $tasks_height $st_cheight $st_label_ht $stl_yview

	set st_lx [ expr $stx + $scroll_width ]

	place $ST_L -x $st_lx -y $st_cy \
		-width $st_labels_width -height $st_cheight

	set st_cx [ expr $st_lx + $st_labels_width ]

	place $ST_C -x $st_cx -y $st_cy \
		-width $st_cwidth -height $st_cheight

	set stsby [ expr $st_cy + $st_cheight ]

	place $ST_SBH -x $st_cx -y $stsby \
		-width $st_cwidth -height $scroll_width

	scrollSet $ST_SBH $timex $st_cwidth 1 $st_xview

	update

	#debug_proc layout_st_panel exit
}


proc layout_spawn_dialog { } \
{
	#debug_proc layout_spawn_dialog entry

	global spawn_flags_trace
	global border_space
	global trace_format
	global spawn_where
	global spawn_width

	global SP

	place $SP.cmd -x $border_space -y $border_space

	update

	set nwt [ expr $spawn_width - [ winfo width $SP.cmd ] ]

	place $SP.cmd_entry \
		-x [ right $SP.cmd ] -y $border_space -width $nwt

	update

	place $SP.flags -x $border_space -y [ below $SP.cmd_entry ]

	update

	set indentx [ expr 2 * $border_space ]

	set try [ below $SP.flags ]

	place $SP.flags_trace -x $indentx -y $try

	update

	place $SP.flags_debug -x $indentx -y [ below $SP.flags_trace ]

	update

	place $SP.flags_front -x $indentx -y [ below $SP.flags_debug ]

	update

	place $SP.flags_compl -x $indentx -y [ below $SP.flags_front ]

	if { $spawn_flags_trace == "ON" } \
	{
		if { $trace_format == "3.3" } \
		{
			set tx [ expr [ right $SP.flags_trace ] \
				+ (3 * $border_space) ]

			place $SP.trace_mask -anchor nw -x $tx -y $try
		} \
\
		elseif { $trace_format == "3.4" } \
		{
			set tx [ expr [ right $SP.flags_trace ] \
				+ (3 * $border_space) ]

			place $SP.buf -anchor nw -x $tx -y $try

			update

			set bewt [ expr $spawn_width - $tx \
				- [ winfo width $SP.buf ] + $border_space ]

			place $SP.buf_entry -anchor nw \
				-x [ right $SP.buf ] -y $try -width $bewt

			update

			place $SP.trace_mask -anchor nw -x $tx \
				-y [ below $SP.buf_entry ]
		}
	} \
\
	else \
	{
		place forget $SP.buf
		place forget $SP.buf_entry
		place forget $SP.trace_mask
	}

	update

	place $SP.where -x $border_space -y [ below $SP.flags_compl ]

	update

	place $SP.where_host -x $indentx -y [ below $SP.where ]

	update

	place $SP.where_arch -x $indentx -y [ below $SP.where_host ]

	update

	place $SP.where_default -x $indentx -y [ below $SP.where_arch ]

	update

	if { $spawn_where != "Default" } \
	{
		set ly [ below $SP.where_default ]

		$SP.loc configure -text $spawn_where

		place $SP.loc -x $border_space -y $ly

		update

		set lwt [ expr $spawn_width - [ winfo width $SP.loc ] ]

		place $SP.loc_entry -x [ right $SP.loc ] -y $ly -width $lwt

		update

		set ny [ below $SP.loc_entry ]
	} \
\
	else \
	{
		place forget $SP.loc

		place forget $SP.loc_entry

		set ny [ below $SP.where_default ]
	}

	place $SP.ntasks -x $border_space -y $ny

	update

	set twt [ expr $spawn_width - [ winfo width $SP.ntasks ] ]

	place $SP.ntasks_entry -x [ right $SP.ntasks ] -y $ny -width $twt

	update

	set y [ below $SP.ntasks_entry ]

	place $SP.close_on_start -x $border_space -y $y

	update

	set y [ below $SP.close_on_start ]

	place $SP.close -x $border_space -y $y

	place $SP.start_append -anchor n -relx 0.50 -y $y

	place $SP.start -anchor ne -x $spawn_width -y $y

	update

	$SP configure \
		-width [ expr $spawn_width + (2 * $border_space) + 8 ] \
		-height [ expr $y + [ winfo height $SP.close ] \
			+ $border_space + 4 ]

	#debug_proc layout_spawn_dialog exit
}


proc layout_otf_dialog { } \
{
	#debug_proc layout_otf_dialog entry

	global tracing_status
	global scroll_width
	global border_space
	global otf_cheight
	global otf_cwidth
	global otf_height
	global otf_width

	global OTF
	global OTF_C
	global OTF_CW
	global OTF_SBH
	global OTF_SBV

	$OTF configure -width $otf_width -height $otf_height

	#
	# Top Titles
	#

	set x $border_space
	set y [ expr $border_space / 2 ]

	set cx [ expr $x + $scroll_width ]

	place $OTF.tasks -x $cx -y $y

	#
	# Trace Settings
	#

	set tx [ expr $otf_width - $border_space ]

	place $OTF.tracing -x $tx -y $y -anchor ne

	update

	place $OTF.trace_on -x $tx -y [ below $OTF.tracing ] -anchor ne

	update

	place $OTF.trace_off -x $tx -y [ below $OTF.trace_on ] -anchor ne

	update

	if { $tracing_status == "On" } \
	{
		place $OTF.trace_mask -anchor ne \
			-x $tx -y [ expr [ below $OTF.trace_off ] + $border_space ]
	} \
\
	else \
		{ place forget $OTF.trace_mask }

	update

	#
	# Bottom Buttons
	#

	set cly [ expr $otf_height - $border_space ]

	place $OTF.close -x $x -y $cly -anchor sw

	place $OTF.refresh -relx 0.40 -y $cly -anchor s

	set kax [ expr $otf_width - $border_space ]

	place $OTF.otf_all -x $kax -y $cly -anchor se

	update

	#
	# Canvas & Scrollbars
	#

	set ly [ below $OTF.tasks ]

	set otf_cheight [ expr [ above $OTF.close ] - $ly \
		- $scroll_width - $border_space ]

	set x1 [ left $OTF.tracing ]
	set x2 [ left $OTF.trace_mask ]

	if { $x1 < $x2 } \
		{ set lx $x1 } \
\
	else \
		{ set lx $x2 }

	set otf_cwidth [ expr $lx - $scroll_width - (2 * $border_space) ]

	place $OTF_SBV -x $x -y $ly \
		-width $scroll_width -height $otf_cheight

	place $OTF_C -x $cx -y $ly \
		-width $otf_cwidth -height $otf_cheight

	set sby [ expr $ly + $otf_cheight ]

	place $OTF_SBH -x $cx -y $sby \
		-width $otf_cwidth -height $scroll_width

	update

	#debug_proc layout_otf_dialog exit
}


proc layout_kill_dialog { } \
{
	#debug_proc layout_kill_dialog entry

	global scroll_width
	global border_space
	global kill_cheight
	global kill_cwidth
	global kill_height
	global kill_width

	global KL
	global KL_C
	global KL_CW
	global KL_SBH
	global KL_SBV

	$KL configure -width $kill_width -height $kill_height

	#
	# Top Titles
	#

	set x $border_space
	set y [ expr $border_space / 2 ]

	set cx [ expr $x + $scroll_width ]

	place $KL.tasks -x $cx -y $y

	#
	# Bottom Buttons
	#

	set cly [ expr $kill_height - $border_space ]

	place $KL.close -x $x -y $cly -anchor sw

	place $KL.refresh -relx 0.50 -y $cly -anchor s

	set kax [ expr $kill_width - $border_space ]

	place $KL.kill_all -x $kax -y $cly -anchor se

	update

	#
	# Canvas & Scrollbars
	#

	set ly [ below $KL.tasks ]

	set kill_cheight [ expr [ above $KL.close ] - $ly \
		- $scroll_width - $border_space ]

	set kill_cwidth [ expr $kill_width - $scroll_width \
		- (2 * $border_space)]

	place $KL_SBV -x $x -y $ly \
		-width $scroll_width -height $kill_cheight

	place $KL_C -x $cx -y $ly \
		-width $kill_cwidth -height $kill_cheight

	set sby [ expr $ly + $kill_cheight ]

	place $KL_SBH -x $cx -y $sby \
		-width $kill_cwidth -height $scroll_width

	update

	#debug_proc layout_kill_dialog exit
}


proc signal_button { name index } \
{
	#debug_proc signal_button entry

	global active_fg_color
	global selector_color
	global frame_border
	global fg_color

	global SELECTOR

	global SG_LFCW

	radiobutton $SG_LFCW.$name -text $index -value $index \
		-padx 1 -pady 1 \
		-bd $frame_border -relief flat \
		-variable signal_selected \
		$SELECTOR $selector_color -foreground $fg_color \
		-activeforeground $active_fg_color

	restrict_bindings $SG_LFCW.$name ""

	butt_help $SG_LFCW.$name button "Select Unix Signal $index"

	#debug_proc signal_button exit
}


proc layout_signal_dialog { } \
{
	#debug_proc layout_signal_dialog entry

	global signal_canvas_list_win
	global signal_list_height
	global signal_list_width
	global signal_lcheight
	global signal_cheight
	global signal_cwidth
	global signal_height
	global signal_width
	global scroll_width
	global border_space
	global frame_border

	global FRAME_OFFSET

	global SG
	global SG_C
	global SG_CW
	global SG_SBH
	global SG_SBV

	global SG_LF
	global SG_LFC
	global SG_LFCW
	global SG_LSBV

	$SG configure -width $signal_width -height $signal_height

	#
	# Top Titles
	#

	set x $border_space
	set y [ expr $border_space / 2 ]

	set cx [ expr $x + $scroll_width ]

	place $SG.tasks -x $cx -y $y

	#
	# Bottom Buttons
	#

	set cly [ expr $signal_height - $border_space ]

	place $SG.close -x $x -y $cly -anchor sw

	place $SG.refresh -relx 0.45 -y $cly -anchor s

	set sax [ expr $signal_width - $border_space ]

	place $SG.signal_all -x $sax -y $cly -anchor se

	update

	#
	# Canvases & Scrollbars
	#

	set ly [ below $SG.tasks ]

	set signal_cheight [ expr [ above $SG.close ] - $ly \
		- $scroll_width - $border_space ]

	set signal_cwidth [ expr $signal_width - (2 * $scroll_width) \
		- $signal_list_width - (3 * $border_space)]

	place $SG_SBV -x $x -y $ly \
		-width $scroll_width -height $signal_cheight

	place $SG_C -x $cx -y $ly \
		-width $signal_cwidth -height $signal_cheight

	set lx [ expr $cx + $signal_cwidth + $border_space ]

	set signal_lcheight [ expr $signal_cheight + $scroll_width ]

	place $SG_LSBV -x $lx -y $ly \
		-width $scroll_width -height $signal_lcheight

	set lcx [ expr $lx + $scroll_width ]

	#
	# Signals Column
	#

	place $SG.signals -x $lcx -y $y

	set fo [ expr $FRAME_OFFSET * $frame_border ]

	place $SG_LF \
		-x [ expr $lcx + $fo ] -y [ expr $ly + $fo ] \
		-width [ expr $signal_list_width - (2 * $fo) ] \
		-height [ expr $signal_lcheight - (2 * $fo) ]

	place $SG_LFC -x 0 -y 0 \
		-width [ expr $signal_list_width - (2 * $frame_border) \
			- (2 * $fo) ] \
		-height [ expr $signal_lcheight - (2 * $frame_border) \
			- (2 * $fo) ]

	set bx $frame_border

	place $SG_LFCW.hup	  -x $bx -y $frame_border ; update
	place $SG_LFCW.int	  -x $bx -y [ below $SG_LFCW.hup ] ;	update
	place $SG_LFCW.quit	  -x $bx -y [ below $SG_LFCW.int ] ;	update
	place $SG_LFCW.ill	  -x $bx -y [ below $SG_LFCW.quit ] ;	update
	place $SG_LFCW.trap	  -x $bx -y [ below $SG_LFCW.ill ] ;	update
	place $SG_LFCW.abrt	  -x $bx -y [ below $SG_LFCW.trap ] ;	update
	place $SG_LFCW.emt	  -x $bx -y [ below $SG_LFCW.abrt ] ;	update
	place $SG_LFCW.fpe	  -x $bx -y [ below $SG_LFCW.emt ] ;	update
	place $SG_LFCW.kill	  -x $bx -y [ below $SG_LFCW.fpe ] ;	update
	place $SG_LFCW.bus	  -x $bx -y [ below $SG_LFCW.kill ] ;	update
	place $SG_LFCW.segv	  -x $bx -y [ below $SG_LFCW.bus ] ;	update
	place $SG_LFCW.sys	  -x $bx -y [ below $SG_LFCW.segv ] ;	update
	place $SG_LFCW.pipe	  -x $bx -y [ below $SG_LFCW.sys ] ;	update
	place $SG_LFCW.alrm	  -x $bx -y [ below $SG_LFCW.pipe ] ;	update
	place $SG_LFCW.term	  -x $bx -y [ below $SG_LFCW.alrm ] ;	update
	place $SG_LFCW.urg	  -x $bx -y [ below $SG_LFCW.term ] ;	update
	place $SG_LFCW.stop	  -x $bx -y [ below $SG_LFCW.urg ] ;	update
	place $SG_LFCW.tstp	  -x $bx -y [ below $SG_LFCW.stop ] ;	update
	place $SG_LFCW.cont	  -x $bx -y [ below $SG_LFCW.tstp ] ;	update
	place $SG_LFCW.chld	  -x $bx -y [ below $SG_LFCW.cont ] ;	update
	place $SG_LFCW.ttin	  -x $bx -y [ below $SG_LFCW.chld ] ;	update
	place $SG_LFCW.ttou	  -x $bx -y [ below $SG_LFCW.ttin ] ;	update
	place $SG_LFCW.io	  -x $bx -y [ below $SG_LFCW.ttou ] ;	update
	place $SG_LFCW.xcpu	  -x $bx -y [ below $SG_LFCW.io ] ;		update
	place $SG_LFCW.xfsz	  -x $bx -y [ below $SG_LFCW.xcpu ] ;	update
	place $SG_LFCW.vtalrm -x $bx -y [ below $SG_LFCW.xfsz ] ;	update
	place $SG_LFCW.prof	  -x $bx -y [ below $SG_LFCW.vtalrm ] ; update
	place $SG_LFCW.winch  -x $bx -y [ below $SG_LFCW.prof ] ;	update
	place $SG_LFCW.lost	  -x $bx -y [ below $SG_LFCW.winch ] ;  update
	place $SG_LFCW.usr1	  -x $bx -y [ below $SG_LFCW.lost ] ;	update
	place $SG_LFCW.usr2	  -x $bx -y [ below $SG_LFCW.usr1 ] ;	update

	set signal_list_height [ expr [ below $SG_LFCW.usr2 ] \
		+ $frame_border ]

	$SG_LFC itemconfigure $signal_canvas_list_win -window $SG_LFCW \
		-height $signal_list_height

	set sby [ expr $ly + $signal_cheight ]

	place $SG_SBH -x $cx -y $sby \
		-width $signal_cwidth -height $scroll_width

	update

	#debug_proc layout_signal_dialog exit
}


proc resize_help_win { index } \
{
	#debug_proc resize_help_win entry

	global min_help_height

	global ${index}_height
	global ${index}_width

	set WIN .${index}_help_win

	set ht [ winfo height $WIN ]
	set wt [ winfo width $WIN ]

	if { [ set ${index}_width ] != $wt \
		|| [ set ${index}_height ] != $ht } \
	{
		set ${index}_height $ht
		set ${index}_width $wt

		layout_help_win $index
	}

	#debug_proc resize_help_win exit
}


proc layout_help_win { index } \
{
	#debug_proc layout_help_win entry

	global border_space
	global scroll_width
	global row_height

	global ${index}_canvas_height
	global ${index}_canvas_width
	global ${index}_cheight
	global ${index}_cwidth
	global ${index}_height
	global ${index}_width
	global ${index}_xview
	global ${index}_yview

	set WIN .${index}_help_win

	set WIN_C $WIN.canvas

	set WIN_SBH $WIN.horiz_sb
	set WIN_SBV $WIN.vert_sb

	#
	# Top Titles
	#

	place $WIN.title -relx 0.50 -y 0 -anchor n

	#
	# Bottom Buttons
	#

	set cly [ expr [ set ${index}_height ] - ($border_space / 2) ]

	place $WIN.close -x $border_space -y $cly -anchor sw

	update

	#
	# Canvas & ScrollBars
	#

	set cy [ below $WIN.title ]

	set ${index}_cheight [ expr [ above $WIN.close ] - $cy \
		- $scroll_width - ($border_space / 2 ) ]

	set ${index}_cwidth [ expr [ set ${index}_width ] - $scroll_width \
		- (2 * $border_space)]

	set sbx $border_space

	place $WIN_SBV -x $sbx -y $cy \
		-width $scroll_width -height [ set ${index}_cheight ]

	scrollSet $WIN_SBV \
		[ set ${index}_canvas_height ] [ set ${index}_cheight ] \
		$row_height [ set ${index}_yview ]

	set cx [ expr $sbx + $scroll_width ]

	place $WIN_C -x $cx -y $cy \
		-width [ set ${index}_cwidth ] \
		-height [ set ${index}_cheight ]

	set sby [ expr $cy + [ set ${index}_cheight ] ]

	place $WIN_SBH -x $cx -y $sby \
		-width [ set ${index}_cwidth ] -height $scroll_width

	scrollSet $WIN_SBH \
		[ set ${index}_canvas_width ] [ set ${index}_cwidth ] \
		$row_height [ set ${index}_xview ]

	update

	#debug_proc layout_help_win exit
}


proc fix_menus_resize { } \
{
	#debug_proc fix_menus_resize entry

	replaceMenu .xpvm.hosts_menu .xpvm.hosts .xpvm

	replaceMenu .xpvm.tasks_menu .xpvm.tasks .xpvm

	replaceMenu .xpvm.views_menu .xpvm.views .xpvm

	replaceMenu .xpvm.reset_menu .xpvm.reset .xpvm

	replaceMenu .xpvm.help_menu .xpvm.help .xpvm
	replaceMenu .xpvm.tasks_help_menu .xpvm.help .xpvm
	replaceMenu .xpvm.views_help_menu .xpvm.help .xpvm

	update

	replaceSubMenu .xpvm.spawn .xpvm.tasks_menu \
		.xpvm.tasks_menu.butt_SPAWN .xpvm.spawn.cmd_entry

	replaceSubMenu .xpvm.systasks_menu .xpvm.tasks_menu \
		.xpvm.tasks_menu.butt_SYS_TASKS none

	update

	replaceMenu .xpvm.trace_mask_menu .xpvm.spawn.trace_mask .xpvm
	replaceMenu .xpvm.host_ev_menu .xpvm.spawn.trace_mask .xpvm
	replaceMenu .xpvm.group_ev_menu .xpvm.spawn.trace_mask .xpvm
	replaceMenu .xpvm.task_ev_menu .xpvm.spawn.trace_mask .xpvm
	replaceMenu .xpvm.comm_ev_menu .xpvm.spawn.trace_mask .xpvm
	replaceMenu .xpvm.buff_ev_menu .xpvm.spawn.trace_mask .xpvm
	replaceMenu .xpvm.pack_ev_menu .xpvm.spawn.trace_mask .xpvm
	replaceMenu .xpvm.unpack_ev_menu .xpvm.spawn.trace_mask .xpvm
	replaceMenu .xpvm.info_ev_menu .xpvm.spawn.trace_mask .xpvm
	replaceMenu .xpvm.misc_ev_menu .xpvm.spawn.trace_mask .xpvm

	#debug_proc fix_menus_resize exit
}


proc resize_ut_panel { } \
{
	#debug_proc resize_ut_panel entry

	global ut_height
	global ut_width

	global UT

	set ht [ winfo height $UT ]
	set wt [ winfo width $UT ]

	if { $ut_width != $wt || $ut_height != $ht } \
	{
		set ut_height $ht
		set ut_width $wt

		layout_ut_panel

		utAdjustHeight

		update
	}

	#debug_proc resize_ut_panel exit
}


proc layout_ut_panel { } \
{
	#debug_proc layout_ut_panel entry

	global border_space
	global scroll_width
	global ut_cheight
	global ut_cwidth
	global col_width
	global ut_height
	global ut_width
	global ut_xview
	global timex

	global UT_F
	global UT_C
	global UT_SBH

	#
	# Place Top Titles
	#

	place $UT_F -x 0 -y 0 -width $ut_width -height $ut_height

	set utx [ expr $border_space / 2 ]
	set uty [ expr $border_space / 2 ]

	place $UT_F.title -relx 0.50 -y $uty -anchor n

	update

	set utcy [ below $UT_F.title ]

	place $UT_F.xN -x $utx -y $utcy

	update

	place $UT_F.xT -x $utx -y [ below $UT_F.xN ]

	update

	place $UT_F.xA -x $utx -y [ below $UT_F.xT ]

	update

	place $UT_F.xS -x $utx -y [ below $UT_F.xA ]

	update

	place $UT_F.xK -x $utx -y [ below $UT_F.xS ]

	update

	place $UT_F.xX -x $utx -y [ below $UT_F.xK ]

	#
	# Place Bottom Buttons
	#

	set kly [ expr $ut_height - ($border_space / 2) ]

	place $UT_F.close -x $border_space -y $kly -anchor sw

	set kky [ expr $kly - 2 ]

	place $UT_F.computing_label -relx 0.32 -y $kky -anchor s
	place $UT_F.overhead_label -relx 0.60 -y $kky -anchor s
	place $UT_F.waiting_label -relx 0.85 -y $kky -anchor s

	update

	set kht [ winfo height $UT_F.computing_label ]
	set kwt [ expr $kht / 2 ]

	place $UT_F.computing_box \
		-x [ right $UT_F.computing_label ] -y $kky -anchor sw \
		-width $kwt -height $kht

	place $UT_F.overhead_box \
		-x [ right $UT_F.overhead_label ] -y $kky -anchor sw \
		-width $kwt -height $kht

	place $UT_F.waiting_box \
		-x [ right $UT_F.waiting_label ] -y $kky -anchor sw \
		-width $kwt -height $kht

	update

	#
	# Place Canvas & Scrollbar
	#

	set ut_cheight [ expr [ above $UT_F.close ] - $utcy \
		- $scroll_width - ($border_space / 2) ]

	set ut_cwidth [ expr $ut_width \
		- (4 * $col_width) - (2 * $border_space) ]

	set utcx [ expr $utx + ($border_space / 2) + (4 * $col_width) ]

	place $UT_F.ntasks -x $utcx -y $utcy -anchor ne

	place $UT_F.tick \
		-x $utcx -y [ expr $utcy + ($ut_cheight / 2) ] -anchor e \
		-width 8 -height 2

	place $UT_F.zero -x $utcx -y [ expr $utcy + $ut_cheight ] -anchor se

	place $UT_C -x $utcx -y $utcy -width $ut_cwidth -height $ut_cheight

	set utsby [ expr $utcy + $ut_cheight ]

	place $UT_SBH -x $utcx -y $utsby \
		-width $ut_cwidth -height $scroll_width

	scrollSet $UT_SBH $timex $ut_cwidth 1 $ut_xview

	update

	#debug_proc layout_ut_panel exit
}


proc resize_mq_panel { } \
{
	#debug_proc resize_mq_panel entry

	global mq_height
	global mq_width

	global MQ

	set ht [ winfo height $MQ ]
	set wt [ winfo width $MQ ]

	if { $mq_width != $wt || $mq_height != $ht } \
	{
		set mq_height $ht
		set mq_width $wt

		layout_mq_panel

		mqArrange
	}

	#debug_proc resize_mq_panel exit
}


proc layout_mq_panel { } \
{
	#debug_proc layout_mq_panel entry

	global mq_tasks_width
	global frame_border
	global border_space
	global scroll_width
	global mq_task_wt
	global mq_cheight
	global mq_cwidth
	global col_width
	global mq_height
	global mq_width
	global mq_xview

	global MQ_F
	global MQ_C
	global MQ_SBH

	#
	# Top Titles
	#

	place $MQ_F -x 0 -y 0 -width $mq_width -height $mq_height

	set mqx [ expr $border_space + (4 * $col_width) ]
	set mqy [ expr $border_space / 2 ]

	place $MQ_F.title -x $mqx -y $mqy -anchor nw

	update

	set mqlx [ expr $border_space / 2 ]

	set mqcy [ below $MQ_F.title ]

	place $MQ_F.xN -x $mqlx -y $mqcy -anchor nw

	update

	place $MQ_F.xB -x $mqlx -y [ below $MQ_F.xN ] -anchor nw

	update

	place $MQ_F.xY -x $mqlx -y [ below $MQ_F.xB ] -anchor nw

	update

	place $MQ_F.xT -x $mqlx -y [ below $MQ_F.xY ] -anchor nw

	update

	place $MQ_F.xE -x $mqlx -y [ below $MQ_F.xT ] -anchor nw

	update

	place $MQ_F.xS -x $mqlx -y [ below $MQ_F.xE ] -anchor nw

	#
	# Bottom Buttons
	#

	set mqclx $border_space
	set mqcly [ expr $mq_height - $border_space ]

	place $MQ_F.close -x $mqclx -y $mqcly -anchor sw

	update

	set mqqwt [ expr $mq_width - [ winfo width $MQ_F.close ] \
		- (3 * $border_space) ]

	set sz [ winfo height $MQ_F.title ]

	place $MQ_F.query_frame \
		-x [ expr [ right $MQ_F.close ] + $border_space ] -y $mqcly \
		-anchor sw \
		-width $mqqwt -height [ expr $sz + (2 * $frame_border) ]

	place $MQ_F.query_frame.query -x 0 -y 0 -anchor nw -height $sz

	update

	#
	# Canvas & Scrollbar
	#

	set mq_cheight [ expr [ above $MQ_F.close ] - $mqcy \
		- $scroll_width - ($border_space / 2) ]

	set mq_cwidth [ expr $mq_width - (4 * $col_width) \
		- (2 * $border_space) ]

	place $MQ_C -x $mqx -y $mqcy -anchor nw \
		-width $mq_cwidth -height $mq_cheight

	place $MQ_F.nbytes -anchor ne -x $mqx -y $mqcy

	place $MQ_F.tick -anchor e \
		-x $mqx -y [ expr $mqcy + ($mq_cheight / 2) ] \
		-width 8 -height 2

	place $MQ_F.zero -anchor se -x $mqx -y [ expr $mqcy + $mq_cheight ]

	set mqsby [ expr $mqcy + $mq_cheight ]

	place $MQ_SBH -x $mqx -y $mqsby \
		-width $mq_cwidth -height $scroll_width

	scrollSet $MQ_SBH $mq_tasks_width $mq_cwidth $mq_task_wt $mq_xview

	update

	#debug_proc layout_mq_panel exit
}


proc resize_ct_panel { } \
{
	#debug_proc resize_ct_panel entry

	global ct_height
	global ct_width

	global CT

	set ht [ winfo height $CT ]
	set wt [ winfo width $CT ]

	if { $ct_width != $wt || $ct_height != $ht } \
	{
		set ct_height $ht
		set ct_width $wt

		layout_ct_panel
	}

	#debug_proc resize_ct_panel exit
}


proc layout_ct_panel { } \
{
	#debug_proc layout_ct_panel entry

	global ct_canvas_width
	global ct_labels_width
	global border_space
	global scroll_width
	global tasks_height
	global st_label_ht
	global ct_cheight
	global ct_cwidth
	global ct_lwidth
	global ct_height
	global ct_width
	global ct_xview
	global ct_yview

	global CT_F
	global CT_L
	global CT_C
	global CT_SBH
	global CT_SBV

	#
	# Top Titles
	#

	place $CT_F -x 0 -y 0 -width $ct_width -height $ct_height

	set ctx $border_space
	set cty [ expr $border_space / 2 ]

	place $CT_F.title -x $ctx -y $cty -anchor nw

	update

	set qwt [ expr $ct_width - [ winfo width $CT_F.title ] \
		- ( 2 * $border_space ) ]

	place $CT_F.query -x [ right $CT_F.title ] -y $cty -anchor nw \
		-width $qwt

	#
	# Bottom Button
	#

	set ctcly [ expr $ct_height - ($border_space / 2) ]

	place $CT_F.close -x $ctx -y $ctcly -anchor sw

	update

	#
	# Canvas & Scrollbars
	#

	set cty [ below $CT_F.query ]

	set ct_cheight [ expr [ above $CT_F.close ] - $cty \
		- ($border_space / 2) ]

	set ct_lwidth [ expr $ct_labels_width + $scroll_width ]

	set ct_cwidth [ expr $ct_width - $ct_lwidth \
		- (2 * $border_space) ]

	place $CT_SBV -x $ctx -y $cty \
		-width $scroll_width -height $ct_cheight

	scrollSet $CT_SBV $tasks_height $ct_cheight $st_label_ht $ct_yview

	set ctlx [ expr $ctx + $scroll_width ]

	place $CT_L -x $ctlx -y $cty \
		-width $ct_labels_width -height $ct_cheight

	set ctcx [ expr $ctlx + $ct_labels_width ]

	place $CT_C -x $ctcx -y $cty \
		-width $ct_cwidth -height $ct_cheight

	set ctsby [ expr $cty + $ct_cheight ]

	place $CT_SBH -x $ctcx -y $ctsby \
		-width $ct_cwidth -height $scroll_width

	scrollSet $CT_SBH $ct_canvas_width $ct_cwidth 1 $ct_xview

	update

	#debug_proc layout_ct_panel exit
}


proc resize_to_panel { } \
{
	#debug_proc resize_to_panel entry

	global to_height
	global to_width

	global TO

	set ht [ winfo height $TO ]
	set wt [ winfo width $TO ]

	if { $to_width != $wt || $to_height != $ht } \
	{
		set to_height $ht
		set to_width $wt

		layout_to_panel
	}

	#debug_proc resize_to_panel exit
}


proc layout_to_panel { } \
{
	#debug_proc layout_to_panel entry

	global to_canvas_width
	global border_space
	global scroll_width
	global frame_border
	global row_height
	global to_cheight
	global to_cwidth
	global to_height
	global to_lasty
	global to_width
	global to_xview
	global to_yview

	global TO_F
	global TO_C
	global TO_SBH
	global TO_SBV

	#
	# Top Titles
	#

	place $TO_F -x 0 -y 0 -width $to_width -height $to_height

	set tox $border_space
	set toy [ expr $border_space / 2 ]

	place $TO_F.title \
		-x $tox -y [ expr $toy + $frame_border ] -anchor nw

	update

	place $TO_F.file_entry -x [ right $TO_F.title ] -y $toy \
		-anchor nw \
		-width [ expr $to_width - [ winfo width $TO_F.title ] \
			- (2 * $border_space) ]

	update

	set toy [ below $TO_F.file_entry ]

	place $TO_F.filter_label \
		-x $tox -y [ expr $toy + $frame_border ] -anchor nw

	update

	place $TO_F.filter_entry -x [ right $TO_F.filter_label ] -y $toy \
		-anchor nw \
		-width [ expr $to_width \
			- [ winfo width $TO_F.filter_label ] \
			- (2 * $border_space) ]

	update

	set toy [ below $TO_F.filter_entry ]

	place $TO_F.search_dir -x $tox -y $toy -anchor nw

	update

	place $TO_F.search_button \
		-x [ right $TO_F.search_dir ] \
		-y [ expr $toy + $frame_border ] \
		-anchor nw

	update

	place $TO_F.search_entry -x [ right $TO_F.search_button ] -y $toy \
		-anchor nw \
		-width [ expr $to_width \
			- [ right $TO_F.search_button ] \
			- $border_space ]

	#
	# Bottom Button
	#

	set tocly [ expr $to_height - ($border_space / 2) ]

	place $TO_F.close -x $tox -y $tocly -anchor sw

	update

	#
	# Canvas & Scrollbars
	#

	set tocy [ below $TO_F.search_dir ]

	set to_cheight [ expr [ above $TO_F.close ] - $tocy \
		- $scroll_width - ($border_space / 2) ]

	set to_cwidth [ expr $to_width - $scroll_width \
		- (2 * $border_space) ]

	place $TO_SBV -x $tox -y $tocy \
		-width $scroll_width -height $to_cheight

	scrollSet $TO_SBV $to_lasty $to_cheight $row_height $to_yview

	set tocx [ expr $tox + $scroll_width ]

	place $TO_C -x $tocx -y $tocy \
		-width $to_cwidth -height $to_cheight

	set tosby [ expr $tocy + $to_cheight ]

	place $TO_SBH -x $tocx -y $tosby \
		-width $to_cwidth -height $scroll_width

	scrollSet $TO_SBH $to_canvas_width $to_cwidth $row_height $to_xview

	update

	#debug_proc layout_to_panel exit
}


proc resize_tv_panel { } \
{
	#debug_proc resize_tv_panel entry

	global tv_height
	global tv_width

	global TV

	set ht [ winfo height $TV ]
	set wt [ winfo width $TV ]

	if { $tv_width != $wt || $tv_height != $ht } \
	{
		set tv_height $ht
		set tv_width $wt

		layout_tv_panel
	}

	#debug_proc resize_tv_panel exit
}


proc layout_tv_panel { } \
{
	#debug_proc layout_tv_panel entry

	global tv_canvas_width
	global border_space
	global scroll_width
	global frame_border
	global row_height
	global tv_cheight
	global tv_cwidth
	global tv_height
	global tv_lasty
	global tv_width
	global tv_xview
	global tv_yview

	global TV_F
	global TV_C
	global TV_SBH
	global TV_SBV

	#
	# Top Titles
	#

	place $TV_F -x 0 -y 0 -width $tv_width -height $tv_height

	set tvx $border_space
	set tvy [ expr $border_space / 2 ]

	place $TV_F.title \
		-x $tvx -y [ expr $tvy + $frame_border ] -anchor nw

	update

	set tvy [ below $TV_F.title ]

	place $TV_F.filter_label \
		-x $tvx -y [ expr $tvy + $frame_border ] -anchor nw

	update

	place $TV_F.filter_entry -x [ right $TV_F.filter_label ] -y $tvy \
		-anchor nw \
		-width [ expr $tv_width \
			- [ winfo width $TV_F.filter_label ] \
			- (2 * $border_space) ]

	update

	set tvy [ below $TV_F.filter_entry ]

	place $TV_F.search_dir -x $tvx -y $tvy -anchor nw

	update

	place $TV_F.search_button \
		-x [ right $TV_F.search_dir ] \
		-y [ expr $tvy + $frame_border ] \
		-anchor nw

	update

	place $TV_F.search_entry -x [ right $TV_F.search_button ] -y $tvy \
		-anchor nw \
		-width [ expr $tv_width \
			- [ right $TV_F.search_button ] \
			- $border_space ]

	#
	# Bottom Button
	#

	set tvcly [ expr $tv_height - ($border_space / 2) ]

	place $TV_F.close -x $tvx -y $tvcly -anchor sw

	update

	#
	# Canvas & Scrollbars
	#

	set tvcy [ below $TV_F.search_dir ]

	set tv_cheight [ expr [ above $TV_F.close ] - $tvcy \
		- $scroll_width - ($border_space / 2) ]

	set tv_cwidth [ expr $tv_width - $scroll_width \
		- (2 * $border_space) ]

	place $TV_SBV -x $tvx -y $tvcy \
		-width $scroll_width -height $tv_cheight

	scrollSet $TV_SBV $tv_lasty $tv_cheight $row_height $tv_yview

	set tvcx [ expr $tvx + $scroll_width ]

	place $TV_C -x $tvcx -y $tvcy \
		-width $tv_cwidth -height $tv_cheight

	set tvsby [ expr $tvcy + $tv_cheight ]

	place $TV_SBH -x $tvcx -y $tvsby \
		-width $tv_cwidth -height $scroll_width

	scrollSet $TV_SBH $tv_canvas_width $tv_cwidth $row_height $tv_xview

	update

	#debug_proc layout_tv_panel exit
}