1
1

Merge branch '2686_master_cleanup'

* 2686_master_cleanup:
  Modified "Configure options" dialog for better look'n'feel.
  Fixed user defined home dir, if home dir contain tilda (~/)
  Fixed memory leak in lib/serialize.c
  Move type and function declarations.
  (mc_config_normalize_before_save): fixed possible memory leak.
  (history_put): unused. Removed.
  Fixed double declaration of midnight_dlg variable.
  Moved declaration of old_esc_mode_timeout variable to the proper file section.
  More type accuracy
  (tty_lowlevel_getch): used in lib/tty only.
  Type accuracy.
  Fixed panel type replacement.
  Ticket 2686: Code cleanup
Этот коммит содержится в:
Slava Zanko 2011-12-13 11:21:26 +03:00
родитель c697e28e9c bd2ddb54cb
Коммит 8187e6eca5
26 изменённых файлов: 152 добавлений и 174 удалений

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

@ -141,8 +141,9 @@ incomplete, use `configure --help' to get the full list):
`--with-homedir'
This option allow users to place user config directories in any
place. By default value is 'XDG', this mean, mc will respect XDG
standards. If other value will specified, this will used as directory
name (relative to $HOME).
standards. If other value is specified, this will used as directory
name (relative to $HOME if path is relative, or as is if path is
absolute).
VFS options:
- - - - - -

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

@ -1798,6 +1798,10 @@ When you press F7 to create a new directory, the input line in popup dialog
will be filled by name of current file or directory in active panel.
Disabled by default.
.PP
.I Preallocate space
Preallocate space for whole target file, if possible, before copy operation.
Disabled by default.
.PP
.B Esc key mode.
.PP
By default the Midnight Commander treats the ESC key as a key prefix.

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

@ -1907,6 +1907,9 @@ mc на экране.
При создании нового каталога по F7 в поле ввода имени нового каталога
будет автоматически подставляться имя файла или каталога, находящегося
под курсором. По умолчанию выключено.
.I Выделять место
Если возможно, предварительно выделять место под весь копируемый файл.
По умолчанию выключено.
.PP
.B Клавиша Esc
.PP

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

@ -301,11 +301,17 @@ mc_config_init_config_paths (GError ** error)
mc_config_fix_migrated_rules ();
#else /* MC_HOMEDIR_XDG */
char *u_config_dir = g_build_filename (mc_config_get_home_dir (), MC_USERCONF_DIR, NULL);
char *defined_userconf_dir;
char *u_config_dir;
u_config_dir = (u_config_dir == NULL)
? g_build_filename (mc_config_get_home_dir (), MC_OLD_USERCONF_DIR,
NULL) : g_strdup (u_config_dir);
defined_userconf_dir = tilde_expand (MC_USERCONF_DIR);
if (!g_path_is_absolute (defined_userconf_dir))
{
u_config_dir = g_build_filename (mc_config_get_home_dir (), MC_USERCONF_DIR, NULL);
g_free (defined_userconf_dir);
}
else
u_config_dir = defined_userconf_dir;
mc_data_str = mc_cache_str = mc_config_str =
mc_config_init_one_config_path (u_config_dir, "", error);

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

@ -43,6 +43,7 @@ mc_config_normalize_before_save (const gchar * value)
{
GIConv conv;
GString *buffer;
gboolean ok;
if (mc_global.utf8_display)
return g_strdup (value);
@ -53,13 +54,15 @@ mc_config_normalize_before_save (const gchar * value)
buffer = g_string_new ("");
if (str_convert (conv, value, buffer) == ESTR_FAILURE)
ok = (str_convert (conv, value, buffer) != ESTR_FAILURE);
str_close_conv (conv);
if (!ok)
{
g_string_free (buffer, TRUE);
return g_strdup (value);
}
str_close_conv (conv);
return g_string_free (buffer, FALSE);
}

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

@ -321,7 +321,7 @@ mc_deserialize_config (const char *data, GError ** error)
break;
case WAIT_VALUE:
current_value = mc_deserialize_str ('v', data, error);
if (current_param == NULL)
if (current_value == NULL)
{
g_free (current_group);
g_free (current_param);

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

@ -82,6 +82,8 @@
int mou_auto_repeat = 100;
int double_click_speed = 250;
int old_esc_mode = 0;
/* timeout for old_esc_mode in usec */
int old_esc_mode_timeout = 1000000; /* settable via env */
int use_8th_bit_as_meta = 0;
/* This table is a mapping between names and the constants we use
@ -501,9 +503,6 @@ static key_define_t qansi_key_defines[] = {
{0, NULL, MCKEY_NOACTION},
};
/* timeout for old_esc_mode in usec */
int old_esc_mode_timeout = 1000000; /* settable via env */
/* This holds all the key definitions */
static key_def *keys = NULL;

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

@ -38,6 +38,7 @@ extern char *rmcup;
char *mc_tty_normalize_from_utf8 (const char *);
void tty_init_xterm_support (gboolean is_xterm);
int tty_lowlevel_getch (void);
/*** inline functions ****************************************************************************/
#endif /* MC_TTY_INTERNAL_H */

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

@ -93,7 +93,7 @@ tty_setup_sigwinch (void (*handler) (int))
/* --------------------------------------------------------------------------------------------- */
void
static void
sigwinch_handler (int dummy)
{
(void) dummy;

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

@ -97,8 +97,6 @@ extern void tty_keypad (gboolean set);
extern void tty_nodelay (gboolean set);
extern int tty_baudrate (void);
extern int tty_lowlevel_getch (void);
/* {{{ Output }}} */
/*

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

@ -286,46 +286,6 @@ history_save (struct mc_config_t *cfg, const char *name, GList * h)
/* --------------------------------------------------------------------------------------------- */
#if 0
/**
* Write the history to the ${XDG_CACHE_HOME}/mc/history file.
*/
void
history_put (const char *input_name, GList * h)
{
char *profile;
int i;
if (num_history_items_recorded == 0) /* this is how to disable */
return;
if ((input_name == NULL) || (*input_name == '\0'))
return;
if (h == NULL)
return;
profile = mc_config_get_full_path (MC_HISTORY_FILE);
i = open (profile, O_CREAT | O_EXCL, S_IRUSR | S_IWUSR);
if (i != -1)
close (i);
/* Make sure the history is only readable by the user */
if (chmod (profile, S_IRUSR | S_IWUSR) != -1 || errno == ENOENT)
{
mc_config_t *cfg;
cfg = mc_config_init (profile);
history_save (cfg, input_name, h);
mc_config_save_file (cfg, NULL);
mc_config_deinit (cfg);
}
g_free (profile);
}
#endif
/* --------------------------------------------------------------------------------------------- */
char *
history_show (GList ** history, Widget * widget)
{

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

@ -27,10 +27,6 @@ GList *history_get (const char *input_name);
GList *history_load (struct mc_config_t * cfg, const char *name);
/* save history to the mc_config, but don't save config to file */
void history_save (struct mc_config_t * cfg, const char *name, GList * h);
#if 0
/* write history to the ${XDG_CACHE_HOME}/mc/history file */
void history_put (const char *input_name, GList * h);
#endif
/* for repositioning of history dialog we should pass widget to this
* function, as position of history dialog depends on widget's position */
char *history_show (GList ** history, Widget * widget);

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

@ -64,6 +64,7 @@
#include "src/filemanager/usermenu.h" /* user_menu_cmd() */
#include "src/setup.h" /* option_tab_spacing */
#include "src/main.h" /* macro_index */
#include "src/learn.h" /* learn_keys */
#include "src/keybind-defaults.h"

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

@ -62,12 +62,12 @@
#include "src/history.h"
#include "src/setup.h" /* option_tab_spacing */
#include "src/main.h" /* mactos_t */
#include "src/selcodepage.h"
#include "src/keybind-defaults.h"
#include "src/util.h" /* check_for_default() */
#include "src/filemanager/layout.h" /* mc_refresh() */
#include "edit-impl.h"
#include "edit-widget.h"
#include "editcmd_dialogs.h"
@ -1298,7 +1298,7 @@ edit_delete_macro (WEdit * edit, int hotkey)
const char *section_name = "editor";
gchar *macros_fname;
guint indx;
char *keyname;
char *skeyname;
const macros_t *macros = NULL;
/* clear array of actions for current hotkey */
@ -1318,10 +1318,10 @@ edit_delete_macro (WEdit * edit, int hotkey)
if (macros_config == NULL)
return FALSE;
keyname = lookup_key_by_code (hotkey);
while (mc_config_del_key (macros_config, section_name, keyname))
skeyname = lookup_key_by_code (hotkey);
while (mc_config_del_key (macros_config, section_name, skeyname))
;
g_free (keyname);
g_free (skeyname);
mc_config_save_file (macros_config, NULL);
mc_config_deinit (macros_config);
return TRUE;
@ -1630,7 +1630,7 @@ edit_store_macro_cmd (WEdit * edit)
GArray *macros; /* current macro */
int tmp_act;
gboolean have_macro = FALSE;
char *keyname = NULL;
char *skeyname = NULL;
hotkey = editcmd_dialog_raw_key_query (_("Save macro"), _("Press the macro's new hotkey:"), 1);
if (hotkey == ESC_CHAR)
@ -1657,7 +1657,7 @@ edit_store_macro_cmd (WEdit * edit)
marcros_string = g_string_sized_new (250);
macros = g_array_new (TRUE, FALSE, sizeof (macro_action_t));
keyname = lookup_key_by_code (hotkey);
skeyname = lookup_key_by_code (hotkey);
for (i = 0; i < macro_index; i++)
{
@ -1682,12 +1682,12 @@ edit_store_macro_cmd (WEdit * edit)
macro.hotkey = hotkey;
macro.macro = macros;
g_array_append_val (macros_list, macro);
mc_config_set_string (macros_config, section_name, keyname, marcros_string->str);
mc_config_set_string (macros_config, section_name, skeyname, marcros_string->str);
}
else
mc_config_del_key (macros_config, section_name, keyname);
mc_config_del_key (macros_config, section_name, skeyname);
g_free (keyname);
g_free (skeyname);
edit_macro_sort_by_hotkey ();
g_string_free (marcros_string, TRUE);

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

@ -51,6 +51,7 @@
#include "lib/charsets.h"
#include "src/setup.h" /* edit_tab_spacing */
#include "src/main.h" /* macro_index */
#include "edit-impl.h"
#include "edit-widget.h"

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

@ -51,6 +51,7 @@
#include "src/setup.h" /* use_file_to_check_type */
#include "src/execute.h"
#include "src/history.h"
#include "src/main.h" /* do_cd */
#include "src/consaver/cons.saver.h"
#include "src/viewer/mcviewer.h"
@ -60,7 +61,6 @@
#endif
#include "usermenu.h"
#include "layout.h"
#include "ext.h"

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

@ -2626,9 +2626,9 @@ panel_operate (void *source_panel, FileOperation operation, gboolean force_singl
/* Background also need ctx->ui, but not full */
if (do_bg)
file_op_context_create_ui_without_init (ctx, 1, dialog_type);
file_op_context_create_ui_without_init (ctx, TRUE, dialog_type);
else
file_op_context_create_ui (ctx, 1, dialog_type);
file_op_context_create_ui (ctx, TRUE, dialog_type);
}
#ifdef WITH_BACKGROUND

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

@ -273,7 +273,7 @@ file_bps_prepare_for_show (char *buffer, long bps)
g_snprintf (buffer, BUF_TINY, _("%ld B/s"), bps);
}
else
*buffer = 0;
*buffer = '\0';
}
/* --------------------------------------------------------------------------------------------- */

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

@ -1593,7 +1593,7 @@ load_hotlist (void)
else
message (D_ERROR, _("Hotlist Load"),
_
("MC was unable to write ~/%s file,\nyour old hotlist entries were not deleted"),
("MC was unable to write %s file,\nyour old hotlist entries were not deleted"),
MC_USERCONF_DIR PATH_SEP_STR MC_HOTLIST_FILE);
}
else

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

@ -149,7 +149,7 @@ static int _equal_split;
static int _first_panel_size;
static int _menubar_visible;
static int _output_lines;
static int _command_prompt;
static gboolean _command_prompt;
static int _keybar_visible;
static int _message_visible;
static gboolean _xterm_title;
@ -319,10 +319,10 @@ layout_callback (Dlg_head * h, Widget * sender, dlg_msg_t msg, int parm, void *d
case DLG_POST_KEY:
_menubar_visible = check_options[5].widget->state & C_BOOL;
_command_prompt = check_options[4].widget->state & C_BOOL;
_command_prompt = (check_options[4].widget->state & C_BOOL) != 0;
_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;
_xterm_title = (check_options[1].widget->state & C_BOOL) != 0;
_free_space = check_options[0].widget->state & C_BOOL;
if (mc_global.tty.console_flag != '\0')
@ -330,7 +330,7 @@ layout_callback (Dlg_head * h, Widget * sender, dlg_msg_t msg, int parm, void *d
int minimum;
if (_output_lines < 0)
_output_lines = 0;
height = LINES - _keybar_visible - _command_prompt -
height = LINES - _keybar_visible - (_command_prompt ? 1 : 0) -
_menubar_visible - _output_lines - _message_visible;
minimum = MINHEIGHT * (1 + _horizontal_split);
if (height < minimum)
@ -340,7 +340,7 @@ layout_callback (Dlg_head * h, Widget * sender, dlg_msg_t msg, int parm, void *d
}
}
else
height = LINES - _keybar_visible - _command_prompt -
height = LINES - _keybar_visible - (_command_prompt ? 1 : 0) -
_menubar_visible - _output_lines - _message_visible;
if (old_output_lines != _output_lines)
@ -653,7 +653,7 @@ setup_panels (void)
if (output_lines < 0)
output_lines = 0;
height =
LINES - mc_global.keybar_visible - command_prompt - menubar_visible -
LINES - mc_global.keybar_visible - (command_prompt ? 1 : 0) - menubar_visible -
output_lines - mc_global.message_visible;
minimum = MINHEIGHT * (1 + horizontal_split);
if (height < minimum)
@ -665,7 +665,7 @@ setup_panels (void)
else
{
height =
LINES - menubar_visible - command_prompt - mc_global.keybar_visible -
LINES - menubar_visible - (command_prompt ? 1 : 0) - mc_global.keybar_visible -
mc_global.message_visible;
}
check_split ();
@ -713,7 +713,7 @@ setup_panels (void)
/* Output window */
if (mc_global.tty.console_flag != '\0' && output_lines)
{
output_start_y = LINES - command_prompt - mc_global.keybar_visible - output_lines;
output_start_y = LINES - (command_prompt ? 1 : 0) - mc_global.keybar_visible - output_lines;
show_console_contents (output_start_y,
LINES - output_lines - mc_global.keybar_visible - 1,
LINES - mc_global.keybar_visible - 1);
@ -840,7 +840,7 @@ set_display_type (int num, panel_view_mode_t type)
unsigned int the_other = 0; /* Index to the other panel */
const char *file_name = NULL; /* For Quick view */
Widget *new_widget = NULL, *old_widget = NULL;
panel_view_mode_t old_type;
panel_view_mode_t old_type = view_listing;
WPanel *the_other_panel = NULL;
if (num >= MAX_VIEWS)
@ -927,7 +927,7 @@ set_display_type (int num, panel_view_mode_t type)
/* same state. Maybe we could just kill it and then replace it */
if ((midnight_dlg != NULL) && (old_widget != NULL))
{
if (old_widget == view_listing)
if (old_type == view_listing)
{
/* save and write directory history of panel
* ... and other histories of midnight_dlg */
@ -975,45 +975,6 @@ set_display_type (int num, panel_view_mode_t type)
g_free (old_widget);
}
/* --------------------------------------------------------------------------------------------- */
void
panel_update_cols (Widget * widget, panel_display_t frame_size)
{
int cols, origin;
/* don't touch panel if it is not in dialog yet */
/* if panel is not in dialog it is not in widgets list
and cannot be compared with get_panel_widget() result */
if (widget->owner == NULL)
return;
if (horizontal_split)
{
widget->cols = COLS;
return;
}
if (frame_size == frame_full)
{
cols = COLS;
origin = 0;
}
else if (widget == get_panel_widget (0))
{
cols = first_panel_size;
origin = 0;
}
else
{
cols = COLS - first_panel_size;
origin = first_panel_size;
}
widget->cols = cols;
widget->x = origin;
}
/* --------------------------------------------------------------------------------------------- */
/** This routine is deeply sticked to the two panels idea.
What should it do in more panels. ANSWER - don't use it

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

@ -8,14 +8,23 @@
#include "lib/global.h"
#include "lib/widget.h"
#include "panel.h"
/*** typedefs(not structures) and defined constants **********************************************/
typedef enum
{
view_listing = 0, /* Directory listing */
view_info = 1, /* Information panel */
view_tree = 2, /* Tree view */
view_quick = 3, /* Quick view */
view_nothing = 4, /* Undefined */
} panel_view_mode_t;
/*** enums ***************************************************************************************/
/*** structures declarations (and typedefs of structures)*****************************************/
struct WPanel;
/*** global variables defined in .c file *********************************************************/
extern int equal_split;
@ -38,7 +47,6 @@ void setup_panels (void);
void destroy_panels (void);
void setup_cmdline (void);
void set_display_type (int num, panel_view_mode_t type);
void panel_update_cols (Widget * widget, panel_display_t frame_size);
void swap_panels (void);
panel_view_mode_t get_display_type (int idx);
panel_view_mode_t get_current_type (void);
@ -52,7 +60,7 @@ struct Widget *get_panel_widget (int idx);
struct WPanel *get_other_panel (void);
void save_panel_dir (int idx);
const char *get_panel_dir_for (const WPanel * widget);
const char *get_panel_dir_for (const struct WPanel * widget);
void set_hintbar (const char *str);

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

@ -28,7 +28,6 @@ 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;

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

@ -76,7 +76,7 @@ configure_callback (Dlg_head * h, Widget * sender, dlg_msg_t msg, int parm, void
{
case DLG_ACTION:
/* message from "Single press" checkbutton */
if (sender != NULL && sender->id == 18)
if (sender != NULL && sender->id == 17)
{
const gboolean not_single = !(((WCheck *) sender)->state & C_BOOL);
Widget *w;
@ -107,7 +107,7 @@ void
configure_box (void)
{
int dlg_width = 60;
int dlg_height = 20;
int dlg_height = 21;
char time_out[BUF_TINY] = "";
char *time_out_new;
@ -125,11 +125,8 @@ configure_box (void)
QUICK_BUTTON (38, dlg_width, dlg_height - 3, dlg_height, N_("&Cancel"), B_CANCEL, NULL),
QUICK_BUTTON (14, dlg_width, dlg_height - 3, dlg_height, N_("&OK"), B_ENTER, NULL),
/* other options */
QUICK_CHECKBOX (dlg_width / 2 + 2, dlg_width, 13, dlg_height, N_("A&uto save setup"),
QUICK_CHECKBOX (dlg_width / 2 + 2, dlg_width, 12, dlg_height, N_("A&uto save setup"),
&auto_save_setup),
QUICK_CHECKBOX (dlg_width / 2 + 2, dlg_width, 12, dlg_height,
N_("Preallocate &space before file copying"),
&mc_global.vfs.preallocate_space),
QUICK_CHECKBOX (dlg_width / 2 + 2, dlg_width, 11, dlg_height, N_("Sa&fe delete"),
&safe_delete),
QUICK_CHECKBOX (dlg_width / 2 + 2, dlg_width, 10, dlg_height, N_("Cd follows lin&ks"),
@ -147,28 +144,30 @@ configure_box (void)
&use_internal_view),
QUICK_CHECKBOX (dlg_width / 2 + 2, dlg_width, 3, dlg_height, N_("Use internal edi&t"),
&use_internal_edit),
QUICK_GROUPBOX (dlg_width / 2, dlg_width, 2, dlg_height, dlg_width / 2 - 4, 15,
QUICK_GROUPBOX (dlg_width / 2, dlg_width, 2, dlg_height, dlg_width / 2 - 4, 16,
N_("Other options")),
/* pause options */
QUICK_RADIO (5, dlg_width, 13, dlg_height, pause_options_num, pause_options,
QUICK_RADIO (5, dlg_width, 14, dlg_height, pause_options_num, pause_options,
&pause_after_run),
QUICK_GROUPBOX (3, dlg_width, 12, dlg_height, dlg_width / 2 - 4, 5, N_("Pause after run")),
QUICK_GROUPBOX (3, dlg_width, 13, dlg_height, dlg_width / 2 - 4, 5, N_("Pause after run")),
/* Esc key mode */
QUICK_INPUT (10, dlg_width, 10, dlg_height, (const char *) time_out, 8, 0,
QUICK_INPUT (10, dlg_width, 11, dlg_height, (const char *) time_out, 8, 0,
MC_HISTORY_ESC_TIMEOUT, &time_out_new),
QUICK_LABEL (5, dlg_width, 10, dlg_height, N_("Timeout:")),
QUICK_CHECKBOX (5, dlg_width, 9, dlg_height, N_("S&ingle press"), &old_esc_mode),
QUICK_GROUPBOX (3, dlg_width, 8, dlg_height, dlg_width / 2 - 4, 4, N_("Esc key mode")),
QUICK_LABEL (5, dlg_width, 11, dlg_height, N_("Timeout:")),
QUICK_CHECKBOX (5, dlg_width, 10, dlg_height, N_("S&ingle press"), &old_esc_mode),
QUICK_GROUPBOX (3, dlg_width, 9, dlg_height, dlg_width / 2 - 4, 4, N_("Esc key mode")),
/* file operation options */
QUICK_CHECKBOX (5, dlg_width, 7, dlg_height, N_("Preallocate &space"),
&mc_global.vfs.preallocate_space),
QUICK_CHECKBOX (5, dlg_width, 6, dlg_height, N_("Mkdi&r autoname"), &auto_fill_mkdir_name),
QUICK_CHECKBOX (5, dlg_width, 5, dlg_height, N_("Classic pro&gressbar"),
&classic_progressbar),
QUICK_CHECKBOX (5, dlg_width, 4, dlg_height, N_("Compute tota&ls"),
&file_op_compute_totals),
QUICK_CHECKBOX (5, dlg_width, 3, dlg_height, N_("&Verbose operation"), &verbose),
QUICK_GROUPBOX (3, dlg_width, 2, dlg_height, dlg_width / 2 - 4, 6,
QUICK_GROUPBOX (3, dlg_width, 2, dlg_height, dlg_width / 2 - 4, 7,
N_("File operation options")),
QUICK_END
};
@ -194,14 +193,14 @@ configure_box (void)
/* buttons */
quick_widgets[i].u.button.text = _(quick_widgets[i].u.button.text);
break;
case 13:
case 15:
case 19:
case 12:
case 14:
case 18:
case 24:
/* groupboxes */
quick_widgets[i].u.groupbox.title = _(quick_widgets[i].u.groupbox.title);
break;
case 14:
case 13:
{
/* radio button */
size_t j;
@ -209,10 +208,10 @@ configure_box (void)
pause_options[j] = _(pause_options[j]);
}
break;
case 16:
case 15:
/* input line */
break;
case 17:
case 16:
/* label */
quick_widgets[i].u.label.text = _(quick_widgets[i].u.label.text);
break;
@ -236,19 +235,19 @@ configure_box (void)
/* checkboxes within groupboxes */
c_len = 0;
for (i = 2; i < 24; i++)
if ((i < 13) || (i == 18) || (i > 19))
if ((i < 12) || (i == 17) || (i > 18))
c_len = max (c_len, str_term_width1 (quick_widgets[i].u.checkbox.text) + 3);
/* radiobuttons */
for (i = 0; i < (size_t) pause_options_num; i++)
c_len = max (c_len, str_term_width1 (pause_options[i]) + 3);
/* label + input */
l_len = str_term_width1 (quick_widgets[17].u.label.text);
l_len = str_term_width1 (quick_widgets[16].u.label.text);
c_len = max (c_len, l_len + 1 + 8);
/* groupboxes */
g_len = max (c_len + 2, str_term_width1 (quick_widgets[24].u.groupbox.title) + 4);
g_len = max (g_len, str_term_width1 (quick_widgets[19].u.groupbox.title) + 4);
g_len = max (g_len, str_term_width1 (quick_widgets[15].u.groupbox.title) + 4);
g_len = max (g_len, str_term_width1 (quick_widgets[13].u.groupbox.title) + 4);
g_len = max (g_len, str_term_width1 (quick_widgets[18].u.groupbox.title) + 4);
g_len = max (g_len, str_term_width1 (quick_widgets[14].u.groupbox.title) + 4);
g_len = max (g_len, str_term_width1 (quick_widgets[12].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);
@ -260,19 +259,19 @@ configure_box (void)
quick_widgets[i].x_divisions = Quick_input.xlen;
/* groupboxes */
quick_widgets[15].u.groupbox.width =
quick_widgets[19].u.groupbox.width =
quick_widgets[14].u.groupbox.width =
quick_widgets[18].u.groupbox.width =
quick_widgets[24].u.groupbox.width = Quick_input.xlen / 2 - 4;
quick_widgets[13].u.groupbox.width = Quick_input.xlen / 2 - 3;
quick_widgets[12].u.groupbox.width = Quick_input.xlen / 2 - 3;
/* input */
quick_widgets[16].relative_x = quick_widgets[17].relative_x + l_len + 1;
quick_widgets[16].u.input.len = quick_widgets[19].u.groupbox.width - l_len - 4;
quick_widgets[15].relative_x = quick_widgets[16].relative_x + l_len + 1;
quick_widgets[15].u.input.len = quick_widgets[18].u.groupbox.width - l_len - 4;
/* right column */
quick_widgets[13].relative_x = Quick_input.xlen / 2;
for (i = 2; i < 13; i++)
quick_widgets[i].relative_x = quick_widgets[13].relative_x + 2;
quick_widgets[12].relative_x = Quick_input.xlen / 2;
for (i = 2; i < 12; i++)
quick_widgets[i].relative_x = quick_widgets[12].relative_x + 2;
/* buttons */
quick_widgets[1].relative_x = (Quick_input.xlen - b_len) / 3;
@ -281,7 +280,12 @@ configure_box (void)
g_snprintf (time_out, sizeof (time_out), "%d", old_esc_mode_timeout);
if (!old_esc_mode)
quick_widgets[16].options = quick_widgets[17].options = W_DISABLED;
quick_widgets[15].options = quick_widgets[16].options = W_DISABLED;
#ifndef HAVE_POSIX_FALLOCATE
mc_global.vfs.preallocate_space = FALSE;
quick_widgets[19].options = W_DISABLED;
#endif
if (quick_dialog (&Quick_input) == B_ENTER)
old_esc_mode_timeout = atoi (time_out_new);

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

@ -3871,6 +3871,45 @@ set_panel_formats (WPanel * p)
/* --------------------------------------------------------------------------------------------- */
void
panel_update_cols (Widget * widget, panel_display_t frame_size)
{
int cols, origin;
/* don't touch panel if it is not in dialog yet */
/* if panel is not in dialog it is not in widgets list
and cannot be compared with get_panel_widget() result */
if (widget->owner == NULL)
return;
if (horizontal_split)
{
widget->cols = COLS;
return;
}
if (frame_size == frame_full)
{
cols = COLS;
origin = 0;
}
else if (widget == get_panel_widget (0))
{
cols = first_panel_size;
origin = 0;
}
else
{
cols = COLS - first_panel_size;
origin = first_panel_size;
}
widget->cols = cols;
widget->x = origin;
}
/* --------------------------------------------------------------------------------------------- */
/* Select current item and readjust the panel */
void
select_item (WPanel * panel)

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

@ -35,15 +35,6 @@ enum list_types
list_user /* User defined */
};
typedef enum
{
view_listing = 0, /* Directory listing */
view_info = 1, /* Information panel */
view_tree = 2, /* Tree view */
view_quick = 3, /* Quick view */
view_nothing = 4, /* Undefined */
} panel_view_mode_t;
typedef enum
{
frame_full, /* full screen frame */
@ -157,6 +148,7 @@ void panel_change_encoding (WPanel * panel);
void update_panels (panel_update_flags_t flags, const char *current_file);
int set_panel_formats (WPanel * p);
void panel_update_cols (Widget * widget, panel_display_t frame_size);
void try_to_select (WPanel * panel, const char *name);

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

@ -9,7 +9,7 @@
#include "lib/global.h" /* GError */
#include "filemanager/panel.h" /* WPanel, panel_view_mode_t */
#include "filemanager/layout.h" /* panel_view_mode_t */
/*** typedefs(not structures) and defined constants **********************************************/
@ -52,6 +52,8 @@ typedef struct
gboolean torben_fj_mode; /* If TRUE, use some usability hacks by Torben */
} panels_options_t;
struct WPanel;
/*** global variables defined in .c file *********************************************************/
/* global paremeters */
@ -106,8 +108,8 @@ char *load_anon_passwd (void);
void load_keymap_defs (gboolean load_from_file);
void free_keymap_defs (void);
void panel_load_setup (WPanel * panel, const char *section);
void panel_save_setup (WPanel * panel, const char *section);
void panel_load_setup (struct WPanel * panel, const char *section);
void panel_save_setup (struct WPanel * panel, const char *section);
void panels_load_options (void);
void panels_save_options (void);