root/lib/keybind.h

/* [previous][next][first][last][top][bottom][index][help]  */

INCLUDED FROM


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

/* [previous][next][first][last][top][bottom][index][help]  */