Reorganization of "Show mini info" option.

"Show mini info" checkbox was moved from the "Layout" dialog window
to the "Panel options" one. Documentation was updated.
The show_mini_info global variable was transformed to the member
of panels_options_t structure.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2010-08-09 12:07:04 +04:00
parent f13778d94f
commit 09021fd954
9 changed files with 45 additions and 46 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,9 +70,6 @@
/*** global variables ****************************************************************************/
/* If true, show the mini-info on the panel */
int show_mini_info = 1;
/* The hook list for the select file function */
hook_t *select_file_hook = NULL;
@ -309,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 ****************************************************************/
@ -879,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);
@ -998,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;
@ -1066,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);
@ -1095,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)
{
@ -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,8 +133,6 @@ typedef struct WPanel
extern panel_field_t panel_fields[];
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,
@ -231,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 }
};
@ -349,6 +349,7 @@ static const struct
const char *opt_name;
gboolean *opt_addr;
} panels_ini_options[] = {
{ "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 },

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 */