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
|
/*
* BRLTTY - A background process providing access to the console screen (when in
* text mode) for a blind person using a refreshable braille display.
*
* Copyright (C) 1995-2014 by The BRLTTY Developers.
*
* BRLTTY comes with ABSOLUTELY NO WARRANTY.
*
* This is free software, placed 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. Please see the file LICENSE-GPL for details.
*
* Web Page: http://mielke.cc/brltty/
*
* This software is maintained by Dave Mielke <dave@mielke.cc>.
*/
#include "prologue.h"
#include <stdio.h>
#include <string.h>
#include "log.h"
#include "embed.h"
#include "revision.h"
#include "menu.h"
#include "menu_prefs.h"
#include "prefs.h"
#include "profile.h"
#include "status_types.h"
#include "ttb.h"
#include "atb.h"
#include "ctb.h"
#include "tune.h"
#include "midi.h"
#include "brltty.h"
#define PREFS_MENU_ITEM_VARIABLE(name) prefsMenuItemVariable_##name
#define PREFS_MENU_ITEM_GETTER_DECLARE(name) \
static MenuItem *PREFS_MENU_ITEM_VARIABLE(name) = NULL; \
PREFS_MENU_ITEM_GETTER_PROTOTYPE(name) { \
return getPreferencesMenu()? PREFS_MENU_ITEM_VARIABLE(name): NULL; \
}
PREFS_MENU_ITEM_APPLY(PREFS_MENU_ITEM_GETTER_DECLARE)
#define NAME(name) static const MenuString itemName = {.label=name}
#define ITEM(new) MenuItem *item = (new); if (!item) goto noItem
#define TEST(property) setMenuItemTester(item, test##property)
#define CHANGED(setting) setMenuItemChanged(item, changed##setting)
#define SET(name) PREFS_MENU_ITEM_VARIABLE(name) = item
#define SUBMENU(variable, parent, name) \
NAME(name); \
Menu *variable = newSubmenuMenuItem(parent, &itemName); \
if (!variable) goto noItem
static int
testAdvancedSubmenu (void) {
return prefs.showAdvancedSubmenus;
}
static void
setAdvancedSubmenu (Menu *submenu) {
Menu *parent = getMenuParent(submenu);
if (parent) {
unsigned int size = getMenuSize(parent);
if (size) {
MenuItem *item = getMenuItem(parent, size-1);
if (item) setMenuItemTester(item, testAdvancedSubmenu);
}
}
}
static int
testSlidingWindow (void) {
return prefs.slidingWindow;
}
static int
changedWindowOverlap (const MenuItem *item UNUSED, unsigned char setting) {
if (setting >= textCount) return 0;
reconfigureWindow();
return 1;
}
static int
testAutorepeat (void) {
return prefs.autorepeat;
}
static int
setAutorepeat (BrailleDisplay *brl, int on, int delay, int interval) {
if (!brl->setAutorepeat) return 1;
return setBrailleAutorepeat(brl, on, delay, interval);
}
static int
changedAutorepeat (const MenuItem *item UNUSED, unsigned char setting) {
return setAutorepeat(&brl, setting,
PREFERENCES_TIME(prefs.longPressTime),
PREFERENCES_TIME(prefs.autorepeatInterval));
}
static int
changedAutorepeatDelay (const MenuItem *item UNUSED, unsigned char setting) {
return setAutorepeat(&brl, prefs.autorepeat,
setting,
PREFERENCES_TIME(prefs.autorepeatInterval));
}
static int
changedAutorepeatInterval (const MenuItem *item UNUSED, unsigned char setting) {
return setAutorepeat(&brl, prefs.autorepeat,
PREFERENCES_TIME(prefs.longPressTime),
setting);
}
static int
testShowCursor (void) {
return prefs.showCursor;
}
static int
testBlinkingCursor (void) {
return testShowCursor() && prefs.blinkingCursor;
}
static int
testShowAttributes (void) {
return prefs.showAttributes;
}
static int
testBlinkingAttributes (void) {
return testShowAttributes() && prefs.blinkingAttributes;
}
static int
testBlinkingCapitals (void) {
return prefs.blinkingCapitals;
}
static int
testBrailleFirmness (void) {
return brl.setFirmness != NULL;
}
static int
changedBrailleFirmness (const MenuItem *item UNUSED, unsigned char setting) {
return setBrailleFirmness(&brl, setting);
}
static int
testBrailleSensitivity (void) {
return brl.setSensitivity != NULL;
}
static int
changedBrailleSensitivity (const MenuItem *item UNUSED, unsigned char setting) {
return setBrailleSensitivity(&brl, setting);
}
static int
testBrailleDisplayOrientation (void) {
return brl.rotateInput != NULL;
}
static int
testTunes (void) {
return prefs.alertTunes;
}
static int
changedTuneDevice (const MenuItem *item UNUSED, unsigned char setting) {
return setTuneDevice(setting);
}
#ifdef HAVE_PCM_SUPPORT
static int
testTunesPcm (void) {
return testTunes() && (prefs.tuneDevice == tdPcm);
}
#endif /* HAVE_PCM_SUPPORT */
#ifdef HAVE_MIDI_SUPPORT
static int
testTunesMidi (void) {
return testTunes() && (prefs.tuneDevice == tdMidi);
}
#endif /* HAVE_MIDI_SUPPORT */
#ifdef HAVE_FM_SUPPORT
static int
testTunesFm (void) {
return testTunes() && (prefs.tuneDevice == tdFm);
}
#endif /* HAVE_FM_SUPPORT */
#ifdef ENABLE_SPEECH_SUPPORT
static int
testSpeechVolume (void) {
return canSetSpeechVolume();
}
static int
changedSpeechVolume (const MenuItem *item UNUSED, unsigned char setting) {
return setSpeechVolume(setting, !prefs.autospeak);
}
static int
testSpeechRate (void) {
return canSetSpeechRate();
}
static int
changedSpeechRate (const MenuItem *item UNUSED, unsigned char setting) {
return setSpeechRate(setting, !prefs.autospeak);
}
static int
testSpeechPitch (void) {
return canSetSpeechPitch();
}
static int
changedSpeechPitch (const MenuItem *item UNUSED, unsigned char setting) {
return setSpeechPitch(setting, !prefs.autospeak);
}
static int
testSpeechPunctuation (void) {
return canSetSpeechPunctuation();
}
static int
changedSpeechPunctuation (const MenuItem *item UNUSED, unsigned char setting) {
return setSpeechPunctuation(setting, !prefs.autospeak);
}
static int
testAutospeak (void) {
return prefs.autospeak;
}
static int
testShowSpeechCursor (void) {
return prefs.showSpeechCursor;
}
static int
testBlinkingSpeechCursor (void) {
return testShowSpeechCursor() && prefs.blinkingSpeechCursor;
}
#endif /* ENABLE_SPEECH_SUPPORT */
static int
testShowDate (void) {
return prefs.datePosition != dpNone;
}
static int
testStatusPosition (void) {
return !haveStatusCells();
}
static int
changedStatusPosition (const MenuItem *item UNUSED, unsigned char setting UNUSED) {
reconfigureWindow();
return 1;
}
static int
testStatusCount (void) {
return testStatusPosition() && (prefs.statusPosition != spNone);
}
static int
changedStatusCount (const MenuItem *item UNUSED, unsigned char setting UNUSED) {
reconfigureWindow();
return 1;
}
static int
testStatusSeparator (void) {
return testStatusCount();
}
static int
changedStatusSeparator (const MenuItem *item UNUSED, unsigned char setting UNUSED) {
reconfigureWindow();
return 1;
}
static int
testStatusField (unsigned char index) {
return (haveStatusCells() || (prefs.statusPosition != spNone)) &&
((index == 0) || (prefs.statusFields[index-1] != sfEnd));
}
static int
changedStatusField (unsigned char index, unsigned char setting) {
switch (setting) {
case sfGeneric:
if (index > 0) return 0;
if (!haveStatusCells()) return 0;
if (!braille->statusFields) return 0;
if (*braille->statusFields != sfGeneric) return 0;
case sfEnd:
if (prefs.statusFields[index+1] != sfEnd) return 0;
break;
default:
if ((index > 0) && (prefs.statusFields[index-1] == sfGeneric)) return 0;
break;
}
reconfigureWindow();
return 1;
}
#define STATUS_FIELD_HANDLERS(n) \
static int testStatusField##n (void) { return testStatusField(n-1); } \
static int changedStatusField##n (const MenuItem *item UNUSED, unsigned char setting) { return changedStatusField(n-1, setting); }
STATUS_FIELD_HANDLERS(1)
STATUS_FIELD_HANDLERS(2)
STATUS_FIELD_HANDLERS(3)
STATUS_FIELD_HANDLERS(4)
STATUS_FIELD_HANDLERS(5)
STATUS_FIELD_HANDLERS(6)
STATUS_FIELD_HANDLERS(7)
STATUS_FIELD_HANDLERS(8)
STATUS_FIELD_HANDLERS(9)
#undef STATUS_FIELD_HANDLERS
static int
changedTextTable (const MenuItem *item, unsigned char setting UNUSED) {
return changeTextTable(getMenuItemValue(item));
}
static int
changedAttributesTable (const MenuItem *item, unsigned char setting UNUSED) {
return changeAttributesTable(getMenuItemValue(item));
}
static int
changedKeyboardTable (const MenuItem *item, unsigned char setting UNUSED) {
return changeKeyboardTable(getMenuItemValue(item));
}
#ifdef ENABLE_CONTRACTED_BRAILLE
static int
testContractedBraille (void) {
return prefs.textStyle == tsContractedBraille;
}
static int
changedContractionTable (const MenuItem *item, unsigned char setting UNUSED) {
return changeContractionTable(getMenuItemValue(item));
}
#endif /* ENABLE_CONTRACTED_BRAILLE */
static int
testInputTable (void) {
return !!brl.keyTable;
}
static int
testKeyboardTable (void) {
return !!keyboardTable;
}
static MenuItem *
newProfileMenuItem (Menu *menu, const ProfileDescriptor *profile) {
MenuString name = {.label = profile->category};
;
return newFilesMenuItem(menu, &name, opt_tablesDirectory, PROFILES_SUBDIRECTORY, profile->extension, "", 1);
}
static int
changedProfile (const ProfileDescriptor *profile, const MenuItem *item) {
const char *value = getMenuItemValue(item);
if (*value) {
activateProfile(profile, opt_tablesDirectory, value);
} else {
deactivateProfile(profile);
}
return 1;
}
static int
changedLanguageProfile (const MenuItem *item, unsigned char setting UNUSED) {
return changedProfile(&languageProfile, item);
}
static MenuItem *
newStatusFieldMenuItem (
Menu *menu, unsigned char number,
MenuItemTester *test, MenuItemChanged *changed
) {
static const MenuString strings[] = {
{.label=strtext("End")},
{.label=strtext("Window Coordinates"), .comment=strtext("2 cells")},
{.label=strtext("Window Column"), .comment=strtext("1 cell")},
{.label=strtext("Window Row"), .comment=strtext("1 cell")},
{.label=strtext("Cursor Coordinates"), .comment=strtext("2 cells")},
{.label=strtext("Cursor Column"), .comment=strtext("1 cell")},
{.label=strtext("Cursor Row"), .comment=strtext("1 cell")},
{.label=strtext("Cursor and Window Column"), .comment=strtext("2 cells")},
{.label=strtext("Cursor and Window Row"), .comment=strtext("2 cells")},
{.label=strtext("Screen Number"), .comment=strtext("1 cell")},
{.label=strtext("State Dots"), .comment=strtext("1 cell")},
{.label=strtext("State Letter"), .comment=strtext("1 cell")},
{.label=strtext("Time"), .comment=strtext("2 cells")},
{.label=strtext("Alphabetic Window Coordinates"), .comment=strtext("1 cell")},
{.label=strtext("Alphabetic Cursor Coordinates"), .comment=strtext("1 cell")},
{.label=strtext("Generic")}
};
MenuString name = {
.label = strtext("Status Field")
};
char *comment;
{
char buffer[0X3];
snprintf(buffer, sizeof(buffer), "%u", number);
name.comment = comment = strdup(buffer);
}
if (comment) {
MenuItem *item = newEnumeratedMenuItem(menu, &prefs.statusFields[number-1], &name, strings);
if (item) {
setMenuItemTester(item, test);
setMenuItemChanged(item, changed);
return item;
}
free(comment);
} else {
logMallocError();
}
return NULL;
}
static MenuItem *
newTimeMenuItem (Menu *menu, unsigned char *setting, const MenuString *name) {
return newNumericMenuItem(menu, setting, name, 1, 100, 4, strtext("csecs"));
}
#if defined(HAVE_PCM_SUPPORT) || defined(HAVE_MIDI_SUPPORT) || defined(HAVE_FM_SUPPORT)
static MenuItem *
newVolumeMenuItem (Menu *menu, unsigned char *setting, const MenuString *name) {
return newNumericMenuItem(menu, setting, name, 0, 100, 5, strtext("percentage"));
}
#endif /* defined(HAVE_PCM_SUPPORT) || defined(HAVE_MIDI_SUPPORT) || defined(HAVE_FM_SUPPORT) */
#ifdef HAVE_MIDI_SUPPORT
MenuString *
makeMidiInstrumentMenuStrings (void) {
MenuString *strings = malloc(midiInstrumentCount * sizeof(*strings));
if (strings) {
unsigned int instrument;
for (instrument=0; instrument<midiInstrumentCount; instrument+=1) {
MenuString *string = &strings[instrument];
string->label = midiInstrumentTable[instrument];
string->comment = midiGetInstrumentType(instrument);
}
}
return strings;
}
#endif /* HAVE_MIDI_SUPPORT */
static Menu *
makePreferencesMenu (void) {
static const MenuString cursorStyles[] = {
{.label=strtext("Underline"), .comment=strtext("dots 7 and 8")},
{.label=strtext("Block"), .comment=strtext("all dots")},
{.label=strtext("Lower Left Dot"), .comment=strtext("dot 7")},
{.label=strtext("Lower Right Dot"), .comment=strtext("dot 8")}
};
Menu *rootMenu = newMenu();
if (!rootMenu) goto noMenu;
{
NAME(strtext("Save on Exit"));
ITEM(newBooleanMenuItem(rootMenu, &prefs.saveOnExit, &itemName));
}
{
SUBMENU(optionsSubmenu, rootMenu, strtext("Menu Options"));
{
NAME(strtext("Show Submenu Sizes"));
ITEM(newBooleanMenuItem(optionsSubmenu, &prefs.showSubmenuSizes, &itemName));
}
{
NAME(strtext("Show Advanced Submenus"));
ITEM(newBooleanMenuItem(optionsSubmenu, &prefs.showAdvancedSubmenus, &itemName));
}
{
NAME(strtext("Show All Items"));
ITEM(newBooleanMenuItem(optionsSubmenu, &prefs.showAllItems, &itemName));
}
}
{
SUBMENU(presentationSubmenu, rootMenu, strtext("Braille Presentation"));
{
static const MenuString strings[] = {
{.label=strtext("8-Dot Computer Braille")},
{.label=strtext("Contracted Braille")},
{.label=strtext("6-Dot Computer Braille")}
};
NAME(strtext("Text Style"));
ITEM(newEnumeratedMenuItem(presentationSubmenu, &prefs.textStyle, &itemName, strings));
}
#ifdef ENABLE_CONTRACTED_BRAILLE
{
NAME(strtext("Expand Current Word"));
ITEM(newBooleanMenuItem(presentationSubmenu, &prefs.expandCurrentWord, &itemName));
TEST(ContractedBraille);
}
{
static const MenuString strings[] = {
{.label=strtext("No Capitalization")},
{.label=strtext("Use Capital Sign")},
{.label=strtext("Superimpose Dot 7")}
};
NAME(strtext("Capitalization Mode"));
ITEM(newEnumeratedMenuItem(presentationSubmenu, &prefs.capitalizationMode, &itemName, strings));
TEST(ContractedBraille);
}
#endif /* ENABLE_CONTRACTED_BRAILLE */
{
static const MenuString strings[] = {
{.label=strtext("Minimum")},
{.label=strtext("Low")},
{.label=strtext("Medium")},
{.label=strtext("High")},
{.label=strtext("Maximum")}
};
NAME(strtext("Braille Firmness"));
ITEM(newEnumeratedMenuItem(presentationSubmenu, &prefs.brailleFirmness, &itemName, strings));
TEST(BrailleFirmness);
CHANGED(BrailleFirmness);
}
}
{
SUBMENU(indicatorsSubmenu, rootMenu, strtext("Text Indicators"));
{
NAME(strtext("Show Cursor"));
ITEM(newBooleanMenuItem(indicatorsSubmenu, &prefs.showCursor, &itemName));
}
{
NAME(strtext("Cursor Style"));
ITEM(newEnumeratedMenuItem(indicatorsSubmenu, &prefs.cursorStyle, &itemName, cursorStyles));
TEST(ShowCursor);
}
{
NAME(strtext("Blinking Cursor"));
ITEM(newBooleanMenuItem(indicatorsSubmenu, &prefs.blinkingCursor, &itemName));
TEST(ShowCursor);
}
{
NAME(strtext("Cursor Visible Time"));
ITEM(newTimeMenuItem(indicatorsSubmenu, &prefs.cursorVisibleTime, &itemName));
TEST(BlinkingCursor);
}
{
NAME(strtext("Cursor Invisible Time"));
ITEM(newTimeMenuItem(indicatorsSubmenu, &prefs.cursorInvisibleTime, &itemName));
TEST(BlinkingCursor);
}
{
NAME(strtext("Show Attributes"));
ITEM(newBooleanMenuItem(indicatorsSubmenu, &prefs.showAttributes, &itemName));
}
{
NAME(strtext("Blinking Attributes"));
ITEM(newBooleanMenuItem(indicatorsSubmenu, &prefs.blinkingAttributes, &itemName));
TEST(ShowAttributes);
}
{
NAME(strtext("Attributes Visible Time"));
ITEM(newTimeMenuItem(indicatorsSubmenu, &prefs.attributesVisibleTime, &itemName));
TEST(BlinkingAttributes);
}
{
NAME(strtext("Attributes Invisible Time"));
ITEM(newTimeMenuItem(indicatorsSubmenu, &prefs.attributesInvisibleTime, &itemName));
TEST(BlinkingAttributes);
}
{
NAME(strtext("Blinking Capitals"));
ITEM(newBooleanMenuItem(indicatorsSubmenu, &prefs.blinkingCapitals, &itemName));
}
{
NAME(strtext("Capitals Visible Time"));
ITEM(newTimeMenuItem(indicatorsSubmenu, &prefs.capitalsVisibleTime, &itemName));
TEST(BlinkingCapitals);
}
{
NAME(strtext("Capitals Invisible Time"));
ITEM(newTimeMenuItem(indicatorsSubmenu, &prefs.capitalsInvisibleTime, &itemName));
TEST(BlinkingCapitals);
}
}
{
SUBMENU(navigationSubmenu, rootMenu, strtext("Navigation Options"));
{
NAME(strtext("Skip Identical Lines"));
ITEM(newBooleanMenuItem(navigationSubmenu, &prefs.skipIdenticalLines, &itemName));
}
{
NAME(strtext("Skip Blank Windows"));
ITEM(newBooleanMenuItem(navigationSubmenu, &prefs.skipBlankWindows, &itemName));
}
{
static const MenuString strings[] = {
{.label=strtext("All")},
{.label=strtext("End of Line")},
{.label=strtext("Rest of Line")}
};
NAME(strtext("Skip Which Blank Windows"));
ITEM(newEnumeratedMenuItem(navigationSubmenu, &prefs.skipBlankWindowsMode, &itemName, strings));
}
{
NAME(strtext("Sliding Window"));
ITEM(newBooleanMenuItem(navigationSubmenu, &prefs.slidingWindow, &itemName));
}
{
NAME(strtext("Eager Sliding Window"));
ITEM(newBooleanMenuItem(navigationSubmenu, &prefs.eagerSlidingWindow, &itemName));
TEST(SlidingWindow);
}
{
NAME(strtext("Window Overlap"));
ITEM(newNumericMenuItem(navigationSubmenu, &prefs.windowOverlap, &itemName, 0, 20, 1, strtext("cells")));
CHANGED(WindowOverlap);
}
#ifdef HAVE_LIBGPM
{
NAME(strtext("Window Follows Pointer"));
ITEM(newBooleanMenuItem(navigationSubmenu, &prefs.windowFollowsPointer, &itemName));
}
#endif /* HAVE_LIBGPM */
{
NAME(strtext("Highlight Window"));
ITEM(newBooleanMenuItem(navigationSubmenu, &prefs.highlightWindow, &itemName));
}
}
{
SUBMENU(inputSubmenu, rootMenu, strtext("Input Options"));
{
NAME(strtext("Long Press Time"));
ITEM(newTimeMenuItem(inputSubmenu, &prefs.longPressTime, &itemName));
CHANGED(AutorepeatDelay);
}
{
NAME(strtext("Autorepeat"));
ITEM(newBooleanMenuItem(inputSubmenu, &prefs.autorepeat, &itemName));
CHANGED(Autorepeat);
}
{
NAME(strtext("Autorepeat Panning"));
ITEM(newBooleanMenuItem(inputSubmenu, &prefs.autorepeatPanning, &itemName));
TEST(Autorepeat);
}
{
NAME(strtext("Autorepeat Interval"));
ITEM(newTimeMenuItem(inputSubmenu, &prefs.autorepeatInterval, &itemName));
TEST(Autorepeat);
CHANGED(AutorepeatInterval);
}
{
static const MenuString strings[] = {
{.label=strtext("Minimum")},
{.label=strtext("Low")},
{.label=strtext("Medium")},
{.label=strtext("High")},
{.label=strtext("Maximum")}
};
NAME(strtext("Braille Sensitivity"));
ITEM(newEnumeratedMenuItem(inputSubmenu, &prefs.brailleSensitivity, &itemName, strings));
TEST(BrailleSensitivity);
CHANGED(BrailleSensitivity);
}
{
static const MenuString strings[] = {
{.label=strtext("Translated via Text Table")},
{.label=strtext("Dots via Unicode Braille")}
};
NAME(strtext("Braille Input Mode"));
ITEM(newEnumeratedMenuItem(inputSubmenu, &prefs.brailleInputMode, &itemName, strings));
}
{
static const MenuString strings[] = {
{.label=strtext("Normal")},
{.label=strtext("Rotated")}
};
NAME(strtext("Braille Display Orientation"));
ITEM(newEnumeratedMenuItem(inputSubmenu, &prefs.brailleDisplayOrientation, &itemName, strings));
TEST(BrailleDisplayOrientation);
}
}
{
SUBMENU(alertsSubmenu, rootMenu, strtext("Event Alerts"));
{
NAME(strtext("Alert Tunes"));
ITEM(newBooleanMenuItem(alertsSubmenu, &prefs.alertTunes, &itemName));
}
{
static const MenuString strings[] = {
{.label=strtext("Beeper"), .comment=strtext("console tone generator")},
{.label=strtext("PCM"), .comment=strtext("soundcard digital audio")},
{.label=strtext("MIDI"), .comment=strtext("Musical Instrument Digital Interface")},
{.label=strtext("FM"), .comment=strtext("soundcard synthesizer")}
};
NAME(strtext("Tune Device"));
ITEM(newEnumeratedMenuItem(alertsSubmenu, &prefs.tuneDevice, &itemName, strings));
TEST(Tunes);
CHANGED(TuneDevice);
}
#ifdef HAVE_PCM_SUPPORT
{
NAME(strtext("PCM Volume"));
ITEM(newVolumeMenuItem(alertsSubmenu, &prefs.pcmVolume, &itemName));
TEST(TunesPcm);
}
#endif /* HAVE_PCM_SUPPORT */
#ifdef HAVE_MIDI_SUPPORT
{
NAME(strtext("MIDI Volume"));
ITEM(newVolumeMenuItem(alertsSubmenu, &prefs.midiVolume, &itemName));
TEST(TunesMidi);
}
{
const MenuString *strings = makeMidiInstrumentMenuStrings();
if (!strings) goto noItem;
{
NAME(strtext("MIDI Instrument"));
ITEM(newStringsMenuItem(alertsSubmenu, &prefs.midiInstrument, &itemName, strings, midiInstrumentCount));
TEST(TunesMidi);
}
}
#endif /* HAVE_MIDI_SUPPORT */
#ifdef HAVE_FM_SUPPORT
{
NAME(strtext("FM Volume"));
ITEM(newVolumeMenuItem(alertsSubmenu, &prefs.fmVolume, &itemName));
TEST(TunesFm);
}
#endif /* HAVE_FM_SUPPORT */
{
NAME(strtext("Alert Dots"));
ITEM(newBooleanMenuItem(alertsSubmenu, &prefs.alertDots, &itemName));
}
{
NAME(strtext("Alert Messages"));
ITEM(newBooleanMenuItem(alertsSubmenu, &prefs.alertMessages, &itemName));
}
}
#ifdef ENABLE_SPEECH_SUPPORT
{
SUBMENU(speechSubmenu, rootMenu, strtext("Speech Options"));
{
NAME(strtext("Speech Volume"));
ITEM(newNumericMenuItem(speechSubmenu, &prefs.speechVolume, &itemName, 0, SPK_VOLUME_MAXIMUM, 1, NULL));
TEST(SpeechVolume);
CHANGED(SpeechVolume);
}
{
NAME(strtext("Speech Rate"));
ITEM(newNumericMenuItem(speechSubmenu, &prefs.speechRate, &itemName, 0, SPK_RATE_MAXIMUM, 1, NULL));
TEST(SpeechRate);
CHANGED(SpeechRate);
}
{
NAME(strtext("Speech Pitch"));
ITEM(newNumericMenuItem(speechSubmenu, &prefs.speechPitch, &itemName, 0, SPK_PITCH_MAXIMUM, 1, NULL));
TEST(SpeechPitch);
CHANGED(SpeechPitch);
}
{
static const MenuString strings[] = {
{.label=strtext("None")},
{.label=strtext("Some")},
{.label=strtext("All")}
};
NAME(strtext("Speech Punctuation"));
ITEM(newEnumeratedMenuItem(speechSubmenu, &prefs.speechPunctuation, &itemName, strings));
TEST(SpeechPunctuation);
CHANGED(SpeechPunctuation);
}
{
static const MenuString strings[] = {
{.label=strtext("None")},
// "cap" here, used during speech output, is short for "capital".
// It is spoken just before an uppercase letter, e.g. "cap A".
{.label=strtext("Say Cap")},
{.label=strtext("Raise Pitch")}
};
NAME(strtext("Uppercase Indicator"));
ITEM(newEnumeratedMenuItem(speechSubmenu, &prefs.uppercaseIndicator, &itemName, strings));
}
{
static const MenuString strings[] = {
{.label=strtext("None")},
{.label=strtext("Say Space")},
};
NAME(strtext("Whitespace Indicator"));
ITEM(newEnumeratedMenuItem(speechSubmenu, &prefs.whitespaceIndicator, &itemName, strings));
}
{
static const MenuString strings[] = {
{.label=strtext("Immediate")},
{.label=strtext("Enqueue")}
};
NAME(strtext("Say Line Mode"));
ITEM(newEnumeratedMenuItem(speechSubmenu, &prefs.sayLineMode, &itemName, strings));
}
{
NAME(strtext("Autospeak"));
ITEM(newBooleanMenuItem(speechSubmenu, &prefs.autospeak, &itemName));
}
{
NAME(strtext("Speak Selected Line"));
ITEM(newBooleanMenuItem(speechSubmenu, &prefs.autospeakSelectedLine, &itemName));
TEST(Autospeak);
}
{
NAME(strtext("Speak Selected Character"));
ITEM(newBooleanMenuItem(speechSubmenu, &prefs.autospeakSelectedCharacter, &itemName));
TEST(Autospeak);
}
{
NAME(strtext("Speak Inserted Characters"));
ITEM(newBooleanMenuItem(speechSubmenu, &prefs.autospeakInsertedCharacters, &itemName));
TEST(Autospeak);
}
{
NAME(strtext("Speak Deleted Characters"));
ITEM(newBooleanMenuItem(speechSubmenu, &prefs.autospeakDeletedCharacters, &itemName));
TEST(Autospeak);
}
{
NAME(strtext("Speak Replaced Characters"));
ITEM(newBooleanMenuItem(speechSubmenu, &prefs.autospeakReplacedCharacters, &itemName));
TEST(Autospeak);
}
{
NAME(strtext("Speak Completed Words"));
ITEM(newBooleanMenuItem(speechSubmenu, &prefs.autospeakCompletedWords, &itemName));
TEST(Autospeak);
}
{
NAME(strtext("Show Speech Cursor"));
ITEM(newBooleanMenuItem(speechSubmenu, &prefs.showSpeechCursor, &itemName));
}
{
NAME(strtext("Speech Cursor Style"));
ITEM(newEnumeratedMenuItem(speechSubmenu, &prefs.speechCursorStyle, &itemName, cursorStyles));
TEST(ShowSpeechCursor);
}
{
NAME(strtext("Blinking Speech Cursor"));
ITEM(newBooleanMenuItem(speechSubmenu, &prefs.blinkingSpeechCursor, &itemName));
TEST(ShowSpeechCursor);
}
{
NAME(strtext("Speech Cursor Visible Time"));
ITEM(newTimeMenuItem(speechSubmenu, &prefs.speechCursorVisibleTime, &itemName));
TEST(BlinkingSpeechCursor);
}
{
NAME(strtext("Speech Cursor Invisible Time"));
ITEM(newTimeMenuItem(speechSubmenu, &prefs.speechCursorInvisibleTime, &itemName));
TEST(BlinkingSpeechCursor);
}
}
#endif /* ENABLE_SPEECH_SUPPORT */
{
SUBMENU(timeSubmenu, rootMenu, strtext("Time Presentation"));
{
static const MenuString strings[] = {
{.label=strtext("24 Hour")},
{.label=strtext("12 Hour")}
};
NAME(strtext("Time Format"));
ITEM(newEnumeratedMenuItem(timeSubmenu, &prefs.timeFormat, &itemName, strings));
}
{
static const MenuString strings[] = {
{.label=strtext("Colon"), ":"},
{.label=strtext("Dot"), "."},
};
NAME(strtext("Time Separator"));
ITEM(newEnumeratedMenuItem(timeSubmenu, &prefs.timeSeparator, &itemName, strings));
}
{
NAME(strtext("Show Seconds"));
ITEM(newBooleanMenuItem(timeSubmenu, &prefs.showSeconds, &itemName));
}
{
static const MenuString strings[] = {
{.label=strtext("None")},
{.label=strtext("Before Time")},
{.label=strtext("After Time")}
};
NAME(strtext("Date Position"));
ITEM(newEnumeratedMenuItem(timeSubmenu, &prefs.datePosition, &itemName, strings));
}
{
static const MenuString strings[] = {
{.label=strtext("Year Month Day")},
{.label=strtext("Month Day Year")},
{.label=strtext("Day Month Year")},
};
NAME(strtext("Date Format"));
ITEM(newEnumeratedMenuItem(timeSubmenu, &prefs.dateFormat, &itemName, strings));
TEST(ShowDate);
}
{
static const MenuString strings[] = {
{.label=strtext("Dash"), "-"},
{.label=strtext("Slash"), "/"},
{.label=strtext("Dot"), "."}
};
NAME(strtext("Date Separator"));
ITEM(newEnumeratedMenuItem(timeSubmenu, &prefs.dateSeparator, &itemName, strings));
TEST(ShowDate);
}
}
{
SUBMENU(statusSubmenu, rootMenu, strtext("Status Cells"));
{
static const MenuString strings[] = {
{.label=strtext("None")},
{.label=strtext("Left")},
{.label=strtext("Right")}
};
NAME(strtext("Status Position"));
ITEM(newEnumeratedMenuItem(statusSubmenu, &prefs.statusPosition, &itemName, strings));
TEST(StatusPosition);
CHANGED(StatusPosition);
}
{
NAME(strtext("Status Count"));
ITEM(newNumericMenuItem(statusSubmenu, &prefs.statusCount, &itemName, 0, MAX((int)brl.textColumns/2-1, 0), 1, strtext("cells")));
TEST(StatusCount);
CHANGED(StatusCount);
}
{
static const MenuString strings[] = {
{.label=strtext("None")},
{.label=strtext("Space")},
{.label=strtext("Block")},
{.label=strtext("Status Side")},
{.label=strtext("Text Side")}
};
NAME(strtext("Status Separator"));
ITEM(newEnumeratedMenuItem(statusSubmenu, &prefs.statusSeparator, &itemName, strings));
TEST(StatusSeparator);
CHANGED(StatusSeparator);
}
{
#define STATUS_FIELD_ITEM(number) { ITEM(newStatusFieldMenuItem(statusSubmenu, number, testStatusField##number, changedStatusField##number)); }
STATUS_FIELD_ITEM(1);
STATUS_FIELD_ITEM(2);
STATUS_FIELD_ITEM(3);
STATUS_FIELD_ITEM(4);
STATUS_FIELD_ITEM(5);
STATUS_FIELD_ITEM(6);
STATUS_FIELD_ITEM(7);
STATUS_FIELD_ITEM(8);
STATUS_FIELD_ITEM(9);
#undef STATUS_FIELD_ITEM
}
}
{
SUBMENU(tablesSubmenu, rootMenu, strtext("Braille Tables"));
{
NAME(strtext("Text Table"));
ITEM(newFilesMenuItem(tablesSubmenu, &itemName, opt_tablesDirectory, TEXT_TABLES_SUBDIRECTORY, TEXT_TABLE_EXTENSION, opt_textTable, 0));
CHANGED(TextTable);
SET(textTable);
}
{
NAME(strtext("Attributes Table"));
ITEM(newFilesMenuItem(tablesSubmenu, &itemName, opt_tablesDirectory, ATTRIBUTES_TABLES_SUBDIRECTORY, ATTRIBUTES_TABLE_EXTENSION, opt_attributesTable, 0));
CHANGED(AttributesTable);
SET(attributesTable);
}
#ifdef ENABLE_CONTRACTED_BRAILLE
{
NAME(strtext("Contraction Table"));
ITEM(newFilesMenuItem(tablesSubmenu, &itemName, opt_tablesDirectory, CONTRACTION_TABLES_SUBDIRECTORY, CONTRACTION_TABLE_EXTENSION, opt_contractionTable, 1));
CHANGED(ContractionTable);
SET(contractionTable);
}
#endif /* ENABLE_CONTRACTED_BRAILLE */
{
NAME(strtext("Keyboard Table"));
ITEM(newFilesMenuItem(tablesSubmenu, &itemName, opt_tablesDirectory, KEYBOARD_TABLES_SUBDIRECTORY, KEY_TABLE_EXTENSION, opt_keyboardTable, 1));
CHANGED(KeyboardTable);
SET(keyboardTable);
}
}
{
SUBMENU(profilesSubmenu, rootMenu, strtext("Profiles"));
{
ITEM(newProfileMenuItem(profilesSubmenu, &languageProfile));
CHANGED(LanguageProfile);
SET(languageProfile);
}
}
{
SUBMENU(buildSubmenu, rootMenu, strtext("Build Information"));
setAdvancedSubmenu(buildSubmenu);
{
NAME(strtext("Package Version"));
ITEM(newTextMenuItem(buildSubmenu, &itemName, PACKAGE_VERSION));
}
{
NAME(strtext("Package Revision"));
ITEM(newTextMenuItem(buildSubmenu, &itemName, getRevisionIdentifier()));
}
{
NAME(strtext("Web Site"));
ITEM(newTextMenuItem(buildSubmenu, &itemName, PACKAGE_URL));
}
{
NAME(strtext("Bug Reports"));
ITEM(newTextMenuItem(buildSubmenu, &itemName, PACKAGE_BUGREPORT));
}
{
NAME(strtext("Configuration Directory"));
ITEM(newTextMenuItem(buildSubmenu, &itemName, CONFIGURATION_DIRECTORY));
}
{
NAME(strtext("Configuration File"));
ITEM(newTextMenuItem(buildSubmenu, &itemName, CONFIGURATION_FILE));
}
{
NAME(strtext("Tables Directory"));
ITEM(newTextMenuItem(buildSubmenu, &itemName, TABLES_DIRECTORY));
}
{
NAME(strtext("Drivers Directory"));
ITEM(newTextMenuItem(buildSubmenu, &itemName, DRIVERS_DIRECTORY));
}
{
NAME(strtext("State Directory"));
ITEM(newTextMenuItem(buildSubmenu, &itemName, STATE_DIRECTORY));
}
{
NAME(strtext("Preferences File"));
ITEM(newTextMenuItem(buildSubmenu, &itemName, PREFERENCES_FILE));
}
{
NAME(strtext("Writable Directory"));
ITEM(newTextMenuItem(buildSubmenu, &itemName, WRITABLE_DIRECTORY));
}
{
NAME(strtext("Locale Directory"));
ITEM(newTextMenuItem(buildSubmenu, &itemName, LOCALE_DIRECTORY));
}
}
{
static const MenuString logLevels[] = {
{.label=strtext("Emergency")},
{.label=strtext("Alert")},
{.label=strtext("Critical")},
{.label=strtext("Error")},
{.label=strtext("Warning")},
{.label=strtext("Notice")},
{.label=strtext("Information")},
{.label=strtext("Debug")}
};
SUBMENU(internalSubmenu, rootMenu, strtext("Internal Parameters"));
setAdvancedSubmenu(internalSubmenu);
{
NAME(strtext("System Log Level"));
ITEM(newEnumeratedMenuItem(internalSubmenu, &systemLogLevel, &itemName, logLevels));
}
{
NAME(strtext("Standard Error Log Level"));
ITEM(newEnumeratedMenuItem(internalSubmenu, &stderrLogLevel, &itemName, logLevels));
}
{
NAME(strtext("Category Log Level"));
ITEM(newEnumeratedMenuItem(internalSubmenu, &categoryLogLevel, &itemName, logLevels));
}
{
SUBMENU(logCategoriesSubmenu, internalSubmenu, strtext("Log Categories"));
setAdvancedSubmenu(logCategoriesSubmenu);
{
LogCategoryIndex category;
for (category=0; category<LOG_CATEGORY_COUNT; category+=1) {
const char *description = getLogCategoryTitle(category);
if (description && *description) {
MenuString *name;
if (!(name = malloc(sizeof(*name)))) goto noItem;
memset(name, 0, sizeof(*name));
name->label = description;
{
ITEM(newBooleanMenuItem(logCategoriesSubmenu, &logCategoryFlags[category], name));
switch (category) {
case LOG_CATEGORY_INDEX(BRAILLE_KEYS):
TEST(InputTable);
break;
case LOG_CATEGORY_INDEX(KEYBOARD_KEYS):
TEST(KeyboardTable);
break;
default:
break;
}
}
}
}
}
}
}
{
SUBMENU(toolsSubmenu, rootMenu, strtext("Tools"));
setAdvancedSubmenu(toolsSubmenu);
{
NAME(strtext("Restart Braille Driver"));
ITEM(newToolMenuItem(toolsSubmenu, &itemName, restartBrailleDriver));
}
#ifdef ENABLE_SPEECH_SUPPORT
{
NAME(strtext("Restart Speech Driver"));
ITEM(newToolMenuItem(toolsSubmenu, &itemName, restartSpeechDriver));
}
#endif /* ENABLE_SPEECH_SUPPORT */
{
NAME(strtext("Restart Screen Driver"));
ITEM(newToolMenuItem(toolsSubmenu, &itemName, restartScreenDriver));
}
}
return rootMenu;
noItem:
destroyMenu(rootMenu);
noMenu:
return NULL;
}
Menu *
getPreferencesMenu (void) {
static Menu *menu = NULL;
if (!menu) menu = makePreferencesMenu();
return menu;
}
|