From 722121a57505c6cf9fd98ba16fa1c0778ad8fca1 Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Sun, 20 Feb 2011 18:23:32 +0300 Subject: [PATCH] Define keybind numbers using enum. Signed-off-by: Andrew Borodin --- doc/man/mcedit.1.in | 10 +- lib/keybind.c | 10 +- lib/keybind.h | 570 ++++++++++++++++++------------------- lib/widget/buttonbar.c | 4 +- lib/widget/dialog.c | 2 +- lib/widget/input.c | 4 +- lib/widget/listbox.c | 2 +- lib/widget/menu.c | 16 +- src/diffviewer/ydiff.c | 2 +- src/editor/editcmd.c | 2 +- src/editor/editkeys.c | 8 +- src/filemanager/midnight.c | 4 +- src/help.c | 2 +- src/keybind-defaults.c | 26 +- src/viewer/actions_cmd.c | 4 +- 15 files changed, 331 insertions(+), 335 deletions(-) diff --git a/doc/man/mcedit.1.in b/doc/man/mcedit.1.in index 22261e3d5..1acdc00cf 100644 --- a/doc/man/mcedit.1.in +++ b/doc/man/mcedit.1.in @@ -117,18 +117,18 @@ like following: .PP .nf [editor] -ctrl\-W=EditPipeBlock:25; +ctrl\-W=ExecuteScript:25; .fi .PP This means that ctrl\-W hotkey initiates the -.I EditPipeBlock(25) -action, next the editor handler translates this into execution of +.I ExecuteScript(25) +action, then editor handler translates this into execution of .B ~/.local/share/mc/mcedit/macros.d/macro.25.sh shell script. .PP -External scripts stored into +External scripts are stored in .B ~/.local/share/mc/mcedit/macros.d/ -directory and must named +directory and must be named as .B macro.XXXX.sh where .B XXXX diff --git a/lib/keybind.c b/lib/keybind.c index e81938765..1cdba94cc 100644 --- a/lib/keybind.c +++ b/lib/keybind.c @@ -301,6 +301,8 @@ static name_keymap_t command_names[] = { {"ShowMargin", CK_ShowMargin}, {"OptionsSaveMode", CK_OptionsSaveMode}, {"About", CK_About}, + /* An action to run external script from macro */ + {"ExecuteScript", CK_PipeBlock (0)}, #endif /* USE_INTERNAL_EDIT */ /* viewer */ @@ -329,7 +331,7 @@ static name_keymap_t command_names[] = { {"Merge", CK_Merge}, #endif /* USE_DIFF_VIEW */ - {NULL, CK_Ignore_Key} + {NULL, CK_IgnoreKey} }; static const size_t num_command_names = G_N_ELEMENTS (command_names) - 1; @@ -366,7 +368,7 @@ sort_command_names (void) static void keymap_add (GArray * keymap, long key, unsigned long cmd, const char *caption) { - if (key != 0 && cmd != CK_Ignore_Key) + if (key != 0 && cmd != CK_IgnoreKey) { global_keymap_t new_bind; @@ -405,7 +407,7 @@ keybind_lookup_action (const char *name) res = bsearch (&key, command_names, num_command_names, sizeof (command_names[0]), name_keymap_comparator); - return (res != NULL) ? res->val : CK_Ignore_Key; + return (res != NULL) ? res->val : CK_IgnoreKey; } /* --------------------------------------------------------------------------------------------- */ @@ -447,7 +449,7 @@ keybind_lookup_keymap_command (const global_keymap_t * keymap, long key) if (keymap[i].key == key) return keymap[i].command; - return CK_Ignore_Key; + return CK_IgnoreKey; } /* --------------------------------------------------------------------------------------------- */ diff --git a/lib/keybind.h b/lib/keybind.h index 0d3598fb0..3532d77d8 100644 --- a/lib/keybind.h +++ b/lib/keybind.h @@ -10,299 +10,293 @@ #define KEYMAP_SHORTCUT_LENGTH 32 /* FIXME: is 32 bytes enough for shortcut? */ -/* special commands */ -#define CK_Insert_Char -1 -#define CK_Ignore_Key 0 - -/* common */ -#define CK_Enter 3 -#define CK_Up 10 -#define CK_Down 11 -#define CK_Left 6 -#define CK_Right 7 -#define CK_Home 12 -#define CK_End 13 -#define CK_LeftQuick 9027 -#define CK_RightQuick 9028 -#define CK_PageUp 4 -#define CK_PageDown 5 -#define CK_HalfPageUp 1015 -#define CK_HalfPageDown 1014 -#define CK_Top 17 -#define CK_Bottom 18 -#define CK_TopOnScreen 8019 -#define CK_MiddleOnScreen 8018 -#define CK_BottomOnScreen 8017 -#define CK_WordLeft 8 -#define CK_WordRight 9 -#define CK_Copy 202 -#define CK_Move 203 -#define CK_Delete 2 -#define CK_MakeDir 7045 -#define CK_ChangeMode 7003 -#define CK_ChangeOwn 7005 -#define CK_ChangeOwnAdvanced 7004 -#define CK_Remove 204 -#define CK_BackSpace 1 -#define CK_Redo 16 -#define CK_Clear 4026 -#define CK_Menu 123 -#define CK_MenuLastSelected 7044 -#define CK_UserMenu 425 -#define CK_EditUserMenu 7026 -#define CK_Search 8032 -#define CK_SearchContinue 5011 -#define CK_Replace 303 -#define CK_ReplaceContinue 304 -#define CK_SearchStop 8033 -#define CK_Help 404 -#define CK_Edit 7020 -#define CK_Shell 801 -#ifdef HAVE_CHARSET -#define CK_SelectCodepage 2002 -#endif -#define CK_History 4021 -#define CK_HistoryNext 4022 -#define CK_HistoryPrev 4023 -#define CK_Complete 305 -#define CK_SaveAs 104 -#define CK_Goto 407 -#define CK_Reread 7053 -#define CK_Refresh 406 -#define CK_Suspend 7060 -#define CK_Swap 7061 -#define CK_HotList 7048 -#define CK_ScreenList 7079 -#define CK_ScreenNext 7080 -#define CK_ScreenPrev 7081 -#define CK_FilePrev 111 -#define CK_FileNext 112 -#define CK_DeleteToWordBegin 24 -#define CK_DeleteToWordEnd 25 -#define CK_ShowNumbers 490 -#define CK_Store 701 -#define CK_Cut 702 -#define CK_Paste 703 -#define CK_Mark 201 -#define CK_MarkLeft 606 -#define CK_MarkRight 607 -#define CK_MarkUp 8021 -#define CK_MarkDown 8022 -#define CK_MarkToWordBegin 608 -#define CK_MarkToWordEnd 609 -#define CK_MarkToHome 612 -#define CK_MarkToEnd 613 -#define CK_ToggleNavigation 5027 -#define CK_Sort 412 -#define CK_Options 7007 -#define CK_LearnKeys 7037 -#define CK_Bookmark 5013 -#define CK_Quit 402 -#define CK_QuitQuiet 7050 -/* C-x or similar */ -#define CK_ExtendedKeyMap 820 - -/* main commands */ -#ifdef USE_INTERNAL_EDIT -#define CK_EditForceInternal 7082 -#endif -#define CK_View 7071 -#define CK_ViewRaw 8011 -#define CK_ViewFile 7072 -#define CK_ViewFiltered 7029 -#define CK_Find 419 -#define CK_DirSize 7058 -#define CK_HotListAdd 7001 -#define CK_PanelListingChange 7002 -#define CK_CompareDirs 7006 -#define CK_OptionsVfs 7008 -#define CK_OptionsConfirm 7009 -#define CK_PutCurrentLink 7012 -#define CK_PutOtherLink 7015 -#define CK_OptionsDisplayBits 7019 -#define CK_EditExtensionsFile 7021 -#define CK_EditFileHighlightFile 7022 -#define CK_LinkSymbolicEdit 7024 -#define CK_ExternalPanelize 7027 -#define CK_Filter 7028 -#define CK_ConnectFish 7031 -#define CK_ConnectFtp 7032 -#define CK_ConnectSmb 7059 -#define CK_PanelInfo 7034 -#define CK_Jobs 7035 -#define CK_OptionsLayout 7036 -#define CK_Link 7038 -#define CK_PanelListing 7039 -#define CK_ListMode 7042 -#define CK_CdQuick 7047 -#define CK_PanelQuickView 7049 -#define CK_VfsList 7054 -#define CK_SaveSetup 7056 -#define CK_LinkSymbolic 7062 -#define CK_PanelListingSwitch 7063 -#define CK_ShowHidden 7064 -#define CK_PanelTree 7065 -#define CK_Tree 7066 -#define CK_Undelete 7067 -#define CK_SplitVertHoriz 7075 -#ifdef USE_DIFF_VIEW -#define CK_CompareFiles 7076 -#endif /* USE_DIFF_VIEW */ -#define CK_OptionsPanel 7077 -#define CK_LinkSymbolicRelative 7078 -#define CK_PutCurrentPath 7011 -#define CK_PutOtherPath 7014 -#define CK_PutCurrentTagged 7013 -#define CK_PutOtherTagged 7016 -#define CK_Select 7057 -#define CK_Unselect 7068 -#define CK_SelectInvert 7055 - -/* panels */ -#define CK_PanelOtherCd 8001 -#define CK_PanelOtherCdLink 8002 -#define CK_CopySingle 8003 -#define CK_MoveSingle 8007 -#define CK_DeleteSingle 8004 -#define CK_CdChild 8012 -#define CK_CdParent 8013 -#define CK_CdParentSmart 8043 -#define CK_PanelOtherSync 8034 -#define CK_SortNext 8035 -#define CK_SortPrev 8036 -#define CK_SortReverse 8038 -#define CK_SortByName 8039 -#define CK_SortByExt 8040 -#define CK_SortBySize 8041 -#define CK_SortByMTime 8042 - -/* dialog */ -#define CK_Ok 3001 -#define CK_Cancel 3002 - -/* input */ -#define CK_Yank 4018 - -/* help */ -#define CK_Index 1002 -#define CK_Back 1003 -#define CK_LinkNext 1008 -#define CK_LinkPrev 1009 -#define CK_NodeNext 1010 -#define CK_NodePrev 1011 - -/* tree */ -#define CK_Forget 6003 - -#ifdef USE_INTERNAL_EDIT -/* cursor movements */ -#define CK_Tab 14 -#define CK_Undo 15 -#define CK_ScrollUp 19 -#define CK_ScrollDown 20 -#define CK_Return 21 -#define CK_ParagraphUp 26 -#define CK_ParagraphDown 27 -/* file commands */ -#define CK_Save 101 -#define CK_EditFile 102 -#define CK_EditNew 103 -#define CK_EditSyntaxFile 121 -/* block commands */ -#define CK_Unmark 206 -#define CK_BlockSave 207 -#define CK_MarkColumn 208 -#define CK_BlockShiftLeft 211 -#define CK_BlockShiftRight 212 -#define CK_MarkAll 213 -#define CK_MarkWord 214 -#define CK_MarkLine 215 -#define CK_InsertFile 401 -#define CK_InsertOverwrite 403 -#define CK_Date 405 -#define CK_DeleteLine 408 -#define CK_DeleteToHome 409 -#define CK_DeleteToEnd 410 -#define CK_Mail 413 -#define CK_ParagraphFormat 416 -#define CK_MatchBracket 421 -#define CK_ExternalCommand 424 -#define CK_OptionsSaveMode 428 -#define CK_About 430 -#define CK_ShowMargin 460 -#define CK_ShowTabTws 470 -#define CK_SyntaxOnOff 480 -#define CK_SyntaxChoose 429 -#define CK_InsertLiteral 851 -/* bookmarks */ -#define CK_BookmarkFlush 551 -#define CK_BookmarkNext 552 -#define CK_BookmarkPrev 553 -/* mark commands */ -#define CK_MarkPageUp 604 -#define CK_MarkPageDown 605 -#define CK_MarkToFileBegin 614 -#define CK_MarkToFileEnd 615 -#define CK_MarkToPageBegin 616 -#define CK_MarkToPageEnd 617 -#define CK_MarkScrollUp 618 -#define CK_MarkScrollDown 619 -#define CK_MarkParagraphUp 620 -#define CK_MarkParagraphDown 621 -/* column mark commands */ -#define CK_MarkColumnPageUp 654 -#define CK_MarkColumnPageDown 655 -#define CK_MarkColumnLeft 656 -#define CK_MarkColumnRight 657 -#define CK_MarkColumnUp 660 -#define CK_MarkColumnDown 661 -#define CK_MarkColumnScrollUp 668 -#define CK_MarkColumnScrollDown 669 -#define CK_MarkColumnParagraphUp 670 -#define CK_MarkColumnParagraphDown 671 -/* macros */ -#define CK_MacroStartRecord 501 -#define CK_MacroStopRecord 502 -#define CK_MacroStartStopRecord 853 -#define CK_MacroExecute 852 -#define CK_MacroDelete 503 -#define CK_RepeatStartStopRecord 854 -#define CK_RepeatStartRecord 855 -#define CK_RepeatStopRecord 856 -#endif /* USE_INTERNAL_EDIT */ - -/* viewer */ -#define CK_WrapMode 5002 -#define CK_HexEditMode 5003 -#define CK_HexMode 5004 -#define CK_MagicMode 5008 -#define CK_NroffMode 5009 -#define CK_BookmarkGoto 5012 -#define CK_Ruler 5026 - -#ifdef USE_DIFF_VIEW -/* diff viewer */ -#define CK_ShowSymbols 9001 -#define CK_SplitFull 9003 -#define CK_SplitEqual 9004 -#define CK_SplitMore 9005 -#define CK_SplitLess 9006 -#define CK_Tab2 9009 -#define CK_Tab3 9010 -#define CK_Tab4 9011 -#define CK_Tab8 9012 -#define CK_HunkNext 9015 -#define CK_HunkPrev 9016 -#define CK_EditOther 9019 -#define CK_Merge 9035 -#endif /* USE_DIFF_VIEW */ - #define CK_PipeBlock(i) (10000+(i)) #define CK_Macro(i) (20000+(i)) -#define CK_Last_Macro CK_Macro(0x7FFF) +#define CK_MacroLast CK_Macro(0x7FFF) /*** enums ***************************************************************************************/ +enum +{ + /* special commands */ + CK_InsertChar = -1, + CK_IgnoreKey = 0, + + /* common */ + CK_Enter = 1, + CK_Up, + CK_Down, + CK_Left, + CK_Right, + CK_Home, + CK_End, + CK_LeftQuick, + CK_RightQuick, + CK_PageUp, + CK_PageDown, + CK_HalfPageUp, + CK_HalfPageDown, + CK_Top, + CK_Bottom, + CK_TopOnScreen, + CK_MiddleOnScreen, + CK_BottomOnScreen, + CK_WordLeft, + CK_WordRight, + CK_Copy, + CK_Move, + CK_Delete, + CK_MakeDir, + CK_ChangeMode, + CK_ChangeOwn, + CK_ChangeOwnAdvanced, + CK_Remove, + CK_BackSpace, + CK_Redo, + CK_Clear, + CK_Menu, + CK_MenuLastSelected, + CK_UserMenu, + CK_EditUserMenu, + CK_Search, + CK_SearchContinue, + CK_Replace, + CK_ReplaceContinue, + CK_SearchStop, + CK_Help, + CK_Edit, + CK_Shell, + CK_SelectCodepage, + CK_History, + CK_HistoryNext, + CK_HistoryPrev, + CK_Complete, + CK_SaveAs, + CK_Goto, + CK_Reread, + CK_Refresh, + CK_Suspend, + CK_Swap, + CK_Mark, + CK_HotList, + CK_ScreenList, + CK_ScreenNext, + CK_ScreenPrev, + CK_FilePrev, + CK_FileNext, + CK_DeleteToWordBegin, + CK_DeleteToWordEnd, + CK_ShowNumbers, + CK_Store, + CK_Cut, + CK_Paste, + CK_MarkLeft, + CK_MarkRight, + CK_MarkUp, + CK_MarkDown, + CK_MarkToWordBegin, + CK_MarkToWordEnd, + CK_MarkToHome, + CK_MarkToEnd, + CK_ToggleNavigation, + CK_Sort, + CK_Options, + CK_LearnKeys, + CK_Bookmark, + CK_Quit, + CK_QuitQuiet, + /* C-x or similar */ + CK_ExtendedKeyMap, + + /* main commands */ + CK_EditForceInternal = 100, + CK_View, + CK_ViewRaw, + CK_ViewFile, + CK_ViewFiltered, + CK_Find, + CK_DirSize, + CK_HotListAdd, + CK_PanelListingChange, + CK_CompareDirs, + CK_OptionsVfs, + CK_OptionsConfirm, + CK_PutCurrentLink, + CK_PutOtherLink, + CK_OptionsDisplayBits, + CK_EditExtensionsFile, + CK_EditFileHighlightFile, + CK_LinkSymbolicEdit, + CK_ExternalPanelize, + CK_Filter, + CK_ConnectFish, + CK_ConnectFtp, + CK_ConnectSmb, + CK_PanelInfo, + CK_Jobs, + CK_OptionsLayout, + CK_Link, + CK_PanelListing, + CK_ListMode, + CK_CdQuick, + CK_PanelQuickView, + CK_VfsList, + CK_SaveSetup, + CK_LinkSymbolic, + CK_PanelListingSwitch, + CK_ShowHidden, + CK_PanelTree, + CK_Tree, + CK_Undelete, + CK_SplitVertHoriz, + CK_CompareFiles, + CK_OptionsPanel, + CK_LinkSymbolicRelative, + CK_PutCurrentPath, + CK_PutOtherPath, + CK_PutCurrentTagged, + CK_PutOtherTagged, + CK_Select, + CK_Unselect, + CK_SelectInvert, + + /* panels */ + CK_PanelOtherCd = 200, + CK_PanelOtherCdLink, + CK_CopySingle, + CK_MoveSingle, + CK_DeleteSingle, + CK_CdChild, + CK_CdParent, + CK_CdParentSmart, + CK_PanelOtherSync, + CK_SortNext, + CK_SortPrev, + CK_SortReverse, + CK_SortByName, + CK_SortByExt, + CK_SortBySize, + CK_SortByMTime, + + /* dialog */ + CK_Ok = 300, + CK_Cancel, + + /* input */ + CK_Yank = 350, + + /* help */ + CK_Index = 400, + CK_Back, + CK_LinkNext, + CK_LinkPrev, + CK_NodeNext, + CK_NodePrev, + + /* tree */ + CK_Forget = 450, + + /* editor */ + /* cursor movements */ + CK_Tab = 500, + CK_Undo, + CK_ScrollUp, + CK_ScrollDown, + CK_Return, + CK_ParagraphUp, + CK_ParagraphDown, + /* file commands */ + CK_Save, + CK_EditFile, + CK_EditNew, + CK_InsertFile, + CK_EditSyntaxFile, + /* block commands */ + CK_BlockSave, + CK_BlockShiftLeft, + CK_BlockShiftRight, + CK_DeleteLine, + CK_DeleteToHome, + CK_DeleteToEnd, + /* bookmarks */ + CK_BookmarkFlush, + CK_BookmarkNext, + CK_BookmarkPrev, + /* mark commands */ + CK_MarkColumn, + CK_MarkWord, + CK_MarkLine, + CK_MarkAll, + CK_Unmark, + CK_MarkPageUp, + CK_MarkPageDown, + CK_MarkToFileBegin, + CK_MarkToFileEnd, + CK_MarkToPageBegin, + CK_MarkToPageEnd, + CK_MarkScrollUp, + CK_MarkScrollDown, + CK_MarkParagraphUp, + CK_MarkParagraphDown, + /* column mark commands */ + CK_MarkColumnPageUp, + CK_MarkColumnPageDown, + CK_MarkColumnLeft, + CK_MarkColumnRight, + CK_MarkColumnUp, + CK_MarkColumnDown, + CK_MarkColumnScrollUp, + CK_MarkColumnScrollDown, + CK_MarkColumnParagraphUp, + CK_MarkColumnParagraphDown, + /* macros */ + CK_MacroStartRecord, + CK_MacroStopRecord, + CK_MacroStartStopRecord, + CK_MacroDelete, + CK_RepeatStartRecord, + CK_RepeatStopRecord, + CK_RepeatStartStopRecord, + /* misc commands */ + CK_InsertOverwrite, + CK_ParagraphFormat, + CK_MatchBracket, + CK_OptionsSaveMode, + CK_About, + CK_ShowMargin, + CK_ShowTabTws, + CK_SyntaxOnOff, + CK_SyntaxChoose, + CK_InsertLiteral, + CK_ExternalCommand, + CK_Date, + CK_Mail, + + /* viewer */ + CK_WrapMode = 600, + CK_MagicMode, + CK_NroffMode, + CK_HexMode, + CK_HexEditMode, + CK_BookmarkGoto, + CK_Ruler, + + /* diff viewer */ + CK_ShowSymbols = 700, + CK_SplitFull, + CK_SplitEqual, + CK_SplitMore, + CK_SplitLess, + CK_Tab2, + CK_Tab3, + CK_Tab4, + CK_Tab8, + CK_HunkNext, + CK_HunkPrev, + CK_EditOther, + CK_Merge +}; + /*** structures declarations (and typedefs of structures)*****************************************/ typedef struct name_keymap_t diff --git a/lib/widget/buttonbar.c b/lib/widget/buttonbar.c index 18cf7a05b..8cbc2aa84 100644 --- a/lib/widget/buttonbar.c +++ b/lib/widget/buttonbar.c @@ -146,7 +146,7 @@ buttonbar_call (WButtonBar * bb, int i) { cb_ret_t ret = MSG_NOT_HANDLED; - if ((bb != NULL) && (bb->labels[i].command != CK_Ignore_Key)) + if ((bb != NULL) && (bb->labels[i].command != CK_IgnoreKey)) ret = bb->widget.owner->callback (bb->widget.owner, (Widget *) bb, DLG_ACTION, bb->labels[i].command, bb->labels[i].receiver); @@ -256,7 +256,7 @@ buttonbar_set_label (WButtonBar * bb, int idx, const char *text, { if ((bb != NULL) && (idx >= 1) && (idx <= BUTTONBAR_LABELS_NUM)) { - unsigned long command = CK_Ignore_Key; + unsigned long command = CK_IgnoreKey; if (keymap != NULL) command = keybind_lookup_keymap_command (keymap, KEY_F (idx)); diff --git a/lib/widget/dialog.c b/lib/widget/dialog.c index cbc210010..4181da4c1 100644 --- a/lib/widget/dialog.c +++ b/lib/widget/dialog.c @@ -310,7 +310,7 @@ dlg_handle_key (Dlg_head * h, int d_key) { unsigned long command; command = keybind_lookup_keymap_command (dialog_map, d_key); - if ((command == CK_Ignore_Key) || (dlg_execute_cmd (h, command) == MSG_NOT_HANDLED)) + if ((command == CK_IgnoreKey) || (dlg_execute_cmd (h, command) == MSG_NOT_HANDLED)) return MSG_NOT_HANDLED; else return MSG_HANDLED; diff --git a/lib/widget/input.c b/lib/widget/input.c index 6b697bbc4..ddd3afd88 100644 --- a/lib/widget/input.c +++ b/lib/widget/input.c @@ -1115,7 +1115,7 @@ input_handle_char (WInput * in, int key) command = keybind_lookup_keymap_command (input_map, key); - if (command == CK_Ignore_Key) + if (command == CK_IgnoreKey) { if (key > 255) return MSG_NOT_HANDLED; @@ -1151,7 +1151,7 @@ input_key_is_in_map (WInput * in, int key) (void) in; command = keybind_lookup_keymap_command (input_map, key); - if (command == CK_Ignore_Key) + if (command == CK_IgnoreKey) return 0; return (command == CK_Complete) ? 2 : 1; diff --git a/lib/widget/listbox.c b/lib/widget/listbox.c index 497368bda..fa0c23d2b 100644 --- a/lib/widget/listbox.c +++ b/lib/widget/listbox.c @@ -308,7 +308,7 @@ listbox_key (WListbox * l, int key) } command = keybind_lookup_keymap_command (listbox_map, key); - if (command == CK_Ignore_Key) + if (command == CK_IgnoreKey) return MSG_NOT_HANDLED; return listbox_execute_cmd (l, command); } diff --git a/lib/widget/menu.c b/lib/widget/menu.c index f449324fe..ad513cf72 100644 --- a/lib/widget/menu.c +++ b/lib/widget/menu.c @@ -36,7 +36,7 @@ #include "lib/widget.h" /* TODO: these includes should be removed! */ -#include "src/keybind-defaults.h" /* CK_Ignore_Key */ +#include "src/keybind-defaults.h" /* CK_IgnoreKey */ #include "src/help.h" #include "src/filemanager/midnight.h" /* is_right */ @@ -294,7 +294,7 @@ menubar_execute (WMenuBar * menubar) const Menu *menu = g_list_nth_data (menubar->menu, menubar->selected); const menu_entry_t *entry = g_list_nth_data (menu->entries, menu->selected); - if ((entry != NULL) && (entry->command != CK_Ignore_Key)) + if ((entry != NULL) && (entry->command != CK_IgnoreKey)) { is_right = (menubar->selected != 0); menubar_finish (menubar); @@ -320,7 +320,7 @@ menubar_down (WMenuBar * menubar) menu->selected = (menu->selected + 1) % len; entry = (menu_entry_t *) g_list_nth_data (menu->entries, menu->selected); } - while ((entry == NULL) || (entry->command == CK_Ignore_Key)); + while ((entry == NULL) || (entry->command == CK_IgnoreKey)); menubar_paint_idx (menubar, menu->selected, MENU_SELECTED_COLOR); } @@ -344,7 +344,7 @@ menubar_up (WMenuBar * menubar) menu->selected--; entry = (menu_entry_t *) g_list_nth_data (menu->entries, menu->selected); } - while ((entry == NULL) || (entry->command == CK_Ignore_Key)); + while ((entry == NULL) || (entry->command == CK_IgnoreKey)); menubar_paint_idx (menubar, menu->selected, MENU_SELECTED_COLOR); } @@ -368,7 +368,7 @@ menubar_first (WMenuBar * menubar) { entry = (menu_entry_t *) g_list_nth_data (menu->entries, menu->selected); - if ((entry == NULL) || (entry->command == CK_Ignore_Key)) + if ((entry == NULL) || (entry->command == CK_IgnoreKey)) menu->selected++; else break; @@ -398,7 +398,7 @@ menubar_last (WMenuBar * menubar) menu->selected--; entry = (menu_entry_t *) g_list_nth_data (menu->entries, menu->selected); } - while ((entry == NULL) || (entry->command == CK_Ignore_Key)); + while ((entry == NULL) || (entry->command == CK_IgnoreKey)); menubar_paint_idx (menubar, menu->selected, MENU_SELECTED_COLOR); } @@ -474,7 +474,7 @@ menubar_handle_key (WMenuBar * menubar, int key) { const menu_entry_t *entry = i->data; - if ((entry != NULL) && (entry->command != CK_Ignore_Key) + if ((entry != NULL) && (entry->command != CK_IgnoreKey) && (entry->text.hotkey != NULL) && (key == g_ascii_tolower (entry->text.hotkey[0]))) { menu->selected = g_list_position (menu->entries, i); @@ -686,7 +686,7 @@ menubar_event (Gpm_Event * event, void *data) if ((pos < 0) || (pos >= bottom_y - 3)) return MOU_NORMAL; - if ((entry != NULL) && (entry->command != CK_Ignore_Key)) + if ((entry != NULL) && (entry->command != CK_IgnoreKey)) { menubar_paint_idx (menubar, menu->selected, MENU_ENTRY_COLOR); menu->selected = pos; diff --git a/src/diffviewer/ydiff.c b/src/diffviewer/ydiff.c index f34381b6d..dde6457a9 100644 --- a/src/diffviewer/ydiff.c +++ b/src/diffviewer/ydiff.c @@ -3144,7 +3144,7 @@ dview_handle_key (WDiff * dview, int key) key = convert_from_input_c (key); command = keybind_lookup_keymap_command (diff_map, key); - if ((command != CK_Ignore_Key) && (dview_execute_cmd (dview, command) == MSG_HANDLED)) + if ((command != CK_IgnoreKey) && (dview_execute_cmd (dview, command) == MSG_HANDLED)) return MSG_HANDLED; /* Key not used */ diff --git a/src/editor/editcmd.c b/src/editor/editcmd.c index d1fa746b8..f537db5fc 100644 --- a/src/editor/editcmd.c +++ b/src/editor/editcmd.c @@ -2901,7 +2901,7 @@ edit_print_string (WEdit * e, const char *s) { size_t i = 0; while (s[i] != '\0') - edit_execute_cmd (e, CK_Insert_Char, (unsigned char) s[i++]); + edit_execute_cmd (e, CK_InsertChar, (unsigned char) s[i++]); e->force |= REDRAW_COMPLETELY; edit_update_screen (e); return i; diff --git a/src/editor/editkeys.c b/src/editor/editkeys.c index 0de8a5ce0..9a945473c 100644 --- a/src/editor/editkeys.c +++ b/src/editor/editkeys.c @@ -75,7 +75,7 @@ int edit_translate_key (WEdit * edit, long x_key, int *cmd, int *ch) { - unsigned long command = (unsigned long) CK_Insert_Char; + unsigned long command = (unsigned long) CK_InsertChar; int char_for_insertion = -1; int c; @@ -190,14 +190,14 @@ edit_translate_key (WEdit * edit, long x_key, int *cmd, int *ch) else command = keybind_lookup_keymap_command (editor_map, x_key); - if (command == CK_Ignore_Key) - command = CK_Insert_Char; + if (command == CK_IgnoreKey) + command = CK_InsertChar; fin: *cmd = (int) command; /* FIXME */ *ch = char_for_insertion; - return (command == (unsigned long) CK_Insert_Char && char_for_insertion == -1) ? 0 : 1; + return (command == (unsigned long) CK_InsertChar && char_for_insertion == -1) ? 0 : 1; } /* --------------------------------------------------------------------------------------------- */ diff --git a/src/filemanager/midnight.c b/src/filemanager/midnight.c index 169b893ca..d0f22128f 100644 --- a/src/filemanager/midnight.c +++ b/src/filemanager/midnight.c @@ -1334,7 +1334,7 @@ midnight_callback (Dlg_head * h, Widget * sender, dlg_msg_t msg, int parm, void { ctl_x_map_enabled = FALSE; command = keybind_lookup_keymap_command (main_x_map, parm); - if (command != CK_Ignore_Key) + if (command != CK_IgnoreKey) return midnight_execute_cmd (NULL, command); } @@ -1455,7 +1455,7 @@ midnight_callback (Dlg_head * h, Widget * sender, dlg_msg_t msg, int parm, void else command = keybind_lookup_keymap_command (main_map, parm); - return (command == CK_Ignore_Key) ? MSG_NOT_HANDLED : midnight_execute_cmd (NULL, command); + return (command == CK_IgnoreKey) ? MSG_NOT_HANDLED : midnight_execute_cmd (NULL, command); case DLG_POST_KEY: if (!the_menubar->is_active) diff --git a/src/help.c b/src/help.c index 6fa619b9d..e10b8697f 100644 --- a/src/help.c +++ b/src/help.c @@ -919,7 +919,7 @@ help_handle_key (Dlg_head * h, int c) unsigned long command; command = keybind_lookup_keymap_command (help_map, c); - if ((command == CK_Ignore_Key) || (help_execute_cmd (command) == MSG_NOT_HANDLED)) + if ((command == CK_IgnoreKey) || (help_execute_cmd (command) == MSG_NOT_HANDLED)) return MSG_NOT_HANDLED; help_callback (h, NULL, DLG_DRAW, 0, NULL); diff --git a/src/keybind-defaults.c b/src/keybind-defaults.c index a6bda692b..be7b02d09 100644 --- a/src/keybind-defaults.c +++ b/src/keybind-defaults.c @@ -116,7 +116,7 @@ const global_keymap_t default_main_map[] = { {ALT ('}'), CK_ScreenNext, "M-}"}, {ALT ('{'), CK_ScreenPrev, "M-{"}, - {0, CK_Ignore_Key, ""} + {0, CK_IgnoreKey, ""} }; const global_keymap_t default_main_x_map[] = { @@ -146,7 +146,7 @@ const global_keymap_t default_main_x_map[] = { #ifdef WITH_BACKGROUND {'j', CK_Jobs, "j"}, #endif /* WITH_BACKGROUND */ - {0, CK_Ignore_Key, ""} + {0, CK_IgnoreKey, ""} }; /* panel */ @@ -190,7 +190,7 @@ const global_keymap_t default_panel_keymap[] = { {XCTRL ('s'), CK_Search, "C-s"}, {ALT ('s'), CK_Search, "M-s"}, {ALT ('i'), CK_PanelOtherSync, "M-i"}, - {0, CK_Ignore_Key, ""} + {0, CK_IgnoreKey, ""} }; /* dialog */ @@ -207,7 +207,7 @@ const global_keymap_t default_dialog_keymap[] = { {KEY_F (1), CK_Help, "F1"}, {XCTRL ('z'), CK_Suspend, "C-z"}, {XCTRL ('l'), CK_Refresh, "C-l"}, - {0, CK_Ignore_Key, ""} + {0, CK_IgnoreKey, ""} }; const global_keymap_t default_input_keymap[] = { @@ -255,7 +255,7 @@ const global_keymap_t default_input_keymap[] = { /* Completion */ {ALT ('\t'), CK_Complete, "M-tab"}, - {0, CK_Ignore_Key, ""} + {0, CK_IgnoreKey, ""} }; const global_keymap_t default_listbox_keymap[] = { @@ -277,7 +277,7 @@ const global_keymap_t default_listbox_keymap[] = { {'d', CK_Delete, "d"}, {KEY_M_SHIFT | KEY_DC, CK_Clear, "S-Delete"}, {'D', CK_Clear, "D"}, - {0, CK_Ignore_Key, ""} + {0, CK_IgnoreKey, ""} }; /* tree */ @@ -314,7 +314,7 @@ const global_keymap_t default_tree_keymap[] = { {XCTRL ('s'), CK_Search, "C-s"}, {ALT ('s'), CK_Search, "M-s"}, {KEY_DC, CK_Delete, "Delete"}, - {0, CK_Ignore_Key, ""} + {0, CK_IgnoreKey, ""} }; /* help */ @@ -360,7 +360,7 @@ const global_keymap_t default_help_keymap[] = { {'p', CK_NodePrev, "p"}, {ESC_CHAR, CK_Quit, "Esc"}, {XCTRL ('g'), CK_Quit, "C-g"}, - {0, CK_Ignore_Key, ""} + {0, CK_IgnoreKey, ""} }; #ifdef USE_INTERNAL_EDIT @@ -492,13 +492,13 @@ const global_keymap_t default_editor_keymap[] = { {XCTRL ('x'), CK_ExtendedKeyMap, "C-x"}, - {0, CK_Ignore_Key, ""} + {0, CK_IgnoreKey, ""} }; /* emacs keyboard layout emulation */ const global_keymap_t default_editor_x_keymap[] = { {'k', CK_EditNew, "k"}, - {0, CK_Ignore_Key, ""} + {0, CK_IgnoreKey, ""} }; #endif /* USE_INTERNAL_EDIT */ @@ -589,7 +589,7 @@ const global_keymap_t default_viewer_keymap[] = { #endif {XCTRL ('o'), CK_Shell, "C-o"}, - {0, CK_Ignore_Key, ""} + {0, CK_IgnoreKey, ""} }; const global_keymap_t default_viewer_hex_keymap[] = { @@ -658,7 +658,7 @@ const global_keymap_t default_viewer_hex_keymap[] = { #endif {XCTRL ('o'), CK_Shell, "C-o"}, - {0, CK_Ignore_Key, ""} + {0, CK_IgnoreKey, ""} }; @@ -708,7 +708,7 @@ const global_keymap_t default_diff_keymap[] = { {KEY_F (10), CK_Quit, "F10"}, {KEY_F (14), CK_EditOther, "S-F4"}, - {0, CK_Ignore_Key, ""} + {0, CK_IgnoreKey, ""} }; #endif diff --git a/src/viewer/actions_cmd.c b/src/viewer/actions_cmd.c index fe0c3cc94..00e8cdbc6 100644 --- a/src/viewer/actions_cmd.c +++ b/src/viewer/actions_cmd.c @@ -400,12 +400,12 @@ mcview_handle_key (mcview_t * view, int key) return MSG_HANDLED; command = keybind_lookup_keymap_command (view->hex_map, key); - if ((command != CK_Ignore_Key) && (mcview_execute_cmd (view, command) == MSG_HANDLED)) + if ((command != CK_IgnoreKey) && (mcview_execute_cmd (view, command) == MSG_HANDLED)) return MSG_HANDLED; } command = keybind_lookup_keymap_command (view->plain_map, key); - if ((command != CK_Ignore_Key) && (mcview_execute_cmd (view, command) == MSG_HANDLED)) + if ((command != CK_IgnoreKey) && (mcview_execute_cmd (view, command) == MSG_HANDLED)) return MSG_HANDLED; #ifdef MC_ENABLE_DEBUGGING_CODE