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
|
/***********************************************************************/
/* SHOW.C - Functions involving displaying the data. */
/***********************************************************************/
/*
* THE - The Hessling Editor. A text editor similar to VM/CMS xedit.
* Copyright (C) 1991-1997 Mark Hessling
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to:
*
* The Free Software Foundation, Inc.
* 675 Mass Ave,
* Cambridge, MA 02139 USA.
*
*
* If you make modifications to this software that you feel increases
* it usefulness for the rest of the community, please email the
* changes, enhancements, bug fixes as well as any and all ideas to me.
* This software is going to be maintained and enhanced as deemed
* necessary by the community.
*
* Mark Hessling Email: M.Hessling@qut.edu.au
* PO Box 203 Phone: +617 3802 0800
* Bellara http://www.gu.edu.au/gext/the/markh.html
* QLD 4507 **** Maintainer PDCurses & REXX/SQL ****
* Australia ************* Author of THE ************
*/
/*
$Id: show.c 2.1 1995/06/24 16:31:13 MH Rel MH $
*/
#include <the.h>
#include <proto.h>
#if defined(USE_EXTCURSES)
# include <cur04.h>
#endif
#include <time.h>
/*------------------------ function definitions -----------------------*/
#ifdef HAVE_PROTO
static void build_lines(CHARTYPE,short,LINE *,short,short);
static void show_lines(CHARTYPE);
static void show_a_line(CHARTYPE,short);
static void set_prefix_contents(CHARTYPE,LINE *,short,LINETYPE);
static void show_hex_line(CHARTYPE,short);
#else
static void build_lines();
static void show_lines();
static void show_a_line();
static void set_prefix_contents();
static void show_hex_line();
#endif
static LINE *hexshow_curr=NULL;
/***********************************************************************/
#ifdef HAVE_PROTO
void show_heading(CHARTYPE scrno)
#else
void show_heading(scrno)
CHARTYPE scrno;
#endif
/***********************************************************************/
{
/*-------------------------- external data ----------------------------*/
#if !defined(MULTIPLE_PSEUDO_FILES)
extern CHARTYPE dir_path[MAX_FILE_NAME+1];
extern CHARTYPE dir_files[MAX_FILE_NAME+1];
extern CHARTYPE rexx_macro_name[MAX_FILE_NAME+1];
#endif
extern bool horizontal;
extern CHARTYPE display_screens;
extern short compatible_look;
/*--------------------------- local data ------------------------------*/
short fpath_len=0,max_name=0;
LENGTHTYPE x=0;
LINETYPE line_number=0L;
CHARTYPE buffer[60];
CHARTYPE display_path[MAX_FILE_NAME+1];
CHARTYPE *fpath = display_path;
short num_to_delete=0,num_to_start=0,col=0;
short size_col=0,line_col=0;
register short i=0;
/*--------------------------- processing ------------------------------*/
#ifdef TRACE
trace_function("show.c: show_heading");
#endif
/*---------------------------------------------------------------------*/
/* If IDLINE is not to be displayed, exit now. */
/*---------------------------------------------------------------------*/
if (!SCREEN_VIEW(scrno)->id_line)
{
#ifdef TRACE
trace_return();
#endif
return;
}
/*---------------------------------------------------------------------*/
/* Reset idline to blank. */
/*---------------------------------------------------------------------*/
wattrset(SCREEN_WINDOW_IDLINE(scrno),set_colour(SCREEN_FILE(scrno)->attr+ATTR_IDLINE));
wmove(SCREEN_WINDOW_IDLINE(scrno),0,0);
my_wclrtoeol(SCREEN_WINDOW_IDLINE(scrno));
/*---------------------------------------------------------------------*/
/* Get line,col values only if POSITION is ON... */
/*---------------------------------------------------------------------*/
if (SCREEN_VIEW(scrno)->position_status)
(void)get_current_position(scrno,&line_number,&x);
/*---------------------------------------------------------------------*/
/* Set up buffer for line,col,size and alt values for vertical screens.*/
/*---------------------------------------------------------------------*/
if (display_screens != 1 && !horizontal)
{
if (SCREEN_VIEW(scrno)->position_status)
{
if (compatible_look == COMPAT_XEDIT)
{
sprintf((DEFCHAR *)buffer,"S=%-.1ld L=%-.1ld C=%-.1d A=%d,%d",
SCREEN_FILE(scrno)->number_lines,
line_number,x,
SCREEN_FILE(scrno)->autosave_alt,
SCREEN_FILE(scrno)->save_alt);
}
else
{
sprintf((DEFCHAR *)buffer,"L=%-.1ld C=%-.1d S=%-.1ld A=%d,%d",
line_number,x,
SCREEN_FILE(scrno)->number_lines,
SCREEN_FILE(scrno)->autosave_alt,
SCREEN_FILE(scrno)->save_alt);
}
}
else
{
sprintf((DEFCHAR *)buffer,"S=%-.1ld A=%d,%d",
SCREEN_FILE(scrno)->number_lines,
SCREEN_FILE(scrno)->autosave_alt,
SCREEN_FILE(scrno)->save_alt);
}
max_name = (screen[scrno].screen_cols-1) - strlen((DEFCHAR *)buffer);
}
else
{
if (SCREEN_VIEW(scrno)->position_status)
max_name = (screen[scrno].screen_cols-48);
else
max_name = (screen[scrno].screen_cols-27);
if (compatible_look == COMPAT_XEDIT)
{
size_col = screen[scrno].screen_cols-46;
line_col = screen[scrno].screen_cols-46+12;
}
else
{
size_col = screen[scrno].screen_cols-46+21;
line_col = screen[scrno].screen_cols-46;
}
}
/*---------------------------------------------------------------------*/
/* Determine which portion of filename can be displayed. */
/*---------------------------------------------------------------------*/
#if defined(MULTIPLE_PSEUDO_FILES)
strcpy((DEFCHAR *)display_path,(DEFCHAR *)SCREEN_FILE(scrno)->fpath);
strcat((DEFCHAR *)display_path,(DEFCHAR *)SCREEN_FILE(scrno)->fname);
#else
switch(SCREEN_FILE(scrno)->pseudo_file)
{
case PSEUDO_DIR:
strcpy((DEFCHAR *)display_path,"DIR: ");
strcat((DEFCHAR *)display_path,(DEFCHAR *)dir_path);
strcat((DEFCHAR *)display_path,(DEFCHAR *)dir_files);
break;
case PSEUDO_REXX:
strcpy((DEFCHAR *)display_path,"Output from: ");
strcat((DEFCHAR *)display_path,(DEFCHAR *)rexx_macro_name);
break;
case PSEUDO_KEY:
strcpy((DEFCHAR *)display_path,"Key definitions:");
break;
default:
if (SCREEN_FILE(scrno)->display_actual_filename)
{
strcpy((DEFCHAR *)display_path,(DEFCHAR *)SCREEN_FILE(scrno)->fpath);
strcat((DEFCHAR *)display_path,(DEFCHAR *)SCREEN_FILE(scrno)->fname);
}
else
{
strcpy((DEFCHAR *)display_path,(DEFCHAR *)SCREEN_FILE(scrno)->actualfname);
}
break;
}
#endif
fpath = strrmdup(strtrans(display_path,ISLASH,ESLASH),ESLASH);
fpath_len = strlen((DEFCHAR *)fpath);
if (fpath_len > max_name)
{
num_to_delete = fpath_len - max_name + 2;
num_to_start = (strlen((DEFCHAR *)fpath)/2)-(num_to_delete/2);
for (i=0;i<num_to_start;i++)
{
mvwaddch(SCREEN_WINDOW_IDLINE(scrno),0,i,display_path[i]);
}
col = i+2;
waddstr(SCREEN_WINDOW_IDLINE(scrno),"<>");
for (i=num_to_start+num_to_delete;i<strlen((DEFCHAR *)fpath);i++,col++)
{
mvwaddch(SCREEN_WINDOW_IDLINE(scrno),0,col,display_path[i]);
}
}
else
{
wmove(SCREEN_WINDOW_IDLINE(scrno),0,0);
wprintw(SCREEN_WINDOW_IDLINE(scrno),"%s",fpath);
}
if (display_screens != 1 && !horizontal)
{
wmove(SCREEN_WINDOW_IDLINE(scrno),0,max_name+1);
wprintw(SCREEN_WINDOW_IDLINE(scrno),"%-s",buffer);
}
else
{
if (SCREEN_VIEW(scrno)->position_status)
{
wmove(SCREEN_WINDOW_IDLINE(scrno),0,line_col);
wprintw(SCREEN_WINDOW_IDLINE(scrno),"Line=%-6.1ld Col=%-5.1d",line_number,x);
}
wmove(SCREEN_WINDOW_IDLINE(scrno),0,size_col);
wprintw(SCREEN_WINDOW_IDLINE(scrno),"Size=%-6.1ld",SCREEN_FILE(scrno)->number_lines);
wmove(SCREEN_WINDOW_IDLINE(scrno),0,screen[scrno].screen_cols-46+32);
wprintw(SCREEN_WINDOW_IDLINE(scrno),"Alt= ");
wmove(SCREEN_WINDOW_IDLINE(scrno),0,screen[scrno].screen_cols-46+36);
wprintw(SCREEN_WINDOW_IDLINE(scrno),"%d,%d",SCREEN_FILE(scrno)->autosave_alt,
SCREEN_FILE(scrno)->save_alt);
}
#ifdef MSWIN
Win31Scroll(x,line_number,SCREEN_FILE(scrno)->number_lines,SCREEN_FILE(scrno)->max_line_length);
#endif
wnoutrefresh(SCREEN_WINDOW_IDLINE(scrno));
#ifdef TRACE
trace_return();
#endif
return;
}
/***********************************************************************/
#ifdef HAVE_PROTO
void show_statarea(void)
#else
void show_statarea()
#endif
/***********************************************************************/
{
/*------------------------- external data -----------------------------*/
extern CHARTYPE *rec;
extern CHARTYPE *cmd_rec;
extern CHARTYPE *pre_rec;
extern CHARTYPE *the_version;
extern CHARTYPE *the_copyright;
extern bool CLOCKx;
extern bool HEXDISPLAYx;
extern bool INSERTMODEx;
extern CHARTYPE number_of_files;
extern WINDOW *statarea;
extern bool colour_support;
extern bool initial;
extern bool rexx_support;
extern ROWTYPE STATUSLINEx;
/*--------------------------- local data ------------------------------*/
register int i=0;
short y=0,x=0;
short key=0;
WINDOW *w=NULL;
time_t timer;
struct tm *tblock=NULL;
char rel[10]; /* not initialised - OK */
/*--------------------------- processing ------------------------------*/
#ifdef TRACE
trace_function("show.c: show_statarea");
#endif
/*---------------------------------------------------------------------*/
/* If the status line is off, just exit... */
/*---------------------------------------------------------------------*/
if (STATUSLINEx == 'O')
{
#ifdef TRACE
trace_return();
#endif
return;
}
/*---------------------------------------------------------------------*/
/* If GUI option set for status line... */
/*---------------------------------------------------------------------*/
if (STATUSLINEx == 'G')
{
#ifdef MSWIN
Show_GUI_footing();
# ifdef TRACE
trace_return();
# endif
return;
#endif
#ifdef TRACE
trace_return();
#endif
return;
}
w = CURRENT_WINDOW;
/*---------------------------------------------------------------------*/
/* Display THE version. */
/*---------------------------------------------------------------------*/
strcpy(rel,"THE ");
strcat(rel,(DEFCHAR *)the_version);
/* strcat(rel,the_release+10);*/
mvwaddstr(statarea,0,0,rel);
/*---------------------------------------------------------------------*/
/* Clear from files to clock position... */
/*---------------------------------------------------------------------*/
for (i=12;i<53;i++)
{
wmove(statarea,0,i);
waddch(statarea,' ');
}
/*---------------------------------------------------------------------*/
/* Display number of files or copyright on startup. */
/*---------------------------------------------------------------------*/
wmove(statarea,0,12);
if (initial)
waddstr(statarea,(DEFCHAR *)the_copyright);
else
wprintw(statarea,"Files=%d Width=%d",number_of_files,max_line_length);
/*---------------------------------------------------------------------*/
/* Display any pending prefix command warning */
/*---------------------------------------------------------------------*/
if (CURRENT_FILE->first_ppc != NULL
&& CURRENT_FILE->first_ppc->ppc_cmd_idx != (-1)
&& CURRENT_FILE->first_ppc->ppc_cmd_idx != (-2))
{
wmove(statarea,0,20);
wprintw(statarea,"'%s' pending...",get_prefix_command(CURRENT_FILE->first_ppc->ppc_cmd_idx));
}
/*---------------------------------------------------------------------*/
/* Display CLOCK. */
/*---------------------------------------------------------------------*/
if (CLOCKx)
{
timer = time(NULL);
tblock = localtime(&timer);
wmove(statarea,0,53);
wprintw(statarea,"%2d:%02.2d%s",
(tblock->tm_hour > 12) ? (tblock->tm_hour-12) : (tblock->tm_hour),
tblock->tm_min,
(tblock->tm_hour >= 12) ? ("pm") : ("am"));
}
/*---------------------------------------------------------------------*/
/* Display HEXDISPLAY. */
/*---------------------------------------------------------------------*/
if (HEXDISPLAYx)
{
getyx(CURRENT_WINDOW,y,x);
switch(CURRENT_VIEW->current_window)
{
case WINDOW_FILEAREA:
key = (short)(*(rec+CURRENT_VIEW->verify_col-1+x) & A_CHARTEXT);
break;
case WINDOW_COMMAND:
key = (short)(*(cmd_rec+x) & A_CHARTEXT);
break;
case WINDOW_PREFIX:
key = (short)(*(pre_rec+x) & A_CHARTEXT);
break;
}
wmove(statarea,0,61);
wprintw(statarea,"' '=%2.2X/%3.3d ",key,key);
wmove(statarea,0,62);
put_char(statarea,key,ADDCHAR);
}
/*---------------------------------------------------------------------*/
/* Display colour setting. */
/*---------------------------------------------------------------------*/
wmove(statarea,0,73);
#ifdef A_COLOR
if (colour_support)
waddch(statarea,'C');
else
waddch(statarea,'c');
#else
waddch(statarea,'M');
#endif
/*---------------------------------------------------------------------*/
/* Display REXX support character. */
/*---------------------------------------------------------------------*/
wmove(statarea,0,74);
if (rexx_support)
waddch(statarea,'R');
else
waddch(statarea,' ');
/*---------------------------------------------------------------------*/
/* Display INSERTMODE toggle. */
/*---------------------------------------------------------------------*/
wmove(statarea,0,76);
if (INSERTMODEx)
waddstr(statarea,"Ins");
else
waddstr(statarea," ");
/*---------------------------------------------------------------------*/
/* Refresh the STATUS LINE. */
/*---------------------------------------------------------------------*/
wnoutrefresh(statarea);
#ifdef TRACE
trace_return();
#endif
return;
}
/***********************************************************************/
#ifdef HAVE_PROTO
void clear_statarea(void)
#else
void clear_statarea()
#endif
/***********************************************************************/
{
/*------------------------- external data -----------------------------*/
extern WINDOW *statarea;
extern ROWTYPE STATUSLINEx;
/*--------------------------- local data ------------------------------*/
/*--------------------------- processing ------------------------------*/
#ifdef TRACE
trace_function("show.c: clear_statarea");
#endif
/*---------------------------------------------------------------------*/
/* If the status line is not displayed, don't do anything. */
/*---------------------------------------------------------------------*/
switch(STATUSLINEx)
{
case 'T':
case 'B':
wmove(statarea,0,0);
my_wclrtoeol(statarea);
break;
default:
break;
}
#ifdef TRACE
trace_return();
#endif
return;
}
/***********************************************************************/
#ifdef HAVE_PROTO
void redraw_window(WINDOW *win)
#else
void redraw_window(win)
WINDOW *win;
#endif
/***********************************************************************/
{
/*------------------------- external data -----------------------------*/
/*--------------------------- local data ------------------------------*/
register short i=0,j=0;
chtype ch=0;
short y=0,x=0;
/*--------------------------- processing ------------------------------*/
#ifdef TRACE
trace_function("show.c: redraw_window");
#endif
getyx(win,y,x);
for (i=0;i<getmaxx(win);i++)
for (j=0;j<getmaxy(win);j++)
{
wmove(win,j,i);
ch = (chtype)(winch(win) & A_CHARTEXT);
put_char(win,ch,ADDCHAR);
}
wmove(win,y,x);
#ifdef TRACE
trace_return();
#endif
return;
}
#if NOT_USED
/***********************************************************************/
#ifdef HAVE_PROTO
void repaint_screen(void)
#else
void repaint_screen()
#endif
/***********************************************************************/
{
/*-------------------------- external data ----------------------------*/
/*--------------------------- local data ------------------------------*/
short y=0,x=0;
/*--------------------------- processing ------------------------------*/
#ifdef TRACE
trace_function("show.c: repaint_screen");
#endif
getyx(CURRENT_WINDOW,y,x);
y = get_row_for_focus_line(current_screen,CURRENT_VIEW->focus_line,
CURRENT_VIEW->current_row);
if (x > CURRENT_SCREEN.cols[WINDOW_FILEAREA])
x = 0;
pre_process_line(CURRENT_VIEW,CURRENT_VIEW->focus_line,(LINE *)NULL);
build_screen(current_screen);
display_screen(current_screen);
cleanup_command_line();
/* show_heading();*/
wmove(CURRENT_WINDOW,y,x);
#ifdef TRACE
trace_return();
#endif
return;
}
#endif
/***********************************************************************/
#ifdef HAVE_PROTO
void build_screen(CHARTYPE scrno)
#else
void build_screen(scrno)
CHARTYPE scrno;
#endif
/***********************************************************************/
{
/*-------------------------- external data ----------------------------*/
extern bool SBx;
/*--------------------------- local data ------------------------------*/
LINE *curr=NULL;
LINE *save_curr=NULL;
short crow = SCREEN_VIEW(scrno)->current_row;
LINETYPE cline = SCREEN_VIEW(scrno)->current_line;
/*--------------------------- processing ------------------------------*/
#ifdef TRACE
trace_function("show.c: build_screen");
#endif
hexshow_curr = save_curr = curr = lll_find(SCREEN_FILE(scrno)->first_line,SCREEN_FILE(scrno)->last_line,
cline,SCREEN_FILE(scrno)->number_lines);
/*---------------------------------------------------------------------*/
/* Build the file contents from the current line to the bottom of the*/
/* window. */
/*---------------------------------------------------------------------*/
build_lines(scrno,DIRECTION_FORWARD,curr,screen[scrno].rows[WINDOW_FILEAREA]-crow,crow);
/*---------------------------------------------------------------------*/
/* Build the file contents from the current line to the top of the */
/* window. */
/*---------------------------------------------------------------------*/
curr = save_curr->prev;
build_lines(scrno,DIRECTION_BACKWARD,curr,crow,crow-1);
#if defined(HAVE_SB_INIT)
if (SBx
&& scrno == current_screen)
{
sb_set_vert(2+CURRENT_FILE->number_lines +CURRENT_SCREEN.rows[WINDOW_FILEAREA],
CURRENT_SCREEN.rows[WINDOW_FILEAREA],
CURRENT_VIEW->current_line);
sb_set_horz(max_line_length+CURRENT_SCREEN.cols[WINDOW_FILEAREA],
CURRENT_SCREEN.cols[WINDOW_FILEAREA],
CURRENT_VIEW->verify_col);
sb_refresh();
}
#endif
#ifdef TRACE
trace_return();
#endif
return;
}
/***********************************************************************/
#ifdef HAVE_PROTO
void display_screen(CHARTYPE scrno)
#else
void display_screen(scrno)
CHARTYPE scrno;
#endif
/***********************************************************************/
{
/*-------------------------- external data ----------------------------*/
extern bool in_macro;
extern bool in_repeat;
extern bool batch_only;
extern bool curses_started;
extern bool first_screen_display;
/*--------------------------- local data ------------------------------*/
unsigned short x=0,y=0;
unsigned short savex=0,savey=0;
/*--------------------------- processing ------------------------------*/
#ifdef TRACE
trace_function("show.c: display_screen");
#endif
/*---------------------------------------------------------------------*/
/* We don't display the screen if we are in a macro, running in batch, */
/* runninf REPEAT command, or curses hasn't started yet... */
/*---------------------------------------------------------------------*/
if (batch_only
|| in_macro
|| in_repeat
|| !curses_started)
{
#ifdef TRACE
trace_return();
#endif
return;
}
first_screen_display = TRUE;
/*---------------------------------------------------------------------*/
/* Turn off the cursor. */
/*---------------------------------------------------------------------*/
draw_cursor(FALSE);
/*---------------------------------------------------------------------*/
/* Display the IDLINE window... */
/*---------------------------------------------------------------------*/
show_heading(scrno);
/*---------------------------------------------------------------------*/
/* Display the ARROW and CMDLINE if on... */
/*---------------------------------------------------------------------*/
if (SCREEN_WINDOW_ARROW(scrno) != NULL)
{
wattrset(SCREEN_WINDOW_ARROW(scrno),set_colour(SCREEN_FILE(scrno)->attr+ATTR_ARROW));
redraw_window(SCREEN_WINDOW_ARROW(scrno));
touchwin(SCREEN_WINDOW_ARROW(scrno));
wnoutrefresh(SCREEN_WINDOW_ARROW(scrno));
}
if (SCREEN_WINDOW_COMMAND(scrno) != NULL)
{
wattrset(SCREEN_WINDOW_COMMAND(scrno),set_colour(SCREEN_FILE(scrno)->attr+ATTR_CMDLINE));
redraw_window(SCREEN_WINDOW_COMMAND(scrno));
touchwin(SCREEN_WINDOW_COMMAND(scrno));
wnoutrefresh(SCREEN_WINDOW_COMMAND(scrno));
}
/*---------------------------------------------------------------------*/
/* Save the position of previous window if on command line. */
/*---------------------------------------------------------------------*/
if (SCREEN_VIEW(scrno)->current_window == WINDOW_COMMAND)
getyx(SCREEN_PREV_WINDOW(scrno),savey,savex);
getyx(SCREEN_WINDOW(scrno),y,x);
/*---------------------------------------------------------------------*/
/* Display the built lines... */
/*---------------------------------------------------------------------*/
show_lines(scrno);
/*---------------------------------------------------------------------*/
/* Refresh the windows. */
/*---------------------------------------------------------------------*/
if (SCREEN_WINDOW_PREFIX(scrno) != NULL)
wnoutrefresh(SCREEN_WINDOW_PREFIX(scrno));
if (SCREEN_WINDOW_GAP(scrno) != NULL)
wnoutrefresh(SCREEN_WINDOW_GAP(scrno));
wrefresh(SCREEN_WINDOW_FILEAREA(scrno));
/*---------------------------------------------------------------------*/
/* Lastly, turn the cursor back on again. */
/*---------------------------------------------------------------------*/
draw_cursor(TRUE);
/*---------------------------------------------------------------------*/
/* Restore the position of previous window if on command line. */
/*---------------------------------------------------------------------*/
if (SCREEN_VIEW(scrno)->current_window == WINDOW_COMMAND)
wmove(SCREEN_PREV_WINDOW(scrno),savey,savex);
wmove(SCREEN_WINDOW(scrno),y,x);
#ifdef TRACE
trace_return();
#endif
return;
}
/***********************************************************************/
#ifdef HAVE_PROTO
static void build_lines(CHARTYPE scrno,short direction,LINE *curr,
short rows,short start_row)
#else
static void build_lines(scrno,direction,curr,rows,start_row)
CHARTYPE scrno;
short direction;
LINE *curr;
short rows,start_row;
#endif
/***********************************************************************/
{
/*-------------------------- external data ----------------------------*/
extern CHARTYPE *rec;
extern LENGTHTYPE rec_len;
extern VIEW_DETAILS *vd_mark;
extern short compatible_feel;
extern CHARTYPE display_screens;
/*--------------------------- local data ------------------------------*/
LINETYPE cline = SCREEN_VIEW(scrno)->current_line;
RESERVED *curr_rsrvd=NULL;
short num_shadow_lines=0;
bool marked=FALSE,current=FALSE;
short tab_actual_row=0;
short scale_actual_row=0;
short hexshow_actual_start_row=0;
bool display_rec=FALSE;
/*--------------------------- processing ------------------------------*/
#ifdef TRACE
trace_function("show.c: build_lines");
#endif
/*---------------------------------------------------------------------*/
/* Determine if the contents of "rec" should be used to display the */
/* focus line. */
/*---------------------------------------------------------------------*/
if (display_screens > 1)
{
if (scrno == current_screen
|| SCREEN_FILE(current_screen) == SCREEN_FILE(other_screen))
display_rec = TRUE;
else
display_rec = FALSE;
}
else
display_rec = TRUE;
/*---------------------------------------------------------------------*/
/* Determine the row that is the focus line. */
/*---------------------------------------------------------------------*/
if (direction == DIRECTION_BACKWARD)
cline--;
num_shadow_lines = 0;
/*---------------------------------------------------------------------*/
/* These only need to be calculated once. */
/*---------------------------------------------------------------------*/
tab_actual_row=calculate_actual_row(SCREEN_VIEW(scrno)->tab_base,SCREEN_VIEW(scrno)->tab_off,screen[scrno].rows[WINDOW_FILEAREA],TRUE);
scale_actual_row=calculate_actual_row(SCREEN_VIEW(scrno)->scale_base,SCREEN_VIEW(scrno)->scale_off,screen[scrno].rows[WINDOW_FILEAREA],TRUE);
/*---------------------------------------------------------------------*/
/* Now, for each row to be displayed... */
/*---------------------------------------------------------------------*/
while(rows)
{
screen[scrno].sl[start_row].full_length = FALSE;
screen[scrno].sl[start_row].number_lines_excluded = 0;
screen[scrno].sl[start_row].other_start_col = 0;
screen[scrno].sl[start_row].other_end_col = 0;
screen[scrno].sl[start_row].line_type = LINE_LINE;
screen[scrno].sl[start_row].main_enterable = TRUE;
screen[scrno].sl[start_row].prefix_enterable = TRUE;
screen[scrno].sl[start_row].highlight = FALSE;
/*---------------------------------------------------------------------*/
/* If HEXSHOW is ON... */
/*---------------------------------------------------------------------*/
if (SCREEN_VIEW(scrno)->hexshow_on)
{
hexshow_actual_start_row=calculate_actual_row(SCREEN_VIEW(scrno)->hexshow_base,SCREEN_VIEW(scrno)->hexshow_off,screen[scrno].rows[WINDOW_FILEAREA],TRUE);
if (hexshow_actual_start_row == start_row
|| hexshow_actual_start_row+1 == start_row)
{
screen[scrno].sl[start_row].line_type = LINE_HEXSHOW;
screen[scrno].sl[start_row].full_length = TRUE;
screen[scrno].sl[start_row].line_number = (-1L);
screen[scrno].sl[start_row].main_enterable = FALSE;
screen[scrno].sl[start_row].prefix_enterable = FALSE;
screen[scrno].sl[start_row].normal_colour = set_colour(SCREEN_FILE(scrno)->attr+ATTR_SHADOW);
if (scrno == current_screen)
{
if (SCREEN_VIEW(scrno)->current_line == SCREEN_VIEW(scrno)->focus_line)
{
screen[scrno].sl[start_row].contents = rec;
screen[scrno].sl[start_row].length = rec_len;
}
else
{
screen[scrno].sl[start_row].contents = hexshow_curr->line;
screen[scrno].sl[start_row].length = hexshow_curr->length;
}
}
else
{
if (SCREEN_VIEW(scrno)->current_line == SCREEN_VIEW(current_screen)->focus_line
&& display_rec)
{
screen[scrno].sl[start_row].contents = rec;
screen[scrno].sl[start_row].length = rec_len;
}
else
{
screen[scrno].sl[start_row].contents = hexshow_curr->line;
screen[scrno].sl[start_row].length = hexshow_curr->length;
}
}
if (hexshow_actual_start_row == start_row)
screen[scrno].sl[start_row].other_start_col = 0;
else
screen[scrno].sl[start_row].other_start_col = 1;
if (SCREEN_VIEW(scrno)->prefix) /* display prefix if on */
{
memset(screen[scrno].sl[start_row].prefix,' ',SCREEN_VIEW(scrno)->prefix_width-SCREEN_VIEW(scrno)->prefix_gap);
screen[scrno].sl[start_row].prefix[SCREEN_VIEW(scrno)->prefix_width-SCREEN_VIEW(scrno)->prefix_gap] = '\0';
screen[scrno].sl[start_row].prefix_colour = set_colour(SCREEN_FILE(scrno)->attr+ATTR_PREFIX);
if (SCREEN_VIEW(scrno)->prefix_gap)
{
screen[scrno].sl[start_row].gap_colour = set_colour(SCREEN_FILE(scrno)->attr+ATTR_GAP);
strcpy((DEFCHAR*)screen[scrno].sl[start_row].gap,"");
}
}
start_row += direction;
rows--;
continue;
}
}
/*---------------------------------------------------------------------*/
/* If the current line is a reserved line... */
/*---------------------------------------------------------------------*/
if (SCREEN_FILE(scrno)->first_reserved) /* at least one reserved line */
{
if ((curr_rsrvd = find_reserved_line(scrno,TRUE,start_row,0,0)) != NULL)
{
screen[scrno].sl[start_row].line_type = LINE_RESERVED;
screen[scrno].sl[start_row].full_length = TRUE;
screen[scrno].sl[start_row].line_number = (-1L);
screen[scrno].sl[start_row].current = (LINE *)NULL;
screen[scrno].sl[start_row].main_enterable = FALSE;
screen[scrno].sl[start_row].prefix_enterable = FALSE;
if (SCREEN_VIEW(scrno)->prefix) /* display prefix if on */
{
screen[scrno].sl[start_row].prefix_colour = set_colour(curr_rsrvd->attr);
screen[scrno].sl[start_row].gap_colour = set_colour(curr_rsrvd->attr);
if ((SCREEN_VIEW(scrno)->prefix&PREFIX_LOCATION_MASK) == PREFIX_LEFT)
{
memset(screen[scrno].sl[start_row].prefix,' ',SCREEN_VIEW(scrno)->prefix_width-SCREEN_VIEW(scrno)->prefix_gap);
memcpy(screen[scrno].sl[start_row].prefix,curr_rsrvd->line,min(curr_rsrvd->length,SCREEN_VIEW(scrno)->prefix_width-SCREEN_VIEW(scrno)->prefix_gap));
screen[scrno].sl[start_row].prefix[SCREEN_VIEW(scrno)->prefix_width-SCREEN_VIEW(scrno)->prefix_gap] = '\0';
strcpy((DEFCHAR*)screen[scrno].sl[start_row].gap,"");
if (curr_rsrvd->length <= SCREEN_VIEW(scrno)->prefix_width)
{
screen[scrno].sl[start_row].contents = NULL;
screen[scrno].sl[start_row].length = 0;
}
else
{
screen[scrno].sl[start_row].contents = curr_rsrvd->line+SCREEN_VIEW(scrno)->prefix_width;
screen[scrno].sl[start_row].length = curr_rsrvd->length-SCREEN_VIEW(scrno)->prefix_width;
}
if (curr_rsrvd->length > SCREEN_VIEW(scrno)->prefix_width-SCREEN_VIEW(scrno)->prefix_gap)
{
memcpy(screen[scrno].sl[start_row].gap,
curr_rsrvd->line+(SCREEN_VIEW(scrno)->prefix_width-SCREEN_VIEW(scrno)->prefix_gap),
min(SCREEN_VIEW(scrno)->prefix_gap,
curr_rsrvd->length-(SCREEN_VIEW(scrno)->prefix_width-SCREEN_VIEW(scrno)->prefix_gap)));
screen[scrno].sl[start_row].gap[min(SCREEN_VIEW(scrno)->prefix_width-SCREEN_VIEW(scrno)->prefix_gap,curr_rsrvd->length-(SCREEN_VIEW(scrno)->prefix_width-SCREEN_VIEW(scrno)->prefix_gap))] = '\0';
}
}
else
{
screen[scrno].sl[start_row].contents = curr_rsrvd->line;
screen[scrno].sl[start_row].length = min(curr_rsrvd->length,screen[scrno].cols[WINDOW_FILEAREA]);
memset(screen[scrno].sl[start_row].prefix,' ',SCREEN_VIEW(scrno)->prefix_width-SCREEN_VIEW(scrno)->prefix_gap);
screen[scrno].sl[start_row].prefix[SCREEN_VIEW(scrno)->prefix_width-SCREEN_VIEW(scrno)->prefix_gap] = '\0';
strcpy((DEFCHAR*)screen[scrno].sl[start_row].gap,"");
if (curr_rsrvd->length > screen[scrno].cols[WINDOW_FILEAREA])
{
/*
* Reserved line contents may be in prefix area or gap or both
* Add to gap if there is one
*/
if (SCREEN_VIEW(scrno)->prefix_gap)
{
memcpy(screen[scrno].sl[start_row].gap,
curr_rsrvd->line+screen[scrno].cols[WINDOW_FILEAREA],
min(curr_rsrvd->length-screen[scrno].cols[WINDOW_FILEAREA],
SCREEN_VIEW(scrno)->prefix_gap));
screen[scrno].sl[start_row].gap[min(curr_rsrvd->length-screen[scrno].cols[WINDOW_FILEAREA],SCREEN_VIEW(scrno)->prefix_gap)] = '\0';
}
if (curr_rsrvd->length > screen[scrno].cols[WINDOW_FILEAREA]+(SCREEN_VIEW(scrno)->prefix_width-SCREEN_VIEW(scrno)->prefix_gap))
{
/*
* Add to prefix area
*/
memcpy(screen[scrno].sl[start_row].prefix,
curr_rsrvd->line+screen[scrno].cols[WINDOW_FILEAREA]+(SCREEN_VIEW(scrno)->prefix_width-SCREEN_VIEW(scrno)->prefix_gap),
min(curr_rsrvd->length-screen[scrno].cols[WINDOW_FILEAREA]+(SCREEN_VIEW(scrno)->prefix_width-SCREEN_VIEW(scrno)->prefix_gap),
SCREEN_VIEW(scrno)->prefix_width-SCREEN_VIEW(scrno)->prefix_gap));
screen[scrno].sl[start_row].prefix[min(curr_rsrvd->length-screen[scrno].cols[WINDOW_FILEAREA]+(SCREEN_VIEW(scrno)->prefix_width-SCREEN_VIEW(scrno)->prefix_gap),SCREEN_VIEW(scrno)->prefix_width-SCREEN_VIEW(scrno)->prefix_gap)] = '\0';
}
}
}
}
else
{
screen[scrno].sl[start_row].contents = curr_rsrvd->line;
screen[scrno].sl[start_row].length = curr_rsrvd->length;
}
screen[scrno].sl[start_row].normal_colour = set_colour(curr_rsrvd->attr);
screen[scrno].sl[start_row].other_colour = set_colour(curr_rsrvd->attr);
start_row += direction;
rows--;
continue;
}
}
/*---------------------------------------------------------------------*/
/* If the current line is the scale or tab line... */
/*---------------------------------------------------------------------*/
if ((SCREEN_VIEW(scrno)->scale_on && scale_actual_row == start_row)
|| (SCREEN_VIEW(scrno)->tab_on && tab_actual_row == start_row))
{
screen[scrno].sl[start_row].contents = NULL;
screen[scrno].sl[start_row].length = 0;
screen[scrno].sl[start_row].line_number = (-1L);
screen[scrno].sl[start_row].current = (LINE *)NULL;
screen[scrno].sl[start_row].main_enterable = FALSE;
screen[scrno].sl[start_row].prefix_enterable = FALSE;
if (SCREEN_VIEW(scrno)->prefix) /* display prefix if on */
{
memset(screen[scrno].sl[start_row].prefix,' ',SCREEN_VIEW(scrno)->prefix_width-SCREEN_VIEW(scrno)->prefix_gap);
screen[scrno].sl[start_row].prefix[SCREEN_VIEW(scrno)->prefix_width-SCREEN_VIEW(scrno)->prefix_gap] = '\0';
screen[scrno].sl[start_row].prefix_colour = set_colour(SCREEN_FILE(scrno)->attr+ATTR_PREFIX);
screen[scrno].sl[start_row].gap_colour = set_colour(SCREEN_FILE(scrno)->attr+ATTR_GAP);
strcpy((DEFCHAR*)screen[scrno].sl[start_row].gap,"");
}
if (SCREEN_VIEW(scrno)->tab_on && tab_actual_row == start_row)
{
screen[scrno].sl[start_row].line_type |= LINE_TABLINE;
screen[scrno].sl[start_row].normal_colour = set_colour(SCREEN_FILE(scrno)->attr+ATTR_TABLINE);
}
if (SCREEN_VIEW(scrno)->scale_on && scale_actual_row == start_row)
{
screen[scrno].sl[start_row].line_type |= LINE_SCALE;
screen[scrno].sl[start_row].normal_colour = set_colour(SCREEN_FILE(scrno)->attr+ATTR_SCALE);
}
start_row += direction;
rows--;
continue;
}
/*---------------------------------------------------------------------*/
/* If the current line is above or below TOF or EOF, set all to blank. */
/*---------------------------------------------------------------------*/
if (curr == NULL)
{
screen[scrno].sl[start_row].contents = NULL;
screen[scrno].sl[start_row].length = 0;
screen[scrno].sl[start_row].normal_colour = set_colour(SCREEN_FILE(scrno)->attr+ATTR_FILEAREA);
screen[scrno].sl[start_row].line_type = (direction == DIRECTION_BACKWARD) ? LINE_OUT_OF_BOUNDS_ABOVE : LINE_OUT_OF_BOUNDS_BELOW;
screen[scrno].sl[start_row].line_number = (-1L);
screen[scrno].sl[start_row].current = (LINE *)NULL;
screen[scrno].sl[start_row].main_enterable = FALSE;
screen[scrno].sl[start_row].prefix_enterable = FALSE;
if (SCREEN_VIEW(scrno)->prefix) /* display prefix if on */
{
memset(screen[scrno].sl[start_row].prefix,' ',SCREEN_VIEW(scrno)->prefix_width-SCREEN_VIEW(scrno)->prefix_gap);
screen[scrno].sl[start_row].prefix[SCREEN_VIEW(scrno)->prefix_width-SCREEN_VIEW(scrno)->prefix_gap] = '\0';
screen[scrno].sl[start_row].prefix_colour = set_colour(SCREEN_FILE(scrno)->attr+ATTR_PREFIX);
screen[scrno].sl[start_row].gap_colour = set_colour(SCREEN_FILE(scrno)->attr+ATTR_GAP);
strcpy((DEFCHAR*)screen[scrno].sl[start_row].gap,"");
}
start_row += direction;
rows--;
continue;
}
/*---------------------------------------------------------------------*/
/* If the current line is excluded, increment a running total. */
/* Ignore the line if on TOF or BOF. */
/*---------------------------------------------------------------------*/
if (curr->next != NULL /* Bottom of file */
&& curr->prev != NULL) /* Top of file */
{
if (in_scope(SCREEN_VIEW(scrno),curr)
|| cline == SCREEN_VIEW(scrno)->current_line
|| curr->pre != NULL)
;
else
{
if (num_shadow_lines == 0
&& direction == DIRECTION_FORWARD)
{
set_prefix_contents(scrno,curr,start_row,cline);
screen[scrno].sl[start_row].line_number = cline;
screen[scrno].sl[start_row].current = curr;
}
num_shadow_lines++;
cline += (LINETYPE)direction;
if (direction == DIRECTION_FORWARD)
curr = curr->next;
else
curr = curr->prev;
continue;
}
}
/*---------------------------------------------------------------------*/
/* If we get here, we have to determine if a shadow line is to be */
/* displayed or not. */
/*---------------------------------------------------------------------*/
if (SCREEN_VIEW(scrno)->shadow
&& num_shadow_lines > 0)
{
screen[scrno].sl[start_row].length = 0;
if (direction != DIRECTION_FORWARD)
{
set_prefix_contents(scrno,curr->next,start_row,cline+1);
screen[scrno].sl[start_row].line_number = cline+1;
screen[scrno].sl[start_row].current = curr;
}
screen[scrno].sl[start_row].normal_colour = set_colour(SCREEN_FILE(scrno)->attr+ATTR_SHADOW);
screen[scrno].sl[start_row].full_length = TRUE;
screen[scrno].sl[start_row].number_lines_excluded = num_shadow_lines;
screen[scrno].sl[start_row].line_type = LINE_SHADOW;
if (compatible_feel == COMPAT_XEDIT)
screen[scrno].sl[start_row].main_enterable = FALSE;
num_shadow_lines = 0;
start_row += direction;
rows--;
continue;
}
/*---------------------------------------------------------------------*/
/* Determine if line being processed is the current line. */
/*---------------------------------------------------------------------*/
if (cline == SCREEN_VIEW(scrno)->current_line)
current = TRUE;
else
current = FALSE;
/*---------------------------------------------------------------------*/
/* Determine if line being processed is in a marked block. */
/*---------------------------------------------------------------------*/
if (MARK_VIEW != (VIEW_DETAILS *)NULL
&& MARK_VIEW == SCREEN_VIEW(scrno))
{
if (cline >= MARK_VIEW->mark_start_line
&& cline <= MARK_VIEW->mark_end_line)
marked = TRUE;
else
marked = FALSE;
}
/*---------------------------------------------------------------------*/
/* The remainder is for lines that are to be displayed. */
/*---------------------------------------------------------------------*/
screen[scrno].sl[start_row].line_number = cline;
screen[scrno].sl[start_row].current = curr;
/*---------------------------------------------------------------------*/
/* If the current row to be displayed is the focus line, display */
/* the working area, rec and rec_len instead of the entry in the LL. */
/*---------------------------------------------------------------------*/
#if 1
if (scrno == current_screen)
{
if (cline == SCREEN_VIEW(scrno)->focus_line
&& display_rec)
{
screen[scrno].sl[start_row].contents = rec;
screen[scrno].sl[start_row].length = rec_len;
}
else
{
screen[scrno].sl[start_row].contents = curr->line;
screen[scrno].sl[start_row].length = curr->length;
}
}
else
{
if (cline == SCREEN_VIEW(current_screen)->focus_line
&& display_rec)
{
screen[scrno].sl[start_row].contents = rec;
screen[scrno].sl[start_row].length = rec_len;
}
else
{
screen[scrno].sl[start_row].contents = curr->line;
screen[scrno].sl[start_row].length = curr->length;
}
}
#else
if (cline == SCREEN_VIEW(scrno)->focus_line
&& display_rec)
{
screen[scrno].sl[start_row].contents = rec;
screen[scrno].sl[start_row].length = rec_len;
}
else
{
screen[scrno].sl[start_row].contents = curr->line;
screen[scrno].sl[start_row].length = curr->length;
}
#endif
set_prefix_contents(scrno,curr,start_row,cline);
/*---------------------------------------------------------------------*/
/* Set up TOF and EOF lines... */
/*---------------------------------------------------------------------*/
if (curr->next == NULL /* Bottom of file */
|| curr->prev == NULL) /* Top of file */
{
screen[scrno].sl[start_row].normal_colour = (current) ? set_colour(SCREEN_FILE(scrno)->attr+ATTR_CTOFEOF) :
set_colour(SCREEN_FILE(scrno)->attr+ATTR_TOFEOF);
#ifndef REMOVED_FOR_CONSISTANCY
if (compatible_feel == COMPAT_XEDIT)
screen[scrno].sl[start_row].main_enterable = FALSE;
#endif
screen[scrno].sl[start_row].line_type = (curr->next==NULL)?LINE_EOF:LINE_TOF; /* MH12 */
}
else
{
if (SCREEN_VIEW(scrno)->highlight)
{
switch(SCREEN_VIEW(scrno)->highlight)
{
case HIGHLIGHT_TAG:
if (curr->tag_flag)
screen[scrno].sl[start_row].highlight = TRUE;
break;
case HIGHLIGHT_ALT:
if (curr->new_flag
|| curr->changed_flag)
screen[scrno].sl[start_row].highlight = TRUE;
break;
case HIGHLIGHT_SELECT:
if (curr->select >= SCREEN_VIEW(scrno)->highlight_low
&& curr->select <= SCREEN_VIEW(scrno)->highlight_high)
screen[scrno].sl[start_row].highlight = TRUE;
break;
default:
break;
}
}
if (marked)
{
switch(MARK_VIEW->mark_type)
{
case M_LINE:
screen[scrno].sl[start_row].other_start_col = (-1);
screen[scrno].sl[start_row].other_end_col = (-1);
screen[scrno].sl[start_row].normal_colour = (current) ? set_colour(SCREEN_FILE(scrno)->attr+ATTR_CBLOCK) :
set_colour(SCREEN_FILE(scrno)->attr+ATTR_BLOCK);
screen[scrno].sl[start_row].full_length = TRUE;
break;
case M_BOX:
case M_COLUMN:
case M_WORD:
screen[scrno].sl[start_row].other_start_col = MARK_VIEW->mark_start_col - 1;
screen[scrno].sl[start_row].other_end_col = MARK_VIEW->mark_end_col - 1;
if (screen[scrno].sl[start_row].highlight)
screen[scrno].sl[start_row].normal_colour = (current) ? set_colour(SCREEN_FILE(scrno)->attr+ATTR_CHIGHLIGHT) :
set_colour(SCREEN_FILE(scrno)->attr+ATTR_HIGHLIGHT);
else
screen[scrno].sl[start_row].normal_colour = (current) ? set_colour(SCREEN_FILE(scrno)->attr+ATTR_CURLINE) :
set_colour(SCREEN_FILE(scrno)->attr+ATTR_FILEAREA);
screen[scrno].sl[start_row].other_colour = (current) ? set_colour(SCREEN_FILE(scrno)->attr+ATTR_CBLOCK) :
set_colour(SCREEN_FILE(scrno)->attr+ATTR_BLOCK);
break;
case M_STREAM:
if (screen[scrno].sl[start_row].highlight)
screen[scrno].sl[start_row].normal_colour = (current) ? set_colour(SCREEN_FILE(scrno)->attr+ATTR_CHIGHLIGHT) :
set_colour(SCREEN_FILE(scrno)->attr+ATTR_HIGHLIGHT);
else
screen[scrno].sl[start_row].normal_colour = (current) ? set_colour(SCREEN_FILE(scrno)->attr+ATTR_CURLINE) :
set_colour(SCREEN_FILE(scrno)->attr+ATTR_FILEAREA);
screen[scrno].sl[start_row].other_colour = (current) ? set_colour(SCREEN_FILE(scrno)->attr+ATTR_CBLOCK) :
set_colour(SCREEN_FILE(scrno)->attr+ATTR_BLOCK);
screen[scrno].sl[start_row].other_end_col = MAX_INT;
screen[scrno].sl[start_row].other_start_col = 0;
if (cline == MARK_VIEW->mark_start_line)
screen[scrno].sl[start_row].other_start_col = MARK_VIEW->mark_start_col - 1;
if (cline == MARK_VIEW->mark_end_line)
screen[scrno].sl[start_row].other_end_col = MARK_VIEW->mark_end_col - 1;
if (cline > MARK_VIEW->mark_start_line
&& cline < MARK_VIEW->mark_end_line)
{
screen[scrno].sl[start_row].normal_colour = (current) ? set_colour(SCREEN_FILE(scrno)->attr+ATTR_CBLOCK) :
set_colour(SCREEN_FILE(scrno)->attr+ATTR_BLOCK);
screen[scrno].sl[start_row].full_length = TRUE;
}
break;
}
}
else
{
if (screen[scrno].sl[start_row].highlight)
{
screen[scrno].sl[start_row].normal_colour = (current) ? set_colour(SCREEN_FILE(scrno)->attr+ATTR_CHIGHLIGHT) :
set_colour(SCREEN_FILE(scrno)->attr+ATTR_HIGHLIGHT);
screen[scrno].sl[start_row].other_colour = screen[scrno].sl[start_row].normal_colour;
}
else
{
screen[scrno].sl[start_row].normal_colour = (current) ? set_colour(SCREEN_FILE(scrno)->attr+ATTR_CURLINE) :
set_colour(SCREEN_FILE(scrno)->attr+ATTR_FILEAREA);
screen[scrno].sl[start_row].other_colour = screen[scrno].sl[start_row].normal_colour;
}
}
}
start_row += direction;
rows--;
cline += (LINETYPE)direction;
if (direction == DIRECTION_FORWARD)
curr = curr->next;
else
curr = curr->prev;
}
#ifdef TRACE
trace_return();
#endif
return;
}
/***********************************************************************/
#ifdef HAVE_PROTO
static void show_lines(CHARTYPE scrno)
#else
static void show_lines(scrno)
CHARTYPE scrno;
#endif
/***********************************************************************/
{
/*------------------------- external data -----------------------------*/
/*--------------------------- local data ------------------------------*/
register short i=0,j=0;
short true_col=0;
short max_cols = min(screen[scrno].cols[WINDOW_FILEAREA],SCREEN_VIEW(scrno)->verify_end-SCREEN_VIEW(scrno)->verify_start+1);
short off=0,num_tens=0;
unsigned short y=0,x=0;
CHARTYPE tens[5];
/*--------------------------- processing ------------------------------*/
#ifdef TRACE
trace_function("show.c: show_lines");
#endif
for (i=0;i<screen[scrno].rows[WINDOW_FILEAREA];i++)
{
/*---------------------------------------------------------------------*/
/* Display the contents of the prefix area (if on). */
/*---------------------------------------------------------------------*/
if (SCREEN_VIEW(scrno)->prefix)
{
wattrset(SCREEN_WINDOW_PREFIX(scrno),screen[scrno].sl[i].prefix_colour);
wmove(SCREEN_WINDOW_PREFIX(scrno),i,0);
my_wclrtoeol(SCREEN_WINDOW_PREFIX(scrno));
put_string(SCREEN_WINDOW_PREFIX(scrno),i,0,screen[scrno].sl[i].prefix,strlen((DEFCHAR *)screen[scrno].sl[i].prefix));
if (SCREEN_VIEW(scrno)->prefix_gap)
{
wattrset(SCREEN_WINDOW_GAP(scrno),screen[scrno].sl[i].gap_colour);
wmove(SCREEN_WINDOW_GAP(scrno),i,0);
my_wclrtoeol(SCREEN_WINDOW_GAP(scrno));
put_string(SCREEN_WINDOW_GAP(scrno),i,0,screen[scrno].sl[i].gap,strlen((DEFCHAR *)screen[scrno].sl[i].gap));
}
}
wmove(SCREEN_WINDOW_FILEAREA(scrno),i,0);
wattrset(SCREEN_WINDOW_FILEAREA(scrno),screen[scrno].sl[i].normal_colour);
/*---------------------------------------------------------------------*/
/* Display any shadow line. No need to test to see if SHADOW is ON as */
/* number_excluded_lines would not be > 0 if SHADOW OFF. */
/*---------------------------------------------------------------------*/
if (screen[scrno].sl[i].number_lines_excluded > 0)
{
for (j=0;j<screen[scrno].cols[WINDOW_FILEAREA];j++)
mvwaddch(SCREEN_WINDOW_FILEAREA(scrno),i,j,'-');
wmove(SCREEN_WINDOW_FILEAREA(scrno),i,max(0,(screen[scrno].cols[WINDOW_FILEAREA]/2)-14));
wprintw(SCREEN_WINDOW_FILEAREA(scrno),"%4d line(s) not displayed ",screen[scrno].sl[i].number_lines_excluded);
continue;
}
/*---------------------------------------------------------------------*/
/* Display SCALE and/or TABLINE... */
/*---------------------------------------------------------------------*/
if (screen[scrno].sl[i].line_type & LINE_SCALE
|| screen[scrno].sl[i].line_type & LINE_TABLINE)
{
my_wclrtoeol(SCREEN_WINDOW_FILEAREA(scrno));
for (j=0;j<max_cols;j++)
{
wmove(SCREEN_WINDOW_FILEAREA(scrno),i,j);
true_col = j + SCREEN_VIEW(scrno)->verify_col-1;
/*---------------------------------------------------------------------*/
/* Display '|' in current column position if this is the scale line. */
/*---------------------------------------------------------------------*/
if (screen[scrno].sl[i].line_type & LINE_SCALE
&& SCREEN_VIEW(scrno)->current_column == true_col+1)
{
waddch(SCREEN_WINDOW_FILEAREA(scrno),'|');
continue;
}
/*---------------------------------------------------------------------*/
/* Display 'T' in each tab column. This overrides all other characters */
/* except column position. */
/*---------------------------------------------------------------------*/
if (screen[scrno].sl[i].line_type & LINE_TABLINE)
{
if (is_tab_col(true_col+1))
{
waddch(SCREEN_WINDOW_FILEAREA(scrno),'T');
continue;
}
}
/*---------------------------------------------------------------------*/
/* Only display the following if it is a scale line... */
/*---------------------------------------------------------------------*/
if (screen[scrno].sl[i].line_type & LINE_SCALE)
{
if (SCREEN_VIEW(scrno)->margin_left-1 == true_col)
{
waddch(SCREEN_WINDOW_FILEAREA(scrno),'[');
continue;
}
if (SCREEN_VIEW(scrno)->margin_right-1 == true_col)
{
waddch(SCREEN_WINDOW_FILEAREA(scrno),']');
continue;
}
if (SCREEN_VIEW(scrno)->margin_indent_offset_status
&& SCREEN_VIEW(scrno)->margin_left+SCREEN_VIEW(scrno)->margin_indent-1 == true_col)
{
waddch(SCREEN_WINDOW_FILEAREA(scrno),'p');
continue;
}
if (!SCREEN_VIEW(scrno)->margin_indent_offset_status
&& SCREEN_VIEW(scrno)->margin_indent-1 == true_col)
{
waddch(SCREEN_WINDOW_FILEAREA(scrno),'p');
continue;
}
if (SCREEN_VIEW(scrno)->zone_start-1 == true_col)
{
waddch(SCREEN_WINDOW_FILEAREA(scrno),'<');
continue;
}
if (SCREEN_VIEW(scrno)->zone_end-1 == true_col)
{
waddch(SCREEN_WINDOW_FILEAREA(scrno),'>');
/* break;*/
continue;
}
if (true_col % 10 == 9)
{
sprintf((DEFCHAR *)tens,"%d",(true_col / 10) + 1);
num_tens = strlen((DEFCHAR *)tens);
getyx(SCREEN_WINDOW_FILEAREA(scrno),y,x);
if ((short)x-(num_tens-1) < 0)
{
off = -((short)x-(num_tens-1));
x = 0;
}
else
{
off = 0;
x -= (num_tens-1);
}
wmove(SCREEN_WINDOW_FILEAREA(scrno),y,x);
waddstr(SCREEN_WINDOW_FILEAREA(scrno),(DEFCHAR *)tens+off);
continue;
}
if (true_col % 5 == 4)
{
waddch(SCREEN_WINDOW_FILEAREA(scrno),'+');
continue;
}
waddch(SCREEN_WINDOW_FILEAREA(scrno),'.');
}
}
continue;
}
/*---------------------------------------------------------------------*/
/* Display HEXSHOW line... */
/*---------------------------------------------------------------------*/
if (screen[scrno].sl[i].line_type & LINE_HEXSHOW)
{
my_wclrtoeol(SCREEN_WINDOW_FILEAREA(scrno));
show_hex_line(scrno,i);
continue;
}
/*---------------------------------------------------------------------*/
/* Display TOF or EOF line. */
/*---------------------------------------------------------------------*/
if (screen[scrno].sl[i].line_type == LINE_TOF)
{
my_wclrtoeol(SCREEN_WINDOW_FILEAREA(scrno));
waddstr(SCREEN_WINDOW_FILEAREA(scrno),(DEFCHAR *)TOP_OF_FILE);
continue;
}
if (screen[scrno].sl[i].line_type == LINE_EOF)
{
my_wclrtoeol(SCREEN_WINDOW_FILEAREA(scrno));
waddstr(SCREEN_WINDOW_FILEAREA(scrno),(DEFCHAR *)BOTTOM_OF_FILE);
continue;
}
/*---------------------------------------------------------------------*/
/* Display marked LINE block line(s). */
/*---------------------------------------------------------------------*/
show_a_line(scrno,i);
}
if (SCREEN_WINDOW_PREFIX(scrno) != NULL)
wattrset(SCREEN_WINDOW_PREFIX(scrno),set_colour(SCREEN_FILE(scrno)->attr+ATTR_PENDING));
if (SCREEN_WINDOW_GAP(scrno) != NULL)
wattrset(SCREEN_WINDOW_GAP(scrno),set_colour(SCREEN_FILE(scrno)->attr+ATTR_GAP));
wattrset(SCREEN_WINDOW_FILEAREA(scrno),set_colour(SCREEN_FILE(scrno)->attr+ATTR_FILEAREA));
#ifdef TRACE
trace_return();
#endif
return;
}
/***********************************************************************/
#ifdef HAVE_PROTO
static void show_a_line(CHARTYPE scrno,short row)
#else
static void show_a_line(scrno,row)
CHARTYPE scrno;
short row;
#endif
/***********************************************************************/
{
/*------------------------- external data -----------------------------*/
/*--------------------------- local data ------------------------------*/
register short i=0;
chtype ch=0;
LENGTHTYPE vcol=0,vend=0,vlen=0;
LENGTHTYPE length=0;
CHARTYPE *line=NULL;
#if defined(USE_EXTCURSES) || defined(HAVE_BSD_CURSES)
chtype attr=0,old_attr=0;
#endif
/*--------------------------- processing ------------------------------*/
#ifdef TRACE
trace_function("show.c: show_a_line");
#endif
/*---------------------------------------------------------------------*/
/* If the line to be displayed is a reserved line, set the columns to */
/* be displayed so that the full line is displayed. */
/*---------------------------------------------------------------------*/
if (screen[scrno].sl[row].line_type == LINE_RESERVED)
{
vcol = 0;
vend = screen[scrno].cols[WINDOW_FILEAREA];
vlen = screen[scrno].cols[WINDOW_FILEAREA];
}
else
{
vcol = SCREEN_VIEW(scrno)->verify_col - 1;
vend = SCREEN_VIEW(scrno)->verify_end - 1;
vlen = SCREEN_VIEW(scrno)->verify_end - SCREEN_VIEW(scrno)->verify_start + 1;
}
length = screen[scrno].sl[row].length;
line = screen[scrno].sl[row].contents;
/*---------------------------------------------------------------------*/
/* If the contents are NULL then clear to eol in normal colour. */
/*---------------------------------------------------------------------*/
if (line == NULL)
{
my_wclrtoeol(SCREEN_WINDOW_FILEAREA(scrno));
#ifdef TRACE
trace_return();
#endif
return;
}
wmove(SCREEN_WINDOW_FILEAREA(scrno),row,0);
for (i=0;i<screen[scrno].cols[WINDOW_FILEAREA];i++)
{
/*---------------------------------------------------------------------*/
/* If the last character in the line has been displayed, display blank.*/
/*---------------------------------------------------------------------*/
if (i+vcol < length)
ch = *(line+i+vcol);
else
ch = ' ';
/*---------------------------------------------------------------------*/
/* Determine colour of character to be displayed. BOX blocks are sorted*/
/* out here. */
/*---------------------------------------------------------------------*/
if (vcol+i >= screen[scrno].sl[row].other_start_col
&& vcol+i <= screen[scrno].sl[row].other_end_col)
#if defined(USE_EXTCURSES) || defined(HAVE_BSD_CURSES)
attr = screen[scrno].sl[row].other_colour;
#else
ch = ch | screen[scrno].sl[row].other_colour;
#endif
else
#if defined(USE_EXTCURSES) || defined(HAVE_BSD_CURSES)
attr = screen[scrno].sl[row].normal_colour;
#else
ch = ch | screen[scrno].sl[row].normal_colour;
#endif
/*---------------------------------------------------------------------*/
/* If we have gone past the VERIFY END column, display a blank in the */
/* normal colour. */
/*---------------------------------------------------------------------*/
if (i >= vlen)
{
#if defined(USE_EXTCURSES) || defined(HAVE_BSD_CURSES)
ch = ' ';
attr = screen[scrno].sl[row].normal_colour;
#else
ch = ' ' | screen[scrno].sl[row].normal_colour;
#endif
}
/*---------------------------------------------------------------------*/
/* Go and display the character... */
/*---------------------------------------------------------------------*/
#if defined(USE_EXTCURSES) || defined(HAVE_BSD_CURSES)
if (attr != old_attr)
{
wattrset(SCREEN_WINDOW_FILEAREA(scrno),attr);
old_attr = attr;
}
#endif
put_char(SCREEN_WINDOW_FILEAREA(scrno),ch,ADDCHAR);
}
#ifdef TRACE
trace_return();
#endif
return;
}
/***********************************************************************/
#ifdef HAVE_PROTO
static void set_prefix_contents(CHARTYPE scrno,LINE *curr,short start_row,LINETYPE cline)
#else
static void set_prefix_contents(scrno,curr,start_row,cline)
CHARTYPE scrno;
LINE *curr;
short start_row;
LINETYPE cline;
#endif
/***********************************************************************/
{
/*-------------------------- external data ----------------------------*/
/*--------------------------- local data ------------------------------*/
CHARTYPE *ptr=NULL;
/*--------------------------- processing ------------------------------*/
#ifdef TRACE
trace_function("show.c: set_prefix_contents");
#endif
ptr = screen[scrno].sl[start_row].prefix;
if (SCREEN_VIEW(scrno)->prefix)
{
if (curr->pre != NULL) /* prefix command pending... */
/* && !blank_field(curr->pre->ppc_command))*/ /* ... and not blank */
{
strcpy((DEFCHAR *)ptr,(DEFCHAR *)curr->pre->ppc_command);
screen[scrno].sl[start_row].prefix_colour = set_colour(SCREEN_FILE(scrno)->attr+ATTR_PENDING);
}
else /* no prefix command on this line */
{
memset(ptr,' ',SCREEN_VIEW(scrno)->prefix_width-SCREEN_VIEW(scrno)->prefix_gap);
screen[scrno].sl[start_row].prefix[SCREEN_VIEW(scrno)->prefix_width-SCREEN_VIEW(scrno)->prefix_gap] = '\0';
screen[scrno].sl[start_row].prefix_colour = set_colour(SCREEN_FILE(scrno)->attr+ATTR_PREFIX);
if (SCREEN_VIEW(scrno)->number)
{
if ((SCREEN_VIEW(scrno)->prefix&PREFIX_STATUS_MASK) == PREFIX_ON)
sprintf((DEFCHAR *)ptr,"%*.*ld",
SCREEN_VIEW(scrno)->prefix_width-SCREEN_VIEW(scrno)->prefix_gap,
SCREEN_VIEW(scrno)->prefix_width-SCREEN_VIEW(scrno)->prefix_gap,
cline);
else
sprintf((DEFCHAR *)ptr,"%*ld",
SCREEN_VIEW(scrno)->prefix_width-SCREEN_VIEW(scrno)->prefix_gap,
cline);
}
else
{
if ((SCREEN_VIEW(scrno)->prefix&PREFIX_STATUS_MASK) == PREFIX_ON)
memset(ptr,'=',
SCREEN_VIEW(scrno)->prefix_width-SCREEN_VIEW(scrno)->prefix_gap);
}
}
/*
* clear the gap
*/
strcpy((DEFCHAR*)screen[scrno].sl[start_row].gap,"");
screen[scrno].sl[start_row].gap_colour = set_colour(SCREEN_FILE(scrno)->attr+ATTR_GAP);
}
#ifdef TRACE
trace_return();
#endif
return;
}
/***********************************************************************/
#ifdef HAVE_PROTO
static void show_hex_line(CHARTYPE scrno,short row)
#else
static void show_hex_line(scrno,row)
CHARTYPE scrno;
short row;
#endif
/***********************************************************************/
{
/*-------------------------- external data ----------------------------*/
/*--------------------------- local data ------------------------------*/
register short i=0;
chtype ch=0;
LENGTHTYPE vcol=0,vend=0,vlen=0;
LENGTHTYPE length=0;
CHARTYPE *line=NULL;
int num=0;
/*--------------------------- processing ------------------------------*/
#ifdef TRACE
trace_function("show.c: show_hex_line");
#endif
/*---------------------------------------------------------------------*/
/* Set up columns to display... */
/*---------------------------------------------------------------------*/
vcol = SCREEN_VIEW(scrno)->verify_col - 1;
vend = SCREEN_VIEW(scrno)->verify_end - 1;
vlen = SCREEN_VIEW(scrno)->verify_end - SCREEN_VIEW(scrno)->verify_start + 1;
length = screen[scrno].sl[row].length;
line = screen[scrno].sl[row].contents;
#if defined(USE_EXTCURSES) || defined(HAVE_BSD_CURSES)
wattrset(SCREEN_WINDOW_FILEAREA(scrno),screen[scrno].sl[row].normal_colour);
#endif
wmove(SCREEN_WINDOW_FILEAREA(scrno),row,0);
for (i=0;i<screen[scrno].cols[WINDOW_FILEAREA];i++)
{
/*---------------------------------------------------------------------*/
/* If the last character in the line has been displayed, display blank.*/
/*---------------------------------------------------------------------*/
if (i+vcol < length)
ch = *(line+i+vcol);
else
ch = ' ';
/*---------------------------------------------------------------------*/
/* If we have gone past the VERIFY END column, display a blank. */
/*---------------------------------------------------------------------*/
if (i >= vlen)
ch = ' ';
/*---------------------------------------------------------------------*/
/* Calculate the HEX character to display based on which HEXSHOW line */
/* is being displayed. */
/*---------------------------------------------------------------------*/
if (screen[scrno].sl[row].other_start_col == 0)
num = (int)((ch / 16) + (int)'0');
else
num = (int)((ch % 16) + (int)'0');
num = (num > (int)'9') ? num + 7 : num;
#if defined(USE_EXTCURSES) || defined(HAVE_BSD_CURSES)
ch = (chtype)num;
#else
ch = (chtype)num | screen[scrno].sl[row].normal_colour;
#endif
/*---------------------------------------------------------------------*/
/* Go and display the character... */
/*---------------------------------------------------------------------*/
put_char(SCREEN_WINDOW_FILEAREA(scrno),ch,ADDCHAR);
}
#ifdef TRACE
trace_return();
#endif
return;
}
/***********************************************************************/
#ifdef HAVE_PROTO
void touch_screen(CHARTYPE scrno)
#else
void touch_screen(scrno)
CHARTYPE scrno;
#endif
/***********************************************************************/
{
/*-------------------------- external data ----------------------------*/
/*--------------------------- local data ------------------------------*/
register int i=0;
/*--------------------------- processing ------------------------------*/
#ifdef TRACE
trace_function("commutil.c:touch_screen");
#endif
for (i=0;i<VIEW_WINDOWS;i++)
{
if (screen[scrno].win[i] != (WINDOW *)NULL)
touchwin(screen[scrno].win[i]);
}
#if 0
touchwin(CURRENT_WINDOW_FILEAREA);
if (CURRENT_WINDOW_PREFIX != (WINDOW *)NULL)
touchwin(CURRENT_WINDOW_PREFIX);
if (CURRENT_WINDOW_GAP != (WINDOW *)NULL)
touchwin(CURRENT_WINDOW_GAP);
if (CURRENT_WINDOW_IDLINE != (WINDOW *)NULL)
touchwin(CURRENT_WINDOW_IDLINE);
if (CURRENT_WINDOW_ARROW != (WINDOW *)NULL)
touchwin(CURRENT_WINDOW_ARROW);
if (CURRENT_WINDOW_COMMAND != (WINDOW *)NULL)
touchwin(CURRENT_WINDOW_COMMAND);
#endif
#ifdef TRACE
trace_return();
#endif
return;
}
/***********************************************************************/
#ifdef HAVE_PROTO
void refresh_screen(CHARTYPE scrno)
#else
void refresh_screen(scrno)
CHARTYPE scrno;
#endif
/***********************************************************************/
{
/*-------------------------- external data ----------------------------*/
/*--------------------------- local data ------------------------------*/
/*--------------------------- processing ------------------------------*/
#ifdef TRACE
trace_function("commutil.c:refresh_screen");
#endif
/*---------------------------------------------------------------------*/
/* Turn off the cursor. */
/*---------------------------------------------------------------------*/
/* MH draw_cursor(FALSE); */
show_heading(scrno);
wnoutrefresh(SCREEN_WINDOW_FILEAREA(scrno));
if (SCREEN_WINDOW_PREFIX(scrno) != (WINDOW *)NULL)
wnoutrefresh(SCREEN_WINDOW_PREFIX(scrno));
if (SCREEN_WINDOW_GAP(scrno) != (WINDOW *)NULL)
wnoutrefresh(SCREEN_WINDOW_GAP(scrno));
if (SCREEN_WINDOW_ARROW(scrno) != (WINDOW *)NULL)
{
touchwin(SCREEN_WINDOW_ARROW(scrno));
wnoutrefresh(SCREEN_WINDOW_ARROW(scrno));
}
if (SCREEN_WINDOW_COMMAND(scrno) != (WINDOW *)NULL)
wnoutrefresh(SCREEN_WINDOW_COMMAND(scrno));
wnoutrefresh(SCREEN_WINDOW(scrno));
/*---------------------------------------------------------------------*/
/* Turn on the cursor. */
/*---------------------------------------------------------------------*/
/* draw_cursor(TRUE);*/
#ifdef TRACE
trace_return();
#endif
return;
}
/***********************************************************************/
#ifdef HAVE_PROTO
void redraw_screen(CHARTYPE scrno)
#else
void redraw_screen(scrno)
CHARTYPE scrno;
#endif
/***********************************************************************/
{
/*-------------------------- external data ----------------------------*/
extern bool curses_started;
/*--------------------------- local data ------------------------------*/
/*--------------------------- processing ------------------------------*/
#ifdef TRACE
trace_function("commutil.c:redraw_screen");
#endif
if (curses_started)
{
/*---------------------------------------------------------------------*/
/* Turn off the cursor. */
/*---------------------------------------------------------------------*/
/* MH draw_cursor(FALSE); */
if (SCREEN_WINDOW_COMMAND(scrno) != NULL)
{
wattrset(SCREEN_WINDOW_COMMAND(scrno),set_colour(SCREEN_FILE(scrno)->attr+ATTR_CMDLINE));
touchwin(SCREEN_WINDOW_COMMAND(scrno));
wnoutrefresh(SCREEN_WINDOW_COMMAND(scrno));
}
if (SCREEN_WINDOW_ARROW(scrno) != NULL)
{
wattrset(SCREEN_WINDOW_ARROW(scrno),set_colour(SCREEN_FILE(scrno)->attr+ATTR_ARROW));
redraw_window(SCREEN_WINDOW_ARROW(scrno));
wnoutrefresh(SCREEN_WINDOW_ARROW(scrno));
}
if (SCREEN_WINDOW_IDLINE(scrno) != NULL)
{
wattrset(SCREEN_WINDOW_IDLINE(scrno),set_colour(SCREEN_FILE(scrno)->attr+ATTR_IDLINE));
redraw_window(SCREEN_WINDOW_IDLINE(scrno));
}
if (SCREEN_WINDOW_PREFIX(scrno) != NULL)
touchwin(SCREEN_WINDOW_PREFIX(scrno));
if (SCREEN_WINDOW_GAP(scrno) != NULL)
touchwin(SCREEN_WINDOW_GAP(scrno));
touchwin(SCREEN_WINDOW_FILEAREA(scrno));
/*---------------------------------------------------------------------*/
/* Turn on the cursor. */
/*---------------------------------------------------------------------*/
/* MH draw_cursor(TRUE); */
}
#ifdef TRACE
trace_return();
#endif
return;
}
/***********************************************************************/
#ifdef HAVE_PROTO
bool line_in_view(CHARTYPE scrno,LINETYPE line_number)
#else
bool line_in_view(scrno,line_number)
CHARTYPE scrno;
LINETYPE line_number;
#endif
/***********************************************************************/
{
/*-------------------------- external data ----------------------------*/
/*--------------------------- local data ------------------------------*/
register short i=0;
bool result=FALSE;
/*--------------------------- processing ------------------------------*/
#ifdef TRACE
trace_function("show.c: line_in_view");
#endif
for (i=0;i<screen[scrno].rows[WINDOW_FILEAREA];i++)
{
if (screen[scrno].sl[i].line_number == line_number)
{
result = TRUE;
break;
}
}
#ifdef TRACE
trace_return();
#endif
return(result);
}
/***********************************************************************/
#ifdef HAVE_PROTO
bool column_in_view(CHARTYPE scrno,LENGTHTYPE column_number)
#else
bool column_in_view(scrno,column_number)
CHARTYPE scrno;
LENGTHTYPE column_number;
#endif
/***********************************************************************/
{
/*-------------------------- external data ----------------------------*/
/*--------------------------- local data ------------------------------*/
bool result=FALSE;
LENGTHTYPE min_file_col=0,max_file_col=0;
/*--------------------------- processing ------------------------------*/
#ifdef TRACE
trace_function("show.c: column_in_view");
#endif
min_file_col = screen[scrno].screen_view->verify_col - 1;
max_file_col = screen[scrno].screen_view->verify_col + screen[scrno].cols[WINDOW_FILEAREA] - 2;
if (column_number >= min_file_col
&& column_number <= max_file_col) /* new column in display */
result = TRUE;
#ifdef TRACE
trace_return();
#endif
return(result);
}
/***********************************************************************/
#ifdef HAVE_PROTO
LINETYPE find_next_current_line(LINETYPE num_pages,short direction)
#else
LINETYPE find_next_current_line(num_pages,direction)
LINETYPE num_pages;
short direction;
#endif
/***********************************************************************/
{
/*-------------------------- external data ----------------------------*/
/*--------------------------- local data ------------------------------*/
register short i=0;
LINETYPE cline = CURRENT_VIEW->current_line;
short rows=0,num_display_lines=0,num_shadow_lines=0;
LINE *curr=NULL;
RESERVED *curr_reserved=CURRENT_FILE->first_reserved;
short tab_actual_row=calculate_actual_row(CURRENT_VIEW->tab_base,CURRENT_VIEW->tab_off,CURRENT_SCREEN.rows[WINDOW_FILEAREA],TRUE);
short scale_actual_row=calculate_actual_row(CURRENT_VIEW->scale_base,CURRENT_VIEW->scale_off,CURRENT_SCREEN.rows[WINDOW_FILEAREA],TRUE);
/*--------------------------- processing ------------------------------*/
#ifdef TRACE
trace_function("show.c: find_next_current_line");
#endif
/*---------------------------------------------------------------------*/
/* Determine the number of file lines displayed... */
/*---------------------------------------------------------------------*/
num_display_lines = (CURRENT_SCREEN.rows[WINDOW_FILEAREA]) - 1;
for (i=0;curr_reserved!=NULL;i++)
curr_reserved = curr_reserved->next;
num_display_lines -= i;
if (CURRENT_VIEW->scale_on)
num_display_lines--;
if (CURRENT_VIEW->tab_on)
num_display_lines--;
if (CURRENT_VIEW->hexshow_on)
num_display_lines = num_display_lines - 2;
if (CURRENT_VIEW->scale_on
&& CURRENT_VIEW->tab_on
&& tab_actual_row == scale_actual_row)
num_display_lines++;
curr = lll_find(CURRENT_FILE->first_line,CURRENT_FILE->last_line,cline,CURRENT_FILE->number_lines);
while(num_pages)
{
rows = num_display_lines;
while(rows)
{
/*---------------------------------------------------------------------*/
/* If the current line is above or below TOF or EOF, set all to blank. */
/*---------------------------------------------------------------------*/
if (curr == NULL)
{
cline = (direction == DIRECTION_FORWARD) ? CURRENT_FILE->number_lines + 1L : 0L;
num_pages = 1L;
break;
}
/*---------------------------------------------------------------------*/
/* If the current line is excluded, increment a running total. */
/* Ignore the line if on TOF or BOF. */
/*---------------------------------------------------------------------*/
if (curr->next != NULL /* Bottom of file */
&& curr->prev != NULL) /* Top of file */
{
if (!in_scope(CURRENT_VIEW,curr))
{
num_shadow_lines++;
cline += (LINETYPE)direction;
if (direction == DIRECTION_FORWARD)
curr = curr->next;
else
curr = curr->prev;
continue;
}
}
/*---------------------------------------------------------------------*/
/* If we get here, we have to determine if a shadow line is to be */
/* displayed or not. */
/*---------------------------------------------------------------------*/
if (CURRENT_VIEW->shadow
&& num_shadow_lines > 0)
{
num_shadow_lines = 0;
rows--;
continue;
}
rows--;
cline += (LINETYPE)direction;
if (direction == DIRECTION_FORWARD)
curr = curr->next;
else
curr = curr->prev;
}
num_pages--;
}
if (direction == DIRECTION_FORWARD
&& cline > CURRENT_FILE->number_lines+1L)
cline = CURRENT_FILE->number_lines+1L;
if (direction == DIRECTION_BACKWARD
&& cline < 0L)
cline = 0L;
cline = find_next_in_scope(CURRENT_VIEW,(LINE *)NULL,cline,direction);
#ifdef TRACE
trace_return();
#endif
return(cline);
}
/***********************************************************************/
#ifdef HAVE_PROTO
short get_row_for_focus_line(CHARTYPE scrno,LINETYPE fl,short cr)
#else
short get_row_for_focus_line(scrno,fl,cr)
CHARTYPE scrno;
LINETYPE fl;
short cr;
#endif
/***********************************************************************/
/*---------------------------------------------------------------------*/
/* Returns the row within the main window where the focus line is */
/* placed. If the focus line is off the screen, or out of bounds of the*/
/* current size of the file; <0 or >number_lines, this returns the */
/* current row. */
/*---------------------------------------------------------------------*/
{
/*-------------------------- external data ----------------------------*/
/*--------------------------- local data ------------------------------*/
register short i=0;
/*--------------------------- processing ------------------------------*/
#ifdef TRACE
trace_function("show.c: get_row_for_focus_line");
#endif
for (i=0;i<screen[scrno].rows[WINDOW_FILEAREA];i++)
{
if (screen[scrno].sl[i].line_number == fl)
{
#ifdef TRACE
trace_return();
#endif
return(i);
}
}
#ifdef TRACE
trace_return();
#endif
return(cr);
}
/***********************************************************************/
#ifdef HAVE_PROTO
LINETYPE get_focus_line_in_view(CHARTYPE scrno,LINETYPE fl,unsigned short row)
#else
LINETYPE get_focus_line_in_view(scrno,fl,row)
CHARTYPE scrno;
LINETYPE fl;
unsigned short row;
#endif
/***********************************************************************/
/*---------------------------------------------------------------------*/
/* Returns a new focus line if the specified focus line is no longer */
/* in view, or the same line number if that line is still in view. */
/*---------------------------------------------------------------------*/
{
/*-------------------------- external data ----------------------------*/
/*--------------------------- local data ------------------------------*/
register unsigned short i=0;
/*--------------------------- processing ------------------------------*/
#ifdef TRACE
trace_function("show.c: get_focus_line_in_view");
#endif
for (i=row;i<screen[scrno].rows[WINDOW_FILEAREA];i++)
{
if (screen[scrno].sl[i].line_number != (-1L))
{
#ifdef TRACE
trace_return();
#endif
return(screen[scrno].sl[i].line_number);
}
}
for (i=row;i>0;i--)
{
if (screen[scrno].sl[i].line_number != (-1L))
{
#ifdef TRACE
trace_return();
#endif
return(screen[scrno].sl[i].line_number);
}
}
/*---------------------------------------------------------------------*/
/* We should never get here as there would be no editable lines in view*/
/*---------------------------------------------------------------------*/
#ifdef TRACE
trace_return();
#endif
return(fl);
}
/***********************************************************************/
#ifdef HAVE_PROTO
LINETYPE calculate_focus_line(LINETYPE fl,LINETYPE cl)
#else
LINETYPE calculate_focus_line(fl,cl)
LINETYPE fl,cl;
#endif
/***********************************************************************/
/*---------------------------------------------------------------------*/
/* Returns the new focus line. If the focus line is still in the */
/* window, it stays as is. If not,the focus line becomes the current */
/* line. */
/*---------------------------------------------------------------------*/
{
/*-------------------------- external data ----------------------------*/
/*--------------------------- local data ------------------------------*/
LINETYPE new_fl=(-1L);
register short i=0;
/*--------------------------- processing ------------------------------*/
#ifdef TRACE
trace_function("show.c: calculate_focus_line");
#endif
for (i=0;i<CURRENT_SCREEN.rows[WINDOW_FILEAREA];i++)
{
if (CURRENT_SCREEN.sl[i].line_number == fl
&& (CURRENT_SCREEN.sl[i].line_type == LINE_LINE
|| CURRENT_SCREEN.sl[i].line_type == LINE_TOF /* MH12 */
|| CURRENT_SCREEN.sl[i].line_type == LINE_EOF)) /* MH12 */
{
new_fl = fl;
break;
}
}
if (new_fl == (-1L))
new_fl = cl;
#ifdef TRACE
trace_return();
#endif
return(new_fl);
}
/***********************************************************************/
#ifdef HAVE_PROTO
void get_current_position(CHARTYPE scrno,LINETYPE *line,LENGTHTYPE *col)
#else
void get_current_position(scrno,line,col)
CHARTYPE scrno;
LINETYPE *line;
LENGTHTYPE *col;
#endif
/***********************************************************************/
{
/*-------------------------- external data ----------------------------*/
/*--------------------------- local data ------------------------------*/
short y=0,x=0;
/*--------------------------- processing ------------------------------*/
#ifdef TRACE
trace_function("show.c: get_current_position");
#endif
getyx(SCREEN_WINDOW(scrno),y,x);
switch(SCREEN_VIEW(scrno)->current_window)
{
case WINDOW_COMMAND:
*line = SCREEN_VIEW(scrno)->current_line;
*col = (LENGTHTYPE)(x+1);
break;
case WINDOW_FILEAREA:
*line = SCREEN_VIEW(scrno)->focus_line;
*col = (LENGTHTYPE)x + SCREEN_VIEW(scrno)->verify_col;
break;
case WINDOW_PREFIX:
*line = SCREEN_VIEW(scrno)->focus_line;
*col = (LENGTHTYPE)(x+1);
break;
}
#ifdef TRACE
trace_return();
#endif
return;
}
/***********************************************************************/
#ifdef HAVE_PROTO
void calculate_new_column(COLTYPE current_screen_col,LENGTHTYPE current_verify_col,
LENGTHTYPE new_file_col,COLTYPE *new_screen_col, LENGTHTYPE *new_verify_col)
#else
void calculate_new_column(current_screen_col,current_verify_col,new_file_col,new_screen_col,new_verify_col)
COLTYPE current_screen_col;
LENGTHTYPE current_verify_col,new_file_col;
COLTYPE *new_screen_col;
LENGTHTYPE *new_verify_col;
#endif
/***********************************************************************/
{
/*-------------------------- external data ----------------------------*/
/*--------------------------- local data ------------------------------*/
LINETYPE x=0;
/*--------------------------- processing ------------------------------*/
#ifdef TRACE
trace_function("show.c: calculate_new_column");
#endif
if (CURRENT_VIEW->current_window == WINDOW_COMMAND)
{
*new_screen_col = (LENGTHTYPE)(new_file_col);
#ifdef TRACE
trace_return();
#endif
return;
}
#if 0
min_file_col = CURRENT_VIEW->verify_col - 1;
max_file_col = CURRENT_VIEW->verify_col + CURRENT_SCREEN.cols[WINDOW_FILEAREA] - 2;
if (new_file_col >= min_file_col
&& new_file_col <= max_file_col) /* new column in display */
#else
if (column_in_view(current_screen,new_file_col))
#endif
{
*new_screen_col = (LENGTHTYPE)(new_file_col - (current_verify_col - 1));
*new_verify_col = current_verify_col;
#ifdef TRACE
trace_return();
#endif
return;
}
/*---------------------------------------------------------------------*/
/* To get here, we have new verify column... */
/*---------------------------------------------------------------------*/
x = CURRENT_SCREEN.cols[WINDOW_FILEAREA] / 2;
*new_verify_col = (LENGTHTYPE)max(1L,(LINETYPE)new_file_col - x + 2L);
*new_screen_col = (LENGTHTYPE)((*new_verify_col == 1) ? new_file_col : x - 1);
#ifdef TRACE
trace_return();
#endif
return;
}
/***********************************************************************/
#ifdef HAVE_PROTO
short prepare_view(CHARTYPE scrn)
#else
short prepare_view(scrn)
CHARTYPE scrn;
#endif
/***********************************************************************/
{
/*-------------------------- external data ----------------------------*/
extern bool curses_started;
/*--------------------------- local data ------------------------------*/
int y=0,x=0;
/*--------------------------- processing ------------------------------*/
#ifdef TRACE
trace_function("show.c: prepare_view");
#endif
SCREEN_VIEW(scrn)->current_row = calculate_actual_row(SCREEN_VIEW(scrn)->current_base,
SCREEN_VIEW(scrn)->current_off,
screen[scrn].rows[WINDOW_FILEAREA],TRUE);
build_screen(scrn);
if (!line_in_view(scrn,SCREEN_VIEW(scrn)->focus_line))
{
SCREEN_VIEW(scrn)->focus_line = SCREEN_VIEW(scrn)->current_line;
pre_process_line(SCREEN_VIEW(scrn),SCREEN_VIEW(scrn)->focus_line,(LINE *)NULL);
build_screen(scrn);
}
if (curses_started)
{
getyx(SCREEN_WINDOW_FILEAREA(scrn),y,x);
y = get_row_for_focus_line(scrn,SCREEN_VIEW(scrn)->focus_line,
SCREEN_VIEW(scrn)->current_row);
/* ensure column from WINDOW is in view */
wmove(SCREEN_WINDOW_FILEAREA(scrn),y,x);
}
#ifdef TRACE
trace_return();
#endif
return(RC_OK);
}
/***********************************************************************/
#ifdef HAVE_PROTO
short advance_view(VIEW_DETAILS *next_view,short direction)
#else
short advance_view(next_view,direction)
VIEW_DETAILS *next_view;
short direction;
#endif
/***********************************************************************/
{
/*-------------------------- external data ----------------------------*/
extern CHARTYPE number_of_files;
extern CHARTYPE *cmd_rec;
extern unsigned short cmd_rec_len;
extern VIEW_DETAILS *vd_first;
extern VIEW_DETAILS *vd_last;
extern bool curses_started;
extern CHARTYPE display_screens;
extern WINDOW *statarea;
extern WINDOW *divider;
extern bool horizontal;
/*--------------------------- local data ------------------------------*/
VIEW_DETAILS *save_current_view=next_view; /* point to passed view */
CHARTYPE save_prefix=0;
ROWTYPE save_cmd_line=0;
short save_gap=0;
bool save_id_line=0;
int y=0,x=0;
short rc=RC_OK;
/*--------------------------- processing ------------------------------*/
#ifdef TRACE
trace_function("show.c: advance_view");
#endif
/*---------------------------------------------------------------------*/
/* If this is the only file, ignore the command... */
/*---------------------------------------------------------------------*/
if (number_of_files < 2)
{
#ifdef TRACE
trace_return();
#endif
return(RC_OK);
}
/*---------------------------------------------------------------------*/
/* If we already have a current view, save some details of it... */
/*---------------------------------------------------------------------*/
if (CURRENT_VIEW)
{
save_prefix=CURRENT_VIEW->prefix;
save_gap=CURRENT_VIEW->prefix_gap;
save_cmd_line=CURRENT_VIEW->cmd_line;
save_id_line=CURRENT_VIEW->id_line;
}
memset(cmd_rec,' ',max_line_length);
cmd_rec_len = 0;
/*---------------------------------------------------------------------*/
/* If we have not passed a "next" view determine what the next view */
/* will be... */
/*---------------------------------------------------------------------*/
if (!save_current_view)
{
post_process_line(CURRENT_VIEW,CURRENT_VIEW->focus_line,(LINE *)NULL,TRUE);
/*---------------------------------------------------------------------*/
/* Get a temporary pointer to the "next" view in the linked list. */
/*---------------------------------------------------------------------*/
if (direction == DIRECTION_FORWARD)
{
if (CURRENT_VIEW->next == (VIEW_DETAILS *)NULL)
save_current_view = vd_first;
else
save_current_view = CURRENT_VIEW->next;
}
else
{
if (CURRENT_VIEW->prev == (VIEW_DETAILS *)NULL)
save_current_view = vd_last;
else
save_current_view = CURRENT_VIEW->prev;
}
}
/*---------------------------------------------------------------------*/
/* Save the position of the cursor for the current view before getting */
/* the contents of the new file... */
/*---------------------------------------------------------------------*/
if (curses_started)
{
if (CURRENT_WINDOW_COMMAND != NULL)
{
wmove(CURRENT_WINDOW_COMMAND,0,0);
my_wclrtoeol(CURRENT_WINDOW_COMMAND);
}
getyx(CURRENT_WINDOW_FILEAREA,CURRENT_VIEW->y[WINDOW_FILEAREA],CURRENT_VIEW->x[WINDOW_FILEAREA]);
if (CURRENT_WINDOW_PREFIX != NULL)
getyx(CURRENT_WINDOW_PREFIX,CURRENT_VIEW->y[WINDOW_PREFIX],CURRENT_VIEW->x[WINDOW_PREFIX]);
}
/*---------------------------------------------------------------------*/
/* If more than one screen is displayed and the file displayed in each */
/* screen is the same, remove the 'current' view from the linked list, */
/* making the next view the current one. Only do this is the "next" */
/* view is not the view in the other screen. */
/*---------------------------------------------------------------------*/
if (display_screens > 1)
{
if (CURRENT_SCREEN.screen_view->file_for_view == OTHER_SCREEN.screen_view->file_for_view)
{
if (CURRENT_VIEW->file_for_view == save_current_view->file_for_view)
{
if (direction == DIRECTION_FORWARD)
{
if (save_current_view->next == (VIEW_DETAILS *)NULL)
save_current_view = vd_first;
else
save_current_view = save_current_view->next;
}
else
{
if (save_current_view->prev == (VIEW_DETAILS *)NULL)
save_current_view = vd_last;
else
save_current_view = save_current_view->prev;
}
}
free_a_view();
CURRENT_VIEW = CURRENT_SCREEN.screen_view = save_current_view;
OTHER_FILE->file_views--;
}
else
/*---------------------------------------------------------------------*/
/* First check if the file in the next view is the same as the file */
/* being displayed in the other screen... */
/*---------------------------------------------------------------------*/
{
if (save_current_view->file_for_view == OTHER_FILE)
{
CURRENT_VIEW = CURRENT_SCREEN.screen_view = save_current_view;
if ((rc = defaults_for_other_files(OTHER_VIEW)) != RC_OK)
{
#ifdef TRACE
trace_return();
#endif
return(rc);
}
CURRENT_SCREEN.screen_view = CURRENT_VIEW;
CURRENT_FILE = CURRENT_SCREEN.screen_view->file_for_view = OTHER_FILE;
CURRENT_FILE->file_views++;
}
else
CURRENT_VIEW = CURRENT_SCREEN.screen_view = save_current_view;
}
}
else /* only one screen being displayed...less hassle */
{
/*---------------------------------------------------------------------*/
/* Make the current view the "next" one determined above. */
/*---------------------------------------------------------------------*/
CURRENT_VIEW = CURRENT_SCREEN.screen_view = save_current_view;
}
/*---------------------------------------------------------------------*/
/* If the position of the prefix or command line for the new view is */
/* different from the previous view, rebuild the windows... */
/*---------------------------------------------------------------------*/
if ((save_prefix&PREFIX_LOCATION_MASK) != (CURRENT_VIEW->prefix&PREFIX_LOCATION_MASK)
|| save_gap != CURRENT_VIEW->prefix_gap
|| save_cmd_line != CURRENT_VIEW->cmd_line
|| save_id_line != CURRENT_VIEW->id_line)
{
set_screen_defaults();
if (curses_started)
{
if (set_up_windows(current_screen) != RC_OK)
{
#ifdef TRACE
trace_return();
#endif
return(RC_OK);
}
}
}
/*---------------------------------------------------------------------*/
/* Re-calculate CURLINE for the new view in case the CURLINE is no */
/* longer in the display area. */
/*---------------------------------------------------------------------*/
prepare_view(current_screen);
pre_process_line(CURRENT_VIEW,CURRENT_VIEW->focus_line,(LINE *)NULL);
build_screen(current_screen);
display_screen(current_screen);
if (curses_started)
{
if (statarea != NULL)
{
wattrset(statarea,set_colour(CURRENT_FILE->attr+ATTR_STATAREA));
redraw_window(statarea);
touchwin(statarea);
}
if (divider != NULL)
{
if (display_screens > 1
&& !horizontal)
wattrset(divider,set_colour(CURRENT_FILE->attr+ATTR_DIVIDER));
touchwin(divider);
wnoutrefresh(divider);
}
wmove(CURRENT_WINDOW_FILEAREA,CURRENT_VIEW->y[WINDOW_FILEAREA],CURRENT_VIEW->x[WINDOW_FILEAREA]);
if (CURRENT_WINDOW_PREFIX != NULL)
wmove(CURRENT_WINDOW_PREFIX,CURRENT_VIEW->y[WINDOW_PREFIX],CURRENT_VIEW->x[WINDOW_PREFIX]);
getyx(CURRENT_WINDOW,y,x);
wmove(CURRENT_WINDOW,y,x);
}
#ifdef TRACE
trace_return();
#endif
return(RC_OK);
}
#if defined(CAN_RESIZE) || defined(OS2)
/***********************************************************************/
#ifdef HAVE_PROTO
short THE_Resize(int rows, int cols)
#else
short THE_Resize(rows,cols)
int rows,cols;
#endif
/***********************************************************************/
{
/*-------------------------- external data ----------------------------*/
extern CHARTYPE display_screens;
extern short terminal_lines;
extern short terminal_cols;
extern bool curses_started;
/*--------------------------- local data ------------------------------*/
register int i=0;
int rc=RC_OK;
/*--------------------------- processing ------------------------------*/
#ifdef TRACE
trace_function("show.c: THE_Resize");
#endif
/*---------------------------------------------------------------------*/
/* This function is called as the result of a screen resize. */
/*---------------------------------------------------------------------*/
resize_term(rows,cols); /* LINES and COLS are NOT used in XCURSES */
terminal_lines = LINES;
terminal_cols = COLS;
#ifdef HAVE_BSD_CURSES
terminal_lines--;
#endif
set_screen_defaults();
if (curses_started)
{
for (i=0;i<display_screens;i++)
{
if ((rc = set_up_windows(i)) != RC_OK)
{
#ifdef TRACE
trace_return();
#endif
return(rc);
}
}
}
create_statusline_window();
return (RC_OK);
}
#endif
#if defined(HAVE_BROKEN_SYSVR4_CURSES)
/***********************************************************************/
#ifdef HAVE_PROTO
short force_curses_background(void)
#else
short force_curses_background()
int rows,cols;
#endif
/***********************************************************************/
{
/*-------------------------- external data ----------------------------*/
extern bool colour_support;
/*--------------------------- local data ------------------------------*/
int rc=RC_OK;
short fg=0,bg=0;
/*--------------------------- processing ------------------------------*/
#ifdef TRACE
trace_function("show.c: force_curses_background");
#endif
/*---------------------------------------------------------------------*/
/* This function is called to ensure that the background colour of the */
/* first line on the screen is set to that which THE requests. Some */
/* curses implementations, notably Solaris 2.5, fail to set the */
/* background to black. */
/*---------------------------------------------------------------------*/
if (colour_support)
{
pair_content(1,&fg,&bg);
init_pair(1,COLOR_BLACK,COLOR_WHITE);
move(0,0);
attrset(COLOR_PAIR(1));
addch(' ');
init_pair(1,fg,bg);
}
return (RC_OK);
}
#endif
|