keybind.h 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367
  1. #ifndef MC__KEYBIND_H
  2. #define MC__KEYBIND_H
  3. #include "lib/global.h"
  4. /*** typedefs(not structures) and defined constants **********************************************/
  5. /* keymap sections */
  6. #define KEYMAP_SECTION_FILEMANAGER "filemanager"
  7. #define KEYMAP_SECTION_FILEMANAGER_EXT "filemanager:xmap"
  8. #define KEYMAP_SECTION_PANEL "panel"
  9. #define KEYMAP_SECTION_DIALOG "dialog"
  10. #define KEYMAP_SECTION_MENU "menu"
  11. #define KEYMAP_SECTION_INPUT "input"
  12. #define KEYMAP_SECTION_LISTBOX "listbox"
  13. #define KEYMAP_SECTION_RADIO "radio"
  14. #define KEYMAP_SECTION_TREE "tree"
  15. #define KEYMAP_SECTION_HELP "help"
  16. #define KEYMAP_SECTION_CHATTR "chattr"
  17. #define KEYMAP_SECTION_EDITOR "editor"
  18. #define KEYMAP_SECTION_EDITOR_EXT "editor:xmap"
  19. #define KEYMAP_SECTION_VIEWER "viewer"
  20. #define KEYMAP_SECTION_VIEWER_HEX "viewer:hex"
  21. #define KEYMAP_SECTION_DIFFVIEWER "diffviewer"
  22. #define KEYMAP_SHORTCUT_LENGTH 32 /* FIXME: is 32 bytes enough for shortcut? */
  23. #define CK_PipeBlock(i) (10000+(i))
  24. #define CK_Macro(i) (20000+(i))
  25. #define CK_MacroLast CK_Macro(0x7FFF)
  26. /*** enums ***************************************************************************************/
  27. enum
  28. {
  29. /* special commands */
  30. CK_InsertChar = -1L,
  31. CK_IgnoreKey = 0L,
  32. /* common */
  33. CK_Enter = 1L,
  34. CK_ChangePanel,
  35. CK_Up,
  36. CK_Down,
  37. CK_Left,
  38. CK_Right,
  39. CK_Home,
  40. CK_End,
  41. CK_LeftQuick,
  42. CK_RightQuick,
  43. CK_PageUp,
  44. CK_PageDown,
  45. CK_HalfPageUp,
  46. CK_HalfPageDown,
  47. CK_Top,
  48. CK_Bottom,
  49. CK_TopOnScreen,
  50. CK_MiddleOnScreen,
  51. CK_BottomOnScreen,
  52. CK_WordLeft,
  53. CK_WordRight,
  54. CK_Copy,
  55. CK_Move,
  56. CK_Delete,
  57. CK_MakeDir,
  58. CK_ChangeMode,
  59. CK_ChangeOwn,
  60. CK_ChangeOwnAdvanced,
  61. CK_ChangeAttributes,
  62. CK_Remove,
  63. CK_BackSpace,
  64. CK_Redo,
  65. CK_Clear,
  66. CK_Menu,
  67. CK_MenuLastSelected,
  68. CK_UserMenu,
  69. CK_EditUserMenu,
  70. CK_Search,
  71. CK_SearchContinue,
  72. CK_Replace,
  73. CK_ReplaceContinue,
  74. CK_SearchStop,
  75. CK_Help,
  76. CK_Edit,
  77. CK_EditNew,
  78. CK_Shell,
  79. CK_SelectCodepage,
  80. CK_EditorViewerHistory,
  81. CK_History,
  82. CK_HistoryNext,
  83. CK_HistoryPrev,
  84. CK_Complete,
  85. CK_Save,
  86. CK_SaveAs,
  87. CK_Goto,
  88. CK_Reread,
  89. CK_Refresh,
  90. CK_Suspend,
  91. CK_Swap,
  92. CK_Mark,
  93. CK_HotList,
  94. CK_ScreenList,
  95. CK_ScreenNext,
  96. CK_ScreenPrev,
  97. CK_FilePrev,
  98. CK_FileNext,
  99. CK_DeleteToHome,
  100. CK_DeleteToEnd,
  101. CK_DeleteToWordBegin,
  102. CK_DeleteToWordEnd,
  103. CK_ShowNumbers,
  104. CK_Store,
  105. CK_Cut,
  106. CK_Paste,
  107. CK_MarkLeft,
  108. CK_MarkRight,
  109. CK_MarkUp,
  110. CK_MarkDown,
  111. CK_MarkToWordBegin,
  112. CK_MarkToWordEnd,
  113. CK_MarkToHome,
  114. CK_MarkToEnd,
  115. CK_ToggleNavigation,
  116. CK_Sort,
  117. CK_Options,
  118. CK_LearnKeys,
  119. CK_Bookmark,
  120. CK_Quit,
  121. CK_QuitQuiet,
  122. /* C-x or similar */
  123. CK_ExtendedKeyMap,
  124. /* main commands */
  125. CK_EditForceInternal = 100L,
  126. CK_View,
  127. CK_ViewRaw,
  128. CK_ViewFile,
  129. CK_ViewFiltered,
  130. CK_Find,
  131. CK_DirSize,
  132. CK_HotListAdd,
  133. CK_SetupListingFormat,
  134. CK_CompareDirs,
  135. CK_OptionsVfs,
  136. CK_OptionsConfirm,
  137. CK_PutCurrentLink,
  138. CK_PutOtherLink,
  139. CK_OptionsDisplayBits,
  140. CK_EditExtensionsFile,
  141. CK_EditFileHighlightFile,
  142. CK_LinkSymbolicEdit,
  143. CK_ExternalPanelize,
  144. CK_Filter,
  145. CK_ConnectShell,
  146. CK_ConnectFtp,
  147. CK_ConnectSftp,
  148. CK_PanelInfo,
  149. CK_Jobs,
  150. CK_OptionsLayout,
  151. CK_OptionsAppearance,
  152. CK_Link,
  153. CK_PanelListing,
  154. CK_ListMode,
  155. CK_CdQuick,
  156. CK_PanelQuickView,
  157. CK_VfsList,
  158. CK_SaveSetup,
  159. CK_LinkSymbolic,
  160. CK_ShowHidden,
  161. CK_PanelTree,
  162. CK_Tree,
  163. CK_Undelete,
  164. CK_SplitVertHoriz,
  165. CK_SplitEqual,
  166. CK_SplitMore,
  167. CK_SplitLess,
  168. CK_CompareFiles,
  169. CK_OptionsPanel,
  170. CK_LinkSymbolicRelative,
  171. CK_PutCurrentPath,
  172. CK_PutOtherPath,
  173. CK_PutCurrentSelected,
  174. CK_PutCurrentFullSelected,
  175. CK_PutCurrentTagged,
  176. CK_PutOtherTagged,
  177. CK_Select,
  178. CK_Unselect,
  179. CK_SelectExt,
  180. CK_SelectInvert,
  181. /* panels */
  182. CK_PanelOtherCd = 200L,
  183. CK_PanelOtherCdLink,
  184. CK_Panelize,
  185. CK_CopySingle,
  186. CK_MoveSingle,
  187. CK_DeleteSingle,
  188. CK_CdChild,
  189. CK_CdParent,
  190. CK_CdParentSmart,
  191. CK_PanelOtherSync,
  192. CK_SortNext,
  193. CK_SortPrev,
  194. CK_SortReverse,
  195. CK_SortByName,
  196. CK_SortByExt,
  197. CK_SortBySize,
  198. CK_SortByMTime,
  199. CK_ScrollLeft,
  200. CK_ScrollRight,
  201. CK_CycleListingFormat,
  202. /* dialog */
  203. CK_Ok = 300L,
  204. CK_Cancel,
  205. /* input */
  206. CK_Yank = 350L,
  207. /* help */
  208. CK_Index = 400L,
  209. CK_Back,
  210. CK_LinkNext,
  211. CK_LinkPrev,
  212. CK_NodeNext,
  213. CK_NodePrev,
  214. /* tree */
  215. CK_Forget = 450L,
  216. /* chattr dialog */
  217. CK_MarkAndDown = 480L,
  218. /* editor */
  219. /* cursor movements */
  220. CK_Tab = 500L,
  221. CK_Undo,
  222. CK_ScrollUp,
  223. CK_ScrollDown,
  224. CK_Return,
  225. CK_ParagraphUp,
  226. CK_ParagraphDown,
  227. /* file commands */
  228. CK_EditFile,
  229. CK_InsertFile,
  230. CK_EditSyntaxFile,
  231. CK_Close,
  232. /* block commands */
  233. CK_BlockSave,
  234. CK_BlockShiftLeft,
  235. CK_BlockShiftRight,
  236. CK_DeleteLine,
  237. /* bookmarks */
  238. CK_BookmarkFlush,
  239. CK_BookmarkNext,
  240. CK_BookmarkPrev,
  241. /* mark commands */
  242. CK_MarkColumn,
  243. CK_MarkWord,
  244. CK_MarkLine,
  245. CK_MarkAll,
  246. CK_Unmark,
  247. CK_MarkPageUp,
  248. CK_MarkPageDown,
  249. CK_MarkToFileBegin,
  250. CK_MarkToFileEnd,
  251. CK_MarkToPageBegin,
  252. CK_MarkToPageEnd,
  253. CK_MarkScrollUp,
  254. CK_MarkScrollDown,
  255. CK_MarkParagraphUp,
  256. CK_MarkParagraphDown,
  257. /* column mark commands */
  258. CK_MarkColumnPageUp,
  259. CK_MarkColumnPageDown,
  260. CK_MarkColumnLeft,
  261. CK_MarkColumnRight,
  262. CK_MarkColumnUp,
  263. CK_MarkColumnDown,
  264. CK_MarkColumnScrollUp,
  265. CK_MarkColumnScrollDown,
  266. CK_MarkColumnParagraphUp,
  267. CK_MarkColumnParagraphDown,
  268. /* macros */
  269. CK_MacroStartRecord,
  270. CK_MacroStopRecord,
  271. CK_MacroStartStopRecord,
  272. CK_MacroDelete,
  273. CK_RepeatStartRecord,
  274. CK_RepeatStopRecord,
  275. CK_RepeatStartStopRecord,
  276. /* window commands */
  277. CK_WindowMove,
  278. CK_WindowResize,
  279. CK_WindowFullscreen,
  280. CK_WindowList,
  281. CK_WindowNext,
  282. CK_WindowPrev,
  283. /* misc commands */
  284. CK_SpellCheck,
  285. CK_SpellCheckCurrentWord,
  286. CK_SpellCheckSelectLang,
  287. CK_InsertOverwrite,
  288. CK_ParagraphFormat,
  289. CK_MatchBracket,
  290. CK_OptionsSaveMode,
  291. CK_About,
  292. CK_ShowMargin,
  293. CK_ShowTabTws,
  294. CK_SyntaxOnOff,
  295. CK_SyntaxChoose,
  296. CK_InsertLiteral,
  297. CK_ExternalCommand,
  298. CK_Date,
  299. CK_EditMail,
  300. /* viewer */
  301. CK_WrapMode = 600L,
  302. CK_MagicMode,
  303. CK_NroffMode,
  304. CK_HexMode,
  305. CK_HexEditMode,
  306. CK_BookmarkGoto,
  307. CK_Ruler,
  308. CK_SearchForward,
  309. CK_SearchBackward,
  310. CK_SearchForwardContinue,
  311. CK_SearchBackwardContinue,
  312. CK_SearchOppositeContinue,
  313. /* diff viewer */
  314. CK_ShowSymbols = 700L,
  315. CK_SplitFull,
  316. CK_Tab2,
  317. CK_Tab3,
  318. CK_Tab4,
  319. CK_Tab8,
  320. CK_HunkNext,
  321. CK_HunkPrev,
  322. CK_EditOther,
  323. CK_Merge,
  324. CK_MergeOther
  325. };
  326. /*** structures declarations (and typedefs of structures)*****************************************/
  327. /* The global keymaps are of this type */
  328. typedef struct global_keymap_t
  329. {
  330. long key;
  331. long command;
  332. char caption[KEYMAP_SHORTCUT_LENGTH];
  333. } global_keymap_t;
  334. /*** global variables defined in .c file *********************************************************/
  335. /*** declarations of public functions ************************************************************/
  336. void keybind_cmd_bind (GArray * keymap, const char *keybind, long action);
  337. long keybind_lookup_action (const char *name);
  338. const char *keybind_lookup_actionname (long action);
  339. const char *keybind_lookup_keymap_shortcut (const global_keymap_t * keymap, long action);
  340. long keybind_lookup_keymap_command (const global_keymap_t * keymap, long key);
  341. /*** inline functions ****************************************************************************/
  342. #endif /* MC__KEYBIND_H */