2 * $Id: keymenu.h 1074 2008-06-04 00:08:43Z hubert@u.washington.edu $
4 * ========================================================================
5 * Copyright 2013-2020 Eduardo Chappa
6 * Copyright 2006-2008 University of Washington
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * ========================================================================
17 #ifndef PINE_KEYMENU_INCLUDED
18 #define PINE_KEYMENU_INCLUDED
22 #include "../pith/state.h"
23 #include "../pith/bitmap.h"
27 A key menu has two ways to turn on and off individual items in the menu.
28 If there is a null entry in the key_menu structure for that key, then
29 it is off. Also, if the passed bitmap has a zero in the position for
30 that key, then it is off. This means you can usually set all of the
31 bitmaps and only turn them off if you want to kill a key that is normally
33 Each key_menu is an array of keys with a multiple of 12 number of keys.
36 Argument to draw_keymenu(). These are to identify which of the possibly
37 multiple sets of twelve keys should be shown in the keymenu. That is,
38 a keymenu may have 24 or 36 keys, so that there are 2 or 3 different
39 screens of key menus for that keymenu. FirstMenu means to use the
40 first twelve, NextTwelve uses the one after the previous one, SameTwelve
43 typedef enum {MenuNotSet
= 0, FirstMenu
, NextMenu
, SameMenu
,
44 SecondMenu
, ThirdMenu
, FourthMenu
} OtherMenu
;
48 char *name
; /* the short name */
49 char *label
; /* the descriptive label */
51 short cmd
; /* the resulting command */
52 short nch
; /* how many of ch are active */
53 UCS ch
[11]; /* which keystrokes trigger cmd */
55 KS_OSDATAVAR
/* slot for port-specific data */
56 short column
; /* menu col after formatting */
61 unsigned int how_many
:4; /* how many separate sets of 12 */
62 unsigned int which
:4; /* which of the sets are we using */
63 unsigned int width
:8; /* screen width when formatting done */
64 struct key
*keys
; /* array of how_many*12 size structs */
65 unsigned int formatted_hm
:4; /* how_many when formatting done */
71 * Definitions for the various Menu Commands...
73 #define MC_NONE 0 /* NO command defined */
74 #define MC_UNKNOWN 200
77 /* Cursor/page Motion */
79 #define MC_CHARDOWN 101
80 #define MC_CHARRIGHT 102
81 #define MC_CHARLEFT 103
82 #define MC_GOTOBOL 104
83 #define MC_GOTOEOL 105
84 #define MC_GOTOSOP 106
85 #define MC_GOTOEOP 107
89 #define MC_HOMEKEY 111
92 /* New Screen Commands */
98 #define MC_VIEW_TEXT 505
99 #define MC_VIEW_ATCH 506
100 #define MC_FOLDERS 507
101 #define MC_ADDRBOOK 508
102 #define MC_RELNOTES 509
103 #define MC_KBLOCK 510
104 #define MC_JOURNAL 511
106 #define MC_COLLECTIONS 513
107 #define MC_PARENT 514
109 #define MC_LISTMGR 516
110 #define MC_THRDINDX 517
111 #define MC_SECURITY 518
113 /* Commands within Screens */
114 #define MC_NEXTITEM 700
115 #define MC_PREVITEM 701
116 #define MC_DELETE 702
117 #define MC_UNDELETE 703
118 #define MC_COMPOSE 704
120 #define MC_FORWARD 706
123 #define MC_WHEREIS 709
125 #define MC_PRINTMSG 711
126 #define MC_PRINTTXT 712
129 #define MC_EXPORT 715
130 #define MC_IMPORT 716
131 #define MC_EXPUNGE 717
132 #define MC_UNEXCLUDE 718
133 #define MC_CHOICE 719
134 #define MC_SELECT 720
135 #define MC_SELCUR 721
136 #define MC_SELALL 722
137 #define MC_UNSELALL 723
140 #define MC_FULLHDR 726
141 #define MC_BOUNCE 727
145 #define MC_PRINTALL 731
146 #define MC_REPAINT 732
148 #define MC_RESIZE 734
149 #define MC_FWDTEXT 735
150 #define MC_SAVETEXT 736
151 #define MC_ABOUTATCH 737
152 #define MC_LISTMODE 738
153 #define MC_RENAMEFLDR 739
154 #define MC_ADDFLDR 740
155 #define MC_SUBSCRIBE 741
156 #define MC_UNSUBSCRIBE 742
158 #define MC_TOGGLE 744
160 #define MC_ADDABOOK 746
161 #define MC_DELABOOK 747
162 #define MC_VIEW_ENTRY 748
163 #define MC_EDITABOOK 750
164 #define MC_OPENABOOK 751
166 #define MC_EXPAND 753
167 #define MC_UNEXPAND 754
169 #define MC_SHUFFLE 756
170 #define MC_VIEW_HANDLE 757
171 #define MC_NEXT_HANDLE 758
172 #define MC_PREV_HANDLE 759
173 #define MC_QUERY_SERV 760
174 #define MC_GRIPE_LOCAL 761
175 #define MC_GRIPE_PIC 762
176 #define MC_GRIPE_READ 763
177 #define MC_GRIPE_POST 764
178 #define MC_FINISH 765
179 #define MC_PRINTFLDR 766
180 #define MC_OPENFLDR 767
181 #define MC_EDITFILE 768
182 #define MC_ADDFILE 769
183 #define MC_DELFILE 770
184 #define MC_CHOICEB 771
185 #define MC_CHOICEC 772
186 #define MC_CHOICED 773
187 #define MC_CHOICEE 774
188 #define MC_DEFAULT 775
189 #define MC_TOGGLEB 776
190 #define MC_TOGGLEC 777
191 #define MC_TOGGLED 778
195 #define MC_EXITQUERY 782
196 #define MC_ADDHDR 783
197 #define MC_DELHDR 784
198 #define MC_PRINTER 785
199 #define MC_PASSWD 786
200 #define MC_CONFIG 787
202 #define MC_ABOOKS 789
203 #define MC_CLISTS 790
205 #define MC_DIRECTORY 792
207 #define MC_EXCEPT 794
208 #define MC_REMOTE 795
209 #define MC_NO_EXCEPT 796
213 #define MC_COLLAPSE 800
214 #define MC_CHK_RECENT 801
215 #define MC_DECRYPT 802
217 #define MC_ADDHEADER 804
218 #define MC_XOAUTH2 805
219 #define MC_EXTERNAL 806
222 /* Commands for S/MIME screens */
224 #define MC_PUBLIC 901
225 #define MC_PRIVATE 902
228 * Some standard Key/Command Bindings
230 #define NULL_MENU {NULL, NULL, {MC_NONE}, KS_NONE}
232 * TRANSLATORS: Alpine has a key menu at the bottom of each screen which
233 * lists all of the available commands. Each command is a single character
234 * which is followed with a short descriptive word which describes what
235 * the command does. Commands are almost always to be thought of as verbs
236 * so the descriptive words describe what the command does.
237 * These descriptive words have to fit across the
238 * screen so they would normally only be 8-10 characters long, though
239 * they will be truncated if there isn't enough space. The command
240 * descriptions are usually chosen so that they will be a mnemonic
241 * for the command. For example, the command S is Save,
242 * E is Export, Q is Quit, and ? is Help. You get to translate the
243 * label (the Save part) but the actual command (the S) will stay
244 * the same, so it will be very difficult to come up with mnemonic
245 * labels. The mnemonic isn't necessary, just nice. You can see that
246 * we have stretched to the edge of the usefulness of mnemonics with
247 * cases like K Kolor (instead of Color) and X eXceptions (because E
248 * already meant something else).
250 #define HELP_MENU {"?", N_("Help"), \
251 {MC_HELP, 2, {'?',ctrl('G')}}, \
253 /* TRANSLATORS: Show Other commands */
254 #define OTHER_MENU {"O", N_("OTHER CMDS"), \
255 {MC_OTHER, 1, {'o'}}, \
257 /* TRANSLATORS: WhereIs command searches for text */
258 #define WHEREIS_MENU {"W", N_("WhereIs"), \
259 {MC_WHEREIS, 2, {'w',ctrl('W')}}, \
261 /* TRANSLATORS: the Main Menu is the menu of commands you get when
262 you first start alpine. */
263 #define MAIN_MENU {"M", N_("Main Menu"), \
264 {MC_MAIN, 1, {'m'}}, \
266 #define QUIT_MENU {"Q", N_("Quit Alpine"), \
267 {MC_QUIT, 1, {'q'}}, \
269 /* TRANSLATORS: go to Previous Message */
270 #define PREVMSG_MENU {"P", N_("PrevMsg"), \
271 {MC_PREVITEM, 1, {'p'}}, \
273 /* TRANSLATORS: go to Next Message */
274 #define NEXTMSG_MENU {"N", N_("NextMsg"), \
275 {MC_NEXTITEM, 1, {'n'}}, \
277 #define HOMEKEY_MENU {"Hme", N_("FirstPage"), \
278 {MC_HOMEKEY, 1, {KEY_HOME}}, \
280 #define ENDKEY_MENU {"End", N_("LastPage"), \
281 {MC_ENDKEY, 1, {KEY_END}}, \
283 /* TRANSLATORS: go to Previous Page */
284 #define PREVPAGE_MENU {"-", N_("PrevPage"), \
285 {MC_PAGEUP, 3, {'-',ctrl('Y'),KEY_PGUP}}, \
287 #define NEXTPAGE_MENU {"Spc", N_("NextPage"), \
288 {MC_PAGEDN, 4, {'+',' ',ctrl('V'),KEY_PGDN}}, \
290 /* TRANSLATORS: Jump to a different message in the index */
291 #define JUMP_MENU {"J", N_("Jump"), \
292 {MC_JUMP, 1, {'j'}}, \
294 /* TRANSLATORS: Forward Email */
295 #define FWDEMAIL_MENU {"F", N_("Fwd Email"), \
296 {MC_FWDTEXT,1,{'f'}}, \
298 #define PRYNTMSG_MENU {"%", N_("Print"), \
299 {MC_PRINTMSG,1,{'%'}}, \
301 #define PRYNTTXT_MENU {"%", N_("Print"), \
302 {MC_PRINTTXT,1,{'%'}}, \
304 /* TRANSLATORS: In alpine, Save means to save something internally
305 within alpine or within the email system. */
306 #define SAVE_MENU {"S", N_("Save"), \
309 /* TRANSLATORS: In alpine, Export means to save something externally
310 to alpine, to a file in the user's home directory, for example. */
311 #define EXPORT_MENU {"E", N_("Export"), \
312 {MC_EXPORT, 1, {'e'}}, \
314 /* TRANSLATORS: Edit a new message to be sent as email */
315 #define COMPOSE_MENU {"C", N_("Compose"), \
316 {MC_COMPOSE,1,{'c'}}, \
318 /* TRANSLATORS: Edit a new message while acting in one of
320 #define RCOMPOSE_MENU {"#", N_("Role"), \
323 #define DELETE_MENU {"D", N_("Delete"), \
324 {MC_DELETE,2,{'d',KEY_DEL}}, \
326 #define UNDELETE_MENU {"U", N_("Undelete"), \
327 {MC_UNDELETE,1,{'u'}}, \
329 /* TRANSLATORS: Reply to an email message */
330 #define REPLY_MENU {"R", N_("Reply"), \
331 {MC_REPLY,1,{'r'}}, \
333 /* TRANSLATORS: Forward an email message to someone else */
334 #define FORWARD_MENU {"F", N_("Forward"), \
335 {MC_FORWARD,1,{'f'}}, \
337 /* TRANSLATORS: go to List of Folders */
338 #define LISTFLD_MENU {"L", N_("ListFldrs"), \
339 {MC_COLLECTIONS,1,{'l'}}, \
341 /* TRANSLATORS: the index is a list of email messages, go there */
342 #define INDEX_MENU {"I", N_("Index"), \
343 {MC_INDEX,1,{'i'}}, \
345 /* TRANSLATORS: Go To Folder, a command to go view another mail folder */
346 #define GOTO_MENU {"G", N_("GotoFldr"), \
349 /* TRANSLATORS: Take Address is a command to copy addresses from a
350 message to the user's address book */
351 #define TAKE_MENU {"T", N_("TakeAddr"), \
354 /* TRANSLATORS: To Flag a message means to mark it in some way,
355 for example, flag it as important */
356 #define FLAG_MENU {"*", N_("Flag"), \
359 /* TRANSLATORS: Pipe refers to the Unix pipe command (the vertical bar). */
360 #define PIPE_MENU {"|", N_("Pipe"), \
363 /* TRANSLATORS: Bounce is sometimes called re-sending a message.
364 A user would use this command if a message had been incorrectly
365 sent to him or her. */
366 #define BOUNCE_MENU {"B", N_("Bounce"), \
367 {MC_BOUNCE,1,{'b'}}, \
369 /* TRANSLATORS: Header Mode, refers to showing more or fewer message
370 headers when viewing a message. This command toggles between more
371 and fewer each time it is typed. */
372 #define HDRMODE_MENU {"H", N_("HdrMode"), \
373 {MC_FULLHDR,1,{'h'}}, \
375 /* TRANSLATORS: The Tab key goes to the Next New message */
376 #define TAB_MENU {"Tab", N_("NextNew"), \
379 /* TRANSLATORS: go to the Previous item */
380 #define PREV_MENU {"P", N_("Prev"), \
381 {MC_PREVITEM,1,{'p'}}, \
383 #define NEXT_MENU {"N", N_("Next"), \
384 {MC_NEXTITEM,2,{'n','\t'}}, \
386 #define EXIT_SETUP_MENU {"E", N_("Exit Setup"), \
389 #define TOGGLE_MENU {"X", "[" N_("Set/Unset") "]", \
390 {MC_TOGGLE,3,{'x',ctrl('M'),ctrl('J')}}, \
392 #define TOGGLEB_MENU {"X", "[" N_("Set/Unset") "]", \
393 {MC_TOGGLEB,3,{'x',ctrl('M'),ctrl('J')}}, \
395 #define TOGGLEC_MENU {"X", "[" N_("Set/Unset") "]", \
396 {MC_TOGGLEC,3,{'x',ctrl('M'),ctrl('J')}}, \
398 #define TOGGLED_MENU {"X", "[" N_("Set/Unset") "]", \
399 {MC_TOGGLED,3,{'x',ctrl('M'),ctrl('J')}}, \
401 /* TRANSLATORS: go to the Previous Collection. A Collection in Alpine refers
402 to a collection of mail folders. */
403 #define PREVC_MENU {"P", N_("PrevCltn"), \
404 {MC_PREVITEM,1,{'p'}}, \
406 /* TRANSLATORS: Next Collection. */
407 #define NEXTC_MENU {"N", N_("NextCltn"), \
408 {MC_NEXTITEM,2,{'n','\t'}}, \
410 /* TRANSLATORS: Delete Collection. */
411 #define DELC_MENU {"D", N_("Del Cltn"), \
412 {MC_DELETE,2,{'d',KEY_DEL}}, \
414 /* TRANSLATORS: go to the Previous Folder (in a list of folders). */
415 #define PREVF_MENU {"P", N_("PrevFldr"), \
416 {MC_PREV_HANDLE,3,{'p',ctrl('B'),KEY_LEFT}}, \
418 /* TRANSLATORS: Next Folder (in a list of folders). */
419 #define NEXTF_MENU {"N", N_("NextFldr"), \
420 {MC_NEXT_HANDLE,4,{'n',ctrl('F'),TAB,KEY_RIGHT}}, \
422 /* TRANSLATORS: Current Index of messages (go to the current index) */
423 #define CIND_MENU {"I", N_("CurIndex"), \
424 {MC_INDEX,1,{'i'}}, \
426 /* TRANSLATORS: View this Message */
427 #define VIEWMSG_MENU {">", "[" N_("ViewMsg") "]", \
428 {MC_VIEW_TEXT, 5,{'v','.','>',ctrl('M'),ctrl('J')}}, \
430 /* TRANSLATORS: Sort the index of messages */
431 #define FLDRSORT_MENU {"$", N_("SortIndex"), \
434 /* TRANSLATORS: Exit the Take Address screen */
435 #define TA_EXIT_MENU {"<",N_("ExitTake"), \
436 {MC_EXIT,4,{'e',ctrl('C'),'<',','}}, \
438 #define TA_NEXT_MENU {"N",N_("Next"), \
439 {MC_CHARDOWN,4,{'n','\t',ctrl('N'),KEY_DOWN}}, \
441 /* TRANSLATORS: abbreviation for Previous */
442 #define TA_PREV_MENU {"P",N_("Prev"), \
443 {MC_CHARUP, 3, {'p',ctrl('P'),KEY_UP}}, \
448 * It's bogus that these are defined here. They go with the structures
449 * defined in keymenu.c and have to stay in sync with them.
456 #define SENDTO_KEY 10
457 #define SECONDARY_MAIN_KEY 15
458 #define RCOMPOSE_KEY 19
464 #define KM_MAIN_KEY 15
465 #define KM_ALTVIEW_KEY 16
466 #define KM_ZOOM_KEY 21
467 #define KM_SELECT_KEY 22
468 #define KM_SELCUR_KEY 23
469 #define KM_RECENT_KEY 28
470 #define KM_SHUFFLE_KEY 30
471 #define KM_EXPORT_KEY 32
472 #define KM_IMPORT_KEY 33
473 #define FC_EXIT_KEY 1
476 #define FC_ALTSEL_KEY 8
478 #define SB_EXIT_KEY 2
480 #define SB_LIST_KEY 8
481 #define HLP_MAIN_KEY 0
482 #define HLP_SUBEXIT_KEY 1
483 #define HLP_EXIT_KEY 2
484 #define HLP_VIEW_HANDLE 3
485 #define HLP_PREV_HANDLE 4
486 #define HLP_NEXT_HANDLE 5
487 #define HLP_ALL_KEY 9
488 #define TIMESTAMP_KEY 4
491 #define LM_PREV_KEY 4
492 #define LM_NEXT_KEY 5
496 #define EXCLUDE_KEY 26
497 #define UNEXCLUDE_KEY 27
498 #define SELECT_KEY 28
500 #define VIEW_FULL_HEADERS_KEY 32
501 #define BOUNCE_KEY 33
503 #define VIEW_PIPE_KEY 35
504 #define SELCUR_KEY 38
506 #define COLLAPSE_KEY 45
507 #define ATT_PARENT_KEY 2
508 #define ATT_EXPORT_KEY 11
509 #define ATT_PIPE_KEY 16
510 #define ATT_BOUNCE_KEY 17
511 #define ATT_PRINT_KEY 20
512 #define ATT_REPLY_KEY 22
513 #define ATT_FORWARD_KEY 23
514 #define ATV_BACK_KEY 2
515 #define ATV_VIEW_HILITE 3
516 #define ATV_PREV_URL 4
517 #define ATV_NEXT_URL 5
518 #define ATV_EXPORT_KEY 11
519 #define ATV_PIPE_KEY 16
520 #define ATV_BOUNCE_KEY 17
521 #define ATV_PRINT_KEY 20
522 #define ATV_REPLY_KEY 22
523 #define ATV_FORWARD_KEY 23
524 #define ATV_DECRYPT_KEY (ATV_PIPE_KEY + 14)
525 #define ATV_SECURITY_KEY (ATV_DECRYPT_KEY + 1)
526 #define VIEW_ATT_KEY 3
527 #define VIEW_FULL_HEADERS_KEY 32
528 #define VIEW_VIEW_HANDLE 26
529 #define VIEW_SELECT_KEY 27
530 #define VIEW_PREV_HANDLE 28
531 #define VIEW_NEXT_HANDLE 29
532 #define OE_HELP_KEY 0
533 #define OE_CANCEL_KEY 1
534 #define OE_CTRL_T_KEY 2
535 #define OE_ENTER_KEY 3
536 #define SETUP_PRINTER 3
537 #define SETUP_PASSWD 4
538 #define SETUP_CONFIG 5
540 #define SETUP_DIRECTORY 10
541 #define SETUP_EXCEPT 14
542 #define SETUP_SMIME 16
543 #define MAIN_HELP_KEY 0
544 #define MAIN_DEFAULT_KEY 3
545 #define MAIN_KBLOCK_KEY 9
546 #define MAIN_QUIT_KEY 14
547 #define MAIN_COMPOSE_KEY 15
548 #define MAIN_FOLDER_KEY 16
549 #define MAIN_INDEX_KEY 18
550 #define MAIN_SETUP_KEY 20
551 #define MAIN_ADDRESS_KEY 21
554 #define NUOV_NEXT_PG 6
555 #define NUOV_PREV_PG 7
556 #define NUOV_RELNOTES 10
557 #define DEFAULT_KEY 3
558 #define CHANGEDEF_KEY 10
559 #define SMIME_PARENT_KEY 2
560 #define DECRYPT_KEY (VIEW_PIPE_KEY + 7)
561 #define SECURITY_KEY (DECRYPT_KEY + 1)
564 #define PRIVATE_KEY 7
565 #define DELETE_CERT_KEY 4
566 #define UNDELETE_CERT_KEY 5
568 extern struct key_menu cancel_keymenu
,
585 ans_certfail_keymenu
,
586 ans_certquery_keymenu
,
591 simple_index_keymenu
,
598 choose_setup_keymenu
,
602 modal_message_keymenu
,
606 color_pattern_keymenu
,
607 hdr_color_checkbox_keymenu
,
608 kw_color_checkbox_keymenu
,
609 selectable_bold_checkbox_keymenu
,
612 addr_s_km_with_goback
,
621 sel_from_list_sm_ctrlc
,
623 sel_from_list_lm_ctrlc
,
625 sel_from_list_olm_ctrlc
,
626 printer_edit_keymenu
,
627 printer_select_keymenu
,
630 config_text_wshuf_keymenu
,
631 config_text_wshufandfldr_keymenu
,
632 config_role_file_keymenu
,
633 config_role_file_res_keymenu
,
634 config_role_keyword_keymenu
,
635 config_role_keyword_keymenu_not
,
636 config_role_charset_keymenu_not
,
638 config_role_keymenu_not
,
639 config_role_keymenu_extra
,
640 config_role_addr_pat_keymenu
,
641 config_role_xtrahdr_keymenu
,
642 config_role_addr_act_keymenu
,
643 config_role_patfolder_keymenu
,
644 config_role_actionfolder_keymenu
,
645 config_role_inick_keymenu
,
646 config_role_afrom_keymenu
,
647 config_checkbox_keymenu
,
649 config_text_to_charsets_keymenu
,
650 config_radiobutton_keymenu
,
651 config_yesno_keymenu
,
652 color_changing_keymenu
,
653 custom_color_changing_keymenu
,
654 kw_color_changing_keymenu
,
658 color_setting_keymenu
,
659 custom_color_setting_keymenu
,
660 role_color_setting_keymenu
,
661 kw_color_setting_keymenu
,
662 take_export_keymenu_sm
,
663 take_export_keymenu_lm
,
664 config_smime_helper_keymenu
,
665 config_smime_add_certs_keymenu
,
667 config_smime_manage_certs_menu_keymenu
,
668 config_smime_manage_certs_work_keymenu
,
669 config_smime_manage_password_file_menu_keymenu
,
670 smime_certificate_info_keymenu
,
671 config_smime_add_new_key_keymenu
,
672 config_smime_manage_view_cert_keymenu
,
673 config_smime_manage_view_cert_keymenu_no_delete
;
675 extern struct key rev_msg_keys
[];
678 /* exported prototypes */
679 void draw_cancel_keymenu(void);
680 void end_keymenu(void);
681 int menu_command(UCS
, struct key_menu
*);
682 void menu_init_binding(struct key_menu
*, UCS
, int, char *, char *, int);
683 void menu_add_binding(struct key_menu
*, UCS
, int);
684 int menu_clear_binding(struct key_menu
*, UCS
);
685 int menu_binding_index(struct key_menu
*, int);
686 void mark_keymenu_dirty(void);
687 void blank_keymenu(int, int);
688 void draw_keymenu(struct key_menu
*, bitmap_t
, int, int, int, OtherMenu
);
689 void redraw_keymenu(void);
690 void clearfooter(struct pine
*);
693 #endif /* PINE_KEYMENU_INCLUDED */