Merge branch 'HACK_menu'

* HACK_menu:
  Added new keybinding files in mc.spec.
  Show actual shortcuts in editor menu.
  Implemented default actual shortcuts for main menu.
  Implemented display of actual shortcuts in main menu.
  Add support for multi-hotkeys in editor (like a ctrl-x,t).
  Added default keybinding strings.
  Added missed '#include "fileloc.h"' in main.c.
  Some refactoring.
  Reimplemented keybindings parser.
  Use commands instead of callbacks to execute menu items.
  Fixed key translation in editor.
  Use commands instead of callbacks to execute menu items.
  Menu fixes and optimization.
  New menu engine: use GList instead of GPtrArray.
  Menu: handle HOME and END keys.
  Ticket #1563: Modified menu engine to create and modify menu dynamically.
This commit is contained in:
Andrew Borodin 2009-10-26 16:23:42 +03:00
commit 21fd13bf90
33 changed files with 2654 additions and 2213 deletions

View File

@ -149,6 +149,7 @@ rm -rf $RPM_BUILD_ROOT
%config(noreplace) %{_sysconfdir}/mc/extfs/extfs.ini
%config(noreplace) %{_sysconfdir}/mc/extfs/sfs.ini
%config(noreplace) %{_sysconfdir}/mc/mc.keymap
%config(noreplace) %{_sysconfdir}/mc/mc.keymap.*
%dir %{_datadir}/mc
%{_datadir}/mc/*
@ -156,6 +157,9 @@ rm -rf $RPM_BUILD_ROOT
%dir %{_libexecdir}/mc
%changelog
* Mon Oct 26 2009 Andrew Borodin <aborodin@vmail.ru>
- Add new %%{_sysconfdir}/mc/mc.keymap.* files.
* Fri Sep 04 2009 Slava Zanko <slavazanko@gmail.com>
- Add new file %%{_sysconfdir}/mc/filehighlight.ini

View File

@ -32,6 +32,9 @@
#include <stdio.h>
#include "../src/dialog.h" /* cb_ret_t */
#include "../src/keybind.h" /* global_keymap_t */
#include "../edit/edit.h"
#define SEARCH_DIALOG_OPTION_NO_SCANF (1 << 0)
@ -140,14 +143,15 @@ typedef enum {
} LineBreaks;
#define LB_NAMES (LB_MAC + 1)
struct WMenuBar;
extern const char VERTICAL_MAGIC[5];
/* if enable_show_tabs_tws ==1 then use visible_tab visible_tws */
extern int enable_show_tabs_tws;
int edit_drop_hotkey_menu (WEdit *e, int key);
void edit_menu_cmd (WEdit *e);
struct WMenu *edit_create_menu (void);
void edit_done_menu (struct WMenu *wmenu);
void edit_reload_menu (void);
void edit_init_menu (struct WMenuBar *menubar);
cb_ret_t edit_menu_execute (int command);
void menu_save_mode_cmd (void);
int edit_translate_key (WEdit *edit, long x_key, int *cmd, int *ch);
int edit_get_byte (WEdit * edit, long byte_index);
@ -299,8 +303,10 @@ extern int edit_stack_iterator;
extern edit_stack_type edit_history_moveto [MAX_HISTORY_MOVETO];
extern WEdit *wedit;
struct WMenu;
extern struct WMenu *edit_menubar;
extern struct WMenuBar *edit_menubar;
extern const global_keymap_t *editor_map;
extern const global_keymap_t *editor_x_map;
extern int option_line_state_width;

View File

@ -126,8 +126,6 @@ struct WEdit {
/* user map stuff */
GIConv converter;
const global_key_map_t *user_map;
const global_key_map_t *ext_map;
/* line break */
LineBreaks lb;

View File

@ -59,12 +59,7 @@
#include "../src/strutil.h" /* utf string functions */
#include "../src/charsets.h" /* get_codepage_id */
#include "../src/main.h" /* source_codepage */
/*
what editor are we going to emulate? one of EDIT_KEY_EMULATION_NORMAL
or EDIT_KEY_EMULATION_EMACS
*/
int edit_key_emulation = EDIT_KEY_EMULATION_NORMAL;
#include "../src/learn.h" /* learn_keys */
int option_word_wrap_line_length = 72;
int option_typewriter_wrap = 0;
@ -122,6 +117,8 @@ const char VERTICAL_MAGIC[] = {'\1', '\1', '\1', '\1', '\n'};
* fin.
*/
const global_keymap_t *editor_map;
const global_keymap_t *editor_x_map;
static void user_menu (WEdit *edit);
@ -722,9 +719,13 @@ edit_purge_widget (WEdit *edit)
static void
edit_set_keymap (WEdit *edit)
{
edit->user_map = default_editor_keymap;
editor_map = default_editor_keymap;
if (editor_keymap && editor_keymap->len > 0)
edit->user_map = (global_key_map_t *) editor_keymap->data;
editor_map = (global_keymap_t *) editor_keymap->data;
editor_x_map = default_editor_x_keymap;
if (editor_x_keymap && editor_x_keymap->len > 0)
editor_x_map = (global_keymap_t *) editor_x_keymap->data;
}
@ -2535,7 +2536,7 @@ void edit_execute_key_command (WEdit *edit, int command, int char_for_insertion)
edit->macro[edit->macro_i].command = command;
edit->macro[edit->macro_i++].ch = char_for_insertion;
}
/* record the beginning of a set of editing actions initiated by a key press */
/* record the beginning of a set of editing actions initiated by a key press */
if (command != CK_Undo && command != CK_Ext_Mode)
edit_push_key_press (edit);
@ -3030,6 +3031,10 @@ edit_execute_cmd (WEdit *edit, int command, int char_for_insertion)
case CK_Load_Syntax_File:
edit_load_cmd (edit, EDIT_FILE_SYNTAX);
break;
case CK_Choose_Syntax:
edit_syntax_dialog ();
break;
case CK_Load_Menu_File:
edit_load_cmd (edit, EDIT_FILE_MENU);
break;
@ -3068,23 +3073,40 @@ edit_execute_cmd (WEdit *edit, int command, int char_for_insertion)
case CK_Find_Definition:
edit_get_match_keyword_cmd (edit);
break;
case CK_Exit:
case CK_Quit:
dlg_stop (edit->widget.parent);
break;
case CK_New:
edit_new_cmd (edit);
break;
case CK_Help:
edit_help_cmd (edit);
break;
case CK_Refresh:
edit_refresh_cmd (edit);
break;
case CK_Date:{
case CK_SaveSetupCmd:
save_setup_cmd ();
break;
case CK_About:
query_dialog (_(" About "),
_("\n Cooledit v3.11.5\n\n"
" Copyright (C) 1996 the Free Software Foundation\n\n"
" A user friendly text editor written\n"
" for the Midnight Commander.\n"), D_NORMAL,
1, _("&OK"));
break;
case CK_LearnKeys:
learn_keys ();
break;
case CK_Edit_Options:
edit_options_dialog ();
break;
case CK_Edit_Save_Mode:
menu_save_mode_cmd ();
case CK_Date:
break;
{
char s[1024];
/* fool gcc to prevent a Y2K warning */
char time_format[] = "_c";

View File

@ -39,10 +39,6 @@
struct WEdit;
typedef struct WEdit WEdit;
#define EDIT_KEY_EMULATION_NORMAL 0
#define EDIT_KEY_EMULATION_EMACS 1
#define EDIT_KEY_EMULATION_USER 2
extern int option_word_wrap_line_length;
extern int option_typewriter_wrap;
extern int option_auto_para_formatting;
@ -58,9 +54,6 @@ extern int option_save_position;
extern int option_syntax_highlighting;
extern char *option_backup_ext;
/* what editor are we going to emulate? */
extern int edit_key_emulation;
extern int edit_confirm_save;
extern int visible_tabs;

View File

@ -63,11 +63,10 @@ edit_translate_key (WEdit *edit, long x_key, int *cmd, int *ch)
int command = CK_Insert_Char;
int char_for_insertion = -1;
int i = 0;
int extmod = 0;
int c;
/* an ordinary insertable character */
if (x_key < 256 && !extmod) {
if (x_key < 256) {
#ifdef HAVE_CHARSET
if ( edit->charpoint >= 4 ) {
edit->charpoint = 0;
@ -82,7 +81,7 @@ edit_translate_key (WEdit *edit, long x_key, int *cmd, int *ch)
if ( !utf8_display ) {
/* source in 8-bit codeset */
if (!edit->utf8) {
#endif
#endif /* HAVE_CHARSET */
c = convert_from_input_c (x_key);
if (is_printable (c)) {
char_for_insertion = c;
@ -141,25 +140,29 @@ edit_translate_key (WEdit *edit, long x_key, int *cmd, int *ch)
}
}
}
#endif
#endif /* HAVE_CHARSET */
}
/* Commands specific to the key emulation */
for (i = 0; edit->user_map[i].key != 0; i++) {
if (x_key == edit->user_map[i].key) {
command = edit->user_map[i].command;
if (edit->extmod) {
edit->extmod = 0;
for (i = 0; editor_x_map[i].key; i++) {
if (x_key == editor_x_map[i].key) {
command = editor_x_map[i].command;
break;
}
}
} else {
for (i = 0; editor_map[i].key != 0; i++) {
if (x_key == editor_map[i].key) {
command = editor_map[i].command;
break;
}
}
}
fin:
*cmd = command;
*ch = char_for_insertion;
if (command == CK_Insert_Char && char_for_insertion == -1) {
/* unchanged, key has no function here */
return 0;
}
return 1;
return (command == CK_Insert_Char && char_for_insertion == -1) ? 0 : 1;
}

View File

@ -41,612 +41,183 @@
#include "../src/global.h"
#include "edit-impl.h"
#include "edit-widget.h"
#include "../src/tty/tty.h" /* KEY_F */
#include "../src/tty/key.h" /* XCTRL */
#include "../src/cmd.h" /* save_setup_cmd() */
#include "../src/wtools.h" /* query_dialog() */
#include "../src/menu.h" /* menu_entry */
#include "../src/main.h" /* drop_menus */
#include "../src/learn.h" /* learn_keys */
#include "edit-widget.h"
#include "../src/dialog.h" /* cb_ret_t */
#include "../src/cmddef.h"
static void
menu_cmd (int command)
#include "edit-impl.h"
#include "edit-widget.h"
cb_ret_t
edit_menu_execute (int command)
{
edit_execute_key_command (wedit, command, -1);
edit_update_screen (wedit);
return MSG_HANDLED;
}
static void menu_key (int i)
static GList *
create_file_menu (void)
{
send_message ((Widget *) wedit, WIDGET_KEY, i);
GList *entries = NULL;
entries = g_list_append (entries, menu_entry_create (_("&Open file..."), CK_Load));
entries = g_list_append (entries, menu_entry_create (_("&New"), CK_New));
entries = g_list_append (entries, menu_separator_create ());
entries = g_list_append (entries, menu_entry_create (_("&Save"), CK_Save));
entries = g_list_append (entries, menu_entry_create (_("Save &as..."), CK_Save_As));
entries = g_list_append (entries, menu_separator_create ());
entries = g_list_append (entries, menu_entry_create (_("&Insert file..."), CK_Insert_File));
entries = g_list_append (entries, menu_entry_create (_("Cop&y to file..."), CK_Save_Block));
entries = g_list_append (entries, menu_separator_create ());
entries = g_list_append (entries, menu_entry_create (_("&User menu..."), CK_User_Menu));
entries = g_list_append (entries, menu_separator_create ());
entries = g_list_append (entries, menu_entry_create (_("A&bout..."), CK_About));
entries = g_list_append (entries, menu_separator_create ());
entries = g_list_append (entries, menu_entry_create (_("&Quit"), CK_Quit));
return entries;
}
static void
edit_about_cmd (void)
static GList *
create_edit_menu (void)
{
query_dialog (_(" About "),
_("\n Cooledit v3.11.5\n\n"
" Copyright (C) 1996 the Free Software Foundation\n\n"
" A user friendly text editor written\n"
" for the Midnight Commander.\n"), D_NORMAL,
1, _("&OK"));
GList *entries = NULL;
entries = g_list_append (entries, menu_entry_create (_("&Toggle mark"), CK_Mark));
entries = g_list_append (entries, menu_entry_create (_("&Mark columns"), CK_Column_Mark));
entries = g_list_append (entries, menu_separator_create ());
entries = g_list_append (entries, menu_entry_create (_("Toggle &ins/overw"), CK_Toggle_Insert));
entries = g_list_append (entries, menu_separator_create ());
entries = g_list_append (entries, menu_entry_create (_("&Copy"), CK_Copy));
entries = g_list_append (entries, menu_entry_create (_("&Move"), CK_Move));
entries = g_list_append (entries, menu_entry_create (_("&Delete"), CK_Remove));
entries = g_list_append (entries, menu_separator_create ());
entries = g_list_append (entries, menu_entry_create (_("C&opy to clipfile"), CK_XStore));
entries = g_list_append (entries, menu_entry_create (_("C&ut to clipfile"), CK_XCut));
entries = g_list_append (entries, menu_entry_create (_("&Paste from clipfile"), CK_XPaste));
entries = g_list_append (entries, menu_separator_create ());
entries = g_list_append (entries, menu_entry_create (_("Toggle bookmar&k"), CK_Toggle_Bookmark));
entries = g_list_append (entries, menu_entry_create (_("&Next bookmark"), CK_Next_Bookmark));
entries = g_list_append (entries, menu_entry_create (_("Pre&v bookmark"), CK_Prev_Bookmark));
entries = g_list_append (entries, menu_entry_create (_("&Flush bookmark"), CK_Flush_Bookmarks));
entries = g_list_append (entries, menu_separator_create ());
entries = g_list_append (entries, menu_entry_create (_("&Undo"), CK_Undo));
entries = g_list_append (entries, menu_separator_create ());
entries = g_list_append (entries, menu_entry_create (_("&Beginning"), CK_Beginning_Of_Text));
entries = g_list_append (entries, menu_entry_create (_("&End"), CK_End_Of_Text));
return entries;
}
static void
menu_mail_cmd (void)
static GList *
create_search_replace_menu (void)
{
menu_cmd (CK_Mail);
GList *entries = NULL;
entries = g_list_append (entries, menu_entry_create (_("&Search..."), CK_Find));
entries = g_list_append (entries, menu_entry_create (_("Search &again"), CK_Find_Again));
entries = g_list_append (entries, menu_entry_create (_("&Replace..."), CK_Replace));
return entries;
}
static void
menu_load_cmd (void)
static GList *
create_command_menu (void)
{
menu_cmd (CK_Load);
}
GList *entries = NULL;
static void
menu_new_cmd (void)
{
menu_cmd (CK_New);
}
static void
menu_save_cmd (void)
{
menu_cmd (CK_Save);
}
static void
menu_save_as_cmd (void)
{
menu_cmd (CK_Save_As);
}
static void
menu_insert_file_cmd (void)
{
menu_cmd (CK_Insert_File);
}
static void
menu_quit_cmd (void)
{
menu_cmd (CK_Exit);
}
static void
menu_mark_cmd (void)
{
menu_cmd (CK_Mark);
}
static void
menu_markcol_cmd (void)
{
menu_cmd (CK_Column_Mark);
}
static void
menu_ins_cmd (void)
{
menu_cmd (CK_Toggle_Insert);
}
static void
menu_copy_cmd (void)
{
menu_cmd (CK_Copy);
}
static void
menu_move_cmd (void)
{
menu_cmd (CK_Move);
}
static void
menu_delete_cmd (void)
{
menu_cmd (CK_Remove);
}
static void
menu_xstore_cmd (void)
{
menu_cmd (CK_XStore);
}
static void
menu_xcut_cmd (void)
{
menu_cmd (CK_XCut);
}
static void
menu_xpaste_cmd (void)
{
menu_cmd (CK_XPaste);
}
static void
menu_toggle_bookmark_cmd (void)
{
menu_cmd (CK_Toggle_Bookmark);
}
static void
menu_flush_bookmark_cmd (void)
{
menu_cmd (CK_Flush_Bookmarks);
}
static void
menu_next_bookmark_cmd (void)
{
menu_cmd (CK_Next_Bookmark);
}
static void
menu_prev_bookmark_cmd (void)
{
menu_cmd (CK_Prev_Bookmark);
}
static void
menu_cut_cmd (void)
{
menu_cmd (CK_Save_Block);
}
static void
menu_search_cmd (void)
{
menu_cmd (CK_Find);
}
static void
menu_search_again_cmd (void)
{
menu_cmd (CK_Find_Again);
}
static void
menu_replace_cmd (void)
{
menu_cmd (CK_Replace);
}
static void
menu_select_codepage_cmd (void)
{
menu_cmd (CK_SelectCodepage);
}
static void
menu_begin_record_cmd (void)
{
menu_cmd (CK_Begin_Record_Macro);
}
static void
menu_end_record_cmd (void)
{
menu_cmd (CK_End_Record_Macro);
}
static void
menu_exec_macro_cmd (void)
{
menu_key (XCTRL ('a'));
}
static void
menu_exec_macro_delete_cmd (void)
{
menu_cmd (CK_Delete_Macro);
}
static void
menu_c_form_cmd (void)
{
menu_key (KEY_F (19));
}
static void
menu_ispell_cmd (void)
{
menu_cmd (CK_Pipe_Block (1));
}
static void
menu_sort_cmd (void)
{
menu_cmd (CK_Sort);
}
static void
menu_ext_cmd (void)
{
menu_cmd (CK_ExtCmd);
}
static void
menu_date_cmd (void)
{
menu_cmd (CK_Date);
}
static void
menu_undo_cmd (void)
{
menu_cmd (CK_Undo);
}
static void
menu_beginning_cmd (void)
{
menu_cmd (CK_Beginning_Of_Text);
}
static void
menu_end_cmd (void)
{
menu_cmd (CK_End_Of_Text);
}
static void
menu_refresh_cmd (void)
{
menu_cmd (CK_Refresh);
}
static void
menu_goto_line (void)
{
menu_cmd (CK_Goto);
}
static void
menu_toggle_line_state (void)
{
menu_cmd (CK_Toggle_Line_State);
}
static void
menu_goto_bracket (void)
{
menu_cmd (CK_Match_Bracket);
}
static void
menu_lit_cmd (void)
{
menu_key (XCTRL ('q'));
}
static void
menu_format_paragraph (void)
{
menu_cmd (CK_Paragraph_Format);
}
static void
menu_edit_syntax_file_cmd (void)
{
menu_cmd (CK_Load_Syntax_File);
}
static void
menu_edit_menu_file_cmd (void)
{
menu_cmd (CK_Load_Menu_File);
}
static void
menu_user_menu_cmd (void)
{
menu_key (KEY_F (11));
}
static void
menu_find_declare (void)
{
menu_cmd (CK_Find_Definition);
}
static void
menu_declare_back (void)
{
menu_cmd (CK_Load_Prev_File);
}
static void
menu_declare_forward (void)
{
menu_cmd (CK_Load_Next_File);
}
static menu_entry FileMenu[] =
{
{' ', N_("&Open file..."), NULL_HOTKEY, menu_load_cmd},
{' ', N_("&New C-n"), NULL_HOTKEY, menu_new_cmd},
{' ', "", NULL_HOTKEY, 0},
{' ', N_("&Save F2"), NULL_HOTKEY, menu_save_cmd},
{' ', N_("Save &as... F12"), NULL_HOTKEY, menu_save_as_cmd},
{' ', "", NULL_HOTKEY, 0},
{' ', N_("&Insert file... F15"), NULL_HOTKEY, menu_insert_file_cmd},
{' ', N_("Copy to &file... C-f"), NULL_HOTKEY, menu_cut_cmd},
{' ', "", NULL_HOTKEY, 0},
{' ', N_("&User menu... F11"), NULL_HOTKEY, menu_user_menu_cmd},
{' ', "", NULL_HOTKEY, 0},
{' ', N_("A&bout... "), NULL_HOTKEY, edit_about_cmd},
{' ', "", NULL_HOTKEY, 0},
{' ', N_("&Quit F10"), NULL_HOTKEY, menu_quit_cmd}
};
static menu_entry FileMenuEmacs[] =
{
{' ', N_("&Open file..."), NULL_HOTKEY, menu_load_cmd},
{' ', N_("&New C-x k"), NULL_HOTKEY, menu_new_cmd},
{' ', "", NULL_HOTKEY, 0},
{' ', N_("&Save F2"), NULL_HOTKEY, menu_save_cmd},
{' ', N_("Save &as... F12"), NULL_HOTKEY, menu_save_as_cmd},
{' ', "", NULL_HOTKEY, 0},
{' ', N_("&Insert file... F15"), NULL_HOTKEY, menu_insert_file_cmd},
{' ', N_("Copy to &file... "), NULL_HOTKEY, menu_cut_cmd},
{' ', "", NULL_HOTKEY, 0},
{' ', N_("&User menu... F11"), NULL_HOTKEY, menu_user_menu_cmd},
{' ', "", NULL_HOTKEY, 0},
{' ', N_("A&bout... "), NULL_HOTKEY, edit_about_cmd},
{' ', "", NULL_HOTKEY, 0},
{' ', N_("&Quit F10"), NULL_HOTKEY, menu_quit_cmd}
};
static menu_entry EditMenu[] =
{
{' ', N_("&Toggle mark F3"), NULL_HOTKEY, menu_mark_cmd},
{' ', N_("Mar&k columns S-F3"), NULL_HOTKEY, menu_markcol_cmd},
{' ', "", NULL_HOTKEY, 0},
{' ', N_("Toggle &ins/overw Ins"), NULL_HOTKEY, menu_ins_cmd},
{' ', "", NULL_HOTKEY, 0},
{' ', N_("&Copy F5"), NULL_HOTKEY, menu_copy_cmd},
{' ', N_("&Move F6"), NULL_HOTKEY, menu_move_cmd},
{' ', N_("&Delete F8"), NULL_HOTKEY, menu_delete_cmd},
{' ', "", NULL_HOTKEY, 0},
{' ', N_("C&opy to clipfile C-Ins"), NULL_HOTKEY, menu_xstore_cmd},
{' ', N_("C&ut to clipfile S-Del"), NULL_HOTKEY, menu_xcut_cmd},
{' ', N_("&Paste from clipfile S-Ins"), NULL_HOTKEY, menu_xpaste_cmd},
{' ', "", NULL_HOTKEY, 0},
{' ', N_("Toggle bookmar&k M-k"), NULL_HOTKEY, menu_toggle_bookmark_cmd},
{' ', N_("&Next bookmark M-j"), NULL_HOTKEY, menu_next_bookmark_cmd},
{' ', N_("Pre&v bookmark M-i"), NULL_HOTKEY, menu_prev_bookmark_cmd},
{' ', N_("&Flush bookmark M-o"), NULL_HOTKEY, menu_flush_bookmark_cmd},
{' ', "", NULL_HOTKEY, 0},
{' ', N_("&Undo C-u"), NULL_HOTKEY, menu_undo_cmd},
{' ', "", NULL_HOTKEY, 0},
{' ', N_("&Beginning C-PgUp"), NULL_HOTKEY, menu_beginning_cmd},
{' ', N_("&End C-PgDn"), NULL_HOTKEY, menu_end_cmd}
};
static menu_entry EditMenuEmacs[] =
{
{' ', N_("&Toggle mark F3"), NULL_HOTKEY, menu_mark_cmd},
{' ', N_("Mar&k columns S-F3"), NULL_HOTKEY, menu_markcol_cmd},
{' ', "", NULL_HOTKEY, 0},
{' ', N_("Toggle &ins/overw Ins"), NULL_HOTKEY, menu_ins_cmd},
{' ', "", NULL_HOTKEY, 0},
{' ', N_("&Copy F5"), NULL_HOTKEY, menu_copy_cmd},
{' ', N_("&Move F6"), NULL_HOTKEY, menu_move_cmd},
{' ', N_("&Delete F8"), NULL_HOTKEY, menu_delete_cmd},
{' ', "", NULL_HOTKEY, 0},
{' ', N_("C&opy to clipfile M-w"), NULL_HOTKEY, menu_xstore_cmd},
{' ', N_("C&ut to clipfile C-w"), NULL_HOTKEY, menu_xcut_cmd},
{' ', N_("&Paste from clipfile C-y"), NULL_HOTKEY, menu_xpaste_cmd},
{' ', "", NULL_HOTKEY, 0},
{' ', N_("Toggle bookmar&k "), NULL_HOTKEY, menu_toggle_bookmark_cmd},
{' ', N_("&Next bookmark "), NULL_HOTKEY, menu_next_bookmark_cmd},
{' ', N_("Pre&v bookmark "), NULL_HOTKEY, menu_prev_bookmark_cmd},
{' ', N_("&Flush bookmark "), NULL_HOTKEY, menu_flush_bookmark_cmd},
{' ', "", NULL_HOTKEY, 0},
{' ', N_("&Undo C-u"), NULL_HOTKEY, menu_undo_cmd},
{' ', "", NULL_HOTKEY, 0},
{' ', N_("&Beginning C-PgUp"), NULL_HOTKEY, menu_beginning_cmd},
{' ', N_("&End C-PgDn"), NULL_HOTKEY, menu_end_cmd}
};
static menu_entry SearReplMenu[] =
{
{' ', N_("&Search... F7"), NULL_HOTKEY, menu_search_cmd},
{' ', N_("Search &again F17"), NULL_HOTKEY, menu_search_again_cmd},
{' ', N_("&Replace... F4"), NULL_HOTKEY, menu_replace_cmd}
};
#define SearReplMenuEmacs SearReplMenu
static menu_entry CmdMenu[] =
{
{' ', N_("&Go to line... M-l"), NULL_HOTKEY, menu_goto_line},
{' ', N_("Toggle li&ne state M-n"), NULL_HOTKEY, menu_toggle_line_state},
{' ', N_("Go to matching &bracket M-b"), NULL_HOTKEY, menu_goto_bracket},
{' ', "", NULL_HOTKEY, 0},
{' ', N_("Find declaration A-Enter"), NULL_HOTKEY, menu_find_declare},
{' ', N_("Back from declaration M--"), NULL_HOTKEY, menu_declare_back},
{' ', N_("Forward to declaration M-+"), NULL_HOTKEY, menu_declare_forward},
entries = g_list_append (entries, menu_entry_create (_("&Go to line..."), CK_Goto));
entries = g_list_append (entries, menu_entry_create (_("Toggle li&ne state"), CK_Toggle_Line_State));
entries = g_list_append (entries, menu_entry_create (_("Go to matching &bracket"), CK_Match_Bracket));
entries = g_list_append (entries, menu_separator_create ());
entries = g_list_append (entries, menu_entry_create (_("Find declaration"), CK_Find_Definition));
entries = g_list_append (entries, menu_entry_create (_("Back from declaration"), CK_Load_Prev_File));
entries = g_list_append (entries, menu_entry_create (_("Forward to declaration"), CK_Load_Next_File));
#ifdef HAVE_CHARSET
{' ', "", NULL_HOTKEY, 0},
{' ', N_("Encod&ing... M-e"), NULL_HOTKEY, menu_select_codepage_cmd},
entries = g_list_append (entries, menu_separator_create ());
entries = g_list_append (entries, menu_entry_create (_("Encod&ing..."), CK_SelectCodepage));
#endif
{' ', "", NULL_HOTKEY, 0},
{' ', N_("Insert &literal... C-q"), NULL_HOTKEY, menu_lit_cmd},
{' ', "", NULL_HOTKEY, 0},
{' ', N_("&Refresh screen C-l"), NULL_HOTKEY, menu_refresh_cmd},
{' ', "", NULL_HOTKEY, 0},
{' ', N_("&Start record macro C-r"), NULL_HOTKEY, menu_begin_record_cmd},
{' ', N_("&Finish record macro... C-r"), NULL_HOTKEY, menu_end_record_cmd},
{' ', N_("&Execute macro... C-a, KEY"), NULL_HOTKEY, menu_exec_macro_cmd},
{' ', N_("Delete macr&o... "), NULL_HOTKEY, menu_exec_macro_delete_cmd},
{' ', "", NULL_HOTKEY, 0},
{' ', N_("Insert &date/time "), NULL_HOTKEY, menu_date_cmd},
{' ', "", NULL_HOTKEY, 0},
{' ', N_("Format p&aragraph M-p"), NULL_HOTKEY, menu_format_paragraph},
{' ', N_("'ispell' s&pell check C-p"), NULL_HOTKEY, menu_ispell_cmd},
{' ', N_("Sor&t... M-t"), NULL_HOTKEY, menu_sort_cmd},
{' ', N_("Paste o&utput of... M-u"), NULL_HOTKEY, menu_ext_cmd},
{' ', N_("E&xternal Formatter F19"), NULL_HOTKEY, menu_c_form_cmd},
{' ', N_("&Mail... "), NULL_HOTKEY, menu_mail_cmd}
};
entries = g_list_append (entries, menu_separator_create ());
entries = g_list_append (entries, menu_entry_create (_("Insert &literal..."), CK_Insert_Literal));
entries = g_list_append (entries, menu_separator_create ());
entries = g_list_append (entries, menu_entry_create (_("&Refresh screen"), CK_Refresh));
entries = g_list_append (entries, menu_separator_create ());
entries = g_list_append (entries, menu_entry_create (_("&Start record macro"), CK_Begin_Record_Macro));
entries = g_list_append (entries, menu_entry_create (_("&Finish record macro..."), CK_End_Record_Macro));
entries = g_list_append (entries, menu_entry_create (_("&Execute macro..."), CK_Execute_Macro));
entries = g_list_append (entries, menu_entry_create (_("Delete macr&o..."), CK_Delete_Macro));
entries = g_list_append (entries, menu_separator_create ());
entries = g_list_append (entries, menu_entry_create (_("Insert &date/time"), CK_Date));
entries = g_list_append (entries, menu_separator_create ());
entries = g_list_append (entries, menu_entry_create (_("Format p&aragraph"), CK_Paragraph_Format));
entries = g_list_append (entries, menu_entry_create (_("'ispell' s&pell check"), CK_Pipe_Block (1)));
entries = g_list_append (entries, menu_entry_create (_("Sor&t..."), CK_Sort));
entries = g_list_append (entries, menu_entry_create (_("Paste o&utput of..."), CK_ExtCmd));
entries = g_list_append (entries, menu_entry_create (_("E&xternal formatter"), CK_Pipe_Block (0)));
entries = g_list_append (entries, menu_entry_create (_("&Mail..."), CK_Mail));
static menu_entry CmdMenuEmacs[] =
{
{' ', N_("&Go to line... M-l"), NULL_HOTKEY, menu_goto_line},
{' ', N_("Toggle li&ne state M-n"), NULL_HOTKEY, menu_toggle_line_state},
{' ', N_("Go to matching &bracket M-b"), NULL_HOTKEY, menu_goto_bracket},
{' ', "", NULL_HOTKEY, 0},
{' ', N_("Insert &literal... C-q"), NULL_HOTKEY, menu_lit_cmd},
{' ', "", NULL_HOTKEY, 0},
{' ', N_("&Refresh screen C-l"), NULL_HOTKEY, menu_refresh_cmd},
{' ', "", NULL_HOTKEY, 0},
{' ', N_("&Start record macro C-r"), NULL_HOTKEY, menu_begin_record_cmd},
{' ', N_("&Finish record macro... C-r"), NULL_HOTKEY, menu_end_record_cmd},
{' ', N_("&Execute macro... C-x e, KEY"), NULL_HOTKEY, menu_exec_macro_cmd},
{' ', N_("Delete macr&o... "), NULL_HOTKEY, menu_exec_macro_delete_cmd},
{' ', "", NULL_HOTKEY, 0},
{' ', N_("Insert &date/time "), NULL_HOTKEY, menu_date_cmd},
{' ', "", NULL_HOTKEY, 0},
{' ', N_("Format p&aragraph M-p"), NULL_HOTKEY, menu_format_paragraph},
{' ', N_("'ispell' s&pell check M-$"), NULL_HOTKEY, menu_ispell_cmd},
{' ', N_("Sor&t... M-t"), NULL_HOTKEY, menu_sort_cmd},
{' ', N_("Paste o&utput of... M-u"), NULL_HOTKEY, menu_ext_cmd},
{' ', N_("E&xternal Formatter F19"), NULL_HOTKEY, menu_c_form_cmd},
{' ', N_("&Mail... "), NULL_HOTKEY, menu_mail_cmd}
};
static menu_entry OptMenu[] =
{
{' ', N_("&General... "), NULL_HOTKEY, edit_options_dialog},
{' ', N_("&Save mode..."), NULL_HOTKEY, menu_save_mode_cmd},
{' ', N_("Learn &Keys..."), NULL_HOTKEY, learn_keys},
{' ', N_("Syntax &Highlighting..."), NULL_HOTKEY, edit_syntax_dialog},
{' ', "", NULL_HOTKEY, 0},
{' ', N_("S&yntax file"), NULL_HOTKEY, menu_edit_syntax_file_cmd},
{' ', N_("&Menu file"), NULL_HOTKEY, menu_edit_menu_file_cmd},
{' ', "", NULL_HOTKEY, 0},
{' ', N_("Save setu&p"), NULL_HOTKEY, save_setup_cmd}
};
#define OptMenuEmacs OptMenu
#define menu_entries(x) sizeof(x)/sizeof(menu_entry)
#define N_menus 5
static Menu *EditMenuBar [N_menus];
static void
edit_init_menu_normal (void)
{
EditMenuBar[0] = create_menu (_(" File "), FileMenu, menu_entries (FileMenu),
"[Internal File Editor]");
EditMenuBar[1] = create_menu (_(" Edit "), EditMenu, menu_entries (EditMenu),
"[Internal File Editor]");
EditMenuBar[2] = create_menu (_(" Sear/Repl "), SearReplMenu, menu_entries (SearReplMenu),
"[Internal File Editor]");
EditMenuBar[3] = create_menu (_(" Command "), CmdMenu, menu_entries (CmdMenu),
"[Internal File Editor]");
EditMenuBar[4] = create_menu (_(" Options "), OptMenu, menu_entries (OptMenu),
"[Internal File Editor]");
return entries;
}
static void
edit_init_menu_emacs (void)
static GList *
create_options_menu (void)
{
EditMenuBar[0] = create_menu (_(" File "), FileMenuEmacs, menu_entries (FileMenuEmacs),
"[Internal File Editor]");
EditMenuBar[1] = create_menu (_(" Edit "), EditMenuEmacs, menu_entries (EditMenuEmacs),
"[Internal File Editor]");
EditMenuBar[2] = create_menu (_(" Sear/Repl "), SearReplMenuEmacs, menu_entries (SearReplMenuEmacs),
"[Internal File Editor]");
EditMenuBar[3] = create_menu (_(" Command "), CmdMenuEmacs, menu_entries (CmdMenuEmacs),
"[Internal File Editor]");
EditMenuBar[4] = create_menu (_(" Options "), OptMenuEmacs, menu_entries (OptMenuEmacs),
"[Internal File Editor]");
}
GList *entries = NULL;
static void
edit_init_menu (void)
{
switch (edit_key_emulation) {
default:
case EDIT_KEY_EMULATION_NORMAL:
edit_init_menu_normal ();
break;
case EDIT_KEY_EMULATION_EMACS:
edit_init_menu_emacs ();
break;
}
}
entries = g_list_append (entries, menu_entry_create (_("&General... "), CK_Edit_Options));
entries = g_list_append (entries, menu_entry_create (_("Save &mode..."), CK_Edit_Save_Mode));
entries = g_list_append (entries, menu_entry_create (_("Learn &keys..."), CK_LearnKeys));
entries = g_list_append (entries, menu_entry_create (_("Syntax &highlighting..."), CK_Choose_Syntax));
entries = g_list_append (entries, menu_separator_create ());
entries = g_list_append (entries, menu_entry_create (_("S&yntax file"), CK_Load_Syntax_File));
entries = g_list_append (entries, menu_entry_create (_("&Menu file"), CK_Load_Menu_File));
entries = g_list_append (entries, menu_separator_create ());
entries = g_list_append (entries, menu_entry_create (_("&Save setup"), CK_SaveSetupCmd));
struct WMenu *
edit_create_menu (void)
{
edit_init_menu ();
return menubar_new (0, 0, COLS, EditMenuBar, N_menus);
return entries;
}
void
edit_done_menu (struct WMenu *wmenu)
edit_init_menu (struct WMenuBar *menubar)
{
int i;
for (i = 0; i < N_menus; i++)
destroy_menu (wmenu->menu[i]);
menubar_add_menu (menubar, create_menu (_("&File"), create_file_menu (), "[Internal File Editor]"));
menubar_add_menu (menubar, create_menu (_("&Edit"), create_edit_menu (), "[Internal File Editor]"));
menubar_add_menu (menubar, create_menu (_("&Search"), create_search_replace_menu (), "[Internal File Editor]"));
menubar_add_menu (menubar, create_menu (_("&Command"), create_command_menu (), "[Internal File Editor]"));
menubar_add_menu (menubar, create_menu (_("&Options"), create_options_menu (), "[Internal File Editor]"));
}
void
edit_reload_menu (void)
{
edit_done_menu (edit_menubar);
edit_init_menu ();
menubar_arrange (edit_menubar);
}
static void
edit_drop_menu_cmd (WEdit *e, int which)
{
if (edit_menubar->active)
return;
edit_menubar->active = 1;
edit_menubar->dropped = drop_menus;
if (which >= 0) {
edit_menubar->selected = which;
}
if (!edit_menubar->is_active) {
edit_menubar->is_active = TRUE;
edit_menubar->is_dropped = (drop_menus != 0);
if (which >= 0)
edit_menubar->selected = which;
edit_menubar->previous_widget = e->widget.parent->current->dlg_id;
dlg_select_widget (edit_menubar);
edit_menubar->previous_widget = e->widget.parent->current->dlg_id;
dlg_select_widget (edit_menubar);
}
}
void edit_menu_cmd (WEdit * e)
void
edit_menu_cmd (WEdit *e)
{
edit_drop_menu_cmd (e, -1);
}
int edit_drop_hotkey_menu (WEdit * e, int key)
int
edit_drop_hotkey_menu (WEdit *e, int key)
{
int m = 0;
switch (key) {
case ALT ('f'):
if (edit_key_emulation == EDIT_KEY_EMULATION_EMACS)
return 0;
m = 0;
break;
case ALT ('e'):

View File

@ -38,16 +38,8 @@
#include "../src/wtools.h" /* QuickDialog */
#include "../src/main.h" /* option_tab_spacing */
#define OPT_DLG_H 21
#define OPT_DLG_W 72
static const char *key_emu_str[] =
{
N_("Intuitive"),
N_("Emacs"),
N_("User-defined"),
NULL
};
#define OPT_DLG_H 16
#define OPT_DLG_W 74
static const char *wrap_str[] =
{
@ -72,44 +64,42 @@ edit_options_dialog (void)
char wrap_length[16], tab_spacing[16], *p, *q;
int wrap_mode = 0;
int old_syntax_hl;
int tedit_key_emulation = edit_key_emulation;
QuickWidget quick_widgets[] =
{
/* 0 */ QUICK_BUTTON (6, 10, OPT_DLG_H - 3, OPT_DLG_H, N_("&Cancel"), B_CANCEL, NULL),
/* 1 */ QUICK_BUTTON (2, 10, OPT_DLG_H - 3, OPT_DLG_H, N_("&OK"), B_ENTER, NULL),
/* 2 */ QUICK_LABEL (OPT_DLG_W / 2, OPT_DLG_W, OPT_DLG_H - 6, OPT_DLG_H, N_("Word wrap line length: ")),
/* 3 */ QUICK_INPUT (OPT_DLG_W / 2 + 24, OPT_DLG_W, OPT_DLG_H - 6, OPT_DLG_H,
/* 2 */ QUICK_LABEL (OPT_DLG_W / 2 + 1, OPT_DLG_W, 11, OPT_DLG_H,
N_("Word wrap line length: ")),
/* 3 */ QUICK_INPUT (OPT_DLG_W / 2 + 25, OPT_DLG_W, 11, OPT_DLG_H,
wrap_length, OPT_DLG_W / 2 - 4 - 24, 0, "edit-word-wrap", &p),
/* 4 */ QUICK_LABEL (OPT_DLG_W / 2, OPT_DLG_W, OPT_DLG_H - 7, OPT_DLG_H, N_("Tab spacing: ")),
/* 5 */ QUICK_INPUT (OPT_DLG_W / 2 + 24, OPT_DLG_W, OPT_DLG_H - 7, OPT_DLG_H,
tab_spacing, OPT_DLG_W / 2 - 4 - 24, 0, "edit-tab-spacing", &q),
/* 6 */ QUICK_CHECKBOX (OPT_DLG_W / 2 + 1, OPT_DLG_W, OPT_DLG_H - 8, OPT_DLG_H,
/* 4 */ QUICK_CHECKBOX (OPT_DLG_W / 2 + 1, OPT_DLG_W, 10, OPT_DLG_H,
N_("Cursor beyond end of line"), &option_cursor_beyond_eol),
/* 7 */ QUICK_CHECKBOX (OPT_DLG_W / 2 + 1, OPT_DLG_W, OPT_DLG_H - 9, OPT_DLG_H,
/* 5 */ QUICK_CHECKBOX (OPT_DLG_W / 2 + 1, OPT_DLG_W, 9, OPT_DLG_H,
N_("Pers&istent selection"), &option_persistent_selections),
/* 8 */ QUICK_CHECKBOX (OPT_DLG_W / 2 + 1, OPT_DLG_W, OPT_DLG_H - 10, OPT_DLG_H,
/* 6 */ QUICK_CHECKBOX (OPT_DLG_W / 2 + 1, OPT_DLG_W, 8, OPT_DLG_H,
N_("Synta&x highlighting"), &option_syntax_highlighting),
/* 9 */ QUICK_CHECKBOX (OPT_DLG_W / 2 + 1, OPT_DLG_W, OPT_DLG_H - 11, OPT_DLG_H,
/* 7 */ QUICK_CHECKBOX (OPT_DLG_W / 2 + 1, OPT_DLG_W, 7, OPT_DLG_H,
N_("Visible tabs"), &visible_tabs),
/* 10 */ QUICK_CHECKBOX (OPT_DLG_W / 2 + 1, OPT_DLG_W, OPT_DLG_H - 12, OPT_DLG_H,
/* 8 */ QUICK_CHECKBOX (OPT_DLG_W / 2 + 1, OPT_DLG_W, 6, OPT_DLG_H,
N_("Visible trailing spaces"), &visible_tws),
/* 11 */ QUICK_CHECKBOX (OPT_DLG_W / 2 + 1, OPT_DLG_W, OPT_DLG_H - 13, OPT_DLG_H,
/* 9 */ QUICK_CHECKBOX (OPT_DLG_W / 2 + 1, OPT_DLG_W, 5, OPT_DLG_H,
N_("Save file &position"), &option_save_position),
/* 12 */ QUICK_CHECKBOX (OPT_DLG_W / 2 + 1, OPT_DLG_W, OPT_DLG_H - 14, OPT_DLG_H,
/* 10 */ QUICK_CHECKBOX (OPT_DLG_W / 2 + 1, OPT_DLG_W, 4, OPT_DLG_H,
N_("Confir&m before saving"), &edit_confirm_save),
/* 13 */ QUICK_CHECKBOX (OPT_DLG_W / 2 + 1, OPT_DLG_W, OPT_DLG_H - 15, OPT_DLG_H,
N_("Fill tabs with &spaces"), &option_fill_tabs_with_spaces),
/* 14 */ QUICK_CHECKBOX (OPT_DLG_W / 2 + 1, OPT_DLG_W, OPT_DLG_H - 16, OPT_DLG_H,
/* 11 */ QUICK_CHECKBOX (OPT_DLG_W / 2 + 1, OPT_DLG_W, 3, OPT_DLG_H,
N_("&Return does autoindent"), &option_return_does_auto_indent),
/* 15 */ QUICK_CHECKBOX (OPT_DLG_W / 2 + 1, OPT_DLG_W, OPT_DLG_H - 17, OPT_DLG_H,
/* 12 */ QUICK_LABEL (3, OPT_DLG_W, 11, OPT_DLG_H, N_("Tab spacing: ")),
/* 13 */ QUICK_INPUT (3 + 24, OPT_DLG_W, 11, OPT_DLG_H,
tab_spacing, OPT_DLG_W / 2 - 4 - 24, 0, "edit-tab-spacing", &q),
/* 14 */ QUICK_CHECKBOX (3, OPT_DLG_W, 10, OPT_DLG_H,
N_("Fill tabs with &spaces"), &option_fill_tabs_with_spaces),
/* 15 */ QUICK_CHECKBOX (3, OPT_DLG_W, 9, OPT_DLG_H,
N_("&Backspace through tabs"), &option_backspace_through_tabs),
/* 16 */ QUICK_CHECKBOX (OPT_DLG_W / 2 + 1, OPT_DLG_W, OPT_DLG_H - 18, OPT_DLG_H,
/* 16 */ QUICK_CHECKBOX (3, OPT_DLG_W, 8, OPT_DLG_H,
N_("&Fake half tabs"), &option_fake_half_tabs),
/* 17 */ QUICK_RADIO (5, OPT_DLG_W, OPT_DLG_H - 11, OPT_DLG_H, 3, wrap_str, &wrap_mode),
/* 18 */ QUICK_LABEL (4, OPT_DLG_W, OPT_DLG_H - 12, OPT_DLG_H, N_("Wrap mode")),
/* 19 */ QUICK_RADIO (5, OPT_DLG_W, OPT_DLG_H - 17, OPT_DLG_H, 3, key_emu_str, &tedit_key_emulation),
/* 10 */ QUICK_LABEL (4, OPT_DLG_W, OPT_DLG_H - 18, OPT_DLG_H, N_("Key emulation")),
/* 17 */ QUICK_RADIO (4, OPT_DLG_W, 4, OPT_DLG_H, 3, wrap_str, &wrap_mode),
/* 18 */ QUICK_LABEL (3, OPT_DLG_W, 3, OPT_DLG_H, N_("Wrap mode")),
QUICK_END
};
@ -123,7 +113,6 @@ edit_options_dialog (void)
static gboolean i18n_flag = FALSE;
if (!i18n_flag) {
i18n_translate_array (key_emu_str);
i18n_translate_array (wrap_str);
i18n_flag = TRUE;
}
@ -168,12 +157,6 @@ edit_options_dialog (void)
option_typewriter_wrap = 0;
}
/* Reload menu if key emulation has changed */
if (edit_key_emulation != tedit_key_emulation) {
edit_key_emulation = tedit_key_emulation;
edit_reload_menu ();
}
/* Load or unload syntax rules if the option has changed */
if (option_syntax_highlighting != old_syntax_hl)
edit_load_syntax (wedit, NULL, option_syntax_type);

View File

@ -49,14 +49,35 @@
#include "../src/widget.h" /* buttonbar_redraw() */
#include "../src/menu.h" /* menubar_new() */
#include "../src/cmddef.h"
WEdit *wedit;
struct WMenu *edit_menubar;
struct WMenuBar *edit_menubar;
int column_highlighting = 0;
static cb_ret_t edit_callback (Widget *, widget_msg_t msg, int parm);
static char *
edit_get_shortcut (int command)
{
const char *ext_map;
const char *shortcut = NULL;
ext_map = lookup_keymap_shortcut (editor_map, CK_Ext_Mode);
if (ext_map != NULL)
shortcut = lookup_keymap_shortcut (editor_x_map, command);
if (shortcut != NULL)
return g_strdup_printf ("%s %s", ext_map, shortcut);
shortcut = lookup_keymap_shortcut (editor_map, command);
if (shortcut != NULL)
return g_strdup (shortcut);
return NULL;
}
static int
edit_event (Gpm_Event *event, void *data)
{
@ -189,9 +210,10 @@ edit_file (const char *_file, int line)
g_free (dir);
}
if (!(wedit = edit_init (NULL, LINES - 2, COLS, _file, line))) {
wedit = edit_init (NULL, LINES - 2, COLS, _file, line);
if (wedit == NULL)
return 0;
}
/* Create a new dialog and add it widgets to it */
edit_dlg =
@ -204,17 +226,18 @@ edit_file (const char *_file, int line)
widget_want_cursor (wedit->widget, 1);
edit_bar = buttonbar_new (1);
edit_menubar = edit_create_menu ();
add_widget (edit_dlg, edit_bar);
add_widget (edit_dlg, wedit);
edit_dlg->menu_executor = edit_menu_execute;
edit_dlg->get_shortcut = edit_get_shortcut;
edit_menubar = menubar_new (0, 0, COLS, NULL);
add_widget (edit_dlg, edit_menubar);
edit_init_menu (edit_menubar);
run_dlg (edit_dlg);
edit_done_menu (edit_menubar); /* editmenu.c */
destroy_dlg (edit_dlg);
return 1;

View File

@ -15,6 +15,8 @@ LIBFILES_CONST = \
mc.lib \
filehighlight.ini \
mc.keymap \
mc.keymap.default \
mc.keymap.emacs \
mc.menu \
mc.menu.sr

View File

@ -1,276 +0,0 @@
[editor]
EditXStore =
EditXPaste =
EditXCut =
EditDeleteLine = ctrl-y
EditDeleteToLineEnd = ctrl-k
EditDeleteToLineBegin =
EditLeft = left
EditRight = right
EditUp = up
EditDown = down
EditEnter = enter
EditReturn =
EditBackSpace = backspace
EditDelete = delete
EditPageUp = pgup
EditPageDown = pgdn
EditWordLeft = ctrl-left
EditWordRight = ctrl-right
EditHome = home
EditEnd = end
EditTab = tab
EditUndo = ctrl-u
EditBeginningOfText = ctrl-pgup
EditEndOfText = ctrl-pgdn
EditScrollUp = ctrl-up
EditScrollDown = ctrl-down
EditBeginPage = ctrl-home
EditEndPage = ctrl-end
EditDeleteWordLeft = alt-backspace
EditDeleteWordRight = alt-d
EditParagraphUp =
EditParagraphDown =
EditSave = f2
EditLoad =
EditNew =
EditSaveas = f12
EditMark = f3
EditCopy = f5
EditMove = f6
EditRemove = f8
EditUnmark =
EditFind = f7
EditPageUpHighlight = shift-pgup
EditPageDownHighlight = shift-pgdn
EditLeftHighlight = shift-left
EditRightHighlight = shift-right
EditWordLeftHighlight = ctrl-shift-left
EditWordRightHighlight = ctrl-shift-right
EditUpHighlight = shift-up
EditDownHighlight = shift-down
EditHomeHighlight = shift-home
EditEndHighlight = shift-end
EditBeginningOfTextHighlight = ctrl-shift-home
EditEndOfTextHighlight = ctrl-shift-end
EditBeginPageHighlight = ctrl-shift-pgup
EditEndPageHighlight = ctrl-shift-pgdn
EditScrollUpHighlight =
EditScrollDownHighlight =
EditParagraphUpHighlight =
EditParagraphDownHighlight =
EditPageUpAltHighlight = alt-pgup
EditPageDownAltHighlight = alt-pgdn
EditLeftAltHighlight = alt-left
EditRightAltHighlight = alt-right
EditWordLeftAltHighlight = ctrl-alt-left
EditWordRightAltHighlight = ctrl-alt-right
EditUpAltHighlight = alt-up
EditDownAltHighlight = alt-down
EditHomeAltHighlight = alt-home
EditEndAltHighlight = alt-end
EditBeginningOfTextAltHighlight = ctrl-alt-home
EditEndOfTextHighlight = ctrl-alt-end
EditBeginPageHighlight = ctrl-alt-pgup
EditEndPageAltHighlight = ctrl-alt-pgdn
EditScrollUpAltHighlight =
EditScrollDownAltHighlight =
EditParagraphUpAltHighlight =
EditParagraphDownAltHighlight =
EditSaveBlock = ctrl-f
EditColumnMark = f13
EditFindAgain = f17
EditReplace = f4
EditReplaceAgain = f14
EditCompleteWord = alt-tab
EditDebugStart =
EditDebugStop =
EditDebugToggleBreak =
EditDebugClear =
EditDebugNext =
EditDebugStep =
EditDebugBackTrace =
EditDebugContinue =
EditDebugEnterCommand =
EditDebugUntilCurser =
EditInsertFile = f15
EditExit = f10
EditToggleInsert = ins
EditHelp = f1
EditDate =
EditRefresh = ctrl-l
EditGoto = alt-l
EditManPage =
EditSort = alt-t
EditMail =
EditCancel =
EditComplete =
EditParagraphFormat = alt-p
EditUtil =
EditTypeLoadPython =
EditFindFile =
EditCtags =
EditMatchBracket = alt-b
EditTerminal =
EditTerminalApp =
EditExtCmd = alt-u
EditUserMenu = f11
EditSaveDesktop =
EditNewWindow =
EditCycle =
EditMenu = f9
EditSaveAndQuit =
EditRunAnother =
EditCheckSaveAndQuit =
EditMaximize =
EditDeleteMacro =
EditToggleBookmark = alt-k
EditFlushBookmarks = alt-o
EditNextBookmark = alt-j
EditPrevBookmark = alt-i
EditSelectionHistory =
EditShell = ctrl-o
EditInsertLiteral = ctrl-q
EditExecuteMacro = ctrl-a
EditBeginorEndMacro = ctrl-r
EditBeginRecordMacro =
EditEndRecordMacro =
EditToggleLineState = alt-n
EditToggleTabTWS = alt-underline
EditToggleSyntax = ctrl-s
EditFindDefinition = alt-enter
EditLoadPrevFile = alt-minus
EditLoadNextFile = alt-equal
SelectCodepage = alt-e
[viewer:hex]
HexViewToggleNavigationMode = tab
ViewMoveToBol = ctrl-a; home
ViewMoveToEol = ctrl-e; end
ViewMoveLeft = b; left
ViewMoveRight = f; right
ViewMoveUp = k; y; up
ViewMoveDown = j; delete; down
[viewer]
ViewSearch = question; slash; f7
ViewContinueSearch = ctrl-r; ctrl-s; f17
ViewMoveToBol = home
ViewMoveToEol = end
ViewMoveLeft = h; left
ViewMoveRight = l; right
ViewMoveUp = k; y; insert; up
ViewMoveDown = j; e; delete; down
ViewMovePgDn = f; space; pgdn
ViewMovePgUp = b; pgup
ViewMoveHalfPgDn = d
ViewMoveHalfPgUp = u
ViewGotoBookmark = m
ViewNewBookmark = r
ViewNextFile = ctrl-f
ViewPrevFile = ctrl-b
ViewQuit = q; esc
SelectCodepage = alt-e
ShowCommandLine = ctrl-o
ViewToggleRuler = alt-r
[main]
CmdMenuLastSelected = f19
CmdQuietQuit = f20
CmdSingleDirsize = ctrl-space
CmdCopyCurrentPathname = alt-a
CmdCopyOtherPathname = alt-A
CmdQuickCd = alt-c
CmdQuickChdir = ctrl-backslash
CmdSuspend = ctrl-z
CmdFilteredView = alt-exclamation
CmdFind = alt-question
CmdReread = ctrl-r
CmdToggleListing = alt-t
CmdSwapPanel = ctrl-u
ShowCommandLine = ctrl-o
CmdToggleShowHidden = alt-dot
ExtMap1 = ctrl-x
[main:xmap]
[panel]
PanelStartSearch = ctrl-s; alt-s
PanelMarkFile = ins; ctrl-t
PanelMoveDown = down; ctrl-n
PanelMoveUp = up; ctrl-p
PanelMoveLeft = left
PanelMoveRight = right
PanelPrevPage = pgup; alt-v
PanelNextPage = pgdn; ctrl-v
PanelDoEnter = enter
PanelChdirOtherPanel = alt-o
PanelChdirToReadlink = alt-l
PanelViewSimple = F13
PanelEditNew = F14
PanelCopyLocal = F15
PanelRenameLocal = F16
PanelDeleteLocal = F18
PanelReverseSelection = alt-asterisk
PanelSelect = alt-plus
PanelUnselect = alt-minus
PanelCtrlNextPage = ctrl-pgdn
PanelCtrlPrevPage = ctrl-pgup
PanelDirectoryHistoryList = alt-shift-h
PanelDirectoryHistoryNext = alt-u
PanelDirectoryHistoryPrev = alt-y
PanelGotoBottomFile = alt-j
PanelGotoMiddleFile = alt-r
PanelSyncOtherPanel = alt-i
PanelGotoTopFile = alt-g
PanelSetPanelEncoding = alt-e
PanelMoveHome = alt-lt; home
PanelMoveEnd = alt-gt; end
PanelSelectSortOrder=
PanelToggleSortOrderPrev=
PanelToggleSortOrderNext=
PanelReverseSort=
PanelSortOrderByName=
PanelSortOrderByExt=
PanelSortOrderBySize=
PanelSortOrderByMTime=
[panel:xmap]
[input]
InputBol = ctrl-a; alt-lt; home
InputEol = ctrl-e; alt-gt; end
InputMoveLeft = left; alt-left
InputWordLeft = ctrl-left
InputBackwardChar = ctrl-b
InputBackwardWord = alt-b
InputMoveRight = right; alt-right
InputWordRight = ctrl-right
InputForwardChar = ctrl-f
InputForwardWord = alt-f
InputBackwardDelete = backspace
InputDeleteChar = delete
InputKillWord = alt-d
InputBackwardKillWord = alt-backspace
InputSetMark =
InputKillRegion = ctrl-w
InputKillSave = alt-w
InputYank = ctrl-y
InputKillLine = ctrl-k
InputHistoryPrev = alt-p; ctrl-down
InputHistoryNext = alt-n; ctrl-up
InputHistoryShow = alt-h
InputComplete = alt-tab

1
misc/mc.keymap Symbolic link
View File

@ -0,0 +1 @@
mc.keymap.default

300
misc/mc.keymap.default Normal file
View File

@ -0,0 +1,300 @@
[editor]
EditXStore = ctrl-insert
EditXPaste = shift-insert
EditXCut = shift-delete
EditDeleteLine = ctrl-y
EditDeleteToLineEnd = ctrl-k
EditDeleteToLineBegin =
EditLeft = left
EditRight = right
EditUp = up
EditDown = down
EditEnter = enter
EditReturn =
EditBackSpace = backspace
EditDelete = delete
EditPageUp = pgup
EditPageDown = pgdn
EditWordLeft = ctrl-left
EditWordRight = ctrl-right
EditHome = home
EditEnd = end
EditTab = tab
EditUndo = ctrl-u
EditBeginningOfText = ctrl-pgup
EditEndOfText = ctrl-pgdn
EditScrollUp = ctrl-up
EditScrollDown = ctrl-down
EditBeginPage = ctrl-home
EditEndPage = ctrl-end
EditDeleteWordLeft = alt-backspace
EditDeleteWordRight = alt-d
EditParagraphUp =
EditParagraphDown =
EditSave = f2
EditLoad =
EditNew = ctrl-n
EditSaveas = f12
EditMark = f3
EditCopy = f5
EditMove = f6
EditRemove = f8
EditUnmark =
EditFind = f7
EditPageUpHighlight = shift-pgup
EditPageDownHighlight = shift-pgdn
EditLeftHighlight = shift-left
EditRightHighlight = shift-right
EditWordLeftHighlight = ctrl-shift-left
EditWordRightHighlight = ctrl-shift-right
EditUpHighlight = shift-up
EditDownHighlight = shift-down
EditHomeHighlight = shift-home
EditEndHighlight = shift-end
EditBeginningOfTextHighlight = ctrl-shift-home
EditEndOfTextHighlight = ctrl-shift-end
EditBeginPageHighlight = ctrl-shift-pgup
EditEndPageHighlight = ctrl-shift-pgdn
EditScrollUpHighlight =
EditScrollDownHighlight =
EditParagraphUpHighlight =
EditParagraphDownHighlight =
EditPageUpAltHighlight = alt-pgup
EditPageDownAltHighlight = alt-pgdn
EditLeftAltHighlight = alt-left
EditRightAltHighlight = alt-right
EditWordLeftAltHighlight = ctrl-alt-left
EditWordRightAltHighlight = ctrl-alt-right
EditUpAltHighlight = alt-up
EditDownAltHighlight = alt-down
EditHomeAltHighlight = alt-home
EditEndAltHighlight = alt-end
EditBeginningOfTextAltHighlight = ctrl-alt-home
EditEndOfTextHighlight = ctrl-alt-end
EditBeginPageHighlight = ctrl-alt-pgup
EditEndPageAltHighlight = ctrl-alt-pgdn
EditScrollUpAltHighlight =
EditScrollDownAltHighlight =
EditParagraphUpAltHighlight =
EditParagraphDownAltHighlight =
EditSaveBlock = ctrl-f
EditColumnMark = f13
EditFindAgain = f17
EditReplace = f4
EditReplaceAgain = f14
EditCompleteWord = alt-tab
EditDebugStart =
EditDebugStop =
EditDebugToggleBreak =
EditDebugClear =
EditDebugNext =
EditDebugStep =
EditDebugBackTrace =
EditDebugContinue =
EditDebugEnterCommand =
EditDebugUntilCurser =
EditInsertFile = f15
EditQuit = f10
EditToggleInsert = insert
EditHelp = f1
EditDate =
EditRefresh = ctrl-l
EditGoto = alt-l
EditManPage =
EditSort = alt-t
EditMail =
EditCancel =
EditComplete =
EditParagraphFormat = alt-p
EditUtil =
EditTypeLoadPython =
EditFindFile =
EditCtags =
EditMatchBracket = alt-b
EditTerminal =
EditTerminalApp =
EditExtCmd = alt-u
EditUserMenu = f11
EditSaveDesktop =
EditNewWindow =
EditCycle =
EditMenu = f9
EditSaveAndQuit =
EditRunAnother =
EditCheckSaveAndQuit =
EditMaximize =
EditToggleBookmark = alt-k
EditFlushBookmarks = alt-o
EditNextBookmark = alt-j
EditPrevBookmark = alt-i
EditSelectionHistory =
EditShell = ctrl-o
EditInsertLiteral = ctrl-q
EditBeginRecordMacro = ctrl-r
EditEndRecordMacro = ctrl-r
EditBeginOrEndMacro = ctrl-r
EditExecuteMacro = ctrl-a
EditDeleteMacro =
EditToggleLineState = alt-n
EditToggleTabTWS = alt-underline
EditToggleSyntax = ctrl-s
EditFindDefinition = alt-enter
EditLoadPrevFile = alt-minus
EditLoadNextFile = alt-plus
SelectCodepage = alt-e
[viewer]
ViewSearch = question; slash; f7
ViewContinueSearch = ctrl-r; ctrl-s; f17
ViewMoveToBol = home
ViewMoveToEol = end
ViewMoveLeft = h; left
ViewMoveRight = l; right
ViewMoveUp = k; y; insert; up
ViewMoveDown = j; e; delete; down
ViewMovePgDn = f; space; pgdn
ViewMovePgUp = b; pgup
ViewMoveHalfPgDn = d
ViewMoveHalfPgUp = u
ViewGotoBookmark = m
ViewNewBookmark = r
ViewNextFile = ctrl-f
ViewPrevFile = ctrl-b
ViewQuit = q; esc
SelectCodepage = alt-e
ShowCommandLine = ctrl-o
ViewToggleRuler = alt-r
[viewer:hex]
HexViewToggleNavigationMode = tab
ViewMoveToBol = ctrl-a; home
ViewMoveToEol = ctrl-e; end
ViewMoveLeft = b; left
ViewMoveRight = f; right
ViewMoveUp = k; y; up
ViewMoveDown = j; delete; down
[main]
CmdUserMenu = f2
CmdView = f3
CmdViewFile = f13
CmdEdit = f4
CmdCopy = f5
CmdRename = f6
CmdMkdir = f7
CmdDelete = f8
CmdQuit = f10
CmdMenuLastSelected = f19
CmdQuietQuit = f20
CmdFind = alt-question
CmdQuickCd = alt-c
CmdQuickChdir = ctrl-backslash
CmdReread = ctrl-r
CmdSingleDirsize = ctrl-space
CmdSuspend = ctrl-z
CmdSwapPanel = ctrl-u
CmdHistory = alt-h
CmdToggleListing = alt-t
CmdToggleShowHidden = alt-dot
ShowCommandLine = ctrl-o
CmdCopyCurrentPathname = alt-a
CmdCopyOtherPathname = alt-shift-a
CmdFilteredView = alt-exclamation
CmdSelect = kpplus
CmdUnselect = kpminus
CmdReverseSelection = alt-kpasterisk
ExtMap1 = ctrl-x
[main:xmap]
CmdChmod = c
CmdChown = o
CmdCompareDirs = d
CmdEditSymlink = ctrl-s
CmdLink = l
CmdSymlink = s
CmdMenuInfo = i
CmdMenuQuickView = q
CmdExternalPanelize = exclamation
CmdReselectVfs = a
CmdJobs = j
[panel]
PanelStartSearch = ctrl-s; alt-s
PanelMarkFile = insert; ctrl-t
PanelMoveDown = down; ctrl-n
PanelMoveUp = up; ctrl-p
PanelMoveLeft = left
PanelMoveRight = right
PanelPrevPage = pgup; alt-v
PanelNextPage = pgdn; ctrl-v
PanelDoEnter = enter
PanelChdirOtherPanel = alt-o
PanelChdirToReadlink = alt-l
PanelViewSimple = F13
PanelEditNew = F14
PanelCopyLocal = F15
PanelRenameLocal = F16
PanelDeleteLocal = F18
PanelReverseSelection = alt-asterisk
PanelSelect = alt-plus
PanelUnselect = alt-minus
PanelCtrlNextPage = ctrl-pgdn
PanelCtrlPrevPage = ctrl-pgup
PanelDirectoryHistoryList = alt-shift-h
PanelDirectoryHistoryNext = alt-u
PanelDirectoryHistoryPrev = alt-y
PanelGotoBottomFile = alt-j
PanelGotoMiddleFile = alt-r
PanelSyncOtherPanel = alt-i
PanelGotoTopFile = alt-g
PanelSetPanelEncoding = alt-e
PanelMoveHome = alt-lt; home
PanelMoveEnd = alt-gt; end
PanelSelectSortOrder=
PanelToggleSortOrderPrev=
PanelToggleSortOrderNext=
PanelReverseSort=
PanelSortOrderByName=
PanelSortOrderByExt=
PanelSortOrderBySize=
PanelSortOrderByMTime=
[panel:xmap]
[input]
InputBol = ctrl-a; alt-lt; home
InputEol = ctrl-e; alt-gt; end
InputMoveLeft = left; alt-left
InputWordLeft = ctrl-left
InputBackwardChar = ctrl-b
InputBackwardWord = alt-b
InputMoveRight = right; alt-right
InputWordRight = ctrl-right
InputForwardChar = ctrl-f
InputForwardWord = alt-f
InputBackwardDelete = backspace
InputDeleteChar = delete
InputKillWord = alt-d
InputBackwardKillWord = alt-backspace
InputSetMark =
InputKillRegion = ctrl-w
InputKillSave = alt-w
InputYank = ctrl-y
InputKillLine = ctrl-k
InputHistoryPrev = alt-p; ctrl-down
InputHistoryNext = alt-n; ctrl-up
InputHistoryShow = alt-h
InputComplete = alt-tab

304
misc/mc.keymap.emacs Normal file
View File

@ -0,0 +1,304 @@
[editor]
EditXStore = meta-w
EditXPaste = ctrl-y
EditXCut = ctrl-w
EditDeleteLine = ctrl-y
EditDeleteToLineEnd = ctrl-k
EditDeleteToLineBegin =
EditLeft = left
EditRight = right
EditUp = up
EditDown = down
EditEnter = enter
EditReturn =
EditBackSpace = backspace
EditDelete = delete
EditPageUp = pgup
EditPageDown = pgdn
EditWordLeft = ctrl-left
EditWordRight = ctrl-right
EditHome = home
EditEnd = end
EditTab = tab
EditUndo = ctrl-u
EditBeginningOfText = ctrl-pgup
EditEndOfText = ctrl-pgdn
EditScrollUp = ctrl-up
EditScrollDown = ctrl-down
EditBeginPage = ctrl-home
EditEndPage = ctrl-end
EditDeleteWordLeft = alt-backspace
EditDeleteWordRight = alt-d
EditParagraphUp =
EditParagraphDown =
EditSave = f2
EditLoad =
EditSaveas = f12
EditMark = f3
EditCopy = f5
EditMove = f6
EditRemove = f8
EditUnmark =
EditFind = f7
EditPageUpHighlight = shift-pgup
EditPageDownHighlight = shift-pgdn
EditLeftHighlight = shift-left
EditRightHighlight = shift-right
EditWordLeftHighlight = ctrl-shift-left
EditWordRightHighlight = ctrl-shift-right
EditUpHighlight = shift-up
EditDownHighlight = shift-down
EditHomeHighlight = shift-home
EditEndHighlight = shift-end
EditBeginningOfTextHighlight = ctrl-shift-home
EditEndOfTextHighlight = ctrl-shift-end
EditBeginPageHighlight = ctrl-shift-pgup
EditEndPageHighlight = ctrl-shift-pgdn
EditScrollUpHighlight =
EditScrollDownHighlight =
EditParagraphUpHighlight =
EditParagraphDownHighlight =
EditPageUpAltHighlight = alt-pgup
EditPageDownAltHighlight = alt-pgdn
EditLeftAltHighlight = alt-left
EditRightAltHighlight = alt-right
EditWordLeftAltHighlight = ctrl-alt-left
EditWordRightAltHighlight = ctrl-alt-right
EditUpAltHighlight = alt-up
EditDownAltHighlight = alt-down
EditHomeAltHighlight = alt-home
EditEndAltHighlight = alt-end
EditBeginningOfTextAltHighlight = ctrl-alt-home
EditEndOfTextHighlight = ctrl-alt-end
EditBeginPageHighlight = ctrl-alt-pgup
EditEndPageAltHighlight = ctrl-alt-pgdn
EditScrollUpAltHighlight =
EditScrollDownAltHighlight =
EditParagraphUpAltHighlight =
EditParagraphDownAltHighlight =
EditSaveBlock =
EditColumnMark = f13
EditFindAgain = f17
EditReplace = f4
EditReplaceAgain = f14
EditCompleteWord = alt-tab
EditDebugStart =
EditDebugStop =
EditDebugToggleBreak =
EditDebugClear =
EditDebugNext =
EditDebugStep =
EditDebugBackTrace =
EditDebugContinue =
EditDebugEnterCommand =
EditDebugUntilCurser =
EditInsertFile = f15
EditQuit = f10
EditToggleInsert = insert
EditHelp = f1
EditDate =
EditRefresh = ctrl-l
EditGoto = alt-l
EditManPage =
EditSort = alt-t
EditMail =
EditCancel =
EditComplete =
EditParagraphFormat = alt-p
EditUtil =
EditTypeLoadPython =
EditFindFile =
EditCtags =
EditMatchBracket = alt-b
EditTerminal =
EditTerminalApp =
EditExtCmd = alt-u
EditUserMenu = f11
EditSaveDesktop =
EditNewWindow =
EditCycle =
EditMenu = f9
EditSaveAndQuit =
EditRunAnother =
EditCheckSaveAndQuit =
EditMaximize =
EditToggleBookmark =
EditFlushBookmarks =
EditNextBookmark =
EditPrevBookmark =
EditSelectionHistory =
EditShell = ctrl-o
EditInsertLiteral = ctrl-q
EditBeginRecordMacro = ctrl-r
EditEndRecordMacro = ctrl-r
EditBeginOrEndMacro = ctrl-r
EditDeleteMacro =
EditToggleLineState = alt-n
EditToggleTabTWS = alt-underline
EditToggleSyntax = ctrl-s
EditFindDefinition = alt-enter
EditLoadPrevFile = alt-minus
EditLoadNextFile = alt-plus
SelectCodepage = alt-e
EditExtMode = ctrl-x
[edit:xmap]
EditNew = k
EditExecuteMacro = e
[viewer]
ViewSearch = question; slash; f7
ViewContinueSearch = ctrl-r; ctrl-s; f17
ViewMoveToBol = home
ViewMoveToEol = end
ViewMoveLeft = h; left
ViewMoveRight = l; right
ViewMoveUp = k; y; insert; up
ViewMoveDown = j; e; delete; down
ViewMovePgDn = f; space; pgdn
ViewMovePgUp = b; pgup
ViewMoveHalfPgDn = d
ViewMoveHalfPgUp = u
ViewGotoBookmark = m
ViewNewBookmark = r
ViewNextFile = ctrl-f
ViewPrevFile = ctrl-b
ViewQuit = q; esc
SelectCodepage = alt-e
ShowCommandLine = ctrl-o
ViewToggleRuler = alt-r
[viewer:hex]
HexViewToggleNavigationMode = tab
ViewMoveToBol = ctrl-a; home
ViewMoveToEol = ctrl-e; end
ViewMoveLeft = b; left
ViewMoveRight = f; right
ViewMoveUp = k; y; up
ViewMoveDown = j; delete; down
[main]
CmdUserMenu = f2
CmdView = f3
CmdViewFile = f13
CmdEdit = f4
CmdCopy = f5
CmdRename = f6
CmdMkdir = f7
CmdDelete = f8
CmdQuit = f10
CmdMenuLastSelected = f19
CmdQuietQuit = f20
CmdFind = alt-question
CmdQuickCd = alt-c
CmdQuickChdir = ctrl-backslash
CmdReread = ctrl-r
CmdSingleDirsize = ctrl-space
CmdSuspend = ctrl-z
CmdSwapPanel = ctrl-u
CmdHistory = alt-h
CmdToggleListing = alt-t
CmdToggleShowHidden = alt-dot
ShowCommandLine = ctrl-o
CmdCopyCurrentPathname = alt-a
CmdCopyOtherPathname = alt-shift-a
CmdFilteredView = alt-exclamation
CmdSelect = kpplus
CmdUnselect = kpminus
CmdReverseSelection = alt-kpasterisk
ExtMap1 = ctrl-x
[main:xmap]
CmdChmod = c
CmdChown = o
CmdCompareDirs = d
CmdEditSymlink = ctrl-s
CmdLink = l
CmdSymlink = s
CmdMenuInfo = i
CmdMenuQuickView = q
CmdExternalPanelize = exclamation
CmdReselectVfs = a
CmdJobs = j
[panel]
PanelStartSearch = ctrl-s; alt-s
PanelMarkFile = insert; ctrl-t
PanelMoveDown = down; ctrl-n
PanelMoveUp = up; ctrl-p
PanelMoveLeft = left
PanelMoveRight = right
PanelPrevPage = pgup; alt-v
PanelNextPage = pgdn; ctrl-v
PanelDoEnter = enter
PanelChdirOtherPanel = alt-o
PanelChdirToReadlink = alt-l
PanelViewSimple = F13
PanelEditNew = F14
PanelCopyLocal = F15
PanelRenameLocal = F16
PanelDeleteLocal = F18
PanelReverseSelection = alt-asterisk
PanelSelect = alt-plus
PanelUnselect = alt-minus
PanelCtrlNextPage = ctrl-pgdn
PanelCtrlPrevPage = ctrl-pgup
PanelDirectoryHistoryList = alt-shift-h
PanelDirectoryHistoryNext = alt-u
PanelDirectoryHistoryPrev = alt-y
PanelGotoBottomFile = alt-j
PanelGotoMiddleFile = alt-r
PanelSyncOtherPanel = alt-i
PanelGotoTopFile = alt-g
PanelSetPanelEncoding = alt-e
PanelMoveHome = alt-lt; home
PanelMoveEnd = alt-gt; end
PanelSelectSortOrder=
PanelToggleSortOrderPrev=
PanelToggleSortOrderNext=
PanelReverseSort=
PanelSortOrderByName=
PanelSortOrderByExt=
PanelSortOrderBySize=
PanelSortOrderByMTime=
[panel:xmap]
[input]
InputBol = ctrl-a; alt-lt; home
InputEol = ctrl-e; alt-gt; end
InputMoveLeft = left; alt-left
InputWordLeft = ctrl-left
InputBackwardChar = ctrl-b
InputBackwardWord = alt-b
InputMoveRight = right; alt-right
InputWordRight = ctrl-right
InputForwardChar = ctrl-f
InputForwardWord = alt-f
InputBackwardDelete = backspace
InputDeleteChar = delete
InputKillWord = alt-d
InputBackwardKillWord = alt-backspace
InputSetMark =
InputKillRegion = ctrl-w
InputKillSave = alt-w
InputYank = ctrl-y
InputKillLine = ctrl-k
InputHistoryPrev = alt-p; ctrl-down
InputHistoryNext = alt-n; ctrl-up
InputHistoryShow = alt-h
InputComplete = alt-tab

View File

@ -348,7 +348,7 @@ copy_cmd (void)
}
/* Invoked by F6. Move/rename, default to the other panel, ignore marks. */
void ren_cmd (void)
void rename_cmd (void)
{
save_cwds_stat ();
if (panel_operate (current_panel, OP_MOVE, 0)){
@ -368,7 +368,7 @@ void copy_cmd_local (void)
}
/* Invoked by F16. Move/rename, default to the same panel. */
void ren_cmd_local (void)
void rename_cmd_local (void)
{
save_cwds_stat ();
if (panel_operate (current_panel, OP_MOVE, 1)){

View File

@ -28,16 +28,16 @@ void do_edit_at_line (const char *what, int start_line);
void edit_cmd (void);
void edit_cmd_new (void);
void copy_cmd (void);
void ren_cmd (void);
void copy_cmd_local (void);
void ren_cmd_local (void);
void delete_cmd_local (void);
void reselect_vfs (void);
void rename_cmd (void);
void rename_cmd_local (void);
void mkdir_cmd (void);
void delete_cmd (void);
void delete_cmd_local (void);
void find_cmd (void);
void filter_cmd (void);
void reread_cmd (void);
void reselect_vfs (void);
void ext_cmd (void);
void edit_mc_menu_cmd (void);
void edit_fhl_cmd (void);

View File

@ -82,7 +82,7 @@
/* misc */
#define CK_Insert_File 401
#define CK_Exit 402
#define CK_Quit 402
#define CK_Toggle_Insert 403
#define CK_Help 404
#define CK_Date 405
@ -107,7 +107,12 @@
#define CK_ExtCmd 424
#define CK_User_Menu 425
#define CK_Find_Definition 426
#define CK_Edit_Options 427
#define CK_Edit_Save_Mode 428
#define CK_Choose_Syntax 429
#define CK_About 430
#if 0
/* application control */
#define CK_Save_Desktop 451
#define CK_New_Window 452
@ -117,6 +122,7 @@
#define CK_Run_Another 456
#define CK_Check_Save_And_Quit 457
#define CK_Maximize 458
#endif
#define CK_Toggle_Tab_TWS 470
#define CK_Toggle_Syntax 480
@ -181,16 +187,13 @@
#define CK_Shell 801
/* C-x or similar */
#define CK_Ext_Mode 820
#define CK_Insert_Literal 851
#define CK_Execute_Macro 852
#define CK_Begin_End_Macro 853
/* common */
#define CK_ShowCommandLine 2001
#define CK_SelectCodepage 2002
@ -244,67 +247,76 @@
#define CK_ViewQuit 5020
/* main commands */
#define CK_ChmodCmd 7001
#define CK_ChownAdvancedCmd 7002
#define CK_ChownCmd 7003
#define CK_CompareDirsCmd 7004
#define CK_ConfigureBox 7005
#define CK_ConfigureVfs 7006
#define CK_ConfirmBox 7007
#define CK_CopyCmd 7008
#define CK_CopyCurrentPathname 7009
#define CK_CopyOtherPathname 7010
#define CK_DeleteCmd 7011
#define CK_DirsizesCmd 7012
#define CK_DisplayBitsBox 7013
#define CK_EditCmd 7014
#define CK_EditMcMenuCmd 7015
#define CK_EditSymlinkCmd 7016
#define CK_EditSyntaxCmd 7017
#define CK_EditUserMenuCmd 7018
#define CK_ExternalPanelize 7020
#define CK_FilterCmd 7021
#define CK_FilteredViewCmd 7022
#define CK_FindCmd 7023
#define CK_FishlinkCmd 7024
#define CK_FtplinkCmd 7025
#define CK_HistoryCmd 7026
#define CK_InfoCmd 7027
#define CK_JobsCmd 7028
#define CK_LayoutCmd 7029
#define CK_LearnKeys 7030
#define CK_LinkCmd 7031
#define CK_ListingCmd 7033
#define CK_MenuLastSelectedCmd 7034
#define CK_MkdirCmd 7035
#define CK_QuickCdCmd 7036
#define CK_QuickChdirCmd 7037
#define CK_QuickViewCmd 7038
#define CK_RenCmd 7039
#define CK_RereadCmd 7040
#define CK_ReselectVfs 7041
#define CK_ReverseSelectionCmd 7043
#define CK_SaveSetupCmd 7044
#define CK_SelectCmd 7045
#define CK_SingleDirsizeCmd 7046
#define CK_SuspendCmd 7047
#define CK_SwapCmd 7048
#define CK_SymlinkCmd 7049
#define CK_ToggleListingCmd 7050
#define CK_TreeCmd 7051
#define CK_UndeleteCmd 7052
#define CK_UnselectCmd 7053
#define CK_UserFileMenuCmd 7054
#define CK_ViewCmd 7055
#define CK_ViewFileCmd 7056
#define CK_QuietQuitCmd 7058
#define CK_CopyCurrentTagged 7059
#define CK_CopyCurrentReadlink 7060
#define CK_CopyOtherReadlink 7061
#define CK_AddHotlist 7062
#define CK_QuitCmd 7064
#define CK_CopyOtherTarget 7065
#define CK_ToggleShowHidden 7066
#define CK_AddHotlist 7001
#define CK_ChmodCmd 7002
#define CK_ChownAdvancedCmd 7003
#define CK_ChownCmd 7004
#define CK_CompareDirsCmd 7005
#define CK_ConfigureBox 7006
#define CK_ConfigureVfs 7007
#define CK_ConfirmBox 7008
#define CK_CopyCmd 7009
#define CK_CopyCurrentPathname 7010
#define CK_CopyCurrentReadlink 7011
#define CK_CopyCurrentTagged 7012
#define CK_CopyOtherPathname 7013
#define CK_CopyOtherReadlink 7014
#define CK_CopyOtherTarget 7015
#define CK_DeleteCmd 7016
#define CK_DirsizesCmd 7017
#define CK_DisplayBitsBox 7018
#define CK_EditCmd 7019
#define CK_EditExtFileCmd 7020
#define CK_EditFhlFileCmd 7021
#define CK_EditMcMenuCmd 7022
#define CK_EditSymlinkCmd 7023
#define CK_EditSyntaxCmd 7024
#define CK_EditUserMenuCmd 7025
#define CK_ExternalPanelize 7026
#define CK_FilterCmd 7027
#define CK_FilteredViewCmd 7028
#define CK_FindCmd 7029
#define CK_FishlinkCmd 7030
#define CK_FtplinkCmd 7031
#define CK_HistoryCmd 7032
#define CK_InfoCmd 7033
#define CK_JobsCmd 7034
#define CK_LayoutCmd 7035
#define CK_LearnKeys 7036
#define CK_LinkCmd 7037
#define CK_ListingCmd 7038
#define CK_ListmodeCmd 7039
#define CK_MenuInfoCmd 7040
#define CK_MenuLastSelectedCmd 7042
#define CK_MenuQuickViewCmd 7043
#define CK_MkdirCmd 7044
#define CK_NetlinkCmd 7045
#define CK_QuickCdCmd 7046
#define CK_QuickChdirCmd 7047
#define CK_QuickViewCmd 7048
#define CK_QuietQuitCmd 7049
#define CK_QuitCmd 7050
#define CK_RenameCmd 7051
#define CK_RereadCmd 7052
#define CK_ReselectVfs 7053
#define CK_ReverseSelectionCmd 7054
#define CK_SaveSetupCmd 7055
#define CK_SelectCmd 7056
#define CK_SingleDirsizeCmd 7057
#define CK_SmblinkCmd 7058
#define CK_SuspendCmd 7059
#define CK_SwapCmd 7060
#define CK_SymlinkCmd 7061
#define CK_ToggleListingCmd 7062
#define CK_ToggleShowHidden 7063
#define CK_TreeCmd 7064
#define CK_TreeBoxCmd 7065
#define CK_UndeleteCmd 7066
#define CK_UnselectCmd 7067
#define CK_UserFileMenuCmd 7068
#define CK_UserMenuCmd 7069
#define CK_ViewCmd 7070
#define CK_ViewFileCmd 7071
/* panels */
#define CK_PanelChdirOtherPanel 8001

View File

@ -249,7 +249,7 @@ create_dlg (int y1, int x1, int lines, int cols, const int *color_set,
memmove (new_d->color, color_set, sizeof (int) * DLG_COLOR_NUM);
}
new_d->help_ctx = help_ctx;
new_d->callback = callback ? callback : default_dlg_callback;
new_d->callback = (callback != NULL) ? callback : default_dlg_callback;
new_d->x = x1;
new_d->y = y1;
new_d->flags = flags;
@ -260,12 +260,14 @@ create_dlg (int y1, int x1, int lines, int cols, const int *color_set,
/* Strip existing spaces, add one space before and after the title */
if (title) {
char *t;
t = g_strstrip (g_strdup (title));
new_d->title = g_strconcat (" ", t, " ", (char *) NULL);
if (*t != '\0')
new_d->title = g_strdup_printf (" %s ", t);
g_free (t);
}
return (new_d);
return new_d;
}
void

View File

@ -84,6 +84,13 @@ typedef enum {
struct Dlg_head;
typedef cb_ret_t (*dlg_cb_fn)(struct Dlg_head *h, dlg_msg_t msg, int parm);
/* menu command execution */
typedef cb_ret_t (*menu_exec_fn) (int command);
/* get string representation of shortcut assigned with command */
/* as menu is a widget of dialog, ask dialog about shortcut string */
typedef char * (*dlg_shortcut_str) (int command);
/* Dialog color constants */
#define DLG_COLOR_NUM 4
#define DLG_NORMALC(h) ((h)->color[0])
@ -93,29 +100,31 @@ typedef cb_ret_t (*dlg_cb_fn)(struct Dlg_head *h, dlg_msg_t msg, int parm);
typedef struct Dlg_head {
/* Set by the user */
int flags; /* User flags */
const char *help_ctx; /* Name of the help entry */
int *color; /* Color set. Unused in viewer and editor */
/*notconst*/ char *title; /* Title of the dialog */
int flags; /* User flags */
const char *help_ctx; /* Name of the help entry */
int *color; /* Color set. Unused in viewer and editor */
/*notconst*/ char *title; /* Title of the dialog */
/* Set and received by the user */
int ret_value; /* Result of run_dlg() */
int ret_value; /* Result of run_dlg() */
/* Geometry */
int x, y; /* Position relative to screen origin */
int cols, lines; /* Width and height of the window */
int x, y; /* Position relative to screen origin */
int cols, lines; /* Width and height of the window */
/* Internal flags */
unsigned int running:1; /* The dialog is currently active */
unsigned int fullscreen:1; /* Parents dialogs don't need refresh */
int mouse_status; /* For the autorepeat status of the mouse */
unsigned int running:1; /* The dialog is currently active */
unsigned int fullscreen:1; /* Parents dialogs don't need refresh */
int mouse_status; /* For the autorepeat status of the mouse */
/* Internal variables */
int count; /* Number of widgets */
struct Widget *current; /* Curently active widget */
void *data; /* data can be passed to dialog */
int count; /* Number of widgets */
struct Widget *current; /* Curently active widget */
void *data; /* Data can be passed to dialog */
dlg_cb_fn callback;
struct Dlg_head *parent; /* Parent dialog */
menu_exec_fn menu_executor; /* Execute menu commands */
dlg_shortcut_str get_shortcut; /* Shortcut string */
struct Dlg_head *parent; /* Parent dialog */
} Dlg_head;
/* Color styles for normal and error dialogs */

File diff suppressed because it is too large Load Diff

View File

@ -4,10 +4,10 @@
#include "global.h"
typedef struct name_key_map_t {
typedef struct name_keymap_t {
const char *name;
int val;
} name_key_map_t;
} name_keymap_t;
typedef struct key_config_t {
time_t mtime; /* mtime at the moment we read config file */
@ -17,32 +17,35 @@ typedef struct key_config_t {
} key_config_t;
/* The global keymaps are of this type */
typedef struct global_key_map_t {
#define KEYMAP_SHORTCUT_LENGTH 32 /* FIXME: is 32 bytes enough for shortcut? */
typedef struct global_keymap_t {
long key;
long command;
} global_key_map_t;
char caption[KEYMAP_SHORTCUT_LENGTH];
} global_keymap_t;
int lookup_action (char *keyname);
void keybind_cmd_bind(GArray *keymap, char *keybind, int action);
#endif /* MC_KEYBIND_H */
int lookup_action (const char *keyname);
void keybind_cmd_bind (GArray *keymap, const char *keybind, int action);
const char *lookup_keymap_shortcut (const global_keymap_t *keymap, int action);
/* viewer/actions_cmd.c */
extern const global_key_map_t default_viewer_keymap[];
extern const global_key_map_t default_viewer_hex_keymap[];
extern const global_keymap_t default_viewer_keymap[];
extern const global_keymap_t default_viewer_hex_keymap[];
#ifdef USE_INTERNAL_EDIT
/* ../edit/editkey.c */
extern const global_key_map_t default_editor_keymap[];
extern const global_key_map_t default_editor_x_keymap[];
extern const global_keymap_t default_editor_keymap[];
extern const global_keymap_t default_editor_x_keymap[];
#endif
/* screen.c */
extern const global_key_map_t default_panel_keymap[];
extern const global_keymap_t default_panel_keymap[];
/* widget.c */
extern const global_key_map_t default_input_keymap[];
extern const global_keymap_t default_input_keymap[];
/* main.c */
extern const global_key_map_t default_main_map[];
extern const global_key_map_t default_main_x_map[];
extern const global_keymap_t default_main_map[];
extern const global_keymap_t default_main_x_map[];
extern const global_key_map_t default_input_keymap[];
#endif /* MC_KEYBIND_H */

View File

@ -14,6 +14,6 @@ extern WLabel *the_prompt;
extern WLabel *the_hint;
extern Dlg_head *midnight_dlg;
extern struct WMenu *the_menubar;
extern struct WMenuBar *the_menubar;
#endif

View File

@ -78,6 +78,7 @@
#include "command.h"
#include "wtools.h"
#include "cmddef.h" /* CK_ cmd name const */
#include "fileloc.h" /* MC_USERCONF_DIR */
#include "../vfs/vfs.h" /* vfs_translate_url() */
@ -101,7 +102,7 @@
#include "../vfs/gc.h"
#endif
#include "keybind.h" /* type global_key_map_t */
#include "keybind.h" /* type global_keymap_t */
/* When the modes are active, left_panel, right_panel and tree_panel */
/* Point to a proper data structure. You should check with the functions */
@ -118,7 +119,7 @@ mc_fhl_t *mc_filehighlight;
WTree *the_tree = NULL;
/* The Menubar */
struct WMenu *the_menubar = NULL;
struct WMenuBar *the_menubar = NULL;
/* Pointers to the selected and unselected panel */
WPanel *current_panel = NULL;
@ -305,7 +306,10 @@ mc_main_error_quark (void)
return g_quark_from_static_string (PACKAGE);
}
#ifdef USE_INTERNAL_EDIT
GArray *editor_keymap = NULL;
GArray *editor_x_keymap = NULL;
#endif
GArray *viewer_keymap = NULL;
GArray *viewer_hex_keymap = NULL;
GArray *main_keymap = NULL;
@ -313,8 +317,8 @@ GArray *main_x_keymap = NULL;
GArray *panel_keymap = NULL;
GArray *input_keymap = NULL;
const global_key_map_t *main_map;
const global_key_map_t *main_x_map;
const global_keymap_t *main_map;
const global_keymap_t *main_x_map;
/* Save current stat of directories to avoid reloading the panels */
/* when no modifications have taken place */
@ -666,178 +670,160 @@ listmode_cmd (void)
#endif /* LISTMODE_EDITOR */
/* NOTICE: hotkeys specified here are overriden in menubar_paint_idx (alex) */
static menu_entry LeftMenu[] = {
{' ', N_("&Listing mode..."), NULL_HOTKEY, listing_cmd},
{' ', N_("&Quick view C-x q"), NULL_HOTKEY, quick_view_cmd},
{' ', N_("&Info C-x i"), NULL_HOTKEY, info_cmd},
{' ', N_("&Tree"), NULL_HOTKEY, tree_cmd},
{' ', "", NULL_HOTKEY, 0},
{' ', N_("&Sort order..."), NULL_HOTKEY, sort_cmd},
{' ', "", NULL_HOTKEY, 0},
{' ', N_("&Filter..."), NULL_HOTKEY, filter_cmd},
static GList *
create_panel_menu (void)
{
GList *entries = NULL;
entries = g_list_append (entries, menu_entry_create (_("&Listing mode..."), CK_ListingCmd));
entries = g_list_append (entries, menu_entry_create (_("&Quick view"), CK_MenuQuickViewCmd));
entries = g_list_append (entries, menu_entry_create (_("&Info" ), CK_MenuInfoCmd));
entries = g_list_append (entries, menu_entry_create (_("&Tree"), CK_TreeCmd));
entries = g_list_append (entries, menu_separator_create ());
entries = g_list_append (entries, menu_entry_create (_("&Sort order..."), CK_Sort));
entries = g_list_append (entries, menu_separator_create ());
entries = g_list_append (entries, menu_entry_create (_("&Filter..."), CK_FilterCmd));
#ifdef HAVE_CHARSET
{' ', "",NULL_HOTKEY, 0},
{' ', N_("&Encoding... M-e"), NULL_HOTKEY, encoding_cmd},
entries = g_list_append (entries, menu_separator_create ());
entries = g_list_append (entries, menu_entry_create (_("&Encoding..."), CK_PanelSetPanelEncoding));
#endif
#ifdef USE_NETCODE
{' ', "", NULL_HOTKEY, 0},
entries = g_list_append (entries, menu_separator_create ());
#ifdef ENABLE_VFS_MCFS
{' ', N_("&Network link..."), NULL_HOTKEY, netlink_cmd},
entries = g_list_append (entries, menu_entry_create (_("&Network link..."), CK_NetlinkCmd));
#endif
{' ', N_("FT&P link..."), NULL_HOTKEY, ftplink_cmd},
{' ', N_("S&hell link..."), NULL_HOTKEY, fishlink_cmd},
entries = g_list_append (entries, menu_entry_create (_("FT&P link..."), CK_FtplinkCmd));
entries = g_list_append (entries, menu_entry_create (_("S&hell link..."), CK_FishlinkCmd));
#ifdef WITH_SMBFS
{' ', N_("SM&B link..."), NULL_HOTKEY, smblink_cmd},
entries = g_list_append (entries, menu_entry_create (_("SM&B link..."), CK_SmblinkCmd));
#endif
#endif
{' ', "", NULL_HOTKEY, 0},
{' ', N_("&Rescan C-r"), NULL_HOTKEY, reread_cmd}
};
entries = g_list_append (entries, menu_separator_create ());
entries = g_list_append (entries, menu_entry_create (_("&Rescan"), CK_RereadCmd));
static menu_entry RightMenu[] = {
{' ', N_("&Listing mode..."), NULL_HOTKEY, listing_cmd},
{' ', N_("&Quick view C-x q"), NULL_HOTKEY, quick_view_cmd},
{' ', N_("&Info C-x i"), NULL_HOTKEY, info_cmd},
{' ', N_("&Tree"), NULL_HOTKEY, tree_cmd},
{' ', "", NULL_HOTKEY, 0},
{' ', N_("&Sort order..."), NULL_HOTKEY, sort_cmd},
{' ', "", NULL_HOTKEY, 0},
{' ', N_("&Filter..."), NULL_HOTKEY, filter_cmd},
#ifdef HAVE_CHARSET
{' ', "",NULL_HOTKEY, 0},
{' ', N_("&Encoding... M-e"), NULL_HOTKEY, encoding_cmd},
#endif
#ifdef USE_NETCODE
{' ', "", NULL_HOTKEY, 0},
#ifdef ENABLE_VFS_MCFS
{' ', N_("&Network link..."), NULL_HOTKEY, netlink_cmd},
#endif
{' ', N_("FT&P link..."), NULL_HOTKEY, ftplink_cmd},
{' ', N_("S&hell link..."), NULL_HOTKEY, fishlink_cmd},
#ifdef WITH_SMBFS
{' ', N_("SM&B link..."), NULL_HOTKEY, smblink_cmd},
#endif
#endif
{' ', "", NULL_HOTKEY, 0},
{' ', N_("&Rescan C-r"), NULL_HOTKEY, reread_cmd}
};
return entries;
}
static menu_entry FileMenu[] = {
{' ', N_("&View F3"), NULL_HOTKEY, view_cmd},
{' ', N_("Vie&w file... "), NULL_HOTKEY, view_file_cmd},
{' ', N_("&Filtered view M-!"), NULL_HOTKEY, filtered_view_cmd},
{' ', N_("&Edit F4"), NULL_HOTKEY, edit_cmd},
{' ', N_("&Copy F5"), NULL_HOTKEY, copy_cmd},
{' ', N_("c&Hmod C-x c"), NULL_HOTKEY, chmod_cmd},
{' ', N_("&Link C-x l"), NULL_HOTKEY, link_cmd},
{' ', N_("&SymLink C-x s"), NULL_HOTKEY, symlink_cmd},
{' ', N_("edit s&Ymlink C-x C-s"), NULL_HOTKEY, edit_symlink_cmd},
{' ', N_("ch&Own C-x o"), NULL_HOTKEY, chown_cmd},
{' ', N_("&Advanced chown "), NULL_HOTKEY, chown_advanced_cmd},
{' ', N_("&Rename/Move F6"), NULL_HOTKEY, ren_cmd},
{' ', N_("&Mkdir F7"), NULL_HOTKEY, mkdir_cmd},
{' ', N_("&Delete F8"), NULL_HOTKEY, delete_cmd},
{' ', N_("&Quick cd M-c"), NULL_HOTKEY, quick_cd_cmd},
{' ', "", NULL_HOTKEY, 0},
{' ', N_("select &Group M-+"), NULL_HOTKEY, select_cmd},
{' ', N_("u&Nselect group M-\\"), NULL_HOTKEY, unselect_cmd},
{' ', N_("reverse selec&Tion M-*"), NULL_HOTKEY, reverse_selection_cmd},
{' ', "", NULL_HOTKEY, 0},
{' ', N_("e&Xit F10"), NULL_HOTKEY, quit_cmd}
};
static GList *
create_file_menu (void)
{
GList *entries = NULL;
static menu_entry CmdMenu[] = {
{' ', N_("&User menu F2"), NULL_HOTKEY, user_file_menu_cmd},
entries = g_list_append (entries, menu_entry_create (_("&View"), CK_ViewCmd));
entries = g_list_append (entries, menu_entry_create (_("Vie&w file..."), CK_ViewFileCmd));
entries = g_list_append (entries, menu_entry_create (_("&Filtered view"), CK_FilteredViewCmd));
entries = g_list_append (entries, menu_entry_create (_("&Edit"), CK_EditCmd));
entries = g_list_append (entries, menu_entry_create (_("&Copy"), CK_CopyCmd));
entries = g_list_append (entries, menu_entry_create (_("C&hmod"), CK_ChmodCmd));
entries = g_list_append (entries, menu_entry_create (_("&Link"), CK_LinkCmd));
entries = g_list_append (entries, menu_entry_create (_("&SymLink"), CK_SymlinkCmd));
entries = g_list_append (entries, menu_entry_create (_("Edit s&ymlink"), CK_EditSymlinkCmd));
entries = g_list_append (entries, menu_entry_create (_("Ch&own"), CK_ChownCmd));
entries = g_list_append (entries, menu_entry_create (_("&Advanced chown"), CK_ChownAdvancedCmd));
entries = g_list_append (entries, menu_entry_create (_("&Rename/Move"), CK_RenameCmd));
entries = g_list_append (entries, menu_entry_create (_("&Mkdir"), CK_MkdirCmd));
entries = g_list_append (entries, menu_entry_create (_("&Delete"), CK_DeleteCmd));
entries = g_list_append (entries, menu_entry_create (_("&Quick cd"), CK_QuickCdCmd));
entries = g_list_append (entries, menu_separator_create ());
entries = g_list_append (entries, menu_entry_create (_("Select &group"), CK_SelectCmd));
entries = g_list_append (entries, menu_entry_create (_("U&nselect group"), CK_UnselectCmd));
entries = g_list_append (entries, menu_entry_create (_("Reverse selec&tion"), CK_ReverseSelectionCmd));
entries = g_list_append (entries, menu_separator_create ());
entries = g_list_append (entries, menu_entry_create (_("E&xit"), CK_QuitCmd));
return entries;
}
static GList *
create_command_menu (void)
{
/* I know, I'm lazy, but the tree widget when it's not running
* as a panel still has some problems, I have not yet finished
* the WTree widget port, sorry.
*/
{' ', N_("&Directory tree"), NULL_HOTKEY, treebox_cmd},
{' ', N_("&Find file M-?"), NULL_HOTKEY, find_cmd},
{' ', N_("s&Wap panels C-u"), NULL_HOTKEY, swap_cmd},
{' ', N_("switch &Panels on/off C-o"), NULL_HOTKEY, view_other_cmd},
{' ', N_("&Compare directories C-x d"), NULL_HOTKEY, compare_dirs_cmd},
{' ', N_("e&Xternal panelize C-x !"), NULL_HOTKEY, external_panelize},
{' ', N_("show directory s&Izes"), NULL_HOTKEY, dirsizes_cmd},
{' ', "", NULL_HOTKEY, 0},
{' ', N_("Command &history M-h"), NULL_HOTKEY, history_cmd},
{' ', N_("di&Rectory hotlist C-\\"), NULL_HOTKEY, quick_chdir_cmd},
GList *entries = NULL;
entries = g_list_append (entries, menu_entry_create (_("&User menu"), CK_UserMenuCmd));
entries = g_list_append (entries, menu_entry_create (_("&Directory tree"), CK_TreeBoxCmd));
entries = g_list_append (entries, menu_entry_create (_("&Find file"), CK_FindCmd));
entries = g_list_append (entries, menu_entry_create (_("S&wap panels"), CK_SwapCmd));
entries = g_list_append (entries, menu_entry_create (_("Switch &panels on/off"), CK_ShowCommandLine));
entries = g_list_append (entries, menu_entry_create (_("&Compare directories"), CK_CompareDirsCmd));
entries = g_list_append (entries, menu_entry_create (_("E&xternal panelize"), CK_ExternalPanelize));
entries = g_list_append (entries, menu_entry_create (_("Show directory s&izes"), CK_SingleDirsizeCmd));
entries = g_list_append (entries, menu_separator_create ());
entries = g_list_append (entries, menu_entry_create (_("Command &history"), CK_HistoryCmd));
entries = g_list_append (entries, menu_entry_create (_("Di&rectory hotlist"), CK_QuickChdirCmd));
#ifdef USE_VFS
{' ', N_("&Active VFS list C-x a"), NULL_HOTKEY, reselect_vfs},
entries = g_list_append (entries, menu_entry_create (_("&Active VFS list"), CK_ReselectVfs));
#endif
#ifdef WITH_BACKGROUND
{' ', N_("&Background jobs C-x j"), NULL_HOTKEY, jobs_cmd},
entries = g_list_append (entries, menu_entry_create (_("&Background jobs"), CK_JobsCmd));
#endif
{' ', "", NULL_HOTKEY, 0},
entries = g_list_append (entries, menu_separator_create ());
#ifdef USE_EXT2FSLIB
{' ', N_("&Undelete files (ext2fs only)"), NULL_HOTKEY, undelete_cmd},
entries = g_list_append (entries, menu_entry_create (_("&Undelete files (ext2fs only)"), CK_UndeleteCmd));
#endif
#ifdef LISTMODE_EDITOR
{' ', N_("&Listing format edit"), NULL_HOTKEY, listmode_cmd},
entries = g_list_append (entries, menu_entry_create (_("&Listing format edit"), CK_ListmodeCmd));
#endif
#if defined (USE_EXT2FSLIB) || defined (LISTMODE_EDITOR)
{' ', "", NULL_HOTKEY, 0},
entries = g_list_append (entries, menu_separator_create ());
#endif
{' ', N_("Edit &extension file"), NULL_HOTKEY, ext_cmd},
{' ', N_("Edit &menu file"), NULL_HOTKEY, edit_mc_menu_cmd},
{' ', N_("Edit hi&ghlighting group file"), NULL_HOTKEY, edit_fhl_cmd}
};
entries = g_list_append (entries, menu_entry_create (_("Edit &extension file"), CK_EditExtFileCmd));
entries = g_list_append (entries, menu_entry_create (_("Edit &menu file"), CK_EditMcMenuCmd));
entries = g_list_append (entries, menu_entry_create (_("Edit hi&ghlighting group file"), CK_EditFhlFileCmd));
/* Must keep in sync with the constants in menu_cmd */
static menu_entry OptMenu[] = {
{' ', N_("&Configuration..."), NULL_HOTKEY, configure_box},
{' ', N_("&Layout..."), NULL_HOTKEY, layout_cmd},
{' ', N_("c&Onfirmation..."), NULL_HOTKEY, confirm_box},
{' ', N_("&Display bits..."), NULL_HOTKEY, display_bits_box},
{' ', N_("learn &Keys..."), NULL_HOTKEY, learn_keys},
return entries;
}
static GList *
create_options_menu (void)
{
GList *entries = NULL;
entries = g_list_append (entries, menu_entry_create (_("&Configuration..."), CK_ConfigureBox));
entries = g_list_append (entries, menu_entry_create (_("&Layout..."), CK_LayoutCmd));
entries = g_list_append (entries, menu_entry_create (_("C&onfirmation..."), CK_ConfirmBox));
entries = g_list_append (entries, menu_entry_create (_("&Display bits..."), CK_DisplayBitsBox));
entries = g_list_append (entries, menu_entry_create (_("Learn &keys..."), CK_LearnKeys));
#ifdef USE_VFS
{' ', N_("&Virtual FS..."), NULL_HOTKEY, configure_vfs},
#endif /* !USE_VFS */
{' ', "", NULL_HOTKEY, 0},
{' ', N_("&Save setup"), NULL_HOTKEY, save_setup_cmd}
};
entries = g_list_append (entries, menu_entry_create (_("&Virtual FS..."), CK_ConfigureVfs));
#endif
entries = g_list_append (entries, menu_separator_create ());
entries = g_list_append (entries, menu_entry_create (_("&Save setup"), CK_SaveSetupCmd));
#define menu_entries(x) sizeof(x)/sizeof(menu_entry)
static Menu *MenuBar[5];
return entries;
}
void
init_menu (void)
{
MenuBar[0] =
create_menu (horizontal_split ? _(" &Above ") : _(" &Left "),
LeftMenu, menu_entries (LeftMenu),
"[Left and Right Menus]");
MenuBar[1] =
create_menu (_(" &File "), FileMenu, menu_entries (FileMenu),
"[File Menu]");
MenuBar[2] =
create_menu (_(" &Command "), CmdMenu, menu_entries (CmdMenu),
"[Command Menu]");
MenuBar[3] =
create_menu (_(" &Options "), OptMenu, menu_entries (OptMenu),
"[Options Menu]");
MenuBar[4] =
create_menu (horizontal_split ? _(" &Below ") : _(" &Right "),
RightMenu, menu_entries (RightMenu),
"[Left and Right Menus]");
menubar_add_menu (the_menubar,
create_menu (horizontal_split ? _("&Above") : _("&Left"),
create_panel_menu (), "[Left and Right Menus]"));
menubar_add_menu (the_menubar,
create_menu (_("&File"), create_file_menu (), "[File Menu]"));
menubar_add_menu (the_menubar,
create_menu (_("&Command"), create_command_menu (), "[Command Menu]"));
menubar_add_menu (the_menubar,
create_menu (_("&Options"), create_options_menu (), "[Options Menu]"));
menubar_add_menu (the_menubar,
create_menu (horizontal_split ? _("&Below") : _("&Right"),
create_panel_menu (), "[Left and Right Menus]"));
}
void
done_menu (void)
{
int i;
for (i = 0; i < 5; i++) {
destroy_menu (MenuBar[i]);
}
menubar_set_menu (the_menubar, NULL);
}
static void
menu_last_selected_cmd (void)
{
the_menubar->active = 1;
the_menubar->dropped = drop_menus;
the_menubar->is_active = TRUE;
the_menubar->is_dropped = (drop_menus != 0);
the_menubar->previous_widget = midnight_dlg->current->dlg_id;
dlg_select_widget (the_menubar);
}
@ -845,16 +831,40 @@ menu_last_selected_cmd (void)
static void
menu_cmd (void)
{
if (the_menubar->active)
if (the_menubar->is_active)
return;
if ((get_current_index () == 0) ^ (!current_panel->active))
if ((get_current_index () == 0) == (current_panel->active != 0))
the_menubar->selected = 0;
else
the_menubar->selected = 4;
the_menubar->selected = g_list_length (the_menubar->menu) - 1;
menu_last_selected_cmd ();
}
static char *
midnight_get_shortcut (int command)
{
const char *ext_map;
const char *shortcut = NULL;
ext_map = lookup_keymap_shortcut (main_map, CK_StartExtMap1);
if (ext_map != NULL)
shortcut = lookup_keymap_shortcut (main_x_map, command);
if (shortcut != NULL)
return g_strdup_printf ("%s %s", ext_map, shortcut);
shortcut = lookup_keymap_shortcut (main_map, command);
if (shortcut != NULL)
return g_strdup (shortcut);
shortcut = lookup_keymap_shortcut (panel_map, command);
if (shortcut != NULL)
return g_strdup (shortcut);
return NULL;
}
/* Flag toggling functions */
void
toggle_fast_reload (void)
@ -976,7 +986,7 @@ create_panels (void)
the_hint->auto_adjust_cols = 0;
the_hint->widget.cols = COLS;
the_menubar = menubar_new (0, 0, COLS, MenuBar, 5);
the_menubar = menubar_new (0, 0, COLS, NULL);
}
static void
@ -1116,73 +1126,13 @@ ctl_x_cmd (void)
}
static cb_ret_t
midnight_execute_cmd(int command)
midnight_execute_cmd (int command)
{
cb_ret_t res = MSG_HANDLED;
switch (command) {
case CK_MenuLastSelectedCmd:
menu_last_selected_cmd ();
break;
case CK_QuietQuitCmd:
quiet_quit_cmd ();
break;
case CK_SingleDirsizeCmd:
smart_dirsize_cmd ();
break;
case CK_CopyCurrentPathname:
copy_current_pathname ();
break;
case CK_CopyOtherPathname:
copy_other_pathname ();
break;
case CK_QuickCdCmd:
quick_cd_cmd ();
break;
case CK_QuickChdirCmd:
quick_chdir_cmd ();
break;
case CK_SuspendCmd:
suspend_cmd ();
break;
case CK_FilteredViewCmd:
filtered_view_cmd ();
break;
case CK_FindCmd:
find_cmd ();
break;
case CK_RereadCmd:
reread_cmd ();
break;
case CK_ToggleListingCmd:
toggle_listing_cmd ();
break;
case CK_SwapCmd:
swap_cmd ();
break;
case CK_ShowCommandLine:
view_other_cmd ();
break;
case CK_QuitCmd:
quit_cmd ();
break;
case CK_CompareDirsCmd:
compare_dirs_cmd ();
break;
case CK_ReselectVfs:
reselect_vfs ();
break;
case CK_CopyCurrentTagged:
copy_current_tagged ();
break;
case CK_CopyOtherTarget:
copy_other_tagged ();
break;
case CK_CopyCurrentReadlink:
copy_current_readlink ();
break;
case CK_CopyOtherReadlink:
copy_other_readlink ();
case CK_AddHotlist:
add2hotlist_cmd ();
break;
case CK_ChmodCmd:
chmod_cmd ();
@ -1190,38 +1140,225 @@ midnight_execute_cmd(int command)
case CK_ChownCmd:
chown_cmd ();
break;
case CK_LinkCmd:
link_cmd () ;
case CK_ChownAdvancedCmd:
chown_advanced_cmd ();
break;
case CK_SymlinkCmd:
symlink_cmd ();
case CK_CompareDirsCmd:
compare_dirs_cmd ();
break;
case CK_ConfigureBox:
configure_box ();
break;
#ifdef USE_VFS
case CK_ConfigureVfs:
configure_vfs ();
break;
#endif
case CK_ConfirmBox:
confirm_box ();
break;
case CK_CopyCmd:
copy_cmd ();
break;
case CK_CopyCurrentPathname:
copy_current_pathname ();
break;
case CK_CopyCurrentReadlink:
copy_current_readlink ();
break;
case CK_CopyCurrentTagged:
copy_current_tagged ();
break;
case CK_CopyOtherPathname:
copy_other_pathname ();
break;
case CK_CopyOtherReadlink:
copy_other_readlink ();
break;
case CK_CopyOtherTarget:
copy_other_tagged ();
break;
case CK_DeleteCmd:
delete_cmd ();
break;
case CK_DisplayBitsBox:
display_bits_box ();
break;
case CK_EditCmd:
edit_cmd ();
break;
case CK_EditExtFileCmd:
ext_cmd ();
break;
case CK_EditFhlFileCmd:
edit_fhl_cmd ();
break;
case CK_EditMcMenuCmd:
edit_mc_menu_cmd ();
break;
case CK_EditSymlinkCmd:
edit_symlink_cmd ();
break;
case CK_ExternalPanelize:
external_panelize ();
break;
case CK_FilterCmd:
filter_cmd ();
break;
case CK_FilteredViewCmd:
filtered_view_cmd ();
break;
case CK_FindCmd:
find_cmd ();
break;
#if defined (USE_NETCODE)
case CK_FishlinkCmd:
fishlink_cmd ();
break;
case CK_FtplinkCmd:
ftplink_cmd ();
break;
#endif
case CK_HistoryCmd:
history_cmd ();
break;
case CK_InfoCmd:
info_cmd_no_menu ();
break;
#ifdef WITH_BACKGROUND
case CK_JobsCmd:
jobs_cmd ();
break;
#endif
case CK_LayoutCmd:
layout_cmd ();
break;
case CK_LearnKeys:
learn_keys ();
break;
case CK_LinkCmd:
link_cmd ();
break;
case CK_ListingCmd:
listing_cmd ();
break;
#ifdef LISTMODE_EDITOR
case CK_ListmodeCmd:
listmode_cmd ();
break;
#endif
case CK_MenuInfoCmd:
info_cmd ();
break;
case CK_MenuLastSelectedCmd:
menu_last_selected_cmd ();
break;
case CK_MenuQuickViewCmd:
quick_view_cmd ();
break;
case CK_MkdirCmd:
mkdir_cmd ();
break;
#if defined (USE_NETCODE) && defined (ENABLE_VFS_MCFS)
case CK_NetlinkCmd:
netlink_cmd ();
break;
#endif
#ifdef HAVE_CHARSET
case CK_PanelSetPanelEncoding:
encoding_cmd ();
break;
#endif
case CK_QuickCdCmd:
quick_cd_cmd ();
break;
case CK_QuickChdirCmd:
quick_chdir_cmd ();
break;
case CK_QuickViewCmd:
quick_cmd_no_menu ();
break;
case CK_AddHotlist:
add2hotlist_cmd ();
case CK_QuietQuitCmd:
quiet_quit_cmd ();
break;
case CK_ExternalPanelize:
external_panelize ();
case CK_QuitCmd:
quit_cmd ();
break;
#ifdef WITH_BACKGROUND
case CK_JobsCmd:
jobs_cmd ();
case CK_RenameCmd:
rename_cmd ();
break;
case CK_RereadCmd:
reread_cmd ();
break;
#ifdef USE_VFS
case CK_ReselectVfs:
reselect_vfs ();
break;
#endif
case CK_ToggleShowHidden:
toggle_show_hidden ();
case CK_ReverseSelectionCmd:
reverse_selection_cmd ();
break;
case CK_SaveSetupCmd:
save_setup_cmd ();
break;
case CK_SelectCmd:
select_cmd ();
break;
case CK_ShowCommandLine:
view_other_cmd ();
break;
case CK_SingleDirsizeCmd:
smart_dirsize_cmd ();
break;
#if defined (USE_NETCODE) && defined (WITH_SMBFS)
case CK_SmblinkCmd:
smblink_cmd ();
break;
#endif
case CK_Sort:
sort_cmd ();
break;
case CK_StartExtMap1:
ctl_x_cmd ();
break;
case CK_SuspendCmd:
suspend_cmd ();
break;
case CK_SwapCmd:
swap_cmd ();
break;
case CK_SymlinkCmd:
symlink_cmd ();
break;
case CK_ToggleListingCmd:
toggle_listing_cmd ();
break;
case CK_ToggleShowHidden:
toggle_show_hidden ();
break;
case CK_TreeCmd:
tree_cmd ();
break;
case CK_TreeBoxCmd:
treebox_cmd ();
break;
#ifdef USE_EXT2FSLIB
case CK_UndeleteCmd:
undelete_cmd ();
break;
#endif
case CK_UnselectCmd:
unselect_cmd ();
break;
case CK_UserMenuCmd:
user_file_menu_cmd ();
break;
case CK_ViewCmd:
view_cmd ();
break;
case CK_ViewFileCmd:
view_file_cmd ();
break;
default:
res = MSG_NOT_HANDLED;
}
@ -1290,7 +1427,6 @@ static void
setup_mc (void)
{
setup_pre ();
init_menu ();
create_panels ();
setup_panels ();
@ -1453,7 +1589,7 @@ midnight_callback (struct Dlg_head *h, dlg_msg_t msg, int parm)
}
/* FIXME: should handle all menu shortcuts before this point */
if (the_menubar->active)
if (the_menubar->is_active)
return MSG_NOT_HANDLED;
if (parm == KEY_F (10)) {
@ -1568,7 +1704,7 @@ midnight_callback (struct Dlg_head *h, dlg_msg_t msg, int parm)
return MSG_HANDLED;
case DLG_POST_KEY:
if (!the_menubar->active)
if (!the_menubar->is_active)
update_dirty_panels ();
return MSG_HANDLED;
@ -1646,7 +1782,12 @@ load_hint (int force)
static void
setup_panels_and_run_mc (void)
{
midnight_dlg->menu_executor = midnight_execute_cmd;
midnight_dlg->get_shortcut = midnight_get_shortcut;
add_widget (midnight_dlg, the_menubar);
init_menu ();
add_widget (midnight_dlg, get_panel_widget (0));
add_widget (midnight_dlg, get_panel_widget (1));
add_widget (midnight_dlg, the_hint);
@ -1655,6 +1796,7 @@ setup_panels_and_run_mc (void)
add_widget (midnight_dlg, the_bar);
init_labels ();
if (boot_current_is_left)
dlg_select_widget (get_panel_widget (0));
else
@ -1720,7 +1862,7 @@ do_nc (void)
midnight_colors[2] = mc_skin_color_get("dialog", "hotnormal");
midnight_colors[3] = mc_skin_color_get("dialog", "hotfocus");
panel_init();
panel_init ();
midnight_dlg = create_dlg (0, 0, LINES, COLS, midnight_colors, midnight_callback,
"[main]", NULL, DLG_WANT_IDLE);
@ -1731,27 +1873,28 @@ do_nc (void)
setup_mc ();
/* start check display_codepage and source_codepage */
check_codeset();
check_codeset ();
main_map = default_main_map;
if (main_keymap && main_keymap->len > 0)
main_map = (global_key_map_t *) main_keymap->data;
main_map = (global_keymap_t *) main_keymap->data;
main_x_map = default_main_x_map;
if (main_x_keymap && main_x_keymap->len > 0)
main_x_map = (global_key_map_t *) main_x_keymap->data;
main_x_map = (global_keymap_t *) main_x_keymap->data;
panel_map = default_panel_keymap;
if (panel_keymap && panel_keymap->len > 0) {
panel_map = (global_key_map_t *) panel_keymap->data;
panel_map = (global_keymap_t *) panel_keymap->data;
}
input_map = default_input_keymap;
if (input_keymap && input_keymap->len > 0)
input_map = (global_key_map_t *) input_keymap->data;
input_map = (global_keymap_t *) input_keymap->data;
/* Check if we were invoked as an editor or file viewer */
if (!mc_maybe_editor_or_viewer ()) {
@ -1767,7 +1910,7 @@ do_nc (void)
done_mc ();
}
destroy_dlg (midnight_dlg);
panel_deinit();
panel_deinit ();
current_panel = 0;
done_mc_profile ();
}
@ -2100,7 +2243,7 @@ main (int argc, char *argv[])
flush_extension_file (); /* does only free memory */
mc_fhl_free (&mc_filehighlight);
mc_skin_deinit();
mc_skin_deinit ();
tty_shutdown ();

View File

@ -75,7 +75,10 @@ extern int is_right; /* If the selected menu was the right */
#define MENU_PANEL_IDX (is_right ? 1 : 0)
#define SELECTED_IS_PANEL (get_display_type (is_right ? 1 : 0) == view_listing)
#ifdef USE_INTERNAL_EDIT
extern GArray *editor_keymap;
extern GArray *editor_x_keymap;
#endif
extern GArray *viewer_keymap;
extern GArray *viewer_hex_keymap;
extern GArray *main_keymap;
@ -83,10 +86,12 @@ extern GArray *main_x_keymap;
extern GArray *panel_keymap;
extern GArray *input_keymap;
extern const global_key_map_t *panel_map;
extern const global_key_map_t *input_map;
extern const global_keymap_t *panel_map;
extern const global_keymap_t *input_map;
#ifdef HAVE_SUBSHELL_SUPPORT
void do_update_prompt (void);
#endif
enum cd_enum {
cd_parse_command,

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,22 @@
/* Header file for pulldown menu engine for Midnignt Commander
Copyright (C) 1994, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
2007, 2009 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
/** \file menu.h
* \brief Header: pulldown menu code
*/
@ -6,47 +24,51 @@
#ifndef MC_MENU_H
#define MC_MENU_H
#include "global.h"
#include "widget.h"
typedef void (*callfn) (void);
typedef struct {
char first_letter;
const char *label;
struct hotkey_t text;
callfn call_back;
} menu_entry;
typedef struct Menu {
struct hotkey_t text;
int count;
int max_entry_len;
int selected;
menu_entry *entries;
int start_x; /* position relative to menubar start */
char *help_node;
} Menu;
extern int menubar_visible;
typedef struct menu_entry_t {
unsigned char first_letter;
struct hotkey_t text;
int command;
char *shortcut;
} menu_entry_t;
menu_entry_t *menu_entry_create (const char *name, int command);
void menu_entry_free (menu_entry_t *me);
#define menu_separator_create() NULL
typedef struct Menu {
int start_x; /* position relative to menubar start */
struct hotkey_t text;
GList *entries;
size_t max_entry_len; /* cached max length of entry texts (text + shortcut) */
size_t max_hotkey_len; /* cached max length of shortcuts */
unsigned int selected; /* pointer to current menu entry */
char *help_node;
} Menu;
Menu *create_menu (const char *name, GList *entries,
const char *help_node);
void destroy_menu (Menu *menu);
/* The button bar menu */
typedef struct WMenu {
typedef struct WMenuBar {
Widget widget;
int active; /* If the menubar is in use */
int dropped; /* If the menubar has dropped */
Menu **menu; /* The actual menus */
int items;
int selected; /* Selected menu on the top bar */
int subsel; /* Selected entry on the submenu */
int max_entry_len; /* Cache value for the columns in a box */
int previous_widget; /* Selected widget ID before activating menu */
} WMenu;
gboolean is_active; /* If the menubar is in use */
gboolean is_dropped; /* If the menubar has dropped */
GList *menu; /* The actual menus */
unsigned int selected; /* Selected menu on the top bar */
int previous_widget; /* Selected widget ID before activating menu */
} WMenuBar;
Menu *create_menu (const char *name, menu_entry *entries, int count,
const char *help_node);
void destroy_menu (Menu *menu);
WMenu *menubar_new (int y, int x, int cols, Menu *menu[], int items);
void menubar_arrange (WMenu *menubar);
WMenuBar *menubar_new (int y, int x, int cols, GList *menu);
void menubar_set_menu (WMenuBar *menubar, GList *menu);
void menubar_add_menu (WMenuBar *menubar, Menu *menu);
void menubar_arrange (WMenuBar *menubar);
#endif
#endif /* MC_MENU_H */

View File

@ -61,7 +61,7 @@
#include "selcodepage.h" /* select_charset () */
#include "charsets.h" /* get_codepage_id () */
#include "cmddef.h" /* CK_ cmd name const */
#include "keybind.h" /* global_key_map_t */
#include "keybind.h" /* global_keymap_t */
#define ELEMENTS(arr) ( sizeof(arr) / sizeof((arr)[0]) )
@ -107,7 +107,7 @@ int filetype_mode = 1;
/* The hook list for the select file function */
Hook *select_file_hook = 0;
const global_key_map_t *panel_map;
const global_keymap_t *panel_map;
static cb_ret_t panel_callback (Widget *, widget_msg_t msg, int parm);
static int panel_event (Gpm_Event *event, void *);
@ -2635,12 +2635,12 @@ typedef void (*panel_key_callback) (WPanel *);
static void cmd_do_enter(WPanel *wp) { (void) do_enter(wp); }
static void cmd_view_simple(WPanel *wp) { (void) wp; view_simple_cmd(); }
static void cmd_edit_new(WPanel *wp) { (void) wp; edit_cmd_new(); }
static void cmd_copy_local(WPanel *wp) { (void) wp;copy_cmd_local(); }
static void cmd_rename_local(WPanel *wp) { (void) wp;ren_cmd_local(); }
static void cmd_delete_local(WPanel *wp) { (void) wp;delete_cmd_local(); }
static void cmd_select(WPanel *wp) { (void) wp;select_cmd(); }
static void cmd_unselect(WPanel *wp) { (void) wp;unselect_cmd(); }
static void cmd_reverse_selection(WPanel *wp) { (void) wp;reverse_selection_cmd(); }
static void cmd_copy_local(WPanel *wp) { (void) wp; copy_cmd_local(); }
static void cmd_rename_local(WPanel *wp) { (void) wp; rename_cmd_local(); }
static void cmd_delete_local(WPanel *wp) { (void) wp; delete_cmd_local(); }
static void cmd_select(WPanel *wp) { (void) wp; select_cmd(); }
static void cmd_unselect(WPanel *wp) { (void) wp; unselect_cmd(); }
static void cmd_reverse_selection(WPanel *wp) { (void) wp; reverse_selection_cmd(); }
static cb_ret_t
panel_execute_cmd (WPanel *panel, int command)
@ -2856,7 +2856,7 @@ panel_callback (Widget *w, widget_msg_t msg, int parm)
buttonbar_set_label (h, 3, Q_("ButtonBar|View"), view_cmd);
buttonbar_set_label (h, 4, Q_("ButtonBar|Edit"), edit_cmd);
buttonbar_set_label (h, 5, Q_("ButtonBar|Copy"), copy_cmd);
buttonbar_set_label (h, 6, Q_("ButtonBar|RenMov"), ren_cmd);
buttonbar_set_label (h, 6, Q_("ButtonBar|RenMov"), rename_cmd);
buttonbar_set_label (h, 7, Q_("ButtonBar|Mkdir"), mkdir_cmd);
buttonbar_set_label (h, 8, Q_("ButtonBar|Delete"), delete_cmd);
buttonbar_redraw (h);

View File

@ -200,7 +200,6 @@ static const struct {
#endif /* USE_VFS */
#ifdef USE_INTERNAL_EDIT
{ "editor_word_wrap_line_length", &option_word_wrap_line_length },
{ "editor_key_emulation", &edit_key_emulation },
{ "editor_tab_spacing", &option_tab_spacing },
{ "editor_fill_tabs_with_spaces", &option_fill_tabs_with_spaces },
{ "editor_return_does_auto_indent", &option_return_does_auto_indent },
@ -867,7 +866,7 @@ load_keys_from_section (const char *terminal, mc_config_t *cfg)
}
curr_values = values = mc_config_get_string_list (cfg, section_name, *profile_keys, &values_len);
key_code = lookup_key (*profile_keys);
key_code = lookup_key (*profile_keys, NULL);
if (key_code){
if (curr_values){
while (*curr_values){
@ -881,14 +880,14 @@ load_keys_from_section (const char *terminal, mc_config_t *cfg)
valcopy = convert_controls (value);
define_sequence (key_code, valcopy, MCKEY_NOACTION);
g_free (valcopy);
g_free(value);
g_free (value);
}
}
profile_keys++;
if (values)
g_strfreev(values);
g_strfreev (values);
}
g_strfreev(keys);
g_strfreev (keys);
g_free (section_name);
}
@ -965,28 +964,29 @@ load_keymap_defs (void)
if (mc_global_keymap != NULL)
{
editor_keymap = g_array_new(TRUE, FALSE, sizeof(global_key_map_t));
#ifdef USE_INTERNAL_EDIT
editor_keymap = g_array_new (TRUE, FALSE, sizeof (global_keymap_t));
load_keymap_from_section ("editor", editor_keymap, mc_global_keymap);
editor_x_keymap = g_array_new (TRUE, FALSE, sizeof (global_keymap_t));
load_keymap_from_section ("editor:xmap", editor_x_keymap, mc_global_keymap);
#endif
viewer_keymap = g_array_new(TRUE, FALSE, sizeof(global_key_map_t));
viewer_keymap = g_array_new (TRUE, FALSE, sizeof (global_keymap_t));
load_keymap_from_section ("viewer", viewer_keymap, mc_global_keymap);
viewer_hex_keymap = g_array_new(TRUE, FALSE, sizeof(global_key_map_t));
viewer_hex_keymap = g_array_new (TRUE, FALSE, sizeof (global_keymap_t));
load_keymap_from_section ("viewer:hex", viewer_hex_keymap, mc_global_keymap);
main_keymap = g_array_new(TRUE, FALSE, sizeof(global_key_map_t));
main_keymap = g_array_new (TRUE, FALSE, sizeof (global_keymap_t));
load_keymap_from_section ("main", main_keymap, mc_global_keymap);
main_x_keymap = g_array_new(TRUE, FALSE, sizeof(global_key_map_t));
main_x_keymap = g_array_new (TRUE, FALSE, sizeof (global_keymap_t));
load_keymap_from_section ("main:xmap", main_x_keymap, mc_global_keymap);
panel_keymap = g_array_new(TRUE, FALSE, sizeof(global_key_map_t));
panel_keymap = g_array_new (TRUE, FALSE, sizeof (global_keymap_t));
load_keymap_from_section ("panel", panel_keymap, mc_global_keymap);
input_keymap = g_array_new(TRUE, FALSE, sizeof(global_key_map_t));
input_keymap = g_array_new (TRUE, FALSE, sizeof (global_keymap_t));
load_keymap_from_section ("input", input_keymap, mc_global_keymap);
mc_config_deinit(mc_global_keymap);
mc_config_deinit (mc_global_keymap);
}
}

View File

@ -89,111 +89,110 @@ int double_click_speed = 250;
int old_esc_mode = 0;
int use_8th_bit_as_meta = 0;
/* This table is a mapping between names and the constants we use
* We use this to allow users to define alternate definitions for
* certain keys that may be missing from the terminal database
/* This table is a mapping between names and the constants we use
* We use this to allow users to define alternate definitions for
* certain keys that may be missing from the terminal database
*/
key_code_name_t key_name_conv_tab[] = {
/* KEY_F(0) is not here, since we are mapping it to f10, so there is no reason
to define f0 as well. Also, it makes Learn keys a bunch of problems :( */
{KEY_F (1), "f1", N_("Function key 1")},
{KEY_F (2), "f2", N_("Function key 2")},
{KEY_F (3), "f3", N_("Function key 3")},
{KEY_F (4), "f4", N_("Function key 4")},
{KEY_F (5), "f5", N_("Function key 5")},
{KEY_F (6), "f6", N_("Function key 6")},
{KEY_F (7), "f7", N_("Function key 7")},
{KEY_F (8), "f8", N_("Function key 8")},
{KEY_F (9), "f9", N_("Function key 9")},
{KEY_F (10), "f10", N_("Function key 10")},
{KEY_F (11), "f11", N_("Function key 11")},
{KEY_F (12), "f12", N_("Function key 12")},
{KEY_F (13), "f13", N_("Function key 13")},
{KEY_F (14), "f14", N_("Function key 14")},
{KEY_F (15), "f15", N_("Function key 15")},
{KEY_F (16), "f16", N_("Function key 16")},
{KEY_F (17), "f17", N_("Function key 17")},
{KEY_F (18), "f18", N_("Function key 18")},
{KEY_F (19), "f19", N_("Function key 19")},
{KEY_F (20), "f20", N_("Function key 20")},
{KEY_BACKSPACE, "bs", N_("Backspace key")},
{KEY_END, "end", N_("End key")},
{KEY_UP, "up", N_("Up arrow key")},
{KEY_DOWN, "down", N_("Down arrow key")},
{KEY_LEFT, "left", N_("Left arrow key")},
{KEY_RIGHT, "right", N_("Right arrow key")},
{KEY_HOME, "home", N_("Home key")},
{KEY_NPAGE, "pgdn", N_("Page Down key")},
{KEY_PPAGE, "pgup", N_("Page Up key")},
{KEY_IC, "ins", N_("Insert key")},
{KEY_DC, "delete", N_("Delete key")},
{ALT ('\t'), "complete", N_("Completion/M-tab")},
{KEY_KP_ADD, "kpplus", N_("+ on keypad")},
{KEY_KP_SUBTRACT, "kpminus", N_("- on keypad")},
{(int) '/', "kpslash", N_("Slash on keypad")},
{KEY_KP_MULTIPLY, "kpasterisk", N_("* on keypad")},
/* KEY_F(0) is not here, since we are mapping it to f10, so there is no reason
to define f0 as well. Also, it makes Learn keys a bunch of problems :( */
{ KEY_F (1), "f1", N_("Function key 1"), "F1" },
{ KEY_F (2), "f2", N_("Function key 2"), "F2" },
{ KEY_F (3), "f3", N_("Function key 3"), "F3" },
{ KEY_F (4), "f4", N_("Function key 4"), "F4" },
{ KEY_F (5), "f5", N_("Function key 5"), "F5" },
{ KEY_F (6), "f6", N_("Function key 6"), "F6" },
{ KEY_F (7), "f7", N_("Function key 7"), "F7" },
{ KEY_F (8), "f8", N_("Function key 8"), "F8" },
{ KEY_F (9), "f9", N_("Function key 9"), "F9" },
{ KEY_F (10), "f10", N_("Function key 10"), "F10" },
{ KEY_F (11), "f11", N_("Function key 11"), "F11" },
{ KEY_F (12), "f12", N_("Function key 12"), "F12" },
{ KEY_F (13), "f13", N_("Function key 13"), "F13" },
{ KEY_F (14), "f14", N_("Function key 14"), "F14" },
{ KEY_F (15), "f15", N_("Function key 15"), "F15" },
{ KEY_F (16), "f16", N_("Function key 16"), "F16" },
{ KEY_F (17), "f17", N_("Function key 17"), "F17" },
{ KEY_F (18), "f18", N_("Function key 18"), "F18" },
{ KEY_F (19), "f19", N_("Function key 19"), "F19" },
{ KEY_F (20), "f20", N_("Function key 20"), "F20" },
{ KEY_BACKSPACE, "backspace", N_("Backspace key"), "Backspace" },
{ KEY_END, "end", N_("End key"), "End" },
{ KEY_UP, "up", N_("Up arrow key"), "Up" },
{ KEY_DOWN, "down", N_("Down arrow key"), "Down" },
{ KEY_LEFT, "left", N_("Left arrow key"), "Left" },
{ KEY_RIGHT, "right", N_("Right arrow key"), "Right" },
{ KEY_HOME, "home", N_("Home key"), "Home" },
{ KEY_NPAGE, "pgdn", N_("Page Down key"), "PgDn" },
{ KEY_PPAGE, "pgup", N_("Page Up key"), "PgUp" },
{ KEY_IC, "insert", N_("Insert key"), "Ins" },
{ KEY_DC, "delete", N_("Delete key"), "Del" },
{ ALT ('\t'), "complete", N_("Completion/M-tab"), "Meta-Tab" },
{ KEY_KP_ADD, "kpplus", N_("+ on keypad"), "Gray+" },
{ KEY_KP_SUBTRACT, "kpminus", N_("- on keypad"), "Gray-" },
{ (int) '/', "kpslash", N_("Slash on keypad"), "/" },
{ KEY_KP_MULTIPLY, "kpasterisk", N_("* on keypad"), "Gray*" },
/* From here on, these won't be shown in Learn keys (no space) */
{KEY_LEFT, "kpleft", N_("Left arrow keypad")},
{KEY_RIGHT, "kpright", N_("Right arrow keypad")},
{KEY_UP, "kpup", N_("Up arrow keypad")},
{KEY_DOWN, "kpdown", N_("Down arrow keypad")},
{KEY_HOME, "kphome", N_("Home on keypad")},
{KEY_END, "kpend", N_("End on keypad")},
{KEY_NPAGE, "kpnpage", N_("Page Down keypad")},
{KEY_PPAGE, "kpppage", N_("Page Up keypad")},
{KEY_IC, "kpinsert", N_("Insert on keypad")},
{KEY_DC, "kpdelete", N_("Delete on keypad")},
{ESC_CHAR, "esc", N_("Escape key")},
{ESC_CHAR, "escape", N_("Escape key")},
{(int) '\n', "kpenter", N_("Enter on keypad")},
{KEY_F (21), "f21", N_("Function key 21")},
{KEY_F (22), "f22", N_("Function key 22")},
{KEY_F (23), "f23", N_("Function key 23")},
{KEY_F (24), "f24", N_("Function key 24")},
/* From here on, these won't be shown in Learn keys (no space) */
{ KEY_LEFT, "kpleft", N_("Left arrow keypad"), "Left" },
{ KEY_RIGHT, "kpright", N_("Right arrow keypad"), "Right" },
{ KEY_UP, "kpup", N_("Up arrow keypad"), "Up" },
{ KEY_DOWN, "kpdown", N_("Down arrow keypad"), "Down" },
{ KEY_HOME, "kphome", N_("Home on keypad"), "Home" },
{ KEY_END, "kpend", N_("End on keypad"), "End" },
{ KEY_NPAGE, "kpnpage", N_("Page Down keypad"), "PgDn" },
{ KEY_PPAGE, "kpppage", N_("Page Up keypad"), "PgUp" },
{ KEY_IC, "kpinsert", N_("Insert on keypad"), "Ins" },
{ KEY_DC, "kpdelete", N_("Delete on keypad"), "Del" },
{ (int) '\n', "kpenter", N_("Enter on keypad"), "Enter" },
{ KEY_F (21), "f21", N_("Function key 21"), "F21" },
{ KEY_F (22), "f22", N_("Function key 22"), "F22" },
{ KEY_F (23), "f23", N_("Function key 23"), "F23" },
{ KEY_F (24), "f24", N_("Function key 24"), "F24" },
/* Alternative label */
{KEY_BACKSPACE, "backspace", N_("Backspace key")},
{KEY_IC, "insert", N_("Insert key")},
{(int) '+', "plus", N_("Plus")},
{(int) '-', "minus", N_("Minus")},
{(int) '*', "asterisk", N_("Asterisk")},
{(int) '.', "dot", N_("Dot")},
{(int) '<', "lt", N_("Less than")},
{(int) '>', "gt", N_("Great than")},
{(int) '=', "equal", N_("Equal")},
{(int) ',', "comma", N_("Comma")},
{(int) '\'', "apostrophe", N_("Apostrophe")},
{(int) ':', "colon", N_("Colon")},
{(int) '!', "exclamation", N_("Exclamation mark")},
{(int) '?', "question", N_("Question mark")},
{(int) '&', "ampersand", N_("Ampersand")},
{(int) '$', "dollar", N_("Dollar sign")},
{(int) '"', "quota", N_("Quotation mark")},
{(int) '^', "caret", N_("Caret")},
{(int) '~', "tilda", N_("Tilda")},
{(int) '`', "prime", N_("Prime")},
{(int) '_', "underline", N_("Underline")},
{(int) '_', "understrike", N_("Understrike")},
{(int) '|', "pipe", N_("Pipe")},
{(int) '\n', "enter", N_("Enter")},
{(int) '\t', "tab", N_("Tab key")},
{(int) ' ', "space", N_("Space key")},
{(int) '/', "slash", N_("Slash key")},
{(int) '\\', "backslash", N_("Backslash key")},
{(int) '#', "number", N_("Number sign #")},
{(int) '#', "hash", N_("Number sign #")},
/* Alternative label */
{ KEY_BACKSPACE, "bs", N_("Backspace key"), "Bakspace" },
{ KEY_IC, "ins", N_("Insert key"), "Ins" },
{ KEY_DC, "del", N_("Delete key"), "Del" },
{ (int) '+', "plus", N_("Plus"), "+" },
{ (int) '-', "minus", N_("Minus"), "-" },
{ (int) '*', "asterisk", N_("Asterisk"), "*" },
{ (int) '.', "dot", N_("Dot"), "." },
{ (int) '<', "lt", N_("Less than"), "<" },
{ (int) '>', "gt", N_("Great than"), ">" },
{ (int) '=', "equal", N_("Equal"), "=" },
{ (int) ',', "comma", N_("Comma"), "," },
{ (int) '\'', "apostrophe", N_("Apostrophe"), "\'" },
{ (int) ':', "colon", N_("Colon"), ":" },
{ (int) '!', "exclamation", N_("Exclamation mark"), "!" },
{ (int) '?', "question", N_("Question mark"), "?" },
{ (int) '&', "ampersand", N_("Ampersand"), "&" },
{ (int) '$', "dollar", N_("Dollar sign"), "$" },
{ (int) '"', "quota", N_("Quotation mark"), "\"" },
{ (int) '^', "caret", N_("Caret"), "^" },
{ (int) '~', "tilda", N_("Tilda"), "~" },
{ (int) '`', "prime", N_("Prime"), "`" },
{ (int) '_', "underline", N_("Underline"), "_" },
{ (int) '_', "understrike", N_("Understrike"), "_" },
{ (int) '|', "pipe", N_("Pipe"), "|" },
{ (int) '\n', "enter", N_("Enter"), "Enter" },
{ (int) '\t', "tab", N_("Tab key"), "Tab" },
{ (int) ' ', "space", N_("Space key"), "Space" },
{ (int) '/', "slash", N_("Slash key"), "/" },
{ (int) '\\', "backslash", N_("Backslash key"), "\\" },
{ (int) '#', "number", N_("Number sign #"), "#" },
{ (int) '#', "hash", N_("Number sign #"), "#" },
/* meta keys */
{KEY_M_CTRL, "control", N_("Ctrl")},
{KEY_M_CTRL, "ctrl", N_("Ctrl")},
{KEY_M_ALT, "alt", N_("Alt")},
{KEY_M_ALT, "ralt", N_("Alt")},
{KEY_M_ALT, "meta", N_("Alt")},
{KEY_M_SHIFT, "shift", N_("Shift")},
/* meta keys */
{ KEY_M_CTRL, "control", N_("Ctrl"), "C" },
{ KEY_M_CTRL, "ctrl", N_("Ctrl"), "C" },
{ KEY_M_ALT, "meta", N_("Alt"), "M" },
{ KEY_M_ALT, "alt", N_("Alt"), "M" },
{ KEY_M_ALT, "ralt", N_("Alt"), "M" },
{ KEY_M_SHIFT, "shift", N_("Shift"), "S" },
{0, 0, 0}
{0, NULL, NULL, NULL }
};
@ -566,18 +565,18 @@ try_channels (int set_timeout)
FD_SET (input_fd, &select_set); /* Add stdin */
maxfdp = max (add_selects (&select_set), input_fd);
timeptr = NULL;
if (set_timeout) {
timeout.tv_sec = 0;
timeout.tv_usec = 100000;
timeptr = &timeout;
} else
timeptr = 0;
}
v = select (maxfdp + 1, &select_set, NULL, NULL, timeptr);
if (v > 0) {
check_selects (&select_set);
if (FD_ISSET (input_fd, &select_set))
return;
break;
}
}
}
@ -1230,67 +1229,128 @@ check_movement_keys (int key, int page_size, void *data, move_fn backfn,
return MSG_HANDLED;
}
int
lookup_keyname (char *keyname)
static int
lookup_keyname (const char *keyname, int *index)
{
int i;
if (keyname[0] != '\0') {
int i;
if (keyname[0] == '\0')
return 0;
if (keyname[1] == '\0')
return (int) keyname[0];
if (keyname[1] == '\0') {
*index = -1;
return (int) keyname[0];
}
for (i = 0; key_name_conv_tab[i].code; i++)
if (str_casecmp (key_name_conv_tab[i].name, keyname) == 0)
return key_name_conv_tab[i].code;
for (i = 0; key_name_conv_tab[i].code; i++)
if (str_casecmp (key_name_conv_tab[i].name, keyname) == 0) {
*index = i;
return key_name_conv_tab[i].code;
}
}
*index = -1;
return 0;
}
/* Return the code associated with the symbolic name keyname */
int
lookup_key (char *keyname)
lookup_key (const char *keyname, char **label)
{
char **keys, **p;
int k = -1;
char **keys;
guint keys_count = -1;
int key = 0;
int i = 0;
int index = -1;
int use_meta = -1;
int use_ctrl = -1;
int use_shift = -1;
if (keyname == NULL)
return 0;
return 0;
keys = g_strsplit_set (keyname, "-+ ", -1);
keys_count = g_strv_length (keys);
for (i = keys_count - 1; i >= 0; i--) {
if (keys[i] != NULL && keys[i][0] != 0) {
g_strstrip(keys[i]);
key = lookup_keyname (keys[i]);
keyname = g_strstrip (g_strdup (keyname));
p = keys = g_strsplit_set (keyname, "-+ ", -1);
g_free ((char *) keyname);
if (key & KEY_M_SHIFT) {
if (k < 127) {
k = (gchar) g_ascii_toupper ((gchar) k);
continue;
}
}
if (key & KEY_M_CTRL) {
if (k < 256)
k = XCTRL (k);
else
k |= key;
} else {
if (k == -1) {
if (key < 127)
key = (gchar) g_ascii_tolower ((gchar) key);
k = key;
} else
k |= key;
}
}
while ((p != NULL) && (*p != NULL)) {
if ((*p)[0] != '\0') {
int idx;
key = lookup_keyname (g_strstrip (*p), &idx);
if (key == KEY_M_ALT)
use_meta = idx;
else if (key == KEY_M_CTRL)
use_ctrl = idx;
else if (key == KEY_M_SHIFT)
use_shift = idx;
else {
k = key;
index = idx;
break;
}
}
p++;
}
g_strfreev (keys);
if (k == -1)
return 0;
/* output */
if (k <= 0)
return 0;
if (label != NULL) {
GString *s;
s = g_string_new ("");
if (use_meta != -1) {
g_string_append (s, key_name_conv_tab[use_meta].shortcut);
g_string_append_c (s, '-');
}
if (use_ctrl != -1) {
g_string_append (s, key_name_conv_tab[use_ctrl].shortcut);
g_string_append_c (s, '-');
}
if (use_shift != -1) {
if (k < 127)
g_string_append_c (s, (gchar) g_ascii_toupper ((gchar) k));
else {
g_string_append (s, key_name_conv_tab[use_shift].shortcut);
g_string_append_c (s, '-');
g_string_append (s, key_name_conv_tab[index].shortcut);
}
} else if (k < 128) {
if ((k >= 'A') || (index < 0)
|| (key_name_conv_tab[index].shortcut == NULL))
g_string_append_c (s, (gchar) g_ascii_tolower ((gchar) k));
else
g_string_append (s, key_name_conv_tab[index].shortcut);
} else if ((index != -1) && (key_name_conv_tab[index].shortcut != NULL))
g_string_append (s, key_name_conv_tab[index].shortcut);
else
g_string_append_c (s, (gchar) g_ascii_tolower ((gchar) key));
*label = g_string_free (s, FALSE);
}
if (use_shift != -1) {
if (k < 127)
k = g_ascii_toupper ((gchar) k);
else
k |= KEY_M_SHIFT;
}
if (use_ctrl != -1) {
if (k < 256)
k = XCTRL (k);
else
k |= KEY_M_CTRL;
}
if (use_meta != -1)
k = ALT (k);
return k;
}

View File

@ -21,13 +21,13 @@ void done_key (void);
typedef void (*move_fn) (void *data, int param);
cb_ret_t check_movement_keys (int key, int page_size, void *data,
move_fn backfn, move_fn forfn, move_fn topfn, move_fn bottomfn);
int lookup_keyname (char *keyname);
int lookup_key (char *keyname);
int lookup_key (const char *keyname, char **label);
typedef const struct {
int code;
const char *name;
const char *longname;
const char *shortcut;
} key_code_name_t;
extern key_code_name_t key_name_conv_tab[];
@ -69,7 +69,7 @@ void remove_select_channel (int fd);
void channels_up (void);
void channels_down (void);
#define XCTRL(x) (KEY_M_CTRL | ((x) & 31))
#define XCTRL(x) (KEY_M_CTRL | ((x) & 0x1F))
#define ALT(x) (KEY_M_ALT | (unsigned int)(x))
static inline gboolean

View File

@ -63,7 +63,7 @@
#include "../src/cmd.h"
#include "../src/execute.h"
#include "../src/help.h"
#include "../src/keybind.h" /* global_key_map_t */
#include "../src/keybind.h"
#include "../src/cmddef.h" /* CK_ cmd name const */

View File

@ -9,7 +9,7 @@
#include "../src/widget.h"
#include "../src/search/search.h"
#include "../src/keybind.h" /* global_key_map_t */
#include "../src/keybind.h" /* global_keymap_t */
/*** typedefs(not structures) and defined constants ********************/
@ -168,8 +168,8 @@ typedef struct mcview_struct {
GIConv converter;
/* keymaps */
const global_key_map_t *plain_map;
const global_key_map_t *hex_map;
const global_keymap_t *plain_map;
const global_keymap_t *hex_map;
/* handle of search engine */
mc_search_t *search;

View File

@ -172,11 +172,11 @@ mcview_set_keymap (mcview_t * view)
{
view->plain_map = default_viewer_keymap;
if (viewer_keymap && viewer_keymap->len > 0)
view->plain_map = (global_key_map_t *) viewer_keymap->data;
view->plain_map = (global_keymap_t *) viewer_keymap->data;
view->hex_map = default_viewer_hex_keymap;
if (viewer_hex_keymap && viewer_hex_keymap->len > 0)
view->hex_map = (global_key_map_t *) viewer_hex_keymap->data;
view->hex_map = (global_keymap_t *) viewer_hex_keymap->data;
}
/* --------------------------------------------------------------------------------------------- */

View File

@ -55,10 +55,10 @@
#include "strutil.h"
#include "cmddef.h" /* CK_ cmd name const */
#include "keybind.h" /* global_key_map_t */
#include "keybind.h" /* global_keymap_t */
#include "fileloc.h"
const global_key_map_t *input_map;
const global_keymap_t *input_map;
static void
widget_selectcolor (Widget *w, gboolean focused, gboolean hotkey)