5 #include <sys/time.h> /* time_t */
7 #include "lib/global.h"
9 /*** typedefs(not structures) and defined constants **********************************************/
11 #define KEYMAP_SHORTCUT_LENGTH 32 /* FIXME: is 32 bytes enough for shortcut? */
13 /* special commands */
14 #define CK_Insert_Char -1
15 #define CK_Ignore_Key 0
17 /* cursor movements */
18 #define CK_BackSpace 1
22 #define CK_Page_Down 5
25 #define CK_Word_Left 8
26 #define CK_Word_Right 9
34 #define CK_Beginning_Of_Text 17
35 #define CK_End_Of_Text 18
36 #define CK_Scroll_Up 19
37 #define CK_Scroll_Down 20
39 #define CK_Begin_Page 22
40 #define CK_End_Page 23
41 #define CK_Delete_Word_Left 24
42 #define CK_Delete_Word_Right 25
43 #define CK_Paragraph_Up 26
44 #define CK_Paragraph_Down 27
50 #define CK_Save_As 104
51 #define CK_Load_Prev_File 111
52 #define CK_Load_Next_File 112
53 #define CK_Load_Syntax_File 121
54 #define CK_Load_Menu_File 122
63 #define CK_Save_Block 207
64 #define CK_Column_Mark 208
65 #define CK_Shift_Block_Left 211
66 #define CK_Shift_Block_Right 212
67 #define CK_Mark_All 213
69 /* search and replace */
71 #define CK_Find_Again 302
72 #define CK_Replace 303
73 #define CK_Replace_Again 304
74 #define CK_Complete_Word 305
77 /* debugger commands */
78 #define CK_Debug_Start 350
79 #define CK_Debug_Stop 351
80 #define CK_Debug_Toggle_Break 352
81 #define CK_Debug_Clear 353
82 #define CK_Debug_Next 354
83 #define CK_Debug_Step 355
84 #define CK_Debug_Back_Trace 356
85 #define CK_Debug_Continue 357
86 #define CK_Debug_Enter_Command 358
87 #define CK_Debug_Until_Curser 359
91 #define CK_Insert_File 401
93 #define CK_Toggle_Insert 403
96 #define CK_Refresh 406
98 #define CK_Delete_Line 408
99 #define CK_Delete_To_Line_End 409
100 #define CK_Delete_To_Line_Begin 410
101 #define CK_Man_Page 411
104 #define CK_Cancel 414
105 #define CK_Complete 415
106 #define CK_Paragraph_Format 416
108 #define CK_Type_Load_Python 418
109 #define CK_Find_File 419
111 #define CK_Match_Bracket 421
112 #define CK_Terminal 422
113 #define CK_Terminal_App 423
114 #define CK_ExtCmd 424
115 #define CK_User_Menu 425
116 #define CK_Find_Definition 426
117 #define CK_Edit_Options 427
118 #define CK_Edit_Save_Mode 428
119 #define CK_Choose_Syntax 429
123 /* application control */
124 #define CK_Save_Desktop 451
125 #define CK_New_Window 452
127 #define CK_Save_And_Quit 455
128 #define CK_Run_Another 456
129 #define CK_Check_Save_And_Quit 457
130 #define CK_Maximize 458
133 #define CK_Toggle_Show_Margin 460
134 #define CK_Toggle_Tab_TWS 470
135 #define CK_Toggle_Syntax 480
136 #define CK_Toggle_Line_State 490
139 #define CK_Begin_Record_Macro 501
140 #define CK_End_Record_Macro 502
141 #define CK_Delete_Macro 503
144 #define CK_Toggle_Bookmark 550
145 #define CK_Flush_Bookmarks 551
146 #define CK_Next_Bookmark 552
147 #define CK_Prev_Bookmark 553
149 /* highlight commands */
150 #define CK_Page_Up_Highlight 604
151 #define CK_Page_Down_Highlight 605
152 #define CK_Left_Highlight 606
153 #define CK_Right_Highlight 607
154 #define CK_Word_Left_Highlight 608
155 #define CK_Word_Right_Highlight 609
156 #define CK_Up_Highlight 610
157 #define CK_Down_Highlight 611
158 #define CK_Home_Highlight 612
159 #define CK_End_Highlight 613
160 #define CK_Beginning_Of_Text_Highlight 614
161 #define CK_End_Of_Text_Highlight 615
162 #define CK_Begin_Page_Highlight 616
163 #define CK_End_Page_Highlight 617
164 #define CK_Scroll_Up_Highlight 618
165 #define CK_Scroll_Down_Highlight 619
166 #define CK_Paragraph_Up_Highlight 620
167 #define CK_Paragraph_Down_Highlight 621
169 /* alt highlight commands */
170 #define CK_Page_Up_Alt_Highlight 654
171 #define CK_Page_Down_Alt_Highlight 655
172 #define CK_Left_Alt_Highlight 656
173 #define CK_Right_Alt_Highlight 657
174 #define CK_Word_Left_Alt_Highlight 658
175 #define CK_Word_Right_Alt_Highlight 659
176 #define CK_Up_Alt_Highlight 660
177 #define CK_Down_Alt_Highlight 661
178 #define CK_Home_Alt_Highlight 662
179 #define CK_End_Alt_Highlight 663
180 #define CK_Beginning_Of_Text_Alt_Highlight 664
181 #define CK_End_Of_Text_Alt_Highlight 665
182 #define CK_Begin_Page_Alt_Highlight 666
183 #define CK_End_Page_Alt_Highlight 667
184 #define CK_Scroll_Up_Alt_Highlight 668
185 #define CK_Scroll_Down_Alt_Highlight 669
186 #define CK_Paragraph_Up_Alt_Highlight 670
187 #define CK_Paragraph_Down_Alt_Highlight 671
189 /* X clipboard operations */
190 #define CK_XStore 701
192 #define CK_XPaste 703
193 #define CK_Selection_History 704
198 #define CK_Ext_Mode 820
200 #define CK_Insert_Literal 851
201 #define CK_Execute_Macro 852
202 #define CK_Begin_End_Macro 853
205 #define CK_HelpHelp 1001
206 #define CK_HelpIndex 1002
207 #define CK_HelpBack 1003
208 #define CK_HelpQuit 1004
209 #define CK_HelpMoveUp 1005
210 #define CK_HelpMoveDown 1006
211 #define CK_HelpSelectLink 1007
212 #define CK_HelpNextLink 1008
213 #define CK_HelpPrevLink 1009
214 #define CK_HelpNextNode 1010
215 #define CK_HelpPrevNode 1011
216 #define CK_HelpMovePgDn 1012
217 #define CK_HelpMovePgUp 1013
218 #define CK_HelpMoveHalfPgDn 1014
219 #define CK_HelpMoveHalfPgUp 1015
220 #define CK_HelpMoveTop 1016
221 #define CK_HelpMoveBottom 1017
224 #define CK_ShowCommandLine 2001
225 #define CK_SelectCodepage 2002
226 #define CK_StartExtMap1 2021
227 #define CK_StartExtMap2 2022
230 #define CK_DialogOK 3001
231 #define CK_DialogCancel 3002
232 #define CK_DialogPrevItem 3003
233 #define CK_DialogNextItem 3004
234 #define CK_DialogHelp 3005
235 #define CK_DialogSuspend 3006
236 #define CK_DialogRefresh 3007
239 #define CK_InputBol 4001
240 #define CK_InputEol 4002
241 #define CK_InputMoveLeft 4003
242 #define CK_InputWordLeft 4004
243 #define CK_InputBackwardChar 4005
244 #define CK_InputBackwardWord 4006
245 #define CK_InputMoveRight 4007
246 #define CK_InputWordRight 4008
247 #define CK_InputForwardChar 4009
248 #define CK_InputForwardWord 4010
249 #define CK_InputBackwardDelete 4011
250 #define CK_InputDeleteChar 4012
251 #define CK_InputKillWord 4013
252 #define CK_InputBackwardKillWord 4014
253 #define CK_InputSetMark 4015
254 #define CK_InputKillRegion 4016
255 #define CK_InputKillSave 4017
256 #define CK_InputYank 4018
257 #define CK_InputCopyRegion 4019
258 #define CK_InputKillLine 4020
259 #define CK_InputHistoryPrev 4021
260 #define CK_InputHistoryNext 4022
261 #define CK_InputHistoryShow 4023
262 #define CK_InputComplete 4024
263 #define CK_InputPaste 4025
264 #define CK_InputClearLine 4026
265 #define CK_InputLeftHighlight 4027
266 #define CK_InputRightHighlight 4028
267 #define CK_InputWordLeftHighlight 4029
268 #define CK_InputWordRightHighlight 4030
269 #define CK_InputBolHighlight 4031
270 #define CK_InputEolHighlight 4032
273 #define CK_ListboxMoveUp 4500
274 #define CK_ListboxMoveDown 4501
275 #define CK_ListboxMoveHome 4502
276 #define CK_ListboxMoveEnd 4503
277 #define CK_ListboxMovePgUp 4504
278 #define CK_ListboxMovePgDn 4505
279 #define CK_ListboxDeleteItem 4506
280 #define CK_ListboxDeleteAll 4507
283 #define CK_ViewHelp 5001
284 #define CK_ViewToggleWrapMode 5002
285 #define CK_ViewToggleHexEditMode 5003
286 #define CK_ViewToggleHexMode 5004
287 #define CK_ViewGoto 5005
288 #define CK_ViewHexEditSave 5006
289 #define CK_ViewSearch 5007
290 #define CK_ViewToggleMagicMode 5008
291 #define CK_ViewToggleNroffMode 5009
292 #define CK_ViewQuit 5010
293 #define CK_ViewContinueSearch 5011
294 #define CK_ViewGotoBookmark 5012
295 #define CK_ViewNewBookmark 5013
296 #define CK_ViewMoveUp 5014
297 #define CK_ViewMoveDown 5015
298 #define CK_ViewMoveLeft 5016
299 #define CK_ViewMoveRight 5017
300 #define CK_ViewMovePgDn 5018
301 #define CK_ViewMovePgUp 5019
302 #define CK_ViewMoveHalfPgDn 5020
303 #define CK_ViewMoveHalfPgUp 5021
304 #define CK_ViewMoveToBol 5022
305 #define CK_ViewMoveToEol 5023
306 #define CK_ViewNextFile 5024
307 #define CK_ViewPrevFile 5025
308 #define CK_ViewToggleRuler 5026
309 #define CK_ViewToggleHexNavMode 5027
310 #define CK_ViewMoveTop 5028
311 #define CK_ViewMoveBottom 5029
312 #define CK_ViewMoveLeft10 5030
313 #define CK_ViewMoveRight10 5031
316 #define CK_TreeHelp 6001
317 #define CK_TreeForget 6003
318 #define CK_TreeToggleNav 6004
319 #define CK_TreeCopy 6005
320 #define CK_TreeMove 6006
321 #define CK_TreeMake 6007
322 #define CK_TreeMoveUp 6011
323 #define CK_TreeMoveDown 6012
324 #define CK_TreeMoveLeft 6013
325 #define CK_TreeMoveRight 6014
326 #define CK_TreeMoveHome 6015
327 #define CK_TreeMoveEnd 6016
328 #define CK_TreeMovePgUp 6017
329 #define CK_TreeMovePgDn 6018
330 #define CK_TreeOpen 6019
331 #define CK_TreeRescan 6020
332 #define CK_TreeStartSearch 6021
333 #define CK_TreeRemove 6022
336 #define CK_AddHotlist 7001
337 #define CK_ChangeListingCmd 7002
338 #define CK_ChmodCmd 7003
339 #define CK_ChownAdvancedCmd 7004
340 #define CK_ChownCmd 7005
341 #define CK_CompareDirsCmd 7006
342 #define CK_ConfigureBox 7007
343 #define CK_ConfigureVfs 7008
344 #define CK_ConfirmBox 7009
345 #define CK_CopyCmd 7010
346 #define CK_CopyCurrentPathname 7011
347 #define CK_CopyCurrentReadlink 7012
348 #define CK_CopyCurrentTagged 7013
349 #define CK_CopyOtherPathname 7014
350 #define CK_CopyOtherReadlink 7015
351 #define CK_CopyOtherTagged 7016
352 #define CK_DeleteCmd 7017
353 #define CK_DirsizesCmd 7018
354 #define CK_DisplayBitsBox 7019
355 #define CK_EditCmd 7020
356 #define CK_EditExtFileCmd 7021
357 #define CK_EditFhlFileCmd 7022
358 #define CK_EditMcMenuCmd 7023
359 #define CK_EditSymlinkCmd 7024
360 #define CK_EditSyntaxCmd 7025
361 #define CK_EditUserMenuCmd 7026
362 #define CK_ExternalPanelize 7027
363 #define CK_FilterCmd 7028
364 #define CK_FilteredViewCmd 7029
365 #define CK_FindCmd 7030
366 #define CK_FishlinkCmd 7031
367 #define CK_FtplinkCmd 7032
368 #define CK_HistoryCmd 7033
369 #define CK_InfoCmd 7034
370 #define CK_JobsCmd 7035
371 #define CK_LayoutBox 7036
372 #define CK_LearnKeys 7037
373 #define CK_LinkCmd 7038
374 #define CK_ListingCmd 7039
375 #define CK_ListmodeCmd 7042
376 #define CK_MenuLastSelectedCmd 7044
377 #define CK_MkdirCmd 7045
378 #define CK_QuickCdCmd 7047
379 #define CK_QuickChdirCmd 7048
380 #define CK_QuickViewCmd 7049
381 #define CK_QuietQuitCmd 7050
382 #define CK_QuitCmd 7051
383 #define CK_RenameCmd 7052
384 #define CK_RereadCmd 7053
385 #define CK_ReselectVfs 7054
386 #define CK_ReverseSelectionCmd 7055
387 #define CK_SaveSetupCmd 7056
388 #define CK_SelectCmd 7057
389 #define CK_SingleDirsizeCmd 7058
390 #define CK_SmblinkCmd 7059
391 #define CK_SuspendCmd 7060
392 #define CK_SwapCmd 7061
393 #define CK_SymlinkCmd 7062
394 #define CK_ToggleListingCmd 7063
395 #define CK_ToggleShowHidden 7064
396 #define CK_TreeCmd 7065
397 #define CK_TreeBoxCmd 7066
398 #define CK_UndeleteCmd 7067
399 #define CK_UnselectCmd 7068
400 #define CK_UserFileMenuCmd 7069
401 #define CK_UserMenuCmd 7070
402 #define CK_ViewCmd 7071
403 #define CK_ViewFileCmd 7072
404 #define CK_HelpCmd 7073
405 #define CK_MenuCmd 7074
406 #define CK_TogglePanelsSplit 7075
407 #define CK_DiffViewCmd 7076
408 #define CK_PanelOptionsBox 7077
409 #define CK_RelativeSymlinkCmd 7078
410 #define CK_DialogListCmd 7079
411 #define CK_DialogNextCmd 7080
412 #define CK_DialogPrevCmd 7081
413 #define CK_EditForceInternalCmd 7082
416 #define CK_PanelChdirOtherPanel 8001
417 #define CK_PanelChdirToReadlink 8002
418 #define CK_PanelCmdCopyLocal 8003
419 #define CK_PanelCmdDeleteLocal 8004
420 #define CK_PanelCmdDoEnter 8005
421 #define CK_PanelCmdEditNew 8006
422 #define CK_PanelCmdRenameLocal 8007
423 #define CK_PanelCmdReverseSelection 8008
424 #define CK_PanelCmdSelect 8009
425 #define CK_PanelCmdUnselect 8010
426 #define CK_PanelCmdViewSimple 8011
427 #define CK_PanelGotoChildDir 8012
428 #define CK_PanelGotoParentDir 8013
429 #define CK_PanelDirectoryHistoryList 8014
430 #define CK_PanelDirectoryHistoryNext 8015
431 #define CK_PanelDirectoryHistoryPrev 8016
432 #define CK_PanelGotoBottomFile 8017
433 #define CK_PanelGotoMiddleFile 8018
434 #define CK_PanelGotoTopFile 8019
435 #define CK_PanelMarkFile 8020
436 #define CK_PanelMarkFileUp 8021
437 #define CK_PanelMarkFileDown 8022
438 #define CK_PanelMoveDown 8023
439 #define CK_PanelMoveEnd 8024
440 #define CK_PanelMoveHome 8025
441 #define CK_PanelMoveUp 8026
442 #define CK_PanelMoveLeft 8027
443 #define CK_PanelMoveRight 8028
444 #define CK_PanelNextPage 8029
445 #define CK_PanelPrevPage 8030
446 #define CK_PanelSetPanelEncoding 8031
447 #define CK_PanelStartSearch 8032
448 #define CK_PanelStopSearch 8033
449 #define CK_PanelSyncOtherPanel 8034
450 #define CK_PanelToggleSortOrderNext 8035
451 #define CK_PanelToggleSortOrderPrev 8036
452 #define CK_PanelSelectSortOrder 8037
453 #define CK_PanelReverseSort 8038
454 #define CK_PanelSortOrderByName 8039
455 #define CK_PanelSortOrderByExt 8040
456 #define CK_PanelSortOrderBySize 8041
457 #define CK_PanelSortOrderByMTime 8042
458 #define CK_PanelSmartGotoParentDir 8043
461 #define CK_DiffDisplaySymbols 9001
462 #define CK_DiffDisplayNumbers 9002
463 #define CK_DiffFull 9003
464 #define CK_DiffEqual 9004
465 #define CK_DiffSplitMore 9005
466 #define CK_DiffSplitLess 9006
467 #define CK_DiffShowDiff 9008
468 #define CK_DiffSetTab2 9009
469 #define CK_DiffSetTab3 9010
470 #define CK_DiffSetTab4 9011
471 #define CK_DiffSetTab8 9012
472 #define CK_DiffSwapPanel 9013
473 #define CK_DiffRedo 9014
474 #define CK_DiffNextHunk 9015
475 #define CK_DiffPrevHunk 9016
476 #define CK_DiffGoto 9017
477 #define CK_DiffEditCurrent 9018
478 #define CK_DiffEditOther 9019
479 #define CK_DiffSearch 9020
480 #define CK_DiffEOF 9021
481 #define CK_DiffBOF 9022
482 #define CK_DiffDown 9023
483 #define CK_DiffUp 9024
484 #define CK_DiffLeft 9025
485 #define CK_DiffRight 9026
486 #define CK_DiffQuickLeft 9027
487 #define CK_DiffQuickRight 9028
488 #define CK_DiffPageDown 9029
489 #define CK_DiffPageUp 9030
490 #define CK_DiffHome 9031
491 #define CK_DiffEnd 9032
492 #define CK_DiffQuit 9033
493 #define CK_DiffHelp 9034
494 #define CK_DiffMergeCurrentHunk 9035
495 #define CK_DiffSave 9036
496 #define CK_DiffContinueSearch 9037
497 #define CK_DiffOptions 9038
500 Process a block through a shell command: CK_Pipe_Block(i) executes shell_cmd[i].
501 shell_cmd[i] must process the file ~/cooledit.block and output ~/cooledit.block
502 which is then inserted into the text in place of the original block. shell_cmd[i] must
503 also produce a file homedir/cooledit.error . If this file is not empty an error will
504 have been assumed to have occured, and the block will not be replaced.
505 TODO: bring up a viewer to display the error message instead of inserting
506 it into the text, which is annoying.
508 #define CK_Pipe_Block(i) (1000+(i))
509 #define SHELL_COMMANDS_i {"/edit.indent.rc", "/edit.spell.rc", /* and so on */ 0 }
510 #define CK_Macro(i) (2000+(i))
511 #define CK_Last_Macro CK_Macro(0x7FFF)
513 /*** enums ***************************************************************************************/
515 /*** structures declarations (and typedefs of structures)*****************************************/
517 typedef struct name_keymap_t
523 typedef struct key_config_t
525 time_t mtime
; /* mtime at the moment we read config file */
531 /* The global keymaps are of this type */
532 typedef struct global_keymap_t
535 unsigned long command
;
536 char caption
[KEYMAP_SHORTCUT_LENGTH
];
539 /*** global variables defined in .c file *********************************************************/
541 /*** declarations of public functions ************************************************************/
543 void keybind_cmd_bind (GArray
* keymap
, const char *keybind
, unsigned long action
);
544 unsigned long keybind_lookup_action (const char *name
);
545 const char *keybind_lookup_keymap_shortcut (const global_keymap_t
* keymap
, unsigned long action
);
546 unsigned long keybind_lookup_keymap_command (const global_keymap_t
* keymap
, long key
);
548 /*** inline functions ****************************************************************************/
550 #endif /* MC__KEYBIND_H */