1 #if !defined(lint) && !defined(DOS)
2 static char rcsid
[] = "$Id: keymenu.c 1074 2008-06-04 00:08:43Z hubert@u.washington.edu $";
6 * ========================================================================
7 * Copyright 2013-2018 Eduardo Chappa
8 * Copyright 2006-2008 University of Washington
10 * Licensed under the Apache License, Version 2.0 (the "License");
11 * you may not use this file except in compliance with the License.
12 * You may obtain a copy of the License at
14 * http://www.apache.org/licenses/LICENSE-2.0
16 * ========================================================================
24 #include "../pith/bitmap.h"
25 #include "../pith/conf.h"
26 #include "../pith/state.h"
30 * We put all of the keymenu definitions here so that it is easy to
31 * share them. The names are in keymenu.h, as well. Some of these
32 * aren't easily shareable because we modify them dynamically but
33 * here they are anyway. It's not altogether clear that this is a good idea.
34 * Perhaps it would be better to just define the keymenus multiple times
35 * in different source files even though they are the same, with static
38 * The key numbers are sometimes used symbolically, like OTHER_KEY. Those
39 * are in keymenu.h, too, and are hard to use. If you change a menu here
40 * be sure to check those key numbers that go with it in keymenu.h.
44 void configure_menu_items (struct key_menu
*, bitmap_t
);
49 * Macro to simplify instantiation of key_menu structs from key structs
51 #define INST_KEY_MENU(X, Y) struct key_menu X = \
52 {sizeof(Y)/(sizeof(Y[0])*12), 0, 0, Y}
54 struct key cancel_keys
[] =
56 {"^C",N_("Cancel"),{MC_NONE
},KS_NONE
},
67 INST_KEY_MENU(cancel_keymenu
, cancel_keys
);
71 * A bunch of these are NULL_MENU because we want to change them dynamically.
73 struct key ab_keys
[] =
78 /* TRANSLATORS: go to Previous Entry */
79 {"P", N_("PrevEntry"), {MC_PREVITEM
,1,{'p'}}, KS_NONE
},
80 /* TRANSLATORS: go to Next Entry */
81 {"N", N_("NextEntry"), {MC_NEXTITEM
,1,{'n'}}, KS_NONE
},
104 /* TRANSLATORS: Select this Entry */
105 {";",N_("Select"),{MC_SELECT
,1,{';'}},KS_NONE
},
106 /* TRANSLATORS: Apply a command to several objects at once */
107 {"A",N_("Apply"),{MC_APPLY
,1,{'a'}},KS_APPLY
},
108 /* TRANSLATORS: Select Current entry */
109 {":",N_("SelectCur"),{MC_SELCUR
,1,{':'}},KS_SELECTCUR
},
110 /* TRANSLATORS: Zoom refers to zooming in on a smaller set of
111 items, like with a camera zoom lense */
112 {"Z",N_("ZoomMode"),{MC_ZOOM
,1,{'z'}},KS_NONE
},
120 INST_KEY_MENU(ab_keymenu
, ab_keys
);
123 struct key abook_select_keys
[] =
126 {"E", N_("Exit"), {MC_EXIT
,1,{'e'}}, KS_EXITMODE
},
127 {"S", "[" N_("Select") "]", {MC_CHOICE
,3,{'s',ctrl('M'),ctrl('J')}}, KS_NONE
},
128 /* TRANSLATORS: go to Previous entry */
129 {"P", N_("Prev"), {MC_PREVITEM
, 1, {'p'}}, KS_NONE
},
130 {"N", N_("Next"), {MC_NEXTITEM
, 2, {'n', TAB
}}, KS_NONE
},
137 INST_KEY_MENU(abook_select_km
, abook_select_keys
);
140 struct key abook_view_keys
[] =
143 /* TRANSLATORS: Abook is an abbreviation for Address Book */
144 {"<",N_("Abook"),{MC_EXIT
,2,{'<',','}},KS_NONE
},
145 {"U",N_("Update"),{MC_EDIT
,1,{'u'}},KS_NONE
},
146 /* TRANSLATORS: ComposeTo means to start editing a new message to
147 this address book entry */
148 {"C",N_("ComposeTo"),{MC_COMPOSE
,1,{'c'}},KS_COMPOSER
},
154 /* TRANSLATORS: abbreviation for Forward as Email */
155 {"F", N_("Fwd Email"), {MC_FORWARD
, 1, {'f'}}, KS_FORWARD
},
160 /* TRANSLATORS: View the highlighted link, for example, a URL */
161 {"V",N_("ViewLink"),{MC_VIEW_HANDLE
,3,{'v',ctrl('m'),ctrl('j')}},KS_NONE
},
163 /* TRANSLATORS: go to the previous link, for example, the previous URL */
164 {"^B",N_("PrevLink"),{MC_PREV_HANDLE
,1,{ctrl('B')}},KS_NONE
},
165 {"^F",N_("NextLink"),{MC_NEXT_HANDLE
,1,{ctrl('F')}},KS_NONE
},
172 INST_KEY_MENU(abook_view_keymenu
, abook_view_keys
);
175 struct key abook_text_keys
[] =
178 {"E",N_("Exit Viewer"),{MC_EXIT
,1,{'e'}},KS_NONE
},
187 {"S", N_("Save"), {MC_SAVETEXT
,1,{'s'}}, KS_SAVE
}};
188 INST_KEY_MENU(abook_text_km
, abook_text_keys
);
191 struct key ldap_view_keys
[] =
194 /* TRANSLATORS: go back to the index of results instead of
195 viewing this particular entry */
196 {"<",N_("Results Index"),{MC_EXIT
,2,{'<',','}},KS_NONE
},
198 {"C", N_("ComposeTo"), {MC_COMPOSE
,1,{'c'}}, KS_COMPOSER
},
209 {"V",N_("ViewLink"),{MC_VIEW_HANDLE
,3,{'v',ctrl('m'),ctrl('j')}},KS_NONE
},
211 {"^B",N_("PrevLink"),{MC_PREV_HANDLE
,1,{ctrl('B')}},KS_NONE
},
212 {"^F",N_("NextLink"),{MC_NEXT_HANDLE
,1,{ctrl('F')}},KS_NONE
},
219 INST_KEY_MENU(ldap_view_keymenu
, ldap_view_keys
);
222 struct key context_mgr_keys
[] =
225 {"<", N_("Main Menu"), {MC_MAIN
,3,{'m','<',','}}, KS_EXITMODE
},
226 /* TRANSLATORS: View this Collection of folders */
227 {">", "[" N_("View Cltn") "]",
228 {MC_CHOICE
,5,{'v','>','.',ctrl('M'),ctrl('J')}}, KS_NONE
},
250 INST_KEY_MENU(c_mgr_km
, context_mgr_keys
);
253 struct key context_cfg_keys
[] =
256 {"E", N_("Exit Setup"), {MC_EXIT
,1,{'e'}}, KS_EXITMODE
},
257 {"C", "[" N_("Change") "]", {MC_EDIT
,3,{'c',ctrl('M'),ctrl('J')}}, KS_NONE
},
262 /* TRANSLATORS; Add a Collection of folders */
263 {"A", N_("Add Cltn"), {MC_ADD
,1,{'a'}}, KS_NONE
},
265 /* TRANSLATORS; Change the order of items in a list */
266 {"$", N_("Shuffle"), {MC_SHUFFLE
,1,{'$'}},KS_NONE
},
281 INST_KEY_MENU(c_cfg_km
, context_cfg_keys
);
284 struct key context_select_keys
[] =
286 {"E", N_("ExitSelect"), {MC_EXIT
,1,{'e'}}, KS_EXITMODE
},
288 /* TRANSLATORS: View this collection */
289 {">", "[" N_("View Cltn") "]",
290 {MC_CHOICE
, 5, {'v','>','.',ctrl('M'),ctrl('J')}}, KS_NONE
},
299 INST_KEY_MENU(c_sel_km
, context_select_keys
);
302 struct key context_fcc_keys
[] =
304 {"E", N_("ExitSelect"), {MC_EXIT
,1,{'e'}}, KS_EXITMODE
},
306 {">", "[" N_("View Cltn") "]",
307 {MC_CHOICE
, 5, {'v','>','.',ctrl('M'),ctrl('J')}}, KS_NONE
},
316 INST_KEY_MENU(c_fcc_km
, context_fcc_keys
);
318 struct key folder_keys
[] =
321 {"<", NULL
, {MC_EXIT
,2,{'<',','}}, KS_NONE
},
322 {">", NULL
, {MC_CHOICE
,2,{'>','.'}}, KS_NONE
},
327 /* TRANSLATORS: make an addition, for example add a new folder
328 or a new entry in an address book */
329 {"A",N_("Add"),{MC_ADDFLDR
,1,{'a'}},KS_NONE
},
331 /* TRANSLATORS: change the name of something */
332 {"R",N_("Rename"),{MC_RENAMEFLDR
,1,{'r'}}, KS_NONE
},
339 {"V", "[" N_("View Fldr") "]", {MC_OPENFLDR
}, KS_NONE
},
343 {"%", N_("Print"), {MC_PRINTFLDR
,1,{'%'}}, KS_PRINT
},
344 {"Z", N_("ZoomMode"), {MC_ZOOM
,1,{'z'}}, KS_NONE
},
345 {";",N_("Select"),{MC_SELECT
,1,{';'}},KS_SELECT
},
346 /* TRANSLATORS: Select current item */
347 {":",N_("SelectCur"),{MC_SELCUR
,1,{':'}},KS_SELECT
},
355 {"$", N_("Shuffle"), {MC_SHUFFLE
,1,{'$'}},KS_NONE
},
358 /* TRANSLATORS: Import refers to bringing something in from
359 outside of alpine's normal world */
360 {"U", N_("Import"), {MC_IMPORT
,1,{'u'}},KS_NONE
},
363 INST_KEY_MENU(folder_km
, folder_keys
);
366 struct key folder_sel_keys
[] =
368 {"E", N_("ExitSelect"), {MC_EXIT
,1,{'e'}}, KS_EXITMODE
},
370 {NULL
, NULL
, {MC_CHOICE
,0}, KS_NONE
},
375 {"S", N_("Select"), {MC_OPENFLDR
,1,{'s'}}, KS_NONE
},
392 INST_KEY_MENU(folder_sel_km
, folder_sel_keys
);
395 struct key folder_sela_keys
[] =
397 {"E", N_("ExitSelect"), {MC_EXIT
,1,{'e'}}, KS_EXITMODE
},
399 {NULL
, NULL
, {MC_CHOICE
,0}, KS_NONE
},
404 {"S", N_("Select"), {MC_OPENFLDR
,1,{'s'}}, KS_NONE
},
406 {"A", N_("AddNew"), {MC_ADD
,1,{'a'}}, KS_NONE
},
421 INST_KEY_MENU(folder_sela_km
, folder_sela_keys
);
424 struct key folder_sub_keys
[] =
426 /* TRANSLATORS: Subscribe to a news group */
427 {"S", N_("Subscribe"), {MC_CHOICE
,1,{'s'}}, KS_NONE
},
428 /* TRANSLATORS: Exit Subscribe screen */
429 {"E", N_("ExitSubscb"), {MC_EXIT
,1,{'e'}}, KS_EXITMODE
},
430 {NULL
, "[" N_("Select") "]", {MC_CHOICE
,3,{'s',ctrl('M'),ctrl('J')}}, KS_NONE
},
435 /* TRANSLATORS: List Mode in alpine is where you can select not just
436 one of something but you can select a whole list of something, for
437 example a whole list of addresses to send to. */
438 {"L", N_("List Mode"), {MC_LISTMODE
, 1, {'l'}}, KS_NONE
},
455 INST_KEY_MENU(folder_sub_km
, folder_sub_keys
);
458 struct key folder_post_keys
[] =
461 {"E", N_("ExitSelect"), {MC_EXIT
,1,{'e'}}, KS_EXITMODE
},
462 {"S", "[" N_("Select") "]", {MC_CHOICE
, 3, {'s',ctrl('M'),ctrl('J')}}, KS_NONE
},
471 INST_KEY_MENU(folder_post_km
, folder_post_keys
);
474 struct key help_keys
[] =
476 {NULL
,NULL
,{MC_EXIT
,1,{'e'}}, KS_EXITMODE
},
477 {NULL
,NULL
,{MC_EXIT
,1,{'e'}}, KS_EXITMODE
},
478 {NULL
,NULL
,{MC_VIEW_HANDLE
,3,{'v',ctrl('m'),ctrl('j')}},KS_NONE
},
479 {"^B",N_("PrevLink"),{MC_PREV_HANDLE
,1,{ctrl('B')}},KS_NONE
},
480 {"^F",N_("NextLink"),{MC_NEXT_HANDLE
,1,{ctrl('F')}},KS_NONE
},
484 {"Z",N_("Print All"),{MC_PRINTALL
,1,{'z'}},KS_NONE
},
485 {"N",N_("Name"),{MC_EXPORT
,1,{'n'}},KS_NONE
},
500 INST_KEY_MENU(help_keymenu
, help_keys
);
503 struct key rev_msg_keys
[] =
506 {"E",N_("Exit Viewer"),{MC_EXIT
,1,{'e'}},KS_EXITMODE
},
508 {"T",NULL
,{MC_TOGGLE
,1,{'t'}},KS_NONE
},
509 {"D",NULL
,{MC_JUMP
,1,{'d'}},KS_NONE
},
515 {"S", N_("Save"), {MC_SAVETEXT
,1,{'s'}}, KS_SAVE
},
529 INST_KEY_MENU(rev_msg_keymenu
, rev_msg_keys
);
532 struct key ans_certfail_keys
[] =
536 /* TRANSLATORS: Continue means to keep going. The user is paused to read
537 something and has to tell us to continue when they are finished. */
538 {"C","[" N_("Continue") "]",{MC_YES
,3,{'c',ctrl('J'),ctrl('M')}},KS_NONE
},
547 INST_KEY_MENU(ans_certfail_keymenu
, ans_certfail_keys
);
550 struct key ans_certquery_keys
[] =
553 {"Y",N_("Yes, continue"),{MC_YES
,1,{'y'}},KS_NONE
},
554 {"D","[" N_("Details") "]",{MC_VIEW_HANDLE
,3,{'d',ctrl('M'),ctrl('J')}},KS_NONE
},
555 {"N",N_("No"),{MC_NO
,1,{'n'}},KS_NONE
},
562 {"S", N_("Save"), {MC_SAVETEXT
,1,{'s'}}, KS_SAVE
}};
563 INST_KEY_MENU(ans_certquery_keymenu
, ans_certquery_keys
);
566 struct key forge_keys
[] =
569 {"Y",N_("Yes, continue"),{MC_YES
,1,{'y'}},KS_NONE
},
570 {"N",N_("No"),{MC_NO
,1,{'n'}},KS_NONE
},
578 {"S", N_("Save"), {MC_SAVETEXT
,1,{'s'}}, KS_SAVE
}};
579 INST_KEY_MENU(forge_keymenu
, forge_keys
);
582 struct key listmgr_keys
[] =
585 /* TRANSLATORS: Exit Command List */
586 {"E",N_("Exit CmdList"),{MC_EXIT
,1,{'e'}},KS_EXITMODE
},
587 {"Ret","[" N_("Try Command") "]",{MC_VIEW_HANDLE
,3,
588 {ctrl('m'),ctrl('j'),KEY_RIGHT
}},KS_NONE
},
589 /* TRANSLATORS: go to Previous Command in list */
590 {"^B",N_("Prev Cmd"),{MC_PREV_HANDLE
,1,{ctrl('B')}},KS_NONE
},
591 /* TRANSLATORS: go to Next Command in list */
592 {"^F",N_("Next Cmd"),{MC_NEXT_HANDLE
,1,{ctrl('F')}},KS_NONE
},
599 INST_KEY_MENU(listmgr_keymenu
, listmgr_keys
);
602 struct key index_keys
[] =
605 {"<", NULL
, {MC_FOLDERS
,2,{'<',','}}, KS_NONE
},
631 {"X",NULL
,{MC_EXPUNGE
,1,{'x'}},KS_NONE
},
632 /* TRANSLATORS: this stands for unexclude which is the opposite
633 of the exclude command. Exclude eliminates some messages from
634 the view and unexclude gets them back. */
635 {"&",N_("unXclude"),{MC_UNEXCLUDE
,1,{'&'}},KS_NONE
},
636 {";",N_("Select"),{MC_SELECT
,1,{';'}},KS_SELECT
},
637 {"A",N_("Apply"),{MC_APPLY
,1,{'a'}},KS_APPLY
},
647 {":",N_("SelectCur"),{MC_SELCUR
,1,{':'}},KS_SELECTCUR
},
648 {"Z",N_("ZoomMode"),{MC_ZOOM
,1,{'z'}},KS_ZOOM
},
654 /* TRANSLATORS: toggles a collapsed view or an expanded view
655 of a message thread on and off */
656 {"/",N_("Collapse/Expand"),{MC_COLLAPSE
,1,{'/'}},KS_NONE
},
657 {"@", N_("Quota"), {MC_QUOTA
,1,{'@'}}, KS_NONE
},
659 INST_KEY_MENU(index_keymenu
, index_keys
);
662 struct key simple_index_keys
[] =
664 {"E",N_("ExitSelect"),{MC_EXIT
,1,{'e'}},KS_EXITMODE
},
666 {"S","[" N_("Select") "]",{MC_SELECT
,3,{'s',ctrl('M'),ctrl('J')}},KS_SELECT
},
675 INST_KEY_MENU(simple_index_keymenu
, simple_index_keys
);
678 struct key thread_keys
[] =
681 /* TRANSLATORS: go to the Folder List */
682 {"<", N_("FldrList"), {MC_FOLDERS
,2,{'<',','}}, KS_NONE
},
683 /* TRANSLATORS: View a Thread of messages */
684 {">", "[" N_("ViewThd") "]", {MC_VIEW_ENTRY
,5,{'v','.','>',ctrl('M'),ctrl('J')}},
686 /* TRANSLATORS: go to the Previous Thread */
687 {"P", N_("PrevThd"), {MC_PREVITEM
, 1, {'p'}}, KS_PREVMSG
},
688 /* TRANSLATORS: go to the Next Thread */
689 {"N", N_("NextThd"), {MC_NEXTITEM
, 1, {'n'}}, KS_NEXTMSG
},
712 {"X",NULL
,{MC_EXPUNGE
,1,{'x'}},KS_NONE
},
713 {"&",N_("unXclude"),{MC_UNEXCLUDE
,1,{'&'}},KS_NONE
},
714 {";",N_("Select"),{MC_SELECT
,1,{';'}},KS_SELECT
},
715 {"A",N_("Apply"),{MC_APPLY
,1,{'a'}},KS_APPLY
},
725 {":",N_("SelectCur"),{MC_SELCUR
,1,{':'}},KS_SELECTCUR
},
726 {"Z",N_("ZoomMode"),{MC_ZOOM
,1,{'z'}},KS_ZOOM
},
732 {"/",N_("Collapse/Expand"),{MC_COLLAPSE
,1,{'/'}},KS_NONE
},
733 {"@", N_("Quota"), {MC_QUOTA
,1,{'@'}}, KS_NONE
},
735 INST_KEY_MENU(thread_keymenu
, thread_keys
);
738 struct key att_index_keys
[] =
741 {"<",NULL
,{MC_EXIT
,2,{'<',','}},KS_EXITMODE
},
742 {">","[" N_("View") "]",{MC_VIEW_ATCH
,5,{'v','>','.',ctrl('M'),ctrl('J')}},
744 /* TRANSLATORS: go to Previous Attachment */
745 {"P", N_("PrevAttch"),{MC_PREVITEM
,4,{'p',ctrl('B'),ctrl('P'),KEY_UP
}},
747 /* TRANSLATORS: go to Next Attachment */
748 {"N", N_("NextAtch"),
749 {MC_NEXTITEM
, 5, {'n','\t',ctrl('F'),ctrl('N'), KEY_DOWN
}},
755 {"S", N_("Save"), {MC_SAVETEXT
,1,{'s'}}, KS_SAVE
},
756 {NULL
, NULL
, {MC_EXPORT
, 1, {'e'}}, KS_EXPORT
},
764 /* TRANSLATORS: About Attachment, a short description of the attachment */
765 {"A",N_("AboutAttch"),{MC_ABOUTATCH
,1,{'a'}},KS_NONE
},
767 {"%", N_("Print"), {MC_PRINTMSG
,1,{'%'}}, KS_PRINT
},
784 INST_KEY_MENU(att_index_keymenu
, att_index_keys
);
787 struct key att_view_keys
[] =
790 {"<",NULL
,{MC_EXIT
,2,{'<',','}},KS_EXITMODE
},
791 /* TRANSLATORS: View highlighted URL */
792 {"Ret","[" N_("View Hilite") "]",{MC_VIEW_HANDLE
,3,
793 {ctrl('m'),ctrl('j'),KEY_RIGHT
}},KS_NONE
},
794 /* TRANSLATORS: go to Previous URL */
795 {"^B",N_("Prev URL"),{MC_PREV_HANDLE
,1,{ctrl('B')}},KS_NONE
},
796 /* TRANSLATORS: go to Next URL */
797 {"^F",N_("Next URL"),{MC_NEXT_HANDLE
,1,{ctrl('F')}},KS_NONE
},
813 {"%", N_("Print"), {MC_PRINTMSG
,1,{'%'}}, KS_PRINT
},
825 {"^D","Decrypt", {MC_DECRYPT
,1,{ctrl('d')}},KS_NONE
},
826 {"^E","Security", {MC_SECURITY
,1,{ctrl('e')}},KS_NONE
},
835 INST_KEY_MENU(att_view_keymenu
, att_view_keys
);
838 struct key view_keys
[] =
841 /* TRANSLATORS: go to Message Index */
842 {"<",N_("MsgIndex"),{MC_INDEX
,3,{'i','<',','}},KS_FLDRINDEX
},
843 /* TRANSLATORS: View the Attachment */
844 {">",N_("ViewAttch"),{MC_VIEW_ATCH
,3,{'v','>','.'}},KS_NONE
},
869 /* TRANSLATORS: View the highlighted URL */
870 {"Ret","[" N_("View Hilite") "]",{MC_VIEW_HANDLE
,3,
871 {ctrl('m'),ctrl('j'),KEY_RIGHT
}},KS_NONE
},
872 /* TRANSLATORS: Select the current item */
873 {":",N_("SelectCur"),{MC_SELCUR
,1,{':'}},KS_SELECTCUR
},
874 /* TRANSLATORS: go to previous URL */
875 {"^B",N_("Prev URL"),{MC_PREV_HANDLE
,1,{ctrl('B')}},KS_NONE
},
876 /* TRANSLATORS: go to next URL */
877 {"^F",N_("Next URL"),{MC_NEXT_HANDLE
,1,{ctrl('F')}},KS_NONE
},
890 {"A",N_("TogglePreferPlain"),{MC_TOGGLE
,1,{'a'}},KS_NONE
},
892 {"^D","Decrypt", {MC_DECRYPT
,1,{ctrl('d')}},KS_NONE
},
893 {"^E","Security", {MC_SECURITY
,1,{ctrl('e')}},KS_NONE
},
902 INST_KEY_MENU(view_keymenu
, view_keys
);
905 struct key simple_text_keys
[] =
908 {"E",N_("Exit Viewer"),{MC_EXIT
,1,{'e'}},KS_EXITMODE
},
917 {"S", N_("Save"), {MC_SAVETEXT
,1,{'s'}}, KS_SAVE
},
931 INST_KEY_MENU(simple_text_keymenu
, simple_text_keys
);
934 struct key oe_keys
[] =
935 {{"^G",N_("Help"),{MC_NONE
},KS_SCREENHELP
},
936 {"^C",N_("Cancel"),{MC_NONE
},KS_NONE
},
937 {"^T","xxx",{MC_NONE
},KS_NONE
},
938 /* TRANSLATORS: The user is entering characters, for example, the
939 name of a folder. Accept means the user is done and wants to
940 accept what is currently displayed. */
941 {"Ret",N_("Accept"),{MC_NONE
},KS_NONE
},
950 INST_KEY_MENU(oe_keymenu
, oe_keys
);
953 struct key choose_setup_keys
[] =
956 {"E",N_("Exit Setup"),{MC_EXIT
,2,{'e',ctrl('C')}},KS_EXITMODE
},
957 {"P",N_("Printer"),{MC_PRINTER
,1,{'p'}},KS_NONE
},
958 /* TRANSLATORS: Change password */
959 {"N",N_("Newpassword"),{MC_PASSWD
,1,{'n'}},KS_NONE
},
960 /* TRANSLATORS: Configure Alpine */
961 {"C",N_("Config"),{MC_CONFIG
,1,{'c'}},KS_NONE
},
962 /* TRANSLATORS: Edit signature block */
963 {"S",N_("Signature"),{MC_SIG
,1,{'s'}},KS_NONE
},
964 /* TRANSLATORS: configure address books */
965 {"A",N_("AddressBooks"),{MC_ABOOKS
,1,{'a'}},KS_NONE
},
966 /* TRANSLATORS: configure collection lists */
967 {"L",N_("collectionList"),{MC_CLISTS
,1,{'l'}},KS_NONE
},
968 /* TRANSLATORS: configure rules, an alpine concept */
969 {"R",N_("Rules"),{MC_RULES
,1,{'r'}},KS_NONE
},
970 /* TRANSLATORS: configure directory servers */
971 {"D",N_("Directory"),{MC_DIRECTORY
,1,{'d'}},KS_NONE
},
972 /* TRANSLATORS: configure color */
973 {"K",N_("Kolor"),{MC_KOLOR
,1,{'k'}},KS_NONE
},
978 /* TRANSLATORS: remote configuration setup */
979 {"Z",N_("RemoteConfigSetup"),{MC_REMOTE
,1,{'z'}},KS_NONE
},
980 /* TRANSLATORS: configure S/MIME */
981 {"M",N_("S/Mime"),{MC_SECURITY
,1,{'m'}},KS_NONE
},
989 INST_KEY_MENU(choose_setup_keymenu
, choose_setup_keys
);
992 struct key main_keys
[] =
997 /* TRANSLATORS: go to Previous Command in list */
998 {"P",N_("PrevCmd"),{MC_PREVITEM
,3,{'p',ctrl('P'),KEY_UP
}},KS_NONE
},
999 {"N",N_("NextCmd"),{MC_NEXTITEM
,3,{'n',ctrl('N'),KEY_DOWN
}},KS_NONE
},
1002 /* TRANSLATORS: show release notes */
1003 {"R",N_("RelNotes"),{MC_RELNOTES
,1,{'r'}},KS_NONE
},
1004 /* TRANSLATORS: lock keyboard */
1005 {"K",N_("KBLock"),{MC_KBLOCK
,1,{'k'}},KS_NONE
},
1015 {"I",N_("Index"),{MC_INDEX
,1,{'i'}},KS_FLDRINDEX
},
1016 /* TRANSLATORS: go to the Journal. The Journal shows past
1017 messages that alpine has shown the user. */
1018 {"J",N_("Journal"),{MC_JOURNAL
,1,{'j'}},KS_REVIEW
},
1019 /* TRANSLATORS: go to the Setup screen */
1020 {"S",N_("Setup"),{MC_SETUP
,1,{'s'}},KS_NONE
},
1021 /* TRANSLATORS: go to the address book screen */
1022 {"A",N_("AddrBook"),{MC_ADDRBOOK
,1,{'a'}},KS_ADDRBOOK
},
1025 INST_KEY_MENU(main_keymenu
, main_keys
);
1028 struct key simple_file_keys
[] =
1031 {"Q",N_("Quit Viewer"),{MC_EXIT
,1,{'q'}},KS_NONE
},
1040 {"S", N_("Save"), {MC_SAVETEXT
,1,{'s'}}, KS_SAVE
},
1054 INST_KEY_MENU(simple_file_keymenu
, simple_file_keys
);
1057 struct key nuov_keys
[] =
1060 {"E",NULL
,{MC_EXIT
,1,{'e',ctrl('M'),ctrl('J')}},KS_NONE
},
1061 /* TRANSLATORS: Alpine asks the user to be counted when they
1062 first start using alpine. */
1063 {"Ret","[" N_("Be Counted!") "]",{MC_VIEW_HANDLE
,2,{ctrl('M'),ctrl('J')}},KS_NONE
},
1070 /* TRANSLATORS: show release notes */
1071 {"R",N_("RelNotes"),{MC_RELNOTES
,1,{'r'}},KS_NONE
},
1086 INST_KEY_MENU(nuov_keymenu
, nuov_keys
);
1089 struct key modal_message_keys
[] =
1092 {"Ret",N_("Finished"),{MC_EXIT
,2,{ctrl('m'),ctrl('j')}},KS_NONE
},
1102 INST_KEY_MENU(modal_message_keymenu
, modal_message_keys
);
1105 struct key ta_keys_lm
[] =
1109 /* TRANSLATORS: Take this address into the address book */
1110 {"T", N_("Take"), {MC_TAKE
,1,{'t'}}, KS_NONE
},
1115 {"X","[" N_("Set/Unset") "]", {MC_CHOICE
,3,{'x',ctrl('M'),ctrl('J')}}, KS_NONE
},
1116 {"A", N_("SetAll"),{MC_SELALL
,1,{'a'}},KS_NONE
},
1117 {"U",N_("UnSetAll"),{MC_UNSELALL
,1,{'u'}},KS_NONE
},
1118 /* TRANSLATORS: The Take Address screen has a Single mode and a
1119 List mode. This command causes us to go into Single mode. */
1120 {"S",N_("SinglMode"),{MC_LISTMODE
,1,{'s'}},KS_NONE
}};
1121 INST_KEY_MENU(ta_keymenu_lm
, ta_keys_lm
);
1124 struct key ta_keys_sm
[] =
1128 {"T","[" N_("Take") "]",{MC_TAKE
,3,{'t',ctrl('M'),ctrl('J')}}, KS_NONE
},
1136 /* TRANSLATORS: The Take Address screen has a Single mode and a
1137 List mode. This command causes us to go into List mode. */
1138 {"L",N_("ListMode"),{MC_LISTMODE
,1,{'l'}},KS_NONE
}};
1139 INST_KEY_MENU(ta_keymenu_sm
, ta_keys_sm
);
1142 struct key pipe_cancel_keys
[] =
1144 {"^C",N_("Stop Waiting"),{MC_NONE
},KS_NONE
},
1155 INST_KEY_MENU(pipe_cancel_keymenu
, pipe_cancel_keys
);
1158 struct key color_pattern_keys
[] =
1162 /* TRANSLATORS: Change Value */
1163 {"C", "[" N_("Change Val") "]", {MC_EDIT
,3,{'c',ctrl('M'),ctrl('J')}}, KS_NONE
},
1169 /* TRANSLATORS: Delete Value */
1170 {"D", N_("Delete Val"), {MC_DELETE
,1,{'d'}}, KS_NONE
},
1176 {"I", N_("IndxHdr"), {MC_ADDHEADER
,1,{'i'}}, KS_NONE
},
1186 INST_KEY_MENU(color_pattern_keymenu
, color_pattern_keys
);
1189 struct key hdr_color_checkbox_keys
[] =
1202 INST_KEY_MENU(hdr_color_checkbox_keymenu
, hdr_color_checkbox_keys
);
1205 struct key kw_color_checkbox_keys
[] =
1218 INST_KEY_MENU(kw_color_checkbox_keymenu
, kw_color_checkbox_keys
);
1221 struct key selectable_bold_checkbox_keys
[] =
1234 INST_KEY_MENU(selectable_bold_checkbox_keymenu
, selectable_bold_checkbox_keys
);
1237 struct key flag_keys
[] =
1239 {"A", N_("Add KW"), {MC_ADD
,1,{'a'}}, KS_NONE
},
1240 /* TRANSLATORS: Exit from the Flags screen */
1241 {"E", N_("Exit Flags"), {MC_EXIT
,1,{'e'}}, KS_EXITMODE
},
1251 INST_KEY_MENU(flag_keymenu
, flag_keys
);
1254 struct key addr_select_keys
[] =
1256 {"E", N_("ExitSelect"), {MC_EXIT
,1,{'e'}}, KS_EXITMODE
},
1258 {"S", "[" N_("Select") "]", {MC_CHOICE
,3,{'s',ctrl('M'),ctrl('J')}}, KS_NONE
},
1267 INST_KEY_MENU(addr_s_km
, addr_select_keys
);
1270 struct key addr_select_with_goback_keys
[] =
1273 /* TRANSLATORS: go to address book list */
1274 {"<", N_("AddressBkList"), {MC_ADDRBOOK
,2,{'<',','}}, KS_NONE
},
1275 {"S", "[" N_("Select") "]", {MC_CHOICE
,3,{'s',ctrl('M'),ctrl('J')}}, KS_NONE
},
1282 {"E", N_("ExitSelect"), {MC_EXIT
,1,{'e'}}, KS_EXITMODE
},
1284 INST_KEY_MENU(addr_s_km_with_goback
, addr_select_with_goback_keys
);
1286 static struct key addr_select_with_view_keys
[] =
1289 {"<", N_("AddressBkList"), {MC_ADDRBOOK
,2,{'<',','}}, KS_NONE
},
1290 {">", "[" N_("View") "]",
1291 {MC_VIEW_TEXT
,5,{'v','>','.',ctrl('M'),ctrl('J')}}, KS_NONE
},
1296 /* TRANSLATORS: compose a message to the current address */
1297 {"C", N_("ComposeTo"), {MC_COMPOSE
,1,{'c'}}, KS_COMPOSER
},
1314 INST_KEY_MENU(addr_s_km_with_view
, addr_select_with_view_keys
);
1317 struct key addr_select_for_url_keys
[] =
1320 {"<", N_("Exit Viewer"), {MC_ADDRBOOK
,3,{'<',',','e'}}, KS_NONE
},
1321 {">", "[" N_("View") "]",
1322 {MC_VIEW_TEXT
,5,{'v','>','.',ctrl('M'),ctrl('J')}}, KS_NONE
},
1327 {"C", N_("ComposeTo"), {MC_COMPOSE
,1,{'c'}}, KS_COMPOSER
},
1344 INST_KEY_MENU(addr_s_km_for_url
, addr_select_for_url_keys
);
1347 struct key addr_select_exit_keys
[] =
1350 {"E", "[" N_("Exit") "]", {MC_EXIT
,3,{'e',ctrl('M'),ctrl('J')}},
1361 INST_KEY_MENU(addr_s_km_exit
, addr_select_exit_keys
);
1364 struct key addr_select_goback_keys
[] =
1367 {"E", "[" N_("Exit") "]", {MC_ADDRBOOK
,3,{'e',ctrl('M'),ctrl('J')}},
1378 INST_KEY_MENU(addr_s_km_goback
, addr_select_goback_keys
);
1381 struct key config_text_keys
[] =
1385 {"C", "[" N_("Change Val") "]", {MC_EDIT
,3,{'c',ctrl('M'),ctrl('J')}}, KS_NONE
},
1390 {"A", N_("Add Value"), {MC_ADD
,1,{'a'}}, KS_NONE
},
1391 {"D", N_("Delete Val"), {MC_DELETE
,1,{'d'}}, KS_NONE
},
1407 INST_KEY_MENU(config_text_keymenu
, config_text_keys
);
1410 struct key config_text_to_charsets_keys
[] =
1414 {"C", "[" N_("Change Val") "]", {MC_EDIT
,3,{'c',ctrl('M'),ctrl('J')}}, KS_NONE
},
1419 {"A", N_("Add Value"), {MC_ADD
,1,{'a'}}, KS_NONE
},
1420 {"D", N_("Delete Val"), {MC_DELETE
,1,{'d'}}, KS_NONE
},
1428 /* TRANSLATORS: go to list of keywords */
1429 {"T", N_("ToCharsets"), {MC_CHOICE
, 2, {'t', ctrl('T')}}, KS_NONE
},
1437 INST_KEY_MENU(config_text_to_charsets_keymenu
, config_text_to_charsets_keys
);
1440 struct key direct_config_keys
[] =
1443 {"E", N_("Exit Setup"), {MC_EXIT
,1,{'e'}}, KS_EXITMODE
},
1444 {"C", "[" N_("Change") "]", {MC_EDIT
,3,{'c',ctrl('M'),ctrl('J')}}, KS_NONE
},
1445 /* TRANSLATORS: go to previous LDAP directory server in the list */
1446 {"P", N_("PrevDir"), {MC_PREVITEM
, 1, {'p'}}, KS_NONE
},
1447 {"N", N_("NextDir"), {MC_NEXTITEM
, 2, {'n', TAB
}}, KS_NONE
},
1450 /* TRANSLATORS: add a directory server to configuration */
1451 {"A", N_("Add Dir"), {MC_ADD
,1,{'a'}}, KS_NONE
},
1452 /* TRANSLATORS: delete a directory */
1453 {"D", N_("Del Dir"), {MC_DELETE
,1,{'d'}}, KS_NONE
},
1454 {"$", N_("Shuffle"), {MC_SHUFFLE
,1,{'$'}}, KS_NONE
},
1469 INST_KEY_MENU(dir_conf_km
, direct_config_keys
);
1472 struct key sel_from_list_keys
[] =
1475 {"E", N_("Exit"), {MC_EXIT
,1,{'e'}}, KS_EXITMODE
},
1476 {"S", "[" N_("Select") "]", {MC_SELECT
,3,{'s',ctrl('J'),ctrl('M')}}, KS_NONE
},
1477 {"P", N_("Prev"), {MC_PREVITEM
, 1, {'p'}}, KS_NONE
},
1478 {"N", N_("Next"), {MC_NEXTITEM
, 2, {'n', TAB
}}, KS_NONE
},
1485 INST_KEY_MENU(sel_from_list
, sel_from_list_keys
);
1488 struct key sel_from_list_keys_ctrlc
[] =
1491 {"^C", N_("exit"), {MC_EXIT
,1,{ctrl('C')}}, KS_EXITMODE
},
1492 {"S", "[" N_("Select") "]", {MC_SELECT
,3,{'s',ctrl('J'),ctrl('M')}}, KS_NONE
},
1493 {"P", N_("Prev"), {MC_PREVITEM
, 1, {'p'}}, KS_NONE
},
1494 {"N", N_("Next"), {MC_NEXTITEM
, 2, {'n', TAB
}}, KS_NONE
},
1501 INST_KEY_MENU(sel_from_list_ctrlc
, sel_from_list_keys_ctrlc
);
1504 struct key sel_from_list_keys_sm
[] =
1507 {"E", N_("Exit"), {MC_EXIT
,1,{'e'}}, KS_EXITMODE
},
1508 {"S", "[" N_("Select") "]", {MC_SELECT
,3,{'s',ctrl('J'),ctrl('M')}}, KS_NONE
},
1509 {"P", N_("Prev"), {MC_PREVITEM
, 1, {'p'}}, KS_NONE
},
1510 {"N", N_("Next"), {MC_NEXTITEM
, 2, {'n', TAB
}}, KS_NONE
},
1514 {"L",N_("ListMode"),{MC_LISTMODE
,1,{'l'}},KS_NONE
},
1530 INST_KEY_MENU(sel_from_list_sm
, sel_from_list_keys_sm
);
1533 struct key sel_from_list_keys_sm_ctrlc
[] =
1536 {"^C", N_("exit"), {MC_EXIT
,1,{ctrl('C')}}, KS_EXITMODE
},
1537 {"S", "[" N_("Select") "]", {MC_SELECT
,3,{'s',ctrl('J'),ctrl('M')}}, KS_NONE
},
1538 {"P", N_("Prev"), {MC_PREVITEM
, 1, {'p'}}, KS_NONE
},
1539 {"N", N_("Next"), {MC_NEXTITEM
, 2, {'n', TAB
}}, KS_NONE
},
1543 {"L",N_("ListMode"),{MC_LISTMODE
,1,{'l'}},KS_NONE
},
1559 INST_KEY_MENU(sel_from_list_sm_ctrlc
, sel_from_list_keys_sm_ctrlc
);
1562 struct key sel_from_list_keys_lm
[] =
1565 {"E", N_("Exit"), {MC_EXIT
,1,{'e'}}, KS_EXITMODE
},
1566 {"S", "[" N_("Select") "]", {MC_SELECT
,3,{'s',ctrl('J'),ctrl('M')}}, KS_NONE
},
1567 {"P", N_("Prev"), {MC_PREVITEM
, 1, {'p'}}, KS_NONE
},
1568 {"N", N_("Next"), {MC_NEXTITEM
, 2, {'n', TAB
}}, KS_NONE
},
1571 {"X", N_("Set/Unset"), {MC_TOGGLE
,1,{'x'}}, KS_NONE
},
1572 {"1",N_("SinglMode"),{MC_LISTMODE
,1,{'1'}},KS_NONE
},
1588 INST_KEY_MENU(sel_from_list_lm
, sel_from_list_keys_lm
);
1591 struct key sel_from_list_keys_lm_ctrlc
[] =
1594 {"^C", N_("exit"), {MC_EXIT
,1,{ctrl('C')}}, KS_EXITMODE
},
1595 {"S", "[" N_("Select") "]", {MC_SELECT
,3,{'s',ctrl('J'),ctrl('M')}}, KS_NONE
},
1596 {"P", N_("Prev"), {MC_PREVITEM
, 1, {'p'}}, KS_NONE
},
1597 {"N", N_("Next"), {MC_NEXTITEM
, 2, {'n', TAB
}}, KS_NONE
},
1600 {"X", N_("Set/Unset"), {MC_TOGGLE
,1,{'x'}}, KS_NONE
},
1601 {"1",N_("SinglMode"),{MC_LISTMODE
,1,{'1'}},KS_NONE
},
1617 INST_KEY_MENU(sel_from_list_lm_ctrlc
, sel_from_list_keys_lm_ctrlc
);
1620 struct key sel_from_list_keys_olm
[] =
1623 {"E", N_("Exit"), {MC_EXIT
,1,{'e'}}, KS_EXITMODE
},
1624 {"S", "[" N_("Select") "]", {MC_SELECT
,3,{'s',ctrl('J'),ctrl('M')}}, KS_NONE
},
1625 {"P", N_("Prev"), {MC_PREVITEM
, 1, {'p'}}, KS_NONE
},
1626 {"N", N_("Next"), {MC_NEXTITEM
, 2, {'n', TAB
}}, KS_NONE
},
1629 {"X", N_("Set/Unset"), {MC_TOGGLE
,1,{'x'}}, KS_NONE
},
1646 INST_KEY_MENU(sel_from_list_olm
, sel_from_list_keys_olm
);
1649 struct key sel_from_list_keys_olm_ctrlc
[] =
1652 {"^C", N_("exit"), {MC_EXIT
,1,{ctrl('C')}}, KS_EXITMODE
},
1653 {"S", "[" N_("Select") "]", {MC_SELECT
,3,{'s',ctrl('J'),ctrl('M')}}, KS_NONE
},
1654 {"P", N_("Prev"), {MC_PREVITEM
, 1, {'p'}}, KS_NONE
},
1655 {"N", N_("Next"), {MC_NEXTITEM
, 2, {'n', TAB
}}, KS_NONE
},
1658 {"X", N_("Set/Unset"), {MC_TOGGLE
,1,{'x'}}, KS_NONE
},
1675 INST_KEY_MENU(sel_from_list_olm_ctrlc
, sel_from_list_keys_olm_ctrlc
);
1680 struct key printer_edit_keys
[] =
1684 {"S", "[" N_("Select") "]", {MC_CHOICE
,3,{'s',ctrl('M'),ctrl('J')}}, KS_NONE
},
1689 /* TRANSLATORS: add a printer to configuration */
1690 {"A", N_("Add Printer"), {MC_ADD
,1,{'a'}}, KS_NONE
},
1691 /* TRANSLATORS: delete a printer from configuration */
1692 {"D", N_("DeletePrint"), {MC_DELETE
,1,{'d'}}, KS_NONE
},
1693 {"C", N_("Change"), {MC_EDIT
,1,{'c'}}, KS_NONE
},
1708 INST_KEY_MENU(printer_edit_keymenu
, printer_edit_keys
);
1711 struct key printer_select_keys
[] =
1715 {"S", "[" N_("Select") "]", {MC_CHOICE
,3,{'s',ctrl('M'),ctrl('J')}}, KS_NONE
},
1724 INST_KEY_MENU(printer_select_keymenu
, printer_select_keys
);
1729 struct key role_select_keys
[] =
1732 {"E", N_("Exit"), {MC_EXIT
,1,{'e'}}, KS_EXITMODE
},
1734 /* TRANSLATORS: go to previous Role in list */
1735 {"P", N_("PrevRole"), {MC_PREVITEM
, 1, {'p'}}, KS_NONE
},
1736 {"N", N_("NextRole"), {MC_NEXTITEM
, 2, {'n', TAB
}}, KS_NONE
},
1741 {"D", "", {MC_TOGGLE
, 1, {'d'}}, KS_NONE
},
1743 INST_KEY_MENU(role_select_km
, role_select_keys
);
1746 struct key role_config_keys
[] =
1749 {"E", N_("Exit Setup"), {MC_EXIT
,1,{'e'}}, KS_EXITMODE
},
1750 {"C", "[" N_("Change") "]", {MC_EDIT
,3,{'c',ctrl('M'),ctrl('J')}}, KS_NONE
},
1751 /* TRANSLATORS: go to previous Rule in list */
1752 {"P", N_("PrevRule"), {MC_PREVITEM
, 1, {'p'}}, KS_NONE
},
1753 {"N", N_("NextRule"), {MC_NEXTITEM
, 2, {'n', TAB
}}, KS_NONE
},
1756 {"A", N_("Add"), {MC_ADD
,1,{'a'}}, KS_NONE
},
1757 {"D", N_("Delete"), {MC_DELETE
,1,{'d'}}, KS_NONE
},
1758 {"$", N_("Shuffle"), {MC_SHUFFLE
,1,{'$'}}, KS_NONE
},
1765 /* TRANSLATORS: Include a File from filesystem */
1766 {"I", N_("IncludeFile"), {MC_ADDFILE
,1,{'i'}}, KS_NONE
},
1767 {"X", N_("eXcludeFile"), {MC_DELFILE
,1,{'x'}}, KS_NONE
},
1770 {"R", N_("Replicate"), {MC_COPY
,1,{'r'}}, KS_NONE
},
1774 INST_KEY_MENU(role_conf_km
, role_config_keys
);
1777 struct key config_text_wshuf_keys
[] =
1781 {"C", "[" N_("Change Val") "]", {MC_EDIT
,3,{'c',ctrl('M'),ctrl('J')}}, KS_NONE
},
1786 {"A", N_("Add Value"), {MC_ADD
,1,{'a'}}, KS_NONE
},
1787 {"D", N_("Delete Val"), {MC_DELETE
,1,{'d'}}, KS_NONE
},
1795 {"$", N_("Shuffle"), {MC_SHUFFLE
,1,{'$'}}, KS_NONE
},
1803 INST_KEY_MENU(config_text_wshuf_keymenu
, config_text_wshuf_keys
);
1806 struct key config_text_wshufandfldr_keys
[] =
1810 {"C", "[" N_("Change Val") "]", {MC_EDIT
,3,{'c',ctrl('M'),ctrl('J')}}, KS_NONE
},
1815 {"A", N_("Add Value"), {MC_ADD
,1,{'a'}}, KS_NONE
},
1816 {"D", N_("Delete Val"), {MC_DELETE
,1,{'d'}}, KS_NONE
},
1824 {"$", N_("Shuffle"), {MC_SHUFFLE
,1,{'$'}}, KS_NONE
},
1825 {"T", N_("ToFldrs"), {MC_CHOICE
,2,{'t', ctrl('T')}}, KS_NONE
},
1832 INST_KEY_MENU(config_text_wshufandfldr_keymenu
, config_text_wshufandfldr_keys
);
1835 struct key config_role_file_keys
[] =
1839 {"C", "[" N_("Change Val") "]", {MC_EDIT
,3,{'c',ctrl('M'),ctrl('J')}}, KS_NONE
},
1844 {"A", N_("Add Value"), {MC_ADD
,1,{'a'}}, KS_NONE
},
1845 {"D", N_("Delete Val"), {MC_DELETE
,1,{'d'}}, KS_NONE
},
1853 /* TRANSLATORS: go to list of Files */
1854 {"T", N_("ToFiles"), {MC_CHOICE
, 2, {'t', ctrl('T')}}, KS_NONE
},
1855 /* TRANSLATORS: edit a file */
1856 {"F", N_("editFile"), {MC_EDITFILE
, 1, {'f'}}, KS_NONE
},
1863 INST_KEY_MENU(config_role_file_keymenu
, config_role_file_keys
);
1866 struct key config_role_file_res_keys
[] =
1870 {"C", "[" N_("Change Val") "]", {MC_EDIT
,3,{'c',ctrl('M'),ctrl('J')}}, KS_NONE
},
1875 {"A", N_("Add Value"), {MC_ADD
,1,{'a'}}, KS_NONE
},
1876 {"D", N_("Delete Val"), {MC_DELETE
,1,{'d'}}, KS_NONE
},
1884 {"T", N_("ToFiles"), {MC_CHOICE
, 2, {'t', ctrl('T')}}, KS_NONE
},
1892 INST_KEY_MENU(config_role_file_res_keymenu
, config_role_file_res_keys
);
1895 struct key config_role_keyword_keys
[] =
1899 {"C", "[" N_("Change Val") "]", {MC_EDIT
,3,{'c',ctrl('M'),ctrl('J')}}, KS_NONE
},
1904 {"A", N_("Add Value"), {MC_ADD
,1,{'a'}}, KS_NONE
},
1905 {"D", N_("Delete Val"), {MC_DELETE
,1,{'d'}}, KS_NONE
},
1913 /* TRANSLATORS: go to list of keywords */
1914 {"T", N_("ToKeywords"), {MC_CHOICE
, 2, {'t', ctrl('T')}}, KS_NONE
},
1922 INST_KEY_MENU(config_role_keyword_keymenu
, config_role_keyword_keys
);
1925 struct key config_role_keyword_keys_not
[] =
1929 {"C", "[" N_("Change Val") "]", {MC_EDIT
,3,{'c',ctrl('M'),ctrl('J')}}, KS_NONE
},
1934 {"A", N_("Add Value"), {MC_ADD
,1,{'a'}}, KS_NONE
},
1935 {"D", N_("Delete Val"), {MC_DELETE
,1,{'d'}}, KS_NONE
},
1943 {"T", N_("ToKeywords"), {MC_CHOICE
, 2, {'t', ctrl('T')}}, KS_NONE
},
1945 /* TRANSLATORS: toggle between NOT and not NOT, turn NOT on or off */
1946 {"!", N_("toggle NOT"), {MC_NOT
,1,{'!'}}, KS_NONE
},
1952 INST_KEY_MENU(config_role_keyword_keymenu_not
, config_role_keyword_keys_not
);
1955 struct key config_role_charset_keys_not
[] =
1959 {"C", "[" N_("Change Val") "]", {MC_EDIT
,3,{'c',ctrl('M'),ctrl('J')}}, KS_NONE
},
1964 {"A", N_("Add Value"), {MC_ADD
,1,{'a'}}, KS_NONE
},
1965 {"D", N_("Delete Val"), {MC_DELETE
,1,{'d'}}, KS_NONE
},
1973 /* TRANSLATORS: go to list of character sets */
1974 {"T", N_("ToCharSets"), {MC_CHOICE
, 2, {'t', ctrl('T')}}, KS_NONE
},
1976 {"!", N_("toggle NOT"), {MC_NOT
,1,{'!'}}, KS_NONE
},
1982 INST_KEY_MENU(config_role_charset_keymenu_not
, config_role_charset_keys_not
);
1985 struct key config_role_keys
[] =
1989 {"C", "[" N_("Change Val") "]", {MC_EDIT
,3,{'c',ctrl('M'),ctrl('J')}}, KS_NONE
},
1994 {"A", N_("Add Value"), {MC_ADD
,1,{'a'}}, KS_NONE
},
1995 {"D", N_("Delete Val"), {MC_DELETE
,1,{'d'}}, KS_NONE
},
2011 INST_KEY_MENU(config_role_keymenu
, config_role_keys
);
2014 struct key config_role_keys_not
[] =
2018 {"C", "[" N_("Change Val") "]", {MC_EDIT
,3,{'c',ctrl('M'),ctrl('J')}}, KS_NONE
},
2023 {"A", N_("Add Value"), {MC_ADD
,1,{'a'}}, KS_NONE
},
2024 {"D", N_("Delete Val"), {MC_DELETE
,1,{'d'}}, KS_NONE
},
2033 /* TRANSLATORS: add extra headers to list */
2034 {"X", N_("eXtraHdr"), {MC_ADDHDR
, 1, {'x'}}, KS_NONE
},
2035 {"!", N_("toggle NOT"), {MC_NOT
,1,{'!'}}, KS_NONE
},
2041 INST_KEY_MENU(config_role_keymenu_not
, config_role_keys_not
);
2044 struct key config_role_keys_extra
[] =
2048 {"X", "[" N_("eXtraHdr") "]", {MC_ADDHDR
, 3,{'x',ctrl('M'),ctrl('J')}}, KS_NONE
},
2057 INST_KEY_MENU(config_role_keymenu_extra
, config_role_keys_extra
);
2060 struct key config_role_addr_pat_keys
[] =
2064 {"C", "[" N_("Change Val") "]", {MC_EDIT
,3,{'c',ctrl('M'),ctrl('J')}}, KS_NONE
},
2069 {"A", N_("Add Value"), {MC_ADD
,1,{'a'}}, KS_NONE
},
2070 {"D", N_("Delete Val"), {MC_DELETE
,1,{'d'}}, KS_NONE
},
2078 /* TRANSLATORS: go to address book to get address */
2079 {"T", N_("ToAddrBk"), {MC_CHOICEB
, 2, {'t', ctrl('T')}}, KS_NONE
},
2080 {"X", N_("eXtraHdr"), {MC_ADDHDR
, 1, {'x'}}, KS_NONE
},
2081 {"!", N_("toggle NOT"), {MC_NOT
,1,{'!'}}, KS_NONE
},
2087 INST_KEY_MENU(config_role_addr_pat_keymenu
, config_role_addr_pat_keys
);
2090 struct key config_role_xtrahdr_keys
[] =
2094 {"C", "[" N_("Change Val") "]", {MC_EDIT
,3,{'c',ctrl('M'),ctrl('J')}}, KS_NONE
},
2099 {"A", N_("Add Value"), {MC_ADD
,1,{'a'}}, KS_NONE
},
2100 {"D", N_("Delete Val"), {MC_DELETE
,1,{'d'}}, KS_NONE
},
2109 {"X", N_("eXtraHdr"), {MC_ADDHDR
, 1, {'x'}}, KS_NONE
},
2110 {"!", N_("toggle NOT"), {MC_NOT
,1,{'!'}}, KS_NONE
},
2112 /* TRANSLATORS: remove a header we previously added */
2113 {"R", N_("RemoveHdr"), {MC_DELHDR
, 1, {'r'}}, KS_NONE
},
2117 INST_KEY_MENU(config_role_xtrahdr_keymenu
, config_role_xtrahdr_keys
);
2120 struct key config_role_addr_act_keys
[] =
2124 {"C", "[" N_("Change Val") "]", {MC_EDIT
,3,{'c',ctrl('M'),ctrl('J')}}, KS_NONE
},
2129 {"A", N_("Add Value"), {MC_ADD
,1,{'a'}}, KS_NONE
},
2130 {"D", N_("Delete Val"), {MC_DELETE
,1,{'d'}}, KS_NONE
},
2138 {"T", N_("ToAddrBk"), {MC_CHOICEC
, 2, {'t', ctrl('T')}}, KS_NONE
},
2146 INST_KEY_MENU(config_role_addr_act_keymenu
, config_role_addr_act_keys
);
2149 struct key config_role_patfolder_keys
[] =
2153 {"C", "[" N_("Change Val") "]", {MC_EDIT
,3,{'c',ctrl('M'),ctrl('J')}}, KS_NONE
},
2158 {"A", N_("Add Value"), {MC_ADD
,1,{'a'}}, KS_NONE
},
2159 {"D", N_("Delete Val"), {MC_DELETE
,1,{'d'}}, KS_NONE
},
2167 /* TRANSLATORS: go to list of folders */
2168 {"T", N_("ToFldrs"), {MC_CHOICED
, 2, {'t', ctrl('T')}}, KS_NONE
},
2176 INST_KEY_MENU(config_role_patfolder_keymenu
, config_role_patfolder_keys
);
2179 struct key config_role_actionfolder_keys
[] =
2183 {"C", "[" N_("Change Val") "]", {MC_EDIT
,3,{'c',ctrl('M'),ctrl('J')}}, KS_NONE
},
2188 {"A", N_("Add Value"), {MC_ADD
,1,{'a'}}, KS_NONE
},
2189 {"D", N_("Delete Val"), {MC_DELETE
,1,{'d'}}, KS_NONE
},
2197 {"T", N_("ToFldrs"), {MC_CHOICEE
, 2, {'t', ctrl('T')}}, KS_NONE
},
2205 INST_KEY_MENU(config_role_actionfolder_keymenu
, config_role_actionfolder_keys
);
2208 struct key config_role_inick_keys
[] =
2212 {"C", "[" N_("Change Val") "]", {MC_EDIT
,3,{'c',ctrl('M'),ctrl('J')}}, KS_NONE
},
2217 {"A", N_("Add Value"), {MC_ADD
,1,{'a'}}, KS_NONE
},
2218 {"D", N_("Delete Val"), {MC_DELETE
,1,{'d'}}, KS_NONE
},
2226 /* TRANSLATORS: go to list of nicknames */
2227 {"T", N_("ToNicks"), {MC_CHOICE
, 2, {'t', ctrl('T')}}, KS_NONE
},
2235 INST_KEY_MENU(config_role_inick_keymenu
, config_role_inick_keys
);
2238 struct key config_role_afrom_keys
[] =
2242 {"C", "[" N_("Change Val") "]", {MC_EDIT
,3,{'c',ctrl('M'),ctrl('J')}}, KS_NONE
},
2247 {"A", N_("Add Value"), {MC_ADD
,1,{'a'}}, KS_NONE
},
2248 {"D", N_("Delete Val"), {MC_DELETE
,1,{'d'}}, KS_NONE
},
2256 /* TRANSLATORS: go to list of address books */
2257 {"T", N_("ToAbookList"), {MC_CHOICE
, 2, {'t', ctrl('T')}}, KS_NONE
},
2265 INST_KEY_MENU(config_role_afrom_keymenu
, config_role_afrom_keys
);
2268 struct key config_checkbox_keys
[] =
2281 INST_KEY_MENU(config_checkbox_keymenu
, config_checkbox_keys
);
2284 struct key config_radiobutton_keys
[] =
2288 {"*", "[" N_("Select") "]", {MC_CHOICE
,3,{'*',ctrl('M'),ctrl('J')}}, KS_NONE
},
2297 INST_KEY_MENU(config_radiobutton_keymenu
, config_radiobutton_keys
);
2300 struct key config_yesno_keys
[] =
2304 {"C", "[" N_("Change") "]", {MC_TOGGLE
,3,{'c',ctrl('M'),ctrl('J')}}, KS_NONE
},
2313 INST_KEY_MENU(config_yesno_keymenu
, config_yesno_keys
);
2316 struct key color_changing_keys
[] =
2319 {"E", N_("To Colors"), {MC_EXIT
,1,{'e'}}, KS_EXITMODE
},
2320 {"*", "[" N_("Select") "]", {MC_CHOICE
,3,{'*',ctrl('M'),ctrl('J')}}, KS_NONE
},
2329 INST_KEY_MENU(color_changing_keymenu
, color_changing_keys
);
2332 struct key custom_color_changing_keys
[] =
2335 /* TRANSLATORS: go to color configuration screen */
2336 {"E", N_("To Colors"), {MC_EXIT
,1,{'e'}}, KS_EXITMODE
},
2337 {"*", "[" N_("Select") "]", {MC_CHOICEB
,3,{'*',ctrl('M'),ctrl('J')}}, KS_NONE
},
2346 INST_KEY_MENU(custom_color_changing_keymenu
, custom_color_changing_keys
);
2349 struct key kw_color_changing_keys
[] =
2352 {"E", N_("To Colors"), {MC_EXIT
,1,{'e'}}, KS_EXITMODE
},
2353 {"*", "[" N_("Select") "]", {MC_CHOICEC
,3,{'*',ctrl('M'),ctrl('J')}}, KS_NONE
},
2362 INST_KEY_MENU(kw_color_changing_keymenu
, kw_color_changing_keys
);
2367 struct key color_rgb_changing_keys
[] =
2370 {"E", N_("To Colors"), {MC_EXIT
,1,{'e'}}, KS_EXITMODE
},
2371 {"*", "[" N_("Select") "]", {MC_CHOICE
,3,{'*',ctrl('M'),ctrl('J')}}, KS_NONE
},
2376 {"C", N_("Customize"), {MC_RGB1
,1,{'c'}},KS_NONE
},
2393 INST_KEY_MENU(color_rgb_keymenu
, color_rgb_changing_keys
);
2396 struct key custom_rgb_changing_keys
[] =
2399 {"E", N_("To Colors"), {MC_EXIT
,1,{'e'}}, KS_EXITMODE
},
2400 {"*", "[" N_("Select") "]", {MC_CHOICEB
,3,{'*',ctrl('M'),ctrl('J')}}, KS_NONE
},
2405 {"C", N_("Customize"), {MC_RGB2
,1,{'c'}},KS_NONE
},
2422 INST_KEY_MENU(custom_rgb_keymenu
, custom_rgb_changing_keys
);
2425 struct key kw_rgb_changing_keys
[] =
2428 {"E", N_("To Colors"), {MC_EXIT
,1,{'e'}}, KS_EXITMODE
},
2429 {"*", "[" N_("Select") "]", {MC_CHOICEC
,3,{'*',ctrl('M'),ctrl('J')}}, KS_NONE
},
2434 {"C", N_("Customize"), {MC_RGB3
,1,{'c'}},KS_NONE
},
2451 INST_KEY_MENU(kw_rgb_keymenu
, kw_rgb_changing_keys
);
2456 struct key color_setting_keys
[] =
2460 {"C", "[" N_("Change") "]", {MC_EDIT
,3,{'c',ctrl('M'),ctrl('J')}}, KS_NONE
},
2465 {"A", N_("AddHeader"), {MC_ADD
,1,{'a'}}, KS_NONE
},
2466 /* TRANSLATORS: restore defaults */
2467 {"R", N_("RestoreDefs"), {MC_DEFAULT
,1,{'r'}}, KS_NONE
},
2473 {"I", N_("IndxHdr"), {MC_ADDHEADER
,1,{'i'}}, KS_NONE
},
2483 INST_KEY_MENU(color_setting_keymenu
, color_setting_keys
);
2486 struct key custom_color_setting_keys
[] =
2490 {"C", "[" N_("Change") "]", {MC_EDIT
,3,{'c',ctrl('M'),ctrl('J')}}, KS_NONE
},
2495 {"A", N_("AddHeader"), {MC_ADD
,1,{'a'}}, KS_NONE
},
2496 {"R", N_("RestoreDefs"), {MC_DEFAULT
,1,{'r'}}, KS_NONE
},
2502 {"I", N_("IndxHdr"), {MC_ADDHEADER
,1,{'i'}}, KS_NONE
},
2504 {"D", N_("DeleteHdr"), {MC_DELETE
,1,{'d'}}, KS_NONE
},
2505 /* TRANSLATORS: shuffle headers (change the order of headers) */
2506 {"$", N_("ShuffleHdr"), {MC_SHUFFLE
,1,{'$'}}, KS_NONE
},
2513 INST_KEY_MENU(custom_color_setting_keymenu
, custom_color_setting_keys
);
2516 struct key role_color_setting_keys
[] =
2520 {"*", "[" N_("Select") "]", {MC_CHOICE
,3,{'*',ctrl('M'),ctrl('J')}}, KS_NONE
},
2529 INST_KEY_MENU(role_color_setting_keymenu
, role_color_setting_keys
);
2532 struct key kw_color_setting_keys
[] =
2536 {"C", "[" N_("Change") "]", {MC_EDIT
,3,{'c',ctrl('M'),ctrl('J')}}, KS_NONE
},
2541 {"A", N_("AddHeader"), {MC_ADD
,1,{'a'}}, KS_NONE
},
2542 {"R", N_("RestoreDefs"), {MC_DEFAULT
,1,{'r'}}, KS_NONE
},
2548 {"I", N_("IndxHdr"), {MC_ADDHEADER
,1,{'i'}}, KS_NONE
},
2558 INST_KEY_MENU(kw_color_setting_keymenu
, kw_color_setting_keys
);
2561 struct key take_export_keys_sm
[] =
2564 /* TRANSLATORS: exit the Take Address screen */
2565 {"<",N_("ExitTake"), {MC_EXIT
,4,{'e',ctrl('C'),'<',','}}, KS_EXITMODE
},
2566 {"T","[" N_("Take") "]",{MC_TAKE
,3,{'t',ctrl('M'),ctrl('J')}}, KS_NONE
},
2574 {"L",N_("ListMode"),{MC_LISTMODE
,1,{'l'}},KS_NONE
}};
2575 INST_KEY_MENU(take_export_keymenu_sm
, take_export_keys_sm
);
2578 struct key take_export_keys_lm
[] =
2581 {"<",N_("ExitTake"), {MC_EXIT
,4,{'e',ctrl('C'),'<',','}}, KS_EXITMODE
},
2582 {"T",N_("Take"), {MC_TAKE
,1,{'t'}}, KS_NONE
},
2587 {"X","[" N_("Set/Unset") "]", {MC_CHOICE
,3,{'x',ctrl('M'),ctrl('J')}}, KS_NONE
},
2588 {"A", N_("SetAll"),{MC_SELALL
,1,{'a'}},KS_NONE
},
2589 {"U",N_("UnSetAll"),{MC_UNSELALL
,1,{'u'}},KS_NONE
},
2590 {"S",N_("SinglMode"),{MC_LISTMODE
,1,{'s'}},KS_NONE
}};
2591 INST_KEY_MENU(take_export_keymenu_lm
, take_export_keys_lm
);
2594 struct key smime_info_keys
[] =
2597 {"<","Back",{MC_VIEW_TEXT
,2,{'<',','}},KS_EXITMODE
},
2620 INST_KEY_MENU(smime_info_keymenu
, smime_info_keys
);
2623 struct key config_smime_helper_keys
[] =
2627 {"T","[" N_("Transfer") "]", {MC_CHOICE
,3,{'t',ctrl('M'),ctrl('J')}}, KS_NONE
},
2636 INST_KEY_MENU(config_smime_helper_keymenu
, config_smime_helper_keys
);
2638 struct key config_smime_manage_certs_menu_keys
[] =
2642 {"S", "[" N_("Select") "]", {MC_CHOICE
,3,{'s',ctrl('M'),ctrl('J')}}, KS_NONE
},
2643 {"I", N_("Import Cert"), {MC_IMPORT
,1,{'i'}}, KS_NONE
},
2651 INST_KEY_MENU(config_smime_manage_certs_menu_keymenu
, config_smime_manage_certs_menu_keys
);
2653 struct key config_smime_add_certs_keys
[] =
2657 {"I", N_("Import Cert"), {MC_IMPORT
,3,{'i', ctrl('M'), ctrl('J')}}, KS_NONE
},
2666 INST_KEY_MENU(config_smime_add_certs_keymenu
, config_smime_add_certs_keys
);
2668 struct key config_smime_add_new_key
[] =
2672 {"I", N_("Import Key"), {MC_IMPORT
,3,{'i', ctrl('M'), ctrl('J')}}, KS_NONE
},
2673 {"C", N_("Create Key"), {MC_ADD
,1,{'c'}}, KS_NONE
},
2681 INST_KEY_MENU(config_smime_add_new_key_keymenu
, config_smime_add_new_key
);
2683 struct key config_smime_manage_certs_work_keys
[] =
2687 {"V", "[" N_("View Info") "]", {MC_CHOICE
,3,{'v',ctrl('M'),ctrl('J')}}, KS_NONE
},
2688 {"I", N_("Import Cert"), {MC_IMPORT
,1,{'i'}}, KS_NONE
},
2690 {"D", N_("Delete"), {MC_DELETE
,1,{'d'}}, KS_NONE
},
2691 {"U", N_("Undelete"), {MC_UNDELETE
,1,{'u'}}, KS_NONE
},
2692 {"X", N_("Expunge"), {MC_EXPUNGE
,1,{'x'}}, KS_NONE
},
2709 INST_KEY_MENU(config_smime_manage_certs_work_keymenu
, config_smime_manage_certs_work_keys
);
2711 struct key config_smime_view_cert
[] =
2715 {"V", "[" N_("View Info") "]", {MC_CHOICE
,3,{'v',ctrl('M'),ctrl('J')}}, KS_NONE
},
2716 {"D", N_("Delete pwd"), {MC_DELETE
,1,{'d'}},KS_NONE
},
2724 INST_KEY_MENU(config_smime_manage_view_cert_keymenu
, config_smime_view_cert
);
2726 struct key config_smime_view_cert_no_delete
[] =
2730 {"V", "[" N_("View Info") "]", {MC_CHOICE
,3,{'v',ctrl('M'),ctrl('J')}}, KS_NONE
},
2739 INST_KEY_MENU(config_smime_manage_view_cert_keymenu_no_delete
, config_smime_view_cert_no_delete
);
2741 struct key smime_certificate_info_keys
[] =
2744 {"E",N_("Exit Viewer"),{MC_EXIT
,1,{'e'}},KS_EXITMODE
},
2745 {"T",N_("Trust Cert"), {MC_TRUST
,1,{'t'}},KS_NONE
},
2746 {"D",N_("Delete"), {MC_DELETE
,1,{'d'}},KS_NONE
},
2747 {"U",N_("Undelete"), {MC_UNDELETE
,1,{'u'}},KS_NONE
},
2748 {"B",N_("Public Key"), {MC_PUBLIC
,1,{'b'}},KS_NONE
},
2749 {"R",N_("Private Key"),{MC_PRIVATE
,1,{'r'}},KS_NONE
},
2767 INST_KEY_MENU(smime_certificate_info_keymenu
, smime_certificate_info_keys
);
2770 struct key config_smime_manage_password_file_menu_keys
[] =
2774 {"S", "[" N_("Select") "]", {MC_CHOICE
,3,{'s',ctrl('M'),ctrl('J')}}, KS_NONE
},
2775 {"I", N_("Import Cert"), {MC_IMPORT
,1,{'i'}}, KS_NONE
},
2783 INST_KEY_MENU(config_smime_manage_password_file_menu_keymenu
, config_smime_manage_password_file_menu_keys
);
2788 * Internal prototypes
2790 void output_keymenu(struct key_menu
*, bitmap_t
, int, int);
2791 void format_keymenu(struct key_menu
*, bitmap_t
, int);
2792 void menu_clear_cmd_binding(struct key_menu
*, int);
2794 void print_inverted_label(int, MENUITEM
*);
2798 /* Saved key menu drawing state */
2800 struct key_menu
*km
;
2809 * Longest label that can be displayed in keymenu
2811 #define MAX_LABEL 40
2812 #define MAX_KEYNAME 3
2813 static struct key last_time_buf
[12];
2814 static int keymenu_is_dirty
= 1;
2817 mark_keymenu_dirty(void)
2819 keymenu_is_dirty
= 1;
2824 * Write an already formatted key_menu to the screen
2826 * Args: km -- key_menu structure
2827 * bm -- bitmap, 0's mean don't draw this key
2828 * row -- the row on the screen to begin on, negative values
2829 * are counted from the bottom of the screen up
2830 * column -- column on the screen to begin on
2832 * The bits in the bitmap are used from least significant to most significant,
2833 * not left to right. So, if you write out the bitmap in the normal way, for
2835 * bm[0] = 0x5, bm[1] = 0x8, bm[2] = 0x21, bm[3] = bm[4] = bm[5] = 0
2836 * 0000 0101 0000 1000 0010 0001 ...
2837 * means that menu item 0 (first row, first column) is set, item 1 (2nd row,
2838 * first column) is not set, item 2 is set, items 3-10 are not set, item 11
2839 * (2nd row, 6th and last column) is set. In the second menu (the second set
2840 * of 12 bits) items 0-3 are unset, 4 is set, 5-8 unset, 9 set, 10-11 unset.
2841 * That uses up bm[0] - bm[2].
2842 * Just to make sure, here it is drawn out for the first set of 12 items in
2843 * the first keymenu (0-11)
2844 * bm[0] x x x x x x x x bm[1] x x x x x x x x
2845 * 7 6 5 4 3 2 1 0 1110 9 8
2848 output_keymenu(struct key_menu
*km
, unsigned char *bm
, int row
, int column
)
2851 extern char term_name
[];
2853 register struct key
*k
;
2854 struct key
*last_time
;
2856 ufk
, /* using function keys */
2858 max_column
, /* number of columns on screen */
2859 off
; /* offset into keymap */
2860 struct variable
*vars
= ps_global
->vars
;
2861 COLOR_PAIR
*lastc
=NULL
, *label_color
=NULL
, *name_color
=NULL
;
2863 /* 6's are for UTF-8 */
2864 char keystr
[6*MAX_KEYNAME
+ 6*MAX_LABEL
+ 2];
2867 off
= km
->which
* 12;
2868 max_column
= ps_global
->ttyo
->screen_cols
;
2870 if((ps_global
->ttyo
->screen_rows
- FOOTER_ROWS(ps_global
)) < 0
2871 || max_column
<= 0){
2872 keymenu_is_dirty
= 1;
2877 real_row
= row
> 0 ? row
: ps_global
->ttyo
->screen_rows
+ row
;
2879 if(pico_usingcolor()){
2880 lastc
= pico_get_cur_color();
2881 if(lastc
&& VAR_KEYLABEL_FORE_COLOR
&& VAR_KEYLABEL_BACK_COLOR
&&
2882 pico_is_good_color(VAR_KEYLABEL_FORE_COLOR
) &&
2883 pico_is_good_color(VAR_KEYLABEL_BACK_COLOR
)){
2884 label_color
= new_color_pair(VAR_KEYLABEL_FORE_COLOR
,
2885 VAR_KEYLABEL_BACK_COLOR
);
2887 (void)pico_set_colorp(label_color
, PSC_NONE
);
2890 if(label_color
&& VAR_KEYNAME_FORE_COLOR
&& VAR_KEYNAME_BACK_COLOR
&&
2891 pico_is_good_color(VAR_KEYNAME_FORE_COLOR
) &&
2892 pico_is_good_color(VAR_KEYNAME_BACK_COLOR
)){
2893 name_color
= new_color_pair(VAR_KEYNAME_FORE_COLOR
,
2894 VAR_KEYNAME_BACK_COLOR
);
2898 if(keymenu_is_dirty
){
2899 ClearLines(real_row
, real_row
+1);
2900 keymenu_is_dirty
= 0;
2901 /* first time through, set up storage */
2902 if(!last_time_buf
[0].name
){
2903 for(i
= 0; i
< 12; i
++){
2904 last_time
= &last_time_buf
[i
];
2905 last_time
->name
= (char *) fs_get(6*MAX_KEYNAME
+ 1);
2906 last_time
->label
= (char *) fs_get(6*MAX_LABEL
+ 1);
2910 for(i
= 0; i
< 12; i
++)
2911 last_time_buf
[i
].column
= -1;
2914 for(i
= 0; i
< 12; i
++){
2918 dprint((9, "%2d %-7.7s %-10.10s %d\n", i
,
2919 km
== NULL
? "(no km)"
2920 : km
->keys
[e
].name
== NULL
? "(null)"
2922 km
== NULL
? "(no km)"
2923 : km
->keys
[e
].label
== NULL
? "(null)"
2924 : km
->keys
[e
].label
, km
? km
->keys
[e
].column
: 0));
2926 register_key(i
, NO_OP_COMMAND
, "", NULL
, 0, 0, 0, NULL
, NULL
);
2930 ufk
= F_ON(F_USE_FK
, ps_global
);
2931 dprint((9, "row: %d, real_row: %d, column: %d\n", row
,
2934 for(i
= 0; i
< 2; i
++){
2935 int c
, el
, empty
, fkey
, last_in_row
, fix_start
;
2937 char temp
[6*MAX_SCREEN_COLS
+1];
2938 char temp2
[6*MAX_SCREEN_COLS
+1];
2939 char this_label
[6*MAX_LABEL
+1];
2943 if(i
== 1 && !label_color
)
2945 if(i
== 1 && (!label_color
|| !struncmp(term_name
,"cygwin", 6)))
2947 max_column
--; /* Some terminals scroll if you write in the
2948 lower right hand corner. If user has a
2949 label_color set we'll take our chances.
2950 Otherwise, we'd get one cell of Normal. */
2953 * k is the key struct we're working on
2954 * c is the column number
2955 * el is an index into the whole keys array
2956 * Last_time_buf is ordered strangely. It goes row by row instead
2957 * of down each column like km does. J is an index into it.
2959 for(c
= 0, el
= off
+i
, k
= &km
->keys
[el
];
2960 k
< &km
->keys
[off
+12] && c
< max_column
;
2963 if(k
->column
> max_column
)
2968 fkey
= 1 + k
- &km
->keys
[off
];
2970 empty
= (!bitnset(el
,bm
) || !(k
->name
&& *k
->name
));
2971 last_time
= &last_time_buf
[j
];
2972 if(k
+2 < &km
->keys
[off
+12]){
2974 next_col
= last_time_buf
[j
+1].column
;
2975 fix_start
= (k
== &km
->keys
[off
] ||
2976 k
== &km
->keys
[off
+1]) ? k
->column
: 0;
2984 * Make sure there is a space between this label and
2985 * the next name. That is, we prefer a space to the
2986 * extra character of the label because the space
2987 * separates the commands and looks nicer.
2991 char tmp_label
[6*MAX_LABEL
+1];
2993 if(k
->label
[0] == '[' && k
->label
[(l
=strlen(k
->label
))-1] == ']' && l
> 2){
2995 * Can't write in k->label, which might be a constant array.
2997 strncpy(tmp_label
, &k
->label
[1], MIN(sizeof(tmp_label
),l
-2));
2998 tmp_label
[MIN(sizeof(tmp_label
)-1,l
-2)] = '\0';
3000 snprintf(this_label
, sizeof(this_label
), "[%s]", _(tmp_label
));
3003 strncpy(this_label
, _(k
->label
), sizeof(this_label
));
3005 this_label
[sizeof(this_label
)-1] = '\0';
3009 trunc
= (k
+2)->column
- k
->column
3010 - ((k
->name
? utf8_width(k
->name
) : 0) + 1);
3012 * trunc columns available for label but we don't want the label
3013 * to go all the way to the edge
3015 if(utf8_width(this_label
) >= trunc
){
3017 strncpy(tmp_label
, this_label
, sizeof(tmp_label
));
3018 tmp_label
[sizeof(tmp_label
)-1] = '\0';
3019 l
= utf8_pad_to_width(this_label
, tmp_label
, sizeof(this_label
)-2, trunc
-1, 1);
3020 this_label
[l
++] = SPACE
;
3021 this_label
[l
] = '\0';;
3024 this_label
[0] = SPACE
;
3026 this_label
[0] = '\0';
3028 this_label
[sizeof(this_label
)-1] = '\0';
3033 this_label
[0] = '\0';
3035 if(!(k
->column
== last_time
->column
3036 && (last_in_row
|| (k
+2)->column
<= next_col
)
3037 && ((empty
&& !*last_time
->label
&& !*last_time
->name
)
3039 && this_label
&& !strcmp(this_label
,last_time
->label
)
3040 && ((k
->name
&& !strcmp(k
->name
,last_time
->name
))
3043 /* blank out key with spaces */
3044 strncpy(temp
, repeat_char(
3045 ((last_in_row
|| (k
+2)->column
> max_column
)
3051 SPACE
), sizeof(temp
));
3052 temp
[sizeof(temp
)-1] = '\0';
3053 last_time
->column
= k
->column
;
3054 *last_time
->name
= '\0';
3055 *last_time
->label
= '\0';
3056 MoveCursor(real_row
+ i
, column
+ (fix_start
? 0 : k
->column
));
3057 Write_to_screen(temp
);
3058 c
= (fix_start
? 0 : k
->column
) + strlen(temp
);
3061 /* make sure extra space before key name is there */
3063 strncpy(temp
, repeat_char(k
->column
, SPACE
), sizeof(temp
));
3064 temp
[sizeof(temp
)-1] = '\0';
3065 MoveCursor(real_row
+ i
, column
+ 0);
3066 Write_to_screen(temp
);
3069 /* short name of the key */
3071 snprintf(temp
, sizeof(temp
), "F%d", fkey
);
3073 strncpy(temp
, k
->name
, sizeof(temp
));
3075 temp
[sizeof(temp
)-1] = '\0';
3076 last_time
->column
= k
->column
;
3077 strncpy(last_time
->name
, temp
, 6*MAX_KEYNAME
);
3078 last_time
->name
[6*MAX_KEYNAME
] = '\0';
3079 /* make sure name not too long */
3081 strncpy(keystr
, temp
, sizeof(keystr
));
3082 keystr
[sizeof(keystr
)-1] = '\0';
3084 MoveCursor(real_row
+ i
, column
+ k
->column
);
3087 (void)pico_set_colorp(name_color
, PSC_NONE
);
3092 Write_to_screen(temp
);
3093 c
= k
->column
+ utf8_width(temp
);
3099 /* now the space after the name and the label */
3104 strncat(temp
, this_label
, sizeof(temp
)-strlen(temp
)-1);
3106 /* Don't run over the right hand edge */
3107 if(utf8_width(temp
) > max_column
- c
){
3110 l
= utf8_pad_to_width(temp2
, temp
, sizeof(temp2
)-1, max_column
-c
, 1);
3112 strncpy(temp
, temp2
, sizeof(temp
));
3113 temp
[sizeof(temp
)-1] = '\0';
3116 c
+= utf8_width(temp
);
3120 strncat(keystr
, temp
, sizeof(keystr
)-strlen(keystr
)-1);
3121 keystr
[sizeof(keystr
)-1] = '\0';
3123 /* fill out rest of this key with spaces */
3126 strncat(temp
, repeat_char(max_column
- c
, SPACE
), sizeof(temp
)-strlen(temp
)-1);
3130 if(c
< (k
+2)->column
){
3132 repeat_char((k
+2)->column
- c
, SPACE
), sizeof(temp
)-strlen(temp
)-1);
3137 temp
[sizeof(temp
)-1] = '\0';
3140 strncpy(last_time
->label
, this_label
, 6*MAX_LABEL
);
3141 last_time
->label
[6*MAX_LABEL
] = '\0';
3143 (void)pico_set_colorp(label_color
, PSC_NONE
);
3145 Write_to_screen(temp
);
3150 /* fill in what register_key needs from cached data */
3151 snprintf(keystr
, sizeof(keystr
), "%s %s", last_time
->name
, last_time
->label
);
3157 * If label ends in space,
3158 * don't register the space part of label.
3160 len
= strlen(keystr
);
3161 while(keystr
[len
-1] == SPACE
)
3165 register_key(j
, ufk
? PF1
+ fkey
- 1
3166 : (k
->name
[0] == '^')
3168 : (!strucmp(k
->name
, "ret"))
3170 : (!strucmp(k
->name
, "tab"))
3172 : (!strucmp(k
->name
, "spc"))
3174 : (!strucmp(k
->name
, HISTORY_UP_KEYNAME
))
3176 : (!strucmp(k
->name
, HISTORY_DOWN_KEYNAME
))
3179 ? ((isascii((int) k
->bind
.ch
[0]) && islower((int) k
->bind
.ch
[0]))
3180 ? toupper((unsigned char) k
->bind
.ch
[0])
3183 keystr
, print_inverted_label
,
3184 real_row
+i
, k
->column
, len
,
3185 name_color
, label_color
);
3191 while(++j
< 6*(i
+1))
3192 last_time_buf
[j
].column
= -1;
3197 (void)pico_set_colorp(lastc
, PSC_NONE
);
3198 free_color_pair(&lastc
);
3200 free_color_pair(&label_color
);
3202 free_color_pair(&name_color
);
3208 * Clear the key menu lines.
3211 blank_keymenu(int row
, int column
)
3213 struct variable
*vars
= ps_global
->vars
;
3216 if(FOOTER_ROWS(ps_global
) > 1){
3217 km_state
.blanked
= 1;
3219 km_state
.column
= column
;
3220 MoveCursor(row
, column
);
3221 lastc
= pico_set_colors(VAR_KEYLABEL_FORE_COLOR
,
3222 VAR_KEYLABEL_BACK_COLOR
, PSC_NORM
|PSC_RET
);
3225 MoveCursor(row
+1, column
);
3229 (void)pico_set_colorp(lastc
, PSC_NONE
);
3230 free_color_pair(&lastc
);
3237 draw_cancel_keymenu(void)
3242 draw_keymenu(&cancel_keymenu
, bitmap
, ps_global
->ttyo
->screen_cols
,
3243 1-FOOTER_ROWS(ps_global
), 0, FirstMenu
);
3248 clearfooter(struct pine
*ps
)
3250 ClearLines(ps
->ttyo
->screen_rows
- 3, ps
->ttyo
->screen_rows
- 1);
3251 mark_keymenu_dirty();
3252 mark_status_unknown();
3257 * Calculate formatting for key menu at bottom of screen
3259 * Args: km -- The key_menu structure to format
3260 * bm -- Bitmap indicating which menu items should be displayed. If
3261 * an item is NULL, that also means it shouldn't be displayed.
3262 * Sometimes the bitmap will be turned on in that case and just
3263 * rely on the NULL entry.
3264 * width -- the screen width to format it at
3266 * If already formatted for this particular screen width and the requested
3267 * bitmap and formatted bitmap agree, return.
3269 * The formatting results in the column field in the key_menu being
3270 * filled in. The column field is the column to start the label at, the
3271 * name of the key; after that is the label for the key. The basic idea
3272 * is to line up the end of the names and beginning of the labels. If
3273 * the name is too long and shifting it left would run into previous
3274 * label, then shift the whole menu right, or at least that entry if
3275 * things following are short enough to fit back into the regular
3276 * spacing. This has to be calculated and not fixed so it can cope with
3280 format_keymenu(struct key_menu
*km
, unsigned char *bm
, int width
)
3282 int spacing
[7], w
[6], min_w
[6], tw
[6], extra
[6], ufk
, i
, set
;
3284 /* already formatted? */
3285 if(!km
|| (width
== km
->width
&&
3286 km
->how_many
<= km
->formatted_hm
&&
3287 !memcmp(km
->bitmap
, bm
, BM_SIZE
)))
3291 * If we're in the initial command sequence we may be using function
3292 * keys instead of alphas, or vice versa, so we want to recalculate
3293 * the formatting next time through.
3295 if((F_ON(F_USE_FK
,ps_global
) && ps_global
->orig_use_fkeys
) ||
3296 (F_OFF(F_USE_FK
,ps_global
) && !ps_global
->orig_use_fkeys
)){
3298 km
->formatted_hm
= km
->how_many
;
3299 memcpy(km
->bitmap
, bm
, BM_SIZE
);
3302 ufk
= F_ON(F_USE_FK
,ps_global
); /* ufk = "Using Function Keys" */
3304 /* set up "ideal" columns to start in, plus fake 7th column start */
3305 for(i
= 0; i
< 7; i
++)
3306 spacing
[i
] = (i
* width
) / 6;
3308 /* Loop thru each set of 12 menus */
3309 for(set
= 0; set
< km
->how_many
; set
++){
3310 int k_top
, k_bot
, top_name_width
, bot_name_width
,
3311 top_label_width
, bot_label_width
, done
, offset
, next_one
;
3312 struct key
*keytop
, *keybot
;
3314 offset
= set
* 12; /* offset into keymenu */
3317 * Find the required widths for each box.
3319 for(i
= 0; i
< 6; i
++){
3320 k_top
= offset
+ i
*2;
3322 keytop
= &km
->keys
[k_top
];
3323 keybot
= &km
->keys
[k_bot
];
3326 * The width of a box is the max width of top or bottom name,
3327 * plus 1 space, plus the max width of top or bottom label.
3331 * ||||||||||| = 2 + 1 + 8 = 11
3333 * Then we adjust that by adding one space after the box to
3334 * separate it from the next box. The last box doesn't need that
3335 * but we may need an extra space for last box to avoid putting
3336 * a character in the lower right hand cell of display.
3337 * We also have a minimum label width (if screen is really narrow)
3338 * of 3, so at least "Hel" and "Can" shows and the rest gets
3339 * truncated off right hand side.
3342 top_name_width
= (keytop
->name
&& bitnset(k_top
,bm
))
3343 ? (ufk
? (i
>= 5 ? 3 : 2)
3344 : utf8_width(keytop
->name
)) : 0;
3345 bot_name_width
= (keybot
->name
&& bitnset(k_bot
,bm
))
3346 ? (ufk
? (i
>= 4 ? 3 : 2)
3347 : utf8_width(keybot
->name
)) : 0;
3349 * Labels are complicated by the fact that we want to look
3350 * up their translation, but also by the fact that we surround
3351 * the word with brackets like [ViewMsg] when the command is
3352 * the default. We want to look up the translation of the
3353 * part inside the brackets, not the whole thing.
3355 if(keytop
->label
&& bitnset(k_top
,bm
)){
3356 char tmp_label
[6*MAX_LABEL
+1];
3359 if(keytop
->label
[0] == '[' && keytop
->label
[(l
=strlen(keytop
->label
))-1] == ']' && l
> 2){
3361 * Can't write in k->label, which might be a constant array.
3363 strncpy(tmp_label
, &keytop
->label
[1], MIN(sizeof(tmp_label
),l
-2));
3364 tmp_label
[MIN(sizeof(tmp_label
)-1,l
-2)] = '\0';
3366 top_label_width
= 2 + utf8_width(_(tmp_label
));
3369 top_label_width
= utf8_width(_(keytop
->label
));
3372 top_label_width
= 0;
3374 if(keybot
->label
&& bitnset(k_bot
,bm
)){
3375 char tmp_label
[6*MAX_LABEL
+1];
3378 if(keybot
->label
[0] == '[' && keybot
->label
[(l
=strlen(keybot
->label
))-1] == ']' && l
> 2){
3379 strncpy(tmp_label
, &keybot
->label
[1], MIN(sizeof(tmp_label
),l
-2));
3380 tmp_label
[MIN(sizeof(tmp_label
)-1,l
-2)] = '\0';
3382 bot_label_width
= 2 + utf8_width(_(tmp_label
));
3385 bot_label_width
= utf8_width(_(keybot
->label
));
3388 bot_label_width
= 0;
3391 * The 1 for i < 5 is the space between adjacent boxes.
3392 * The last 1 or 0 when i == 5 is so that we won't try to put
3393 * a character in the lower right cell of the display, since that
3394 * causes a linefeed on some terminals.
3396 w
[i
] = MAX(top_name_width
, bot_name_width
) + 1 +
3397 MAX(top_label_width
, bot_label_width
) +
3399 : ((bot_label_width
>= top_label_width
) ? 1 : 0));
3402 * The smallest we'll squeeze a column.
3404 * X ABCDEF we'll squeeze to X ABC
3407 min_w
[i
] = MAX(top_name_width
, bot_name_width
) + 1 +
3408 MIN(MAX(top_label_width
, bot_label_width
), 3) +
3410 : ((bot_label_width
>= top_label_width
) ? 1 : 0));
3412 /* init trial width */
3413 tw
[i
] = spacing
[i
+1] - spacing
[i
];
3414 extra
[i
] = tw
[i
] - w
[i
]; /* negative if it doesn't fit */
3418 * See if we can fit everything on the screen.
3422 int smallest_extra
, how_small
;
3424 /* Find smallest extra */
3425 smallest_extra
= -1;
3427 for(i
= 0; i
< 6; i
++){
3428 if(extra
[i
] < how_small
){
3430 how_small
= extra
[i
];
3434 if(how_small
>= 0) /* everything fits */
3437 int take_from
, how_close
;
3440 * Find the one that is closest to the ideal width
3441 * that has some extra to spare.
3445 for(i
= 0; i
< 6; i
++){
3447 ((spacing
[i
+1]-spacing
[i
]) - tw
[i
]) < how_close
){
3449 how_close
= (spacing
[i
+1]-spacing
[i
]) - tw
[i
];
3455 * Found one. Take one from take_from and add it
3456 * to the smallest_extra.
3458 tw
[smallest_extra
]++;
3459 extra
[smallest_extra
]++;
3467 * Oops. Not enough space to fit everything in.
3468 * Some of the labels are truncated. Some may even be
3469 * truncated past the minimum. We make sure that each
3470 * field is at least its minimum size, and then we cut
3471 * back those over the minimum until we can fit all the
3472 * minimal names on the screen (if possible).
3474 for(i
= 0; i
< 6; i
++)
3475 tw
[i
] = MAX(tw
[i
], min_w
[i
]);
3478 for(i
= 0; i
< 6; i
++)
3479 used_width
+= tw
[i
];
3481 while(used_width
> width
&& !done
){
3482 int candidate
, excess
;
3485 * Find the one with the most width over it's
3490 for(i
= 0; i
< 6; i
++){
3491 if(tw
[i
] - min_w
[i
] > excess
){
3493 excess
= tw
[i
] - min_w
[i
];
3511 * Assign the format we came up with to the keymenu.
3514 for(i
= 0; i
< 6; i
++){
3515 k_top
= offset
+ i
*2;
3517 keytop
= &km
->keys
[k_top
];
3518 keybot
= &km
->keys
[k_bot
];
3519 top_name_width
= (keytop
->name
&& bitnset(k_top
,bm
))
3520 ? (ufk
? (i
>= 5 ? 3 : 2)
3521 : utf8_width(keytop
->name
)) : 0;
3522 bot_name_width
= (keybot
->name
&& bitnset(k_bot
,bm
))
3523 ? (ufk
? (i
>= 4 ? 3 : 2)
3524 : utf8_width(keybot
->name
)) : 0;
3526 if(top_name_width
>= bot_name_width
){
3527 keytop
->column
= next_one
;
3528 keybot
->column
= next_one
+ (top_name_width
- bot_name_width
);
3531 keytop
->column
= next_one
+ (bot_name_width
- top_name_width
);
3532 keybot
->column
= next_one
;
3542 * Draw the key menu at bottom of screen
3544 * Args: km -- key_menu structure
3545 * bitmap -- which fields are active
3546 * width -- the screen width to format it at
3547 * row -- where to put it
3548 * column -- where to put it
3549 * what -- this is an enum telling us whether to display the
3550 * first menu (first set of 12 keys), or to display the same
3551 * one we displayed last time, or to display a particular
3552 * one (which), or to display the next one.
3554 * Fields are inactive if *either* the corresponding bitmap entry is 0 *or*
3555 * the actual entry in the key_menu is NULL. Therefore, it is sometimes
3556 * useful to just turn on all the bits in a bitmap and let the NULLs take
3557 * care of it. On the other hand, the bitmap gives a convenient method
3558 * for turning some keys on or off dynamically or due to options.
3559 * Both methods are used about equally.
3561 * Also saves the state for a possible redraw later.
3563 * Row should usually be a negative number. If row is 0, the menu is not
3567 draw_keymenu(struct key_menu
*km
, unsigned char *bitmap
, int width
, int row
,
3568 int column
, OtherMenu what
)
3571 configure_menu_items (km
, bitmap
);
3573 format_keymenu(km
, bitmap
, width
);
3575 /*--- save state for a possible redraw ---*/
3578 km_state
.column
= column
;
3579 memcpy(km_state
.bitmap
, bitmap
, BM_SIZE
);
3584 if(km_state
.blanked
)
3585 keymenu_is_dirty
= 1;
3587 if(what
== FirstMenu
|| what
== SecondMenu
|| what
== ThirdMenu
||
3588 what
== FourthMenu
|| what
== MenuNotSet
){
3589 if(what
== FirstMenu
|| what
== MenuNotSet
)
3591 else if(what
== SecondMenu
)
3593 else if(what
== ThirdMenu
)
3595 else if(what
== FourthMenu
)
3598 if(km
->which
>= km
->how_many
)
3601 else if(what
== NextMenu
)
3602 km
->which
= (km
->which
+ 1) % km
->how_many
;
3603 /* else what must be SameMenu */
3605 output_keymenu(km
, bitmap
, row
, column
);
3607 km_state
.blanked
= 0;
3612 redraw_keymenu(void)
3614 if(km_state
.blanked
)
3615 blank_keymenu(km_state
.row
, km_state
.column
);
3617 draw_keymenu(km_state
.km
, km_state
.bitmap
, ps_global
->ttyo
->screen_cols
,
3618 km_state
.row
, km_state
.column
, SameMenu
);
3623 * end_keymenu - free resources associated with keymenu display cache
3630 for(i
= 0; i
< 12; i
++){
3631 if(last_time_buf
[i
].name
)
3632 fs_give((void **) &last_time_buf
[i
].name
);
3634 if(last_time_buf
[i
].label
)
3635 fs_give((void **) &last_time_buf
[i
].label
);
3640 /*----------------------------------------------------------------------
3641 Reveal Keymenu to Pine Command mappings
3647 menu_command(UCS keystroke
, struct key_menu
*menu
)
3651 if(keystroke
== KEY_UTF8
|| keystroke
== KEY_UNKNOWN
)
3657 if(F_ON(F_USE_FK
,ps_global
)){
3658 /* No alpha commands permitted in function key mode */
3659 if(keystroke
< 0x80 && isalpha((unsigned char) keystroke
))
3662 /* Tres simple: compute offset, and test */
3663 if(keystroke
>= F1
&& keystroke
<= F12
){
3664 n
= (menu
->which
* 12) + (keystroke
- F1
);
3665 if(bitnset(n
, menu
->bitmap
))
3666 return(menu
->keys
[n
].bind
.cmd
);
3669 else if(keystroke
>= F1
&& keystroke
<= F12
)
3672 /* if ascii, coerce lower case */
3673 if(keystroke
< 0x80 && isupper((unsigned char) keystroke
))
3674 keystroke
= tolower((unsigned char) keystroke
);
3676 /* keep this here for Windows port */
3677 if((keystroke
= validatekeys(keystroke
)) == KEY_JUNK
)
3680 /* Scan the list for any keystroke/command binding */
3681 if(keystroke
!= NO_OP_COMMAND
)
3682 for(i
= (menu
->how_many
* 12) - 1; i
>= 0; i
--)
3683 if(bitnset(i
, menu
->bitmap
))
3684 for(n
= menu
->keys
[i
].bind
.nch
- 1; n
>= 0; n
--)
3685 if(keystroke
== menu
->keys
[i
].bind
.ch
[n
])
3686 return(menu
->keys
[i
].bind
.cmd
);
3689 * If explicit mapping failed, check feature mappings and
3690 * hardwired defaults...
3692 if(F_ON(F_ENABLE_PRYNT
,ps_global
)
3693 && (keystroke
== 'y' || keystroke
== 'Y')){
3694 /* SPECIAL CASE: Scan the list for print bindings */
3695 for(i
= (menu
->how_many
* 12) - 1; i
>= 0; i
--)
3696 if(bitnset(i
, menu
->bitmap
))
3697 if(menu
->keys
[i
].bind
.cmd
== MC_PRINTMSG
3698 || menu
->keys
[i
].bind
.cmd
== MC_PRINTTXT
)
3699 return(menu
->keys
[i
].bind
.cmd
);
3702 if(F_ON(F_ENABLE_LESSTHAN_EXIT
,ps_global
)
3703 && (keystroke
== '<' || keystroke
== ','
3704 || (F_ON(F_ARROW_NAV
,ps_global
) && keystroke
== KEY_LEFT
))){
3705 /* SPECIAL CASE: Scan the list for MC_EXIT bindings */
3706 for(i
= (menu
->how_many
* 12) - 1; i
>= 0; i
--)
3707 if(bitnset(i
, menu
->bitmap
))
3708 if(menu
->keys
[i
].bind
.cmd
== MC_EXIT
)
3713 * If no match after scanning bindings, try universally
3714 * bound keystrokes...
3726 return(MC_CHARDOWN
);
3730 return(MC_CHARRIGHT
);
3734 return(MC_CHARLEFT
);
3750 if(USER_INPUT_TIMEOUT(ps_global
))
3751 user_input_timeout_exit(ps_global
->hours_to_timeout
); /* no return */
3759 return(MC_UNKNOWN
); /* utter failure */
3764 /*----------------------------------------------------------------------
3765 Set up a binding for cmd, with one key bound to it.
3766 Use menu_add_binding to add more keys to this binding.
3768 Args: menu -- the keymenu
3769 key -- the initial key to bind to
3770 cmd -- the command to initialize to
3771 name -- a pointer to the string to point name to
3772 label -- a pointer to the string to point label to
3773 keynum -- which key in the keys array to initialize
3775 For translation purposes, the label in the calling routine
3776 should be wrapped in an N_() macro.
3780 menu_init_binding(struct key_menu
*menu
, UCS key
, int cmd
, char *name
, char *label
, int keynum
)
3782 /* if ascii, coerce to lower case */
3783 if(key
< 0x80 && isupper((unsigned char)key
))
3784 key
= tolower((unsigned char)key
);
3786 /* remove binding from any other key */
3787 menu_clear_cmd_binding(menu
, cmd
);
3789 menu
->keys
[keynum
].name
= name
;
3790 menu
->keys
[keynum
].label
= label
;
3791 menu
->keys
[keynum
].bind
.cmd
= cmd
;
3792 menu
->keys
[keynum
].bind
.nch
= 0;
3793 menu
->keys
[keynum
].bind
.ch
[menu
->keys
[keynum
].bind
.nch
++] = key
;
3797 /*----------------------------------------------------------------------
3798 Add a key/command binding to the given keymenu structure
3804 menu_add_binding(struct key_menu
*menu
, UCS key
, int cmd
)
3808 /* NOTE: cmd *MUST* already have had a binding */
3809 for(i
= (menu
->how_many
* 12) - 1; i
>= 0; i
--)
3810 if(menu
->keys
[i
].bind
.cmd
== cmd
){
3811 for(n
= menu
->keys
[i
].bind
.nch
- 1;
3812 n
>= 0 && key
!= menu
->keys
[i
].bind
.ch
[n
];
3816 /* if ascii, coerce to lower case */
3817 if(key
< 0x80 && isupper((unsigned char)key
))
3818 key
= tolower((unsigned char)key
);
3820 if(n
< 0) /* not already bound, bind it */
3821 menu
->keys
[i
].bind
.ch
[menu
->keys
[i
].bind
.nch
++] = key
;
3828 /*----------------------------------------------------------------------
3829 REMOVE a key/command binding from the given keymenu structure
3835 menu_clear_binding(struct key_menu
*menu
, UCS key
)
3839 /* if ascii, coerce to lower case */
3840 if(key
< 0x80 && isupper((unsigned char)key
))
3841 key
= tolower((unsigned char)key
);
3843 for(i
= (menu
->how_many
* 12) - 1; i
>= 0; i
--)
3844 for(n
= menu
->keys
[i
].bind
.nch
- 1; n
>= 0; n
--)
3845 if(key
== menu
->keys
[i
].bind
.ch
[n
]){
3846 int cmd
= menu
->keys
[i
].bind
.cmd
;
3848 for(--menu
->keys
[i
].bind
.nch
; n
< menu
->keys
[i
].bind
.nch
; n
++)
3849 menu
->keys
[i
].bind
.ch
[n
] = menu
->keys
[i
].bind
.ch
[n
+1];
3859 menu_clear_cmd_binding(struct key_menu
*menu
, int cmd
)
3863 for(i
= (menu
->how_many
* 12) - 1; i
>= 0; i
--){
3864 if(cmd
== menu
->keys
[i
].bind
.cmd
){
3865 menu
->keys
[i
].name
= NULL
;
3866 menu
->keys
[i
].label
= NULL
;
3867 menu
->keys
[i
].bind
.cmd
= 0;
3868 menu
->keys
[i
].bind
.nch
= 0;
3869 menu
->keys
[i
].bind
.ch
[0] = 0;
3876 menu_binding_index(struct key_menu
*menu
, int cmd
)
3880 for(i
= 0; i
< menu
->how_many
* 12; i
++)
3881 if(cmd
== menu
->keys
[i
].bind
.cmd
)
3890 * print_inverted_label - highlight the label of the given menu item.
3891 * (callback from pico mouse routines)
3893 * So far, this is only
3894 * ever called with the top left row equal to the bottom right row.
3895 * If you change that you probably need to fix it.
3898 print_inverted_label(int state
, MENUITEM
*m
)
3901 int col_offsetwid
, col_offsetchars
, do_color
= 0, skipwid
= 0, skipchars
= 0, len
, c
;
3904 char labelpart
[100];
3906 COLOR_PAIR
*name_color
= NULL
, *label_color
= NULL
, *lastc
= NULL
;
3907 struct variable
*vars
= ps_global
->vars
;
3909 if(m
->label
&& (lp
=strchr(m
->label
, ' '))){
3914 col_offsetwid
= utf8_width(m
->label
);
3915 col_offsetchars
= lp
- m
->label
;
3919 col_offsetwid
= col_offsetchars
= 0;
3921 if(pico_usingcolor() && ((VAR_KEYLABEL_FORE_COLOR
&&
3922 VAR_KEYLABEL_BACK_COLOR
) ||
3923 (VAR_KEYNAME_FORE_COLOR
&&
3924 VAR_KEYNAME_BACK_COLOR
))){
3925 lastc
= pico_get_cur_color();
3927 if(VAR_KEYNAME_FORE_COLOR
&& VAR_KEYNAME_BACK_COLOR
){
3928 name_color
= state
? new_color_pair(VAR_KEYNAME_BACK_COLOR
,
3929 VAR_KEYNAME_FORE_COLOR
)
3930 : new_color_pair(VAR_KEYNAME_FORE_COLOR
,
3931 VAR_KEYNAME_BACK_COLOR
);
3933 else if(VAR_REV_FORE_COLOR
&& VAR_REV_BACK_COLOR
)
3934 name_color
= new_color_pair(VAR_REV_FORE_COLOR
, VAR_REV_BACK_COLOR
);
3936 if(VAR_KEYLABEL_FORE_COLOR
&& VAR_KEYLABEL_BACK_COLOR
){
3937 label_color
= state
? new_color_pair(VAR_KEYLABEL_BACK_COLOR
,
3938 VAR_KEYLABEL_FORE_COLOR
)
3939 : new_color_pair(VAR_KEYLABEL_FORE_COLOR
,
3940 VAR_KEYLABEL_BACK_COLOR
);
3942 else if(VAR_REV_FORE_COLOR
&& VAR_REV_BACK_COLOR
){
3943 label_color
= state
? new_color_pair(VAR_REV_FORE_COLOR
,
3945 : new_color_pair(VAR_NORM_FORE_COLOR
,
3946 VAR_NORM_BACK_COLOR
);
3950 * See if we can grok all these colors. If not, we're going to
3951 * punt and pretend there are no colors at all.
3953 if(!pico_is_good_colorpair(name_color
) ||
3954 !pico_is_good_colorpair(label_color
)){
3956 free_color_pair(&name_color
);
3958 free_color_pair(&label_color
);
3960 free_color_pair(&lastc
);
3964 (void)pico_set_colorp(label_color
, PSC_NONE
);
3965 if(!(VAR_KEYLABEL_FORE_COLOR
&& VAR_KEYLABEL_BACK_COLOR
)){
3976 * Command name's already inverted, leave it.
3978 skipwid
= state
? 0 : col_offsetwid
;
3979 skipchars
= state
? 0 : col_offsetchars
;
3986 MoveCursor((int)(m
->tl
.r
), (int)(m
->tl
.c
) + skipwid
);
3988 label
= m
->label
? m
->label
: "";
3989 len
= strlen(label
);
3992 * this is a bit complicated by the fact that we have to keep track of
3993 * the screenwidth as we print the label, because the screenwidth might
3994 * not be the same as the number of characters.
3995 * UNTESTED SINCE switching to UTF-8 *
3997 for(i
= m
->tl
.r
; i
<= m
->br
.r
; i
++){
3998 /* collect part before name */
3999 for(k
=0, j
= m
->tl
.c
+ skipchars
; j
< MIN(m
->lbl
.c
,m
->br
.c
); j
++){
4000 if(k
< sizeof(prename
))
4004 if(k
< sizeof(prename
))
4007 /* collect name part */
4008 for(k
=0; j
< MIN(m
->lbl
.c
+col_offsetchars
,m
->br
.c
); j
++){
4009 c
= (i
== m
->lbl
.r
&&
4010 j
- m
->lbl
.c
< len
) ? label
[j
- m
->lbl
.c
] : ' ';
4011 if(k
< sizeof(namepart
))
4015 if(k
< sizeof(namepart
))
4018 /* collect label part */
4019 for(k
=0; j
<= m
->br
.c
; j
++){
4020 c
= (i
== m
->lbl
.r
&&
4021 j
- m
->lbl
.c
< len
) ? label
[j
- m
->lbl
.c
] : ' ';
4022 if(k
< sizeof(labelpart
))
4026 if(k
< sizeof(labelpart
))
4027 labelpart
[k
] = '\0';
4031 Write_to_screen(prename
);
4034 if(name_color
&& col_offsetchars
)
4035 (void) pico_set_colorp(name_color
, PSC_NONE
);
4037 Write_to_screen(namepart
);
4041 if(name_color
&& col_offsetchars
){
4043 (void) pico_set_colorp(label_color
, PSC_NONE
);
4052 Write_to_screen(labelpart
);
4057 (void)pico_set_colorp(lastc
, PSC_NONE
);
4058 free_color_pair(&lastc
);
4063 pico_set_normal_color();
4066 free_color_pair(&name_color
);
4068 free_color_pair(&label_color
);
4080 * This function scans the key menu and calls mswin.c functions
4081 * to build a corresponding windows menu.
4084 configure_menu_items (struct key_menu
*km
, bitmap_t bitmap
)
4090 mswin_menuitemclear ();
4095 for (i
= 0, k
= km
->keys
; i
< km
->how_many
* 12; i
++, k
++) {
4096 if (k
->name
!= NULL
&& k
->label
!= NULL
&& bitnset (i
, bitmap
) &&
4097 k
->menuitem
!= KS_NONE
) {
4099 if (k
->name
[0] == '^')
4100 key
= ctrl(k
->name
[1]);
4101 else if (strcmp(k
->name
, "Ret") == 0)
4103 else if (strcmp(k
->name
, "Spc") == 0)
4108 mswin_menuitemadd (key
, k
->label
, k
->menuitem
, 0);