Merge branch '2305_drop_panel_old_options'

* 2305_drop_panel_old_options:
  Reorganization of "Show mini info" option.
  torben_fj_mode options was moved from [Midnight-Commander] section to [Panels] one.
  Ticket #2305: drop backward compatibility for global panels options.
This commit is contained in:
Andrew Borodin 2011-01-30 12:25:00 +03:00
commit 22cdf545f4
9 changed files with 73 additions and 92 deletions

View File

@ -1940,10 +1940,6 @@ on native console only.
If enabled, main menu of Midnight Commander is always visible on the top row
of screen above panels. Enabled by default.
.PP
.I Show mini\-status.
If enabled, one line of status information about the currently selected item
is shown at the bottom of the panels. Enabled by default.
.PP
.I Command prompt.
If enabled, command line is avalable. Enabled by default.
.PP
@ -1968,6 +1964,10 @@ at the bottom frame of panel. Enabled by default.
.SH " Panel options"
.B Main panel options
.PP
.I Show mini\-status.
If enabled, one line of status information about the currently selected item
is shown at the bottom of the panels. Enabled by default.
.PP
.I Use SI size units.
If this option is enabled, Midnight Commander will use SI units (powers of 1000)
when displaying any byte sizes. The suffixes (k, m ...) are shown in lowercase.

View File

@ -2087,10 +2087,6 @@ FreeBSD. Она устанавливает число строк, которые
Если включено, основное меню программы будет отображаться постоянно вверху
экрана. По умолчанию включено.
.PP
.I Мини\-статус.
Если включено, в нижней части каждой панели выводится строка информации
о выделенном подсветкой файле или каталоге каждой панели. По умолчанию включено.
.PP
.I Командная строка.
Если включено, в нижней части экрана будет доступна командная строка.
По умолчанию включено.
@ -2117,6 +2113,10 @@ FreeBSD. Она устанавливает число строк, которые
.SH " Настройки панелей"
.B Основные настройки панелей
.PP
.I Показывать мини\-статус.
Если включено, в нижней части каждой панели выводится строка информации
о выделенном подсветкой файле или каталоге каждой панели. По умолчанию включено.
.PP
.I Размеры в единицах СИ.
Если эта опция включена, то Midnight Commander отображает размеры файлов
и каталогов в единицах СИ (по основанию 1000). Суффиксы к, м, и т. д.

View File

@ -190,7 +190,6 @@ static struct
{ N_("H&intbar visible"), &message_visible, NULL},
{ N_("&Keybar visible"), &keybar_visible, NULL},
{ N_("Command &prompt"), &command_prompt, NULL},
{ N_("Show &mini status"), &show_mini_info, NULL},
{ N_("Menu&bar visible"), &menubar_visible, NULL},
{ N_("&Equal split"), &equal_split, NULL}
/* *INDENT-ON* */
@ -242,7 +241,7 @@ update_split (const Dlg_head * h)
it can change due to calling _check_split() as well */
_check_split ();
tty_setcolor (check_options[7].widget->state & C_BOOL ? DISABLED_COLOR : COLOR_NORMAL);
tty_setcolor (check_options[6].widget->state & C_BOOL ? DISABLED_COLOR : COLOR_NORMAL);
dlg_move (h, 6, 6);
tty_printf ("%03d", _first_panel_size);
@ -329,8 +328,8 @@ layout_callback (Dlg_head * h, Widget * sender, dlg_msg_t msg, int parm, void *d
return MSG_HANDLED;
case DLG_POST_KEY:
_menubar_visible = check_options[6].widget->state & C_BOOL;
_command_prompt = check_options[5].widget->state & C_BOOL;
_menubar_visible = check_options[5].widget->state & C_BOOL;
_command_prompt = check_options[4].widget->state & C_BOOL;
_keybar_visible = check_options[3].widget->state & C_BOOL;
_message_visible = check_options[2].widget->state & C_BOOL;
_xterm_title = check_options[1].widget->state & C_BOOL;
@ -383,9 +382,9 @@ layout_callback (Dlg_head * h, Widget * sender, dlg_msg_t msg, int parm, void *d
return MSG_HANDLED;
}
if (sender == (Widget *) check_options[7].widget)
if (sender == (Widget *) check_options[6].widget)
{
_equal_split = check_options[7].widget->state & C_BOOL;
_equal_split = check_options[6].widget->state & C_BOOL;
widget_disable (bleft_widget->widget, _equal_split);
send_message ((Widget *) bleft_widget, WIDGET_DRAW, 0);
@ -534,7 +533,7 @@ init_layout (void)
bleft_widget = button_new (6, 9, B_2LEFT, NARROW_BUTTON, "&<", b_left_right_cback);
widget_disable (bleft_widget->widget, _equal_split);
add_widget (layout_dlg, bleft_widget);
check_options[7].widget = check_new (5, 6, XTRACT (7));
check_options[6].widget = check_new (5, 6, XTRACT (6));
old_first_panel_size = -1;
old_horizontal_split = -1;
@ -543,7 +542,8 @@ init_layout (void)
_first_panel_size = first_panel_size;
_output_lines = output_lines;
add_widget (layout_dlg, check_options[7].widget);
add_widget (layout_dlg, check_options[6].widget);
radio_widget = radio_new (3, 6, 2, s_split_direction);
add_widget (layout_dlg, radio_widget);
radio_widget->sel = horizontal_split;

View File

@ -320,26 +320,28 @@ panel_options_box (void)
QUICK_GROUPBOX (dlg_width / 2, dlg_width, 2, dlg_height, dlg_width / 2 - 4, 5,
N_("Navigation")),
/* main panel options */
QUICK_CHECKBOX (5, dlg_width, 11, dlg_height, N_("A&uto save panels setup"),
QUICK_CHECKBOX (5, dlg_width, 12, dlg_height, N_("A&uto save panels setup"),
&panels_options.auto_save_setup),
QUICK_CHECKBOX (5, dlg_width, 10, dlg_height, N_("Simple s&wap"),
QUICK_CHECKBOX (5, dlg_width, 11, dlg_height, N_("Simple s&wap"),
&simple_swap),
QUICK_CHECKBOX (5, dlg_width, 9, dlg_height, N_("Re&verse files only"),
QUICK_CHECKBOX (5, dlg_width, 10, dlg_height, N_("Re&verse files only"),
&panels_options.reverse_files_only),
QUICK_CHECKBOX (5, dlg_width, 8, dlg_height, N_("Ma&rk moves down"),
QUICK_CHECKBOX (5, dlg_width, 9, dlg_height, N_("Ma&rk moves down"),
&panels_options.mark_moves_down),
QUICK_CHECKBOX (5, dlg_width, 7, dlg_height, N_("&Fast dir reload"),
QUICK_CHECKBOX (5, dlg_width, 8, dlg_height, N_("&Fast dir reload"),
&panels_options.fast_reload),
QUICK_CHECKBOX (5, dlg_width, 6, dlg_height, N_("Show &hidden files"),
QUICK_CHECKBOX (5, dlg_width, 7, dlg_height, N_("Show &hidden files"),
&panels_options.show_dot_files),
QUICK_CHECKBOX (5, dlg_width, 5, dlg_height, N_("Show &backup files"),
QUICK_CHECKBOX (5, dlg_width, 6, dlg_height, N_("Show &backup files"),
&panels_options.show_backups),
QUICK_CHECKBOX (5, dlg_width, 4, dlg_height, N_("Mi&x all files"),
QUICK_CHECKBOX (5, dlg_width, 5, dlg_height, N_("Mi&x all files"),
&panels_options.mix_all_files),
QUICK_CHECKBOX (5, dlg_width, 3, dlg_height, N_("Use SI si&ze units"),
QUICK_CHECKBOX (5, dlg_width, 4, dlg_height, N_("Use SI si&ze units"),
&panels_options.kilobyte_si),
QUICK_CHECKBOX (5, dlg_width, 3, dlg_height, N_("Show mi&ni-status"),
&panels_options.show_mini_info),
QUICK_GROUPBOX (3, dlg_width, 2, dlg_height, dlg_width / 2 - 4, 14,
N_("Main panel options")),
N_("Main options")),
QUICK_END
};
@ -370,7 +372,7 @@ panel_options_box (void)
for (j = 0; j < QSEARCH_NUM; j++)
qsearch_options[j] = _(qsearch_options[j]);
}
else if ((i == 4) || (i == 7) || (i == 11) || (i == 21))
else if ((i == 4) || (i == 7) || (i == 11) || (i == 22))
/* groupboxes */
quick_widgets[i].u.groupbox.title = _(quick_widgets[i].u.groupbox.title);
else
@ -392,7 +394,7 @@ panel_options_box (void)
/* checkboxes within groupboxes */
c_len = 0;
for (i = 5; i < 21; i++)
for (i = 5; i < 22; i++)
if ((i != 7) && (i != 11))
c_len = max (c_len, str_term_width1 (quick_widgets[i].u.checkbox.text) + 4);
@ -403,7 +405,7 @@ panel_options_box (void)
g_len = max (c_len + 2, str_term_width1 (quick_widgets[4].u.groupbox.title) + 4);
g_len = max (g_len, str_term_width1 (quick_widgets[7].u.groupbox.title) + 4);
g_len = max (g_len, str_term_width1 (quick_widgets[11].u.groupbox.title) + 4);
g_len = max (g_len, str_term_width1 (quick_widgets[21].u.groupbox.title) + 4);
g_len = max (g_len, str_term_width1 (quick_widgets[22].u.groupbox.title) + 4);
/* dialog width */
Quick_input.xlen = max (dlg_width, g_len * 2 + 9);
Quick_input.xlen = max (Quick_input.xlen, b_len + 2);
@ -418,7 +420,7 @@ panel_options_box (void)
quick_widgets[4].u.groupbox.width =
quick_widgets[7].u.groupbox.width =
quick_widgets[11].u.groupbox.width = Quick_input.xlen / 2 - 3;
quick_widgets[21].u.groupbox.width = Quick_input.xlen / 2 - 4;
quick_widgets[22].u.groupbox.width = Quick_input.xlen / 2 - 4;
/* right column */
quick_widgets[4].relative_x =

View File

@ -70,12 +70,6 @@
/*** global variables ****************************************************************************/
/* If true, show the mini-info on the panel */
int show_mini_info = 1;
/* If true, use some usability hacks by Torben */
int torben_fj_mode = 0;
/* The hook list for the select file function */
hook_t *select_file_hook = NULL;
@ -312,7 +306,7 @@ extern int saving_setup;
#define STATUS 5
/* This macro extracts the number of available lines in a panel */
#define llines(p) (p->widget.lines-3 - (show_mini_info ? 2 : 0))
#define llines(p) (p->widget.lines - 3 - (panels_options.show_mini_info ? 2 : 0))
/*** file scope type declarations ****************************************************************/
@ -882,7 +876,7 @@ repaint_file (WPanel * panel, int file_index, int mv, int attr, int isstatus)
static void
display_mini_info (WPanel * panel)
{
if (!show_mini_info)
if (!panels_options.show_mini_info)
return;
widget_move (&panel->widget, llines (panel) + 3, 1);
@ -1001,7 +995,7 @@ display_total_marked_size (WPanel * panel, int y, int x, gboolean size_only)
static void
mini_info_separator (WPanel * panel)
{
if (show_mini_info)
if (panels_options.show_mini_info)
{
const int y = llines (panel) + 2;
@ -1069,7 +1063,7 @@ show_dir (WPanel * panel)
draw_box (panel->widget.owner,
panel->widget.y, panel->widget.x, panel->widget.lines, panel->widget.cols, FALSE);
if (show_mini_info)
if (panels_options.show_mini_info)
{
widget_move (&panel->widget, llines (panel) + 2, 0);
tty_print_alt_char (ACS_LTEE, FALSE);
@ -1098,7 +1092,7 @@ show_dir (WPanel * panel)
str_term_trim (strip_home_and_password (panel->cwd),
min (max (panel->widget.cols - 12, 0), panel->widget.cols)));
if (!show_mini_info)
if (!panels_options.show_mini_info)
{
if (panel->marked == 0)
{
@ -1956,9 +1950,10 @@ move_home (WPanel * panel)
{
if (panel->selected == 0)
return;
unselect_item (panel);
if (torben_fj_mode)
if (panels_options.torben_fj_mode)
{
int middle_pos = panel->top_file + (ITEMS (panel) / 2);
@ -1988,8 +1983,10 @@ move_end (WPanel * panel)
{
if (panel->selected == panel->count - 1)
return;
unselect_item (panel);
if (torben_fj_mode)
if (panels_options.torben_fj_mode)
{
int middle_pos = panel->top_file + (ITEMS (panel) / 2);
@ -2870,7 +2867,7 @@ panel_key (WPanel * panel, int key)
if (key == panel_map[i].key)
return panel_execute_cmd (panel, panel_map[i].command);
if (torben_fj_mode && key == ALT ('h'))
if (panels_options.torben_fj_mode && key == ALT ('h'))
{
goto_middle_file (panel);
return MSG_HANDLED;
@ -3624,7 +3621,7 @@ set_panel_formats (WPanel * p)
p->format = form;
}
if (show_mini_info)
if (panels_options.show_mini_info)
{
form = use_display_format (p, mini_status_format (p), &err, 1);

View File

@ -133,9 +133,6 @@ typedef struct WPanel
extern panel_field_t panel_fields[];
extern int torben_fj_mode;
extern int show_mini_info;
extern hook_t *select_file_hook;
/*** declarations of public functions ************************************************************/

View File

@ -51,7 +51,7 @@
#include "lib/util.h"
#include "lib/widget.h"
#include "src/setup.h" /* confirm_delete */
#include "src/setup.h" /* confirm_delete, panels_options */
#include "src/keybind-defaults.h"
#include "src/history.h"
#include "src/help.h"
@ -79,7 +79,7 @@ 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)
#define tlines(t) (t->is_panel ? t->widget.lines - 2 - (panels_options.show_mini_info ? 2 : 0) : t->widget.lines)
/* Use the color of the parent widget for the unselected entries */
#define TREE_NORMALC(h) (h->color[DLG_COLOR_NORMAL])
@ -227,7 +227,7 @@ tree_show_mini_info (WTree * tree, int tree_lines, int tree_cols)
/* Show mini info */
if (tree->is_panel)
{
if (!show_mini_info)
if (!panels_options.show_mini_info)
return;
line = tree_lines + 2;
}
@ -1147,7 +1147,7 @@ tree_frame (Dlg_head * h, WTree * tree)
widget_move (&tree->widget, 0, (tree->widget.cols - len - 2) / 2);
tty_printf (" %s ", title);
if (show_mini_info)
if (panels_options.show_mini_info)
widget_move (&tree->widget, tlines (tree) + 1, 0);
tty_print_alt_char (ACS_LTEE, FALSE);
widget_move (&tree->widget, tlines (tree) + 1, tree->widget.cols - 1);

View File

@ -129,6 +129,7 @@ int option_tab_spacing = DEFAULT_TAB_SPACING;
int saving_setup;
panels_options_t panels_options = {
.show_mini_info = TRUE,
.kilobyte_si = FALSE,
.mix_all_files = FALSE,
.show_backups = TRUE,
@ -143,7 +144,8 @@ panels_options_t panels_options = {
.mouse_move_pages = TRUE,
.filetype_mode = TRUE,
.permission_mode = FALSE,
.qsearch_mode = QSEARCH_PANEL_CASE
.qsearch_mode = QSEARCH_PANEL_CASE,
.torben_fj_mode = FALSE
};
int easy_patterns = 1;
@ -230,7 +232,6 @@ static const struct
{ "output_lines", &output_lines },
{ "command_prompt", &command_prompt },
{ "menubar_visible", &menubar_visible },
{ "show_mini_info", &show_mini_info },
{ "free_space", &free_space },
{ NULL, NULL }
};
@ -273,7 +274,6 @@ static const struct
{ "cd_symlinks", &cd_symlinks },
{ "show_all_if_ambiguous", &show_all_if_ambiguous },
{ "max_dirt_limit", &mcview_max_dirt_limit },
{ "torben_fj_mode", &torben_fj_mode },
{ "use_file_to_guess_type", &use_file_to_check_type },
{ "alternate_plus_minus", &alternate_plus_minus },
{ "only_leading_plus_minus", &only_leading_plus_minus },
@ -347,24 +347,25 @@ static const struct
static const struct
{
const char *opt_name;
const char *opt_old_name;
gboolean *opt_addr;
} panels_ini_options[] = {
{ "kilobyte_si", NULL, &panels_options.kilobyte_si },
{ "mix_all_files", NULL, &panels_options.mix_all_files },
{ "show_backups", NULL, &panels_options.show_backups },
{ "show_dot_files", NULL, &panels_options.show_dot_files },
{ "fast_reload", NULL, &panels_options.fast_reload },
{ "fast_reload_msg_shown", NULL, &panels_options.fast_reload_msg_shown },
{ "mark_moves_down", NULL, &panels_options.mark_moves_down },
{ "reverse_files_only", NULL, &panels_options.reverse_files_only },
{ "auto_save_setup_panels", "auto_save_setup", &panels_options.auto_save_setup },
{ "navigate_with_arrows", NULL, &panels_options.navigate_with_arrows },
{ "panel_scroll_pages", "scroll_pages", &panels_options.scroll_pages },
{ "mouse_move_pages", NULL, &panels_options.mouse_move_pages },
{ "filetype_mode", NULL, &panels_options.filetype_mode },
{ "permission_mode", NULL, &panels_options.permission_mode },
{ NULL, NULL, NULL }
{ "show_mini_info", &panels_options.show_mini_info },
{ "kilobyte_si", &panels_options.kilobyte_si },
{ "mix_all_files", &panels_options.mix_all_files },
{ "show_backups", &panels_options.show_backups },
{ "show_dot_files", &panels_options.show_dot_files },
{ "fast_reload", &panels_options.fast_reload },
{ "fast_reload_msg_shown", &panels_options.fast_reload_msg_shown },
{ "mark_moves_down", &panels_options.mark_moves_down },
{ "reverse_files_only", &panels_options.reverse_files_only },
{ "auto_save_setup_panels", &panels_options.auto_save_setup },
{ "navigate_with_arrows", &panels_options.navigate_with_arrows },
{ "panel_scroll_pages", &panels_options.scroll_pages },
{ "mouse_move_pages", &panels_options.mouse_move_pages },
{ "filetype_mode", &panels_options.filetype_mode },
{ "permission_mode", &panels_options.permission_mode },
{ "torben_fj_mode", &panels_options.torben_fj_mode },
{ NULL, NULL }
};
/* *INDENT-ON* */
@ -1378,29 +1379,11 @@ panel_save_setup (struct WPanel *panel, const char *section)
void
panels_load_options (void)
{
if (mc_config_has_group (mc_main_config, CONFIG_PANELS_SECTION))
{
size_t i;
int qmode;
/* Backward compatibility: load old parameters */
for (i = 0; panels_ini_options[i].opt_name != NULL; i++)
*panels_ini_options[i].opt_addr =
mc_config_get_int (mc_main_config, CONFIG_APP_SECTION,
panels_ini_options[i].opt_old_name != NULL
? panels_ini_options[i].opt_old_name : panels_ini_options[i].
opt_name, *panels_ini_options[i].opt_addr);
qmode = mc_config_get_int (mc_main_config, CONFIG_APP_SECTION,
"quick_search_case_sensitive", (int) panels_options.qsearch_mode);
if (qmode < 0)
panels_options.qsearch_mode = QSEARCH_CASE_INSENSITIVE;
else if (qmode >= QSEARCH_NUM)
panels_options.qsearch_mode = QSEARCH_PANEL_CASE;
else
panels_options.qsearch_mode = (qsearch_mode_t) qmode;
/* overwrite by new parameters */
if (mc_config_has_group (mc_main_config, CONFIG_PANELS_SECTION))
{
for (i = 0; panels_ini_options[i].opt_name != NULL; i++)
*panels_ini_options[i].opt_addr =
mc_config_get_bool (mc_main_config, CONFIG_PANELS_SECTION,

View File

@ -31,6 +31,7 @@ typedef enum
/* panels ini options; [Panels] section */
typedef struct
{
gboolean show_mini_info; /* If true, show the mini-info on the panel */
gboolean kilobyte_si; /* If TRUE, SI units (1000 based) will be used for larger units
* (kilobyte, megabyte, ...). If FALSE, binary units (1024 based) will be used */
gboolean mix_all_files; /* If FALSE then directories are shown separately from files */
@ -48,6 +49,7 @@ typedef struct
gboolean filetype_mode; /* If TRUE then add per file type hilighting */
gboolean permission_mode; /* If TRUE, we use permission hilighting */
qsearch_mode_t qsearch_mode; /* Quick search mode */
gboolean torben_fj_mode; /* If TRUE, use some usability hacks by Torben */
} panels_options_t;
/*** global variables defined in .c file *********************************************************/