mirror of
https://github.com/MidnightCommander/mc
synced 2025-01-03 01:54:24 +03:00
Add events for panels in filemanager.
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
This commit is contained in:
parent
785144d625
commit
ad0999f2f1
@ -494,7 +494,7 @@ copy_region (WInput * in, int x_first, int x_last)
|
||||
if (last == first)
|
||||
{
|
||||
/* Copy selected files to clipboard */
|
||||
mc_event_raise (MCEVENT_GROUP_FILEMANAGER, "panel_save_current_file_to_clip_file", NULL,
|
||||
mc_event_raise (MCEVENT_GROUP_FILEMANAGER, "save_current_file_to_clip_file", NULL,
|
||||
NULL, NULL);
|
||||
/* try use external clipboard utility */
|
||||
mc_event_raise (MCEVENT_GROUP_CORE, "clipboard_file_to_ext_clip", NULL, NULL, NULL);
|
||||
|
@ -117,17 +117,17 @@ clipboard_file_from_ext_clip (event_info_t * event_info, gpointer data, GError *
|
||||
|
||||
while (TRUE)
|
||||
{
|
||||
GError *error = NULL;
|
||||
GError *mcerror = NULL;
|
||||
|
||||
p->out.len = MC_PIPE_BUFSIZE;
|
||||
p->err.len = MC_PIPE_BUFSIZE;
|
||||
|
||||
mc_pread (p, &error);
|
||||
mc_pread (p, &mcerror);
|
||||
|
||||
if (error != NULL)
|
||||
if (mcerror != NULL)
|
||||
{
|
||||
/* don't show error message */
|
||||
g_error_free (error);
|
||||
g_error_free (mcerror);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -168,7 +168,7 @@ clipboard_file_from_ext_clip (event_info_t * event_info, gpointer data, GError *
|
||||
|
||||
/* event callback */
|
||||
gboolean
|
||||
clipboard_text_to_file (event_info_t * event_info, gpointer data, GError ** error)
|
||||
clipboard_text_to_file (event_info_t * event_info, gpointer data, GError ** mcerror)
|
||||
{
|
||||
int file;
|
||||
vfs_path_t *fname_vpath = NULL;
|
||||
@ -176,7 +176,7 @@ clipboard_text_to_file (event_info_t * event_info, gpointer data, GError ** erro
|
||||
const char *text = (const char *) data;
|
||||
|
||||
(void) event_info;
|
||||
(void) error;
|
||||
(void) mcerror;
|
||||
|
||||
if (text == NULL)
|
||||
return FALSE;
|
||||
@ -203,7 +203,7 @@ clipboard_text_to_file (event_info_t * event_info, gpointer data, GError ** erro
|
||||
|
||||
/* event callback */
|
||||
gboolean
|
||||
clipboard_text_from_file (event_info_t * event_info, gpointer data, GError ** error)
|
||||
clipboard_text_from_file (event_info_t * event_info, gpointer data, GError ** mcerror)
|
||||
{
|
||||
char buf[BUF_LARGE];
|
||||
FILE *f;
|
||||
@ -211,7 +211,7 @@ clipboard_text_from_file (event_info_t * event_info, gpointer data, GError ** er
|
||||
char **text = (char **) data;
|
||||
gboolean first = TRUE;
|
||||
|
||||
(void) error;
|
||||
(void) mcerror;
|
||||
|
||||
fname = mc_config_get_full_path (EDIT_CLIP_FILE);
|
||||
f = fopen (fname, "r");
|
||||
|
@ -80,6 +80,7 @@
|
||||
#include "src/diffviewer/ydiff.h"
|
||||
#endif
|
||||
|
||||
#include "event.h"
|
||||
#include "fileopctx.h"
|
||||
#include "file.h" /* file operation routines */
|
||||
#include "find.h" /* find_file() */
|
||||
@ -125,15 +126,20 @@ static const char *machine_str = N_("Enter machine name (F1 for details):");
|
||||
* Run viewer (internal or external) on the currently selected file.
|
||||
* If normal is TRUE, force internal viewer and raw mode (used for F13).
|
||||
*/
|
||||
|
||||
static void
|
||||
do_view_cmd (gboolean normal)
|
||||
do_view_cmd (WPanel * panel, gboolean normal)
|
||||
{
|
||||
file_entry_t *fe;
|
||||
|
||||
fe = selection (panel);
|
||||
|
||||
/* Directories are viewed by changing to them */
|
||||
if (S_ISDIR (selection (current_panel)->st.st_mode) || link_isdir (selection (current_panel)))
|
||||
if (S_ISDIR (fe->st.st_mode) || link_isdir (fe))
|
||||
{
|
||||
vfs_path_t *fname_vpath;
|
||||
|
||||
if (confirm_view_dir && (current_panel->marked || current_panel->dirs_marked))
|
||||
if (confirm_view_dir && (panel->marked || panel->dirs_marked))
|
||||
{
|
||||
if (query_dialog
|
||||
(_("Confirmation"), _("Files tagged, want to cd?"), D_NORMAL, 2,
|
||||
@ -142,7 +148,7 @@ do_view_cmd (gboolean normal)
|
||||
return;
|
||||
}
|
||||
}
|
||||
fname_vpath = vfs_path_from_str (selection (current_panel)->fname);
|
||||
fname_vpath = vfs_path_from_str (fe->fname);
|
||||
if (!do_cd (fname_vpath, cd_exact))
|
||||
message (D_ERROR, MSG_ERROR, _("Cannot change directory"));
|
||||
vfs_path_free (fname_vpath);
|
||||
@ -152,8 +158,8 @@ do_view_cmd (gboolean normal)
|
||||
int file_idx;
|
||||
vfs_path_t *filename_vpath;
|
||||
|
||||
file_idx = current_panel->selected;
|
||||
filename_vpath = vfs_path_from_str (current_panel->dir.list[file_idx].fname);
|
||||
file_idx = panel->selected;
|
||||
filename_vpath = vfs_path_from_str (panel->dir.list[file_idx].fname);
|
||||
view_file (filename_vpath, normal, use_internal_view != 0);
|
||||
vfs_path_free (filename_vpath);
|
||||
}
|
||||
@ -626,12 +632,20 @@ view_file (const vfs_path_t * filename_vpath, gboolean plain_view, gboolean inte
|
||||
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
/* event callback */
|
||||
/** Run user's preferred viewer on the currently selected file */
|
||||
|
||||
void
|
||||
view_cmd (void)
|
||||
gboolean
|
||||
mc_panel_cmd_file_view (event_info_t * event_info, gpointer data, GError ** error)
|
||||
{
|
||||
do_view_cmd (FALSE);
|
||||
WPanel *panel = (WPanel *) data;
|
||||
|
||||
(void) error;
|
||||
(void) event_info;
|
||||
|
||||
do_view_cmd (panel, FALSE);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
@ -657,11 +671,20 @@ view_file_cmd (void)
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
/* event callback */
|
||||
/** Run plain internal viewer on the currently selected file */
|
||||
void
|
||||
view_raw_cmd (void)
|
||||
|
||||
gboolean
|
||||
mc_panel_cmd_file_view_raw (event_info_t * event_info, gpointer data, GError ** error)
|
||||
{
|
||||
do_view_cmd (TRUE);
|
||||
WPanel *panel = (WPanel *) data;
|
||||
|
||||
(void) error;
|
||||
(void) event_info;
|
||||
|
||||
do_view_cmd (panel, TRUE);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
@ -757,12 +780,17 @@ edit_cmd_force_internal (void)
|
||||
#endif
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
/* event callback */
|
||||
|
||||
void
|
||||
edit_cmd_new (void)
|
||||
gboolean
|
||||
mc_panel_cmd_edit_new (event_info_t * event_info, gpointer data, GError ** error)
|
||||
{
|
||||
vfs_path_t *fname_vpath = NULL;
|
||||
|
||||
(void) error;
|
||||
(void) data;
|
||||
(void) event_info;
|
||||
|
||||
if (editor_ask_filename_before_edit)
|
||||
{
|
||||
char *fname;
|
||||
@ -770,7 +798,7 @@ edit_cmd_new (void)
|
||||
fname = input_expand_dialog (_("Edit file"), _("Enter file name:"),
|
||||
MC_HISTORY_EDIT_LOAD, "", INPUT_COMPLETE_FILENAMES);
|
||||
if (fname == NULL)
|
||||
return;
|
||||
return TRUE;
|
||||
|
||||
if (*fname != '\0')
|
||||
fname_vpath = vfs_path_from_str (fname);
|
||||
@ -784,6 +812,8 @@ edit_cmd_new (void)
|
||||
do_edit (fname_vpath);
|
||||
|
||||
vfs_path_free (fname_vpath);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
@ -815,31 +845,47 @@ rename_cmd (void)
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
/* event callback */
|
||||
/** Invoked by F15. Copy, default to the same panel, ignore marks. */
|
||||
|
||||
void
|
||||
copy_cmd_local (void)
|
||||
gboolean
|
||||
mc_panel_cmd_copy_single (event_info_t * event_info, gpointer data, GError ** error)
|
||||
{
|
||||
WPanel *panel = (WPanel *) data;
|
||||
|
||||
(void) error;
|
||||
(void) event_info;
|
||||
|
||||
save_cwds_stat ();
|
||||
if (panel_operate (current_panel, OP_COPY, TRUE))
|
||||
if (panel_operate (panel, OP_COPY, TRUE))
|
||||
{
|
||||
update_panels (UP_OPTIMIZE, UP_KEEPSEL);
|
||||
repaint_screen ();
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
/* event callback */
|
||||
/** Invoked by F16. Move/rename, default to the same panel. */
|
||||
|
||||
void
|
||||
rename_cmd_local (void)
|
||||
gboolean
|
||||
mc_panel_cmd_rename_single (event_info_t * event_info, gpointer data, GError ** error)
|
||||
{
|
||||
WPanel *panel = (WPanel *) data;
|
||||
|
||||
(void) error;
|
||||
(void) event_info;
|
||||
|
||||
save_cwds_stat ();
|
||||
if (panel_operate (current_panel, OP_MOVE, TRUE))
|
||||
if (panel_operate (panel, OP_MOVE, TRUE))
|
||||
{
|
||||
update_panels (UP_OPTIMIZE, UP_KEEPSEL);
|
||||
repaint_screen ();
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
@ -908,18 +954,26 @@ delete_cmd (void)
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
/* event callback */
|
||||
/** Invoked by F18. Remove selected file, regardless of marked files. */
|
||||
|
||||
void
|
||||
delete_cmd_local (void)
|
||||
gboolean
|
||||
mc_panel_cmd_delete_single (event_info_t * event_info, gpointer data, GError ** error)
|
||||
{
|
||||
WPanel *panel = (WPanel *) data;
|
||||
|
||||
(void) error;
|
||||
(void) event_info;
|
||||
|
||||
save_cwds_stat ();
|
||||
|
||||
if (panel_operate (current_panel, OP_DELETE, TRUE))
|
||||
if (panel_operate (panel, OP_DELETE, TRUE))
|
||||
{
|
||||
update_panels (UP_OPTIMIZE, UP_KEEPSEL);
|
||||
repaint_screen ();
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
@ -1132,6 +1186,8 @@ hotlist_cmd (void)
|
||||
g_free (target);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef ENABLE_VFS
|
||||
void
|
||||
vfs_list (void)
|
||||
@ -1715,7 +1771,7 @@ void
|
||||
encoding_cmd (void)
|
||||
{
|
||||
if (SELECTED_IS_PANEL)
|
||||
panel_change_encoding (MENU_PANEL);
|
||||
mc_event_raise (MCEVENT_GROUP_FILEMANAGER, "select_codepage", MENU_PANEL, NULL, NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -46,23 +46,17 @@ void dirsizes_cmd (void);
|
||||
gboolean view_file_at_line (const vfs_path_t * filename_vpath, gboolean plain_view,
|
||||
gboolean internal, long start_line);
|
||||
gboolean view_file (const vfs_path_t * filename_vpath, gboolean normal, gboolean internal);
|
||||
void view_cmd (void);
|
||||
void view_file_cmd (void);
|
||||
void view_raw_cmd (void);
|
||||
void view_filtered_cmd (void);
|
||||
void edit_file_at_line (const vfs_path_t * what_vpath, gboolean internal, long start_line);
|
||||
void edit_cmd (void);
|
||||
void edit_cmd_new (void);
|
||||
#ifdef USE_INTERNAL_EDIT
|
||||
void edit_cmd_force_internal (void);
|
||||
#endif
|
||||
void copy_cmd (void);
|
||||
void copy_cmd_local (void);
|
||||
void rename_cmd (void);
|
||||
void rename_cmd_local (void);
|
||||
void mkdir_cmd (void);
|
||||
void delete_cmd (void);
|
||||
void delete_cmd_local (void);
|
||||
void find_cmd (void);
|
||||
void filter_cmd (void);
|
||||
void reread_cmd (void);
|
||||
|
@ -75,10 +75,78 @@ mc_filemanager_init_events (GError ** error)
|
||||
};
|
||||
/* *INDENT-ON* */
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
event_init_group_t filemanager_group_events[] =
|
||||
{
|
||||
{"update_panels", mc_panel_cmd_update_panels, NULL},
|
||||
{"save_current_file_to_clip_file", mc_panel_cmd_save_current_file_to_clip_file, NULL},
|
||||
{"chdir_other", mc_panel_cmd_chdir_other, NULL},
|
||||
{"chdir_other_if_link", mc_panel_cmd_chdir_other_if_link, NULL},
|
||||
{"copy_single", mc_panel_cmd_copy_single, NULL},
|
||||
{"delete_single", mc_panel_cmd_delete_single, NULL},
|
||||
{"enter", mc_panel_cmd_enter, NULL},
|
||||
{"view_raw", mc_panel_cmd_file_view_raw, NULL},
|
||||
{"view", mc_panel_cmd_file_view, NULL},
|
||||
{"edit_new", mc_panel_cmd_edit_new, NULL},
|
||||
{"rename_single", mc_panel_cmd_rename_single, NULL},
|
||||
{"goto_page_down", mc_panel_cmd_goto_page_down, NULL},
|
||||
{"goto_page_up", mc_panel_cmd_goto_page_up, NULL},
|
||||
{"ch_sub_dir", mc_panel_cmd_ch_sub_dir, NULL},
|
||||
{"ch_parent_dir", mc_panel_cmd_ch_parent_dir, NULL},
|
||||
{"directory_history_list", mc_panel_cmd_directory_history_list, NULL},
|
||||
{"directory_history_next", mc_panel_cmd_directory_history_next, NULL},
|
||||
{"directory_history_prev", mc_panel_cmd_directory_history_prev, NULL},
|
||||
{"goto_bottom_screen", mc_panel_cmd_goto_bottom_screen, NULL},
|
||||
{"goto_middle_screen", mc_panel_cmd_goto_middle_screen, NULL},
|
||||
{"goto_top_screen", mc_panel_cmd_goto_top_screen, NULL},
|
||||
{"mark", mc_panel_cmd_mark, NULL},
|
||||
{"mark_up", mc_panel_cmd_mark_up, NULL},
|
||||
{"mark_down", mc_panel_cmd_mark_down, NULL},
|
||||
{"mark_left", mc_panel_cmd_mark_left, NULL},
|
||||
{"mark_right", mc_panel_cmd_mark_right, NULL},
|
||||
{"cd_parent_smart", mc_panel_cmd_cd_parent_smart, NULL},
|
||||
|
||||
{"goto_up", mc_panel_cmd_goto_up, NULL},
|
||||
{"goto_down", mc_panel_cmd_goto_down, NULL},
|
||||
{"goto_left", mc_panel_cmd_goto_left, NULL},
|
||||
{"goto_right", mc_panel_cmd_goto_right, NULL},
|
||||
{"goto_home", mc_panel_cmd_goto_home, NULL},
|
||||
{"goto_end", mc_panel_cmd_goto_end, NULL},
|
||||
|
||||
{"content_scroll_left", mc_panel_cmd_content_scroll_left, NULL},
|
||||
{"content_scroll_right", mc_panel_cmd_content_scroll_right, NULL},
|
||||
|
||||
{"search", mc_panel_cmd_search, NULL},
|
||||
{"search_stop", mc_panel_cmd_search_stop, NULL},
|
||||
{"sync_other", mc_panel_cmd_sync_other, NULL},
|
||||
|
||||
{"sort_order_select", mc_panel_cmd_sort_order_select, NULL},
|
||||
{"sort_order_prev", mc_panel_cmd_sort_order_prev, NULL},
|
||||
{"sort_order_next", mc_panel_cmd_sort_order_next, NULL},
|
||||
{"sort_order_reverse", mc_panel_cmd_sort_order_next, NULL},
|
||||
{"sort_by_name", mc_panel_cmd_sort_order_next, NULL},
|
||||
{"sort_by_extension", mc_panel_cmd_sort_order_next, NULL},
|
||||
{"sort_by_size", mc_panel_cmd_sort_order_next, NULL},
|
||||
{"sort_by_mtime", mc_panel_cmd_sort_order_next, NULL},
|
||||
|
||||
{"select_files", mc_panel_cmd_select_files, NULL},
|
||||
{"unselect_files", mc_panel_cmd_unselect_files, NULL},
|
||||
{"select_invert_files", mc_panel_cmd_select_invert_files, NULL},
|
||||
{"select_files_by_extension", mc_panel_cmd_select_files_by_extension, NULL},
|
||||
|
||||
#ifdef HAVE_CHARSET
|
||||
{"select_codepage", mc_panel_cmd_select_codepage, NULL},
|
||||
#endif /* HAVE_CHARSET */
|
||||
|
||||
{NULL, NULL, NULL}
|
||||
};
|
||||
/* *INDENT-ON* */
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
event_init_t standard_events[] =
|
||||
{
|
||||
{MCEVENT_GROUP_TREEVIEW, treeview_group_events},
|
||||
{MCEVENT_GROUP_FILEMANAGER, filemanager_group_events},
|
||||
{NULL, NULL}
|
||||
};
|
||||
/* *INDENT-ON* */
|
||||
|
@ -36,6 +36,74 @@ gboolean mc_tree_cmd_rmdir (event_info_t * event_info, gpointer data, GError **
|
||||
gboolean mc_tree_cmd_chdir (event_info_t * event_info, gpointer data, GError ** error);
|
||||
gboolean mc_tree_cmd_show_box (event_info_t * event_info, gpointer data, GError ** error);
|
||||
|
||||
gboolean mc_panel_cmd_update_panels (event_info_t * event_info, gpointer data, GError ** error);
|
||||
gboolean mc_panel_cmd_save_current_file_to_clip_file (event_info_t * event_info, gpointer data,
|
||||
GError ** error);
|
||||
gboolean mc_panel_cmd_chdir_other (event_info_t * event_info, gpointer data, GError ** error);
|
||||
gboolean mc_panel_cmd_chdir_other_if_link (event_info_t * event_info, gpointer data,
|
||||
GError ** error);
|
||||
gboolean mc_panel_cmd_copy_single (event_info_t * event_info, gpointer data, GError ** error);
|
||||
gboolean mc_panel_cmd_delete_single (event_info_t * event_info, gpointer data, GError ** error);
|
||||
gboolean mc_panel_cmd_enter (event_info_t * event_info, gpointer data, GError ** error);
|
||||
gboolean mc_panel_cmd_file_view_raw (event_info_t * event_info, gpointer data, GError ** error);
|
||||
gboolean mc_panel_cmd_file_view (event_info_t * event_info, gpointer data, GError ** error);
|
||||
gboolean mc_panel_cmd_edit_new (event_info_t * event_info, gpointer data, GError ** error);
|
||||
gboolean mc_panel_cmd_rename_single (event_info_t * event_info, gpointer data, GError ** error);
|
||||
gboolean mc_panel_cmd_goto_page_down (event_info_t * event_info, gpointer data, GError ** error);
|
||||
gboolean mc_panel_cmd_goto_page_up (event_info_t * event_info, gpointer data, GError ** error);
|
||||
gboolean mc_panel_cmd_ch_sub_dir (event_info_t * event_info, gpointer data, GError ** error);
|
||||
gboolean mc_panel_cmd_ch_parent_dir (event_info_t * event_info, gpointer data, GError ** error);
|
||||
gboolean mc_panel_cmd_directory_history_list (event_info_t * event_info, gpointer data,
|
||||
GError ** error);
|
||||
gboolean mc_panel_cmd_directory_history_next (event_info_t * event_info, gpointer data,
|
||||
GError ** error);
|
||||
gboolean mc_panel_cmd_directory_history_prev (event_info_t * event_info, gpointer data,
|
||||
GError ** error);
|
||||
gboolean mc_panel_cmd_goto_bottom_screen (event_info_t * event_info, gpointer data,
|
||||
GError ** error);
|
||||
gboolean mc_panel_cmd_goto_middle_screen (event_info_t * event_info, gpointer data,
|
||||
GError ** error);
|
||||
gboolean mc_panel_cmd_goto_top_screen (event_info_t * event_info, gpointer data, GError ** error);
|
||||
|
||||
gboolean mc_panel_cmd_mark (event_info_t * event_info, gpointer data, GError ** error);
|
||||
gboolean mc_panel_cmd_mark_up (event_info_t * event_info, gpointer data, GError ** error);
|
||||
gboolean mc_panel_cmd_mark_down (event_info_t * event_info, gpointer data, GError ** error);
|
||||
gboolean mc_panel_cmd_mark_left (event_info_t * event_info, gpointer data, GError ** error);
|
||||
gboolean mc_panel_cmd_mark_right (event_info_t * event_info, gpointer data, GError ** error);
|
||||
gboolean mc_panel_cmd_cd_parent_smart (event_info_t * event_info, gpointer data, GError ** error);
|
||||
gboolean mc_panel_cmd_goto_up (event_info_t * event_info, gpointer data, GError ** error);
|
||||
gboolean mc_panel_cmd_goto_down (event_info_t * event_info, gpointer data, GError ** error);
|
||||
gboolean mc_panel_cmd_goto_left (event_info_t * event_info, gpointer data, GError ** error);
|
||||
gboolean mc_panel_cmd_goto_right (event_info_t * event_info, gpointer data, GError ** error);
|
||||
gboolean mc_panel_cmd_goto_home (event_info_t * event_info, gpointer data, GError ** error);
|
||||
gboolean mc_panel_cmd_goto_end (event_info_t * event_info, gpointer data, GError ** error);
|
||||
gboolean mc_panel_cmd_content_scroll_left (event_info_t * event_info, gpointer data,
|
||||
GError ** error);
|
||||
gboolean mc_panel_cmd_content_scroll_right (event_info_t * event_info, gpointer data,
|
||||
GError ** error);
|
||||
gboolean mc_panel_cmd_search (event_info_t * event_info, gpointer data, GError ** error);
|
||||
gboolean mc_panel_cmd_search_stop (event_info_t * event_info, gpointer data, GError ** error);
|
||||
gboolean mc_panel_cmd_sync_other (event_info_t * event_info, gpointer data, GError ** error);
|
||||
gboolean mc_panel_cmd_sort_order_select (event_info_t * event_info, gpointer data, GError ** error);
|
||||
gboolean mc_panel_cmd_sort_order_prev (event_info_t * event_info, gpointer data, GError ** error);
|
||||
gboolean mc_panel_cmd_sort_order_next (event_info_t * event_info, gpointer data, GError ** error);
|
||||
gboolean mc_panel_cmd_sort_order_reverse (event_info_t * event_info, gpointer data,
|
||||
GError ** error);
|
||||
gboolean mc_panel_cmd_sort_by_name (event_info_t * event_info, gpointer data, GError ** error);
|
||||
gboolean mc_panel_cmd_sort_by_extension (event_info_t * event_info, gpointer data, GError ** error);
|
||||
gboolean mc_panel_cmd_sort_by_size (event_info_t * event_info, gpointer data, GError ** error);
|
||||
gboolean mc_panel_cmd_sort_by_mtime (event_info_t * event_info, gpointer data, GError ** error);
|
||||
|
||||
gboolean mc_panel_cmd_select_files (event_info_t * event_info, gpointer data, GError ** error);
|
||||
gboolean mc_panel_cmd_unselect_files (event_info_t * event_info, gpointer data, GError ** error);
|
||||
gboolean mc_panel_cmd_select_invert_files (event_info_t * event_info, gpointer data,
|
||||
GError ** error);
|
||||
gboolean mc_panel_cmd_select_files_by_extension (event_info_t * event_info, gpointer data,
|
||||
GError ** error);
|
||||
|
||||
#ifdef HAVE_CHARSET
|
||||
gboolean mc_panel_cmd_select_codepage (event_info_t * event_info, gpointer data, GError ** error);
|
||||
#endif /* HAVE_CHARSET */
|
||||
|
||||
/*** inline functions ****************************************************************************/
|
||||
|
||||
|
@ -1108,6 +1108,9 @@ static cb_ret_t
|
||||
midnight_execute_cmd (Widget * sender, unsigned long command)
|
||||
{
|
||||
cb_ret_t res = MSG_HANDLED;
|
||||
const char *event_group_name = MCEVENT_GROUP_FILEMANAGER;
|
||||
const char *event_name = NULL;
|
||||
event_return_t ret;
|
||||
|
||||
(void) sender;
|
||||
|
||||
@ -1385,7 +1388,7 @@ midnight_execute_cmd (Widget * sender, unsigned long command)
|
||||
user_file_menu_cmd ();
|
||||
break;
|
||||
case CK_View:
|
||||
view_cmd ();
|
||||
event_name = "view";
|
||||
break;
|
||||
case CK_ViewFile:
|
||||
view_file_cmd ();
|
||||
@ -1397,54 +1400,21 @@ midnight_execute_cmd (Widget * sender, unsigned long command)
|
||||
res = MSG_NOT_HANDLED;
|
||||
}
|
||||
|
||||
if (mc_event_raise (event_group_name, event_name, current_panel, &ret, NULL))
|
||||
{
|
||||
return (ret.b) ? MSG_HANDLED : MSG_NOT_HANDLED;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static cb_ret_t
|
||||
midnight_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data)
|
||||
midnight_handle_raw_keys (int parm)
|
||||
{
|
||||
unsigned long command;
|
||||
|
||||
switch (msg)
|
||||
{
|
||||
case MSG_INIT:
|
||||
panel_init ();
|
||||
setup_panels ();
|
||||
return MSG_HANDLED;
|
||||
|
||||
case MSG_DRAW:
|
||||
load_hint (1);
|
||||
/* We handle the special case of the output lines */
|
||||
if (mc_global.tty.console_flag != '\0' && output_lines)
|
||||
show_console_contents (output_start_y,
|
||||
LINES - output_lines - mc_global.keybar_visible -
|
||||
1, LINES - mc_global.keybar_visible - 1);
|
||||
return MSG_HANDLED;
|
||||
|
||||
case MSG_RESIZE:
|
||||
/* dlg_set_size() is surplus for this case */
|
||||
w->lines = LINES;
|
||||
w->cols = COLS;
|
||||
setup_panels ();
|
||||
menubar_arrange (the_menubar);
|
||||
return MSG_HANDLED;
|
||||
|
||||
case MSG_IDLE:
|
||||
/* We only need the first idle event to show user menu after start */
|
||||
widget_want_idle (w, FALSE);
|
||||
|
||||
if (boot_current_is_left)
|
||||
dlg_select_widget (get_panel_widget (0));
|
||||
else
|
||||
dlg_select_widget (get_panel_widget (1));
|
||||
|
||||
if (auto_menu)
|
||||
midnight_execute_cmd (NULL, CK_UserMenu);
|
||||
return MSG_HANDLED;
|
||||
|
||||
case MSG_KEY:
|
||||
if (ctl_x_map_enabled)
|
||||
{
|
||||
ctl_x_map_enabled = FALSE;
|
||||
@ -1514,24 +1484,23 @@ midnight_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void
|
||||
return send_message (current_panel, midnight_dlg, MSG_ACTION, CK_Select, NULL);
|
||||
|
||||
if (parm == '\\' || parm == '-')
|
||||
return send_message (current_panel, midnight_dlg, MSG_ACTION, CK_Unselect,
|
||||
NULL);
|
||||
return send_message (current_panel, midnight_dlg, MSG_ACTION, CK_Unselect, NULL);
|
||||
|
||||
if (parm == '*')
|
||||
return send_message (current_panel, midnight_dlg, MSG_ACTION, CK_SelectInvert,
|
||||
NULL);
|
||||
}
|
||||
else if (!command_prompt || cmdline->buffer[0] == '\0')
|
||||
else if (!command_prompt || !cmdline->buffer[0])
|
||||
{
|
||||
/* Special treatement '+', '-', '\', '*' only when this is
|
||||
* first char on input line
|
||||
*/
|
||||
|
||||
if (parm == '+')
|
||||
return send_message (current_panel, midnight_dlg, MSG_ACTION, CK_Select, NULL);
|
||||
|
||||
if (parm == '\\' || parm == '-')
|
||||
return send_message (current_panel, midnight_dlg, MSG_ACTION, CK_Unselect,
|
||||
NULL);
|
||||
return send_message (current_panel, midnight_dlg, MSG_ACTION, CK_Unselect, NULL);
|
||||
|
||||
if (parm == '*')
|
||||
return send_message (current_panel, midnight_dlg, MSG_ACTION, CK_SelectInvert,
|
||||
@ -1539,6 +1508,54 @@ midnight_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void
|
||||
}
|
||||
}
|
||||
return MSG_NOT_HANDLED;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static cb_ret_t
|
||||
midnight_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data)
|
||||
{
|
||||
unsigned long command;
|
||||
|
||||
switch (msg)
|
||||
{
|
||||
case MSG_INIT:
|
||||
panel_init ();
|
||||
setup_panels ();
|
||||
return MSG_HANDLED;
|
||||
|
||||
case MSG_DRAW:
|
||||
load_hint (1);
|
||||
/* We handle the special case of the output lines */
|
||||
if (mc_global.tty.console_flag != '\0' && output_lines)
|
||||
show_console_contents (output_start_y,
|
||||
LINES - output_lines - mc_global.keybar_visible -
|
||||
1, LINES - mc_global.keybar_visible - 1);
|
||||
return MSG_HANDLED;
|
||||
|
||||
case MSG_RESIZE:
|
||||
/* dlg_set_size() is surplus for this case */
|
||||
w->lines = LINES;
|
||||
w->cols = COLS;
|
||||
setup_panels ();
|
||||
menubar_arrange (the_menubar);
|
||||
return MSG_HANDLED;
|
||||
|
||||
case MSG_IDLE:
|
||||
/* We only need the first idle event to show user menu after start */
|
||||
widget_want_idle (w, FALSE);
|
||||
|
||||
if (boot_current_is_left)
|
||||
dlg_select_widget (get_panel_widget (0));
|
||||
else
|
||||
dlg_select_widget (get_panel_widget (1));
|
||||
|
||||
if (auto_menu)
|
||||
midnight_execute_cmd (NULL, CK_UserMenu);
|
||||
return MSG_HANDLED;
|
||||
|
||||
case MSG_KEY:
|
||||
return midnight_handle_raw_keys (parm);
|
||||
|
||||
case MSG_HOTKEY_HANDLED:
|
||||
if ((get_current_type () == view_listing) && current_panel->searching)
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -161,7 +161,6 @@ void panel_set_sort_order (WPanel * panel, const panel_field_t * sort_order);
|
||||
void panel_re_sort (WPanel * panel);
|
||||
|
||||
#ifdef HAVE_CHARSET
|
||||
void panel_change_encoding (WPanel * panel);
|
||||
vfs_path_t *remove_encoding_from_path (const vfs_path_t * vpath);
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user