1998-03-30 Miguel de Icaza <miguel@nuclecu.unam.mx>
* menu.c (destroy_menu): Implement destroy_menu for all of the ports as a routine that frees the menu entries if internationalization has been enabled. * wtools.c (quick_dialog_skip): Do not i18n any string that is empty. Sun Mar 29 23:02:09 1998 Alex Tkachenko <alex@bcs.zp.ua> * src/menu.[ch]: new member to menu_entry (hot_pos) introduced to make internationalized version of menu use externally defined hotkeys (denoted with preceding &). create_menu() fixed to load intl text of the entries. Some fixes around menu.c to enable usage of reloaded hotkeys. * main.c, editmenu.c: menu initialization code fixed to conform new menu structure. editmenu init code includes N_(..) now. * menu.c, layout.c, editwidget.c: bar menu items displacement is made dynamically upon initialization and window size changes. Mouse event processing is fixed accordingly. Sat Mar 28 13:18:36 1998 Alex Tkachenko <alex@bcs.zp.ua> * src/screen.c: (repaint_file) last patches to format_file() in the same file broke appearance of panels in brief mode -- fixed.
Этот коммит содержится в:
родитель
7967178200
Коммит
60c595aa91
@ -1,4 +1,4 @@
|
||||
VERSION=4.1.29
|
||||
VERSION=4.1.30
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
|
2
VERSION
2
VERSION
@ -1 +1 @@
|
||||
#define VERSION "4.1.29"
|
||||
#define VERSION "4.1.30"
|
||||
|
158
edit/editmenu.c
158
edit/editmenu.c
@ -114,142 +114,142 @@ void menu_options (void) { edit_options_dialog (); }
|
||||
|
||||
static menu_entry FileMenu[] =
|
||||
{
|
||||
{' ', "Open/load... C-o", 'O', menu_load_cmd},
|
||||
{' ', "New C-n", 'N', menu_new_cmd},
|
||||
{' ', N_("Open/load... C-o"), 'O', 0, menu_load_cmd},
|
||||
{' ', N_("New C-n"), 'N', 0, menu_new_cmd},
|
||||
{' ', "", ' ', 0},
|
||||
{' ', "Save F2", 'S', menu_save_cmd},
|
||||
{' ', "save As... F12", 'A', menu_save_as_cmd},
|
||||
{' ', N_("Save F2"), 'S', 0, menu_save_cmd},
|
||||
{' ', N_("save As... F12"), 'A', 5, menu_save_as_cmd},
|
||||
{' ', "", ' ', 0},
|
||||
{' ', "Insert file... F15", 'I', menu_insert_file_cmd},
|
||||
{' ', "copy to File... C-f", 'F', menu_cut_cmd},
|
||||
{' ', N_("Insert file... F15"), 'I', 0, menu_insert_file_cmd},
|
||||
{' ', N_("copy to File... C-f"), 'F', 8, menu_cut_cmd},
|
||||
{' ', "", ' ', 0},
|
||||
{' ', "aBout... ", 'B', edit_about_cmd},
|
||||
{' ', N_("aBout... "), 'B', 1, edit_about_cmd},
|
||||
{' ', "", ' ', 0},
|
||||
{' ', "Quit F10", 'Q', menu_quit_cmd}
|
||||
{' ', N_("Quit F10"), 'Q', 0, menu_quit_cmd}
|
||||
};
|
||||
|
||||
static menu_entry FileMenuEmacs[] =
|
||||
{
|
||||
{' ', "Open/load... C-o", 'O', menu_load_cmd},
|
||||
{' ', "New C-x k", 'N', menu_new_cmd},
|
||||
{' ', N_("Open/load... C-o"), 'O', 0, menu_load_cmd},
|
||||
{' ', N_("New C-x k"), 'N', 0, menu_new_cmd},
|
||||
{' ', "", ' ', 0},
|
||||
{' ', "Save F2", 'S', menu_save_cmd},
|
||||
{' ', "save As... F12", 'A', menu_save_as_cmd},
|
||||
{' ', N_("Save F2"), 'S', 0, menu_save_cmd},
|
||||
{' ', N_("save As... F12"), 'A', 5, menu_save_as_cmd},
|
||||
{' ', "", ' ', 0},
|
||||
{' ', "Insert file... F15", 'I', menu_insert_file_cmd},
|
||||
{' ', "copy to File... ", 'F', menu_cut_cmd},
|
||||
{' ', N_("Insert file... F15"), 'I', 0, menu_insert_file_cmd},
|
||||
{' ', N_("copy to File... "), 'F', 8, menu_cut_cmd},
|
||||
{' ', "", ' ', 0},
|
||||
{' ', "aBout... ", 'B', edit_about_cmd},
|
||||
{' ', N_("aBout... "), 'B', 1, edit_about_cmd},
|
||||
{' ', "", ' ', 0},
|
||||
{' ', "Quit F10", 'Q', menu_quit_cmd}
|
||||
{' ', N_("Quit F10"), 'Q', 0, menu_quit_cmd}
|
||||
};
|
||||
|
||||
static menu_entry EditMenu[] =
|
||||
{
|
||||
{' ', "Toggle Mark F3", 'T', menu_mark_cmd},
|
||||
{' ', N_("Toggle Mark F3"), 'T', 0, menu_mark_cmd},
|
||||
{' ', "", ' ', 0},
|
||||
{' ', "toggle Ins/overw Ins", 'I', menu_ins_cmd},
|
||||
{' ', N_("toggle Ins/overw Ins"), 'I', 7, menu_ins_cmd},
|
||||
{' ', "", ' ', 0},
|
||||
{' ', "Copy F5", 'C', menu_copy_cmd},
|
||||
{' ', "Move F6", 'M', menu_move_cmd},
|
||||
{' ', "Delete F8", 'D', menu_delete_cmd},
|
||||
{' ', N_("Copy F5"), 'C', 0, menu_copy_cmd},
|
||||
{' ', N_("Move F6"), 'M', 0, menu_move_cmd},
|
||||
{' ', N_("Delete F8"), 'D', 0, menu_delete_cmd},
|
||||
{' ', "", ' ', 0},
|
||||
{' ', "Undo C-u", 'U', menu_undo_cmd},
|
||||
{' ', N_("Undo C-u"), 'U', 0, menu_undo_cmd},
|
||||
{' ', "", ' ', 0},
|
||||
{' ', "Beginning C-PgUp", 'B', menu_beginning_cmd},
|
||||
{' ', "End C-PgDn", 'E', menu_end_cmd}
|
||||
{' ', N_("Beginning C-PgUp"), 'B', 0, menu_beginning_cmd},
|
||||
{' ', N_("End C-PgDn"), 'E', 0, menu_end_cmd}
|
||||
};
|
||||
|
||||
static menu_entry EditMenuEmacs[] =
|
||||
{
|
||||
{' ', "Toggle Mark F3", 'T', menu_mark_cmd},
|
||||
{' ', N_("Toggle Mark F3"), 'T', 0, menu_mark_cmd},
|
||||
{' ', "", ' ', 0},
|
||||
{' ', "toggle Ins/overw Ins", 'I', menu_ins_cmd},
|
||||
{' ', N_("toggle Ins/overw Ins"), 'I', 7, menu_ins_cmd},
|
||||
{' ', "", ' ', 0},
|
||||
{' ', "Copy F5", 'C', menu_copy_cmd},
|
||||
{' ', "Move F6", 'M', menu_move_cmd},
|
||||
{' ', "Delete F8", 'D', menu_delete_cmd},
|
||||
{' ', N_("Copy F5"), 'C', 0, menu_copy_cmd},
|
||||
{' ', N_("Move F6"), 'M', 0, menu_move_cmd},
|
||||
{' ', N_("Delete F8"), 'D', 0, menu_delete_cmd},
|
||||
{' ', "", ' ', 0},
|
||||
{' ', "Undo C-u", 'U', menu_undo_cmd},
|
||||
{' ', N_("Undo C-u"), 'U', 0, menu_undo_cmd},
|
||||
{' ', "", ' ', 0},
|
||||
{' ', "Beginning C-PgUp", 'B', menu_beginning_cmd},
|
||||
{' ', "End C-PgDn", 'E', menu_end_cmd}
|
||||
{' ', N_("Beginning C-PgUp"), 'B', 0, menu_beginning_cmd},
|
||||
{' ', N_("End C-PgDn"), 'E', 0, menu_end_cmd}
|
||||
};
|
||||
|
||||
static menu_entry SearReplMenu[] =
|
||||
{
|
||||
{' ', "Search... F7", 'S', menu_search_cmd},
|
||||
{' ', "search Again F17", 'A', menu_search_again_cmd},
|
||||
{' ', "Replace... F4", 'R', menu_replace_cmd}
|
||||
{' ', N_("Search... F7"), 'S', 0, menu_search_cmd},
|
||||
{' ', N_("search Again F17"), 'A', 7, menu_search_again_cmd},
|
||||
{' ', N_("Replace... F4"), 'R', 0, menu_replace_cmd}
|
||||
};
|
||||
|
||||
static menu_entry SearReplMenuEmacs[] =
|
||||
{
|
||||
{' ', "Search... F7", 'S', menu_search_cmd},
|
||||
{' ', "search Again F17", 'A', menu_search_again_cmd},
|
||||
{' ', "Replace... F4", 'R', menu_replace_cmd}
|
||||
{' ', N_("Search... F7"), 'S', 0, menu_search_cmd},
|
||||
{' ', N_("search Again F17"), 'A', 7, menu_search_again_cmd},
|
||||
{' ', N_("Replace... F4"), 'R', 0, menu_replace_cmd}
|
||||
};
|
||||
|
||||
static menu_entry CmdMenu[] =
|
||||
{
|
||||
{' ', "Goto line... M-l", 'G', menu_goto_line},
|
||||
{' ', N_("Goto line... M-l"), 'G', 0, menu_goto_line},
|
||||
{' ', "", ' ', 0},
|
||||
{' ', "insert Literal... C-q", 'L', menu_lit_cmd},
|
||||
{' ', N_("insert Literal... C-q"), 'L', 7, menu_lit_cmd},
|
||||
{' ', "", ' ', 0},
|
||||
{' ', "Refresh screen C-l", 'R', menu_refresh_cmd},
|
||||
{' ', N_("Refresh screen C-l"), 'R', 0, menu_refresh_cmd},
|
||||
{' ', "", ' ', 0},
|
||||
{' ', "Start record macro C-r", 'S', menu_begin_record_cmd},
|
||||
{' ', "Finish record macro... C-r", 'F', menu_end_record_cmd},
|
||||
{' ', "Execute macro... C-a, KEY", 'E', menu_exec_macro_cmd},
|
||||
{' ', "Delete macro... ", 'o', menu_exec_macro_delete_cmd},
|
||||
{' ', N_("Start record macro C-r"), 'S', 0, menu_begin_record_cmd},
|
||||
{' ', N_("Finish record macro... C-r"), 'F', 0, menu_end_record_cmd},
|
||||
{' ', N_("Execute macro... C-a, KEY"), 'E', 0, menu_exec_macro_cmd},
|
||||
{' ', N_("Delete macro... "), 'o',11, menu_exec_macro_delete_cmd},
|
||||
{' ', "", ' ', 0},
|
||||
{' ', "insert Date/time ", 'D', menu_date_cmd},
|
||||
{' ', N_("insert Date/time "), 'D', 7, menu_date_cmd},
|
||||
{' ', "", ' ', 0},
|
||||
{' ', "Format paragraph M-p", 'a', menu_format_paragraph},
|
||||
{' ', "'ispell' Spell Check C-p", 'P', menu_ispell_cmd},
|
||||
{' ', "Sort... M-t", 'O', menu_sort_cmd},
|
||||
{' ', "'indent' C Formatter F19", 'C', menu_c_form_cmd},
|
||||
{' ', "Mail... ", 'M', menu_mail_cmd}
|
||||
{' ', N_("Format paragraph M-p"), 'a', 4, menu_format_paragraph},
|
||||
{' ', N_("'ispell' Spell Check C-p"), 'p', 3, menu_ispell_cmd},
|
||||
{' ', N_("Sort... M-t"), 't', 3, menu_sort_cmd},
|
||||
{' ', N_("'indent' C Formatter F19"), 'C', 9, menu_c_form_cmd},
|
||||
{' ', N_("Mail... "), 'M', 0, menu_mail_cmd}
|
||||
};
|
||||
|
||||
static menu_entry CmdMenuEmacs[] =
|
||||
{
|
||||
{' ', "Goto line... M-l", 'G', menu_goto_line},
|
||||
{' ', N_("Goto line... M-l"), 'G', 0, menu_goto_line},
|
||||
{' ', "", ' ', 0},
|
||||
{' ', "insert Literal... C-q", 'L', menu_lit_cmd},
|
||||
{' ', N_("insert Literal... C-q"), 'L', 7, menu_lit_cmd},
|
||||
{' ', "", ' ', 0},
|
||||
{' ', "Refresh screen C-l", 'R', menu_refresh_cmd},
|
||||
{' ', N_("Refresh screen C-l"), 'R', 0, menu_refresh_cmd},
|
||||
{' ', "", ' ', 0},
|
||||
{' ', "Start record macro C-r", 'S', menu_begin_record_cmd},
|
||||
{' ', "Finish record macro... C-r", 'F', menu_end_record_cmd},
|
||||
{' ', "Execute macro... C-x e, KEY", 'E', menu_exec_macro_cmd},
|
||||
{' ', "Delete macro... ", 'o', menu_exec_macro_delete_cmd},
|
||||
{' ', N_("Start record macro C-r"), 'S', 0, menu_begin_record_cmd},
|
||||
{' ', N_("Finish record macro... C-r"), 'F', 0, menu_end_record_cmd},
|
||||
{' ', N_("Execute macro... C-x e, KEY"), 'E', 0, menu_exec_macro_cmd},
|
||||
{' ', N_("Delete macro... "), 'o',11, menu_exec_macro_delete_cmd},
|
||||
{' ', "", ' ', 0},
|
||||
{' ', "insert Date/time ", 'D', menu_date_cmd},
|
||||
{' ', N_("insert Date/time "), 'D', 7, menu_date_cmd},
|
||||
{' ', "", ' ', 0},
|
||||
{' ', "Format paragraph M-p", 'a', menu_format_paragraph},
|
||||
{' ', "'ispell' Spell Check M-$", 'P', menu_ispell_cmd},
|
||||
{' ', "Sort... M-t", 'T', menu_sort_cmd},
|
||||
{' ', "'indent' C Formatter F19", 'C', menu_c_form_cmd}
|
||||
{' ', N_("Format paragraph M-p"), 'a', 4, menu_format_paragraph},
|
||||
{' ', N_("'ispell' Spell Check M-$"), 'P', 3, menu_ispell_cmd},
|
||||
{' ', N_("Sort... M-t"), 'T', 3, menu_sort_cmd},
|
||||
{' ', N_("'indent' C Formatter F19"), 'C', 9, menu_c_form_cmd}
|
||||
};
|
||||
|
||||
extern void menu_save_mode_cmd (void);
|
||||
|
||||
static menu_entry OptMenu[] =
|
||||
{
|
||||
{' ', "General... ", 'G', menu_options},
|
||||
{' ', "Save mode...", 'S', menu_save_mode_cmd}
|
||||
{' ', N_("General... "), 'G', 0, menu_options},
|
||||
{' ', N_("Save mode..."), 'S', 0, menu_save_mode_cmd}
|
||||
#if 0
|
||||
{' ', "Layout...", 'L', menu_layout_cmd}
|
||||
{' ', N_("Layout..."), 'L', 0, menu_layout_cmd}
|
||||
#endif
|
||||
};
|
||||
|
||||
static menu_entry OptMenuEmacs[] =
|
||||
{
|
||||
{' ', "General... ", 'G', menu_options},
|
||||
{' ', "Save mode...", 'S', menu_save_mode_cmd}
|
||||
{' ', N_("General... "), 'G', 0, menu_options},
|
||||
{' ', N_("Save mode..."), 'S', 0, menu_save_mode_cmd}
|
||||
#if 0
|
||||
{' ', "Layout...", 'L', menu_layout_cmd}
|
||||
{' ', N_("Layout..."), 'L', 0, menu_layout_cmd}
|
||||
#endif
|
||||
};
|
||||
|
||||
@ -260,20 +260,20 @@ Menu EditMenuBar[N_menus];
|
||||
|
||||
void edit_init_menu_normal (void)
|
||||
{
|
||||
EditMenuBar[0] = create_menu (" File ", FileMenu, menu_entries (FileMenu));
|
||||
EditMenuBar[1] = create_menu (" Edit ", EditMenu, menu_entries (EditMenu));
|
||||
EditMenuBar[2] = create_menu (" Sear/Repl ", SearReplMenu, menu_entries (SearReplMenu));
|
||||
EditMenuBar[3] = create_menu (" Command ", CmdMenu, menu_entries (CmdMenu));
|
||||
EditMenuBar[4] = create_menu (" Options ", OptMenu, menu_entries (OptMenu));
|
||||
EditMenuBar[0] = create_menu (_(" File "), FileMenu, menu_entries (FileMenu));
|
||||
EditMenuBar[1] = create_menu (_(" Edit "), EditMenu, menu_entries (EditMenu));
|
||||
EditMenuBar[2] = create_menu (_(" Sear/Repl "), SearReplMenu, menu_entries (SearReplMenu));
|
||||
EditMenuBar[3] = create_menu (_(" Command "), CmdMenu, menu_entries (CmdMenu));
|
||||
EditMenuBar[4] = create_menu (_(" Options "), OptMenu, menu_entries (OptMenu));
|
||||
}
|
||||
|
||||
void edit_init_menu_emacs (void)
|
||||
{
|
||||
EditMenuBar[0] = create_menu (" File ", FileMenuEmacs, menu_entries (FileMenuEmacs));
|
||||
EditMenuBar[1] = create_menu (" Edit ", EditMenuEmacs, menu_entries (EditMenuEmacs));
|
||||
EditMenuBar[2] = create_menu (" Sear/Repl ", SearReplMenuEmacs, menu_entries (SearReplMenuEmacs));
|
||||
EditMenuBar[3] = create_menu (" Command ", CmdMenuEmacs, menu_entries (CmdMenuEmacs));
|
||||
EditMenuBar[4] = create_menu (" Options ", OptMenuEmacs, menu_entries (OptMenuEmacs));
|
||||
EditMenuBar[0] = create_menu (_(" File "), FileMenuEmacs, menu_entries (FileMenuEmacs));
|
||||
EditMenuBar[1] = create_menu (_(" Edit "), EditMenuEmacs, menu_entries (EditMenuEmacs));
|
||||
EditMenuBar[2] = create_menu (_(" Sear/Repl "), SearReplMenuEmacs, menu_entries (SearReplMenuEmacs));
|
||||
EditMenuBar[3] = create_menu (_(" Command "), CmdMenuEmacs, menu_entries (CmdMenuEmacs));
|
||||
EditMenuBar[4] = create_menu (_(" Options "), OptMenuEmacs, menu_entries (OptMenuEmacs));
|
||||
}
|
||||
|
||||
void edit_done_menu (void)
|
||||
|
@ -937,6 +937,8 @@ void edit_adjust_size (Dlg_head * h)
|
||||
edit_bar = (WButtonBar *) edit->widget.parent->current->next->widget;
|
||||
widget_set_size (&edit->widget, 0, 0, LINES - 1, COLS);
|
||||
widget_set_size (&edit_bar->widget, LINES - 1, 0, 1, COLS);
|
||||
widget_set_size (&edit_menubar->widget, 0, 0, 1, COLS);
|
||||
menubar_arrange(edit_menubar);
|
||||
}
|
||||
|
||||
void edit_update_screen (WEdit * e)
|
||||
|
2
mc.spec
2
mc.spec
@ -1,6 +1,6 @@
|
||||
Summary: Midnight Commander visual shell
|
||||
Name: mc
|
||||
Version: 4.1.29
|
||||
Version: 4.1.30
|
||||
Release: 1
|
||||
Copyright: GPL
|
||||
Group: Shells
|
||||
|
@ -80,7 +80,7 @@ $(srcdir)/$(PACKAGE).pot: $(POTFILES)
|
||||
--add-comments --keyword=_ --keyword=N_ \
|
||||
--files-from=$(srcdir)/POTFILES.in
|
||||
rm -f $(srcdir)/$(PACKAGE).pot
|
||||
mv $(PACKAGE).po $(srcdir)/$(PACKAGE).pot
|
||||
-mv $(PACKAGE).po $(srcdir)/$(PACKAGE).pot
|
||||
|
||||
$(srcdir)/cat-id-tbl.c: stamp-cat-id; @:
|
||||
$(srcdir)/stamp-cat-id: $(PACKAGE).pot
|
||||
|
@ -1,6 +1,6 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Date: 1998-03-24 23:08:51-0600\n"
|
||||
"Date: 1998-03-25 12:58:38-0600\n"
|
||||
"From: Miguel de Icaza,computo,622-4680 <miguel@metropolis.nuclecu.unam.mx>\n"
|
||||
"Content-Type: text/plain; charset=\n"
|
||||
"Xgettext-Options: --default-domain=mc --directory=.. --add-comments --keyword=_ --keyword=N_ --files-from=./POTFILES.in\n"
|
||||
|
@ -1,7 +1,31 @@
|
||||
1998-03-30 Miguel de Icaza <miguel@nuclecu.unam.mx>
|
||||
|
||||
* menu.c (destroy_menu): Implement destroy_menu for all of the
|
||||
ports as a routine that frees the menu entries if
|
||||
internationalization has been enabled.
|
||||
|
||||
* wtools.c (quick_dialog_skip): Do not i18n any string that is empty.
|
||||
|
||||
Sun Mar 29 23:02:09 1998 Alex Tkachenko <alex@bcs.zp.ua>
|
||||
|
||||
* src/menu.[ch]: new member to menu_entry (hot_pos) introduced to make
|
||||
internationalized version of menu use externally defined hotkeys
|
||||
(denoted with preceding &). create_menu() fixed to load intl text of
|
||||
the entries. Some fixes around menu.c to enable usage of reloaded
|
||||
hotkeys.
|
||||
|
||||
* main.c, editmenu.c: menu initialization code fixed to conform new
|
||||
menu structure. editmenu init code includes N_(..) now.
|
||||
|
||||
* menu.c, layout.c, editwidget.c: bar menu items displacement is made
|
||||
dynamically upon initialization and window size changes. Mouse event
|
||||
processing is fixed accordingly.
|
||||
|
||||
Sat Mar 28 13:18:36 1998 Alex Tkachenko <alex@bcs.zp.ua>
|
||||
|
||||
* src/screen.c: (repaint_file) last patches to format_file() in the
|
||||
same file broke appearance of panels in brief mode -- fixed.
|
||||
|
||||
Wed Mar 25 19:05:31 1998 Norbert Warmuth <k3190@fh-sw.de>
|
||||
|
||||
* view.c (view_done): Set monitor off before deleting the view
|
||||
|
@ -435,6 +435,7 @@ void layout_change (void)
|
||||
how the panel are split (horizontal/vertical). */
|
||||
done_menu();
|
||||
init_menu();
|
||||
menubar_arrange(the_menubar);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -713,6 +714,8 @@ void change_screen_size (void)
|
||||
edit_adjust_size (edit_dlg);
|
||||
#endif
|
||||
|
||||
menubar_arrange(the_menubar);
|
||||
|
||||
/* Now, force the redraw */
|
||||
do_refresh ();
|
||||
touchwin (stdscr);
|
||||
|
122
src/main.c
122
src/main.c
@ -1116,71 +1116,71 @@ void init_menu () {};
|
||||
void done_menu () {};
|
||||
#else
|
||||
static menu_entry PanelMenu [] = {
|
||||
{ ' ', N_("Listing mode..."), 'L', listing_cmd },
|
||||
{ ' ', N_("Quick view C-x q"), 'Q', quick_view_cmd },
|
||||
{ ' ', N_("Info C-x i"), 'I', info_cmd },
|
||||
{ ' ', N_("Tree"), 'T', tree_cmd },
|
||||
{ ' ', N_("Listing mode..."), 'L', 0, listing_cmd },
|
||||
{ ' ', N_("Quick view C-x q"), 'Q', 0, quick_view_cmd },
|
||||
{ ' ', N_("Info C-x i"), 'I', 0, info_cmd },
|
||||
{ ' ', N_("Tree"), 'T', 0, tree_cmd },
|
||||
{ ' ', "", ' ', 0 },
|
||||
{ ' ', N_("Sort order..."), 'S', sort_cmd },
|
||||
{ ' ', N_("Sort order..."), 'S', 0, sort_cmd },
|
||||
{ ' ', "", ' ', 0 },
|
||||
{ ' ', N_("Filter..."), 'F', filter_cmd },
|
||||
{ ' ', N_("Filter..."), 'F', 0, filter_cmd },
|
||||
#ifdef USE_NETCODE
|
||||
{ ' ', "", ' ', 0 },
|
||||
{ ' ', N_("Network link..."), 'N', netlink_cmd },
|
||||
{ ' ', N_("FTP link..."), 'P', ftplink_cmd },
|
||||
{ ' ', N_("Network link..."), 'N', 0, netlink_cmd },
|
||||
{ ' ', N_("FTP link..."), 'P', 2, ftplink_cmd },
|
||||
#endif
|
||||
{ ' ', "", ' ', 0 },
|
||||
#ifdef OS2_NT
|
||||
{ ' ', N_("Drive... M-d"),ALT('d'), drive_cmd_a },
|
||||
{ ' ', N_("Drive... M-d"), ALT('d'), 0, drive_cmd_a },
|
||||
#endif
|
||||
{ ' ', N_("Rescan C-r"),XCTRL('R'), reread_cmd }
|
||||
{ ' ', N_("Rescan C-r"), XCTRL('R'), 0, reread_cmd }
|
||||
};
|
||||
|
||||
static menu_entry RightMenu [] = {
|
||||
{ ' ', N_("Listing mode..."), 'L', listing_cmd },
|
||||
{ ' ', N_("Quick view C-x q"), 'Q', quick_view_cmd },
|
||||
{ ' ', N_("Info C-x i"), 'I', info_cmd },
|
||||
{ ' ', N_("Tree"), 'T', tree_cmd },
|
||||
{ ' ', N_("Listing mode..."), 'L', 0, listing_cmd },
|
||||
{ ' ', N_("Quick view C-x q"), 'Q', 0, quick_view_cmd },
|
||||
{ ' ', N_("Info C-x i"), 'I', 0, info_cmd },
|
||||
{ ' ', N_("Tree"), 'T', 0, tree_cmd },
|
||||
{ ' ', "", ' ', 0 },
|
||||
{ ' ', N_("Sort order..."), 'S', sort_cmd },
|
||||
{ ' ', N_("Sort order..."), 'S', 0, sort_cmd },
|
||||
{ ' ', "", ' ', 0 },
|
||||
{ ' ', N_("Filter..."), 'F', filter_cmd },
|
||||
{ ' ', N_("Filter..."), 'F', 0, filter_cmd },
|
||||
#ifdef USE_NETCODE
|
||||
{ ' ', "", ' ', 0 },
|
||||
{ ' ', N_("Network link..."), 'N', netlink_cmd },
|
||||
{ ' ', N_("FTP link..."), 'P', ftplink_cmd },
|
||||
{ ' ', N_("Network link..."), 'N', 0, netlink_cmd },
|
||||
{ ' ', N_("FTP link..."), 'P', 2, ftplink_cmd },
|
||||
#endif
|
||||
{ ' ', "", ' ', 0 },
|
||||
#ifdef OS2_NT
|
||||
{ ' ', N_("Drive... M-d"),ALT('d'), drive_cmd_b },
|
||||
{ ' ', N_("Drive... M-d"), ALT('d'), 0, drive_cmd_b },
|
||||
#endif
|
||||
{ ' ', N_("Rescan C-r"),XCTRL('R'), reread_cmd }
|
||||
{ ' ', N_("Rescan C-r"), XCTRL('R'), 0, reread_cmd }
|
||||
};
|
||||
|
||||
static menu_entry FileMenu [] = {
|
||||
{ ' ', N_("User menu F2"), KEY_F(2), user_menu_cmd },
|
||||
{ ' ', N_("View F3"), KEY_F(3), view_cmd },
|
||||
{ ' ', N_("Filtered view M-!"), ALT('!'), filtered_view_cmd },
|
||||
{ ' ', N_("Edit F4"), KEY_F(4), edit_cmd },
|
||||
{ ' ', N_("Copy F5"), KEY_F(5), copy_cmd },
|
||||
{ ' ', N_("Chmod C-x c"), 'C', chmod_cmd },
|
||||
{ ' ', N_("User menu F2"), KEY_F(2), 0, user_menu_cmd },
|
||||
{ ' ', N_("View F3"), KEY_F(3), 0, view_cmd },
|
||||
{ ' ', N_("Filtered view M-!"), ALT('!'), 0, filtered_view_cmd },
|
||||
{ ' ', N_("Edit F4"), KEY_F(4), 0, edit_cmd },
|
||||
{ ' ', N_("Copy F5"), KEY_F(5), 2, copy_cmd },
|
||||
{ ' ', N_("Chmod C-x c"), 'C', 0, chmod_cmd },
|
||||
#ifndef OS2_NT
|
||||
{ ' ', N_("Link C-x l"), 'L', link_cmd },
|
||||
{ ' ', N_("SymLink C-x s"), 'S', symlink_cmd },
|
||||
{ ' ', N_("edit sYmlink C-x C-s"), 'Y', edit_symlink_cmd },
|
||||
{ ' ', N_("chOwn C-x o"), 'O', chown_cmd },
|
||||
{ ' ', N_("Advanced chown "), 'A', chown_advanced_cmd },
|
||||
{ ' ', N_("Link C-x l"), 'L', 0, link_cmd },
|
||||
{ ' ', N_("SymLink C-x s"), 'S', 0, symlink_cmd },
|
||||
{ ' ', N_("Edit symlink C-x C-s"), 'Y', 6, edit_symlink_cmd },
|
||||
{ ' ', N_("Chown C-x o"), 'O', 2, chown_cmd },
|
||||
{ ' ', N_("Advanced chown "), 'A', 0, chown_advanced_cmd },
|
||||
#endif
|
||||
{ ' ', N_("Rename/Move F6"), KEY_F(6), ren_cmd },
|
||||
{ ' ', N_("Mkdir F7"), KEY_F(7), mkdir_cmd },
|
||||
{ ' ', N_("Delete F8"), KEY_F(8), delete_cmd },
|
||||
{ ' ', N_("Quick cd M-c"), ALT('c'), quick_cd_cmd },
|
||||
{ ' ', N_("Rename/Move F6"), KEY_F(6), 0, ren_cmd },
|
||||
{ ' ', N_("Mkdir F7"), KEY_F(7), 0, mkdir_cmd },
|
||||
{ ' ', N_("Delete F8"), KEY_F(8), 0, delete_cmd },
|
||||
{ ' ', N_("Quick cd M-c"), ALT('c'), 0, quick_cd_cmd },
|
||||
{ ' ', "", ' ', 0 },
|
||||
{ ' ', N_("Select group M-+"), ALT('+'), select_cmd },
|
||||
{ ' ', N_("Unselect group M-\\"),ALT('\\'), unselect_cmd },
|
||||
{ ' ', N_("Reverse selection M-*"), ALT('*'), reverse_selection_cmd },
|
||||
{ ' ', N_("Select group M-+"), ALT('+'), 7, select_cmd },
|
||||
{ ' ', N_("Unselect group M-\\"),ALT('\\'), 1, unselect_cmd },
|
||||
{ ' ', N_("Reverse selection M-*"), ALT('*'), 13, reverse_selection_cmd },
|
||||
{ ' ', "", ' ', 0 },
|
||||
{ ' ', N_("Quit F10"), KEY_F(10), (callfn) quit_cmd }
|
||||
{ ' ', N_("Quit F10"), 'Q', 0, (callfn) quit_cmd }
|
||||
};
|
||||
|
||||
void external_panelize (void);
|
||||
@ -1189,51 +1189,51 @@ static menu_entry CmdMenu [] = {
|
||||
* as a panel still has some problems, I have not yet finished
|
||||
* the WTree widget port, sorry.
|
||||
*/
|
||||
{ ' ', N_("Directory tree"), 'D', tree_box },
|
||||
{ ' ', N_("Find file M-?"), ALT('?'), find_cmd },
|
||||
{ ' ', N_("Directory tree"), 'D', 0, tree_box },
|
||||
{ ' ', N_("Find file M-?"), ALT('?'), 0, find_cmd },
|
||||
#ifndef HAVE_XVIEW
|
||||
{ ' ', N_("Swap panels C-u"), XCTRL('u'), swap_cmd },
|
||||
{ ' ', N_("Switch panels on/off C-o"), XCTRL('o'), view_other_cmd },
|
||||
{ ' ', N_("sWap panels C-u"), XCTRL('u'), 1, swap_cmd },
|
||||
{ ' ', N_("switch Panels on/off C-o"), XCTRL('o'), 7, view_other_cmd },
|
||||
#endif
|
||||
{ ' ', N_("Compare directories"), 'C', compare_dirs_cmd },
|
||||
{ ' ', N_("eXternal panelize C-x !"),'X', external_panelize },
|
||||
{ ' ', N_("Compare directories C-x d"),'C', 0, compare_dirs_cmd },
|
||||
{ ' ', N_("eXternal panelize C-x !"),'X', 1, external_panelize },
|
||||
#ifdef HAVE_DUSUM
|
||||
{ ' ', N_("show directory sIzes"), 'I', dirsizes_cmd },
|
||||
{ ' ', N_("show directory sIzes"), 'I', 16, dirsizes_cmd },
|
||||
#endif
|
||||
{ ' ', "", ' ', 0 },
|
||||
{ ' ', N_("command History"), 'H', history_cmd },
|
||||
{ ' ', N_("Directory hotlist C-\\"), XCTRL('\\'), quick_chdir_cmd },
|
||||
{ ' ', N_("command History"), 'H', 8, history_cmd },
|
||||
{ ' ', N_("Directory hotlist C-\\"), XCTRL('\\'), 13, quick_chdir_cmd },
|
||||
#ifdef USE_VFS
|
||||
{ ' ', N_("Active VFS list C-x a"), 'A', reselect_vfs },
|
||||
{ ' ', N_("Active VFS list C-x a"), 'A', 0, reselect_vfs },
|
||||
#endif
|
||||
#ifdef WITH_BACKGROUND
|
||||
{ ' ', N_("Background jobs C-x j"), 'B', jobs_cmd },
|
||||
{ ' ', N_("Background jobs C-x j"), 'B', 0, jobs_cmd },
|
||||
#endif
|
||||
{ ' ', "", ' ', 0 },
|
||||
#ifdef USE_EXT2FSLIB
|
||||
{ ' ', N_("Undelete files (ext2fs only)"),'U', undelete_cmd },
|
||||
{ ' ', N_("Undelete files (ext2fs only)"),'U', 0, undelete_cmd },
|
||||
#endif
|
||||
#ifdef VERSION_4
|
||||
{ ' ', N_("Listing format edit"), 'L', listmode_cmd},
|
||||
{ ' ', N_("Listing format edit"), 'L', 0, listmode_cmd},
|
||||
#endif
|
||||
{ ' ', N_("Extension file edit"), 'E', ext_cmd },
|
||||
{ ' ', N_("Menu file edit"), 'M', menu_edit_cmd }
|
||||
{ ' ', N_("Extension file edit"), 'E', 0, ext_cmd },
|
||||
{ ' ', N_("Menu file edit"), 'M', 0, menu_edit_cmd }
|
||||
};
|
||||
|
||||
/* Must keep in sync with the constants in menu_cmd */
|
||||
static menu_entry OptMenu [] = {
|
||||
{ ' ', N_("Configuration..."), 'C', configure_box },
|
||||
{ ' ', N_("Layout..."), 'L', layout_cmd },
|
||||
{ ' ', N_("cOnfirmation..."), 'O', confirm_box },
|
||||
{ ' ', N_("Display bits..."), 'D', display_bits_box },
|
||||
{ ' ', N_("Configuration..."), 'C', 0, configure_box },
|
||||
{ ' ', N_("Layout..."), 'L', 0, layout_cmd },
|
||||
{ ' ', N_("cOnfirmation..."), 'O', 1, confirm_box },
|
||||
{ ' ', N_("Display bits..."), 'D', 0, display_bits_box },
|
||||
#if !defined(HAVE_X) && !defined(OS2_NT)
|
||||
{ ' ', N_("learn Keys..."), 'K', learn_keys },
|
||||
{ ' ', N_("learn Keys..."), 'K', 6, learn_keys },
|
||||
#endif
|
||||
#ifdef USE_VFS
|
||||
{ ' ', N_("Virtual FS..."), 'V', configure_vfs },
|
||||
{ ' ', N_("Virtual FS..."), 'V', 0, configure_vfs },
|
||||
#endif
|
||||
{ ' ', "", ' ', 0 },
|
||||
{ ' ', N_("Save setup"), 'S', save_setup_cmd }
|
||||
{ ' ', N_("Save setup"), 'S', 0, save_setup_cmd }
|
||||
};
|
||||
|
||||
#define menu_entries(x) sizeof(x)/sizeof(menu_entry)
|
||||
|
156
src/menu.c
156
src/menu.c
@ -46,7 +46,46 @@ Menu create_menu (char *name, menu_entry *entries, int count)
|
||||
menu->count = count;
|
||||
menu->max_entry_len = 0;
|
||||
menu->entries = entries;
|
||||
|
||||
#ifdef ENABLE_NLS
|
||||
if (entries != (menu_entry*) 0)
|
||||
{
|
||||
register menu_entry* mp;
|
||||
register char* cp;
|
||||
for (mp = entries; count--; mp++)
|
||||
{
|
||||
if (mp->text[0] == '\0')
|
||||
continue;
|
||||
|
||||
cp = _(mp->text);
|
||||
|
||||
if (mp->text != cp)
|
||||
{
|
||||
char tmpbuf[80]; /* hope it's long enough for menu entries */
|
||||
register char *src = cp, *dest = tmpbuf;
|
||||
while (*src)
|
||||
{
|
||||
if (*src == '&' && *++src)
|
||||
{
|
||||
/* Preserve non-ascii hotkeys */
|
||||
if (mp->hot_key <= 256)
|
||||
mp->hot_key = *src;
|
||||
mp->hot_pos = src-cp-1;
|
||||
continue;
|
||||
}
|
||||
*dest++ = *src++;
|
||||
}
|
||||
*dest = '\0';
|
||||
mp->text = strdup(tmpbuf);
|
||||
}
|
||||
}
|
||||
}
|
||||
menu->name = _(name);
|
||||
#else
|
||||
menu->name = name;
|
||||
#endif /* ENABLE_NLS */
|
||||
|
||||
menu->start_x = 0;
|
||||
return menu;
|
||||
}
|
||||
|
||||
@ -65,7 +104,10 @@ static void menubar_paint_idx (WMenu *menubar, int idx, int color)
|
||||
{
|
||||
const Menu menu = menubar->menu [menubar->selected];
|
||||
const int y = 2 + idx;
|
||||
const int x = (menubar->selected * 12) + 1;
|
||||
int x = menubar-> menu[menubar->selected]->start_x;
|
||||
|
||||
if (x + menubar->max_entry_len + 3 > menubar->widget.cols)
|
||||
x = menubar->widget.cols - menubar->max_entry_len - 3;
|
||||
|
||||
widget_move (&menubar->widget, y, x);
|
||||
attrset (color);
|
||||
@ -77,26 +119,15 @@ static void menubar_paint_idx (WMenu *menubar, int idx, int color)
|
||||
} else {
|
||||
char *text = menu->entries [idx].text;
|
||||
int hotkey = menu->entries [idx].hot_key;
|
||||
char *save;
|
||||
|
||||
int hotpos = menu->entries [idx].hot_pos;
|
||||
|
||||
printw ("%c%-s", menu->entries [idx].first_letter, text);
|
||||
|
||||
if (!slow_terminal){
|
||||
save = text;
|
||||
|
||||
/* First, try to highlight the hotkey */
|
||||
while (*text && *text != hotkey)
|
||||
text++;
|
||||
|
||||
if (!*text)
|
||||
text = save;
|
||||
|
||||
if (*text){
|
||||
widget_move (&menubar->widget, y, x+text-save+1);
|
||||
widget_move (&menubar->widget, y, x+hotpos+1);
|
||||
attrset (color == MENU_SELECTED_COLOR ?
|
||||
MENU_HOTSEL_COLOR : MENU_HOT_COLOR);
|
||||
addch (*text);
|
||||
}
|
||||
addch (text[hotpos]);
|
||||
}
|
||||
}
|
||||
widget_move (&menubar->widget, y, x + 1);
|
||||
@ -107,7 +138,10 @@ static INLINE void menubar_draw_drop (WMenu *menubar)
|
||||
const int count = (menubar->menu [menubar->selected])->count;
|
||||
int i;
|
||||
int sel = menubar->subsel;
|
||||
int column = (menubar->selected * 12);
|
||||
int column = menubar-> menu[menubar->selected]->start_x - 1;
|
||||
|
||||
if (column + menubar->max_entry_len + 4 > menubar->widget.cols)
|
||||
column = menubar->widget.cols - menubar->max_entry_len - 4;
|
||||
|
||||
attrset (SELECTED_COLOR);
|
||||
draw_box (menubar->widget.parent,
|
||||
@ -141,15 +175,15 @@ static void menubar_draw (WMenu *menubar)
|
||||
for (i = 0; i < items; i++){
|
||||
if (menubar->active)
|
||||
attrset(i == menubar->selected?MENU_SELECTED_COLOR:SELECTED_COLOR);
|
||||
widget_move (&menubar->widget, 0, menubar->widget.x + 2 + (i * 12));
|
||||
printw ("%s", _(menubar->menu [i]->name));
|
||||
widget_move (&menubar->widget, 0, menubar->menu [i]->start_x);
|
||||
printw ("%s", menubar->menu [i]->name);
|
||||
}
|
||||
|
||||
if (menubar->dropped)
|
||||
menubar_draw_drop (menubar);
|
||||
else
|
||||
widget_move (&menubar->widget, 0, menubar->widget.x + 3 +
|
||||
menubar->selected * 12);
|
||||
widget_move (&menubar->widget, 0,
|
||||
menubar-> menu[menubar->selected]->start_x);
|
||||
}
|
||||
|
||||
static INLINE void menubar_remove (WMenu *menubar)
|
||||
@ -283,7 +317,11 @@ static int menubar_handle_key (WMenu *menubar, int key)
|
||||
if (m < 256 && ISASCII (m))
|
||||
m = tolower (m);
|
||||
if (key != m)
|
||||
continue;
|
||||
{
|
||||
m = tolower (menu->entries[i].text[menu->entries[i].hot_pos]);
|
||||
if (key != m)
|
||||
continue;
|
||||
}
|
||||
|
||||
menubar_execute (menubar, i);
|
||||
return 1;
|
||||
@ -385,10 +423,12 @@ menubar_event (Gpm_Event *event, WMenu *menubar)
|
||||
return MOU_NORMAL;
|
||||
|
||||
new_selection = 0;
|
||||
if (event->x < menubar->items * 13)
|
||||
new_selection = event->x / 13;
|
||||
else
|
||||
new_selection = menubar->items - 1;
|
||||
while (new_selection < menubar->items
|
||||
&& event->x > menubar->menu[new_selection]->start_x
|
||||
)
|
||||
new_selection++;
|
||||
|
||||
--new_selection;
|
||||
|
||||
if (!was_active){
|
||||
menubar->selected = new_selection;
|
||||
@ -415,8 +455,14 @@ menubar_event (Gpm_Event *event, WMenu *menubar)
|
||||
return MOU_NORMAL;
|
||||
|
||||
/* Else, the mouse operation is on the menus or it is not */
|
||||
left_x = menubar->selected * 12;
|
||||
right_x = left_x + menubar->max_entry_len + 4;
|
||||
left_x = menubar->menu[menubar->selected]->start_x;
|
||||
right_x = left_x + menubar->max_entry_len + 4;
|
||||
if (right_x > menubar->widget.cols)
|
||||
{
|
||||
left_x = menubar->widget.cols - menubar->max_entry_len - 3;
|
||||
right_x = menubar->widget.cols - 1;
|
||||
}
|
||||
|
||||
bottom_y = (menubar->menu [menubar->selected])->count + 3;
|
||||
|
||||
if ((event->x > left_x) && (event->x < right_x) && (event->y < bottom_y)){
|
||||
@ -442,10 +488,59 @@ static void menubar_destroy (WMenu *menubar)
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* Properly space menubar items. Should be called when menubar is created
|
||||
* and also when widget width is changed (i.e. upon xterm resize).
|
||||
*/
|
||||
void
|
||||
menubar_arrange(WMenu* menubar)
|
||||
{
|
||||
register int i, start_x;
|
||||
int items = menubar->items;
|
||||
int gap = menubar->widget.cols - 2;
|
||||
|
||||
/* First, calculate gap between items... */
|
||||
for (i = 0; i < items; i++)
|
||||
{
|
||||
/* preserve length here, to be used below */
|
||||
gap -= (menubar->menu[i]->start_x = strlen(menubar->menu[i]->name));
|
||||
}
|
||||
gap /= (items - 1);
|
||||
|
||||
if (gap <= 0)
|
||||
{
|
||||
/* We are out of luck - window is too narrow... */
|
||||
gap = 1;
|
||||
}
|
||||
|
||||
/* ...and now fix start positions of menubar items */
|
||||
for (i = 0, start_x = 1; i < items; i++)
|
||||
{
|
||||
int len = menubar->menu[i]->start_x;
|
||||
menubar->menu[i]->start_x = start_x;
|
||||
start_x += len + gap;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
destroy_menu (Menu menu)
|
||||
{
|
||||
int i;
|
||||
menu_entry *e;
|
||||
|
||||
for (i = 0, e = menu->entries; i < menu->count; i++){
|
||||
#ifdef ENABLE_NLS
|
||||
free (e->text);
|
||||
#endif
|
||||
e++;
|
||||
}
|
||||
free (menu);
|
||||
}
|
||||
|
||||
WMenu *menubar_new (int y, int x, int cols, Menu menu [], int items)
|
||||
{
|
||||
WMenu *menubar = (WMenu *) xmalloc (sizeof (WMenu), "menubar_new");
|
||||
|
||||
|
||||
memset(menubar, 0, sizeof(*menubar)); /* FIXME: subsel used w/o being set */
|
||||
init_widget (&menubar->widget, y, x, 1, cols,
|
||||
(callback_fn) menubar_callback,
|
||||
@ -457,6 +552,7 @@ WMenu *menubar_new (int y, int x, int cols, Menu menu [], int items)
|
||||
menubar->items = items;
|
||||
menubar->selected = 0;
|
||||
widget_want_cursor (menubar->widget, 0);
|
||||
|
||||
menubar_arrange(menubar);
|
||||
|
||||
return menubar;
|
||||
}
|
||||
|
@ -18,6 +18,7 @@ typedef struct {
|
||||
char first_letter;
|
||||
char *text;
|
||||
int hot_key;
|
||||
int hot_pos;
|
||||
callfn call_back;
|
||||
} menu_entry;
|
||||
|
||||
@ -32,16 +33,13 @@ typedef struct {
|
||||
int max_entry_len;
|
||||
int selected;
|
||||
menu_entry *entries;
|
||||
int start_x; /* position relative to menubar start */
|
||||
} sMenu;
|
||||
typedef sMenu *Menu;
|
||||
#endif
|
||||
|
||||
Menu create_menu (char *name, menu_entry *entries, int count);
|
||||
#ifdef HAVE_XVIEW
|
||||
void destroy_menu (Menu menu);
|
||||
#else
|
||||
# define destroy_menu(x) free(x)
|
||||
#endif
|
||||
void destroy_menu (Menu menu);
|
||||
|
||||
extern int menubar_visible;
|
||||
|
||||
|
@ -575,10 +575,10 @@ repaint_file (WPanel *panel, int file_index, int mv, int attr, int isstatus)
|
||||
if (!isstatus && panel->split){
|
||||
|
||||
second_column = (file_index - panel->top_file) / llines (panel);
|
||||
width = (panel->widget.cols/2 - 2) - 1;
|
||||
width = (panel->widget.cols - 2)/2 - 1;
|
||||
|
||||
if (second_column){
|
||||
offset = 2 + width;
|
||||
offset = 1 + width;
|
||||
width = (panel->widget.cols-2) - (panel->widget.cols-2)/2 - 1;
|
||||
}
|
||||
} else
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user