Merge branch '2585_mcedit_input_fname_before_edit'

* 2585_mcedit_input_fname_before_edit:
  add option "Ask new file name" in the Configuration box
  Ticket #2585 (Ask filename before create new file)
This commit is contained in:
Andrew Borodin 2013-02-03 10:10:45 +04:00
commit 74d71e7523
6 changed files with 37 additions and 5 deletions

View File

@ -1874,6 +1874,9 @@ command is used. See the section on the
internal file viewer\&. internal file viewer\&.
.\"Internal File Viewer" .\"Internal File Viewer"
.PP .PP
.I Ask new file name
If this option is enabled, file name is asked before open new file in editor.
.PP
.I Auto menus. .I Auto menus.
If this option is enabled, the user menu will be invoked at startup. If this option is enabled, the user menu will be invoked at startup.
Useful for building menus for non\-unixers. Useful for building menus for non\-unixers.

View File

@ -2002,6 +2002,10 @@ FreeBSD или при использовании xterm вы можете про
компьютере работают неопытные пользователи (операторы), которые должны компьютере работают неопытные пользователи (операторы), которые должны
выполнять только стандартные операции. выполнять только стандартные операции.
.PP .PP
.I Спрашивать имя нового файла.
Если эта опция включена, то перед открытием нового файла в редакторе
будет запрошено его имя.
.PP
.I Выпадение меню при вызове. .I Выпадение меню при вызове.
Если эта опция включена, то при вызове главного меню нажатием клавиши F9 Если эта опция включена, то при вызове главного меню нажатием клавиши F9
будет сразу отображаться перечень пунктов меню (выпадающее меню). будет сразу отображаться перечень пунктов меню (выпадающее меню).

View File

@ -458,7 +458,7 @@ configure_box (void)
QUICK_CHECKBOX (N_("Compute tota&ls"), &file_op_compute_totals, NULL), QUICK_CHECKBOX (N_("Compute tota&ls"), &file_op_compute_totals, NULL),
QUICK_CHECKBOX (N_("Classic pro&gressbar"), &classic_progressbar, NULL), QUICK_CHECKBOX (N_("Classic pro&gressbar"), &classic_progressbar, NULL),
QUICK_CHECKBOX (N_("Mkdi&r autoname"), &auto_fill_mkdir_name, NULL), QUICK_CHECKBOX (N_("Mkdi&r autoname"), &auto_fill_mkdir_name, NULL),
QUICK_CHECKBOX (N_("Preallocate &space"), &mc_global.vfs.preallocate_space, QUICK_CHECKBOX (N_("&Preallocate space"), &mc_global.vfs.preallocate_space,
NULL), NULL),
QUICK_STOP_GROUPBOX, QUICK_STOP_GROUPBOX,
QUICK_START_GROUPBOX (N_("Esc key mode")), QUICK_START_GROUPBOX (N_("Esc key mode")),
@ -474,9 +474,11 @@ configure_box (void)
QUICK_START_GROUPBOX (N_("Other options")), QUICK_START_GROUPBOX (N_("Other options")),
QUICK_CHECKBOX (N_("Use internal edi&t"), &use_internal_edit, NULL), QUICK_CHECKBOX (N_("Use internal edi&t"), &use_internal_edit, NULL),
QUICK_CHECKBOX (N_("Use internal vie&w"), &use_internal_view, NULL), QUICK_CHECKBOX (N_("Use internal vie&w"), &use_internal_view, NULL),
QUICK_CHECKBOX (N_("A&sk new file name"),
&editor_ask_filename_before_edit, NULL),
QUICK_CHECKBOX (N_("Auto m&enus"), &auto_menu, NULL), QUICK_CHECKBOX (N_("Auto m&enus"), &auto_menu, NULL),
QUICK_CHECKBOX (N_("&Drop down menus"), &drop_menus, NULL), QUICK_CHECKBOX (N_("&Drop down menus"), &drop_menus, NULL),
QUICK_CHECKBOX (N_("Shell &patterns"), &easy_patterns, NULL), QUICK_CHECKBOX (N_("S&hell patterns"), &easy_patterns, NULL),
QUICK_CHECKBOX (N_("Co&mplete: show all"), QUICK_CHECKBOX (N_("Co&mplete: show all"),
&mc_global.widget.show_all_if_ambiguous, NULL), &mc_global.widget.show_all_if_ambiguous, NULL),
QUICK_CHECKBOX (N_("Rotating d&ash"), &nice_rotating_dash, NULL), QUICK_CHECKBOX (N_("Rotating d&ash"), &nice_rotating_dash, NULL),
@ -486,7 +488,6 @@ configure_box (void)
QUICK_SEPARATOR (FALSE), QUICK_SEPARATOR (FALSE),
QUICK_SEPARATOR (FALSE), QUICK_SEPARATOR (FALSE),
QUICK_SEPARATOR (FALSE), QUICK_SEPARATOR (FALSE),
QUICK_SEPARATOR (FALSE),
QUICK_STOP_GROUPBOX, QUICK_STOP_GROUPBOX,
QUICK_STOP_COLUMNS, QUICK_STOP_COLUMNS,
QUICK_BUTTONS_OK_CANCEL, QUICK_BUTTONS_OK_CANCEL,

View File

@ -3,7 +3,7 @@
They normally operate on the current panel. They normally operate on the current panel.
Copyright (C) 1994, 1995, 1998, 1999, 2000, 2001, 2002, 2003, 2004, Copyright (C) 1994, 1995, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
2005, 2006, 2007, 2009, 2011 2005, 2006, 2007, 2009, 2011, 2013
The Free Software Foundation, Inc. The Free Software Foundation, Inc.
This file is part of the Midnight Commander. This file is part of the Midnight Commander.
@ -818,10 +818,29 @@ edit_cmd_force_internal (void)
void void
edit_cmd_new (void) edit_cmd_new (void)
{ {
vfs_path_t *fname_vpath = NULL;
if (editor_ask_filename_before_edit)
{
char *fname;
fname = input_expand_dialog (_("Edit file"), _("Enter file name:"),
MC_HISTORY_EDIT_LOAD, "");
if (fname == NULL)
return;
if (*fname != '\0')
fname_vpath = vfs_path_from_str (fname);
g_free (fname);
}
#ifdef HAVE_CHARSET #ifdef HAVE_CHARSET
mc_global.source_codepage = default_source_codepage; mc_global.source_codepage = default_source_codepage;
#endif #endif
do_edit (NULL); do_edit (fname_vpath);
vfs_path_free (fname_vpath);
} }
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */

View File

@ -115,6 +115,9 @@ int drop_menus = 0;
are tagged files */ are tagged files */
int confirm_view_dir = 0; int confirm_view_dir = 0;
/* Ask file name before start the editor */
int editor_ask_filename_before_edit = 0;
panel_view_mode_t startup_left_mode; panel_view_mode_t startup_left_mode;
panel_view_mode_t startup_right_mode; panel_view_mode_t startup_right_mode;
@ -353,6 +356,7 @@ static const struct
{ "editor_show_right_margin", &show_right_margin }, { "editor_show_right_margin", &show_right_margin },
{ "editor_group_undo", &option_group_undo }, { "editor_group_undo", &option_group_undo },
#endif /* USE_INTERNAL_EDIT */ #endif /* USE_INTERNAL_EDIT */
{ "editor_ask_filename_before_edit", &editor_ask_filename_before_edit },
{ "nice_rotating_dash", &nice_rotating_dash }, { "nice_rotating_dash", &nice_rotating_dash },
{ "mcview_remember_file_position", &mcview_remember_file_position }, { "mcview_remember_file_position", &mcview_remember_file_position },
{ "auto_fill_mkdir_name", &auto_fill_mkdir_name }, { "auto_fill_mkdir_name", &auto_fill_mkdir_name },

View File

@ -98,6 +98,7 @@ extern int auto_fill_mkdir_name;
extern int output_starts_shell; extern int output_starts_shell;
extern int use_file_to_check_type; extern int use_file_to_check_type;
extern int file_op_compute_totals; extern int file_op_compute_totals;
extern int editor_ask_filename_before_edit;
extern panels_options_t panels_options; extern panels_options_t panels_options;