mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 20:36:50 +03:00
New menu engine: use GList instead of GPtrArray.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
83b855027e
commit
c47d2d20d7
308
edit/editmenu.c
308
edit/editmenu.c
@ -373,216 +373,216 @@ menu_declare_forward (void)
|
||||
menu_cmd (CK_Load_Next_File);
|
||||
}
|
||||
|
||||
static GPtrArray *
|
||||
static GList *
|
||||
create_file_menu (void)
|
||||
{
|
||||
GPtrArray *entries = g_ptr_array_new ();
|
||||
GList *entries = NULL;
|
||||
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&Open file..."), menu_load_cmd));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&New C-n"), menu_new_cmd));
|
||||
g_ptr_array_add (entries, menu_separator_create ());
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&Save F2"), menu_save_cmd));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("Save &as... F12"), menu_save_as_cmd));
|
||||
g_ptr_array_add (entries, menu_separator_create ());
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&Insert file... F15"), menu_insert_file_cmd));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("Copy to &file... C-f"), menu_cut_cmd));
|
||||
g_ptr_array_add (entries, menu_separator_create ());
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&User menu... F11"), menu_user_menu_cmd));
|
||||
g_ptr_array_add (entries, menu_separator_create ());
|
||||
g_ptr_array_add (entries, menu_entry_create (_("A&bout... "), edit_about_cmd));
|
||||
g_ptr_array_add (entries, menu_separator_create ());
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&Quit F10"), menu_quit_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("&Open file..."), menu_load_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("&New C-n"), menu_new_cmd));
|
||||
entries = g_list_append (entries, menu_separator_create ());
|
||||
entries = g_list_append (entries, menu_entry_create (_("&Save F2"), menu_save_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("Save &as... F12"), menu_save_as_cmd));
|
||||
entries = g_list_append (entries, menu_separator_create ());
|
||||
entries = g_list_append (entries, menu_entry_create (_("&Insert file... F15"), menu_insert_file_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("Copy to &file... C-f"), menu_cut_cmd));
|
||||
entries = g_list_append (entries, menu_separator_create ());
|
||||
entries = g_list_append (entries, menu_entry_create (_("&User menu... F11"), menu_user_menu_cmd));
|
||||
entries = g_list_append (entries, menu_separator_create ());
|
||||
entries = g_list_append (entries, menu_entry_create (_("A&bout... "), edit_about_cmd));
|
||||
entries = g_list_append (entries, menu_separator_create ());
|
||||
entries = g_list_append (entries, menu_entry_create (_("&Quit F10"), menu_quit_cmd));
|
||||
|
||||
return entries;
|
||||
}
|
||||
|
||||
static GPtrArray *
|
||||
static GList *
|
||||
create_file_menu_emacs (void)
|
||||
{
|
||||
GPtrArray *entries = g_ptr_array_new ();
|
||||
GList *entries = NULL;
|
||||
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&Open file..."), menu_load_cmd));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&New C-x k"), menu_new_cmd));
|
||||
g_ptr_array_add (entries, menu_separator_create ());
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&Save F2"), menu_save_cmd));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("Save &as... F12"), menu_save_as_cmd));
|
||||
g_ptr_array_add (entries, menu_separator_create ());
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&Insert file... F15"), menu_insert_file_cmd));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("Copy to &file... "), menu_cut_cmd));
|
||||
g_ptr_array_add (entries, menu_separator_create ());
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&User menu... F11"), menu_user_menu_cmd));
|
||||
g_ptr_array_add (entries, menu_separator_create ());
|
||||
g_ptr_array_add (entries, menu_entry_create (_("A&bout... "), edit_about_cmd));
|
||||
g_ptr_array_add (entries, menu_separator_create ());
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&Quit F10"), menu_quit_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("&Open file..."), menu_load_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("&New C-x k"), menu_new_cmd));
|
||||
entries = g_list_append (entries, menu_separator_create ());
|
||||
entries = g_list_append (entries, menu_entry_create (_("&Save F2"), menu_save_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("Save &as... F12"), menu_save_as_cmd));
|
||||
entries = g_list_append (entries, menu_separator_create ());
|
||||
entries = g_list_append (entries, menu_entry_create (_("&Insert file... F15"), menu_insert_file_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("Copy to &file... "), menu_cut_cmd));
|
||||
entries = g_list_append (entries, menu_separator_create ());
|
||||
entries = g_list_append (entries, menu_entry_create (_("&User menu... F11"), menu_user_menu_cmd));
|
||||
entries = g_list_append (entries, menu_separator_create ());
|
||||
entries = g_list_append (entries, menu_entry_create (_("A&bout... "), edit_about_cmd));
|
||||
entries = g_list_append (entries, menu_separator_create ());
|
||||
entries = g_list_append (entries, menu_entry_create (_("&Quit F10"), menu_quit_cmd));
|
||||
|
||||
return entries;
|
||||
}
|
||||
|
||||
static GPtrArray *
|
||||
static GList *
|
||||
create_edit_menu (void)
|
||||
{
|
||||
GPtrArray *entries = g_ptr_array_new ();
|
||||
GList *entries = NULL;
|
||||
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&Toggle Mark F3"), menu_mark_cmd));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&Mark Columns S-F3"), menu_markcol_cmd));
|
||||
g_ptr_array_add (entries, menu_separator_create ());
|
||||
g_ptr_array_add (entries, menu_entry_create (_("Toggle &ins/overw Ins"), menu_ins_cmd));
|
||||
g_ptr_array_add (entries, menu_separator_create ());
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&Copy F5"), menu_copy_cmd));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&Move F6"), menu_move_cmd));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&Delete F8"), menu_delete_cmd));
|
||||
g_ptr_array_add (entries, menu_separator_create ());
|
||||
g_ptr_array_add (entries, menu_entry_create (_("C&opy to clipfile C-Ins"), menu_xstore_cmd));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("C&ut to clipfile S-Del"), menu_xcut_cmd));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&Paste from clipfile S-Ins"), menu_xpaste_cmd));
|
||||
g_ptr_array_add (entries, menu_separator_create ());
|
||||
g_ptr_array_add (entries, menu_entry_create (_("Toggle bookmar&k M-k"), menu_toggle_bookmark_cmd));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&Next bookmark M-j"), menu_next_bookmark_cmd));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("Pre&v bookmark M-i"), menu_prev_bookmark_cmd));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&Flush bookmark M-o"), menu_flush_bookmark_cmd));
|
||||
g_ptr_array_add (entries, menu_separator_create ());
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&Undo C-u"), menu_undo_cmd));
|
||||
g_ptr_array_add (entries, menu_separator_create ());
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&Beginning C-PgUp"), menu_beginning_cmd));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&End C-PgDn"), menu_end_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("&Toggle Mark F3"), menu_mark_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("&Mark Columns S-F3"), menu_markcol_cmd));
|
||||
entries = g_list_append (entries, menu_separator_create ());
|
||||
entries = g_list_append (entries, menu_entry_create (_("Toggle &ins/overw Ins"), menu_ins_cmd));
|
||||
entries = g_list_append (entries, menu_separator_create ());
|
||||
entries = g_list_append (entries, menu_entry_create (_("&Copy F5"), menu_copy_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("&Move F6"), menu_move_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("&Delete F8"), menu_delete_cmd));
|
||||
entries = g_list_append (entries, menu_separator_create ());
|
||||
entries = g_list_append (entries, menu_entry_create (_("C&opy to clipfile C-Ins"), menu_xstore_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("C&ut to clipfile S-Del"), menu_xcut_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("&Paste from clipfile S-Ins"), menu_xpaste_cmd));
|
||||
entries = g_list_append (entries, menu_separator_create ());
|
||||
entries = g_list_append (entries, menu_entry_create (_("Toggle bookmar&k M-k"), menu_toggle_bookmark_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("&Next bookmark M-j"), menu_next_bookmark_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("Pre&v bookmark M-i"), menu_prev_bookmark_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("&Flush bookmark M-o"), menu_flush_bookmark_cmd));
|
||||
entries = g_list_append (entries, menu_separator_create ());
|
||||
entries = g_list_append (entries, menu_entry_create (_("&Undo C-u"), menu_undo_cmd));
|
||||
entries = g_list_append (entries, menu_separator_create ());
|
||||
entries = g_list_append (entries, menu_entry_create (_("&Beginning C-PgUp"), menu_beginning_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("&End C-PgDn"), menu_end_cmd));
|
||||
|
||||
return entries;
|
||||
}
|
||||
|
||||
static GPtrArray *
|
||||
static GList *
|
||||
create_edit_menu_emacs (void)
|
||||
{
|
||||
GPtrArray *entries = g_ptr_array_new ();
|
||||
GList *entries = NULL;
|
||||
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&Toggle mark F3"), menu_mark_cmd));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("Mar&k columns S-F3"), menu_markcol_cmd));
|
||||
g_ptr_array_add (entries, menu_separator_create ());
|
||||
g_ptr_array_add (entries, menu_entry_create (_("Toggle &ins/overw Ins"), menu_ins_cmd));
|
||||
g_ptr_array_add (entries, menu_separator_create ());
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&Copy F5"), menu_copy_cmd));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&Move F6"), menu_move_cmd));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&Delete F8"), menu_delete_cmd));
|
||||
g_ptr_array_add (entries, menu_separator_create ());
|
||||
g_ptr_array_add (entries, menu_entry_create (_("C&opy to clipfile M-w"), menu_xstore_cmd));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("C&ut to clipfile C-w"), menu_xcut_cmd));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&Paste from clipfile C-y"), menu_xpaste_cmd));
|
||||
g_ptr_array_add (entries, menu_separator_create ());
|
||||
g_ptr_array_add (entries, menu_entry_create (_("Toggle bookmar&k "), menu_toggle_bookmark_cmd));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&Next bookmark "), menu_next_bookmark_cmd));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("Pre&v bookmark "), menu_prev_bookmark_cmd));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&Flush bookmark "), menu_flush_bookmark_cmd));
|
||||
g_ptr_array_add (entries, menu_separator_create ());
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&Undo C-u"), menu_undo_cmd));
|
||||
g_ptr_array_add (entries, menu_separator_create ());
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&Beginning C-PgUp"), menu_beginning_cmd));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&End C-PgDn"), menu_end_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("&Toggle mark F3"), menu_mark_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("Mar&k columns S-F3"), menu_markcol_cmd));
|
||||
entries = g_list_append (entries, menu_separator_create ());
|
||||
entries = g_list_append (entries, menu_entry_create (_("Toggle &ins/overw Ins"), menu_ins_cmd));
|
||||
entries = g_list_append (entries, menu_separator_create ());
|
||||
entries = g_list_append (entries, menu_entry_create (_("&Copy F5"), menu_copy_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("&Move F6"), menu_move_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("&Delete F8"), menu_delete_cmd));
|
||||
entries = g_list_append (entries, menu_separator_create ());
|
||||
entries = g_list_append (entries, menu_entry_create (_("C&opy to clipfile M-w"), menu_xstore_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("C&ut to clipfile C-w"), menu_xcut_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("&Paste from clipfile C-y"), menu_xpaste_cmd));
|
||||
entries = g_list_append (entries, menu_separator_create ());
|
||||
entries = g_list_append (entries, menu_entry_create (_("Toggle bookmar&k "), menu_toggle_bookmark_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("&Next bookmark "), menu_next_bookmark_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("Pre&v bookmark "), menu_prev_bookmark_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("&Flush bookmark "), menu_flush_bookmark_cmd));
|
||||
entries = g_list_append (entries, menu_separator_create ());
|
||||
entries = g_list_append (entries, menu_entry_create (_("&Undo C-u"), menu_undo_cmd));
|
||||
entries = g_list_append (entries, menu_separator_create ());
|
||||
entries = g_list_append (entries, menu_entry_create (_("&Beginning C-PgUp"), menu_beginning_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("&End C-PgDn"), menu_end_cmd));
|
||||
|
||||
return entries;
|
||||
}
|
||||
|
||||
static GPtrArray *
|
||||
static GList *
|
||||
create_search_replace_menu (void)
|
||||
{
|
||||
GPtrArray *entries = g_ptr_array_new ();
|
||||
GList *entries = NULL;
|
||||
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&Search... F7"), menu_search_cmd));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("Search &again F17"), menu_search_again_cmd));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&Replace... F4"), menu_replace_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("&Search... F7"), menu_search_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("Search &again F17"), menu_search_again_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("&Replace... F4"), menu_replace_cmd));
|
||||
|
||||
return entries;
|
||||
}
|
||||
|
||||
static GPtrArray *
|
||||
static GList *
|
||||
create_command_menu (void)
|
||||
{
|
||||
GPtrArray *entries = g_ptr_array_new ();
|
||||
GList *entries = NULL;
|
||||
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&Go to line... M-l"), menu_goto_line));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("Toggle li&ne state M-n"), menu_toggle_line_state));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("Go to matching &bracket M-b"), menu_goto_bracket));
|
||||
g_ptr_array_add (entries, menu_separator_create ());
|
||||
g_ptr_array_add (entries, menu_entry_create (_("Find declaration A-Enter"), menu_find_declare));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("Back from declaration M--"), menu_declare_back));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("Forward to declaration M-+"), menu_declare_forward));
|
||||
entries = g_list_append (entries, menu_entry_create (_("&Go to line... M-l"), menu_goto_line));
|
||||
entries = g_list_append (entries, menu_entry_create (_("Toggle li&ne state M-n"), menu_toggle_line_state));
|
||||
entries = g_list_append (entries, menu_entry_create (_("Go to matching &bracket M-b"), menu_goto_bracket));
|
||||
entries = g_list_append (entries, menu_separator_create ());
|
||||
entries = g_list_append (entries, menu_entry_create (_("Find declaration A-Enter"), menu_find_declare));
|
||||
entries = g_list_append (entries, menu_entry_create (_("Back from declaration M--"), menu_declare_back));
|
||||
entries = g_list_append (entries, menu_entry_create (_("Forward to declaration M-+"), menu_declare_forward));
|
||||
#ifdef HAVE_CHARSET
|
||||
g_ptr_array_add (entries, menu_separator_create ());
|
||||
g_ptr_array_add (entries, menu_entry_create (_("Encod&ing... M-e"), menu_select_codepage_cmd));
|
||||
entries = g_list_append (entries, menu_separator_create ());
|
||||
entries = g_list_append (entries, menu_entry_create (_("Encod&ing... M-e"), menu_select_codepage_cmd));
|
||||
#endif
|
||||
g_ptr_array_add (entries, menu_separator_create ());
|
||||
g_ptr_array_add (entries, menu_entry_create (_("Insert &literal... C-q"), menu_lit_cmd));
|
||||
g_ptr_array_add (entries, menu_separator_create ());
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&Refresh screen C-l"), menu_refresh_cmd));
|
||||
g_ptr_array_add (entries, menu_separator_create ());
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&Start record macro C-r"), menu_begin_record_cmd));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&Finish record macro... C-r"), menu_end_record_cmd));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&Execute macro... C-a, KEY"), menu_exec_macro_cmd));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("Delete macr&o... "), menu_exec_macro_delete_cmd));
|
||||
g_ptr_array_add (entries, menu_separator_create ());
|
||||
g_ptr_array_add (entries, menu_entry_create (_("Insert &date/time "), menu_date_cmd));
|
||||
g_ptr_array_add (entries, menu_separator_create ());
|
||||
g_ptr_array_add (entries, menu_entry_create (_("Format p&aragraph M-p"), menu_format_paragraph));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("'ispell' s&pell check C-p"), menu_ispell_cmd));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("Sor&t... M-t"), menu_sort_cmd));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("Paste o&utput of... M-u"), menu_ext_cmd));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("E&xternal Formatter F19"), menu_c_form_cmd));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&Mail... "), menu_mail_cmd));
|
||||
entries = g_list_append (entries, menu_separator_create ());
|
||||
entries = g_list_append (entries, menu_entry_create (_("Insert &literal... C-q"), menu_lit_cmd));
|
||||
entries = g_list_append (entries, menu_separator_create ());
|
||||
entries = g_list_append (entries, menu_entry_create (_("&Refresh screen C-l"), menu_refresh_cmd));
|
||||
entries = g_list_append (entries, menu_separator_create ());
|
||||
entries = g_list_append (entries, menu_entry_create (_("&Start record macro C-r"), menu_begin_record_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("&Finish record macro... C-r"), menu_end_record_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("&Execute macro... C-a, KEY"), menu_exec_macro_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("Delete macr&o... "), menu_exec_macro_delete_cmd));
|
||||
entries = g_list_append (entries, menu_separator_create ());
|
||||
entries = g_list_append (entries, menu_entry_create (_("Insert &date/time "), menu_date_cmd));
|
||||
entries = g_list_append (entries, menu_separator_create ());
|
||||
entries = g_list_append (entries, menu_entry_create (_("Format p&aragraph M-p"), menu_format_paragraph));
|
||||
entries = g_list_append (entries, menu_entry_create (_("'ispell' s&pell check C-p"), menu_ispell_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("Sor&t... M-t"), menu_sort_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("Paste o&utput of... M-u"), menu_ext_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("E&xternal Formatter F19"), menu_c_form_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("&Mail... "), menu_mail_cmd));
|
||||
|
||||
return entries;
|
||||
}
|
||||
|
||||
static GPtrArray *
|
||||
static GList *
|
||||
create_command_menu_emacs (void)
|
||||
{
|
||||
GPtrArray *entries = g_ptr_array_new ();
|
||||
GList *entries = NULL;
|
||||
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&Go to line... M-l"), menu_goto_line));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("Toggle li&ne state M-n"), menu_toggle_line_state));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("Go to matching &bracket M-b"), menu_goto_bracket));
|
||||
g_ptr_array_add (entries, menu_separator_create ());
|
||||
g_ptr_array_add (entries, menu_entry_create (_("Find declaration A-Enter"), menu_find_declare));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("Back from declaration M--"), menu_declare_back));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("Forward to declaration M-+"), menu_declare_forward));
|
||||
entries = g_list_append (entries, menu_entry_create (_("&Go to line... M-l"), menu_goto_line));
|
||||
entries = g_list_append (entries, menu_entry_create (_("Toggle li&ne state M-n"), menu_toggle_line_state));
|
||||
entries = g_list_append (entries, menu_entry_create (_("Go to matching &bracket M-b"), menu_goto_bracket));
|
||||
entries = g_list_append (entries, menu_separator_create ());
|
||||
entries = g_list_append (entries, menu_entry_create (_("Find declaration A-Enter"), menu_find_declare));
|
||||
entries = g_list_append (entries, menu_entry_create (_("Back from declaration M--"), menu_declare_back));
|
||||
entries = g_list_append (entries, menu_entry_create (_("Forward to declaration M-+"), menu_declare_forward));
|
||||
#ifdef HAVE_CHARSET
|
||||
g_ptr_array_add (entries, menu_separator_create ());
|
||||
g_ptr_array_add (entries, menu_entry_create (_("Encod&ing... C-t"), menu_select_codepage_cmd));
|
||||
entries = g_list_append (entries, menu_separator_create ());
|
||||
entries = g_list_append (entries, menu_entry_create (_("Encod&ing... C-t"), menu_select_codepage_cmd));
|
||||
#endif
|
||||
g_ptr_array_add (entries, menu_separator_create ());
|
||||
g_ptr_array_add (entries, menu_entry_create (_("Insert &literal... C-q"), menu_lit_cmd));
|
||||
g_ptr_array_add (entries, menu_separator_create ());
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&Refresh screen C-l"), menu_refresh_cmd));
|
||||
g_ptr_array_add (entries, menu_separator_create ());
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&Start record macro C-r"), menu_begin_record_cmd));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&Finish record macro... C-r"), menu_end_record_cmd));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&Execute macro... C-x e, KEY"), menu_exec_macro_cmd));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("Delete macr&o... "), menu_exec_macro_delete_cmd));
|
||||
g_ptr_array_add (entries, menu_separator_create ());
|
||||
g_ptr_array_add (entries, menu_entry_create (_("Insert &date/time "), menu_date_cmd));
|
||||
g_ptr_array_add (entries, menu_separator_create ());
|
||||
g_ptr_array_add (entries, menu_entry_create (_("Format p&aragraph M-p"), menu_format_paragraph));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("'ispell' s&pell check M-$"), menu_ispell_cmd));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("Sor&t... M-t"), menu_sort_cmd));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("Paste o&utput of... M-u"), menu_ext_cmd));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("E&xternal Formatter F19"), menu_c_form_cmd));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&Mail... "), menu_mail_cmd));
|
||||
entries = g_list_append (entries, menu_separator_create ());
|
||||
entries = g_list_append (entries, menu_entry_create (_("Insert &literal... C-q"), menu_lit_cmd));
|
||||
entries = g_list_append (entries, menu_separator_create ());
|
||||
entries = g_list_append (entries, menu_entry_create (_("&Refresh screen C-l"), menu_refresh_cmd));
|
||||
entries = g_list_append (entries, menu_separator_create ());
|
||||
entries = g_list_append (entries, menu_entry_create (_("&Start record macro C-r"), menu_begin_record_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("&Finish record macro... C-r"), menu_end_record_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("&Execute macro... C-x e, KEY"), menu_exec_macro_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("Delete macr&o... "), menu_exec_macro_delete_cmd));
|
||||
entries = g_list_append (entries, menu_separator_create ());
|
||||
entries = g_list_append (entries, menu_entry_create (_("Insert &date/time "), menu_date_cmd));
|
||||
entries = g_list_append (entries, menu_separator_create ());
|
||||
entries = g_list_append (entries, menu_entry_create (_("Format p&aragraph M-p"), menu_format_paragraph));
|
||||
entries = g_list_append (entries, menu_entry_create (_("'ispell' s&pell check M-$"), menu_ispell_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("Sor&t... M-t"), menu_sort_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("Paste o&utput of... M-u"), menu_ext_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("E&xternal Formatter F19"), menu_c_form_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("&Mail... "), menu_mail_cmd));
|
||||
|
||||
return entries;
|
||||
}
|
||||
|
||||
static GPtrArray *
|
||||
static GList *
|
||||
create_options_menu (void)
|
||||
{
|
||||
GPtrArray *entries = g_ptr_array_new ();
|
||||
GList *entries = NULL;
|
||||
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&General... "), edit_options_dialog));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&Save mode..."), menu_save_mode_cmd));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("Learn &Keys..."), learn_keys));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("Syntax &Highlighting..."), edit_syntax_dialog));
|
||||
g_ptr_array_add (entries, menu_separator_create ());
|
||||
g_ptr_array_add (entries, menu_entry_create (_("S&yntax file"), menu_edit_syntax_file_cmd));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&Menu file"), menu_edit_menu_file_cmd));
|
||||
g_ptr_array_add (entries, menu_separator_create ());
|
||||
g_ptr_array_add (entries, menu_entry_create (_("Save setu&p..."), save_setup_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("&General... "), edit_options_dialog));
|
||||
entries = g_list_append (entries, menu_entry_create (_("&Save mode..."), menu_save_mode_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("Learn &Keys..."), learn_keys));
|
||||
entries = g_list_append (entries, menu_entry_create (_("Syntax &Highlighting..."), edit_syntax_dialog));
|
||||
entries = g_list_append (entries, menu_separator_create ());
|
||||
entries = g_list_append (entries, menu_entry_create (_("S&yntax file"), menu_edit_syntax_file_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("&Menu file"), menu_edit_menu_file_cmd));
|
||||
entries = g_list_append (entries, menu_separator_create ());
|
||||
entries = g_list_append (entries, menu_entry_create (_("Save setu&p..."), save_setup_cmd));
|
||||
|
||||
return entries;
|
||||
}
|
||||
|
188
src/main.c
188
src/main.c
@ -666,162 +666,162 @@ listmode_cmd (void)
|
||||
#endif /* LISTMODE_EDITOR */
|
||||
|
||||
/* NOTICE: hotkeys specified here are overriden in menubar_paint_idx (alex) */
|
||||
static GPtrArray *
|
||||
static GList *
|
||||
create_left_menu (void)
|
||||
{
|
||||
GPtrArray *entries = g_ptr_array_new ();
|
||||
GList *entries = NULL;
|
||||
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&Listing mode..."), listing_cmd));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&Quick view C-x q"), quick_view_cmd));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&Info C-x i" ), info_cmd));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&Tree"), tree_cmd));
|
||||
g_ptr_array_add (entries, menu_separator_create ());
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&Sort order..."), sort_cmd));
|
||||
g_ptr_array_add (entries, menu_separator_create ());
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&Filter..."), filter_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("&Listing mode..."), listing_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("&Quick view C-x q"), quick_view_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("&Info C-x i" ), info_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("&Tree"), tree_cmd));
|
||||
entries = g_list_append (entries, menu_separator_create ());
|
||||
entries = g_list_append (entries, menu_entry_create (_("&Sort order..."), sort_cmd));
|
||||
entries = g_list_append (entries, menu_separator_create ());
|
||||
entries = g_list_append (entries, menu_entry_create (_("&Filter..."), filter_cmd));
|
||||
#ifdef HAVE_CHARSET
|
||||
g_ptr_array_add (entries, menu_separator_create ());
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&Encoding... M-e"), encoding_cmd));
|
||||
entries = g_list_append (entries, menu_separator_create ());
|
||||
entries = g_list_append (entries, menu_entry_create (_("&Encoding... M-e"), encoding_cmd));
|
||||
#endif
|
||||
#ifdef USE_NETCODE
|
||||
g_ptr_array_add (entries, menu_separator_create ());
|
||||
entries = g_list_append (entries, menu_separator_create ());
|
||||
#ifdef ENABLE_VFS_MCFS
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&Network link..."), netlink_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("&Network link..."), netlink_cmd));
|
||||
#endif
|
||||
g_ptr_array_add (entries, menu_entry_create (_("FT&P link..."), ftplink_cmd));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("S&hell link..."), fishlink_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("FT&P link..."), ftplink_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("S&hell link..."), fishlink_cmd));
|
||||
#ifdef WITH_SMBFS
|
||||
g_ptr_array_add (entries, menu_entry_create (_("SM&B link..."), smblink_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("SM&B link..."), smblink_cmd));
|
||||
#endif
|
||||
#endif
|
||||
g_ptr_array_add (entries, menu_separator_create ());
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&Rescan C-r"), reread_cmd));
|
||||
entries = g_list_append (entries, menu_separator_create ());
|
||||
entries = g_list_append (entries, menu_entry_create (_("&Rescan C-r"), reread_cmd));
|
||||
|
||||
return entries;
|
||||
}
|
||||
|
||||
static GPtrArray *
|
||||
static GList *
|
||||
create_right_menu (void)
|
||||
{
|
||||
GPtrArray *entries = g_ptr_array_new ();
|
||||
GList *entries = NULL;
|
||||
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&Listing mode..."), listing_cmd));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&Quick view C-x q"), quick_view_cmd));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&Info C-x i" ), info_cmd));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&Tree"), tree_cmd));
|
||||
g_ptr_array_add (entries, menu_separator_create ());
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&Sort order..."), sort_cmd));
|
||||
g_ptr_array_add (entries, menu_separator_create ());
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&Filter..."), filter_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("&Listing mode..."), listing_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("&Quick view C-x q"), quick_view_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("&Info C-x i" ), info_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("&Tree"), tree_cmd));
|
||||
entries = g_list_append (entries, menu_separator_create ());
|
||||
entries = g_list_append (entries, menu_entry_create (_("&Sort order..."), sort_cmd));
|
||||
entries = g_list_append (entries, menu_separator_create ());
|
||||
entries = g_list_append (entries, menu_entry_create (_("&Filter..."), filter_cmd));
|
||||
#ifdef HAVE_CHARSET
|
||||
g_ptr_array_add (entries, menu_separator_create ());
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&Encoding... M-e"), encoding_cmd));
|
||||
entries = g_list_append (entries, menu_separator_create ());
|
||||
entries = g_list_append (entries, menu_entry_create (_("&Encoding... M-e"), encoding_cmd));
|
||||
#endif
|
||||
#ifdef USE_NETCODE
|
||||
g_ptr_array_add (entries, menu_separator_create ());
|
||||
entries = g_list_append (entries, menu_separator_create ());
|
||||
#ifdef ENABLE_VFS_MCFS
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&Network link..."), netlink_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("&Network link..."), netlink_cmd));
|
||||
#endif
|
||||
g_ptr_array_add (entries, menu_entry_create (_("FT&P link..."), ftplink_cmd));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("S&hell link..."), fishlink_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("FT&P link..."), ftplink_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("S&hell link..."), fishlink_cmd));
|
||||
#ifdef WITH_SMBFS
|
||||
g_ptr_array_add (entries, menu_entry_create (_("SM&B link..."), smblink_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("SM&B link..."), smblink_cmd));
|
||||
#endif
|
||||
#endif
|
||||
g_ptr_array_add (entries, menu_separator_create ());
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&Rescan C-r"), reread_cmd));
|
||||
entries = g_list_append (entries, menu_separator_create ());
|
||||
entries = g_list_append (entries, menu_entry_create (_("&Rescan C-r"), reread_cmd));
|
||||
|
||||
return entries;
|
||||
}
|
||||
|
||||
static GPtrArray *
|
||||
static GList *
|
||||
create_file_menu (void)
|
||||
{
|
||||
GPtrArray *entries = g_ptr_array_new ();
|
||||
GList *entries = NULL;
|
||||
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&View F3"), view_cmd));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("Vie&w file... "), view_file_cmd));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&Filtered view M-!"), filtered_view_cmd));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&Edit F4"), edit_cmd));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&Copy F5"), copy_cmd));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("c&Hmod C-x c"), chmod_cmd));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&Link C-x l"), link_cmd));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&SymLink C-x s"), symlink_cmd));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("edit s&Ymlink C-x C-s"), edit_symlink_cmd));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("ch&Own C-x o"), chown_cmd));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&Advanced chown "), chown_advanced_cmd));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&Rename/Move F6"), ren_cmd));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&Mkdir F7"), mkdir_cmd));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&Delete F8"), delete_cmd));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&Quick cd M-c"), quick_cd_cmd));
|
||||
g_ptr_array_add (entries, menu_separator_create ());
|
||||
g_ptr_array_add (entries, menu_entry_create (_("select &Group M-+"), select_cmd));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("u&Nselect group M-\\"), unselect_cmd));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("reverse selec&Tion M-*"), reverse_selection_cmd));
|
||||
g_ptr_array_add (entries, menu_separator_create ());
|
||||
g_ptr_array_add (entries, menu_entry_create (_("e&Xit F10"), quit_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("&View F3"), view_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("Vie&w file... "), view_file_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("&Filtered view M-!"), filtered_view_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("&Edit F4"), edit_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("&Copy F5"), copy_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("c&Hmod C-x c"), chmod_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("&Link C-x l"), link_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("&SymLink C-x s"), symlink_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("edit s&Ymlink C-x C-s"), edit_symlink_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("ch&Own C-x o"), chown_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("&Advanced chown "), chown_advanced_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("&Rename/Move F6"), ren_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("&Mkdir F7"), mkdir_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("&Delete F8"), delete_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("&Quick cd M-c"), quick_cd_cmd));
|
||||
entries = g_list_append (entries, menu_separator_create ());
|
||||
entries = g_list_append (entries, menu_entry_create (_("select &Group M-+"), select_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("u&Nselect group M-\\"), unselect_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("reverse selec&Tion M-*"), reverse_selection_cmd));
|
||||
entries = g_list_append (entries, menu_separator_create ());
|
||||
entries = g_list_append (entries, menu_entry_create (_("e&Xit F10"), quit_cmd));
|
||||
|
||||
return entries;
|
||||
}
|
||||
|
||||
static GPtrArray *
|
||||
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.
|
||||
*/
|
||||
GPtrArray *entries = g_ptr_array_new ();
|
||||
GList *entries = NULL;
|
||||
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&User menu F2"), user_file_menu_cmd));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&Directory tree"), treebox_cmd));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&Find file M-?"), find_cmd));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("s&Wap panels C-u"), swap_cmd));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("switch &Panels on/off C-o"), view_other_cmd));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&Compare directories C-x d"), compare_dirs_cmd));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("e&Xternal panelize C-x !"), external_panelize));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("show directory s&Izes"), dirsizes_cmd));
|
||||
g_ptr_array_add (entries, menu_separator_create ());
|
||||
g_ptr_array_add (entries, menu_entry_create (_("command &History"), history_cmd));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("di&Rectory hotlist C-\\"), quick_chdir_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("&User menu F2"), user_file_menu_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("&Directory tree"), treebox_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("&Find file M-?"), find_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("s&Wap panels C-u"), swap_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("switch &Panels on/off C-o"), view_other_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("&Compare directories C-x d"), compare_dirs_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("e&Xternal panelize C-x !"), external_panelize));
|
||||
entries = g_list_append (entries, menu_entry_create (_("show directory s&Izes"), dirsizes_cmd));
|
||||
entries = g_list_append (entries, menu_separator_create ());
|
||||
entries = g_list_append (entries, menu_entry_create (_("command &History"), history_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("di&Rectory hotlist C-\\"), quick_chdir_cmd));
|
||||
#ifdef USE_VFS
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&Active VFS list C-x a"), reselect_vfs));
|
||||
entries = g_list_append (entries, menu_entry_create (_("&Active VFS list C-x a"), reselect_vfs));
|
||||
#endif
|
||||
#ifdef WITH_BACKGROUND
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&Background jobs C-x j"), jobs_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("&Background jobs C-x j"), jobs_cmd));
|
||||
#endif
|
||||
g_ptr_array_add (entries, menu_separator_create ());
|
||||
entries = g_list_append (entries, menu_separator_create ());
|
||||
#ifdef USE_EXT2FSLIB
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&Undelete files (ext2fs only)"), undelete_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("&Undelete files (ext2fs only)"), undelete_cmd));
|
||||
#endif
|
||||
#ifdef LISTMODE_EDITOR
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&Listing format edit"), listmode_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("&Listing format edit"), listmode_cmd));
|
||||
#endif
|
||||
#if defined (USE_EXT2FSLIB) || defined (LISTMODE_EDITOR)
|
||||
g_ptr_array_add (entries, menu_separator_create ());
|
||||
entries = g_list_append (entries, menu_separator_create ());
|
||||
#endif
|
||||
g_ptr_array_add (entries, menu_entry_create (_("Edit &extension file"), ext_cmd));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("Edit &menu file"), edit_mc_menu_cmd));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("Edit hi&ghlighting group file"), edit_fhl_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("Edit &extension file"), ext_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("Edit &menu file"), edit_mc_menu_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("Edit hi&ghlighting group file"), edit_fhl_cmd));
|
||||
|
||||
return entries;
|
||||
}
|
||||
|
||||
static GPtrArray *
|
||||
static GList *
|
||||
create_options_menu (void)
|
||||
{
|
||||
GPtrArray *entries = g_ptr_array_new ();
|
||||
GList *entries = NULL;
|
||||
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&Configuration..."), configure_box));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&Layout..."), layout_cmd));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("c&Onfirmation..."), confirm_box));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&Display bits..."), display_bits_box));
|
||||
g_ptr_array_add (entries, menu_entry_create (_("learn &Keys..."), learn_keys));
|
||||
entries = g_list_append (entries, menu_entry_create (_("&Configuration..."), configure_box));
|
||||
entries = g_list_append (entries, menu_entry_create (_("&Layout..."), layout_cmd));
|
||||
entries = g_list_append (entries, menu_entry_create (_("c&Onfirmation..."), confirm_box));
|
||||
entries = g_list_append (entries, menu_entry_create (_("&Display bits..."), display_bits_box));
|
||||
entries = g_list_append (entries, menu_entry_create (_("learn &Keys..."), learn_keys));
|
||||
#ifdef USE_VFS
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&Virtual FS..."), configure_vfs));
|
||||
entries = g_list_append (entries, menu_entry_create (_("&Virtual FS..."), configure_vfs));
|
||||
#endif
|
||||
g_ptr_array_add (entries, menu_separator_create ());
|
||||
g_ptr_array_add (entries, menu_entry_create (_("&Save setup"), save_setup_cmd));
|
||||
entries = g_list_append (entries, menu_separator_create ());
|
||||
entries = g_list_append (entries, menu_entry_create (_("&Save setup"), save_setup_cmd));
|
||||
|
||||
return entries;
|
||||
}
|
||||
@ -867,7 +867,7 @@ menu_cmd (void)
|
||||
if ((get_current_index () == 0) == (current_panel->active != 0))
|
||||
the_menubar->selected = 0;
|
||||
else
|
||||
the_menubar->selected = the_menubar->menu->len - 1;
|
||||
the_menubar->selected = g_list_length (the_menubar->menu) - 1;
|
||||
menu_last_selected_cmd ();
|
||||
}
|
||||
|
||||
|
153
src/menu.c
153
src/menu.c
@ -65,19 +65,16 @@ menu_entry_free (menu_entry_t *entry)
|
||||
}
|
||||
|
||||
static void
|
||||
menu_arrange (Menu* menu)
|
||||
menu_arrange (Menu *menu)
|
||||
{
|
||||
if (menu != NULL) {
|
||||
unsigned int i;
|
||||
GList *i;
|
||||
|
||||
for (i = 0; i < menu->entries->len; i++) {
|
||||
menu_entry_t *entry;
|
||||
size_t len;
|
||||
|
||||
entry = g_ptr_array_index (menu->entries, i);
|
||||
for (i = menu->entries; i != NULL; i = g_list_next (i)) {
|
||||
menu_entry_t *entry = i->data;
|
||||
|
||||
if (entry != NULL) {
|
||||
len = (size_t) hotkey_width (entry->text);
|
||||
const size_t len = (size_t) hotkey_width (entry->text);
|
||||
menu->max_entry_len = max (menu->max_entry_len, len);
|
||||
}
|
||||
}
|
||||
@ -85,7 +82,7 @@ menu_arrange (Menu* menu)
|
||||
}
|
||||
|
||||
Menu *
|
||||
create_menu (const char *name, GPtrArray *entries, const char *help_node)
|
||||
create_menu (const char *name, GList *entries, const char *help_node)
|
||||
{
|
||||
Menu *menu;
|
||||
|
||||
@ -105,8 +102,8 @@ void
|
||||
destroy_menu (Menu *menu)
|
||||
{
|
||||
release_hotkey (menu->text);
|
||||
g_ptr_array_foreach (menu->entries, (GFunc) menu_entry_free, NULL);
|
||||
g_ptr_array_free (menu->entries, TRUE);
|
||||
g_list_foreach (menu->entries, (GFunc) menu_entry_free, NULL);
|
||||
g_list_free (menu->entries);
|
||||
g_free (menu->help_node);
|
||||
g_free (menu);
|
||||
}
|
||||
@ -114,9 +111,7 @@ destroy_menu (Menu *menu)
|
||||
void
|
||||
menu_add_entry (Menu *menu, const char *name, menu_exec_fn cmd)
|
||||
{
|
||||
if (menu->entries == NULL)
|
||||
menu->entries = g_ptr_array_new ();
|
||||
g_ptr_array_add (menu->entries,
|
||||
menu->entries = g_list_append (menu->entries,
|
||||
menu_entry_create (name, cmd));
|
||||
menu_arrange (menu);
|
||||
}
|
||||
@ -124,16 +119,14 @@ menu_add_entry (Menu *menu, const char *name, menu_exec_fn cmd)
|
||||
void
|
||||
menu_add_separator (Menu *menu)
|
||||
{
|
||||
if (menu->entries == NULL)
|
||||
menu->entries = g_ptr_array_new ();
|
||||
g_ptr_array_add (menu->entries, menu_separator_create ());
|
||||
menu->entries = g_list_append (menu->entries, menu_separator_create ());
|
||||
}
|
||||
|
||||
static void
|
||||
menubar_paint_idx (WMenuBar *menubar, unsigned int idx, int color)
|
||||
{
|
||||
const Menu *menu = g_ptr_array_index (menubar->menu, menubar->selected);
|
||||
const menu_entry_t *entry = g_ptr_array_index (menu->entries, idx);
|
||||
const Menu *menu = g_list_nth_data (menubar->menu, menubar->selected);
|
||||
const menu_entry_t *entry = g_list_nth_data (menu->entries, idx);
|
||||
const int y = 2 + idx;
|
||||
int x = menu->start_x;
|
||||
|
||||
@ -178,8 +171,8 @@ menubar_paint_idx (WMenuBar *menubar, unsigned int idx, int color)
|
||||
static void
|
||||
menubar_draw_drop (WMenuBar *menubar)
|
||||
{
|
||||
const Menu *menu = g_ptr_array_index (menubar->menu, menubar->selected);
|
||||
const unsigned int count = menu->entries->len;
|
||||
const Menu *menu = g_list_nth_data (menubar->menu, menubar->selected);
|
||||
const unsigned int count = g_list_length (menu->entries);
|
||||
int column = menu->start_x - 1;
|
||||
unsigned int i;
|
||||
|
||||
@ -201,11 +194,11 @@ menubar_draw_drop (WMenuBar *menubar)
|
||||
}
|
||||
|
||||
static void
|
||||
menubar_set_color (WMenuBar *menubar, int current, gboolean hotkey)
|
||||
menubar_set_color (WMenuBar *menubar, gboolean current, gboolean hotkey)
|
||||
{
|
||||
if (!menubar->is_active)
|
||||
tty_setcolor (hotkey ? COLOR_HOT_FOCUS : SELECTED_COLOR);
|
||||
else if (current == menubar->selected)
|
||||
else if (current)
|
||||
tty_setcolor (hotkey ? MENU_HOTSEL_COLOR : MENU_SELECTED_COLOR);
|
||||
else
|
||||
tty_setcolor (hotkey ? MENU_HOT_COLOR : MENU_ENTRY_COLOR);
|
||||
@ -214,25 +207,26 @@ menubar_set_color (WMenuBar *menubar, int current, gboolean hotkey)
|
||||
static void
|
||||
menubar_draw (WMenuBar *menubar)
|
||||
{
|
||||
unsigned int i;
|
||||
GList *i;
|
||||
|
||||
/* First draw the complete menubar */
|
||||
tty_setcolor (menubar->is_active ? MENU_ENTRY_COLOR : SELECTED_COLOR);
|
||||
tty_draw_hline (menubar->widget.y, menubar->widget.x, ' ', menubar->widget.cols);
|
||||
|
||||
/* Now each one of the entries */
|
||||
for (i = 0; i < menubar->menu->len; i++) {
|
||||
Menu *menu = g_ptr_array_index (menubar->menu, i);
|
||||
for (i = menubar->menu; i != NULL; i = g_list_next (i)) {
|
||||
Menu *menu = i->data;
|
||||
gboolean is_selected = (menubar->selected == g_list_position (menubar->menu, i));
|
||||
|
||||
menubar_set_color (menubar, i, FALSE);
|
||||
menubar_set_color (menubar, is_selected, FALSE);
|
||||
widget_move (&menubar->widget, 0, menu->start_x);
|
||||
|
||||
tty_print_string (menu->text.start);
|
||||
|
||||
if (menu->text.hotkey != NULL) {
|
||||
menubar_set_color (menubar, i, TRUE);
|
||||
menubar_set_color (menubar, is_selected, TRUE);
|
||||
tty_print_string (menu->text.hotkey);
|
||||
menubar_set_color (menubar, i, FALSE);
|
||||
menubar_set_color (menubar, is_selected, FALSE);
|
||||
}
|
||||
|
||||
if (menu->text.end != NULL)
|
||||
@ -243,7 +237,7 @@ menubar_draw (WMenuBar *menubar)
|
||||
menubar_draw_drop (menubar);
|
||||
else
|
||||
widget_move (&menubar->widget, 0,
|
||||
((Menu *) g_ptr_array_index (menubar->menu,
|
||||
((Menu *) g_list_nth_data (menubar->menu,
|
||||
menubar->selected))->start_x);
|
||||
}
|
||||
|
||||
@ -262,7 +256,7 @@ menubar_left (WMenuBar *menubar)
|
||||
{
|
||||
menubar_remove (menubar);
|
||||
if (menubar->selected == 0)
|
||||
menubar->selected = menubar->menu->len - 1;
|
||||
menubar->selected = g_list_length (menubar->menu) - 1;
|
||||
else
|
||||
menubar->selected--;
|
||||
menubar_draw (menubar);
|
||||
@ -272,7 +266,7 @@ static void
|
||||
menubar_right (WMenuBar *menubar)
|
||||
{
|
||||
menubar_remove (menubar);
|
||||
menubar->selected = (menubar->selected + 1) % menubar->menu->len;
|
||||
menubar->selected = (menubar->selected + 1) % g_list_length (menubar->menu);
|
||||
menubar_draw (menubar);
|
||||
}
|
||||
|
||||
@ -299,8 +293,8 @@ menubar_drop (WMenuBar *menubar, unsigned int selected)
|
||||
static void
|
||||
menubar_execute (WMenuBar *menubar, unsigned int idx)
|
||||
{
|
||||
const Menu *menu = g_ptr_array_index (menubar->menu, menubar->selected);
|
||||
const menu_entry_t *entry = g_ptr_array_index (menu->entries, idx);
|
||||
const Menu *menu = g_list_nth_data (menubar->menu, menubar->selected);
|
||||
const menu_entry_t *entry = g_list_nth_data (menu->entries, idx);
|
||||
|
||||
if ((entry == NULL) || (entry->callback == NULL))
|
||||
return;
|
||||
@ -319,14 +313,15 @@ menubar_execute (WMenuBar *menubar, unsigned int idx)
|
||||
static void
|
||||
menubar_down (WMenuBar *menubar)
|
||||
{
|
||||
Menu *menu = g_ptr_array_index (menubar->menu, menubar->selected);
|
||||
Menu *menu = g_list_nth_data (menubar->menu, menubar->selected);
|
||||
const unsigned int len = g_list_length (menu->entries);
|
||||
menu_entry_t *entry;
|
||||
|
||||
menubar_paint_idx (menubar, menu->selected, MENU_ENTRY_COLOR);
|
||||
|
||||
do {
|
||||
menu->selected = (menu->selected + 1) % menu->entries->len;
|
||||
entry = (menu_entry_t *) g_ptr_array_index (menu->entries, menu->selected);
|
||||
menu->selected = (menu->selected + 1) % len;
|
||||
entry = (menu_entry_t *) g_list_nth_data (menu->entries, menu->selected);
|
||||
} while ((entry == NULL) || (entry->callback == NULL));
|
||||
|
||||
menubar_paint_idx (menubar, menu->selected, MENU_SELECTED_COLOR);
|
||||
@ -335,17 +330,18 @@ menubar_down (WMenuBar *menubar)
|
||||
static void
|
||||
menubar_up (WMenuBar *menubar)
|
||||
{
|
||||
Menu *menu = g_ptr_array_index (menubar->menu, menubar->selected);
|
||||
Menu *menu = g_list_nth_data (menubar->menu, menubar->selected);
|
||||
const unsigned int len = g_list_length (menu->entries);
|
||||
menu_entry_t *entry;
|
||||
|
||||
menubar_paint_idx (menubar, menu->selected, MENU_ENTRY_COLOR);
|
||||
|
||||
do {
|
||||
if (menu->selected == 0)
|
||||
menu->selected = menu->entries->len - 1;
|
||||
menu->selected = len - 1;
|
||||
else
|
||||
menu->selected--;
|
||||
entry = (menu_entry_t *) g_ptr_array_index (menu->entries, menu->selected);
|
||||
entry = (menu_entry_t *) g_list_nth_data (menu->entries, menu->selected);
|
||||
} while ((entry == NULL) || (entry->callback == NULL));
|
||||
|
||||
menubar_paint_idx (menubar, menu->selected, MENU_SELECTED_COLOR);
|
||||
@ -354,7 +350,7 @@ menubar_up (WMenuBar *menubar)
|
||||
static void
|
||||
menubar_first (WMenuBar *menubar)
|
||||
{
|
||||
Menu *menu = g_ptr_array_index (menubar->menu, menubar->selected);
|
||||
Menu *menu = g_list_nth_data (menubar->menu, menubar->selected);
|
||||
menu_entry_t *entry;
|
||||
|
||||
if (menu->selected == 0)
|
||||
@ -365,7 +361,7 @@ menubar_first (WMenuBar *menubar)
|
||||
menu->selected = 0;
|
||||
|
||||
while (TRUE) {
|
||||
entry = (menu_entry_t *) g_ptr_array_index (menu->entries, menu->selected);
|
||||
entry = (menu_entry_t *) g_list_nth_data (menu->entries, menu->selected);
|
||||
|
||||
if ((entry == NULL) || (entry->callback == NULL))
|
||||
menu->selected++;
|
||||
@ -379,19 +375,20 @@ menubar_first (WMenuBar *menubar)
|
||||
static void
|
||||
menubar_last (WMenuBar *menubar)
|
||||
{
|
||||
Menu *menu = g_ptr_array_index (menubar->menu, menubar->selected);
|
||||
Menu *menu = g_list_nth_data (menubar->menu, menubar->selected);
|
||||
const unsigned int len = g_list_length (menu->entries);
|
||||
menu_entry_t *entry;
|
||||
|
||||
if (menu->selected == menu->entries->len - 1)
|
||||
if (menu->selected == len - 1)
|
||||
return;
|
||||
|
||||
menubar_paint_idx (menubar, menu->selected, MENU_ENTRY_COLOR);
|
||||
|
||||
menu->selected = menu->entries->len;
|
||||
menu->selected = len;
|
||||
|
||||
do {
|
||||
menu->selected--;
|
||||
entry = (menu_entry_t *) g_ptr_array_index (menu->entries, menu->selected);
|
||||
entry = (menu_entry_t *) g_list_nth_data (menu->entries, menu->selected);
|
||||
} while ((entry == NULL) || (entry->callback == NULL));
|
||||
|
||||
menubar_paint_idx (menubar, menu->selected, MENU_SELECTED_COLOR);
|
||||
@ -414,7 +411,7 @@ menubar_handle_key (WMenuBar *menubar, int key)
|
||||
case KEY_F(1):
|
||||
if (menubar->is_dropped)
|
||||
interactive_display (NULL,
|
||||
((Menu *) g_ptr_array_index (menubar->menu,
|
||||
((Menu *) g_list_nth_data (menubar->menu,
|
||||
menubar->selected))->help_node);
|
||||
else
|
||||
interactive_display (NULL, "[Menu Bar]");
|
||||
@ -433,15 +430,15 @@ menubar_handle_key (WMenuBar *menubar, int key)
|
||||
}
|
||||
|
||||
if (!menubar->is_dropped) {
|
||||
unsigned int i;
|
||||
GList *i;
|
||||
|
||||
/* drop menu by hotkey */
|
||||
for (i = 0; i < menubar->menu->len; i++) {
|
||||
Menu *menu = g_ptr_array_index (menubar->menu, i);
|
||||
for (i = menubar->menu; i != NULL; i = g_list_next (i)) {
|
||||
Menu *menu = i->data;
|
||||
|
||||
if ((menu->text.hotkey != NULL)
|
||||
&& (key == g_ascii_tolower (menu->text.hotkey[0]))) {
|
||||
menubar_drop (menubar, i);
|
||||
menubar_drop (menubar, g_list_position (menubar->menu, i));
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@ -455,17 +452,17 @@ menubar_handle_key (WMenuBar *menubar, int key)
|
||||
}
|
||||
|
||||
{
|
||||
const Menu *menu = g_ptr_array_index (menubar->menu, menubar->selected);
|
||||
unsigned int i;
|
||||
const Menu *menu = g_list_nth_data (menubar->menu, menubar->selected);
|
||||
GList *i;
|
||||
|
||||
/* execute menu callback by hotkey */
|
||||
for (i = 0; i < menu->entries->len; i++) {
|
||||
const menu_entry_t *entry = g_ptr_array_index (menu->entries, i);
|
||||
for (i = menubar->menu; i != NULL; i = g_list_next (i)) {
|
||||
const menu_entry_t *entry = i->data;
|
||||
|
||||
if ((entry != NULL) && (entry->callback != NULL)
|
||||
&& (entry->text.hotkey != NULL)
|
||||
&& (key == g_ascii_tolower (entry->text.hotkey[0]))) {
|
||||
menubar_execute (menubar, i);
|
||||
menubar_execute (menubar, g_list_position (menubar->menu, i));
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@ -600,10 +597,11 @@ menubar_event (Gpm_Event *event, void *data)
|
||||
else if (event->buttons & GPM_B_DOWN)
|
||||
menubar_right (menubar);
|
||||
else {
|
||||
const unsigned int len = g_list_length (menubar->menu);
|
||||
int new_selection = 0;
|
||||
|
||||
while ((new_selection < menubar->menu->len)
|
||||
&& (event->x > ((Menu *) g_ptr_array_index (menubar->menu,
|
||||
while ((new_selection < len)
|
||||
&& (event->x > ((Menu *) g_list_nth_data (menubar->menu,
|
||||
new_selection))->start_x))
|
||||
new_selection++;
|
||||
|
||||
@ -628,13 +626,13 @@ menubar_event (Gpm_Event *event, void *data)
|
||||
/* middle click -- everywhere */
|
||||
if (((event->buttons & GPM_B_MIDDLE) != 0)
|
||||
&& ((event->type & GPM_DOWN) != 0)) {
|
||||
Menu *menu = (Menu *) g_ptr_array_index (menubar->menu, menubar->selected);
|
||||
Menu *menu = (Menu *) g_list_nth_data (menubar->menu, menubar->selected);
|
||||
menubar_execute (menubar, menu->selected);
|
||||
return MOU_NORMAL;
|
||||
}
|
||||
|
||||
/* the mouse operation is on the menus or it is not */
|
||||
menu = (Menu *) g_ptr_array_index (menubar->menu, menubar->selected);
|
||||
menu = (Menu *) g_list_nth_data (menubar->menu, menubar->selected);
|
||||
left_x = menu->start_x;
|
||||
right_x = left_x + menu->max_entry_len + 3;
|
||||
if (right_x > menubar->widget.cols) {
|
||||
@ -642,11 +640,11 @@ menubar_event (Gpm_Event *event, void *data)
|
||||
right_x = menubar->widget.cols;
|
||||
}
|
||||
|
||||
bottom_y = menu->entries->len + 3;
|
||||
bottom_y = g_list_length (menu->entries) + 3;
|
||||
|
||||
if ((event->x >= left_x) && (event->x <= right_x) && (event->y <= bottom_y)){
|
||||
int pos = event->y - 3;
|
||||
const menu_entry_t *entry = g_ptr_array_index (menu->entries, pos);
|
||||
const menu_entry_t *entry = g_list_nth_data (menu->entries, pos);
|
||||
|
||||
/* mouse wheel */
|
||||
if ((event->buttons & GPM_B_UP) && (event->type & GPM_DOWN)) {
|
||||
@ -659,7 +657,7 @@ menubar_event (Gpm_Event *event, void *data)
|
||||
}
|
||||
|
||||
/* ignore events above and below dropped down menu */
|
||||
if ((pos < 0) || (pos >= menu->entries->len))
|
||||
if ((pos < 0) || (pos >= bottom_y - 3))
|
||||
return MOU_NORMAL;
|
||||
|
||||
if ((entry != NULL) && (entry->callback != NULL)) {
|
||||
@ -680,7 +678,7 @@ menubar_event (Gpm_Event *event, void *data)
|
||||
}
|
||||
|
||||
WMenuBar *
|
||||
menubar_new (int y, int x, int cols, GPtrArray *menu)
|
||||
menubar_new (int y, int x, int cols, GList *menu)
|
||||
{
|
||||
WMenuBar *menubar = g_new0 (WMenuBar, 1);
|
||||
|
||||
@ -692,12 +690,12 @@ menubar_new (int y, int x, int cols, GPtrArray *menu)
|
||||
}
|
||||
|
||||
void
|
||||
menubar_set_menu (WMenuBar *menubar, GPtrArray *menu)
|
||||
menubar_set_menu (WMenuBar *menubar, GList *menu)
|
||||
{
|
||||
/* delete previous menu */
|
||||
if (menubar->menu != NULL) {
|
||||
g_ptr_array_foreach (menubar->menu, (GFunc) destroy_menu, NULL);
|
||||
g_ptr_array_free (menubar->menu, TRUE);
|
||||
g_list_foreach (menubar->menu, (GFunc) destroy_menu, NULL);
|
||||
g_list_free (menubar->menu);
|
||||
}
|
||||
/* add new menu */
|
||||
menubar->is_active = FALSE;
|
||||
@ -710,11 +708,8 @@ menubar_set_menu (WMenuBar *menubar, GPtrArray *menu)
|
||||
void
|
||||
menubar_add_menu (WMenuBar *menubar, Menu *menu)
|
||||
{
|
||||
if (menubar->menu == NULL)
|
||||
menubar->menu = g_ptr_array_new ();
|
||||
|
||||
if (menu != NULL)
|
||||
g_ptr_array_add (menubar->menu, menu);
|
||||
menubar->menu = g_list_append (menubar->menu, menu);
|
||||
|
||||
menubar_arrange (menubar);
|
||||
}
|
||||
@ -727,17 +722,17 @@ void
|
||||
menubar_arrange (WMenuBar* menubar)
|
||||
{
|
||||
int start_x = 1;
|
||||
unsigned int i;
|
||||
GList *i;
|
||||
int gap;
|
||||
|
||||
if ((menubar->menu == NULL) || (menubar->menu->len == 0))
|
||||
if (menubar->menu == NULL)
|
||||
return;
|
||||
|
||||
#ifndef RESIZABLE_MENUBAR
|
||||
gap = 3;
|
||||
|
||||
for (i = 0; i < menubar->menu->len; i++) {
|
||||
Menu *menu = g_ptr_array_index (menubar->menu, i);
|
||||
for (i = menubar->menu; i != NULL; i = g_list_next (i)) {
|
||||
Menu *menu = i->data;
|
||||
int len = hotkey_width (menu->text);
|
||||
|
||||
menu->start_x = start_x;
|
||||
@ -747,8 +742,8 @@ menubar_arrange (WMenuBar* menubar)
|
||||
gap = menubar->widget.cols - 2;
|
||||
|
||||
/* First, calculate gap between items... */
|
||||
for (i = 0; i < menubar->menu->len; i++) {
|
||||
Menu *menu = g_ptr_array_index (menubar->menu, i);
|
||||
for (i = menubar->menu; i != NULL; i = g_list_nwxt (i)) {
|
||||
Menu *menu = i->data;
|
||||
/* preserve length here, to be used below */
|
||||
menu->start_x = hotkey_width (menu->text);
|
||||
gap -= menu->start_x;
|
||||
@ -762,8 +757,8 @@ menubar_arrange (WMenuBar* menubar)
|
||||
}
|
||||
|
||||
/* ...and now fix start positions of menubar items */
|
||||
for (i = 0; i < menubar->menu->len; i++) {
|
||||
Menu *menu = g_ptr_array_index (menubar->menu, i);
|
||||
for (i = menubar->menu; i != NULL; i = g_list_nwxt (i)) {
|
||||
Menu *menu = i->data;
|
||||
int len = menu->start_x;
|
||||
|
||||
menu->start_x = start_x;
|
||||
|
10
src/menu.h
10
src/menu.h
@ -45,13 +45,13 @@ void menu_entry_free (menu_entry_t *me);
|
||||
typedef struct Menu {
|
||||
int start_x; /* position relative to menubar start */
|
||||
struct hotkey_t text;
|
||||
GPtrArray *entries;
|
||||
GList *entries;
|
||||
size_t max_entry_len;
|
||||
unsigned int selected; /* pointer to current menu entry */
|
||||
char *help_node;
|
||||
} Menu;
|
||||
|
||||
Menu *create_menu (const char *name, GPtrArray *entries,
|
||||
Menu *create_menu (const char *name, GList *entries,
|
||||
const char *help_node);
|
||||
|
||||
void destroy_menu (Menu *menu);
|
||||
@ -64,13 +64,13 @@ typedef struct WMenuBar {
|
||||
|
||||
gboolean is_active; /* If the menubar is in use */
|
||||
gboolean is_dropped; /* If the menubar has dropped */
|
||||
GPtrArray *menu; /* The actual menus */
|
||||
GList *menu; /* The actual menus */
|
||||
unsigned int selected; /* Selected menu on the top bar */
|
||||
int previous_widget; /* Selected widget ID before activating menu */
|
||||
} WMenuBar;
|
||||
|
||||
WMenuBar *menubar_new (int y, int x, int cols, GPtrArray *menu);
|
||||
void menubar_set_menu (WMenuBar *menubar, GPtrArray *menu);
|
||||
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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user