bindings.cc 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513
  1. // Copyright (C) 2003 Mooffie <mooffie@typo.co.il>
  2. //
  3. // This program is free software; you can redistribute it and/or modify
  4. // it under the terms of the GNU General Public License as published by
  5. // the Free Software Foundation; either version 2 of the License, or
  6. // (at your option) any later version.
  7. //
  8. // This program is distributed in the hope that it will be useful,
  9. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. // GNU General Public License for more details.
  12. //
  13. // You should have received a copy of the GNU General Public License
  14. // along with this program; if not, write to the Free Software
  15. // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
  16. #include <config.h>
  17. #include "editbox.h"
  18. #include "editor.h"
  19. #include "helpbox.h"
  20. #include "dialogline.h"
  21. #include "inputline.h"
  22. #include "speller.h"
  23. #include "basemenu.h"
  24. #define ESC 27
  25. EditBox::action_entry EditBox::actions_table[] = {
  26. ADD_ACTION(EditBox, key_left,
  27. N_("Move a character left")),
  28. ADD_ACTION(EditBox, key_right,
  29. N_("Move a character right")),
  30. ADD_ACTION(EditBox, move_previous_line,
  31. N_("Move to the previous line")),
  32. ADD_ACTION(EditBox, move_next_line,
  33. N_("Move to the next line")),
  34. ADD_ACTION(EditBox, move_forward_page,
  35. N_("Move to the next page")),
  36. ADD_ACTION(EditBox, move_backward_page,
  37. N_("Move to the previous page")),
  38. ADD_ACTION(EditBox, move_forward_char,
  39. N_("Move forward a character")),
  40. ADD_ACTION(EditBox, move_backward_char,
  41. N_("Move back a character")),
  42. ADD_ACTION(EditBox, move_beginning_of_line,
  43. N_("Move to the beginning of the current line, logical")),
  44. ADD_ACTION(EditBox, move_beginning_of_visual_line,
  45. N_("Move to the beginning of the current line, visual")),
  46. ADD_ACTION(EditBox, key_home,
  47. N_("Move to the beginning of the current line")),
  48. ADD_ACTION(EditBox, move_end_of_line,
  49. N_("Move to the end of the current line")),
  50. ADD_ACTION(EditBox, move_last_modification,
  51. N_("Jump to the place of the last editing operation")),
  52. ADD_ACTION(EditBox, delete_backward_char,
  53. N_("Delete the previous character")),
  54. ADD_ACTION(EditBox, delete_forward_char,
  55. N_("Delete the character the cursor is on")),
  56. ADD_ACTION(EditBox, copy,
  57. N_("Copy the selected text to clipboard")),
  58. ADD_ACTION(EditBox, cut,
  59. N_("Copy the selected text to clipboard and delete it from the buffer")),
  60. ADD_ACTION(EditBox, paste,
  61. N_("Paste the text in the clipboard into the buffer")),
  62. ADD_ACTION(EditBox, move_end_of_buffer,
  63. N_("Move to the end of the buffer")),
  64. ADD_ACTION(EditBox, move_beginning_of_buffer,
  65. N_("Move to the beginning of the buffer")),
  66. ADD_ACTION(EditBox, move_backward_word,
  67. N_("Move to the beginning of the current or previous word")),
  68. ADD_ACTION(EditBox, move_forward_word,
  69. N_("Move to the end of the current or next word")),
  70. ADD_ACTION(EditBox, delete_backward_word,
  71. N_("Delete to the beginning of the current or previous word")),
  72. ADD_ACTION(EditBox, delete_forward_word,
  73. N_("Delete to the end of the current or next word")),
  74. ADD_ACTION(EditBox, toggle_dir_algo,
  75. N_("Change the algorithm used to determine the base direction of paragraphs")),
  76. ADD_ACTION(EditBox, set_dir_algo_unicode,
  77. N_("Unicode's TR #9: First strong character determines base dir. Neutral gets LTR.")),
  78. ADD_ACTION(EditBox, set_dir_algo_context_strong,
  79. N_("Contextual-strong: Unicode's TR #9 + neutral paras now inherit surroundings")),
  80. ADD_ACTION(EditBox, set_dir_algo_context_rtl,
  81. N_("Contextual-rtl: like Contextual-strong, but if there's any RTL char, para is RTL")),
  82. ADD_ACTION(EditBox, set_dir_algo_force_ltr,
  83. N_("Force LTR")),
  84. ADD_ACTION(EditBox, set_dir_algo_force_rtl,
  85. N_("Force RTL")),
  86. ADD_ACTION(EditBox, toggle_wrap,
  87. N_("Change the way long lines are displayed (whether to wrap or not, and how)")),
  88. ADD_ACTION(EditBox, set_wrap_type_at_white_space,
  89. N_("Wrap lines, do not break words (just like a word processor)")),
  90. ADD_ACTION(EditBox, set_wrap_type_anywhere,
  91. N_("Wrap lines, break words")),
  92. ADD_ACTION(EditBox, set_wrap_type_off,
  93. N_("Don't wrap lines;you'll have to scroll horizontally to view the rest of the line")),
  94. ADD_ACTION(EditBox, toggle_alt_kbd,
  95. N_("Toogle Hebrew keyboard emulation")),
  96. ADD_ACTION(EditBox, set_translate_next_char,
  97. N_("Translate next character")),
  98. ADD_ACTION(EditBox, justify,
  99. N_("Justify the current or next paragraph")),
  100. ADD_ACTION(EditBox, cut_end_of_paragraph,
  101. N_("Cut [to] end of paragraph")),
  102. ADD_ACTION(EditBox, undo,
  103. N_("Undo the last change")),
  104. ADD_ACTION(EditBox, redo,
  105. N_("Redo the last change you canceled")),
  106. ADD_ACTION(EditBox, delete_paragraph,
  107. N_("Delete the current paragraph")),
  108. ADD_ACTION(EditBox, toggle_primary_mark,
  109. N_("Start/cancel selection")),
  110. ADD_ACTION(EditBox, toggle_auto_justify,
  111. N_("Toggle auto-justify")),
  112. ADD_ACTION(EditBox, toggle_auto_indent,
  113. N_("Toggle auto-indent")),
  114. ADD_ACTION(EditBox, toggle_formatting_marks,
  115. N_("Toggle display of formatting marks (paragraph ends, explicit BiDi marks, tabs)")),
  116. ADD_ACTION(EditBox, toggle_rtl_nsm,
  117. N_("Toggle display of Hebrew/Arabic points (off/transliterated/as-is)")),
  118. ADD_ACTION(EditBox, set_rtl_nsm_asis,
  119. N_("Display Hebrew/Arabic points as-is (for capable terminals only)")),
  120. ADD_ACTION(EditBox, set_rtl_nsm_transliterated,
  121. N_("Display Hebrew/Arabic points as highlighted ASCII characters")),
  122. ADD_ACTION(EditBox, set_rtl_nsm_off,
  123. N_("Hide Hebrew/Arabic points")),
  124. ADD_ACTION(EditBox, toggle_maqaf,
  125. N_("Toggle Hebrew maqaf highlighting and/or enable its ASCII transliteration")),
  126. ADD_ACTION(EditBox, set_maqaf_display_transliterated,
  127. N_("Display the maqaf as ASCII dash")),
  128. ADD_ACTION(EditBox, set_maqaf_display_highlighted,
  129. N_("Highlight the maqaf")),
  130. ADD_ACTION(EditBox, set_maqaf_display_asis,
  131. N_("Display the maqaf as-is (for capable terminals)")),
  132. ADD_ACTION(EditBox, toggle_smart_typing,
  133. N_("Toggle smart-typing mode: auto replace some plain characters with typographical ones")),
  134. ADD_ACTION(EditBox, insert_maqaf,
  135. N_("Insert Hebrew maqaf")),
  136. ADD_ACTION(EditBox, toggle_read_only,
  137. N_("Toggle read-only status of buffer")),
  138. ADD_ACTION(EditBox, toggle_eops,
  139. N_("Change end-of-paragraphs type")),
  140. ADD_ACTION(EditBox, set_eops_unix,
  141. N_("Set end-of-paragraphs type to Unix")),
  142. ADD_ACTION(EditBox, set_eops_dos,
  143. N_("Set end-of-paragraphs type to DOS/Windows")),
  144. ADD_ACTION(EditBox, set_eops_mac,
  145. N_("Set end-of-paragraphs type to Macintosh")),
  146. ADD_ACTION(EditBox, set_eops_unicode,
  147. N_("Set end-of-paragraphs type to Unicode PS")),
  148. ADD_ACTION(EditBox, toggle_key_for_key_undo,
  149. N_("Toggle key-for-key undo (whether to group small editing operations)")),
  150. ADD_ACTION(EditBox, toggle_bidi,
  151. N_("Turn off/on the BiDi algorithm (useful when editing complicated bi-di texts)")),
  152. ADD_ACTION(EditBox, toggle_visual_cursor_movement,
  153. N_("Toggle between logical and visual cursor movement")),
  154. ADD_ACTION(EditBox, menu_set_syn_hlt_none, N_("Don't do syntax-highlighting")),
  155. ADD_ACTION(EditBox, menu_set_syn_hlt_html, N_("Highlight HTML tags")),
  156. ADD_ACTION(EditBox, menu_set_syn_hlt_email, N_("Highlight lines starting with '>'")),
  157. ADD_ACTION(EditBox, toggle_underline, N_("Whether to highlight *text* and _text_ on your terminal")),
  158. END_ACTIONS
  159. };
  160. binding_entry EditBox::bindings_table[] = {
  161. { Event(KEY_LEFT), "key_left" },
  162. { Event(KEY_RIGHT), "key_right" },
  163. { Event(KEY_UP), "move_previous_line" },
  164. { Event(KEY_DOWN), "move_next_line" },
  165. { Event(KEY_NPAGE), "move_forward_page" },
  166. { Event(KEY_PPAGE), "move_backward_page" },
  167. { Event(KEY_HOME), "key_home" },
  168. { Event(KEY_END), "move_end_of_line" },
  169. { Event(CTRL, 'b'), "move_backward_char" },
  170. { Event(CTRL, 'f'), "move_forward_char" },
  171. { Event(CTRL, 'p'), "move_previous_line" },
  172. { Event(CTRL, 'n'), "move_next_line" },
  173. { Event(CTRL, 'a'), "move_beginning_of_line" },
  174. { Event(CTRL, 'e'), "move_end_of_line" },
  175. { Event(CTRL, 'o'), "move_last_modification" },
  176. { Event(ALT, 'o'), "move_last_modification" },
  177. { Event(KEY_BACKSPACE), "delete_backward_char" },
  178. { Event(KEY_DC), "delete_forward_char" },
  179. { Event(CTRL, 'd'), "delete_forward_char" },
  180. { Event(ALT, 'h'), "toggle_alt_kbd" },
  181. { Event(KEY_F(12)), "toggle_alt_kbd" },
  182. { Event(ALT, '>'), "move_end_of_buffer" },
  183. { Event(ALT, '<'), "move_beginning_of_buffer" },
  184. { Event(ALT, 'b'), "move_backward_word" },
  185. { Event(ALT, 'f'), "move_forward_word" },
  186. { Event(ALT, 'F'), "toggle_formatting_marks" },
  187. { Event(ALT, 'n'), "toggle_rtl_nsm" },
  188. { Event(ALT, 'd'), "delete_forward_word" },
  189. { Event(ALT, 0, KEY_BACKSPACE), "delete_backward_word" },
  190. { Event(ALT, 't'), "toggle_dir_algo" },
  191. { Event(ALT, 'w'), "toggle_wrap" },
  192. { Event(CTRL, 'q'), "set_translate_next_char" },
  193. { Event(CTRL, 'j'), "justify" },
  194. { Event(CTRL, 'k'), "cut_end_of_paragraph" },
  195. { Event(CTRL, 'r'), "redo" },
  196. { Event(CTRL, 'u'), "undo" },
  197. { Event(CTRL, 'c'), "copy" },
  198. { Event(CTRL, 'x'), "cut" },
  199. { Event(CTRL, 'v'), "paste" },
  200. { Event(CTRL, 'y'), "delete_paragraph" },
  201. { Event(CTRL, '^'), "toggle_primary_mark" },
  202. { Event(CTRL, '@'), "toggle_primary_mark" },
  203. { Event(KEY_F(11)), "toggle_primary_mark" }, // cygwin
  204. { Event(ALT, 'J'), "toggle_auto_justify" },
  205. { Event(ALT, 'i'), "toggle_auto_indent" },
  206. { Event(ALT, 'k'), "toggle_maqaf" },
  207. { Event(ALT, 'q'), "toggle_smart_typing" },
  208. { Event(ALT, '-'), "insert_maqaf" },
  209. { Event(ALT, 'R'), "toggle_read_only" },
  210. { Event(CTRL | ALT, 'e'), "toggle_eops" },
  211. { Event(VIRTUAL, 2001), "set_eops_unix" },
  212. { Event(VIRTUAL, 2002), "set_eops_dos" },
  213. { Event(VIRTUAL, 2003), "set_eops_mac" },
  214. { Event(VIRTUAL, 2004), "set_eops_unicode" },
  215. { Event(VIRTUAL, 2005), "set_rtl_nsm_off" },
  216. { Event(VIRTUAL, 2006), "set_rtl_nsm_asis" },
  217. { Event(VIRTUAL, 2007), "set_rtl_nsm_transliterated" },
  218. { Event(VIRTUAL, 2008), "set_maqaf_display_transliterated" },
  219. { Event(VIRTUAL, 2009), "set_maqaf_display_highlighted" },
  220. { Event(VIRTUAL, 2010), "set_maqaf_display_asis" },
  221. { Event(VIRTUAL, 2011), "set_wrap_type_at_white_space" },
  222. { Event(VIRTUAL, 2012), "set_wrap_type_anywhere" },
  223. { Event(VIRTUAL, 2013), "set_wrap_type_off" },
  224. { Event(ALT, '1'), "set_dir_algo_unicode" },
  225. { Event(ALT, '2'), "set_dir_algo_context_strong" },
  226. { Event(ALT, '3'), "set_dir_algo_context_rtl" },
  227. { Event(ALT, '4'), "set_dir_algo_force_ltr" },
  228. { Event(ALT, '5'), "set_dir_algo_force_rtl" },
  229. { Event(VIRTUAL, 2300), "toggle_key_for_key_undo" },
  230. { Event(CTRL | ALT, 'b'), "toggle_bidi" },
  231. { Event(VIRTUAL, 4000), "menu_set_syn_hlt_none" },
  232. { Event(VIRTUAL, 4001), "menu_set_syn_hlt_html" },
  233. { Event(VIRTUAL, 4002), "menu_set_syn_hlt_email" },
  234. { Event(VIRTUAL, 4010), "toggle_underline" },
  235. { Event(ALT, 'v'), "toggle_visual_cursor_movement" },
  236. END_BINDINGS
  237. };
  238. Editor::action_entry Editor::actions_table[] = {
  239. ADD_ACTION(Editor, layout_windows, NULL),
  240. ADD_ACTION(Editor, load_file,
  241. N_("Load file from disk")),
  242. ADD_ACTION(Editor, save_file,
  243. N_("Save file to disk")),
  244. ADD_ACTION(Editor, save_file_as,
  245. N_("Save file in another name")),
  246. ADD_ACTION(Editor, insert_file,
  247. N_("Insert file from disk (or read from pipe) into the buffer")),
  248. ADD_ACTION(Editor, change_tab_width,
  249. N_("Change the TAB character size")),
  250. ADD_ACTION(Editor, change_justification_column,
  251. N_("Change the column used to justify paragraphs")),
  252. ADD_ACTION(Editor, insert_unicode_char,
  253. N_("Insert a specific Unicode character using its known code number")),
  254. ADD_ACTION(Editor, go_to_line,
  255. N_("Go to a specific line")),
  256. ADD_ACTION(Editor, search_forward,
  257. N_("Search for a string, starting from the cursor")),
  258. ADD_ACTION(Editor, search_forward_next,
  259. N_("Search for the next occurrence of the string")),
  260. ADD_ACTION(Editor, toggle_cursor_position_report,
  261. N_("Toggle continuous display of cursor position in the status line")),
  262. ADD_ACTION(Editor, refresh_and_center,
  263. N_("Repaint the terminal screen (if it was garbled for some reason)")),
  264. ADD_ACTION(Editor, show_character_code,
  265. N_("Print the unicode value and UTF-8 sequence of the character the cursor is on")),
  266. ADD_ACTION(Editor, show_character_info,
  267. N_("Print the corresponding UnicodeData.txt line of the character the cursor is on")),
  268. ADD_ACTION(Editor, quit,
  269. N_("Quit the editor")),
  270. ADD_ACTION(Editor, help,
  271. N_("Get help for using this editor")),
  272. ADD_ACTION(Editor, describe_key,
  273. N_("Gives a short description for a shortcut key")),
  274. ADD_ACTION(Editor, change_directory,
  275. N_("Change current directory")),
  276. ADD_ACTION(Editor, toggle_arabic_shaping,
  277. N_("Toggle Arabic shaping and Lam-Alif ligature")),
  278. ADD_ACTION(Editor, write_selection_to_file,
  279. N_("Write the selected text (or the whole text, if none selected) to a file/pipe")),
  280. ADD_ACTION(Editor, change_scroll_step,
  281. N_("Change the scroll step (# of lines to scroll up/down when cursor at top/bottom)")),
  282. ADD_ACTION(Editor, load_unload_speller,
  283. N_("Explicitly load or unload the speller process")),
  284. ADD_ACTION(Editor, spell_check_all,
  285. N_("Spell check all the document")),
  286. ADD_ACTION(Editor, spell_check_forward,
  287. N_("Spell check the document, from the cursor onward")),
  288. ADD_ACTION(Editor, spell_check_word,
  289. N_("Spell check the word on which the cursor stands")),
  290. ADD_ACTION(Editor, menu,
  291. N_("Activate menu")),
  292. #ifdef HAVE_CURS_SET
  293. ADD_ACTION(Editor, toggle_big_cursor,
  294. N_("Toogle big cursor (console only); useful if you're visually impaired")),
  295. #endif
  296. ADD_ACTION(Editor, toggle_graphical_boxes,
  297. N_("Use graphical characters for the menus and scrollbar")),
  298. ADD_ACTION(Editor, external_edit_prompt,
  299. N_("Edit this file with an external editor, prompt for editor command")),
  300. ADD_ACTION(Editor, external_edit_no_prompt,
  301. N_("Edit this file with an external editor (using previously entered command)")),
  302. ADD_ACTION(Editor, menu_set_scrollbar_none, NULL),
  303. ADD_ACTION(Editor, menu_set_scrollbar_left, NULL),
  304. ADD_ACTION(Editor, menu_set_scrollbar_right, NULL),
  305. ADD_ACTION(Editor, toggle_syntax_auto_detection, N_("Whether to try to detect HTML files and email messages")),
  306. ADD_ACTION(Editor, set_default_theme, NULL),
  307. END_ACTIONS
  308. };
  309. binding_entry Editor::bindings_table[] = {
  310. #ifdef KEY_RESIZE
  311. { Event(KEY_RESIZE), "layout_windows" },
  312. #endif
  313. { Event(KEY_F(1)), "help" },
  314. { Event(KEY_F(2)), "save_file" },
  315. { Event(CTRL, 's'), "save_file_as" },
  316. { Event(CTRL, 'w'), "write_selection_to_file" },
  317. { Event(KEY_F(3)), "load_file" },
  318. { Event(KEY_F(7)), "search_forward" },
  319. { Event(KEY_F(17)), "search_forward_next" },
  320. { Event(ALT, 'r'), "insert_file" },
  321. { Event(CTRL | ALT, 'c'), "change_directory" },
  322. { Event(ALT, 'x'), "quit" },
  323. { Event(ALT, 'X'), "quit" },
  324. { Event(ALT, 'c'), "toggle_cursor_position_report" },
  325. { Event(CTRL | ALT, 't'), "change_tab_width" },
  326. { Event(CTRL | ALT, 'j'), "change_justification_column" },
  327. { Event(CTRL | ALT, 'v'), "insert_unicode_char"},
  328. { Event(CTRL | ALT, 'u'), "show_character_code"},
  329. { Event(CTRL | ALT, 's'), "change_scroll_step"},
  330. { Event(ALT, 'a'), "toggle_arabic_shaping"},
  331. { Event(ALT, '\t'), "show_character_info"},
  332. { Event(CTRL, 'g'), "go_to_line"},
  333. { Event(CTRL, 'l'), "refresh_and_center"},
  334. { Event(KEY_F(4)), "describe_key"},
  335. { Event(KEY_F(5)), "spell_check_all" },
  336. { Event(KEY_F(6)), "spell_check_forward" },
  337. { Event(ALT, '$'), "spell_check_word" },
  338. { Event(ALT, 'S'), "load_unload_speller" },
  339. { Event(KEY_F(9)), "menu" },
  340. { Event(KEY_F(10)), "menu" },
  341. { Event(ALT, 0, KEY_F(8)), "external_edit_prompt" },
  342. { Event(KEY_F(8)), "external_edit_no_prompt" },
  343. { Event(VIRTUAL, 3000), "toggle_big_cursor" },
  344. { Event(VIRTUAL, 1100), "toggle_graphical_boxes" },
  345. { Event(VIRTUAL, 1200), "menu_set_scrollbar_none" },
  346. { Event(VIRTUAL, 1201), "menu_set_scrollbar_left" },
  347. { Event(VIRTUAL, 1202), "menu_set_scrollbar_right" },
  348. { Event(VIRTUAL, 1300), "toggle_syntax_auto_detection" },
  349. { Event(VIRTUAL, 1400), "set_default_theme" },
  350. END_BINDINGS
  351. };
  352. DialogLine::action_entry DialogLine::actions_table[] = {
  353. ADD_ACTION(DialogLine, layout_windows, NULL),
  354. ADD_ACTION(DialogLine, cancel_modal, NULL),
  355. ADD_ACTION(DialogLine, refresh, NULL),
  356. END_ACTIONS
  357. };
  358. binding_entry DialogLine::bindings_table[] = {
  359. #ifdef KEY_RESIZE
  360. { Event(KEY_RESIZE), "layout_windows" },
  361. #endif
  362. { Event(CTRL, 'g'), "cancel_modal" },
  363. { Event(CTRL, 'c'), "cancel_modal" },
  364. { Event(0, ESC), "cancel_modal" },
  365. { Event(CTRL, 'l'), "refresh" },
  366. END_BINDINGS
  367. };
  368. InputLine::action_entry InputLine::actions_table[] = {
  369. ADD_ACTION(InputLine, previous_completion, NULL),
  370. ADD_ACTION(InputLine, next_completion, NULL),
  371. ADD_ACTION(InputLine, end_modal, NULL),
  372. ADD_ACTION(InputLine, previous_history, NULL),
  373. ADD_ACTION(InputLine, next_history, NULL),
  374. END_ACTIONS
  375. };
  376. binding_entry InputLine::bindings_table[] = {
  377. { Event(0, '\r'), "end_modal" },
  378. { Event(0, '\t'), "next_completion" },
  379. { Event(ALT, '\t'), "previous_completion" },
  380. { Event(CTRL, 'p'), "previous_history" },
  381. { Event(CTRL, 'n'), "next_history" },
  382. { Event(KEY_UP), "previous_history" },
  383. { Event(KEY_DOWN), "next_history" },
  384. END_BINDINGS
  385. };
  386. HelpBox::action_entry HelpBox::actions_table[] = {
  387. ADD_ACTION(HelpBox, end_modal, NULL),
  388. ADD_ACTION(HelpBox, layout_windows, NULL),
  389. ADD_ACTION(HelpBox, refresh_and_center, NULL),
  390. ADD_ACTION(HelpBox, move_to_toc, NULL),
  391. ADD_ACTION(HelpBox, pop_position, NULL),
  392. END_ACTIONS
  393. };
  394. binding_entry HelpBox::bindings_table[] = {
  395. #ifdef KEY_RESIZE
  396. { Event(KEY_RESIZE), "layout_windows" },
  397. #endif
  398. { Event(CTRL, 'l'), "refresh_and_center"},
  399. { Event(KEY_F(1)), "end_modal" },
  400. { Event(ALT, 'x'), "end_modal" },
  401. { Event(ALT, 'X'), "end_modal" },
  402. { Event(0, ESC), "end_modal" },
  403. { Event(ALT, 'b'), "pop_position" },
  404. { Event(ALT, 't'), "move_to_toc" },
  405. END_BINDINGS
  406. };
  407. SpellerWnd::action_entry SpellerWnd::actions_table[] = {
  408. ADD_ACTION(SpellerWnd, layout_windows, NULL),
  409. ADD_ACTION(SpellerWnd, ignore_word, NULL),
  410. ADD_ACTION(SpellerWnd, abort_spelling, NULL),
  411. ADD_ACTION(SpellerWnd, abort_spelling_restore_cursor, NULL),
  412. ADD_ACTION(SpellerWnd, add_to_dict, NULL),
  413. ADD_ACTION(SpellerWnd, edit_replacement, NULL),
  414. ADD_ACTION(SpellerWnd, set_global_decision, NULL),
  415. ADD_ACTION(SpellerWnd, refresh, NULL),
  416. END_ACTIONS
  417. };
  418. binding_entry SpellerWnd::bindings_table[] = {
  419. #ifdef KEY_RESIZE
  420. { Event(KEY_RESIZE), "layout_windows" },
  421. #endif
  422. { Event(CTRL, 'g'), "abort_spelling" },
  423. { Event(CTRL, 'c'), "abort_spelling" },
  424. { Event(0, ESC), "abort_spelling" },
  425. { Event(ALT, 'x'), "abort_spelling_restore_cursor" },
  426. { Event(0, 'q'), "abort_spelling_restore_cursor" },
  427. { Event(0, 'x'), "abort_spelling_restore_cursor" },
  428. { Event(CTRL, 'l'), "refresh" },
  429. { Event(0, ' '), "ignore_word" },
  430. { Event(0, 'a'), "add_to_dict" },
  431. { Event(0, 'r'), "edit_replacement" },
  432. { Event(0, 'g'), "set_global_decision" },
  433. END_BINDINGS
  434. };
  435. PopupMenu::action_entry PopupMenu::actions_table[] = {
  436. ADD_ACTION(PopupMenu, cancel_menu, NULL),
  437. ADD_ACTION(PopupMenu, prev_menu, NULL),
  438. ADD_ACTION(PopupMenu, next_menu, NULL),
  439. ADD_ACTION(PopupMenu, select, NULL),
  440. ADD_ACTION(PopupMenu, move_previous_item, NULL),
  441. ADD_ACTION(PopupMenu, move_next_item, NULL),
  442. ADD_ACTION(PopupMenu, move_first_item, NULL),
  443. ADD_ACTION(PopupMenu, move_last_item, NULL),
  444. ADD_ACTION(PopupMenu, screen_resize, NULL),
  445. END_ACTIONS
  446. };
  447. binding_entry PopupMenu::bindings_table[] = {
  448. #ifdef KEY_RESIZE
  449. { Event(KEY_RESIZE), "screen_resize" },
  450. #endif
  451. { Event(KEY_F(9)), "cancel_menu" },
  452. { Event(KEY_F(10)), "cancel_menu" },
  453. { Event(CTRL, 'c'), "cancel_menu" },
  454. { Event(CTRL, 'g'), "cancel_menu" },
  455. { Event(0, ESC), "cancel_menu" },
  456. { Event(KEY_LEFT), "prev_menu" },
  457. { Event(KEY_RIGHT), "next_menu" },
  458. { Event(0, '\r'), "select" },
  459. { Event(KEY_UP), "move_previous_item" },
  460. { Event(KEY_DOWN), "move_next_item" },
  461. { Event(KEY_HOME), "move_first_item" },
  462. { Event(KEY_END), "move_last_item" },
  463. { Event(KEY_PPAGE), "move_first_item" },
  464. { Event(KEY_NPAGE), "move_last_item" },
  465. { Event(CTRL, 'p'), "move_previous_item" },
  466. { Event(CTRL, 'n'), "move_next_item" },
  467. END_BINDINGS
  468. };
  469. Menubar::action_entry Menubar::actions_table[] = {
  470. ADD_ACTION(Menubar, select, NULL),
  471. ADD_ACTION(Menubar, next_menu, NULL),
  472. ADD_ACTION(Menubar, prev_menu, NULL),
  473. ADD_ACTION(Menubar, end_modal, NULL),
  474. ADD_ACTION(Menubar, screen_resize, NULL),
  475. END_ACTIONS
  476. };
  477. binding_entry Menubar::bindings_table[] = {
  478. #ifdef KEY_RESIZE
  479. { Event(KEY_RESIZE), "screen_resize" },
  480. #endif
  481. { Event(KEY_F(9)), "end_modal" },
  482. { Event(KEY_F(10)), "end_modal" },
  483. { Event(CTRL, 'c'), "end_modal" },
  484. { Event(CTRL, 'g'), "end_modal" },
  485. { Event(0, ESC), "end_modal" },
  486. { Event(KEY_LEFT), "prev_menu" },
  487. { Event(KEY_RIGHT), "next_menu" },
  488. { Event(KEY_DOWN), "select" },
  489. { Event(0, '\r'), "select" },
  490. END_BINDINGS
  491. };