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
|
// Preferences dialog box
#include "config.h"
#include "i18n.h"
#include <fx.h>
#include <fxkeys.h>
#include "icons.h"
#include "xfedefs.h"
#include "xfeutils.h"
#include "FileDialog.h"
#include "FontDialog.h"
#include "XFileExplorer.h"
#include "MessageBox.h"
#include "Keybindings.h"
#include "Preferences.h"
FXbool Theme::operator != (const Theme& t)
{
for(int i=0;i<NUM_COLORS;i++)
if(color[i] != t.color[i])
return TRUE;
return FALSE;
}
// Main window
extern FXMainWindow *mainWindow;
// Single click navigation
extern FXbool single_click;
// File tooltips
extern FXbool file_tooltips;
// Relative resizing of the panels and columns in detailed mode
extern FXbool relative_resize;
// Save window position
extern FXbool save_win_pos;
// Create hilite color from given color for gradient controls
FXColor makeHiliteColorGradient(FXColor color)
{
FXuint r, g, b;
r=FXREDVAL(color);
g=FXGREENVAL(color);
b=FXBLUEVAL(color);
r=(FXuint)(FXMIN(1.2*r,255));
g=(FXuint)(FXMIN(1.2*g,255));
b=(FXuint)(FXMIN(1.2*b,255));
return FXRGB(r,g,b);
}
// Create shadow color from given color for gradient controls
FXColor makeShadowColorGradient(FXColor color)
{
FXuint r, g, b;
r=FXREDVAL(color);
g=FXGREENVAL(color);
b=FXBLUEVAL(color);
r=(FXuint)(0.7*r);
g=(FXuint)(0.7*g);
b=(FXuint)(0.7*b);
return FXRGB(r,g,b);
}
// Map
FXDEFMAP(PreferencesBox) PreferencesMap[]=
{
FXMAPFUNC(SEL_COMMAND,PreferencesBox::ID_ACCEPT,PreferencesBox::onCmdAccept),
FXMAPFUNC(SEL_COMMAND,PreferencesBox::ID_CANCEL,PreferencesBox::onCmdCancel),
FXMAPFUNC(SEL_COMMAND,PreferencesBox::ID_BROWSE_TXTEDIT,PreferencesBox::onCmdBrowse),
FXMAPFUNC(SEL_COMMAND,PreferencesBox::ID_BROWSE_TXTVIEW,PreferencesBox::onCmdBrowse),
FXMAPFUNC(SEL_COMMAND,PreferencesBox::ID_BROWSE_IMGVIEW,PreferencesBox::onCmdBrowse),
FXMAPFUNC(SEL_COMMAND,PreferencesBox::ID_BROWSE_ARCHIVER,PreferencesBox::onCmdBrowse),
FXMAPFUNC(SEL_COMMAND,PreferencesBox::ID_BROWSE_PDFVIEW,PreferencesBox::onCmdBrowse),
FXMAPFUNC(SEL_COMMAND,PreferencesBox::ID_BROWSE_VIDEOVIEW,PreferencesBox::onCmdBrowse),
FXMAPFUNC(SEL_COMMAND,PreferencesBox::ID_BROWSE_AUDIOVIEW,PreferencesBox::onCmdBrowse),
FXMAPFUNC(SEL_COMMAND,PreferencesBox::ID_BROWSE_XTERM,PreferencesBox::onCmdBrowse),
FXMAPFUNC(SEL_COMMAND,PreferencesBox::ID_COLOR,PreferencesBox::onCmdColor),
FXMAPFUNC(SEL_COMMAND,PreferencesBox::ID_NORMALFONT,PreferencesBox::onCmdNormalFont),
FXMAPFUNC(SEL_COMMAND,PreferencesBox::ID_TEXTFONT,PreferencesBox::onCmdTextFont),
FXMAPFUNC(SEL_COMMAND,PreferencesBox::ID_THEME,PreferencesBox::onCmdTheme),
FXMAPFUNC(SEL_COMMAND,PreferencesBox::ID_BROWSE_ICON_PATH,PreferencesBox::onCmdBrowsePath),
FXMAPFUNC(SEL_COMMAND,PreferencesBox::ID_SU_CMD,PreferencesBox::onCmdSuMode),
FXMAPFUNC(SEL_COMMAND,PreferencesBox::ID_SUDO_CMD,PreferencesBox::onCmdSuMode),
FXMAPFUNC(SEL_COMMAND,PreferencesBox::ID_STANDARD_CONTROLS,PreferencesBox::onCmdControls),
FXMAPFUNC(SEL_COMMAND,PreferencesBox::ID_CLEARLOOKS_CONTROLS,PreferencesBox::onCmdControls),
FXMAPFUNC(SEL_COMMAND,PreferencesBox::ID_WHEELADJUST,PreferencesBox::onCmdWheelAdjust),
FXMAPFUNC(SEL_COMMAND,PreferencesBox::ID_CHANGE_KEYBINDINGS,PreferencesBox::onCmdChangeKeyBindings),
FXMAPFUNC(SEL_COMMAND,PreferencesBox::ID_RESTORE_KEYBINDINGS,PreferencesBox::onCmdRestoreKeyBindings),
FXMAPFUNC(SEL_UPDATE,PreferencesBox::ID_STANDARD_CONTROLS,PreferencesBox::onUpdControls),
FXMAPFUNC(SEL_UPDATE,PreferencesBox::ID_CLEARLOOKS_CONTROLS,PreferencesBox::onUpdControls),
FXMAPFUNC(SEL_UPDATE,PreferencesBox::ID_COLOR,PreferencesBox::onUpdColor),
FXMAPFUNC(SEL_UPDATE,PreferencesBox::ID_WHEELADJUST,PreferencesBox::onUpdWheelAdjust),
FXMAPFUNC(SEL_UPDATE,PreferencesBox::ID_SINGLE_CLICK_FILEOPEN,PreferencesBox::onUpdSingleClickFileopen),
FXMAPFUNC(SEL_UPDATE,PreferencesBox::ID_CONFIRM_TRASH,PreferencesBox::onUpdTrash),
FXMAPFUNC(SEL_UPDATE,PreferencesBox::ID_TRASH_BYPASS,PreferencesBox::onUpdTrash),
FXMAPFUNC(SEL_UPDATE,PreferencesBox::ID_CONFIRM_DEL_EMPTYDIR,PreferencesBox::onUpdConfirmDelEmptyDir),
FXMAPFUNC(SEL_UPDATE,PreferencesBox::ID_SU_CMD,PreferencesBox::onUpdSuMode),
FXMAPFUNC(SEL_UPDATE,PreferencesBox::ID_SUDO_CMD,PreferencesBox::onUpdSuMode),
};
// Object implementation
FXIMPLEMENT(PreferencesBox,DialogBox,PreferencesMap,ARRAYNUMBER(PreferencesMap))
// Construct window
PreferencesBox::PreferencesBox(FXWindow *win, FXColor listbackcolor, FXColor listforecolor, FXColor highlightcolor, FXColor pbarcolor, FXColor attentioncolor, FXColor scrollbarcolor): DialogBox(win,_("Preferences"), DECOR_TITLE|DECOR_BORDER)
{
currTheme.name = _("Current Theme");
currTheme.color[0] = getApp()->getBaseColor();
currTheme.color[1] = getApp()->getBorderColor();
currTheme.color[2] = getApp()->getBackColor();
currTheme.color[3] = getApp()->getForeColor();
currTheme.color[4] = getApp()->getSelbackColor();
currTheme.color[5] = getApp()->getSelforeColor();
currTheme.color[6] = listbackcolor;
currTheme.color[7] = listforecolor;
currTheme.color[8] = highlightcolor;
currTheme.color[9] = pbarcolor;
currTheme.color[10] = attentioncolor;
currTheme.color[11] = scrollbarcolor;
Themes[0] = currTheme;
Themes[1] = Theme("Clearlooks",FXRGB(237,236,235),FXRGB(0,0,0),FXRGB(255,255,255),FXRGB(0,0,0),FXRGB(139,175,220),FXRGB(255,255,255),FXRGB(255,255,255),FXRGB(0,0,0),FXRGB(238,238,238),FXRGB(121,153,192),FXRGB(255,0,0),FXRGB(149,178,215));
Themes[2] = Theme("Human",FXRGB(239,235,231),FXRGB(0,0,0),FXRGB(238,238,238),FXRGB(0,0,0),FXRGB(211,170,123),FXRGB(255,255,255),FXRGB(238,238,238),FXRGB(0,0,0),FXRGB(255,255,255),FXRGB(195,158,114),FXRGB(255,0,0),FXRGB(212,172,124));
Themes[3] = Theme("Sea Sky",FXRGB(165,178,198),FXRGB(0,0,0),FXRGB(255,255,255),FXRGB(0,0,0),FXRGB(49,101,156),FXRGB(255,255,255),FXRGB(255,255,255),FXRGB(0,0,0),FXRGB(238,238,238),FXRGB(49,101,156),FXRGB(255,0,0),FXRGB(68,106,146));
Themes[4] = Theme("Blue Slate",FXRGB(156,186,205),FXRGB(0,0,0),FXRGB(197,194,197),FXRGB(0,0,0),FXRGB(82,129,148),FXRGB(255,255,255),FXRGB(197,194,197),FXRGB(0,0,0),FXRGB(238,238,238),FXRGB(82,129,148),FXRGB(255,0,0),FXRGB(156,186,205));
Themes[5] = Theme("FOX",FXRGB(212,208,200),FXRGB(0,0,0),FXRGB(255,255,255),FXRGB(0,0,0),FXRGB(10,36,106),FXRGB(255,255,255),FXRGB(255,255,255),FXRGB(0,0,0),FXRGB(238,238,238),FXRGB(10,36,106),FXRGB(255,0,0),FXRGB(212,208,200));
Themes[6] = Theme("GNOME2",FXRGB(220,218,213),FXRGB(0,0,0),FXRGB(255,255,255),FXRGB(0,0,0),FXRGB(75,105,131),FXRGB(255,255,255),FXRGB(255,255,255),FXRGB(0,0,0),FXRGB(238,238,238),FXRGB(75,105,131),FXRGB(255,0,0),FXRGB(134,171,217));
Themes[7] = Theme("KDE3",FXRGB(238,238,230),FXRGB(0,0,0),FXRGB(255,255,255),FXRGB(0,0,0),FXRGB(255,222,118),FXRGB(0,0,0),FXRGB(255,255,255),FXRGB(0,0,0),FXRGB(238,238,238),FXRGB(255,222,118),FXRGB(255,0,0),FXRGB(238,238,230));
Themes[8] = Theme("XFCE4",FXRGB(238,238,238),FXRGB(0,0,0),FXRGB(238,238,238),FXRGB(0,0,0),FXRGB(99,119,146),FXRGB(255,255,255),FXRGB(255,255,255),FXRGB(0,0,0),FXRGB(238,238,238),FXRGB(99,119,146),FXRGB(255,0,0),FXRGB(238,238,238));
Themes[9] = Theme("CDE",FXRGB(156,153,156),FXRGB(0,0,0),FXRGB(131,129,131),FXRGB(255,255,255),FXRGB(49,97,131),FXRGB(255,255,255),FXRGB(131,129,131),FXRGB(255,255,255),FXRGB(165,162,165),FXRGB(49,97,131),FXRGB(255,0,0),FXRGB(156,153,156));
Themes[10] = Theme("iMac",FXRGB(205,206,205),FXRGB(0,0,0),FXRGB(255,255,255),FXRGB(0,0,0),FXRGB(0,0,128),FXRGB(255,255,255),FXRGB(255,255,255),FXRGB(0,0,0),FXRGB(238,238,238),FXRGB(0,0,128),FXRGB(255,0,0),FXRGB(205,206,205));
Themes[11] = Theme("Windows 95",FXRGB(192,192,192),FXRGB(0,0,0),FXRGB(255,255,255),FXRGB(0,0,0),FXRGB(0,0,128),FXRGB(255,255,255),FXRGB(255,255,255),FXRGB(0,0,0),FXRGB(238,238,238),FXRGB(0,0,128),FXRGB(255,0,0),FXRGB(192,192,192));
// Buttons
FXHorizontalFrame *buttons=new FXHorizontalFrame(this,LAYOUT_SIDE_BOTTOM|LAYOUT_FILL_X,0,0,0,0,10,10,5,5);
// Contents
FXHorizontalFrame *contents=new FXHorizontalFrame(this,LAYOUT_SIDE_TOP|FRAME_NONE|LAYOUT_FILL_X|LAYOUT_FILL_Y|PACK_UNIFORM_WIDTH);
// Accept
FXButton *ok = new FXButton(buttons,_("&Accept"),NULL,this,PreferencesBox::ID_ACCEPT,FRAME_RAISED|FRAME_THICK|LAYOUT_RIGHT|LAYOUT_CENTER_Y,0,0,0,0,20,20);
ok->addHotKey(KEY_Return);
// Cancel
new FXButton(buttons,_("&Cancel"),NULL,this,PreferencesBox::ID_CANCEL,FRAME_RAISED|FRAME_THICK|LAYOUT_RIGHT|LAYOUT_CENTER_Y,0,0,0,0,20,20);
// Switcher
FXTabBook *tabbook = new FXTabBook(contents,NULL,0,LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_RIGHT);
// First tab - General options
new FXTabItem(tabbook,_("&General"),NULL);
FXVerticalFrame *options=new FXVerticalFrame(tabbook,FRAME_RAISED);
FXGroupBox *group=new FXGroupBox(options,_("Options"),GROUPBOX_TITLE_LEFT|FRAME_GROOVE|LAYOUT_FILL_X|LAYOUT_FILL_Y);
trashcan=new FXCheckButton(group,_("Use trash can for file deletion (safe delete)"));
trashbypass=new FXCheckButton(group,_("Include a command to bypass the trash can (permanent delete)"),this,ID_TRASH_BYPASS);
autosave=new FXCheckButton(group,_("Auto save layout"));
savewinpos=new FXCheckButton(group,_("Save window position"));
diropen=new FXCheckButton(group,_("Single click folder open"));
fileopen=new FXCheckButton(group,_("Single click file open"),this,ID_SINGLE_CLICK_FILEOPEN);
filetooltips=new FXCheckButton(group,_("Display tooltips in file and folder lists"),this,ID_FILE_TOOLTIPS);
relativeresize=new FXCheckButton(group,_("Relative resizing of file lists"),this,ID_RELATIVE_RESIZE);
showpathlink=new FXCheckButton(group,_("Display a path linker above file lists"),this,ID_SHOW_PATHLINK);
#ifdef STARTUP_NOTIFICATION
usesn=new FXCheckButton(group,_("Notify when applications start up"));
#endif
FXMatrix *matrix = new FXMatrix(group,2,MATRIX_BY_COLUMNS|LAYOUT_SIDE_TOP|LAYOUT_FILL_X|LAYOUT_FILL_Y);
new FXLabel(matrix,_("Date format used in file and folder lists:\n(Type 'man strftime' in a terminal for help on the format)"),NULL,JUSTIFY_LEFT|LAYOUT_FILL_COLUMN|LAYOUT_FILL_ROW);
timeformat = new FXTextField(matrix,15,NULL,0,FRAME_THICK|FRAME_SUNKEN|LAYOUT_FILL_COLUMN|LAYOUT_FILL_ROW|LAYOUT_FILL_X);
oldtimeformat=getApp()->reg().readStringEntry("SETTINGS","time_format",DEFAULT_TIME_FORMAT);
timeformat->setText(oldtimeformat);
group=new FXGroupBox(options,_("Mouse"),GROUPBOX_TITLE_LEFT|FRAME_GROOVE|LAYOUT_FILL_X|LAYOUT_FILL_Y);
scroll=new FXCheckButton(group,_("Smooth scrolling in file lists and text windows"));
matrix = new FXMatrix(group,2,MATRIX_BY_COLUMNS|LAYOUT_SIDE_TOP|LAYOUT_FILL_Y);
new FXLabel(matrix,_("Mouse scrolling speed:"),NULL,JUSTIFY_LEFT|LAYOUT_FILL_COLUMN|LAYOUT_FILL_ROW);
FXSpinner* spinner=new FXSpinner(matrix,3,this,PreferencesBox::ID_WHEELADJUST,JUSTIFY_RIGHT|LAYOUT_FILL_X|LAYOUT_FILL_ROW,0,0,0,0, 2,2,1,1);
spinner->setRange(1,100);
FXbool smoothscroll=getApp()->reg().readUnsignedEntry("SETTINGS","smooth_scroll",TRUE);
scroll->setCheck(smoothscroll);
group=new FXGroupBox(options,_("Root mode"),GROUPBOX_TITLE_LEFT|FRAME_GROOVE|LAYOUT_FILL_X|LAYOUT_FILL_Y);
rootmode=new FXCheckButton(group,_("Allow root mode"));
FXRadioButton* subutton=new FXRadioButton(group,_("Authentication using su (uses root password)"),this,ID_SU_CMD);
FXRadioButton* sudobutton=new FXRadioButton(group,_("Authentication using sudo (uses user password)"),this,ID_SUDO_CMD);
FXbool root_mode=getApp()->reg().readUnsignedEntry("OPTIONS","root_mode",TRUE);
rootmode->setCheck(root_mode);
if (getuid()==0) // Super user
{
rootmode->disable();
subutton->disable();
sudobutton->disable();
}
use_sudo=getApp()->reg().readUnsignedEntry("OPTIONS","use_sudo",FALSE);
FXbool use_trash_can=getApp()->reg().readUnsignedEntry("OPTIONS","use_trash_can",TRUE);
trashcan->setCheck(use_trash_can);
if (trashcan->getCheck())
{
FXbool use_trash_bypass=getApp()->reg().readUnsignedEntry("OPTIONS","use_trash_bypass",FALSE);
trashbypass->setCheck(use_trash_bypass);
}
else
trashbypass->disable();
FXbool auto_save_layout=getApp()->reg().readUnsignedEntry("OPTIONS","auto_save_layout",TRUE);
autosave->setCheck(auto_save_layout);
FXbool save_win_pos=getApp()->reg().readUnsignedEntry("SETTINGS","save_win_pos",FALSE);
savewinpos->setCheck(save_win_pos);
// Single click navigation
single_click=getApp()->reg().readUnsignedEntry("SETTINGS","single_click",SINGLE_CLICK_NONE);
single_click=getApp()->reg().readUnsignedEntry("SETTINGS","single_click",SINGLE_CLICK_NONE);
if (single_click==SINGLE_CLICK_DIR)
{
diropen->setCheck(TRUE);
fileopen->setCheck(FALSE);
}
else if (single_click==SINGLE_CLICK_DIR_FILE)
{
diropen->setCheck(TRUE);
fileopen->setCheck(TRUE);
}
else
{
diropen->setCheck(FALSE);
fileopen->setCheck(FALSE);
}
// File tooltips
if (file_tooltips==FALSE)
filetooltips->setCheck(FALSE);
else
filetooltips->setCheck(TRUE);
// Relative resizing
if (relative_resize==FALSE)
relativeresize->setCheck(FALSE);
else
relativeresize->setCheck(TRUE);
// Display path linker
show_pathlink=getApp()->reg().readUnsignedEntry("SETTINGS","show_pathlinker",TRUE);
if (show_pathlink==FALSE)
showpathlink->setCheck(FALSE);
else
showpathlink->setCheck(TRUE);
#ifdef STARTUP_NOTIFICATION
FXbool use_sn=getApp()->reg().readUnsignedEntry("OPTIONS","use_startup_notification",TRUE);
usesn->setCheck(use_sn);
#endif
// Second tab - Dialogs
new FXTabItem(tabbook,_("&Dialogs"),NULL);
FXVerticalFrame *dialogs=new FXVerticalFrame(tabbook,FRAME_RAISED);
group=new FXGroupBox(dialogs,_("Confirmations"),GROUPBOX_TITLE_LEFT|FRAME_GROOVE|LAYOUT_FILL_X|LAYOUT_FILL_Y);
ask=new FXCheckButton(group,_("Confirm copy/move/rename/symlink"));
dnd=new FXCheckButton(group,_("Confirm drag and drop"));
trashmv=new FXCheckButton(group,_("Confirm move to trash/restore from trash"),this,ID_CONFIRM_TRASH);
del=new FXCheckButton(group,_("Confirm delete"));
del_emptydir=new FXCheckButton(group,_("Confirm delete non empty folders"),this,ID_CONFIRM_DEL_EMPTYDIR);
overwrite=new FXCheckButton(group,_("Confirm overwrite"));
exec=new FXCheckButton(group,_("Confirm execute text files"));
group=new FXGroupBox(dialogs,_("Warnings"),GROUPBOX_TITLE_LEFT|FRAME_GROOVE|LAYOUT_FILL_X|LAYOUT_FILL_Y);
folder_warning=new FXCheckButton (group,_("Warn when setting current folder in search window"));
#if defined(linux)
mount=new FXCheckButton (group,_("Warn when mount points are not responding"));
show_mount=new FXCheckButton(group, _("Display mount/umount success messages"));
#endif
preserve_date_warning = new FXCheckButton (group,_("Warn when date preservation failed"));
root_warning=new FXCheckButton (group,_("Warn if running as root"));
FXbool confirm_trash=getApp()->reg().readUnsignedEntry("OPTIONS","confirm_trash",TRUE);
trashmv->setCheck(confirm_trash);
FXbool confirm_del=getApp()->reg().readUnsignedEntry("OPTIONS","confirm_delete",TRUE);
del->setCheck(confirm_del);
FXbool confirm_del_emptydir=getApp()->reg().readUnsignedEntry("OPTIONS","confirm_delete_emptydir",TRUE);
del_emptydir->setCheck(confirm_del_emptydir);
FXbool confirm_overwrite=getApp()->reg().readUnsignedEntry("OPTIONS","confirm_overwrite",TRUE);
overwrite->setCheck(confirm_overwrite);
FXbool confirm_exec=getApp()->reg().readUnsignedEntry("OPTIONS","confirm_execute",TRUE);
exec->setCheck(confirm_exec);
FXbool ask_before_copy=getApp()->reg().readUnsignedEntry("OPTIONS","ask_before_copy",TRUE);
ask->setCheck(ask_before_copy);
FXbool confirm_dnd=getApp()->reg().readUnsignedEntry("OPTIONS","confirm_drag_and_drop",TRUE);
dnd->setCheck(confirm_dnd);
#if defined(linux)
FXbool mount_warn=getApp()->reg().readUnsignedEntry("OPTIONS","mount_warn",FALSE);
FXbool mount_messages=getApp()->reg().readUnsignedEntry("OPTIONS","mount_messages",TRUE);
mount->setCheck(mount_warn);
show_mount->setCheck(mount_messages);
#endif
FXbool folder_warn=getApp()->reg().readUnsignedEntry("OPTIONS","folderwarn",TRUE);
folder_warning->setCheck(folder_warn);
FXbool preserve_date_warn=getApp()->reg().readUnsignedEntry("OPTIONS","preserve_date_warn",TRUE);
preserve_date_warning->setCheck(preserve_date_warn);
FXbool root_warn=getApp()->reg().readUnsignedEntry("OPTIONS","root_warn",TRUE);
if(getuid()) // Simple user
root_warning->disable();
else
root_warning->setCheck(root_warn);
// Third tab - Programs
new FXTabItem(tabbook,_("&Programs"),NULL);
FXVerticalFrame *programs=new FXVerticalFrame(tabbook,FRAME_RAISED);
group=new FXGroupBox(programs,_("Default programs"),GROUPBOX_TITLE_LEFT|FRAME_GROOVE|LAYOUT_FILL_X|LAYOUT_FILL_Y);
matrix = new FXMatrix(group,3,MATRIX_BY_COLUMNS|LAYOUT_SIDE_TOP|LAYOUT_FILL_X|LAYOUT_FILL_Y);
new FXLabel(matrix,_("Text editor:"),NULL,JUSTIFY_LEFT|LAYOUT_FILL_COLUMN|LAYOUT_FILL_ROW);
txteditor = new FXTextField(matrix,30,NULL,0,FRAME_THICK|FRAME_SUNKEN|LAYOUT_FILL_COLUMN|LAYOUT_FILL_ROW|LAYOUT_FILL_X);
new FXButton(matrix,_("\tSelect file..."),filedialogicon,this,ID_BROWSE_TXTEDIT,FRAME_RAISED|FRAME_THICK|LAYOUT_RIGHT|LAYOUT_CENTER_Y,0,0,0,0,20,20);
oldtxteditor=getApp()->reg().readStringEntry("PROGS","txteditor",DEFAULT_TXTEDITOR);
txteditor->setText(oldtxteditor);
new FXLabel(matrix,_("Text viewer:"),NULL,JUSTIFY_LEFT|LAYOUT_FILL_COLUMN|LAYOUT_FILL_ROW);
txtviewer = new FXTextField(matrix,30,NULL,0,FRAME_THICK|FRAME_SUNKEN|LAYOUT_FILL_COLUMN|LAYOUT_FILL_ROW|LAYOUT_FILL_X);
new FXButton(matrix,_("\tSelect file..."),filedialogicon,this,ID_BROWSE_TXTVIEW,FRAME_RAISED|FRAME_THICK|LAYOUT_RIGHT|LAYOUT_CENTER_Y,0,0,0,0,20,20);
oldtxtviewer=getApp()->reg().readStringEntry("PROGS","txtviewer",DEFAULT_TXTVIEWER);
txtviewer->setText(oldtxtviewer);
new FXLabel(matrix,_("Image editor:"),NULL,JUSTIFY_LEFT|LAYOUT_FILL_COLUMN|LAYOUT_FILL_ROW);
imgeditor = new FXTextField(matrix,30,NULL,0,FRAME_THICK|FRAME_SUNKEN|LAYOUT_FILL_COLUMN|LAYOUT_FILL_ROW|LAYOUT_FILL_X);
new FXButton(matrix,_("\tSelect file..."),filedialogicon,this,ID_BROWSE_IMGVIEW,FRAME_RAISED|FRAME_THICK|LAYOUT_RIGHT|LAYOUT_CENTER_Y,0,0,0,0,20,20);
oldimgeditor=getApp()->reg().readStringEntry("PROGS","imgeditor",DEFAULT_IMGEDITOR);
imgeditor->setText(oldimgeditor);
new FXLabel(matrix,_("Image viewer:"),NULL,JUSTIFY_LEFT|LAYOUT_FILL_COLUMN|LAYOUT_FILL_ROW);
imgviewer = new FXTextField(matrix,30,NULL,0,FRAME_THICK|FRAME_SUNKEN|LAYOUT_FILL_COLUMN|LAYOUT_FILL_ROW|LAYOUT_FILL_X);
new FXButton(matrix,_("\tSelect file..."),filedialogicon,this,ID_BROWSE_IMGVIEW,FRAME_RAISED|FRAME_THICK|LAYOUT_RIGHT|LAYOUT_CENTER_Y,0,0,0,0,20,20);
oldimgviewer=getApp()->reg().readStringEntry("PROGS","imgviewer",DEFAULT_IMGVIEWER);
imgviewer->setText(oldimgviewer);
new FXLabel(matrix,_("Archiver:"),NULL,JUSTIFY_LEFT|LAYOUT_FILL_COLUMN|LAYOUT_FILL_ROW);
archiver = new FXTextField(matrix,30,NULL,0,FRAME_THICK|FRAME_SUNKEN|LAYOUT_FILL_COLUMN|LAYOUT_FILL_ROW|LAYOUT_FILL_X);
new FXButton(matrix,_("\tSelect file..."),filedialogicon,this,ID_BROWSE_ARCHIVER,FRAME_RAISED|FRAME_THICK|LAYOUT_RIGHT|LAYOUT_CENTER_Y,0,0,0,0,20,20);
oldarchiver=getApp()->reg().readStringEntry("PROGS","archiver",DEFAULT_ARCHIVER);
archiver->setText(oldarchiver);
new FXLabel(matrix,_("Pdf viewer:"),NULL,JUSTIFY_LEFT|LAYOUT_FILL_COLUMN|LAYOUT_FILL_ROW);
pdfviewer = new FXTextField(matrix,30,NULL,0,FRAME_THICK|FRAME_SUNKEN|LAYOUT_FILL_COLUMN|LAYOUT_FILL_ROW|LAYOUT_FILL_X);
new FXButton(matrix,_("\tSelect file..."),filedialogicon,this,ID_BROWSE_PDFVIEW,FRAME_RAISED|FRAME_THICK|LAYOUT_RIGHT|LAYOUT_CENTER_Y,0,0,0,0,20,20);
oldpdfviewer=getApp()->reg().readStringEntry("PROGS","pdfviewer",DEFAULT_PDFVIEWER);
pdfviewer->setText(oldpdfviewer);
new FXLabel(matrix,_("Audio player:"),NULL,JUSTIFY_LEFT|LAYOUT_FILL_COLUMN|LAYOUT_FILL_ROW);
audioviewer = new FXTextField(matrix,30,NULL,0,FRAME_THICK|FRAME_SUNKEN|LAYOUT_FILL_COLUMN|LAYOUT_FILL_ROW|LAYOUT_FILL_X);
new FXButton(matrix,_("\tSelect file..."),filedialogicon,this,ID_BROWSE_AUDIOVIEW,FRAME_RAISED|FRAME_THICK|LAYOUT_RIGHT|LAYOUT_CENTER_Y,0,0,0,0,20,20);
oldaudioviewer=getApp()->reg().readStringEntry("PROGS","audioviewer",DEFAULT_AUDIOVIEWER);
audioviewer->setText(oldaudioviewer);
new FXLabel(matrix,_("Video player:"),NULL,JUSTIFY_LEFT|LAYOUT_FILL_COLUMN|LAYOUT_FILL_ROW);
videoviewer = new FXTextField(matrix,30,NULL,0,FRAME_THICK|FRAME_SUNKEN|LAYOUT_FILL_COLUMN|LAYOUT_FILL_ROW|LAYOUT_FILL_X);
new FXButton(matrix,_("\tSelect file..."),filedialogicon,this,ID_BROWSE_VIDEOVIEW,FRAME_RAISED|FRAME_THICK|LAYOUT_RIGHT|LAYOUT_CENTER_Y,0,0,0,0,20,20);
oldvideoviewer=getApp()->reg().readStringEntry("PROGS","videoviewer",DEFAULT_VIDEOVIEWER);
videoviewer->setText(oldvideoviewer);
new FXLabel(matrix,_("Terminal:"),NULL,JUSTIFY_LEFT|LAYOUT_FILL_COLUMN|LAYOUT_FILL_ROW);
xterm = new FXTextField(matrix,30,NULL,0,FRAME_THICK|FRAME_SUNKEN|LAYOUT_FILL_COLUMN|LAYOUT_FILL_ROW|LAYOUT_FILL_X);
new FXButton(matrix,_("\tSelect file..."),filedialogicon,this,ID_BROWSE_XTERM,FRAME_RAISED|FRAME_THICK|LAYOUT_RIGHT|LAYOUT_CENTER_Y,0,0,0,0,20,20);
oldxterm=getApp()->reg().readStringEntry("PROGS","xterm",DEFAULT_TERMINAL);
xterm->setText(oldxterm);
// Fourth tab - Visual
new FXTabItem(tabbook,_("&Themes"),NULL);
FXVerticalFrame *visual=new FXVerticalFrame(tabbook,FRAME_RAISED);
FXGroupBox *themes=new FXGroupBox(visual,_("Color theme"),GROUPBOX_TITLE_LEFT|FRAME_GROOVE|LAYOUT_FILL_X|LAYOUT_FILL_Y);
FXPacker *pack = new FXPacker(themes,FRAME_THICK|FRAME_SUNKEN|LAYOUT_FILL_Y|LAYOUT_FILL_X,0,0,0,0, 0,0,0,0);
themesList = new FXList(pack,this,ID_THEME,LIST_BROWSESELECT|FRAME_SUNKEN|FRAME_THICK|LAYOUT_FILL_X|LAYOUT_FILL_Y);
themesList->setNumVisible(7);
for(int i=0;i<NUM_THEMES;i++)
themesList->appendItem(Themes[i].name);
themesList->setCurrentItem(0);
FXGroupBox *colors=new FXGroupBox(visual,_("Custom colors"),GROUPBOX_TITLE_LEFT|FRAME_GROOVE|LAYOUT_FILL_X);
FXMatrix *matrix3 = new FXMatrix(colors,2,MATRIX_BY_COLUMNS|LAYOUT_SIDE_TOP|LAYOUT_FILL_X|LAYOUT_FILL_Y);
colorsBox = new FXComboBox(matrix3,NUM_COLORS,NULL,0,COMBOBOX_STATIC|LAYOUT_FILL_X|LAYOUT_SIDE_RIGHT|LAYOUT_CENTER_Y);
colorsBox->setNumVisible(NUM_COLORS);
cwell=new FXColorWell(matrix3,FXRGB(0,0,0),this,ID_COLOR,LAYOUT_FILL_X|LAYOUT_FILL_COLUMN|LAYOUT_FILL_Y,0,0,0,0, 10,10,0,0);
cwell->setTipText(_("Double click to customize the color"));
colorsBox->appendItem(_("Base color"));
colorsBox->appendItem(_("Border color"));
colorsBox->appendItem(_("Background color"));
colorsBox->appendItem(_("Text color"));
colorsBox->appendItem(_("Selection background color"));
colorsBox->appendItem(_("Selection text color"));
colorsBox->appendItem(_("File list background color"));
colorsBox->appendItem(_("File list text color"));
colorsBox->appendItem(_("File list highlight color"));
colorsBox->appendItem(_("Progress bar color"));
colorsBox->appendItem(_("Attention color"));
colorsBox->appendItem(_("Scrollbar color"));
colorsBox->setCurrentItem(0);
// Controls theme
FXGroupBox *button=new FXGroupBox(visual,_("Controls"),GROUPBOX_TITLE_LEFT|FRAME_GROOVE|LAYOUT_FILL_X|LAYOUT_FILL_Y);
use_clearlooks=getApp()->reg().readUnsignedEntry("SETTINGS","use_clearlooks",TRUE);
new FXRadioButton(button,_("Standard (classic controls)"),this,ID_STANDARD_CONTROLS);
new FXRadioButton(button,_("Clearlooks (modern looking controls)"),this,ID_CLEARLOOKS_CONTROLS);
// Find iconpath from the Xfe registry settings or set it to DEFAULTICONPATH
FXGroupBox *group2=new FXGroupBox(visual,_("Icon theme path"),GROUPBOX_TITLE_LEFT|FRAME_GROOVE|LAYOUT_FILL_X);
FXMatrix *matrix2 = new FXMatrix(group2,2,MATRIX_BY_COLUMNS|LAYOUT_SIDE_TOP|LAYOUT_FILL_X|LAYOUT_FILL_Y);
iconpath = new FXTextField(matrix2,40,NULL,0,FRAME_THICK|FRAME_SUNKEN|LAYOUT_FILL_COLUMN|LAYOUT_FILL_ROW|LAYOUT_FILL_X);
new FXButton(matrix2,_("\tSelect path..."),filedialogicon,this,ID_BROWSE_ICON_PATH,FRAME_RAISED|FRAME_THICK|LAYOUT_RIGHT|LAYOUT_CENTER_Y,0,0,0,0,20,20);
oldiconpath=getApp()->reg().readStringEntry("SETTINGS","iconpath",DEFAULTICONPATH);
iconpath->setText(oldiconpath);
// Fifth tab - Fonts
new FXTabItem(tabbook,_("&Fonts"),NULL);
FXVerticalFrame *fonts=new FXVerticalFrame(tabbook,FRAME_RAISED);
FXGroupBox *fgroup=new FXGroupBox(fonts,_("Fonts"),GROUPBOX_TITLE_LEFT|FRAME_GROOVE|LAYOUT_FILL_X|LAYOUT_FILL_Y);
FXMatrix *fmatrix = new FXMatrix(fgroup,3,MATRIX_BY_COLUMNS|LAYOUT_SIDE_TOP|LAYOUT_FILL_X|LAYOUT_FILL_Y);
new FXLabel(fmatrix,_("Normal font:"),NULL,JUSTIFY_LEFT|LAYOUT_FILL_COLUMN|LAYOUT_FILL_ROW);
normalfont = new FXTextField(fmatrix,30,NULL,0,FRAME_THICK|FRAME_SUNKEN|LAYOUT_FILL_COLUMN|LAYOUT_FILL_ROW|LAYOUT_FILL_X);
new FXButton(fmatrix,_(" Select..."),NULL,this,ID_NORMALFONT,FRAME_RAISED|FRAME_THICK|LAYOUT_RIGHT|LAYOUT_CENTER_Y);//,0,0,0,0,20,20);
oldnormalfont=getApp()->reg().readStringEntry("SETTINGS","font","Helvetica,100,normal,regular");
normalfont->setText(oldnormalfont);
new FXLabel(fmatrix,_("Text font:"),NULL,JUSTIFY_LEFT|LAYOUT_FILL_COLUMN|LAYOUT_FILL_ROW);
textfont = new FXTextField(fmatrix,30,NULL,0,FRAME_THICK|FRAME_SUNKEN|LAYOUT_FILL_COLUMN|LAYOUT_FILL_ROW|LAYOUT_FILL_X);
new FXButton(fmatrix,_(" Select..."),NULL,this,ID_TEXTFONT,FRAME_RAISED|FRAME_THICK|LAYOUT_RIGHT|LAYOUT_CENTER_Y);//0,0,0,0,20,20);
oldtextfont=getApp()->reg().readStringEntry("SETTINGS","textfont","Helvetica,100,normal,regular");
textfont->setText(oldtextfont);
// Sixth tab - Key bindings
new FXTabItem(tabbook,_("&Key Bindings"),NULL);
FXVerticalFrame *keybindings=new FXVerticalFrame(tabbook,FRAME_RAISED);
FXGroupBox *kbgroup=new FXGroupBox(keybindings,_("Key Bindings"),GROUPBOX_TITLE_LEFT|FRAME_GROOVE|LAYOUT_FILL_X|LAYOUT_FILL_Y);
FXPacker *kbpack = new FXPacker(kbgroup,LAYOUT_FILL_X);
new FXButton(kbpack,_("Modify key bindings..."),minikeybindingsicon,this,ID_CHANGE_KEYBINDINGS,FRAME_RAISED|FRAME_THICK|ICON_BEFORE_TEXT|LAYOUT_SIDE_TOP|LAYOUT_FILL_X);//,0,0,0,0,20,20);
new FXButton(kbpack,_("Restore default key bindings..."),reloadicon,this,ID_RESTORE_KEYBINDINGS,FRAME_RAISED|FRAME_THICK|ICON_BEFORE_TEXT|LAYOUT_SIDE_TOP|LAYOUT_FILL_X);//,0,0,0,0,20,20);
// Initializations
bindingsbox=NULL;
glbBindingsDict=NULL;
xfeBindingsDict=NULL;
xfiBindingsDict=NULL;
xfwBindingsDict=NULL;
}
long PreferencesBox::onUpdColor(FXObject* o,FXSelector s,void* p)
{
FXColorWell *cwell = (FXColorWell*)o;
int i = colorsBox->getCurrentItem();
cwell->setRGBA(currTheme.color[i]);
return 1;
}
long PreferencesBox::onCmdColor(FXObject* o,FXSelector s,void* p)
{
FXColorWell *cwell = (FXColorWell*)o;
int i = colorsBox->getCurrentItem();
currTheme.color[i] = cwell->getRGBA();
return 1;
}
long PreferencesBox::onCmdTheme(FXObject* o,FXSelector s,void* p)
{
currTheme = Themes[themesList->getCurrentItem()];
return 1;
}
long PreferencesBox::onCmdBrowsePath(FXObject* o,FXSelector s,void* p)
{
FileDialog browse(this,_("Select an icon theme folder or an icon file"));
browse.setSelectMode(SELECT_FILE_MIXED);
browse.setDirectory(iconpath->getText());
if(browse.execute())
{
FXString path=browse.getFilename();
if (::isFile(path))
iconpath->setText(FXPath::directory(path).text());
else
iconpath->setText(path);
}
return 1;
}
long PreferencesBox::onCmdBrowse(FXObject* o,FXSelector s,void* p)
{
FileDialog browse(this,_("Select an executable file"));
const char *patterns[]=
{
_("All files"), "*",NULL
};
browse.setFilename(ROOTDIR);
browse.setPatternList(patterns);
browse.setSelectMode(SELECT_FILE_EXISTING);
if(browse.execute())
{
FXString path=browse.getFilename();
switch(FXSELID(s))
{
case ID_BROWSE_TXTEDIT:
txteditor->setText(FXPath::name(path));
break;
case ID_BROWSE_TXTVIEW:
txtviewer->setText(FXPath::name(path));
break;
case ID_BROWSE_IMGVIEW:
imgviewer->setText(FXPath::name(path));
break;
case ID_BROWSE_ARCHIVER:
archiver->setText(FXPath::name(path));
break;
case ID_BROWSE_PDFVIEW:
pdfviewer->setText(FXPath::name(path));
break;
case ID_BROWSE_AUDIOVIEW:
audioviewer->setText(FXPath::name(path));
break;
case ID_BROWSE_VIDEOVIEW:
videoviewer->setText(FXPath::name(path));
break;
case ID_BROWSE_XTERM:
xterm->setText(FXPath::name(path));
break;
}
}
return 1;
}
// Change normal font
long PreferencesBox::onCmdNormalFont(FXObject*,FXSelector,void*)
{
FontDialog fontdlg(this,_("Change Normal Font"),DECOR_BORDER|DECOR_TITLE);
FXFontDesc fontdesc;
FXString fontspec;
fontspec=getApp()->reg().readStringEntry("SETTINGS","font","Helvetica,100,normal,regular");
FXFont* nfont=new FXFont(getApp(),fontspec);
nfont->create();
nfont->getFontDesc(fontdesc);
fontdlg.setFontSelection(fontdesc);
if(fontdlg.execute())
{
fontdlg.getFontSelection(fontdesc);
nfont->setFontDesc(fontdesc);
fontspec=nfont->getFont();
normalfont->setText(fontspec);
}
return 1;
}
// Change text font
long PreferencesBox::onCmdTextFont(FXObject*,FXSelector,void*)
{
FontDialog fontdlg(this,_("Change Text Font"),DECOR_BORDER|DECOR_TITLE);
FXFontDesc fontdesc;
FXString fontspec;
fontspec=getApp()->reg().readStringEntry("SETTINGS","textfont","Helvetica,100,normal,regular");
FXFont* tfont=new FXFont(getApp(),fontspec);
tfont->create();
tfont->getFontDesc(fontdesc);
fontdlg.setFontSelection(fontdesc);
if(fontdlg.execute())
{
fontdlg.getFontSelection(fontdesc);
tfont->setFontDesc(fontdesc);
fontspec=tfont->getFont();
textfont->setText(fontspec);
}
return 1;
}
// Change key bindings
long PreferencesBox::onCmdChangeKeyBindings(FXObject*,FXSelector,void*)
{
FXString key, str;
// String dictionary used to store global key bindings
if (glbBindingsDict==NULL)
glbBindingsDict=new FXStringDict();
key=getApp()->reg().readStringEntry("KEYBINDINGS","go_back","Ctrl-Backspace");
str=_("Go to previous folder")+TAB+key;
glbBindingsDict->insert("go_back",str.text());
key=getApp()->reg().readStringEntry("KEYBINDINGS","go_forward","Shift-Backspace");
str=_("Go to next folder")+TAB+key;
glbBindingsDict->insert("go_forward",str.text());
key=getApp()->reg().readStringEntry("KEYBINDINGS","go_up","Backspace");
str=_("Go to parent folder")+TAB+key;
glbBindingsDict->insert("go_up",str.text());
key=getApp()->reg().readStringEntry("KEYBINDINGS","go_home","Ctrl-H");
str=_("Go to home folder")+TAB+key;
glbBindingsDict->insert("go_home",str.text());
key=getApp()->reg().readStringEntry("KEYBINDINGS","new_file","Ctrl-N");
str=_("Create new file")+TAB+key;
glbBindingsDict->insert("new_file",str.text());
key=getApp()->reg().readStringEntry("KEYBINDINGS","new_folder","F7");
str=_("Create new folder")+TAB+key;
glbBindingsDict->insert("new_folder",str.text());
key=getApp()->reg().readStringEntry("KEYBINDINGS","copy","Ctrl-C");
str=_("Copy to clipboard")+TAB+key;
glbBindingsDict->insert("copy",str.text());
key=getApp()->reg().readStringEntry("KEYBINDINGS","cut","Ctrl-X");
str=_("Cut to clipboard")+TAB+key;
glbBindingsDict->insert("cut",str.text());
key=getApp()->reg().readStringEntry("KEYBINDINGS","paste","Ctrl-V");
str=_("Paste from clipboard")+TAB+key;
glbBindingsDict->insert("paste",str.text());
key=getApp()->reg().readStringEntry("KEYBINDINGS","big_icons","F10");
str=_("Big icon list")+TAB+key;
glbBindingsDict->insert("big_icons",str.text());
key=getApp()->reg().readStringEntry("KEYBINDINGS","small_icons","F11");
str=_("Small icon list")+TAB+key;
glbBindingsDict->insert("small_icons",str.text());
key=getApp()->reg().readStringEntry("KEYBINDINGS","detailed_file_list","F12");
str=_("Detailed file list")+TAB+key;
glbBindingsDict->insert("detailed_file_list",str.text());
key=getApp()->reg().readStringEntry("KEYBINDINGS","open","Ctrl-O");
str=_("Open file")+TAB+key;
glbBindingsDict->insert("open",str.text());
key=getApp()->reg().readStringEntry("KEYBINDINGS","quit","Ctrl-Q");
str=_("Quit application")+TAB+key;
glbBindingsDict->insert("quit",str.text());
key=getApp()->reg().readStringEntry("KEYBINDINGS","select_all","Ctrl-A");
str=_("Select all")+TAB+key;
glbBindingsDict->insert("select_all",str.text());
key=getApp()->reg().readStringEntry("KEYBINDINGS","deselect_all","Ctrl-Z");
str=_("Deselect all")+TAB+key;
glbBindingsDict->insert("deselect_all",str.text());
key=getApp()->reg().readStringEntry("KEYBINDINGS","invert_selection","Ctrl-I");
str=_("Invert selection")+TAB+key;
glbBindingsDict->insert("invert_selection",str.text());
key=getApp()->reg().readStringEntry("KEYBINDINGS","help","F1");
str=_("Display help")+TAB+key;
glbBindingsDict->insert("help",str.text());
key=getApp()->reg().readStringEntry("KEYBINDINGS","hidden_files","Ctrl-F6");
str=_("Toggle display hidden files")+TAB+key;
glbBindingsDict->insert("hidden_files",str.text());
key=getApp()->reg().readStringEntry("KEYBINDINGS","thumbnails","Ctrl-F7");
str=_("Toggle display thumbnails")+TAB+key;
glbBindingsDict->insert("thumbnails",str.text());
key=getApp()->reg().readStringEntry("KEYBINDINGS","go_work","Shift-F2");
str=_("Go to working folder")+TAB+key;
glbBindingsDict->insert("go_work",str.text());
key=getApp()->reg().readStringEntry("KEYBINDINGS","close","Ctrl-W");
str=_("Close window")+TAB+key;
glbBindingsDict->insert("close",str.text());
key=getApp()->reg().readStringEntry("KEYBINDINGS","print","Ctrl-P");
str=_("Print file")+TAB+key;
glbBindingsDict->insert("print",str.text());
key=getApp()->reg().readStringEntry("KEYBINDINGS","search","Ctrl-F");
str=_("Search")+TAB+key;
glbBindingsDict->insert("search",str.text());
key=getApp()->reg().readStringEntry("KEYBINDINGS","search_prev","Shift-Ctrl-G");
str=_("Search previous")+TAB+key;
glbBindingsDict->insert("search_prev",str.text());
key=getApp()->reg().readStringEntry("KEYBINDINGS","search_next","Ctrl-G");
str=_("Search next")+TAB+key;
glbBindingsDict->insert("search_next",str.text());
// Key bindings specific to X File Explorer (Xfe)
if (xfeBindingsDict==NULL)
xfeBindingsDict=new FXStringDict();
key=getApp()->reg().readStringEntry("KEYBINDINGS","refresh","Ctrl-R");
str=_("Refresh panels")+TAB+key;
xfeBindingsDict->insert("refresh",str.text());
key=getApp()->reg().readStringEntry("KEYBINDINGS","new_symlink","Ctrl-J");
str=_("Create new symbolic link")+TAB+key;
xfeBindingsDict->insert("new_symlink",str.text());
key=getApp()->reg().readStringEntry("KEYBINDINGS","properties","F9");
str=_("File properties")+TAB+key;
xfeBindingsDict->insert("properties",str.text());
key=getApp()->reg().readStringEntry("KEYBINDINGS","move_to_trash","Del");
str=_("Move files to trash")+TAB+key;
xfeBindingsDict->insert("move_to_trash",str.text());
key=getApp()->reg().readStringEntry("KEYBINDINGS","restore_from_trash","Alt-Del");
str=_("Restore files from trash")+TAB+key;
xfeBindingsDict->insert("restore_from_trash",str.text());
key=getApp()->reg().readStringEntry("KEYBINDINGS","delete","Shift-Del");
str=_("Delete files")+TAB+key;
xfeBindingsDict->insert("delete",str.text());
key=getApp()->reg().readStringEntry("KEYBINDINGS","new_window","F3");
str=_("Create new window")+TAB+key;
xfeBindingsDict->insert("new_window",str.text());
key=getApp()->reg().readStringEntry("KEYBINDINGS","new_root_window","Shift-F3");
str=_("Create new root window")+TAB+key;
xfeBindingsDict->insert("new_root_window",str.text());
key=getApp()->reg().readStringEntry("KEYBINDINGS","execute_command","Ctrl-E");
str=_("Execute command")+TAB+key;
xfeBindingsDict->insert("execute_command",str.text());
key=getApp()->reg().readStringEntry("KEYBINDINGS","terminal","Ctrl-T");
str=_("Launch terminal")+TAB+key;
xfeBindingsDict->insert("terminal",str.text());
#if defined(linux)
key=getApp()->reg().readStringEntry("KEYBINDINGS","mount","Ctrl-M");
str=_("Mount file system (Linux only)")+TAB+key;
xfeBindingsDict->insert("mount",str.text());
key=getApp()->reg().readStringEntry("KEYBINDINGS","unmount","Ctrl-U");
str=_("Unmount file system (Linux only)")+TAB+key;
xfeBindingsDict->insert("unmount",str.text());
#endif
key=getApp()->reg().readStringEntry("KEYBINDINGS","one_panel","Ctrl-F1");
str=_("One panel mode")+TAB+key;
xfeBindingsDict->insert("one_panel",str.text());
key=getApp()->reg().readStringEntry("KEYBINDINGS","tree_panel","Ctrl-F2");
str=_("Tree and panel mode")+TAB+key;
xfeBindingsDict->insert("tree_panel",str.text());
key=getApp()->reg().readStringEntry("KEYBINDINGS","two_panels","Ctrl-F3");
str=_("Two panels mode")+TAB+key;
xfeBindingsDict->insert("two_panels",str.text());
key=getApp()->reg().readStringEntry("KEYBINDINGS","tree_two_panels","Ctrl-F4");
str=_("Tree and two panels mode")+TAB+key;
xfeBindingsDict->insert("tree_two_panels",str.text());
key=getApp()->reg().readStringEntry("KEYBINDINGS","clear_location","Ctrl-L");
str=_("Clear location bar")+TAB+key;
xfeBindingsDict->insert("clear_location",str.text());
key=getApp()->reg().readStringEntry("KEYBINDINGS","rename","F2");
str=_("Rename file")+TAB+key;
xfeBindingsDict->insert("rename",str.text());
key=getApp()->reg().readStringEntry("KEYBINDINGS","copy_to","F5");
str=_("Copy files to location")+TAB+key;
xfeBindingsDict->insert("copy_to",str.text());
key=getApp()->reg().readStringEntry("KEYBINDINGS","move_to","F6");
str=_("Move files to location")+TAB+key;
xfeBindingsDict->insert("move_to",str.text());
key=getApp()->reg().readStringEntry("KEYBINDINGS","symlink_to","Ctrl-S");
str=_("Symlink files to location")+TAB+key;
xfeBindingsDict->insert("symlink_to",str.text());
key=getApp()->reg().readStringEntry("KEYBINDINGS","add_bookmark","Ctrl-B");
str=_("Add bookmark")+TAB+key;
xfeBindingsDict->insert("add_bookmark",str.text());
key=getApp()->reg().readStringEntry("KEYBINDINGS","synchronize_panels","Ctrl-Y");
str=_("Synchronize panels")+TAB+key;
xfeBindingsDict->insert("synchronize_panels",str.text());
key=getApp()->reg().readStringEntry("KEYBINDINGS","switch_panels","Ctrl-K");
str=_("Switch panels")+TAB+key;
xfeBindingsDict->insert("switch_panels",str.text());
key=getApp()->reg().readStringEntry("KEYBINDINGS","go_to_trash","Ctrl-F8");
str=_("Go to trash can")+TAB+key;
xfeBindingsDict->insert("go_to_trash",str.text());
key=getApp()->reg().readStringEntry("KEYBINDINGS","empty_trash_can","Ctrl-Del");
str=_("Empty trash can")+TAB+key;
xfeBindingsDict->insert("empty_trash_can",str.text());
key=getApp()->reg().readStringEntry("KEYBINDINGS","view","Shift-F4");
str=_("View")+TAB+key;
xfeBindingsDict->insert("view",str.text());
key=getApp()->reg().readStringEntry("KEYBINDINGS","edit","F4");
str=_("Edit")+TAB+key;
xfeBindingsDict->insert("edit",str.text());
key=getApp()->reg().readStringEntry("KEYBINDINGS","hidden_dirs","Ctrl-F5");
str=_("Toggle display hidden folders")+TAB+key;
xfeBindingsDict->insert("hidden_dirs",str.text());
key=getApp()->reg().readStringEntry("KEYBINDINGS","filter","Ctrl-D");
str=_("Filter files")+TAB+key;
xfeBindingsDict->insert("filter",str.text());
// Key bindings specific to X File Image (Xfi)
if (xfiBindingsDict==NULL)
xfiBindingsDict=new FXStringDict();
key=getApp()->reg().readStringEntry("KEYBINDINGS","zoom_100","Ctrl-I");
str=_("Zoom image to 100%")+TAB+key;
xfiBindingsDict->insert("zoom_100",str.text());
key=getApp()->reg().readStringEntry("KEYBINDINGS","zoom_win","Ctrl-F");
str=_("Zoom to fit window")+TAB+key;
xfiBindingsDict->insert("zoom_win",str.text());
key=getApp()->reg().readStringEntry("KEYBINDINGS","rotate_left","Ctrl-L");
str=_("Rotate image to left")+TAB+key;
xfiBindingsDict->insert("rotate_left",str.text());
key=getApp()->reg().readStringEntry("KEYBINDINGS","rotate_right","Ctrl-R");
str=_("Rotate image to right")+TAB+key;
xfiBindingsDict->insert("rotate_right",str.text());
key=getApp()->reg().readStringEntry("KEYBINDINGS","mirror_horizontally","Ctrl-H");
str=_("Mirror image horizontally")+TAB+key;
xfiBindingsDict->insert("mirror_horizontally",str.text());
key=getApp()->reg().readStringEntry("KEYBINDINGS","mirror_vertically","Ctrl-V");
str=_("Mirror image vertically")+TAB+key;
xfiBindingsDict->insert("mirror_vertically",str.text());
// Key bindings specific to X File Write (Xfw)
if (xfwBindingsDict==NULL)
xfwBindingsDict=new FXStringDict();
key=getApp()->reg().readStringEntry("KEYBINDINGS","new","Ctrl-N");
str=_("Create new document")+TAB+key;
xfwBindingsDict->insert("new",str.text());
key=getApp()->reg().readStringEntry("KEYBINDINGS","save","Ctrl-S");
str=_("Save changes to file")+TAB+key;
xfwBindingsDict->insert("save",str.text());
key=getApp()->reg().readStringEntry("KEYBINDINGS","goto_line","Ctrl-L");
str=_("Goto line")+TAB+key;
xfwBindingsDict->insert("goto_line",str.text());
key=getApp()->reg().readStringEntry("KEYBINDINGS","undo","Ctrl-Z");
str=_("Undo last change")+TAB+key;
xfwBindingsDict->insert("undo",str.text());
key=getApp()->reg().readStringEntry("KEYBINDINGS","redo","Ctrl-Y");
str=_("Redo last change")+TAB+key;
xfwBindingsDict->insert("redo",str.text());
key=getApp()->reg().readStringEntry("KEYBINDINGS","replace","Ctrl-R");
str=_("Replace string")+TAB+key;
xfwBindingsDict->insert("replace",str.text());
key=getApp()->reg().readStringEntry("KEYBINDINGS","word_wrap","Ctrl-K");
str=_("Toggle word wrap mode")+TAB+key;
xfwBindingsDict->insert("word_wrap",str.text());
key=getApp()->reg().readStringEntry("KEYBINDINGS","line_numbers","Ctrl-T");
str=_("Toggle line numbers mode")+TAB+key;
xfwBindingsDict->insert("line_numbers",str.text());
key=getApp()->reg().readStringEntry("KEYBINDINGS","lower_case","Ctrl-U");
str=_("Toggle lower case mode")+TAB+key;
xfwBindingsDict->insert("lower_case",str.text());
key=getApp()->reg().readStringEntry("KEYBINDINGS","upper_case","Shift-Ctrl-U");
str=_("Toggle upper case mode")+TAB+key;
xfwBindingsDict->insert("upper_case",str.text());
// Display the key bindings dialog box
if (bindingsbox==NULL)
bindingsbox=new KeybindingsBox(this,glbBindingsDict,xfeBindingsDict,xfiBindingsDict,xfwBindingsDict);
bindingsbox->execute(PLACEMENT_OWNER);
return 1;
}
// Restore default key bindings
long PreferencesBox::onCmdRestoreKeyBindings(FXObject*,FXSelector,void*)
{
// Confirmation message
FXString message=_("Do you really want to restore the default key bindings?\n\nAll your customizations will be lost!");
MessageBox box(this,_("Restore default key bindings"),message,keybindingsicon,BOX_OK_CANCEL|DECOR_TITLE|DECOR_BORDER);
if(box.execute(PLACEMENT_CURSOR) != BOX_CLICKED_OK)
return 0;
// Write default key bindings to the registry
// Global key bindings
getApp()->reg().writeStringEntry("KEYBINDINGS","go_back","Ctrl-Backspace");
getApp()->reg().writeStringEntry("KEYBINDINGS","go_forward","Shift-Backspace");
getApp()->reg().writeStringEntry("KEYBINDINGS","go_up","Backspace");
getApp()->reg().writeStringEntry("KEYBINDINGS","go_home","Ctrl-H");
getApp()->reg().writeStringEntry("KEYBINDINGS","new_file","Ctrl-N");
getApp()->reg().writeStringEntry("KEYBINDINGS","new_folder","F7");
getApp()->reg().writeStringEntry("KEYBINDINGS","copy","Ctrl-C");
getApp()->reg().writeStringEntry("KEYBINDINGS","cut","Ctrl-X");
getApp()->reg().writeStringEntry("KEYBINDINGS","paste","Ctrl-V");
getApp()->reg().writeStringEntry("KEYBINDINGS","big_icons","F10");
getApp()->reg().writeStringEntry("KEYBINDINGS","small_icons","F11");
getApp()->reg().writeStringEntry("KEYBINDINGS","detailed_file_list","F12");
getApp()->reg().writeStringEntry("KEYBINDINGS","open","Ctrl-O");
getApp()->reg().writeStringEntry("KEYBINDINGS","quit","Ctrl-Q");
getApp()->reg().writeStringEntry("KEYBINDINGS","select_all","Ctrl-A");
getApp()->reg().writeStringEntry("KEYBINDINGS","deselect_all","Ctrl-Z");
getApp()->reg().writeStringEntry("KEYBINDINGS","invert_selection","Ctrl-I");
getApp()->reg().writeStringEntry("KEYBINDINGS","help","F1");
getApp()->reg().writeStringEntry("KEYBINDINGS","hidden_files","Ctrl-F6");
getApp()->reg().writeStringEntry("KEYBINDINGS","thumbnails","Ctrl-F7");
getApp()->reg().writeStringEntry("KEYBINDINGS","go_work","Shift-F2");
getApp()->reg().writeStringEntry("KEYBINDINGS","close","Ctrl-W");
getApp()->reg().writeStringEntry("KEYBINDINGS","print","Ctrl-P");
getApp()->reg().writeStringEntry("KEYBINDINGS","search","Ctrl-F");
getApp()->reg().writeStringEntry("KEYBINDINGS","search_prev","Shift-Ctrl-G");
getApp()->reg().writeStringEntry("KEYBINDINGS","search_next","Ctrl-G");
// Key bindings specific to X File Explorer (Xfe)
getApp()->reg().writeStringEntry("KEYBINDINGS","refresh","Ctrl-R");
getApp()->reg().writeStringEntry("KEYBINDINGS","new_symlink","Ctrl-J");
getApp()->reg().writeStringEntry("KEYBINDINGS","properties","F9");
getApp()->reg().writeStringEntry("KEYBINDINGS","move_to_trash","Del");
getApp()->reg().writeStringEntry("KEYBINDINGS","restore_from_trash","Alt-Del");
getApp()->reg().writeStringEntry("KEYBINDINGS","delete","Shift-Del");
getApp()->reg().writeStringEntry("KEYBINDINGS","new_window","F3");
getApp()->reg().writeStringEntry("KEYBINDINGS","new_root_window","Shift-F3");
getApp()->reg().writeStringEntry("KEYBINDINGS","execute_command","Ctrl-E");
getApp()->reg().writeStringEntry("KEYBINDINGS","terminal","Ctrl-T");
#if defined(linux)
getApp()->reg().writeStringEntry("KEYBINDINGS","mount","Ctrl-M");
getApp()->reg().writeStringEntry("KEYBINDINGS","unmount","Ctrl-U");
#endif
getApp()->reg().writeStringEntry("KEYBINDINGS","one_panel","Ctrl-F1");
getApp()->reg().writeStringEntry("KEYBINDINGS","tree_panel","Ctrl-F2");
getApp()->reg().writeStringEntry("KEYBINDINGS","two_panels","Ctrl-F3");
getApp()->reg().writeStringEntry("KEYBINDINGS","tree_two_panels","Ctrl-F4");
getApp()->reg().writeStringEntry("KEYBINDINGS","clear_location","Ctrl-L");
getApp()->reg().writeStringEntry("KEYBINDINGS","rename","F2");
getApp()->reg().writeStringEntry("KEYBINDINGS","copy_to","F5");
getApp()->reg().writeStringEntry("KEYBINDINGS","move_to","F6");
getApp()->reg().writeStringEntry("KEYBINDINGS","symlink_to","Ctrl-S");
getApp()->reg().writeStringEntry("KEYBINDINGS","add_bookmark","Ctrl-B");
getApp()->reg().writeStringEntry("KEYBINDINGS","synchronize_panels","Ctrl-Y");
getApp()->reg().writeStringEntry("KEYBINDINGS","switch_panels","Ctrl-K");
getApp()->reg().writeStringEntry("KEYBINDINGS","go_to_trash","Ctrl-F8");
getApp()->reg().writeStringEntry("KEYBINDINGS","empty_trash_can","Ctrl-Del");
getApp()->reg().writeStringEntry("KEYBINDINGS","view","Shift-F4");
getApp()->reg().writeStringEntry("KEYBINDINGS","edit","F4");
getApp()->reg().writeStringEntry("KEYBINDINGS","hidden_dirs","Ctrl-F5");
getApp()->reg().writeStringEntry("KEYBINDINGS","filter","Ctrl-D");
// Key bindings specific to X File Image (Xfi)
getApp()->reg().writeStringEntry("KEYBINDINGS","zoom_100","Ctrl-I");
getApp()->reg().writeStringEntry("KEYBINDINGS","zoom_win","Ctrl-F");
getApp()->reg().writeStringEntry("KEYBINDINGS","rotate_left","Ctrl-L");
getApp()->reg().writeStringEntry("KEYBINDINGS","rotate_right","Ctrl-R");
getApp()->reg().writeStringEntry("KEYBINDINGS","mirror_horizontally","Ctrl-H");
getApp()->reg().writeStringEntry("KEYBINDINGS","mirror_vertically","Ctrl-V");
// Key bindings specific to X File Write (Xfw)
getApp()->reg().writeStringEntry("KEYBINDINGS","new","Ctrl-N");
getApp()->reg().writeStringEntry("KEYBINDINGS","save","Ctrl-S");
getApp()->reg().writeStringEntry("KEYBINDINGS","goto_line","Ctrl-L");
getApp()->reg().writeStringEntry("KEYBINDINGS","undo","Ctrl-Z");
getApp()->reg().writeStringEntry("KEYBINDINGS","redo","Ctrl-Y");
getApp()->reg().writeStringEntry("KEYBINDINGS","replace","Ctrl-R");
getApp()->reg().writeStringEntry("KEYBINDINGS","word_wrap","Ctrl-K");
getApp()->reg().writeStringEntry("KEYBINDINGS","line_numbers","Ctrl-T");
getApp()->reg().writeStringEntry("KEYBINDINGS","lower_case","Ctrl-U");
getApp()->reg().writeStringEntry("KEYBINDINGS","upper_case","Shift-Ctrl-U");
// Finally, update the registry
getApp()->reg().write();
// Ask the user if he wants to restart Xfe
if(BOX_CLICKED_CANCEL!=MessageBox::question(this,BOX_OK_CANCEL,_("Restart"),_("Key bindings will be changed after restart.\nRestart X File Explorer now?")))
mainWindow->handle(this,FXSEL(SEL_COMMAND,XFileExplorer::ID_RESTART),NULL);
return 1;
}
long PreferencesBox::onCmdAccept(FXObject* o,FXSelector s,void* p)
{
FXbool restart_theme=FALSE;
FXbool restart_scroll=FALSE;
FXbool restart_pathlink=FALSE;
FXbool restart_controls=FALSE;
FXbool restart_normalfont=FALSE;
FXbool restart_textfont=FALSE;
if (iconpath->getText()=="")
iconpath->setText(oldiconpath);
// Icon path has changed
if(oldiconpath != iconpath->getText())
{
getApp()->reg().writeStringEntry("SETTINGS","iconpath",iconpath->getText().text());
getApp()->reg().write();
restart_theme=TRUE;
}
// Normal font has changed
if (oldnormalfont != normalfont->getText())
{
getApp()->reg().writeStringEntry("SETTINGS","font",normalfont->getText().text());
getApp()->reg().write();
restart_normalfont=TRUE;
}
// Text font has changed
if (oldtextfont != textfont->getText())
{
getApp()->reg().writeStringEntry("SETTINGS","textfont",textfont->getText().text());
getApp()->reg().write();
restart_textfont=TRUE;
}
// Text editor has changed
if(oldtxteditor != txteditor->getText())
{
// Update the txteditor string
FXString newtxteditor=txteditor->getText().text();
getApp()->reg().writeStringEntry("PROGS","txteditor",newtxteditor.text());
// Update each filetype where the old txteditor was used
FXStringDict *strdict = getApp()->reg().find("FILETYPES");
FileDict *assoc=new FileDict(getApp());
int i;
FXString key, value, newvalue;
FXString strtmp, open, view, edit, command;
for (i=strdict->first(); i<strdict->size(); i=strdict->next(i))
{
// Read key and value of each filetype
key=strdict->key(i);
value=strdict->data(i);
// Replace the old txteditor string with the new one
if (value.contains(oldtxteditor))
{
// Obtain the open, view, edit and command strings
strtmp=value.before(';',1);
command=value.after(';',1);
open=strtmp.section(',',0);
view=strtmp.section(',',1);
edit=strtmp.section(',',2);
// Replace only the open and edit strings, if needed
if (open==oldtxteditor)
open=newtxteditor;
if (edit==oldtxteditor)
edit=newtxteditor;
// Replace with the new value
value=open + "," + view + "," + edit + ";" + command;
assoc->replace(key.text(),value.text());
}
}
}
// Text viewer has changed
if(oldtxtviewer != txtviewer->getText())
{
// Update the txtviewer string
FXString newtxtviewer=txtviewer->getText().text();
getApp()->reg().writeStringEntry("PROGS","txtviewer",newtxtviewer.text());
// Update each filetype where the old txtviewer was used
FXStringDict *strdict = getApp()->reg().find("FILETYPES");
FileDict *assoc=new FileDict(getApp());
int i;
FXString key, value, newvalue;
FXString strtmp, open, view, edit, command;
for (i=strdict->first(); i<strdict->size(); i=strdict->next(i))
{
// Read key and value of each filetype
key=strdict->key(i);
value=strdict->data(i);
// Replace the old txtviewer string with the new one
if (value.contains(oldtxtviewer))
{
// Obtain the open, view, edit and command strings
strtmp=value.before(';',1);
command=value.after(';',1);
open=strtmp.section(',',0);
view=strtmp.section(',',1);
edit=strtmp.section(',',2);
// Replace only the view string, if needed
if (view==oldtxtviewer)
view=newtxtviewer;
// Replace with the new value
value=open + "," + view + "," + edit + ";" + command;
assoc->replace(key.text(),value.text());
}
}
}
// Image editor has changed
if(oldimgeditor != imgeditor->getText())
{
// Update the imgeditor string
FXString newimgeditor=imgeditor->getText().text();
getApp()->reg().writeStringEntry("PROGS","imgeditor",newimgeditor.text());
// Update each filetype where the old imgeditor was used
FXStringDict *strdict = getApp()->reg().find("FILETYPES");
FileDict *assoc=new FileDict(getApp());
int i;
FXString key, value, newvalue;
FXString strtmp, open, view, edit, command;
for (i=strdict->first(); i<strdict->size(); i=strdict->next(i))
{
// Read key and value of each filetype
key=strdict->key(i);
value=strdict->data(i);
// Replace the old imgeditor string with the new one
if (value.contains(oldimgeditor))
{
// Obtain the open, view, edit and command strings
strtmp=value.before(';',1);
command=value.after(';',1);
open=strtmp.section(',',0);
view=strtmp.section(',',1);
edit=strtmp.section(',',2);
// Replace only the open and edit strings, if needed
if (open==oldimgeditor)
open=newimgeditor;
if (edit==oldimgeditor)
edit=newimgeditor;
// Replace with the new value
value=open + "," + view + "," + edit + ";" + command;
assoc->replace(key.text(),value.text());
}
}
}
// Image viewer has changed
if(oldimgviewer != imgviewer->getText())
{
// Update the imgviewer string
FXString newimgviewer=imgviewer->getText().text();
getApp()->reg().writeStringEntry("PROGS","imgviewer",newimgviewer.text());
// Update each filetype where the old imgviewer was used
FXStringDict *strdict = getApp()->reg().find("FILETYPES");
FileDict *assoc=new FileDict(getApp());
int i;
FXString key, value, newvalue;
FXString strtmp, open, view, edit, command;
for (i=strdict->first(); i<strdict->size(); i=strdict->next(i))
{
// Read key and value of each filetype
key=strdict->key(i);
value=strdict->data(i);
// Replace the old imgviewer string with the new one
if (value.contains(oldimgviewer))
{
// Obtain the open, view, edit and command strings
strtmp=value.before(';',1);
command=value.after(';',1);
open=strtmp.section(',',0);
view=strtmp.section(',',1);
edit=strtmp.section(',',2);
// Replace the open and view string, if needed
if (open==oldimgviewer)
open=newimgviewer;
if (view==oldimgviewer)
view=newimgviewer;
// Replace with the new value
value=open + "," + view + "," + edit + ";" + command;
assoc->replace(key.text(),value.text());
}
}
}
// Archiver has changed
if(oldarchiver != archiver->getText())
{
// Update the archiver string
FXString newarchiver=archiver->getText().text();
getApp()->reg().writeStringEntry("PROGS","archiver",newarchiver.text());
// Update each filetype where the old archiver was used
FXStringDict *strdict = getApp()->reg().find("FILETYPES");
FileDict *assoc=new FileDict(getApp());
int i;
FXString key, value, newvalue;
FXString strtmp, open, view, edit, command;
for (i=strdict->first(); i<strdict->size(); i=strdict->next(i))
{
// Read key and value of each filetype
key=strdict->key(i);
value=strdict->data(i);
// Replace the old archiver string with the new one
if (value.contains(oldarchiver))
{
// Obtain the open, view, edit and command strings
strtmp=value.before(';',1);
command=value.after(';',1);
open=strtmp.section(',',0);
view=strtmp.section(',',1);
edit=strtmp.section(',',2);
// Replace the open, view and edit strings, if needed
if (open==oldarchiver)
open=newarchiver;
if (view==oldarchiver)
view=newarchiver;
if (edit==oldarchiver)
edit=newarchiver;
// Replace with the new value
value=open + "," + view + "," + edit + ";" + command;
assoc->replace(key.text(),value.text());
}
}
}
// PDF viewer has changed
if(oldpdfviewer != pdfviewer->getText())
{
// Update the PDF viewer string
FXString newpdfviewer=pdfviewer->getText().text();
getApp()->reg().writeStringEntry("PROGS","pdfviewer",newpdfviewer.text());
// Update each filetype where the old PDF viewer was used
FXStringDict *strdict = getApp()->reg().find("FILETYPES");
FileDict *assoc=new FileDict(getApp());
int i;
FXString key, value, newvalue;
FXString strtmp, open, view, edit, command;
for (i=strdict->first(); i<strdict->size(); i=strdict->next(i))
{
// Read key and value of each filetype
key=strdict->key(i);
value=strdict->data(i);
// Replace the old PDF viewer string with the new one
if (value.contains(oldpdfviewer))
{
// Obtain the open, view, edit and command strings
strtmp=value.before(';',1);
command=value.after(';',1);
open=strtmp.section(',',0);
view=strtmp.section(',',1);
edit=strtmp.section(',',2);
// Replace the open, view and edit strings, if needed
if (open==oldpdfviewer)
open=newpdfviewer;
if (view==oldpdfviewer)
view=newpdfviewer;
if (edit==oldpdfviewer)
edit=newpdfviewer;
// Replace with the new value
value=open + "," + view + "," + edit + ";" + command;
assoc->replace(key.text(),value.text());
}
}
}
// Audio viewer has changed
if(oldaudioviewer != audioviewer->getText())
{
// Update the audio viewer string
FXString newaudioviewer=audioviewer->getText().text();
getApp()->reg().writeStringEntry("PROGS","audioviewer",newaudioviewer.text());
// Update each filetype where the old audio viewer was used
FXStringDict *strdict = getApp()->reg().find("FILETYPES");
FileDict *assoc=new FileDict(getApp());
int i;
FXString key, value, newvalue;
FXString strtmp, open, view, edit, command;
for (i=strdict->first(); i<strdict->size(); i=strdict->next(i))
{
// Read key and value of each filetype
key=strdict->key(i);
value=strdict->data(i);
// Replace the old audio viewer string with the new one
if (value.contains(oldaudioviewer))
{
// Obtain the open, view, edit and command strings
strtmp=value.before(';',1);
command=value.after(';',1);
open=strtmp.section(',',0);
view=strtmp.section(',',1);
edit=strtmp.section(',',2);
// Replace the open, view and edit strings, if needed
if (open==oldaudioviewer)
open=newaudioviewer;
if (view==oldaudioviewer)
view=newaudioviewer;
if (edit==oldaudioviewer)
edit=newaudioviewer;
// Replace with the new value
value=open + "," + view + "," + edit + ";" + command;
assoc->replace(key.text(),value.text());
}
}
}
// Video viewer has changed
if(oldvideoviewer != videoviewer->getText())
{
// Update the video viewer string
FXString newvideoviewer=videoviewer->getText().text();
getApp()->reg().writeStringEntry("PROGS","videoviewer",newvideoviewer.text());
// Update each filetype where the old video viewer was used
FXStringDict *strdict = getApp()->reg().find("FILETYPES");
FileDict *assoc=new FileDict(getApp());
int i;
FXString key, value, newvalue;
FXString strtmp, open, view, edit, command;
for (i=strdict->first(); i<strdict->size(); i=strdict->next(i))
{
// Read key and value of each filetype
key=strdict->key(i);
value=strdict->data(i);
// Replace the old video viewer string with the new one
if (value.contains(oldvideoviewer))
{
// Obtain the open, view, edit and command strings
strtmp=value.before(';',1);
command=value.after(';',1);
open=strtmp.section(',',0);
view=strtmp.section(',',1);
edit=strtmp.section(',',2);
// Replace the open, view and edit strings, if needed
if (open==oldvideoviewer)
open=newvideoviewer;
if (view==oldvideoviewer)
view=newvideoviewer;
if (edit==oldvideoviewer)
edit=newvideoviewer;
// Replace with the new value
value=open + "," + view + "," + edit + ";" + command;
assoc->replace(key.text(),value.text());
}
}
}
// Terminal has changed
if(oldxterm != xterm->getText())
getApp()->reg().writeStringEntry("PROGS","xterm",xterm->getText().text());
getApp()->reg().writeUnsignedEntry("OPTIONS","auto_save_layout",autosave->getCheck());
getApp()->reg().writeUnsignedEntry("SETTINGS","save_win_pos",savewinpos->getCheck());
getApp()->reg().writeUnsignedEntry("OPTIONS","use_trash_can",trashcan->getCheck());
getApp()->reg().writeUnsignedEntry("OPTIONS","use_trash_bypass",trashbypass->getCheck());
getApp()->reg().writeUnsignedEntry("OPTIONS","ask_before_copy",ask->getCheck());
getApp()->reg().writeUnsignedEntry("SETTINGS","single_click",single_click);
getApp()->reg().writeStringEntry("SETTINGS","time_format",timeformat->getText().text());
getApp()->reg().writeUnsignedEntry("OPTIONS","confirm_trash",trashmv->getCheck());
getApp()->reg().writeUnsignedEntry("OPTIONS","confirm_delete",del->getCheck());
getApp()->reg().writeUnsignedEntry("OPTIONS","confirm_delete_emptydir",del_emptydir->getCheck());
getApp()->reg().writeUnsignedEntry("OPTIONS","confirm_overwrite",overwrite->getCheck());
getApp()->reg().writeUnsignedEntry("OPTIONS","confirm_execute",exec->getCheck());
getApp()->reg().writeUnsignedEntry("OPTIONS","confirm_drag_and_drop",dnd->getCheck());
getApp()->reg().writeUnsignedEntry("OPTIONS","folder_warn",folder_warning->getCheck());
getApp()->reg().writeUnsignedEntry("OPTIONS","preserve_date_warn",preserve_date_warning->getCheck());
getApp()->reg().writeUnsignedEntry("OPTIONS","root_warn",root_warning->getCheck());
getApp()->reg().writeUnsignedEntry("OPTIONS","root_mode",rootmode->getCheck());
#ifdef STARTUP_NOTIFICATION
getApp()->reg().writeUnsignedEntry("OPTIONS","use_startup_notification",usesn->getCheck());
#endif
#if defined(linux)
getApp()->reg().writeUnsignedEntry("OPTIONS","mount_warn",mount->getCheck());
getApp()->reg().writeUnsignedEntry("OPTIONS","mount_messages",show_mount->getCheck());
#endif
// Smooth scrolling
getApp()->reg().writeUnsignedEntry("SETTINGS","smooth_scroll",scroll->getCheck());
if (scroll->getCheck()!=smoothscroll_prev)
{
getApp()->reg().write();
restart_scroll=TRUE;
}
// Control themes
getApp()->reg().writeUnsignedEntry("SETTINGS","use_clearlooks",use_clearlooks);
if (use_clearlooks!=use_clearlooks_prev)
{
FXColor hilitecolor, shadowcolor;
// Change control hilite and shadow colors when the control theme has changed
if (use_clearlooks) // clearlooks
{
hilitecolor=makeHiliteColorGradient(currTheme.color[0]);
shadowcolor=makeShadowColorGradient(currTheme.color[0]);
}
else // standard
{
hilitecolor=makeHiliteColor(currTheme.color[0]);
shadowcolor=makeShadowColor(currTheme.color[0]);
}
getApp()->reg().writeColorEntry("SETTINGS","hilitecolor",hilitecolor);
getApp()->reg().writeColorEntry("SETTINGS","shadowcolor",shadowcolor);
getApp()->reg().write();
restart_controls=TRUE;
}
// Update some global options
if (diropen->getCheck() && fileopen->getCheck())
single_click=SINGLE_CLICK_DIR_FILE;
else if (diropen->getCheck() && !fileopen->getCheck())
single_click=SINGLE_CLICK_DIR;
else
single_click=SINGLE_CLICK_NONE;
if (single_click==SINGLE_CLICK_DIR_FILE)
((XFileExplorer*) mainWindow)->setDefaultCursor(getApp()->getDefaultCursor(DEF_HAND_CURSOR));
else
((XFileExplorer*) mainWindow)->setDefaultCursor(getApp()->getDefaultCursor(DEF_ARROW_CURSOR));
// Update the file tooltips flag
if (filetooltips->getCheck())
file_tooltips=TRUE;
else
file_tooltips=FALSE;
getApp()->reg().writeUnsignedEntry("SETTINGS","file_tooltips",(FXuint)file_tooltips);
// Update the relative resize flag
if (relativeresize->getCheck())
relative_resize=TRUE;
else
relative_resize=FALSE;
getApp()->reg().writeUnsignedEntry("SETTINGS","relative_resize",(FXuint)relative_resize);
// Update the display path linker flag
show_pathlink=showpathlink->getCheck();
getApp()->reg().writeUnsignedEntry("SETTINGS","show_pathlinker",show_pathlink);
if (show_pathlink!=show_pathlink_prev)
{
getApp()->reg().write();
restart_pathlink=TRUE;
}
// Theme has changed
if(currTheme != Themes[0])
{
getApp()->reg().writeColorEntry("SETTINGS","basecolor",currTheme.color[0]);
getApp()->reg().writeColorEntry("SETTINGS","bordercolor",currTheme.color[1]);
getApp()->reg().writeColorEntry("SETTINGS","backcolor",currTheme.color[2]);
getApp()->reg().writeColorEntry("SETTINGS","forecolor",currTheme.color[3]);
getApp()->reg().writeColorEntry("SETTINGS","selbackcolor",currTheme.color[4]);
getApp()->reg().writeColorEntry("SETTINGS","selforecolor",currTheme.color[5]);
getApp()->reg().writeColorEntry("SETTINGS","listbackcolor",currTheme.color[6]);
getApp()->reg().writeColorEntry("SETTINGS","listforecolor",currTheme.color[7]);
getApp()->reg().writeColorEntry("SETTINGS","highlightcolor",currTheme.color[8]);
getApp()->reg().writeColorEntry("SETTINGS","pbarcolor",currTheme.color[9]);
getApp()->reg().writeColorEntry("SETTINGS","attentioncolor",currTheme.color[10]);
getApp()->reg().writeColorEntry("SETTINGS","scrollbarcolor",currTheme.color[11]);
// Control themes
FXColor hilitecolor, shadowcolor;
// Change control hilite and shadow colors when the control theme has changed
if (use_clearlooks) // clearlooks
{
hilitecolor=makeHiliteColorGradient(currTheme.color[0]);
shadowcolor=makeShadowColorGradient(currTheme.color[0]);
}
else // standard
{
hilitecolor=makeHiliteColor(currTheme.color[0]);
shadowcolor=makeShadowColor(currTheme.color[0]);
}
getApp()->reg().writeColorEntry("SETTINGS","hilitecolor",hilitecolor);
getApp()->reg().writeColorEntry("SETTINGS","shadowcolor",shadowcolor);
getApp()->reg().write();
restart_theme=TRUE;
}
// Restart application if necessary
if (restart_scroll)
{
if(BOX_CLICKED_CANCEL!=MessageBox::question(this,BOX_OK_CANCEL,_("Restart"),_("Scrolling mode will be changed after restart.\nRestart X File Explorer now?")))
mainWindow->handle(this,FXSEL(SEL_COMMAND,XFileExplorer::ID_RESTART),NULL);
}
if (restart_theme)
{
if(BOX_CLICKED_CANCEL!=MessageBox::question(this,BOX_OK_CANCEL,_("Restart"),_("Theme will be changed after restart.\nRestart X File Explorer now?")))
mainWindow->handle(this,FXSEL(SEL_COMMAND,XFileExplorer::ID_RESTART),NULL);
}
if (restart_pathlink)
{
if(BOX_CLICKED_CANCEL!=MessageBox::question(this,BOX_OK_CANCEL,_("Restart"),_("Path linker will be changed after restart.\nRestart X File Explorer now?")))
mainWindow->handle(this,FXSEL(SEL_COMMAND,XFileExplorer::ID_RESTART),NULL);
}
if (restart_controls)
{
if(BOX_CLICKED_CANCEL!=MessageBox::question(this,BOX_OK_CANCEL,_("Restart"),_("Button style will be changed after restart.\nRestart X File Explorer now?")))
mainWindow->handle(this,FXSEL(SEL_COMMAND,XFileExplorer::ID_RESTART),NULL);
}
if (restart_normalfont)
{
if(BOX_CLICKED_CANCEL!=MessageBox::question(this,BOX_OK_CANCEL,_("Restart"),_("Normal font will be changed after restart.\nRestart X File Explorer now?")))
mainWindow->handle(this,FXSEL(SEL_COMMAND,XFileExplorer::ID_RESTART),NULL);
}
if (restart_textfont)
{
if(BOX_CLICKED_CANCEL!=MessageBox::question(this,BOX_OK_CANCEL,_("Restart"),_("Text font will be changed after restart.\nRestart X File Explorer now?")))
mainWindow->handle(this,FXSEL(SEL_COMMAND,XFileExplorer::ID_RESTART),NULL);
}
// Finally, update the registry
getApp()->reg().write();
// Refresh panels
mainWindow->handle(this,FXSEL(SEL_COMMAND,XFileExplorer::ID_REFRESH),NULL);
DialogBox::onCmdAccept(o,s,p);
return 1;
}
long PreferencesBox::onCmdCancel(FXObject* o,FXSelector s,void* p)
{
// Reset preferences to their previous values
// First tab - Options
trashcan->setCheck(trashcan_prev);
trashbypass->setCheck(trashbypass_prev);
autosave->setCheck(autosave_prev);
savewinpos->setCheck(savewinpos_prev);
diropen->setCheck(diropen_prev);
fileopen->setCheck(fileopen_prev);
filetooltips->setCheck(filetooltips_prev);
relativeresize->setCheck(relativeresize_prev);
showpathlink->setCheck(show_pathlink_prev);
getApp()->setWheelLines(value_prev);
use_sudo=use_sudo_prev;
getApp()->reg().writeUnsignedEntry("OPTIONS","use_sudo",use_sudo);
scroll->setCheck(smoothscroll_prev);
rootmode->setCheck(rootmode_prev);
timeformat->setText(oldtimeformat);
#ifdef STARTUP_NOTIFICATION
usesn->setCheck(usesn_prev);
#endif
// Second tab - Dialogs
ask->setCheck(ask_prev);
dnd->setCheck(dnd_prev);
trashmv->setCheck(trashmv_prev);
del->setCheck(del_prev);
del_emptydir->setCheck(del_emptydir_prev);
overwrite->setCheck(overwrite_prev);
exec->setCheck(exec_prev);
#if defined(linux)
mount->setCheck(mount_prev);
show_mount->setCheck(show_mount_prev);
#endif
folder_warning->setCheck(folder_warning_prev);
preserve_date_warning->setCheck(preserve_date_warning_prev);
root_warning->setCheck(root_warning_prev);
// Third tab - Programs
txteditor->setText(oldtxteditor);
txtviewer->setText(oldtxtviewer);
imgeditor->setText(oldimgeditor);
imgviewer->setText(oldimgviewer);
archiver->setText(oldarchiver);
pdfviewer->setText(oldpdfviewer);
audioviewer->setText(oldaudioviewer);
videoviewer->setText(oldvideoviewer);
xterm->setText(oldxterm);
// Fourth tab - Visual
themesList->setCurrentItem(themelist_prev);
currTheme=currTheme_prev;
iconpath->setText(oldiconpath);
use_clearlooks=use_clearlooks_prev;
getApp()->reg().writeUnsignedEntry("SETTINGS","use_clearlooks",use_clearlooks);
// Fifth tab - Fonts
normalfont->setText(oldnormalfont);
textfont->setText(oldtextfont);
// Finally, update the registry (really necessary?)
getApp()->reg().write();
DialogBox::onCmdCancel(o,s,p);
return 1;
}
// Execute dialog box modally
FXuint PreferencesBox::execute(FXuint placement)
{
// Save current preferences to restore them if cancel is pressed
// First tab - Options
trashcan_prev=trashcan->getCheck();
trashbypass_prev=trashbypass->getCheck();
autosave_prev=autosave->getCheck();
savewinpos_prev=savewinpos->getCheck();
diropen_prev=diropen->getCheck();
fileopen_prev=fileopen->getCheck();
filetooltips_prev=filetooltips->getCheck();
relativeresize_prev=relativeresize->getCheck();
show_pathlink_prev=showpathlink->getCheck();
value_prev=getApp()->getWheelLines();
use_sudo_prev=use_sudo;
smoothscroll_prev=scroll->getCheck();
rootmode_prev=rootmode->getCheck();
#ifdef STARTUP_NOTIFICATION
usesn_prev=usesn->getCheck();
#endif
// Second tab - Dialogs
ask_prev=ask->getCheck();
dnd_prev=dnd->getCheck();
trashmv_prev=trashmv->getCheck();
del_prev=del->getCheck();
del_emptydir_prev=del_emptydir->getCheck();
overwrite_prev=overwrite->getCheck();
exec_prev=exec->getCheck();
#if defined(linux)
mount_prev=mount->getCheck();
show_mount_prev=show_mount->getCheck();
#endif
folder_warning_prev=folder_warning->getCheck();
preserve_date_warning_prev=preserve_date_warning->getCheck();
root_warning_prev=root_warning->getCheck();
// Third tab - Programs
oldtxteditor=txteditor->getText();
oldtxtviewer=txtviewer->getText();
oldimgeditor=imgeditor->getText();
oldimgviewer=imgviewer->getText();
oldarchiver=archiver->getText();
oldpdfviewer=pdfviewer->getText();
oldaudioviewer=audioviewer->getText();
oldvideoviewer=videoviewer->getText();
oldxterm=xterm->getText();
// Fourth tab - Visual
themelist_prev=themesList->getCurrentItem();
currTheme_prev = currTheme;
oldiconpath=iconpath->getText();
use_clearlooks_prev=use_clearlooks;
// Fifth tab - Fonts
oldnormalfont=normalfont->getText();
oldtextfont=textfont->getText();
create();
show(placement);
getApp()->refresh();
return getApp()->runModalFor(this);
}
// Update buttons related to the trash can option item
long PreferencesBox::onUpdTrash(FXObject* o,FXSelector,void*)
{
if (trashcan->getCheck())
o->handle(this,FXSEL(SEL_COMMAND,FXWindow::ID_ENABLE),NULL);
else
o->handle(this,FXSEL(SEL_COMMAND,FXWindow::ID_DISABLE),NULL);
return 1;
}
// Update the confirm delete empty directories option item
long PreferencesBox::onUpdConfirmDelEmptyDir(FXObject* o,FXSelector,void*)
{
if (del->getCheck())
o->handle(this,FXSEL(SEL_COMMAND,FXWindow::ID_ENABLE),NULL);
else
o->handle(this,FXSEL(SEL_COMMAND,FXWindow::ID_DISABLE),NULL);
return 1;
}
// Set root mode
long PreferencesBox::onCmdSuMode(FXObject*,FXSelector sel,void*)
{
if (FXSELID(sel)==ID_SU_CMD)
use_sudo=FALSE;
else if (FXSELID(sel)==ID_SUDO_CMD)
use_sudo=TRUE;
getApp()->reg().writeUnsignedEntry("OPTIONS","use_sudo",use_sudo);
getApp()->reg().write();
return 1;
}
// Update root mode radio button
long PreferencesBox::onUpdSuMode(FXObject* sender,FXSelector sel,void*)
{
if (!rootmode->getCheck())
sender->handle(this,FXSEL(SEL_COMMAND,ID_DISABLE),NULL);
else
{
if (getuid()) // Simple user
sender->handle(this,FXSEL(SEL_COMMAND,ID_ENABLE),NULL);
FXSelector updatemessage=FXSEL(SEL_COMMAND,ID_UNCHECK);
if (FXSELID(sel)==ID_SU_CMD)
{
if (use_sudo)
updatemessage=FXSEL(SEL_COMMAND,ID_UNCHECK);
else
updatemessage=FXSEL(SEL_COMMAND,ID_CHECK);
}
else if (FXSELID(sel)==ID_SUDO_CMD)
{
if (use_sudo)
updatemessage=FXSEL(SEL_COMMAND,ID_CHECK);
else
updatemessage=FXSEL(SEL_COMMAND,ID_UNCHECK);
}
sender->handle(this,updatemessage,NULL);
}
return 1;
}
// Set root mode
long PreferencesBox::onCmdControls(FXObject*,FXSelector sel,void*)
{
if (FXSELID(sel)==ID_STANDARD_CONTROLS)
use_clearlooks=FALSE;
else if (FXSELID(sel)==ID_CLEARLOOKS_CONTROLS)
use_clearlooks=TRUE;
getApp()->reg().writeUnsignedEntry("SETTINGS","use_clearlooks",use_clearlooks);
getApp()->reg().write();
return 1;
}
// Update root mode radio button
long PreferencesBox::onUpdControls(FXObject* sender,FXSelector sel,void*)
{
FXSelector updatemessage=FXSEL(SEL_COMMAND,ID_UNCHECK);
if (FXSELID(sel)==ID_STANDARD_CONTROLS)
{
if (use_clearlooks)
updatemessage=FXSEL(SEL_COMMAND,ID_UNCHECK);
else
updatemessage=FXSEL(SEL_COMMAND,ID_CHECK);
}
else if (FXSELID(sel)==ID_CLEARLOOKS_CONTROLS)
{
if (use_clearlooks)
updatemessage=FXSEL(SEL_COMMAND,ID_CHECK);
else
updatemessage=FXSEL(SEL_COMMAND,ID_UNCHECK);
}
sender->handle(this,updatemessage,NULL);
return 1;
}
// Set scroll wheel lines (Mathew Robertson <mathew@optushome.com.au>)
long PreferencesBox::onCmdWheelAdjust(FXObject* sender,FXSelector,void*)
{
FXuint value;
sender->handle(this,FXSEL(SEL_COMMAND,ID_GETINTVALUE),(void*)&value);
getApp()->setWheelLines(value);
getApp()->reg().write();
return 1;
}
// Update the wheel lines button
long PreferencesBox::onUpdWheelAdjust(FXObject* sender,FXSelector,void*)
{
FXuint value=getApp()->getWheelLines();
sender->handle(this,FXSEL(SEL_COMMAND,ID_SETINTVALUE),(void*)&value);
return 1;
}
// Update single click file open button
long PreferencesBox::onUpdSingleClickFileopen(FXObject* o,FXSelector,void*)
{
if (diropen->getCheck())
o->handle(this,FXSEL(SEL_COMMAND,FXWindow::ID_ENABLE),NULL);
else
{
fileopen->setCheck(FALSE);
o->handle(this,FXSEL(SEL_COMMAND,FXWindow::ID_DISABLE),NULL);
}
return 1;
}
|