1
1
All file panels related stuff was moved to midnight.[ch].

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
Этот коммит содержится в:
Andrew Borodin 2010-11-22 13:45:18 +02:00
родитель b1bd2e2673
Коммит fdb61594df
62 изменённых файлов: 2022 добавлений и 1954 удалений

Просмотреть файл

@ -144,8 +144,6 @@
/*** global variables defined in .c file *********************************************************/
extern const char *home_dir;
/*** declarations of public functions ************************************************************/
void refresh_screen (void *);

Просмотреть файл

@ -33,12 +33,12 @@
#include <stdio.h>
#include "lib/global.h"
#include "logging.h"
#include "lib/mcconfig.h"
#include "lib/fileloc.h"
#include "src/setup.h"
#include "src/main.h" /* home_dir */
#include "logging.h"
/*** global variables ****************************************************************************/

Просмотреть файл

@ -50,9 +50,7 @@
#include "src/filegui.h"
#include "src/file.h" /* copy_file_file() */
#ifndef HAVE_CHARSET
#include "src/main.h" /* eight_bit_clean */
#endif
#include "src/main.h" /* home_dir, eight_bit_clean */
/*** global variables ****************************************************************************/

Просмотреть файл

@ -45,7 +45,7 @@
#include "lib/widget.h" /* message() */
#endif
#include "src/main.h" /* print_vfs_message */
#include "src/layout.h" /* print_vfs_message */
#include "vfs-impl.h"
#include "utilvfs.h"

Просмотреть файл

@ -62,7 +62,8 @@
#include "lib/unixcompat.h"
#include "lib/fileloc.h"
#include "src/main.h" /* print_vfs_message */
#include "src/layout.h" /* print_vfs_message */
#include "src/execute.h" /* pre_exec, post_exec */
#include "vfs-impl.h"
#include "utilvfs.h"
@ -72,7 +73,6 @@
#include "fish.h"
#include "fishdef.h"
#include "src/execute.h" /* pre_exec, post_exec */
/*** global variables ****************************************************************************/

Просмотреть файл

@ -92,7 +92,7 @@ What to do with this?
#include "lib/tty/tty.h" /* enable/disable interrupt key */
#include "lib/widget.h" /* message() */
#include "src/main.h" /* print_vfs_message */
#include "src/layout.h" /* print_vfs_message */
#include "src/history.h"
#include "src/setup.h" /* for load_anon_passwd */

Просмотреть файл

@ -44,7 +44,7 @@
#include "lib/global.h"
#include "src/panel.h" /* current_panel */
#include "src/midnight.h" /* current_panel */
#include "src/layout.h" /* get_current_type(), get_other_type() */
#include "vfs-impl.h"
@ -184,7 +184,7 @@ vfs_stamp_create (struct vfs_class *oldvfs, vfsid oldvfsid)
current_dir and current_panel->cwd or current_dir and other_panel->cwd are the
same, it's possible that all three are different -- Norbert */
if (!current_panel)
if (current_panel == NULL)
return;
nvfs = vfs_get_class (vfs_get_current_dir ());

Просмотреть файл

@ -59,8 +59,7 @@
#include "lib/global.h"
#include "lib/widget.h" /* message() */
#include "src/main.h" /* print_vfs_message */
#include "src/layout.h" /* print_vfs_message */
#include "utilvfs.h"
#include "vfs-impl.h"

Просмотреть файл

@ -58,7 +58,7 @@
#ifdef HAVE_CHARSET
#include "lib/charsets.h"
#endif
#include "src/main.h" /* cd_symlinks */
#include "src/setup.h" /* cd_symlinks */
#include "vfs-impl.h"
#include "utilvfs.h"

Просмотреть файл

@ -32,10 +32,9 @@
/* TODO: these includes should be removed! */
#include "src/layout.h" /* repaint_screen() */
#include "src/main-widgets.h" /* midnight_dlg */
#include "src/midnight.h" /* midnight_dlg */
#include "src/main.h" /* midnight_shutdown */
/*** global variables ****************************************************************************/
/*** file scope macro definitions ****************************************************************/
@ -44,7 +43,6 @@
/*** file scope variables ************************************************************************/
/* List of dialogs: filemanagers, editors, viewers */
static GList *mc_dialogs = NULL;
/* Currently active dialog */

Просмотреть файл

@ -43,8 +43,6 @@
#include "src/layout.h"
#include "src/execute.h" /* suspend_cmd() */
#include "src/keybind-defaults.h"
#include "src/main.h" /* fast_refresh */
#include "src/setup.h" /* mouse_close_dialog */
/*** global variables ****************************************************************************/
@ -59,6 +57,10 @@ GList *top_dlg = NULL;
/* A hook list for idle events */
hook_t *idle_hook = NULL;
/* If set then dialogs just clean the screen when refreshing, else */
/* they do a complete refresh, refreshing all the parts of the program */
int fast_refresh = 0;
/* left click outside of dialog closes it */
int mouse_close_dialog = 0;

Просмотреть файл

@ -159,6 +159,9 @@ extern GList *top_dlg;
/* A hook list for idle events */
extern hook_t *idle_hook;
extern int fast_refresh;
extern int mouse_close_dialog;
/*** declarations of public functions ************************************************************/
/* draw box in window */

Просмотреть файл

@ -50,9 +50,9 @@
#include "lib/keybind.h" /* global_keymap_t */
#include "lib/widget.h"
/* TODO: these includes should be removed! */
#include "src/panel.h" /* current_panel */
#include "src/clipboard.h" /* copy_file_to_ext_clip, paste_to_file_from_ext_clip */
#include "src/main.h" /* home_dir */
#include "src/midnight.h" /* current_panel */
#include "src/clipboard.h" /* copy_file_to_ext_clip, paste_to_file_from_ext_clip */
#include "src/keybind-defaults.h" /* input_map */
/*** global variables ****************************************************************************/

Просмотреть файл

@ -66,6 +66,8 @@ typedef struct
/*** global variables defined in .c file *********************************************************/
extern int quote;
/*** declarations of public functions ************************************************************/
WInput *input_new (int y, int x, const int *input_colors,

Просмотреть файл

@ -46,7 +46,7 @@
/* TODO: these includes should be removed! */
#include "src/keybind-defaults.h" /* listbox_map */
#include "src/main.h" /* confirm_history_cleanup */
#include "src/setup.h" /* confirm_history_cleanup */
/*** global variables ****************************************************************************/

Просмотреть файл

@ -38,7 +38,7 @@
/* TODO: these includes should be removed! */
#include "src/keybind-defaults.h" /* CK_Ignore_Key */
#include "src/help.h"
#include "src/main.h" /* is_right */
#include "src/midnight.h" /* is_right */
/*** global variables ****************************************************************************/

Просмотреть файл

@ -94,7 +94,7 @@ mc_SOURCES = \
layout.c layout.h \
listmode.c listmode.h \
main.c main.h \
main-widgets.h \
midnight.h midnight.c \
panelize.c panelize.h \
subshell.c subshell.h \
textconf.c textconf.h \

Просмотреть файл

@ -44,10 +44,10 @@
#include "lib/widget.h"
#include "dir.h"
#include "panel.h" /* Needed for the externs */
#include "midnight.h" /* current_panel */
#include "chmod.h"
#include "main.h" /* update_panels() */
#include "layout.h" /* repaint_screen() */
#include "achown.h"
/*** global variables ****************************************************************************/

Просмотреть файл

@ -57,7 +57,6 @@
#include "command.h" /* For cmdline */
#include "dir.h"
#include "panel.h" /* LIST_TYPES */
#include "main.h" /* For the confirm_* variables */
#include "tree.h"
#include "layout.h" /* for get_nth_panel_name proto */
#include "background.h" /* task_list */

Просмотреть файл

@ -40,8 +40,7 @@
#include "lib/util.h"
#include "lib/widget.h"
#include "panel.h" /* do_file_mark() */
#include "main.h" /* update_panels() */
#include "midnight.h" /* current_panel */
#include "layout.h" /* repaint_screen() */
#include "chmod.h"

Просмотреть файл

@ -43,11 +43,12 @@
/* Needed for the extern declarations of integer parameters */
#include "chmod.h"
#include "main.h" /* update_panels() */
#include "midnight.h" /* current_panel */
#include "layout.h" /* repaint_screen() */
#include "chown.h"
#include "setup.h" /* panels_options */
#include "chown.h"
/*** global variables ****************************************************************************/
/*** file scope macro definitions ****************************************************************/

Просмотреть файл

@ -40,6 +40,10 @@
/*** global variables ****************************************************************************/
/* path to X clipboard utility */
char *clipboard_store_path = NULL;
char *clipboard_paste_path = NULL;
/*** file scope macro definitions ****************************************************************/
/*** file scope type declarations ****************************************************************/

Просмотреть файл

@ -13,10 +13,14 @@
/*** global variables defined in .c file *********************************************************/
extern char *clipboard_store_path;
extern char *clipboard_paste_path;
/*** declarations of public functions ************************************************************/
gboolean copy_file_to_ext_clip (void);
gboolean paste_to_file_from_ext_clip (void);
/*** inline functions ****************************************************************************/
#endif /* MC__CLIPBOARD_H */

Просмотреть файл

@ -67,8 +67,7 @@
#include "tree.h" /* tree_chdir() */
#include "subshell.h" /* use_subshell */
#include "consaver/cons.saver.h" /* console_flag */
#include "main.h" /* change_panel() */
#include "panel.h" /* current_panel */
#include "midnight.h" /* change_panel() */
#include "help.h" /* interactive_display() */
#include "user.h" /* MC_GLOBAL_MENU */
#include "command.h" /* cmdline */
@ -93,15 +92,6 @@
/*** global variables ****************************************************************************/
/* If set and you don't have subshell support,then C-o will give you a shell */
int output_starts_shell = 0;
/* If set, use the builtin editor */
int use_internal_edit = 1;
/* Automatically fills name with current selected item name on mkdir */
int auto_fill_mkdir_name = 1;
int select_flags = SELECT_MATCH_CASE | SELECT_SHELL_PATTERNS;
/*** file scope macro definitions ****************************************************************/

Просмотреть файл

@ -40,8 +40,7 @@
#include "lib/util.h"
#include "lib/widget.h"
#include "command.h"
#include "panel.h" /* view_tree enum. Also, needed by main.h */
#include "midnight.h" /* current_panel */
#include "main.h" /* do_cd */
#include "layout.h" /* for command_prompt variable */
#include "user.h" /* expand_format */
@ -49,6 +48,8 @@
#include "tree.h" /* for tree_chdir */
#include "execute.h" /* shell_execute */
#include "command.h"
/*** global variables ****************************************************************************/
/* This holds the command line */
@ -257,7 +258,7 @@ enter (WInput * lc_cmdline)
}
if (use_subshell)
load_prompt (0, 0);
load_prompt (0, NULL);
#endif
}
return MSG_HANDLED;

Просмотреть файл

@ -46,7 +46,7 @@
#include "lib/util.h"
#include "lib/widget.h"
#include "main.h" /* show_all_if_ambiguous */
#include "setup.h" /* show_all_if_ambiguous */
/*** global variables ****************************************************************************/

Просмотреть файл

@ -47,7 +47,7 @@
#include "src/cmd.h"
#include "src/help.h"
#include "src/history.h"
#include "src/panel.h" /* Needed for current_panel and other_panel */
#include "src/midnight.h" /* Needed for current_panel and other_panel */
#include "src/layout.h" /* Needed for get_current_index and get_other_panel */
#include "src/main.h" /* mc_run_mode, midnight_shutdown */
#include "src/selcodepage.h"

Просмотреть файл

@ -51,7 +51,10 @@
#include "lib/timefmt.h" /* time formatting */
#include "lib/lock.h"
#include "lib/widget.h"
#ifdef HAVE_CHARSET
#include "lib/charsets.h" /* get_codepage_id */
#endif
#include "src/cmd.h" /* view_other_cmd() */
#include "src/user.h" /* user_menu_cmd() */

Просмотреть файл

@ -45,7 +45,7 @@
#include "lib/tty/key.h" /* XCTRL */
#include "lib/widget.h"
#include "src/main.h" /* drop_menus */
#include "src/setup.h" /* drop_menus */
#include "src/keybind-defaults.h"
#include "edit-impl.h"

Просмотреть файл

@ -47,11 +47,12 @@
#include "lib/util.h" /* concat_dir_and_file() */
#include "lib/widget.h"
#include "src/keybind-defaults.h"
#include "src/main.h" /* home_dir */
#include "edit-impl.h"
#include "edit-widget.h"
#include "src/keybind-defaults.h"
/*** global variables ****************************************************************************/
/*** file scope macro definitions ****************************************************************/

Просмотреть файл

@ -34,15 +34,18 @@
#include "lib/util.h"
#include "lib/widget.h"
#include "main.h"
#include "midnight.h"
#include "consaver/cons.saver.h"
#include "subshell.h"
#include "layout.h" /* use_dash() */
#include "panel.h" /* update_panels() */
#include "setup.h" /* clear_before_exec */
#include "execute.h"
/*** global variables ****************************************************************************/
int pause_after_run = pause_on_dumb_terminals;
/*** file scope macro definitions ****************************************************************/
/*** file scope type declarations ****************************************************************/
@ -156,7 +159,7 @@ do_execute (const char *lc_shell, const char *command, int flags)
{
if ((pause_after_run == pause_always
|| (pause_after_run == pause_on_dumb_terminals && !xterm_flag
&& !console_flag)) && !quit
&& !console_flag)) && quit == 0
#ifdef HAVE_SUBSHELL_SUPPORT
&& subshell_state != RUNNING_COMMAND
#endif /* HAVE_SUBSHELL_SUPPORT */
@ -376,7 +379,7 @@ toggle_panels (void)
#ifdef HAVE_SUBSHELL_SUPPORT
if (use_subshell)
{
load_prompt (0, 0);
load_prompt (0, NULL);
if (new_dir)
do_possible_cd (new_dir);
if (console_flag && output_lines)

Просмотреть файл

@ -14,10 +14,20 @@
/*** enums ***************************************************************************************/
/* If true, after executing a command, wait for a keystroke */
enum
{
pause_never,
pause_on_dumb_terminals,
pause_always
};
/*** structures declarations (and typedefs of structures)*****************************************/
/*** global variables defined in .c file *********************************************************/
extern int pause_after_run;
/*** declarations of public functions ************************************************************/
/* Execute functions that use the shell to execute */

Просмотреть файл

@ -45,7 +45,7 @@
#include "viewer/mcviewer.h"
#include "user.h"
#include "main.h"
#include "setup.h" /* use_file_to_check_type */
#include "execute.h"
#include "history.h"
#include "layout.h"
@ -56,9 +56,6 @@
/*** global variables ****************************************************************************/
/* If set, we execute the file command to check the file type */
int use_file_to_check_type = 1;
/*** file scope macro definitions ****************************************************************/
#ifdef FILE_L

Просмотреть файл

@ -66,30 +66,21 @@
#include "lib/widget.h"
#include "setup.h"
#include "main.h"
#include "layout.h" /* rotate_dash() */
#include "background.h" /* we_are_background */
/* Needed for current_panel, other_panel and WTree */
#include "dir.h"
#include "panel.h"
#include "file.h"
#include "filegui.h"
#include "tree.h"
#include "midnight.h" /* current_panel */
#include "file.h"
/* }}} */
/*** global variables ****************************************************************************/
int verbose = 1;
/*
* Whether the Midnight Commander tries to provide more
* information about copy/move sizes and bytes transfered
* at the expense of some speed
*/
int file_op_compute_totals = 1;
/* TRANSLATORS: no need to translate 'DialogTitle', it's just a context prefix */
const char *op_names[3] = {
N_("DialogTitle|Copy"),

Просмотреть файл

@ -34,8 +34,6 @@ typedef struct
/*** global variables defined in .c file *********************************************************/
extern int file_op_compute_totals;
/*** declarations of public functions ************************************************************/
FileProgressStatus copy_file_file (FileOpTotalContext * tctx, FileOpContext * ctx,

Просмотреть файл

@ -89,10 +89,9 @@
#include "lib/widget.h"
#include "setup.h" /* verbose */
#include "main-widgets.h"
#include "main.h" /* the_hint */
#include "panel.h" /* current_panel */
#include "midnight.h"
#include "fileopctx.h" /* FILE_CONT */
#include "filegui.h"
/* }}} */

Просмотреть файл

@ -47,9 +47,9 @@
#include "setup.h" /* verbose */
#include "dir.h"
#include "panel.h" /* current_panel */
#include "main.h" /* do_cd, try_to_select */
#include "cmd.h" /* view_file_at_line */
#include "midnight.h" /* current_panel */
#include "main.h" /* do_cd */
#include "boxes.h"
#include "history.h" /* MC_HISTORY_SHARED_SEARCH */
#include "layout.h" /* mc_refresh() */

Просмотреть файл

@ -53,13 +53,13 @@
#include "lib/widget.h"
#include "setup.h" /* For profile_bname */
#include "panel.h" /* current_panel */
#include "main.h" /* update_panels() */
#include "midnight.h" /* current_panel */
#include "layout.h" /* repaint_screen() */
#include "hotlist.h"
#include "command.h" /* cmdline */
#include "history.h"
#include "hotlist.h"
/*** global variables ****************************************************************************/
int hotlist_has_dot_dot = 1;

Просмотреть файл

@ -36,8 +36,7 @@
#include "lib/util.h"
#include "lib/widget.h"
#include "main-widgets.h" /* the_menubar */
#include "panel.h" /* for the panel structure */
#include "midnight.h" /* the_menubar */
#include "layout.h"
#include "mountlist.h"
#include "setup.h" /* panels_options */

Просмотреть файл

@ -56,14 +56,13 @@
#include "lib/widget.h"
#include "command.h"
#include "main-widgets.h"
#include "midnight.h"
#include "main.h"
#include "subshell.h" /* For use_subshell and resize_subshell() */
#include "tree.h"
#include "background.h" /* we_are_background */
/* Needed for the extern declarations of integer parameters */
#include "dir.h"
#include "panel.h" /* The Panel widget */
#include "consaver/cons.saver.h"
#include "layout.h"
#include "info.h" /* The Info widget */

Просмотреть файл

@ -69,5 +69,8 @@ void clr_scr (void);
void repaint_screen (void);
void mc_refresh (void);
void print_vfs_message (const char *msg, ...) __attribute__ ((format (__printf__, 1, 2)));
/*** inline functions ****************************************************************************/
#endif /* MC__LAYOUT_H */

Просмотреть файл

@ -47,7 +47,6 @@
#include "panel.h" /* Needed for the externs */
#include "file.h"
#include "layout.h" /* repaint_screen() */
#include "main.h"
#include "listmode.h"
/*** global variables ****************************************************************************/

Просмотреть файл

@ -1,28 +0,0 @@
/** \file main-widgets.h
* \brief Header: provides definitions for some widgets
*/
#ifndef MC__MAIN_WIDGETS_H
#define MC__MAIN_WIDGETS_H
#include "lib/widget.h"
/*** typedefs(not structures) and defined constants **********************************************/
/*** enums ***************************************************************************************/
/*** structures declarations (and typedefs of structures)*****************************************/
/*** global variables defined in .c file *********************************************************/
extern WButtonBar *the_bar;
extern WLabel *the_prompt;
extern WLabel *the_hint;
extern Dlg_head *midnight_dlg;
extern struct WMenuBar *the_menubar;
/*** declarations of public functions ************************************************************/
/*** inline functions ****************************************************************************/
#endif /* MC__MAIN_WIDGETS_H */

1755
src/main.c

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -6,14 +6,9 @@
#define MC__MAIN_H
#include "lib/global.h"
#include "keybind-defaults.h"
/*** typedefs(not structures) and defined constants **********************************************/
#define MENU_PANEL (is_right ? right_panel : left_panel)
#define MENU_PANEL_IDX (is_right ? 1 : 0)
#define SELECTED_IS_PANEL (get_display_type (is_right ? 1 : 0) == view_listing)
/*** enums ***************************************************************************************/
/* run mode and params */
@ -25,10 +20,6 @@ typedef enum
MC_RUN_DIFFVIEWER
} mc_run_mode_t;
/* If true, after executing a command, wait for a keystroke */
enum
{ pause_never, pause_on_dumb_terminals, pause_always };
enum cd_enum
{
cd_parse_command,
@ -38,8 +29,6 @@ enum cd_enum
/*** structures declarations (and typedefs of structures)*****************************************/
struct WButtonBar;
struct mc_fhl_struct;
/*** global variables defined in .c file *********************************************************/
@ -60,16 +49,16 @@ extern char *mc_run_param0;
*/
extern char *mc_run_param1;
extern int quote;
extern volatile int quit;
extern int quit;
/* Set to TRUE to suppress printing the last directory */
extern gboolean print_last_revert;
/* If set, then print to the given file the last directory we were at */
extern char *last_wd_string;
extern struct mc_fhl_struct *mc_filehighlight;
/* See main.c for details on these variables */
extern int auto_menu;
extern int pause_after_run;
extern int auto_save_setup;
extern int use_internal_view;
extern int use_internal_edit;
extern int clear_before_exec;
#ifdef HAVE_CHARSET
extern int source_codepage;
@ -82,71 +71,27 @@ extern int eight_bit_clean;
extern int full_eight_bits;
#endif /* !HAVE_CHARSET */
extern char *clipboard_store_path;
extern char *clipboard_paste_path;
extern int utf8_display;
extern int fast_refresh;
extern int drop_menus;
extern int cd_symlinks;
extern int show_all_if_ambiguous;
extern int update_prompt; /* To comunicate with subshell */
extern int safe_delete;
extern int confirm_delete;
extern int confirm_directory_hotlist_delete;
extern int confirm_execute;
extern int confirm_exit;
extern int confirm_overwrite;
extern int confirm_history_cleanup;
extern int confirm_view_dir;
extern int boot_current_is_left;
extern int use_file_to_check_type;
extern int vfs_use_limit;
extern int only_leading_plus_minus;
extern int output_starts_shell;
extern int midnight_shutdown;
extern char *shell;
extern int auto_fill_mkdir_name;
/* Ugly hack in order to distinguish between left and right panel in menubar */
extern int is_right; /* If the selected menu was the right */
extern char *shell;
extern const char *mc_prompt;
extern char *mc_home;
extern char *mc_home_alt;
extern struct mc_fhl_struct *mc_filehighlight;
extern const char *home_dir;
/*** declarations of public functions ************************************************************/
void toggle_show_hidden (void);
void subshell_chdir (const char *command);
void midnight_set_buttonbar (struct WButtonBar *b);
#ifdef HAVE_SUBSHELL_SUPPORT
void do_update_prompt (void);
int load_prompt (int fd, void *unused);
#endif
int do_cd (const char *new_dir, enum cd_enum cd_type);
void sort_cmd (void);
void change_panel (void);
void save_cwds_stat (void);
gboolean quiet_quit_cmd (void); /* For cmd.c and command.c */
void touch_bar (void);
void update_xterm_title_path (void);
void load_hint (int force);
void print_vfs_message (const char *msg, ...) __attribute__ ((format (__printf__, 1, 2)));
char *get_mc_lib_dir (void);
void update_menu (void);
char *remove_encoding_from_path (const char *);
/*** inline functions ****************************************************************************/
#endif /* MC__MAIN_H */

1616
src/midnight.c Обычный файл

Разница между файлами не показана из-за своего большого размера Загрузить разницу

56
src/midnight.h Обычный файл
Просмотреть файл

@ -0,0 +1,56 @@
/** \file midnight.h
* \brief Header: main dialog (file panel) for Midnight Commander
*/
#ifndef MC__MIDNIGHT_H
#define MC__MIDNIGHT_H
#include "lib/widget.h"
#include "panel.h"
#include "layout.h"
/* TODO: merge content of layout.h here */
/*** typedefs(not structures) and defined constants **********************************************/
#define MENU_PANEL (is_right ? right_panel : left_panel)
#define MENU_PANEL_IDX (is_right ? 1 : 0)
#define SELECTED_IS_PANEL (get_display_type (is_right ? 1 : 0) == view_listing)
#define other_panel get_other_panel()
/*** enums ***************************************************************************************/
/*** structures declarations (and typedefs of structures)*****************************************/
struct WPanel;
/*** global variables defined in .c file *********************************************************/
extern Dlg_head *midnight_dlg;
extern WMenuBar *the_menubar;
extern WLabel *the_prompt;
extern WLabel *the_hint;
extern WButtonBar *the_bar;
/* Ugly hack in order to distinguish between left and right panel in menubar */
extern gboolean is_right; /* If the selected menu was the right */
extern WPanel *left_panel;
extern WPanel *right_panel;
extern WPanel *current_panel;
/*** declarations of public functions ************************************************************/
void update_menu (void);
void midnight_set_buttonbar (WButtonBar *b);
void load_hint (gboolean force);
void change_panel (void);
void save_cwds_stat (void);
gboolean quiet_quit_cmd (void);
void do_nc (void);
/*** inline functions ****************************************************************************/
#endif /* MC__MIDNIGHT_H */

Просмотреть файл

@ -37,11 +37,11 @@
#include "lib/tty/key.h" /* old_esc_mode_timeout */
#include "lib/widget.h"
#include "setup.h" /* panels_options */
#include "main.h"
#include "file.h" /* file_op_compute_totals */
#include "setup.h" /* variables */
#include "layout.h" /* nice_rotating_dash */
#include "history.h" /* MC_HISTORY_ESC_TIMEOUT */
#include "execute.h" /* pause_after_run */
#include "panel.h" /* update_panels() */
#include "option.h"

Просмотреть файл

@ -26,8 +26,6 @@
#define UP_KEEPSEL ((char *) -1)
#define other_panel get_other_panel()
/*** enums ***************************************************************************************/
enum list_types
@ -127,10 +125,6 @@ extern panel_field_t panel_fields[];
extern int torben_fj_mode;
extern int show_mini_info;
extern WPanel *left_panel;
extern WPanel *right_panel;
extern WPanel *current_panel;
extern hook_t *select_file_hook;
/*** declarations of public functions ************************************************************/
@ -162,6 +156,8 @@ gboolean do_panel_cd (struct WPanel *panel, const char *new_dir, enum cd_enum cd
void directory_history_add (struct WPanel *panel, const char *dir);
char *remove_encoding_from_path (const char *path);
gsize panel_get_num_of_sortable_fields (void);
const char **panel_get_sortable_fields (gsize *);
const panel_field_t *panel_get_field_by_id (const char *);

Просмотреть файл

@ -44,12 +44,13 @@
#include "setup.h" /* For profile_bname */
#include "dir.h"
#include "panel.h" /* current_panel */
#include "midnight.h" /* current_panel */
#include "layout.h" /* repaint_screen() */
#include "main.h"
#include "panelize.h"
#include "history.h"
#include "panelize.h"
/*** global variables ****************************************************************************/
/*** file scope macro definitions ****************************************************************/

Просмотреть файл

@ -50,7 +50,6 @@
#endif
#include "dir.h"
#include "panel.h"
#include "boxes.h"
#include "tree.h"
#include "ext.h" /* regexp_command */
@ -60,12 +59,14 @@
#include "setup.h" /* For loading/saving panel options */
#include "user.h"
#include "execute.h"
#include "main-widgets.h"
#include "main.h"
#include "midnight.h"
#include "subshell.h" /* use_subshell */
#include "mountlist.h" /* my_statfs */
#include "selcodepage.h" /* select_charset (), SELECT_CHARSET_NO_TRANSLATE */
#include "keybind-defaults.h" /* global_keymap_t */
#include "panel.h"
/*** global variables ****************************************************************************/
/* If true, show the mini-info on the panel */
@ -2577,6 +2578,18 @@ get_parent_dir_name (const char *cwd, const char *lwd)
return NULL;
}
/* --------------------------------------------------------------------------------------------- */
/** Wrapper for do_subshell_chdir, check for availability of subshell */
static void
subshell_chdir (const char *directory)
{
#ifdef HAVE_SUBSHELL_SUPPORT
if (use_subshell && vfs_current_is_local ())
do_subshell_chdir (directory, FALSE, TRUE);
#endif /* HAVE_SUBSHELL_SUPPORT */
}
/* --------------------------------------------------------------------------------------------- */
/**
* Changes the current directory of the panel.
@ -3062,7 +3075,8 @@ do_panel_event (Gpm_Event * event, WPanel * panel, gboolean * redir)
/* "." button show/hide hidden files */
if (event->x == panel->widget.cols - 5)
{
toggle_show_hidden ();
panel->widget.owner->callback (panel->widget.owner, NULL,
DLG_ACTION, CK_ToggleShowHidden, NULL);
repaint_screen ();
return MOU_NORMAL;
}
@ -3288,42 +3302,43 @@ remove_encoding_from_path (const char *path)
{
GString *ret;
GString *tmp_path, *tmp_conv;
char *tmp, *tmp2;
const char *enc;
GIConv converter;
char *tmp;
ret = g_string_new ("");
tmp_conv = g_string_new ("");
tmp_path = g_string_new (path);
while ((tmp = g_strrstr (tmp_path->str, PATH_SEP_STR VFS_ENCODING_PREFIX)) != NULL)
{
const char *enc;
GIConv converter;
char *tmp2;
enc = vfs_get_encoding ((const char *) tmp);
converter = enc ? str_crt_conv_to (enc) : str_cnv_to_term;
converter = enc != NULL ? str_crt_conv_to (enc) : str_cnv_to_term;
if (converter == INVALID_CONV)
converter = str_cnv_to_term;
tmp2 = tmp + 1;
while (*tmp2 && *tmp2 != PATH_SEP)
while (*tmp2 != '\0' && *tmp2 != PATH_SEP)
tmp2++;
if (*tmp2)
if (*tmp2 != '\0')
{
str_vfs_convert_from (converter, tmp2, tmp_conv);
g_string_prepend (ret, tmp_conv->str);
g_string_set_size (tmp_conv, 0);
}
g_string_set_size (tmp_path, tmp - tmp_path->str);
str_close_conv (converter);
}
g_string_prepend (ret, tmp_path->str);
g_string_free (tmp_path, TRUE);
g_string_free (tmp_conv, TRUE);
tmp = ret->str;
g_string_free (ret, FALSE);
return tmp;
return g_string_free (ret, FALSE);
}
/* --------------------------------------------------------------------------------------------- */

Просмотреть файл

@ -32,17 +32,11 @@
#include "lib/widget.h"
#include "lib/charsets.h"
#include "selcodepage.h"
#include "main.h"
/*** global variables ****************************************************************************/
#include "selcodepage.h"
/* Numbers of (file I/O) and (input/display) codepages. -1 if not selected */
int source_codepage = -1;
int default_source_codepage = -1;
int display_codepage = -1;
char *autodetect_codeset = NULL;
gboolean is_autodetect_codeset_enabled = FALSE;
/*** global variables ****************************************************************************/
/*** file scope macro definitions ****************************************************************/

Просмотреть файл

@ -30,10 +30,10 @@
/*** declarations of public functions ************************************************************/
/*** inline functions ****************************************************************************/
int select_charset (int center_y, int center_x, int current_charset, gboolean seldisplay);
gboolean do_set_codepage (int);
gboolean do_select_codepage (void);
/*** inline functions ****************************************************************************/
#endif /* MC__SELCODEPAGE_H */

Просмотреть файл

@ -53,16 +53,19 @@
#include "args.h"
#include "dir.h"
#include "panel.h"
#include "main.h"
#include "midnight.h"
#include "tree.h" /* xtree_mode */
#include "hotlist.h" /* load/save/done hotlist */
#include "panelize.h" /* load/save/done panelize */
#include "layout.h"
#include "cmd.h"
#include "file.h" /* safe_delete */
#include "execute.h" /* pause_after_run */
#include "clipboard.h"
#include "keybind-defaults.h" /* keybind_lookup_action */
#ifdef HAVE_CHARSET
#include "selcodepage.h"
#endif
#ifdef USE_INTERNAL_EDIT
#include "src/editor/edit.h"
@ -73,13 +76,45 @@
#include "setup.h"
/*** global variables ****************************************************************************/
char *profile_name; /* .mc/ini */
char *global_profile_name; /* mc.lib */
/* Only used at program boot */
gboolean boot_current_is_left = TRUE;
char *setup_color_string;
char *term_color_string;
char *color_terminal_string;
/* If on, default for "No" in delete operations */
int safe_delete = 0;
/* Controls screen clearing before an exec */
int clear_before_exec = 1;
/* Asks for confirmation before deleting a file */
int confirm_delete = 1;
/* Asks for confirmation before deleting a hotlist entry */
int confirm_directory_hotlist_delete = 1;
/* Asks for confirmation before overwriting a file */
int confirm_overwrite = 1;
/* Asks for confirmation before executing a program by pressing enter */
int confirm_execute = 0;
/* Asks for confirmation before leaving the program */
int confirm_exit = 1;
/* Asks for confirmation before clean up of history */
int confirm_history_cleanup = 1;
/* If true, at startup the user-menu is invoked */
int auto_menu = 0;
/* This flag indicates if the pull down menus by default drop down */
int drop_menus = 0;
/* Asks for confirmation when using F3 to view a directory and there
are tagged files */
int confirm_view_dir = 0;
panel_view_mode_t startup_left_mode;
panel_view_mode_t startup_right_mode;
@ -112,6 +147,38 @@ panels_options_t panels_options = {
int easy_patterns = 1;
/* It true saves the setup when quitting */
int auto_save_setup = 1;
/* If true, then the +, - and \ keys have their special meaning only if the
* command line is emtpy, otherwise they behave like regular letters
*/
int only_leading_plus_minus = 1;
/* Set when cd symlink following is desirable (bash mode) */
int cd_symlinks = 1;
/* Set if you want the possible completions dialog for the first time */
int show_all_if_ambiguous = 0;
/* Automatically fills name with current selected item name on mkdir */
int auto_fill_mkdir_name = 1;
/* If set and you don't have subshell support,then C-o will give you a shell */
int output_starts_shell = 0;
/* If set, we execute the file command to check the file type */
int use_file_to_check_type = 1;
int verbose = 1;
/*
* Whether the Midnight Commander tries to provide more
* information about copy/move sizes and bytes transfered
* at the expense of some speed
*/
int file_op_compute_totals = 1;
/*** file scope macro definitions ****************************************************************/
/* In order to use everywhere the same setup for the locale we use defines */
@ -817,7 +884,7 @@ load_setup (void)
g_free (buffer);
}
boot_current_is_left = mc_config_get_int (mc_panels_config, "Dirs", "current_is_left", 1);
boot_current_is_left = mc_config_get_bool (mc_panels_config, "Dirs", "current_is_left", TRUE);
/* Load time formats */
user_recent_timeformat =

Просмотреть файл

@ -25,7 +25,6 @@ typedef enum
QSEARCH_NUM
} qsearch_mode_t;
/*** structures declarations (and typedefs of structures)*****************************************/
/* panels ini options; [Panels] section */
@ -58,19 +57,38 @@ extern char *global_profile_name;
extern char *setup_color_string;
extern char *term_color_string;
extern char *color_terminal_string;
extern int confirm_delete;
extern int confirm_directory_hotlist_delete;
extern int confirm_execute;
extern int confirm_exit;
extern int confirm_overwrite;
extern int confirm_history_cleanup;
extern int confirm_view_dir;
extern int safe_delete;
extern int clear_before_exec;
extern int auto_menu;
extern int drop_menus;
extern int verbose;
extern int mouse_close_dialog;
extern int select_flags;
extern int setup_copymove_persistent_attr;
extern int num_history_items_recorded;
extern int classic_progressbar;
extern int easy_patterns;
extern int option_tab_spacing;
extern int auto_save_setup;
extern int only_leading_plus_minus;
extern int cd_symlinks;
extern int show_all_if_ambiguous;
extern int auto_fill_mkdir_name;
extern int output_starts_shell;
extern int use_file_to_check_type;
extern int file_op_compute_totals;
extern panels_options_t panels_options;
extern panel_view_mode_t startup_left_mode;
extern panel_view_mode_t startup_right_mode;
extern gboolean boot_current_is_left;
/*** declarations of public functions ************************************************************/
@ -91,12 +109,13 @@ char *load_anon_passwd (void);
void load_keymap_defs (void);
void free_keymap_defs (void);
void panel_load_setup (struct WPanel *panel, const char *section);
void panel_save_setup (struct WPanel *panel, const char *section);
void panel_load_setup (WPanel *panel, const char *section);
void panel_save_setup (WPanel *panel, const char *section);
void save_panel_types (void);
void panels_load_options (void);
void panels_save_options (void);
/*** inline functions ****************************************************************************/
#endif /* MC__SETUP_H */

Просмотреть файл

@ -48,6 +48,7 @@
#endif /* HAVE_STROPTS_H */
#include "lib/global.h"
#include "lib/tty/tty.h" /* LINES */
#include "lib/tty/key.h" /* XCTRL */
#include "lib/vfs/mc-vfs/vfs.h"
@ -56,8 +57,8 @@
#include "lib/util.h"
#include "lib/widget.h"
#include "panel.h" /* current_panel */
#include "main.h" /* do_update_prompt() */
#include "midnight.h" /* current_panel */
#include "main.h" /* home_dir */
#include "consaver/cons.saver.h" /* handle_console() */
#include "subshell.h"
@ -83,6 +84,10 @@ enum subshell_state_enum subshell_state;
/* Holds the latest prompt captured from the subshell */
char *subshell_prompt = NULL;
/* Subshell: if set, then the prompt was not saved on CONSOLE_SAVE */
/* We need to paint it after CONSOLE_RESTORE, see: load_prompt */
gboolean update_subshell_prompt = FALSE;
/*** file scope macro definitions ****************************************************************/
#ifndef WEXITSTATUS
@ -921,8 +926,8 @@ invoke_subshell (const char *command, int how, char **new_dir)
tcsetattr (STDOUT_FILENO, TCSANOW, &raw_mode);
/* Make the subshell change to MC's working directory */
if (new_dir)
do_subshell_chdir (current_panel->cwd, TRUE, 1);
if (new_dir != NULL)
do_subshell_chdir (current_panel->cwd, TRUE, TRUE);
if (command == NULL) /* The user has done "C-o" from MC */
{
@ -954,7 +959,7 @@ invoke_subshell (const char *command, int how, char **new_dir)
g_free (pcwd);
/* Restart the subshell if it has died by SIGHUP, SIGQUIT, etc. */
while (!subshell_alive && !quit && use_subshell)
while (!subshell_alive && quit == 0 && use_subshell)
init_subshell ();
prompt_pos = 0;
@ -1024,8 +1029,21 @@ read_subshell_prompt (void)
}
/* --------------------------------------------------------------------------------------------- */
/** Resize given terminal using TIOCSWINSZ, return ioctl() result */
void
do_update_prompt (void)
{
if (update_subshell_prompt)
{
printf ("\r\n%s", subshell_prompt);
fflush (stdout);
update_subshell_prompt = FALSE;
}
}
/* --------------------------------------------------------------------------------------------- */
/** Resize given terminal using TIOCSWINSZ, return ioctl() result */
static int
resize_tty (int fd)
{
@ -1171,10 +1189,10 @@ subshell_name_quote (const char *s)
/* --------------------------------------------------------------------------------------------- */
/** If it actually changed the directory it returns true */
/** If it actually changed the directory it returns true */
void
do_subshell_chdir (const char *directory, int do_update, int reset_prompt)
do_subshell_chdir (const char *directory, gboolean update_prompt, gboolean reset_prompt)
{
char *pcwd;
char *temp;
@ -1182,13 +1200,13 @@ do_subshell_chdir (const char *directory, int do_update, int reset_prompt)
pcwd = vfs_translate_path_n (current_panel->cwd);
if (!(subshell_state == INACTIVE && strcmp (subshell_cwd, pcwd)))
if (!(subshell_state == INACTIVE && strcmp (subshell_cwd, pcwd) != 0))
{
/* We have to repaint the subshell prompt if we read it from
* the main program. Please note that in the code after this
* if, the cd command that is sent will make the subshell
* repaint the prompt, so we don't have to paint it. */
if (do_update)
if (update_prompt)
do_update_prompt ();
g_free (pcwd);
return;
@ -1259,7 +1277,7 @@ do_subshell_chdir (const char *directory, int do_update, int reset_prompt)
if (reset_prompt)
prompt_pos = 0;
update_prompt = FALSE;
update_subshell_prompt = FALSE;
g_free (pcwd);
/* Make sure that MC never stores the CWD in a silly format */

Просмотреть файл

@ -18,11 +18,18 @@
/* State of the subshell; see subshell.c for an explanation */
enum subshell_state_enum
{ INACTIVE, ACTIVE, RUNNING_COMMAND };
{
INACTIVE,
ACTIVE,
RUNNING_COMMAND
};
/* For the `how' argument to various functions */
enum
{ QUIETLY, VISIBLY };
{
QUIETLY,
VISIBLY
};
/*** structures declarations (and typedefs of structures)*****************************************/
@ -39,20 +46,24 @@ extern enum subshell_state_enum subshell_state;
/* Holds the latest prompt captured from the subshell */
extern char *subshell_prompt;
extern gboolean update_subshell_prompt;
/*** declarations of public functions ************************************************************/
void init_subshell (void);
int invoke_subshell (const char *command, int how, char **new_dir);
int read_subshell_prompt (void);
void do_update_prompt (void);
void resize_subshell (void);
int exit_subshell (void);
void do_subshell_chdir (const char *directory, int update_prompt, int reset_prompt);
void do_subshell_chdir (const char *directory, gboolean update_prompt, gboolean reset_prompt);
void subshell_get_console_attributes (void);
void sigchld_handler (int sig);
#else /* not HAVE_SUBSHELL_SUPPORT */
#define use_subshell 0
#endif /* not HAVE_SUBSHELL_SUPPORT */
#endif /* HAVE_SUBSHELL_SUPPORT */
/*** inline functions ****************************************************************************/
#endif /* MC__SUBSHELL_H */

Просмотреть файл

@ -52,9 +52,8 @@
#include "lib/widget.h"
#include "dir.h"
#include "panel.h"
#include "main.h"
#include "main-widgets.h" /* the_menubar */
#include "setup.h" /* confirm_delete */
#include "midnight.h" /* the_menubar */
#include "file.h" /* copy_dir_dir(), move_dir_dir(), erase_dir() */
#include "layout.h" /* command_prompt */
#include "help.h"
@ -62,11 +61,21 @@
#include "cmd.h"
#include "keybind-defaults.h"
#include "history.h"
#include "tree.h"
#include "filegui.h"
#include "tree.h"
/*** global variables ****************************************************************************/
/* The pointer to the tree */
WTree *the_tree = NULL;
/* If this is true, then when browsing the tree the other window will
* automatically reload it's directory with the contents of the currently
* selected directory.
*/
int xtree_mode = 0;
/*** file scope macro definitions ****************************************************************/
#define tlines(t) (t->is_panel ? t->widget.lines - 2 - (show_mini_info ? 2 : 0) : t->widget.lines)

Просмотреть файл

@ -41,14 +41,14 @@
#include "src/viewer/mcviewer.h" /* for default_* externs */
#include "dir.h"
#include "panel.h"
#include "main.h"
#include "user.h"
#include "midnight.h"
#include "layout.h"
#include "execute.h"
#include "setup.h"
#include "history.h"
#include "user.h"
/*** global variables ****************************************************************************/
/*** file scope macro definitions ****************************************************************/

Просмотреть файл

@ -58,7 +58,6 @@
#include "lib/widget.h"
#include "lib/charsets.h"
#include "src/panel.h"
#include "src/layout.h"
#include "src/history.h"
#include "src/cmd.h"
@ -66,6 +65,7 @@
#include "src/help.h"
#include "src/keybind-defaults.h"
#include "src/main.h" /* midnight_shutdown */
#include "src/midnight.h" /* current_panel */
#include "internal.h"
#include "mcviewer.h"

Просмотреть файл

@ -45,10 +45,12 @@
#include "lib/strutil.h"
#include "lib/util.h"
#include "lib/widget.h"
#ifdef HAVE_CHARSET
#include "lib/charsets.h"
#endif
#include "src/setup.h" /* panels_options */
#include "src/main.h" /* source_codepage */
#include "src/main.h"
#include "internal.h"
#include "mcviewer.h"

Просмотреть файл

@ -50,7 +50,7 @@
#include "src/main.h"
#include "src/layout.h" /* menubar_visible */
#include "src/main-widgets.h" /* the_menubar */
#include "src/midnight.h" /* the_menubar */
#include "internal.h"
#include "mcviewer.h"