2 * $Id: keymenu.h 1074 2008-06-04 00:08:43Z hubert@u.washington.edu $
4 * ========================================================================
5 * Copyright 2006-2008 University of Washington
6 * Copyright 2013-2015 Eduardo Chappa
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
220 /* Commands for S/MIME screens */
222 #define MC_PUBLIC 901
223 #define MC_PRIVATE 902
226 * Some standard Key/Command Bindings
228 #define NULL_MENU {NULL, NULL, {MC_NONE}, KS_NONE}
230 * TRANSLATORS: Alpine has a key menu at the bottom of each screen which
231 * lists all of the available commands. Each command is a single character
232 * which is followed with a short descriptive word which describes what
233 * the command does. Commands are almost always to be thought of as verbs
234 * so the descriptive words describe what the command does.
235 * These descriptive words have to fit across the
236 * screen so they would normally only be 8-10 characters long, though
237 * they will be truncated if there isn't enough space. The command
238 * descriptions are usually chosen so that they will be a mnemonic
239 * for the command. For example, the command S is Save,
240 * E is Export, Q is Quit, and ? is Help. You get to translate the
241 * label (the Save part) but the actual command (the S) will stay
242 * the same, so it will be very difficult to come up with mnemonic
243 * labels. The mnemonic isn't necessary, just nice. You can see that
244 * we have stretched to the edge of the usefullness of mnemonics with
245 * cases like K Kolor (instead of Color) and X eXceptions (because E
246 * already meant something else).
248 #define HELP_MENU {"?", N_("Help"), \
249 {MC_HELP, 2, {'?',ctrl('G')}}, \
251 /* TRANSLATORS: Show Other commands */
252 #define OTHER_MENU {"O", N_("OTHER CMDS"), \
253 {MC_OTHER, 1, {'o'}}, \
255 /* TRANSLATORS: WhereIs command searches for text */
256 #define WHEREIS_MENU {"W", N_("WhereIs"), \
257 {MC_WHEREIS, 2, {'w',ctrl('W')}}, \
259 /* TRANSLATORS: the Main Menu is the menu of commands you get when
260 you first start alpine. */
261 #define MAIN_MENU {"M", N_("Main Menu"), \
262 {MC_MAIN, 1, {'m'}}, \
264 #define QUIT_MENU {"Q", N_("Quit Alpine"), \
265 {MC_QUIT, 1, {'q'}}, \
267 /* TRANSLATORS: go to Previous Message */
268 #define PREVMSG_MENU {"P", N_("PrevMsg"), \
269 {MC_PREVITEM, 1, {'p'}}, \
271 /* TRANSLATORS: go to Next Message */
272 #define NEXTMSG_MENU {"N", N_("NextMsg"), \
273 {MC_NEXTITEM, 1, {'n'}}, \
275 #define HOMEKEY_MENU {"Hme", N_("FirstPage"), \
276 {MC_HOMEKEY, 1, {KEY_HOME}}, \
278 #define ENDKEY_MENU {"End", N_("LastPage"), \
279 {MC_ENDKEY, 1, {KEY_END}}, \
281 /* TRANSLATORS: go to Previous Page */
282 #define PREVPAGE_MENU {"-", N_("PrevPage"), \
283 {MC_PAGEUP, 3, {'-',ctrl('Y'),KEY_PGUP}}, \
285 #define NEXTPAGE_MENU {"Spc", N_("NextPage"), \
286 {MC_PAGEDN, 4, {'+',' ',ctrl('V'),KEY_PGDN}}, \
288 /* TRANSLATORS: Jump to a different message in the index */
289 #define JUMP_MENU {"J", N_("Jump"), \
290 {MC_JUMP, 1, {'j'}}, \
292 /* TRANSLATORS: Forward Email */
293 #define FWDEMAIL_MENU {"F", N_("Fwd Email"), \
294 {MC_FWDTEXT,1,{'f'}}, \
296 #define PRYNTMSG_MENU {"%", N_("Print"), \
297 {MC_PRINTMSG,1,{'%'}}, \
299 #define PRYNTTXT_MENU {"%", N_("Print"), \
300 {MC_PRINTTXT,1,{'%'}}, \
302 /* TRANSLATORS: In alpine, Save means to save something internally
303 within alpine or within the email system. */
304 #define SAVE_MENU {"S", N_("Save"), \
307 /* TRANSLATORS: In alpine, Export means to save something externally
308 to alpine, to a file in the user's home directory, for example. */
309 #define EXPORT_MENU {"E", N_("Export"), \
310 {MC_EXPORT, 1, {'e'}}, \
312 /* TRANSLATORS: Edit a new message to be sent as email */
313 #define COMPOSE_MENU {"C", N_("Compose"), \
314 {MC_COMPOSE,1,{'c'}}, \
316 /* TRANSLATORS: Edit a new message while acting in one of
318 #define RCOMPOSE_MENU {"#", N_("Role"), \
321 #define DELETE_MENU {"D", N_("Delete"), \
322 {MC_DELETE,2,{'d',KEY_DEL}}, \
324 #define UNDELETE_MENU {"U", N_("Undelete"), \
325 {MC_UNDELETE,1,{'u'}}, \
327 /* TRANSLATORS: Reply to an email message */
328 #define REPLY_MENU {"R", N_("Reply"), \
329 {MC_REPLY,1,{'r'}}, \
331 /* TRANSLATORS: Forward an email message to someone else */
332 #define FORWARD_MENU {"F", N_("Forward"), \
333 {MC_FORWARD,1,{'f'}}, \
335 /* TRANSLATORS: go to List of Folders */
336 #define LISTFLD_MENU {"L", N_("ListFldrs"), \
337 {MC_COLLECTIONS,1,{'l'}}, \
339 /* TRANSLATORS: the index is a list of email messages, go there */
340 #define INDEX_MENU {"I", N_("Index"), \
341 {MC_INDEX,1,{'i'}}, \
343 /* TRANSLATORS: Go To Folder, a command to go view another mail folder */
344 #define GOTO_MENU {"G", N_("GotoFldr"), \
347 /* TRANSLATORS: Take Address is a command to copy addresses from a
348 message to the user's address book */
349 #define TAKE_MENU {"T", N_("TakeAddr"), \
352 /* TRANSLATORS: To Flag a message means to mark it in some way,
353 for example, flag it as important */
354 #define FLAG_MENU {"*", N_("Flag"), \
357 /* TRANSLATORS: Pipe refers to the Unix pipe command (the vertical bar). */
358 #define PIPE_MENU {"|", N_("Pipe"), \
361 /* TRANSLATORS: Bounce is sometimes called re-sending a message.
362 A user would use this command if a message had been incorrectly
363 sent to him or her. */
364 #define BOUNCE_MENU {"B", N_("Bounce"), \
365 {MC_BOUNCE,1,{'b'}}, \
367 /* TRANSLATORS: Header Mode, refers to showing more or fewer message
368 headers when viewing a message. This command toggles between more
369 and fewer each time it is typed. */
370 #define HDRMODE_MENU {"H", N_("HdrMode"), \
371 {MC_FULLHDR,1,{'h'}}, \
373 /* TRANSLATORS: The Tab key goes to the Next New message */
374 #define TAB_MENU {"Tab", N_("NextNew"), \
377 /* TRANSLATORS: go to the Previous item */
378 #define PREV_MENU {"P", N_("Prev"), \
379 {MC_PREVITEM,1,{'p'}}, \
381 #define NEXT_MENU {"N", N_("Next"), \
382 {MC_NEXTITEM,2,{'n','\t'}}, \
384 #define EXIT_SETUP_MENU {"E", N_("Exit Setup"), \
387 #define TOGGLE_MENU {"X", "[" N_("Set/Unset") "]", \
388 {MC_TOGGLE,3,{'x',ctrl('M'),ctrl('J')}}, \
390 #define TOGGLEB_MENU {"X", "[" N_("Set/Unset") "]", \
391 {MC_TOGGLEB,3,{'x',ctrl('M'),ctrl('J')}}, \
393 #define TOGGLEC_MENU {"X", "[" N_("Set/Unset") "]", \
394 {MC_TOGGLEC,3,{'x',ctrl('M'),ctrl('J')}}, \
396 #define TOGGLED_MENU {"X", "[" N_("Set/Unset") "]", \
397 {MC_TOGGLED,3,{'x',ctrl('M'),ctrl('J')}}, \
399 /* TRANSLATORS: go to the Previous Collection. A Collection in Alpine refers
400 to a collection of mail folders. */
401 #define PREVC_MENU {"P", N_("PrevCltn"), \
402 {MC_PREVITEM,1,{'p'}}, \
404 /* TRANSLATORS: Next Collection. */
405 #define NEXTC_MENU {"N", N_("NextCltn"), \
406 {MC_NEXTITEM,2,{'n','\t'}}, \
408 /* TRANSLATORS: Delete Collection. */
409 #define DELC_MENU {"D", N_("Del Cltn"), \
410 {MC_DELETE,2,{'d',KEY_DEL}}, \
412 /* TRANSLATORS: go to the Previous Folder (in a list of folders). */
413 #define PREVF_MENU {"P", N_("PrevFldr"), \
414 {MC_PREV_HANDLE,3,{'p',ctrl('B'),KEY_LEFT}}, \
416 /* TRANSLATORS: Next Folder (in a list of folders). */
417 #define NEXTF_MENU {"N", N_("NextFldr"), \
418 {MC_NEXT_HANDLE,4,{'n',ctrl('F'),TAB,KEY_RIGHT}}, \
420 /* TRANSLATORS: Current Index of messages (go to the current index) */
421 #define CIND_MENU {"I", N_("CurIndex"), \
422 {MC_INDEX,1,{'i'}}, \
424 /* TRANSLATORS: View this Message */
425 #define VIEWMSG_MENU {">", "[" N_("ViewMsg") "]", \
426 {MC_VIEW_TEXT, 5,{'v','.','>',ctrl('M'),ctrl('J')}}, \
428 /* TRANSLATORS: Sort the index of messages */
429 #define FLDRSORT_MENU {"$", N_("SortIndex"), \
432 /* TRANSLATORS: Exit the Take Address screen */
433 #define TA_EXIT_MENU {"<",N_("ExitTake"), \
434 {MC_EXIT,4,{'e',ctrl('C'),'<',','}}, \
436 #define TA_NEXT_MENU {"N",N_("Next"), \
437 {MC_CHARDOWN,4,{'n','\t',ctrl('N'),KEY_DOWN}}, \
439 /* TRANSLATORS: abbreviation for Previous */
440 #define TA_PREV_MENU {"P",N_("Prev"), \
441 {MC_CHARUP, 3, {'p',ctrl('P'),KEY_UP}}, \
446 * It's bogus that these are defined here. They go with the structures
447 * defined in keymenu.c and have to stay in sync with them.
454 #define SENDTO_KEY 10
455 #define SECONDARY_MAIN_KEY 15
456 #define RCOMPOSE_KEY 19
462 #define KM_MAIN_KEY 15
463 #define KM_ALTVIEW_KEY 16
464 #define KM_ZOOM_KEY 21
465 #define KM_SELECT_KEY 22
466 #define KM_SELCUR_KEY 23
467 #define KM_RECENT_KEY 28
468 #define KM_SHUFFLE_KEY 30
469 #define KM_EXPORT_KEY 32
470 #define KM_IMPORT_KEY 33
471 #define FC_EXIT_KEY 1
474 #define FC_ALTSEL_KEY 8
476 #define SB_EXIT_KEY 2
478 #define SB_LIST_KEY 8
479 #define HLP_MAIN_KEY 0
480 #define HLP_SUBEXIT_KEY 1
481 #define HLP_EXIT_KEY 2
482 #define HLP_VIEW_HANDLE 3
483 #define HLP_PREV_HANDLE 4
484 #define HLP_NEXT_HANDLE 5
485 #define HLP_ALL_KEY 9
486 #define TIMESTAMP_KEY 4
489 #define LM_PREV_KEY 4
490 #define LM_NEXT_KEY 5
494 #define EXCLUDE_KEY 26
495 #define UNEXCLUDE_KEY 27
496 #define SELECT_KEY 28
498 #define VIEW_FULL_HEADERS_KEY 32
499 #define BOUNCE_KEY 33
501 #define VIEW_PIPE_KEY 35
502 #define SELCUR_KEY 38
504 #define COLLAPSE_KEY 45
505 #define ATT_PARENT_KEY 2
506 #define ATT_EXPORT_KEY 11
507 #define ATT_PIPE_KEY 16
508 #define ATT_BOUNCE_KEY 17
509 #define ATT_PRINT_KEY 20
510 #define ATT_REPLY_KEY 22
511 #define ATT_FORWARD_KEY 23
512 #define ATV_BACK_KEY 2
513 #define ATV_VIEW_HILITE 3
514 #define ATV_PREV_URL 4
515 #define ATV_NEXT_URL 5
516 #define ATV_EXPORT_KEY 11
517 #define ATV_PIPE_KEY 16
518 #define ATV_BOUNCE_KEY 17
519 #define ATV_PRINT_KEY 20
520 #define ATV_REPLY_KEY 22
521 #define ATV_FORWARD_KEY 23
522 #define ATV_DECRYPT_KEY (ATV_PIPE_KEY + 14)
523 #define ATV_SECURITY_KEY (ATV_DECRYPT_KEY + 1)
524 #define VIEW_ATT_KEY 3
525 #define VIEW_FULL_HEADERS_KEY 32
526 #define VIEW_VIEW_HANDLE 26
527 #define VIEW_SELECT_KEY 27
528 #define VIEW_PREV_HANDLE 28
529 #define VIEW_NEXT_HANDLE 29
530 #define OE_HELP_KEY 0
531 #define OE_CANCEL_KEY 1
532 #define OE_CTRL_T_KEY 2
533 #define OE_ENTER_KEY 3
534 #define SETUP_PRINTER 3
535 #define SETUP_PASSWD 4
536 #define SETUP_CONFIG 5
538 #define SETUP_DIRECTORY 10
539 #define SETUP_EXCEPT 14
540 #define SETUP_SMIME 16
541 #define MAIN_HELP_KEY 0
542 #define MAIN_DEFAULT_KEY 3
543 #define MAIN_KBLOCK_KEY 9
544 #define MAIN_QUIT_KEY 14
545 #define MAIN_COMPOSE_KEY 15
546 #define MAIN_FOLDER_KEY 16
547 #define MAIN_INDEX_KEY 18
548 #define MAIN_SETUP_KEY 20
549 #define MAIN_ADDRESS_KEY 21
552 #define NUOV_NEXT_PG 6
553 #define NUOV_PREV_PG 7
554 #define NUOV_RELNOTES 10
555 #define DEFAULT_KEY 3
556 #define CHANGEDEF_KEY 10
557 #define SMIME_PARENT_KEY 2
558 #define DECRYPT_KEY (VIEW_PIPE_KEY + 7)
559 #define SECURITY_KEY (DECRYPT_KEY + 1)
562 #define PRIVATE_KEY 7
564 extern struct key_menu cancel_keymenu
,
581 ans_certfail_keymenu
,
582 ans_certquery_keymenu
,
586 simple_index_keymenu
,
593 choose_setup_keymenu
,
597 modal_message_keymenu
,
601 color_pattern_keymenu
,
602 hdr_color_checkbox_keymenu
,
603 kw_color_checkbox_keymenu
,
604 selectable_bold_checkbox_keymenu
,
607 addr_s_km_with_goback
,
616 sel_from_list_sm_ctrlc
,
618 sel_from_list_lm_ctrlc
,
620 sel_from_list_olm_ctrlc
,
621 printer_edit_keymenu
,
622 printer_select_keymenu
,
625 config_text_wshuf_keymenu
,
626 config_text_wshufandfldr_keymenu
,
627 config_role_file_keymenu
,
628 config_role_file_res_keymenu
,
629 config_role_keyword_keymenu
,
630 config_role_keyword_keymenu_not
,
631 config_role_charset_keymenu_not
,
633 config_role_keymenu_not
,
634 config_role_keymenu_extra
,
635 config_role_addr_pat_keymenu
,
636 config_role_xtrahdr_keymenu
,
637 config_role_addr_act_keymenu
,
638 config_role_patfolder_keymenu
,
639 config_role_actionfolder_keymenu
,
640 config_role_inick_keymenu
,
641 config_role_afrom_keymenu
,
642 config_checkbox_keymenu
,
644 config_text_to_charsets_keymenu
,
645 config_radiobutton_keymenu
,
646 config_yesno_keymenu
,
647 color_changing_keymenu
,
648 custom_color_changing_keymenu
,
649 kw_color_changing_keymenu
,
653 color_setting_keymenu
,
654 custom_color_setting_keymenu
,
655 role_color_setting_keymenu
,
656 kw_color_setting_keymenu
,
657 take_export_keymenu_sm
,
658 take_export_keymenu_lm
,
659 config_smime_helper_keymenu
,
660 config_smime_add_certs_keymenu
,
662 config_smime_manage_certs_menu_keymenu
,
663 config_smime_manage_certs_work_keymenu
,
664 smime_certificate_info_keymenu
;
666 extern struct key rev_msg_keys
[];
669 /* exported protoypes */
670 void draw_cancel_keymenu(void);
671 void end_keymenu(void);
672 int menu_command(UCS
, struct key_menu
*);
673 void menu_init_binding(struct key_menu
*, UCS
, int, char *, char *, int);
674 void menu_add_binding(struct key_menu
*, UCS
, int);
675 int menu_clear_binding(struct key_menu
*, UCS
);
676 int menu_binding_index(struct key_menu
*, int);
677 void mark_keymenu_dirty(void);
678 void blank_keymenu(int, int);
679 void draw_keymenu(struct key_menu
*, bitmap_t
, int, int, int, OtherMenu
);
680 void redraw_keymenu(void);
681 void clearfooter(struct pine
*);
684 #endif /* PINE_KEYMENU_INCLUDED */