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
|
#!/usr/bin/tclsh
# Part of MCU 8051 IDE ( http://https://sourceforge.net/projects/mcu8051ide/ )
############################################################################
# Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012 by Martin Ošmera #
# martin.osmera@gmail.com #
# #
# Copyright (C) 2014 by Moravia Microsystems, s.r.o. #
# martin.osmera@gmail.com #
# #
# This program is free software; you can redistribute it and#or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 2 of the License, or #
# (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program; if not, write to the #
# Free Software Foundation, Inc., #
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #
############################################################################
# >>> File inclusion guard
if { ! [ info exists _RIGHTPANEL_TCL ] } {
set _RIGHTPANEL_TCL _
# <<< File inclusion guard
# --------------------------------------------------------------------------
# DESCRIPTION
# Implements Right Panel
# Right Panel Notebook consist of:
# - List of bookmarks
# - List of breakpoints
# - List of register watches
# - Instruction details
# - List of active subprograms
# --------------------------------------------------------------------------
# Import nesesary sources
source "${::LIB_DIRNAME}/rightpanel/regwatches.tcl" ;# Register watches
source "${::LIB_DIRNAME}/rightpanel/instructiondetails.tcl" ;# Instruction details
source "${::LIB_DIRNAME}/rightpanel/subprograms.tcl" ;# List of active subprograms
source "${::LIB_DIRNAME}/rightpanel/hwmanager.tcl" ;# Hardware tools manager
class RightPanel {
inherit RegWatches InstructionDetails SubPrograms HwManager
## COMMON
# Background color for selected rows -- light
public common selection_color {#EEFFDD}
# Background color for selected rows -- dark
public common selection_color_dark {#DDDDFF}
# Default font size for text widgets
public common fontSize ${Editor::fontSize}
# Default font family for text widgets
public common fontFamily ${Editor::fontFamily}
# Font used in Editor
public common editor_font [font create -size -$fontSize -family $fontFamily]
# Definition of popup menu for bookmark list
public common BOOKMARKMENU {
{command {Remove} {$edit:bookmark} 0 "editor_procedure {} Bookmark {}"
{button_cancel} "Add/Remove editor bookmark to/from current line"}
{separator}
{command {Previous} {} 0 "rightPanel_bm_up" {1uparrow}
"Go to previous bookmark"}
{command {Next} {} 0 "rightPanel_bm_up" {1downarrow}
"Go to next bookmark"}
{separator}
{command {Remove all} {} 0 "editor_procedure {} clear_all_bookmarks {}"
{editdelete} "Remove all bookmarks from the editor"}
}
# Definition of popup menu for breakpoint list
public common BREAKPOINTMENU {
{command {Remove} {$edit:breakpoint} 0 "editor_procedure {} Breakpoint {}"
{button_cancel} "Add/Remove editor breakpoint to/from current line"}
{separator}
{command {Previous} {} 0 "rightPanel_bp_up" {1uparrow}
"Go to previous breakpoint"}
{command {Next} {} 0 "rightPanel_bp_up" {1downarrow}
"Go to next breakpoint"}
{separator}
{command {Remove all} {} 0 "editor_procedure {} clear_all_breakpoints {}"
{editdelete} "Remove all breakpoints from the editor"}
}
# Definition of popup menu for symbols list
public common SYMBOLSKMENU {}
## PRIVATE
private variable notebook_frame ;# ID of panel main frame
private variable notebook ;# ID of panel NoteBook
private variable bookmarks ;# ID of tab "Bookmarks"
private variable breakpoints ;# ID of tab "Breakpoints"
private variable watches ;# ID of tab "Register watches"
private variable instruction ;# ID of tab "Instruction details"
private variable subprograms ;# ID of tab "Active subprograms"
private variable hwmanager ;# ID of tab "Hardware manager"
private variable table_of_symbols ;# ID of tab "Table of symbols"
private variable obj_idx ;# Number of this object
private variable bookmarks_menu {} ;# ID of popup menu for "Bookmarks"
private variable breakpoints_menu {} ;# ID of popup menu for "Breakpoints"
private variable symbols_menu ;# ID of popup menu for "Symbol list"
private variable bm_pagesManager ;# ID of pages manager for tab "Bookmarks"
private variable bp_pagesManager ;# ID of pages manager for tab "Breakpoints"
private variable sm_pagesManager ;# ID of pages manager for tab "Symbol list"
private variable bookmarks_lineNumbers ;# ID of text widget showing line numbers - tab "Bookmarks"
private variable breakpoints_lineNumbers ;# ID of text widget showing line numbers - tab "Breakpoints"
private variable bookmarks_text ;# ID of list of bookmarks (text widget) - tab "Bookmarks"
private variable breakpoints_text ;# ID of list of breakpoints (text widget) - tab "Breakpoints"
private variable bm_up_button ;# ID of button "Up" - tab "Bookmarks"
private variable bm_down_button ;# ID of button "Down" - tab "Bookmarks"
private variable bm_clear_button ;# ID of button "Clear all" - tab "Bookmarks"
private variable bp_up_button ;# ID of button "Up" - tab "Breakpoints"
private variable bp_down_button ;# ID of button "Down" - tab "Breakpoints"
private variable bp_clear_button ;# ID of button "Clear all" - tab "Breakpoints"
private variable sm_text ;# ID of symbol list text widget - tab "Symbols"
private variable sm_lineNumbers ;# ID of text widget showing line numbers - tab "Symbols"
private variable LIST_bookmarks_lineNumbers {} ;# List of $bookmarks_lineNumbers (for each editor)
private variable LIST_breakpoints_lineNumbers {} ;# List of $breakpoints_lineNumbers (for each editor)
private variable LIST_bookmarks_text {} ;# List of $bookmarks_text (for each editor)
private variable LIST_breakpoints_text {} ;# List of $breakpoints_text (for each editor)
private variable LIST_bm_up_button {} ;# List of $bm_up_button (for each editor)
private variable LIST_bm_down_button {} ;# List of $bm_down_button (for each editor)
private variable LIST_bm_clear_button {} ;# List of $bm_clear_button (for each editor)
private variable LIST_bp_up_button {} ;# List of $bp_up_button (for each editor)
private variable LIST_bp_down_button {} ;# List of $bp_down_button (for each editor)
private variable LIST_bp_clear_button {} ;# List of $bp_clear_button (for each editor)
private variable LIST_sm_text {} ;# List of $sm_text (for each editor)
private variable LIST_sm_lineNumbers {} ;# List of $sm_lineNumbers (for each editor)
private variable bm_bp_pages_list {} ;# List of editor numbers present in the panel
private variable editors_count 0 ;# Counter of added editors
private variable current_editor_idx 0 ;# Int: Index of currently active editor
private variable block_select 0 ;# Bool: Block selection of an item for certain procedures
private variable search_val_in_progress 0 ;# Bool: Search procedure is in progress
private variable button_bar ;# ID of button bar which replaces notebook on hide
private variable redraw_pane_in_progress 0 ;# (see procedure right_panel_redraw_pane)
private variable parentPane ;# ID of parent container (some frame)
private variable last_PanelSize ;# Last panel widgth
private variable PanelSize $::CONFIG(RIGHT_PANEL_SIZE) ;# Current panel width
private variable active_page $::CONFIG(RIGHT_PANEL_ACTIVE_PAGE) ;# ID of the active page
private variable PanelVisible $::CONFIG(RIGHT_PANEL) ;# Bool: is panel visible
private variable enabled 0 ;# Bool: enable procedures which are needless while loading project
## Object constructor
constructor {} {
}
## Object destructor
destructor {
# Clean up GUI
destroy $notebook_frame
# Remove status bar tips for popup menus
menu_Sbar_remove $bookmarks_menu
menu_Sbar_remove $breakpoints_menu
}
## Create right panel
# @parm Widget notebookframe - frame where to pack NoteBook
# @parm Widget ParentPane - parent paned window
# @parm String watches_file - definition file for register watches
# @return void
public method initialize_rightPanel {notebookframe ParentPane watches_file} {
# Object variables
set parentPane $ParentPane ;# Parent container (some frame)
# Main frame of this panel
set notebook_frame $notebookframe
## Create NoteBook
set notebook [ModernNoteBook $notebook_frame.ntb_rightPanel]
# Register notebook status bar tips
notebook_Sbar_set {rightpanel} [list \
Bookmarks [mc "List of bookmarks in the current editor"] \
Breakpoints [mc "List of breakpoints in the current editor"] \
Instruction [mc "Details for instruction on the current line"] \
Watches [mc "Register watches (for internal data memory, external data memory, expanded data memory and bits)"] \
Subprograms [mc "List of active subprograms"] \
Symbols [mc "Symbol list"] \
Hardware [mc "Hardware manager"] \
Hide [mc "Hide the panel"] \
]
$notebook bindtabs <Enter> "notebook_Sbar rightpanel"
$notebook bindtabs <Leave> "Sbar {} ;#"
#
# Create tabs
#
if {!${::Editor::editor_to_use}} {
# Tab "Bookmarks"
set bookmarks [$notebook insert end {Bookmarks} \
-image ::ICONS::16::bookmark_toolbar \
-raisecmd [list $this rightPanel_set_active_page Bookmarks] \
-helptext [mc "List of bookmarks in editor (Ctrl+6)"] \
]
# Tab "Breakpoints"
set breakpoints [$notebook insert end {Breakpoints} \
-image ::ICONS::16::flag \
-raisecmd [list $this rightPanel_set_active_page Breakpoints] \
-helptext [mc "List of breakpoints in editor (Ctrl+7)"] \
]
# Tab "Symbols"
set table_of_symbols [$notebook insert end {Symbols} \
-image ::ICONS::16::_blockdevice \
-raisecmd [list $this rightPanel_set_active_page Symbols] \
-helptext [mc "Symbol List"] \
]
# Tab "Instruction"
set instruction [$notebook insert end {Instruction} \
-image ::ICONS::16::info \
-raisecmd [list $this rightPanel_set_active_page Instruction] \
-helptext [mc "Instruction details (Ctrl+8)"] \
-createcmd [list $this CreateInstructionDetailsGUI] \
]
}
# Tab "Watches"
set watches [$notebook insert end {Watches} \
-image ::ICONS::16::player_playlist \
-raisecmd [list $this rightPanel_set_active_page Watches] \
-helptext [mc "Register watches (Ctrl+9)"] \
-createcmd [list $this CreateRegWatchesGUI] \
]
# Tab "Subprograms"
set subprograms [$notebook insert end {Subprograms} \
-image ::ICONS::16::queue \
-raisecmd [list $this rightPanel_set_active_page Subprograms] \
-helptext [mc "Active subprograms (Ctrl+0)"] \
-createcmd [list $this CreateSubProgramsGUI] \
]
# Tab "Hardware manager"
set hwmanager [$notebook insert end {Hardware} \
-image ::ICONS::16::kcmpci \
-raisecmd [list $this rightPanel_set_active_page Hardware] \
-helptext [mc "Hardware manager"] \
-createcmd [list $this CreateHwManagerGUI] \
]
# Tab "Hide"
$notebook insert end {Hide} \
-image ::ICONS::16::2rightarrow \
-raisecmd [list $this right_panel_show_hide] \
-helptext [mc "Hide the panel"]
# Prepare panel componenets but do not create GUI elements
PrepareRegWatches $watches $watches_file
PrepareSubPrograms $subprograms
PrepareHwManager $hwmanager
if {!${::Editor::editor_to_use}} {
PrepareInstructionDetails $instruction
}
## Create Button bar
# Button "Show"
set button_bar [frame $notebook_frame.button_bar]
pack [ttk::button $button_bar.but_show \
-image ::ICONS::16::2leftarrow \
-style ToolButton.TButton \
-command "$this right_panel_show_hide" \
]
DynamicHelp::add $button_bar.but_show -text [mc "Show the panel"]
setStatusTip -widget $button_bar.but_show -text [mc "Show the panel"]
# Separator
pack [ttk::separator $button_bar.sep -orient horizontal] -fill x -pady 2
# Button "Hardware manager"
pack [ttk::button $button_bar.but_hwman \
-image ::ICONS::16::kcmpci \
-style ToolButton.TButton \
-command "$this rightPanel_show_up Hardware" \
]
DynamicHelp::add $button_bar.but_hwman -text [mc "Hardware tools"]
setStatusTip -widget $button_bar.but_hwman \
-text [mc "Hardware tools manager"]
# Button "Active Subprograms"
pack [ttk::button $button_bar.but_subprog \
-image ::ICONS::16::queue \
-style ToolButton.TButton \
-command "$this rightPanel_show_up Subprograms" \
]
DynamicHelp::add $button_bar.but_subprog -text [mc "Active subprograms (Ctrl+0)"]
setStatusTip -widget $button_bar.but_subprog \
-text [mc "List of active subprograms"]
# Button "Register watches"
pack [ttk::button $button_bar.but_reg_watch \
-image ::ICONS::16::player_playlist \
-style ToolButton.TButton \
-command "$this rightPanel_show_up Watches" \
]
DynamicHelp::add $button_bar.but_reg_watch -text [mc "MCU register watches (Ctrl+9)"]
setStatusTip -widget $button_bar.but_reg_watch \
-text [mc "Register watches for internal data memory, external data memory and expanded data memory"]
if {!${::Editor::editor_to_use}} {
# Button "Instruction details"
pack [ttk::button $button_bar.but_ins_det \
-image ::ICONS::16::info \
-style ToolButton.TButton \
-command "$this rightPanel_show_up Instruction" \
-state [expr {${::Editor::editor_to_use} ? {disabled} : {!disabled}}] \
]
DynamicHelp::add $button_bar.but_ins_det -text [mc "Instruction details (Ctrl+8)"]
setStatusTip -widget $button_bar.but_ins_det \
-text [mc "Details for instruction on the current line"]
# Button "Symbol List"
pack [ttk::button $button_bar.but_symbols \
-image ::ICONS::16::_blockdevice \
-style ToolButton.TButton \
-command "$this rightPanel_show_up Symbols" \
-state [expr {${::Editor::editor_to_use} ? {disabled} : {!disabled}}] \
]
DynamicHelp::add $button_bar.but_symbols -text [mc "Symbol List"]
setStatusTip -widget $button_bar.but_symbols \
-text [mc "Symbol List"]
# Button "Breakpoints"
pack [ttk::button $button_bar.but_breakpoints \
-image ::ICONS::16::flag \
-style ToolButton.TButton \
-command "$this rightPanel_show_up Breakpoints" \
-state [expr {${::Editor::editor_to_use} ? {disabled} : {!disabled}}] \
]
DynamicHelp::add $button_bar.but_breakpoints -text [mc "List of breakpoints in editor (Ctrl+7)"]
setStatusTip -widget $button_bar.but_breakpoints \
-text [mc "List of breakpoints in the current editor"]
# Button "Bookmarks"
pack [ttk::button $button_bar.but_bookmarks \
-image ::ICONS::16::bookmark_toolbar \
-style ToolButton.TButton \
-command "$this rightPanel_show_up Bookmarks" \
-state [expr {${::Editor::editor_to_use} ? {disabled} : {!disabled}}] \
]
DynamicHelp::add $button_bar.but_bookmarks -text [mc "List of bookmarks in editor (Ctrl+6)"]
setStatusTip -widget $button_bar.but_bookmarks \
-text [mc "List of bookmarks in the current editor"]
}
if {!${::Editor::editor_to_use}} {
# Pack pages managers
set bm_pagesManager [PagesManager $bookmarks.pgm_rightPanel_bm -background ${::COMMON_BG_COLOR}]
pack $bm_pagesManager -expand 1 -fill both
$bm_pagesManager compute_size
set bp_pagesManager [PagesManager $breakpoints.pgm_rightPanel_pm -background ${::COMMON_BG_COLOR}]
pack $bp_pagesManager -expand 1 -fill both
$bp_pagesManager compute_size
set sm_pagesManager [PagesManager $table_of_symbols.sm_pagesManager -background ${::COMMON_BG_COLOR}]
pack $sm_pagesManager -expand 1 -fill both
$sm_pagesManager compute_size
# Create popup menus
set bookmarks_menu $notebook_frame.menu_rightPanel_bookmarks
set breakpoints_menu $notebook_frame.menu_rightPanel_breakpoints
set symbols_menu $notebook_frame.menu_rightPanel_symbols
menuFactory $BREAKPOINTMENU $breakpoints_menu 0 "$this " 0 {} [namespace current]
menuFactory $BOOKMARKMENU $bookmarks_menu 0 "$this " 0 {} [namespace current]
menuFactory $SYMBOLSKMENU $symbols_menu 0 "$this " 0 {} [namespace current]
}
#
# Post-initialization
#
bind $parentPane <ButtonRelease-1> "$this right_panel_set_size"
# Show panel GUI components
if {$PanelVisible} {
# Show NoteBook
$parentPane paneconfigure $notebook_frame -minsize 295
pack [$notebook get_nb] -expand 1 -fill both -padx 5 -pady 5
$parentPane configure -sashwidth 2
if {[catch {
$notebook raise $active_page
if {
${::Editor::editor_to_use} &&
([lsearch {Bookmarks Breakpoints Instruction Symbols} $active_page] != -1)
} then {
set active_page {Watches}
$notebook raise {Watches}
}
}]} then {
set active_page {Watches}
$notebook raise {Watches}
}
} else {
# Show button bar
$parentPane paneconfigure $notebook_frame -minsize 0
pack $button_bar -anchor nw
$parentPane configure -sashwidth 0
bind $parentPane <Button> {break}
set last_PanelSize $PanelSize
set PanelSize 60
}
}
## Synchronously scroll list of bookmarks and its line numbers
# @parm Char - what (m == Bookmarks; p == Breakpoints; s == Symbols)
# @parm String - string "moveto"
# @parm Float - number between 0.0 and 1.0 (0.0 == 'start', 1.0 == 'end')
# @return void
public method rightPanel_scroll args {
# Local variables
set what [lindex $args 0] ;# m == Bookmarks; p == Breakpoints; s == Symbols
set cmd [lindex $args 1] ;# Scroll command (moveto, scroll and such)
set frac [lindex $args 2] ;# Fraction where to move
set units [lindex $args 3] ;# Units (optonal)
switch -- $what {
{m} { ;# Bookmarks
set lnb $bookmarks_lineNumbers
set txt $bookmarks_text
}
{p} { ;# Breakpoints
set lnb $breakpoints_lineNumbers
set txt $breakpoints_text
}
{s} { ;# Symbols
set lnb $sm_lineNumbers
set txt $sm_text
}
}
if {$units == {}} {
$lnb yview $cmd $frac
$txt yview $cmd $frac
} else {
$lnb yview $cmd $frac $units
$txt yview $cmd $frac $units
}
}
## Set position for scrollbar and line numbers in bookmark list
# @parm Char what - (m == Bookmarks; p == Breakpoints; s == Symbols)
# @parm Widget scrollbar - ID of scrollbar widget to adjust
# @parm Float fraction0 - y position
# @parm Float fraction1 - x position
# @return Bool - result
public method rightPanel_scrollSet {what scrollbar fraction0 fraction1} {
switch -- $what {
{m} { ;# Bookmarks
set txt $bookmarks_text
}
{p} { ;# Breakpoints
set txt $breakpoints_text
}
{s} { ;# Symbols
set txt $sm_text
}
}
if {![winfo exists $txt]} {
return 0
}
catch {
if {$fraction0 == {0.0} && $fraction1 == {1.0}} {
if {[winfo ismapped $scrollbar]} {
pack forget $scrollbar
}
} else {
if {![winfo ismapped $scrollbar]} {
pack $scrollbar -side right -fill y -after $txt
}
}
}
$scrollbar set $fraction0 $fraction1
rightPanel_scroll $what moveto $fraction0
return 1
}
## Refresh font settings for all text widgets in the panel
# @parm Bool for_all - 0 == only for the current editor; 1 == for all editors
# @return void
public method rightPanel_refresh_font_settings {for_all} {
if {${::Editor::editor_to_use}} {return}
if {$for_all} {
foreach widget $LIST_bookmarks_lineNumbers {
$widget configure -font ${Editor::defaultFont_bold}
}
foreach widget $LIST_breakpoints_lineNumbers {
$widget configure -font ${Editor::defaultFont_bold}
}
set i 0
foreach widget $LIST_bookmarks_text {
$widget configure -font ${Editor::defaultFont_bold}
ASMsyntaxHighlight::create_tags $widget ${Editor::fontSize} ${Editor::fontFamily}
set language [$this editor_procedure $i get_language {}]
if {$language == 1} {
CsyntaxHighlight::create_tags \
$widget ${Editor::fontSize} ${Editor::fontFamily}
} elseif {$language == 2} {
LSTsyntaxHighlight::create_tags \
$widget ${Editor::fontSize} ${Editor::fontFamily}
}
incr i
}
set i 0
foreach widget $LIST_breakpoints_text {
$widget configure -font ${Editor::defaultFont_bold}
ASMsyntaxHighlight::create_tags $widget ${Editor::fontSize} ${Editor::fontFamily}
set language [$this editor_procedure $i get_language {}]
if {$language == 1} {
CsyntaxHighlight::create_tags \
$widget ${Editor::fontSize} ${Editor::fontFamily}
} elseif {$language == 2} {
LSTsyntaxHighlight::create_tags \
$widget ${Editor::fontSize} ${Editor::fontFamily}
}
incr i
}
} else {
$bookmarks_lineNumbers configure -font ${Editor::defaultFont_bold}
$bookmarks_text configure -font ${Editor::defaultFont_bold}
$breakpoints_lineNumbers configure -font ${Editor::defaultFont_bold}
$breakpoints_text configure -font ${Editor::defaultFont_bold}
$sm_lineNumbers configure -font ${Editor::defaultFont_bold}
$sm_text configure -font ${Editor::defaultFont_bold}
ASMsyntaxHighlight::create_tags $bookmarks_text ${Editor::fontSize} ${Editor::fontFamily}
ASMsyntaxHighlight::create_tags $breakpoints_text ${Editor::fontSize} ${Editor::fontFamily}
set language [$this editor_procedure {end} get_language {}]
if {$language == 1} {
CsyntaxHighlight::create_tags \
$bookmarks_text ${Editor::fontSize} ${Editor::fontFamily}
CsyntaxHighlight::create_tags \
$breakpoints_text ${Editor::fontSize} ${Editor::fontFamily}
} elseif {$language == 2} {
CsyntaxHighlight::create_tags \
$bookmarks_text ${Editor::fontSize} ${Editor::fontFamily}
CsyntaxHighlight::create_tags \
$breakpoints_text ${Editor::fontSize} ${Editor::fontFamily}
}
create_tags_in_symbol_list
}
}
## Create highlight tag for list of bookmarks and breakpoints for the current editor
# @return void
public method rightPanel_add_Editor__create_menu_and_tags {} {
if {${::Editor::editor_to_use}} {return}
ASMsyntaxHighlight::create_tags $breakpoints_text $fontSize $fontFamily
ASMsyntaxHighlight::create_tags $bookmarks_text $fontSize $fontFamily
set language [$this editor_procedure {end} get_language {}]
if {$language == 1} {
rightPanel_bm_bp_create_c_hg_tags
} elseif {$language == 2} {
rightPanel_bm_bp_create_lst_hg_tags
}
create_tags_in_symbol_list
}
## Create highlighting tags in the text widget in the "List of Symbols"
# @return void
private method create_tags_in_symbol_list {} {
set tags_to_define [list tag_label tag_constant tag_normal tag_macro]
foreach tag_def [concat ${::ASMsyntaxHighlight::highlight_tags} ${::CsyntaxHighlight::highlight_tags}] {
if {[lsearch -ascii -exact $tags_to_define [lindex $tag_def 0]] == -1} {
continue
}
# Create array of tag attributes
for {set i 0} {$i < 5} {incr i} {
set tag_def_item($i) [lindex $tag_def $i]
}
# Foreground color
if {$tag_def_item(1) == {}} {
set tag_def_item(1) black
}
# Fonr slant
if {$tag_def_item(3) == 1} {
set tag_def_item(3) italic
} else {
set tag_def_item(3) roman
}
# Font weight
if {$tag_def_item(4) == 1} {
set tag_def_item(4) bold
} else {
set tag_def_item(4) normal
}
# Create the tag in the target text widget
$sm_text tag configure $tag_def_item(0) \
-foreground $tag_def_item(1) \
-font [font create \
-overstrike $tag_def_item(2) \
-slant $tag_def_item(3) \
-weight $tag_def_item(4) \
-size -$::Editor::fontSize \
-family $::Editor::fontFamily \
]
}
# Create tag for C function
$sm_text tag configure tag_c_func \
-foreground {#0000DD} \
-font ${::Editor::defaultFont}
}
## Create highlighting tags for Codelisting for the current editor
# @return void
public method rightPanel_bm_bp_create_lst_hg_tags {} {
LSTsyntaxHighlight::create_tags $breakpoints_text $fontSize $fontFamily
LSTsyntaxHighlight::create_tags $bookmarks_text $fontSize $fontFamily
}
## Create highlighting tags for C language for the current editor
# @return void
public method rightPanel_bm_bp_create_c_hg_tags {} {
CsyntaxHighlight::create_tags $breakpoints_text $fontSize $fontFamily
CsyntaxHighlight::create_tags $bookmarks_text $fontSize $fontFamily
}
## Add new list of bookmarks and list of breakpoints for new editor
# @parm Bool create_menu_and_tags - Create popup menus and highlighting tags
# @return void
public method rightPanel_add_Editor {create_menu_and_tags} {
if {${::Editor::editor_to_use}} {return}
# Local variables
set bm_page [$bm_pagesManager add $editors_count] ;# ID of current bookmarks page
set bp_page [$bp_pagesManager add $editors_count] ;# ID of current breakpoints page
set sm_page [$sm_pagesManager add $editors_count] ;# ID of current page in symbol list
# Register new editor
set current_editor_idx $editors_count
lappend bm_bp_pages_list $editors_count
incr editors_count ;# increment counter of editors
#
# Create tab "Bookmarks"
#
## Create icon bar (up, down, bookmark, clear all)
# Create button frame
set button_frame [frame $bm_page.frm_rightPanel_bm_button_frame]
pack $button_frame -side top -fill x
# Button "Up"
set bm_up_button [ttk::button $button_frame.but_rightPanel_bm_up \
-image ::ICONS::16::1uparrow \
-state disabled \
-command "$this rightPanel_bm_up" \
-style ToolButton.TButton \
]
pack $bm_up_button -side left
DynamicHelp::add $bm_up_button -text [mc "Move to previous bookmark"]
setStatusTip -widget $bm_up_button \
-text [mc "Go to to line of previous bookmark"]
# Button "Down"
set bm_down_button [ttk::button $button_frame.but_rightPanel_bm_down \
-image ::ICONS::16::1downarrow \
-state disabled \
-command "$this rightPanel_bm_down" \
-style ToolButton.TButton \
]
pack $bm_down_button -side left
DynamicHelp::add $bm_down_button -text [mc "Move to the next bookmark"]
setStatusTip -widget $bm_down_button \
-text [mc "Go to to line of next bookmark"]
# Separator
pack [ttk::separator $button_frame.but_rightPanel_bm_sep \
-orient vertical \
] -side left -fill y -padx 2
# Button "Bookmark"
set button [ttk::button $button_frame.but_rightPanel_bm_bookmark \
-image ::ICONS::16::bookmark_add \
-command "$this editor_procedure {} Bookmark {}" \
-style ToolButton.TButton \
]
pack $button -side left
DynamicHelp::add $button -text [mc "Add/Remove bookmark on the current line"]
setStatusTip -widget $button \
-text [mc "Add/Remove bookmark on the current line in editor"]
# Button "Clear all"
set bm_clear_button [ttk::button $button_frame.but_rightPanel_bm_clear \
-image ::ICONS::16::editdelete \
-state disabled \
-command "$this editor_procedure {} clear_all_bookmarks {}" \
-style ToolButton.TButton \
]
pack $bm_clear_button -side right
DynamicHelp::add $bm_clear_button -text [mc "Clear all bookmarks"]
setStatusTip -widget $bm_clear_button \
-text [mc "Clear all bookmarks from editor"]
# Create text frame (Contains: text widget, scrollbar, LineNumbers)
set text_frame [frame $bm_page.frm_rightPanel_bm_text_frame -bd 1 -relief sunken]
pack $text_frame -fill both -expand 1 -side bottom
# Create scrollbar
set scrollbar [ttk::scrollbar \
$text_frame.scr_rightPanel_bookmars \
-orient vertical \
-command "$this rightPanel_scroll m" \
]
# Create line numbers
set bookmarks_lineNumbers [text $text_frame.txt_rightPanel_bm_lineNumbers \
-yscrollcommand "$this rightPanel_scrollSet m $scrollbar" \
-cursor left_ptr \
-width 1 -height 1 \
-bg gray \
-fg white \
-relief flat \
-bd 1 \
-state disabled \
-exportselection 0 \
-takefocus 0 \
-font ${Editor::defaultFont_bold} \
]
$bookmarks_lineNumbers tag configure right -justify right
# Create list of bookmarks
set bookmarks_text [text $text_frame.txt_rightPanel_bookmars \
-cursor left_ptr -state disabled -width 1 -height 1 \
-wrap none -exportselection 0 -bd 1 -relief flat \
-yscrollcommand "$this rightPanel_scrollSet m $scrollbar" \
-font ${Editor::defaultFont_bold} \
]
$bookmarks_text tag configure curLine \
-borderwidth 1 \
-relief raised \
-background ${::RightPanel::selection_color}
# Set bindings
bind $bookmarks_text <<Selection>> "false_selection $bookmarks_text; break"
bind $bookmarks_text <Button-1> "$this rightPanel_xx_txt_click m %x %y; break"
bind $bookmarks_text <ButtonRelease-3> "$this rightPanel_bm_popupmenu %X %Y %x %y; break; break"
bind $bookmarks_lineNumbers <ButtonRelease-3> "$this rightPanel_bm_popupmenu %X %Y %x %y; break; break"
bind $bookmarks_text <Key-Menu> {break}
bind $bookmarks_lineNumbers <<Selection>> "false_selection $bookmarks_lineNumbers; break"
# Pack components of "Text frame"
pack $bookmarks_lineNumbers -side left -fill y
pack $bookmarks_text -side left -expand 1 -fill both
#
# Breakpoints tab
#
## Create icon bar (up, down, breakpoint, clear all)
# Create button frame
set button_frame [frame $bp_page.frm_rightPanel_bp_button_frame]
pack $button_frame -side top -fill x
# Button "Up"
set bp_up_button [ttk::button $button_frame.but_rightPanel_bp_up \
-image ::ICONS::16::1uparrow \
-state disabled \
-command "$this rightPanel_bp_up" \
-style ToolButton.TButton \
]
pack $bp_up_button -side left
DynamicHelp::add $bp_up_button -text [mc "Move to previous breakpoint"]
setStatusTip -widget $bp_up_button \
-text [mc "Go to to line of previous breakpoint"]
# Button "Down"
set bp_down_button [ttk::button $button_frame.but_rightPanel_bp_down \
-image ::ICONS::16::1downarrow \
-state disabled \
-command "$this rightPanel_bp_down" \
-style ToolButton.TButton \
]
pack $bp_down_button -side left
DynamicHelp::add $bp_down_button -text [mc "Move to next breakpoint"]
setStatusTip -widget $bp_down_button \
-text [mc "Go to to line of next breakpoint"]
# Separator
pack [ttk::separator $button_frame.but_rightPanel_bp_sep \
-orient vertical \
] -side left -fill y -padx 2
# Button "Breakpoint"
set button [ttk::button $button_frame.but_rightPanel_bp_breakpoint \
-image ::ICONS::16::flag \
-command "$this editor_procedure {} Breakpoint {}" \
-style ToolButton.TButton \
]
pack $button -side left
DynamicHelp::add $button -text [mc "Add/Remove breakpoint on the current line"]
setStatusTip -widget $button \
-text [mc "Add/Remove breakpoint on the current line in editor"]
# Buttton "Clear all"
set bp_clear_button [ttk::button $button_frame.but_rightPanel_bp_clear \
-image ::ICONS::16::editdelete \
-state disabled \
-command "$this editor_procedure {} clear_all_breakpoints {}" \
-style ToolButton.TButton \
]
pack $bp_clear_button -side right
DynamicHelp::add $bp_clear_button -text [mc "Clear all breakpoints"]
setStatusTip -widget $bp_clear_button \
-text [mc "Clear all breakpoints from editor"]
# Create text frame (Contains: text widget, scrollbar, LineNumbers)
set text_frame [frame $bp_page.frm_rightPanel_bp_text_frame -bd 1 -relief sunken]
pack $text_frame -fill both -expand 1 -side bottom
# Create scrollbar
set scrollbar [ttk::scrollbar \
$text_frame.scr_rightPanel_breakpoints \
-orient vertical \
-command "$this rightPanel_scroll p" \
]
# Create line numbers
set breakpoints_lineNumbers [text $text_frame.txt_rightPanel_bp_lineNumbers \
-yscrollcommand "$this rightPanel_scrollSet p $scrollbar" \
-cursor left_ptr \
-width 1 -height 1 \
-exportselection 0 \
-bg gray \
-fg white \
-relief flat \
-bd 1 \
-state disabled \
-takefocus 0 \
-font ${Editor::defaultFont_bold} \
]
$breakpoints_lineNumbers tag configure right -justify right
# Create list of breakpoints
set breakpoints_text [text $text_frame.txt_rightPanel_breakpoints \
-cursor left_ptr -state disabled \
-wrap none -exportselection 0 -bd 1 -relief flat \
-font ${Editor::defaultFont_bold} -width 1 -height 1 \
-yscrollcommand "$this rightPanel_scrollSet p $scrollbar" \
]
$breakpoints_text tag configure curLine \
-borderwidth 1 \
-relief raised \
-background ${::RightPanel::selection_color}
# Pack widgets of the text frame
pack $breakpoints_lineNumbers -side left -fill y
pack $breakpoints_text -side left -expand 1 -fill both
# Set bindings
bind $breakpoints_text <<Selection>> "false_selection $breakpoints_text; break"
bind $breakpoints_text <Button-1> "$this rightPanel_xx_txt_click p %x %y; break"
bind $breakpoints_text <ButtonRelease-3> "$this rightPanel_bp_popupmenu %X %Y %x %y; break; break"
bind $breakpoints_lineNumbers <ButtonRelease-3> "$this rightPanel_bp_popupmenu %X %Y %x %y; break; break"
bind $breakpoints_text <Key-Menu> {break}
bind $breakpoints_lineNumbers <<Selection>> "false_selection $breakpoints_lineNumbers; break"
#
# Symbol list
#
## Create icon bar (up, down, breakpoint, clear all)
# Create button frame
set button_frame [frame $sm_page.button_frame]
pack $button_frame -side top -fill x
# Button "Refresh"
set refresh_but [ttk::button $button_frame.refresh_but \
-image ::ICONS::16::reload \
-command "$this rightPanel_refresh_symbols" \
-style ToolButton.TButton \
]
pack $refresh_but -side left
DynamicHelp::add $refresh_but -text [mc "Reevaluate"]
setStatusTip -widget $refresh_but \
-text [mc "Reevaluate ..."]
# Button "Clear search string"
set sm_search_clear [ttk::button $button_frame.clear_search \
-image ::ICONS::16::clear_left \
-style Flat.TButton \
-command "$button_frame.search_entry delete 0 end" \
-state disabled \
]
DynamicHelp::add $button_frame.clear_search -text [mc "Clear search string"]
pack $sm_search_clear -side right
setStatusTip -widget $sm_search_clear \
-text [mc "Clear search string"]
# Entry "Search"
set sm_search_entry [ttk::entry $button_frame.search_entry \
-validate key \
-width 0 \
-validatecommand "$this rightPanel_sm_search_validate %P %W $sm_search_clear" \
]
DynamicHelp::add $sm_search_entry -text [mc "Search for a constant, variable, function or macro"]
pack $sm_search_entry -side right -fill x -expand 1
setStatusTip -widget $sm_search_entry \
-text [mc "Search for a constant, variable, function or macro"]
# Label "Search:"
pack [label $button_frame.search_lbl -text [mc " Search:"]] -side right
# Create text frame (Contains: text widget, scrollbar, LineNumbers)
set text_frame [frame $sm_page.text_frame -bd 1 -relief sunken]
pack $text_frame -fill both -expand 1 -side bottom
# Create scrollbar
set scrollbar [ttk::scrollbar $text_frame.scr \
-orient vertical \
-command "$this rightPanel_scroll s" \
]
set sm_lineNumbers [text $text_frame.ln \
-yscrollcommand "$this rightPanel_scrollSet s $scrollbar" \
-cursor left_ptr -width 1 \
-exportselection 0 -bg gray \
-height 1 -fg white \
-relief flat -bd 1 \
-state disabled -takefocus 0 \
-font ${Editor::defaultFont_bold} \
]
$sm_lineNumbers tag configure right -justify right
set sm_text [text $text_frame.txt \
-cursor left_ptr -state disabled \
-wrap none -exportselection 0 -bd 1 -relief flat \
-font ${Editor::defaultFont_bold} -width 1 -height 1 \
-yscrollcommand "$this rightPanel_scrollSet s $scrollbar" \
]
$sm_text tag configure curLine \
-borderwidth 1 \
-relief raised \
-background ${::RightPanel::selection_color}
# Pack widgets of the text frame
pack $scrollbar -side right -fill y
pack $sm_lineNumbers -side left -fill y
pack $sm_text -side left -expand 1 -fill both
# Set bindings
bind $sm_text <<Selection>> "false_selection $sm_text; break"
bind $sm_text <Button-1> "$this rightPanel_xx_txt_click s %x %y; break"
bind $sm_text <Key-Menu> {break}
bind $sm_text <ButtonRelease-3> {break}
bind $sm_lineNumbers <<Selection>> "false_selection $sm_lineNumbers; break"
bind $sm_lineNumbers <Key-Menu> {break}
bind $sm_lineNumbers <ButtonRelease-3> {break}
## FINISH
# Append create d widgets to lists
lappend LIST_bookmarks_lineNumbers $bookmarks_lineNumbers
lappend LIST_breakpoints_lineNumbers $breakpoints_lineNumbers
lappend LIST_bookmarks_text $bookmarks_text
lappend LIST_breakpoints_text $breakpoints_text
lappend LIST_bm_up_button $bm_up_button
lappend LIST_bm_down_button $bm_down_button
lappend LIST_bm_clear_button $bm_clear_button
lappend LIST_bp_up_button $bp_up_button
lappend LIST_bp_down_button $bp_down_button
lappend LIST_bp_clear_button $bp_clear_button
lappend LIST_sm_text $sm_text
lappend LIST_sm_lineNumbers $sm_lineNumbers
if {$create_menu_and_tags} {
rightPanel_add_Editor__create_menu_and_tags
}
}
## Enable/Disable buttons on Bookmarks+Breakpoints icon bar
# @return void
private method bm_bp_disEna_buttons {} {
# Bookmarks
set end [$bookmarks_text index end]
switch -- $end {
{2.0} { ;# Empty list
$bm_up_button configure -state disabled
$bm_down_button configure -state disabled
$bm_clear_button configure -state disabled
}
{3.0} { ;# One item
$bm_up_button configure -state disabled
$bm_down_button configure -state disabled
$bm_clear_button configure -state normal
}
default { ;# More items
$bm_up_button configure -state normal
$bm_down_button configure -state normal
$bm_clear_button configure -state normal
}
}
# Breakpoints
set end [$breakpoints_text index end]
switch -- $end {
{2.0} { ;# Empty list
$bp_up_button configure -state disabled
$bp_down_button configure -state disabled
$bp_clear_button configure -state disabled
}
{3.0} { ;# One item
$bp_up_button configure -state disabled
$bp_down_button configure -state disabled
$bp_clear_button configure -state normal
}
default { ;# More items
$bp_up_button configure -state normal
$bp_down_button configure -state normal
$bp_clear_button configure -state normal
}
}
}
## Recreate popup menus
# @return void
public method rightPanel_makePopupMenu {} {
regwatches_makePopupMenu
if {[winfo exists $breakpoints_menu]} {destroy $breakpoints_menu}
if {[winfo exists $bookmarks_menu]} {destroy $bookmarks_menu}
menuFactory $BREAKPOINTMENU $breakpoints_menu 0 "$this " 0 {} [namespace current]
menuFactory $BOOKMARKMENU $bookmarks_menu 0 "$this " 0 {} [namespace current]
}
## Invoke bookmarks popup menu
# @parm Int X - Absolute X coordinate
# @parm Int Y - Absolute Y coordinate
# @parm Int x - Relative X coordinate
# @parm Int y - Relative Y coordinate
# @return void
public method rightPanel_bm_popupmenu {X Y x y} {
# Change position in the list
rightPanel_xx_txt_click m $x $y
# Enable/Disable menu items
set end [$bookmarks_text index end]
switch -- $end {
{2.0} { ;# Empty list
$bookmarks_menu entryconfigure [::mc "Remove"] -state disabled
$bookmarks_menu entryconfigure [::mc "Next"] -state disabled
$bookmarks_menu entryconfigure [::mc "Previous"] -state disabled
$bookmarks_menu entryconfigure [::mc "Remove all"] -state disabled
}
{3.0} { ;# One item
$bookmarks_menu entryconfigure [::mc "Remove"] -state normal
$bookmarks_menu entryconfigure [::mc "Next"] -state disabled
$bookmarks_menu entryconfigure [::mc "Previous"] -state disabled
$bookmarks_menu entryconfigure [::mc "Remove all"] -state normal
}
default { ;# More items
$bookmarks_menu entryconfigure [::mc "Remove"] -state normal
$bookmarks_menu entryconfigure [::mc "Next"] -state normal
$bookmarks_menu entryconfigure [::mc "Previous"] -state normal
$bookmarks_menu entryconfigure [::mc "Remove all"] -state normal
}
}
# Invoke the menu
tk_popup $bookmarks_menu $X $Y
}
## Invoke breakpoints popup menu
# @parm Int X - Absolute X coordinate
# @parm Int Y - Absolute Y coordinate
# @parm Int x - Relative X coordinate
# @parm Int y - Relative Y coordinate
# @return void
public method rightPanel_bp_popupmenu {X Y x y} {
# Change position in the list
rightPanel_xx_txt_click p $x $y
# Enable/Disable menu items
set end [$breakpoints_text index end]
switch -- $end {
{2.0} { ;# Empty list
$breakpoints_menu entryconfigure [::mc "Remove"] -state disabled
$breakpoints_menu entryconfigure [::mc "Next"] -state disabled
$breakpoints_menu entryconfigure [::mc "Previous"] -state disabled
$breakpoints_menu entryconfigure [::mc "Remove all"] -state disabled
}
{3.0} { ;# One item
$breakpoints_menu entryconfigure [::mc "Remove"] -state normal
$breakpoints_menu entryconfigure [::mc "Next"] -state disabled
$breakpoints_menu entryconfigure [::mc "Previous"] -state disabled
$breakpoints_menu entryconfigure [::mc "Remove all"] -state normal
} default { ;# More items
$breakpoints_menu entryconfigure [::mc "Remove"] -state normal
$breakpoints_menu entryconfigure [::mc "Next"] -state normal
$breakpoints_menu entryconfigure [::mc "Previous"] -state normal
$breakpoints_menu entryconfigure [::mc "Remove all"] -state normal
}
}
# Invoke the menu
tk_popup $breakpoints_menu $X $Y
}
## Remove editor from the list
# @parm Int idx - editor index
# @return void
public method rightPanel_remove_Editor {idx} {
if {${::Editor::editor_to_use}} {return}
# Remove pages from pages managers
$bm_pagesManager delete [lindex $bm_bp_pages_list $idx]
$bp_pagesManager delete [lindex $bm_bp_pages_list $idx]
$sm_pagesManager delete [lindex $bm_bp_pages_list $idx]
set bm_bp_pages_list [lreplace $bm_bp_pages_list $idx $idx]
# Remove widget references from its lists
set LIST_bookmarks_lineNumbers [lreplace $LIST_bookmarks_lineNumbers $idx $idx]
set LIST_breakpoints_lineNumbers [lreplace $LIST_breakpoints_lineNumbers $idx $idx]
set LIST_bookmarks_text [lreplace $LIST_bookmarks_text $idx $idx]
set LIST_breakpoints_text [lreplace $LIST_breakpoints_text $idx $idx]
set LIST_bm_up_button [lreplace $LIST_bm_up_button $idx $idx]
set LIST_bm_down_button [lreplace $LIST_bm_down_button $idx $idx]
set LIST_bm_clear_button [lreplace $LIST_bm_clear_button $idx $idx]
set LIST_bp_up_button [lreplace $LIST_bp_up_button $idx $idx]
set LIST_bp_down_button [lreplace $LIST_bp_down_button $idx $idx]
set LIST_bp_clear_button [lreplace $LIST_bp_clear_button $idx $idx]
set LIST_sm_text [lreplace $LIST_sm_text $idx $idx]
set LIST_sm_lineNumbers [lreplace $LIST_sm_lineNumbers $idx $idx]
}
## Change the current editor
# @parm Int idx - editor index
# @return void
public method rightPanel_switch_editor {idx} {
if {${::Editor::editor_to_use}} {return}
set current_editor_idx $idx
rightPanel_switch_page $idx
rightPanel_switch_editor_vars $idx
}
## Change the current page in pages managers
# @parm Int idx - editor index
# @return void
public method rightPanel_switch_page {idx} {
if {${::Editor::editor_to_use}} {return}
set current_editor_idx $idx
$bm_pagesManager raise [lindex $bm_bp_pages_list $idx]
$bp_pagesManager raise [lindex $bm_bp_pages_list $idx]
$sm_pagesManager raise [lindex $bm_bp_pages_list $idx]
if {$active_page == {Symbols}} {
catch {$this editor_procedure {} comp_win_highlight_all_in_background {}}
}
}
## Change current editor but don not affect GUI
# @parm Int idx - editor index
# @return void
public method rightPanel_switch_editor_vars {idx} {
if {${::Editor::editor_to_use}} {return}
# Set active widgets
set current_editor_idx $idx
set bookmarks_lineNumbers [lindex $LIST_bookmarks_lineNumbers $idx]
set breakpoints_lineNumbers [lindex $LIST_breakpoints_lineNumbers $idx]
set bookmarks_text [lindex $LIST_bookmarks_text $idx]
set breakpoints_text [lindex $LIST_breakpoints_text $idx]
set bm_up_button [lindex $LIST_bm_up_button $idx]
set bm_down_button [lindex $LIST_bm_down_button $idx]
set bm_clear_button [lindex $LIST_bm_clear_button $idx]
set bp_up_button [lindex $LIST_bp_up_button $idx]
set bp_down_button [lindex $LIST_bp_down_button $idx]
set bp_clear_button [lindex $LIST_bp_clear_button $idx]
set sm_text [lindex $LIST_sm_text $idx]
set sm_lineNumbers [lindex $LIST_sm_lineNumbers $idx]
}
## Binding for event <Button-1> for list of ...
# Change selection in the widget and change current line in the editor
# @parm Char - what (m == Bookmarks; p == Breakpoints; s == Symbols)
# @parm Int x - relative X coordinate
# @parm Int y - relative Y coordinate
# @return Bool - result
public method rightPanel_xx_txt_click {what x y} {
if {$block_select} {return}
switch -- $what {
{m} { ;# Bookmarks
set lnb $bookmarks_lineNumbers
set txt $bookmarks_text
}
{p} { ;# Breakpoints
set lnb $breakpoints_lineNumbers
set txt $breakpoints_text
}
{s} { ;# Symbols
set lnb $sm_lineNumbers
set txt $sm_text
}
}
# Determinate line number
set lineNum [rightPanel_txt_click $txt $lnb $x $y]
if {$lineNum == {}} {return 0}
# Change current line in the editor
set block_select 1
$this editor_procedure {} goto $lineNum
update idletasks
set block_select 0
return 1
}
## Determinate line number and select the line
# @parm Widget txt_widget - ID of the text widget
# @parm Widget ln_widget - ID of line numbers widget
# @parm Int x - relative X coordinate
# @parm Int y - relative X coordinate
# @return Int - line number (from line numbers panel)
private method rightPanel_txt_click {txt_widget ln_widget x y} {
set idx [$txt_widget index @$x,$y]
# Determinate traslated line number
set lineNum [$ln_widget get [list $idx linestart] [list $idx lineend]]
# Select the line
if {$lineNum != {}} {
$txt_widget tag remove curLine 1.0 end
$txt_widget tag add curLine [list $idx linestart] [list $idx+1l linestart]
}
# Retrun result
return $lineNum
}
## If the given line contain symbol declaration then select it in the list
# This function should be called after change on the line in the editor
# @parm Int lineNum - line number
# @return Bool - result
public method rightPanel_sm_select {lineNum} {
if {!$enabled || $block_select} {return}
if {![info exists sm_text]} {return}
# Unset selection in the list
$sm_text tag remove curLine 1.0 end
# Check for bookmark presence
set idx0 [lsearch -ascii -exact [$sm_lineNumbers get 1.0 end] $lineNum]
if {$idx0 == -1} {return 0}
# Select the line
incr idx0
set idx1 $idx0
incr idx1
$sm_text tag add curLine $idx0.0 $idx1.0
$sm_text see $idx0.0
return 1
}
## If the given line contain bookmark then select it in the list
# This function should be called after change on the line in the editor
# @parm Int lineNum - line number
# @return Bool - result
public method rightPanel_bm_select {lineNum} {
if {!$enabled || $block_select} {return}
if {![info exists bookmarks_text]} {return}
# Check for bookmark presence
set idx0 [lsearch -ascii -exact [$bookmarks_lineNumbers get 1.0 end] $lineNum]
if {$idx0 == -1} {return 0}
# Select the line
incr idx0
set idx1 $idx0
incr idx1
$bookmarks_text tag remove curLine 1.0 end
$bookmarks_text tag add curLine $idx0.0 $idx1.0
$bookmarks_text see $idx0.0
return 1
}
## If the given line contain bookmark then select it in the list
# This function should be called after change on the line in the editor
# @parm Int lineNum - line number
# @return Bool - result
public method rightPanel_bp_select {lineNum} {
if {!$enabled || $block_select} {return}
if {![info exists breakpoints_text]} {return}
# Check for bookmark presence
set idx0 [lsearch -ascii -exact [$breakpoints_lineNumbers get 1.0 end] $lineNum]
if {$idx0 == -1} {return 0}
# Select the line
incr idx0
set idx1 $idx0
incr idx1
$breakpoints_text tag remove curLine 1.0 end
$breakpoints_text tag add curLine $idx0.0 $idx1.0
$breakpoints_text see $idx0.0
return 1
}
## Unset selection in list of bookmarks
# @return void
public method rightPanel_bm_unselect {} {
if {!$enabled || $block_select} {return}
if {![info exists bookmarks_text]} {return}
$bookmarks_text tag remove curLine 1.0 end
}
## Unset selection in list of breakpoints
# @return void
public method rightPanel_bp_unselect {} {
if {!$enabled || $block_select} {return}
if {![info exists breakpoints_text]} {return}
$breakpoints_text tag remove curLine 1.0 end
}
## Copy line from the editor to target widget and preserve highlight
# @parm Widget target_widget - target widget, where to copy the line
# @parm TextIndex idx - target text index
# @parm Int lineNum - source line number
# @parm Int editor_idx - editor index
# @return void
private method insert_text {target_widget idx lineNum editor_idx} {
# Copy text
set line [$this editor_procedure $editor_idx getLineContent $lineNum]
regsub -all {\t} $line { } line
append line "\n"
$target_widget insert $idx $line
# Gain list of text tags in source widget
set ranges [$this editor_procedure $editor_idx getTagsRanges $lineNum]
# Determinate row in the target widget
if {$idx == {end}} {
set row [$target_widget index end]
set row [expr {int($row) - 2}]
} else {
set row [expr {int($idx)}]
}
# Iterate over source text tags and add them to target widget
foreach range $ranges {
# Local variables
set tag [lindex $range 0] ;# Text tag
set range [lindex $range 1] ;# Tag range
set range_len [llength $range] ;# Number of indexes in tag range
# Iterate over ranges
for {set i 0} {$i < $range_len} {incr i} {
# Translate indexes
set idx0 [lindex $range $i]
regsub {^\d+} $idx0 $row idx0
incr i
set idx1 [lindex $range $i]
regsub {^\d+} $idx1 $row idx1
# Set tag
$target_widget tag add $tag $idx0 $idx1
}
}
}
## Add bookmark to the list
# @parm Int lineNum - line number in the editor
# @return void
public method rightPanel_add_bookmark {lineNum} {
if {$block_select} {return}
## Determinate target text index
set indexes [$bookmarks_lineNumbers get 1.0 end]
set idx -1
set i 0
foreach line $indexes {
incr i
if {$line > $lineNum} {
set idx $i
break
}
}
if {$idx == -1} {
set idx {end}
} else {
append idx {.0}
}
# Enable widgets
$bookmarks_lineNumbers configure -state normal
$bookmarks_text configure -state normal
# Insert new line to line numbers
$bookmarks_lineNumbers insert $idx "$lineNum\n"
adjust_width $bookmarks_lineNumbers
# Insert text to the list
insert_text $bookmarks_text $idx $lineNum {}
# Disable widgets
$bookmarks_lineNumbers configure -state disabled
$bookmarks_text configure -state disabled
# Reevaluate icon bar button states
bm_bp_disEna_buttons
}
## Remove bookmark from the list
# @parm Int lineNum - line number (in Editor)
# @return void
public method rightPanel_remove_bookmark {lineNum} {
if {$block_select} {return}
# Determinate start and end index
set idx [lsearch [$bookmarks_lineNumbers get 1.0 end] $lineNum]
if {$idx == -1} {return}
set idx0 [expr {int($idx) + 1}]
set idx1 [expr {int($idx) + 2}]
# Enable widgets
$bookmarks_lineNumbers configure -state normal
$bookmarks_text configure -state normal
# Remove line from line numbers
$bookmarks_lineNumbers delete $idx0.0 $idx1.0
adjust_width $bookmarks_lineNumbers
# Remove line from the list
$bookmarks_text delete $idx0.0 $idx1.0
# Disable widgets
$bookmarks_lineNumbers configure -state disabled
$bookmarks_text configure -state disabled
# Reevaluate icon bar button states
bm_bp_disEna_buttons
}
## Add breakpoint to the list
# @parm Int lineNum - line number in the editor
# @return void
public method rightPanel_add_breakpoint {lineNum} {
if {$block_select} {return}
## Determinate target text index
set indexes [$breakpoints_lineNumbers get 1.0 end]
set idx -1
set i 0
foreach line $indexes {
incr i
if {$line > $lineNum} {
set idx $i
break
}
}
if {$idx == -1} {
set idx {end}
} else {
append idx {.0}
}
# Enable widgets
$breakpoints_lineNumbers configure -state normal
$breakpoints_text configure -state normal
# Insert new line to line numbers
$breakpoints_lineNumbers insert $idx "$lineNum\n"
adjust_width $breakpoints_lineNumbers
# Insert text to the list
insert_text $breakpoints_text $idx $lineNum {}
# Disable widgets
$breakpoints_lineNumbers configure -state disabled
$breakpoints_text configure -state disabled
# Reevaluate icon bar button states
bm_bp_disEna_buttons
}
## Remove breakpoint from the list
# @parm Int lineNum - line number (in Editor)
# @return void
public method rightPanel_remove_breakpoint {lineNum} {
if {$block_select} {return}
# Determinate start and end index
set idx [lsearch [$breakpoints_lineNumbers get 1.0 end] $lineNum]
if {$idx == -1} {return}
set idx0 [expr {int($idx) + 1}]
set idx1 [expr {int($idx) + 2}]
# Enable widgets
$breakpoints_lineNumbers configure -state normal
$breakpoints_text configure -state normal
# Remove line from line numbers
$breakpoints_lineNumbers delete $idx0.0 $idx1.0
adjust_width $breakpoints_lineNumbers
# Remove line from the list
$breakpoints_text delete $idx0.0 $idx1.0
# Disable widgets
$breakpoints_lineNumbers configure -state disabled
$breakpoints_text configure -state disabled
# Reevaluate icon bar button states
bm_bp_disEna_buttons
}
## Adjust width of given text widget to fit lenght of the last line
# @parm Widget widget - target text widget
# @return void
private method adjust_width {widget} {
$widget configure -width [string length [lindex [$widget get end-2l end] end]]
catch {
$widget tag add right 0.0 end
}
}
## Binding for button "Up" (Bookmarks icon bar) - select bookmark above the current line
# @return void
public method rightPanel_bm_up {} {
# Gain list of bookmarks (line numbers)
set lineNumbers [$bookmarks_lineNumbers get 1.0 end]
if {[llength $lineNumbers] == 0} {return}
# Get current line in the editor
set curLineNum [$this editor_procedure {} get_current_line_number {}]
# Find nearest bookmark
set lineNum [lindex $lineNumbers end]
set idx -2
foreach line $lineNumbers {
incr idx
if {$line >= $curLineNum} {
if {$idx >= 0} {
set lineNum [lindex $lineNumbers $idx]
}
break
}
}
# Select designated bookmark and jump to its line
rightPanel_bm_select $lineNum
$this editor_procedure {} goto $lineNum
}
## Binding for button "Up" (Breakpoints icon bar) - select breakpoint above the current line
# @return void
public method rightPanel_bp_up {} {
# Gain list of breakpoints (line numbers)
set lineNumbers [$breakpoints_lineNumbers get 1.0 end]
if {[llength $lineNumbers] == 0} {return}
# Get current line in the editor
set curLineNum [$this editor_procedure {} get_current_line_number {}]
# Find nearest breakpoint
set lineNum [lindex $lineNumbers end]
set idx -2
foreach line $lineNumbers {
incr idx
if {$line >= $curLineNum} {
if {$idx >= 0} {
set lineNum [lindex $lineNumbers $idx]
}
break
}
}
# Select designated breakpoint and jump to its line
rightPanel_bp_select $lineNum
$this editor_procedure {} goto $lineNum
}
## Binding for button "Down" (Bookmarks icon bar) - select bookmark below the current line
# @return void
public method rightPanel_bm_down {} {
# Gain list of bookmarks (line numbers)
set lineNumbers [$bookmarks_lineNumbers get 1.0 end]
if {[llength $lineNumbers] == 0} {return}
# Get current line in the editor
set curLineNum [$this editor_procedure {} get_current_line_number {}]
# Find nearest bookmark
set lineNum [lindex $lineNumbers 0]
set idx -1
foreach line $lineNumbers {
incr idx
if {$line > $curLineNum} {
set lineNum [lindex $lineNumbers $idx]
break
}
}
# Select designated bookmark and jump to its line
rightPanel_bm_select $lineNum
$this editor_procedure {} goto $lineNum
}
## Binding for button "Down" (Breakpoints icon bar) - select breakpoint below the current line
# @return void
public method rightPanel_bp_down {} {
# Gain list of breakpoints (line numbers)
set lineNumbers [$breakpoints_lineNumbers get 1.0 end]
if {[llength $lineNumbers] == 0} {return}
# Get current line in the editor
set curLineNum [$this editor_procedure {} get_current_line_number {}]
# Find nearest breakpoint
set lineNum [lindex $lineNumbers 0]
set idx -1
foreach line $lineNumbers {
incr idx
if {$line > $curLineNum} {
set lineNum [lindex $lineNumbers $idx]
break
}
}
# Select designated breakpoint and jump to its line
rightPanel_bp_select $lineNum
$this editor_procedure {} goto $lineNum
}
## Remove all bookmarks from the list
# @return void
public method rightPanel_clear_all_bookmarks {} {
# Enable widgets
$bookmarks_lineNumbers configure -state normal
$bookmarks_text configure -state normal
# Clear text widgets
$bookmarks_lineNumbers delete 1.0 end
adjust_width $bookmarks_lineNumbers
$bookmarks_text delete 1.0 end
# Disable widgets
$bookmarks_lineNumbers configure -state disabled
$bookmarks_text configure -state disabled
# Reevaluate button states (icon bar)
bm_bp_disEna_buttons
}
## Remove all breapoints editor
# @return void
public method rightPanel_clear_all_breakpoints {} {
# Enable widgets
$breakpoints_lineNumbers configure -state normal
$breakpoints_text configure -state normal
# Clear text widgets
$breakpoints_lineNumbers delete 1.0 end
adjust_width $breakpoints_lineNumbers
$breakpoints_text delete 1.0 end
# Disable widgets
$breakpoints_lineNumbers configure -state disabled
$breakpoints_text configure -state disabled
# Reevaluate button states (icon bar)
bm_bp_disEna_buttons
}
## Manage list of bookmarks - some lines have been removed from editor widget
# @parm Int start_line - start of deleted area
# @parm Int end_line - end of deleted area
# @return void
public method rightPanel_remove_bookmarks {start_line end_line} {
# Gain list of bookmarks
set lineNumbers [$bookmarks_lineNumbers get 1.0 end]
## Determinate start and end text indexes (list of bookmarks)
# Start index
set start_idx {}
set idx 0
foreach line $lineNumbers {
incr idx
if {$line >= $start_line} {
set start_idx $idx.0
break
}
}
# End index
set end_idx {end}
set idx 0
foreach line $lineNumbers {
incr idx
if {$line > $end_line} {
if {$idx != 0} {
set end_idx $idx.0
}
break
}
}
# Default start index
if {$start_idx == {}} {
if {[lindex $lineNumbers end] != $end_line} {
return
} else {
set start_idx 1.0
}
}
# Determinate number of lines to remove
set diff [expr {$end_line - $start_line + 1}]
# Enable line numbers
$bookmarks_lineNumbers configure -state normal
# Gain list of lines to recomputation
set lineNumbers [$bookmarks_lineNumbers get $end_idx end]
# Remove lines from line numbers
$bookmarks_lineNumbers delete $start_idx end
if {[llength [$bookmarks_lineNumbers get 1.0 end]] != 0} {
$bookmarks_lineNumbers insert end "\n"
}
# Compute missing lines in line numbers
foreach line $lineNumbers {
$bookmarks_lineNumbers insert end [expr {$line - $diff}]
$bookmarks_lineNumbers insert end "\n"
}
# Finish adjustemnt of line numbers
adjust_width $bookmarks_lineNumbers
$bookmarks_lineNumbers configure -state disabled
# Remove lines from list of bookmarks
$bookmarks_text configure -state normal
$bookmarks_text delete $start_idx $end_idx
$bookmarks_text configure -state disabled
# Reevaluate button states (icon bar)
bm_bp_disEna_buttons
}
## Manage list of breakpoints - some lines have been removed from editor widget
# @parm Int start_line - start of deleted area
# @parm Int end_line - end of deleted area
# @return void
public method rightPanel_remove_breakpoints {start_line end_line} {
# Gain list of breakpoints
set lineNumbers [$breakpoints_lineNumbers get 1.0 end]
## Determinate start and end text indexes (list of breakpoints)
# Start index
set start_idx {}
set idx 0
foreach line $lineNumbers {
incr idx
if {$line >= $start_line} {
set start_idx $idx.0
break
}
}
# End index
set end_idx {end}
set idx 0
foreach line $lineNumbers {
incr idx
if {$line > $end_line} {
if {$idx != 0} {
set end_idx $idx.0
}
break
}
}
# Default start index
if {$start_idx == {}} {
if {[lindex $lineNumbers end] != $end_line} {
return
} else {
set start_idx 1.0
}
}
# Determinate number of lines to remove
set diff [expr {$end_line - $start_line + 1}]
# Enable line numbers
$breakpoints_lineNumbers configure -state normal
# Gain list of lines to recomputation
set lineNumbers [$breakpoints_lineNumbers get $end_idx end]
# Remove lines from line numbers
$breakpoints_lineNumbers delete $start_idx end
if {[llength [$breakpoints_lineNumbers get 1.0 end]] != 0} {
$breakpoints_lineNumbers insert end "\n"
}
# Compute missing lines in line numbers
foreach line $lineNumbers {
$breakpoints_lineNumbers insert end [expr {$line - $diff}]
$breakpoints_lineNumbers insert end "\n"
}
# Finish adjustemnt of line numbers
adjust_width $breakpoints_lineNumbers
$breakpoints_lineNumbers configure -state disabled
# Remove lines from list of breakpoints
$breakpoints_text configure -state normal
$breakpoints_text delete $start_idx $end_idx
$breakpoints_text configure -state disabled
# Reevaluate button states (icon bar)
bm_bp_disEna_buttons
}
## Clear the list of symbols
# @return void
public method rightPanel_clear_symbol_list {} {
$sm_lineNumbers configure -state normal
$sm_text configure -state normal
$sm_lineNumbers delete 0.0 end
$sm_text delete 0.0 end
adjust_width $sm_lineNumbers
$sm_lineNumbers configure -state disabled
$sm_text configure -state disabled
}
## Refresh the list of symbols
# @return void
public method rightPanel_refresh_symbols {} {
rightPanel_clear_symbol_list
$this editor_procedure {} autocompletion_turned_on {}
$this editor_procedure {} clear_autocompletion_list {}
$this editor_procedure {} comp_win_highlight_all_in_background {}
}
## Validator for search entrybox in the list of symbols
# @parm String content - A string to search for
# @parm Widget widget - Search entrybox widget
# @parm Widget clr_b - Clear button
# @return Bool - Success
public method rightPanel_sm_search_validate {content widget clr_b} {
# No recursion ...
if {$search_val_in_progress} {return 0}
set search_val_in_progress 1
# Empty string
if {![string length $content]} {
$widget configure -style TEntry
$clr_b configure -state disabled
set search_val_in_progress 0
return 1
# Not empty string
} else {
$clr_b configure -state normal
}
# Perform the search
set content [string toupper $content]
set e [expr {int([$sm_text index insert])}]
for {set i 1} {$i < $e} {incr i} {
if {![string first $content [string toupper [$sm_text get $i.2 [list $i.0 lineend]]]]} {
$widget configure -style StringFound.TEntry
$sm_text tag remove curLine 1.0 end
$sm_text tag add curLine $i.0 [list $i.0+1l linestart]
$sm_text see $i.0
set block_select 1
$this editor_procedure {} goto [$sm_lineNumbers get $i.0 [list $i.0 lineend]]
update idletasks
set block_select 0
set search_val_in_progress 0
return 1
}
}
$widget configure -style StringNotFound.TEntry
set search_val_in_progress 0
return 1
}
## Adjust list of symbols
# @parm Int lineNum - Line number
# @parm String symbol_name - Symbol name
# @parm Int symbol_type -
# 0 - Label
# 1 - Constant
# 2 - Something else
# 3 - Macro
# @parm Bool add__remove - 1 == Add; 0 == Remove
# @return void
public method rightPanel_adjust_symbol_list {lineNum symbol_name symbol_type add__remove {editor_object {}}} {
if {[$this is_splitted] && $editor_object != {}} {
set idx [lsearch -ascii -exact [$this cget -editors] $editor_object]
if {$idx != $current_editor_idx} {
rightPanel_switch_editor_vars $idx
}
}
$sm_lineNumbers configure -state normal
$sm_text configure -state normal
# Add symbol
if {$add__remove} {
set indexes [$sm_lineNumbers get 1.0 end]
set idx -1
set i 0
foreach line $indexes {
incr i
if {$line > $lineNum} {
set idx $i
break
}
}
if {$idx == -1} {
set idx [$sm_text index {end-1l}]
} else {
append idx {.0}
}
switch -- $symbol_type {
0 { ;# Label
set tag {tag_label}
set icon {symbol1}
}
1 { ;# Constant
set tag {tag_constant}
set icon {symbol3}
}
2 { ;# C variable
set tag {tag_normal}
set icon {symbol4}
}
3 { ;# Macro
set tag {tag_macro}
set icon {symbol2}
}
7 { ;# C function
set tag {tag_c_func}
set icon {symbol0}
}
default {
set tag {}
set icon {symbol5}
}
}
$sm_lineNumbers insert $idx "$lineNum\n"
if {${::Editor::defaultCharHeight} < 16} {
$sm_text insert ${idx} { }
} else {
$sm_text image create $idx -image ::ICONS::16::$icon
}
$sm_text insert ${idx}+1c " $symbol_name\n"
if {$tag != {}} {
$sm_text tag add $tag $idx [list $idx lineend]
}
# Remove symbol
} else {
if {$lineNum == {all}} {
set idx [list]
set e [expr {int([$sm_lineNumbers index end]) - 1}]
for {set i 0} {$i < $e} {incr i} {
lappend idx $i
}
} else {
set idx [lsearch -all [$sm_lineNumbers get 1.0 end] $lineNum]
}
if {$idx == {}} {
return
}
foreach i $idx {
incr i
if {[string equal [$sm_text get $i.2 [list $i.0 lineend]] $symbol_name]} {
$sm_text delete $i.0 $i.0+1l
$sm_lineNumbers delete $i.0 $i.0+1l
break
}
}
}
adjust_width $sm_lineNumbers
$sm_lineNumbers configure -state disabled
$sm_text configure -state disabled
}
## Shift list of symbols by certain number of lines
# @parm Int lineNum - Starting line
# @parm Int length - Number of lines to shift by
# @return void
public method rightPanel_shift_symbols {lineNum length} {
if {![info exists sm_lineNumbers]} {return}
# Get list of bookmarks
set lineNumbers [$sm_lineNumbers get 1.0 end]
# Deterinate start index
set start_idx {}
set idx 0
foreach line $lineNumbers {
incr idx
if {$line >= $lineNum} {
set start_idx $idx.0
break
}
}
if {$start_idx == {}} {return}
# Adjust line numbers
$sm_lineNumbers configure -state normal
set lineNumbers [$sm_lineNumbers get $start_idx end]
$sm_lineNumbers delete $start_idx end
if {[llength [$sm_lineNumbers get 1.0 end]] != 0} {
$sm_lineNumbers insert end "\n"
}
foreach line $lineNumbers {
$sm_lineNumbers insert end [expr {$line + $length}]
$sm_lineNumbers insert end "\n"
}
adjust_width $sm_lineNumbers
$sm_lineNumbers configure -state disabled
}
## Manage list of bookmarks - some lines have been added to editor widget
# @parm Int lineNum - line number
# @parm Int length - number of lines
# @return void
public method rightPanel_shift_bookmarks {lineNum length} {
if {![info exists bookmarks_lineNumbers]} {return}
# Get list of bookmarks
set lineNumbers [$bookmarks_lineNumbers get 1.0 end]
# Deterinate start index
set start_idx {}
set idx 0
foreach line $lineNumbers {
incr idx
if {$line >= $lineNum} {
set start_idx $idx.0
break
}
}
if {$start_idx == {}} {return}
# Adjust line numbers
$bookmarks_lineNumbers configure -state normal
set lineNumbers [$bookmarks_lineNumbers get $start_idx end]
$bookmarks_lineNumbers delete $start_idx end
if {[llength [$bookmarks_lineNumbers get 1.0 end]] != 0} {
$bookmarks_lineNumbers insert end "\n"
}
foreach line $lineNumbers {
$bookmarks_lineNumbers insert end [expr {$line + $length}]
$bookmarks_lineNumbers insert end "\n"
}
adjust_width $bookmarks_lineNumbers
$bookmarks_lineNumbers configure -state disabled
}
## Manage list of breakpoints - some lines have been added to editor widget
# @parm Int lineNum - line number
# @parm Int length - number of lines
# @return void
public method rightPanel_shift_breakpoints {lineNum length} {
if {![info exists bookmarks_lineNumbers]} {return}
# Get list of bookmarks
set lineNumbers [$breakpoints_lineNumbers get 1.0 end]
# Deterinate start index
set start_idx {}
set idx 0
foreach line $lineNumbers {
incr idx
if {$line >= $lineNum} {
set start_idx $idx.0
break
}
}
if {$start_idx == {}} {return}
# Adjust line numbers
$breakpoints_lineNumbers configure -state normal
set lineNumbers [$breakpoints_lineNumbers get $start_idx end]
$breakpoints_lineNumbers delete $start_idx end
if {[llength [$breakpoints_lineNumbers get 1.0 end]] != 0} {
$breakpoints_lineNumbers insert end "\n"
}
foreach line $lineNumbers {
$breakpoints_lineNumbers insert end [expr {$line + $length}]
$breakpoints_lineNumbers insert end "\n"
}
adjust_width $breakpoints_lineNumbers
$breakpoints_lineNumbers configure -state disabled
}
## Invoke right panel configuration dialog
# This function takes any list of arguments
# @return void
public method rightPanel_configure args {
::configDialogues::rightPanel::mkDialog $args
}
## Return true if this panel is in visible state
# @return Bool - result
public method isRightPanelVisible {} {return $PanelVisible}
## Get width of the panel
# @return Int - width in pixels
public method getRightPanelSize {} {
if {$PanelVisible} {
return $PanelSize
} else {
return $last_PanelSize
}
}
## Get ID of currently active page
# @return String - the ID
public method getRightPanelActivePage {} {return $active_page}
## Show/Hide this panel
# @return void
public method right_panel_show_hide {} {
# Hide the panel
if {$PanelVisible} {
$parentPane paneconfigure $notebook_frame -minsize 0
pack forget [$notebook get_nb] ;# Hide notebook
set last_PanelSize $PanelSize ;# Save current panel width
set PanelSize 60 ;# Change panel width
right_panel_redraw_pane ;# Redraw panel
# Show button bar
pack $button_bar -anchor nw
# Hide pane sash
$parentPane configure -sashwidth 0
bind $parentPane <Button> {break}
# Set panel visibility flag
set PanelVisible 0
# Show the panel
} else {
$parentPane paneconfigure $notebook_frame -minsize 295
# Hide button bar
pack forget $button_bar
# Show panel notebook
set PanelSize $last_PanelSize
right_panel_redraw_pane
$notebook raise $active_page
pack [$notebook get_nb] -expand 1 -fill both
# Show pane sash
$parentPane configure -sashwidth 2
bind $parentPane <Button> {}
# Set panel visibility flag
set PanelVisible 1
}
}
## Change panel active page
# @parm String page - ID of the page to show
# @return void
public method rightPanel_show_up {page} {
if {!$PanelVisible} right_panel_show_hide
$notebook raise $page
}
## Set active page but do not show it
# @parm String pageName - ID of the page
# @return void
public method rightPanel_set_active_page {pageName} {
switch -- $active_page {
{Symbols} {
catch {
$this editor_procedure {} comp_win_highlight_all_in_background {}
}
}
{Instruction} {
right_panel_instruction_details_set_enabled 0
}
}
set active_page $pageName
switch -- $active_page {
{Symbols} {
catch {
$this editor_procedure {} comp_win_highlight_all_in_background {}
}
}
{Instruction} {
right_panel_instruction_details_set_enabled $enabled
catch {
$this editor_procedure {} adjust_instruction_details {}
}
}
}
}
## Set panel width according to current sash position
# @return void
public method right_panel_set_size {} {
set PanelSize [lindex [$parentPane sash coord 0] 0]
set PanelSize [expr {${::WIN_GEOMETRY_width} - $PanelSize}]
}
## Redraw panel (move pane sash) acorning to current value of $PanelSize
# @return void
public method right_panel_redraw_pane {} {
if {$redraw_pane_in_progress} {
after 50 "$this right_panel_redraw_pane"
return
}
set redraw_pane_in_progress 1
update
$parentPane sash place 0 [expr {${::WIN_GEOMETRY_width} - $PanelSize}] 0
update
set redraw_pane_in_progress 0
}
## Create text tags inteded for "Instruction details"
# @parm Widget widget - tagret text widget
# @parm List definition_list - List of tags to create ({tag_name fg_color ?bold_or_italic?} ...)
# @parm Bool use_editor_font - Use font family and size from code editor
# @return void
public method right_panel_create_highlighting_tags {widget definition_list use_editor_font} {
if {$use_editor_font == 1} {
set font $fontFamily
set size $fontSize
} elseif {$use_editor_font == -1} {
set font $::DEFAULT_FIXED_FONT
set size [expr {int(-14 * $::font_size_factor)}]
} else {
set font $::DEFAULT_FIXED_FONT
set size [expr {int(-12 * $::font_size_factor)}]
}
# Iterate over tags definition
foreach tag $definition_list {
# Explicit flag "Bold or Italic"
if {[lindex $tag 2] != {}} {
# Bold font
if {[lindex $tag 2]} {
$widget tag configure [lindex $tag 0] \
-foreground [lindex $tag 1] \
-font [font create -size $size \
-family $font \
-weight {bold} \
-slant {roman}]
# Italic font
} else {
$widget tag configure [lindex $tag 0] \
-foreground [lindex $tag 1] \
-font [font create -size $size \
-family $font \
-weight {normal} \
-slant {italic}]
}
# No bold, no italic
} else {
$widget tag configure [lindex $tag 0] \
-foreground [lindex $tag 1] \
-font [font create -size $size \
-family $font \
-weight {normal} \
-slant {roman}]
}
}
}
## Enable selections in list of bookmarks and breakpoints and enbale instruction details
# @return void
public method rightPanel_enable {} {
set enabled 1
$this right_panel_watches_set_enabled $enabled
$this right_panel_instruction_details_set_enabled $enabled
}
## Disable selections in list of bookmarks and breakpoints and enbale instruction details
# @return void
public method rightPanel_disable {} {
set enabled 0
$this right_panel_watches_set_enabled $enabled
$this right_panel_instruction_details_set_enabled $enabled
}
}
# >>> File inclusion guard
}
# <<< File inclusion guard
|