1
1

Ticket #1838: fix of broken charset autodetection.

First step: refactoring: unification of WTree and WInfo widget
constructions. Type accuracy.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Этот коммит содержится в:
Andrew Borodin 2010-05-16 10:11:51 +04:00
родитель 6117c5b4ca
Коммит cc8a675ebb
8 изменённых файлов: 22 добавлений и 20 удалений

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

@ -687,7 +687,7 @@ tree_box (const char *current_dir)
dlg = create_dlg (0, 0, LINES - 9, COLS - 20, dialog_colors,
tree_callback, "[Directory Tree]", NULL, DLG_CENTER | DLG_REVERSE);
mytree = tree_new (0, 2, 2, dlg->lines - 6, dlg->cols - 5);
mytree = tree_new (2, 2, dlg->lines - 6, dlg->cols - 5, FALSE);
add_widget (dlg, mytree);
bar = buttonbar_new (TRUE);
add_widget (dlg, bar);

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

@ -285,11 +285,11 @@ info_event (Gpm_Event * event, void *data)
}
WInfo *
info_new (void)
info_new (int y, int x, int lines, int cols)
{
struct WInfo *info = g_new (struct WInfo, 1);
init_widget (&info->widget, 0, 0, 0, 0, info_callback, info_event);
init_widget (&info->widget, y, x, lines, cols, info_callback, info_event);
/* We do not want the cursor */
widget_want_cursor (info->widget, 0);

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

@ -9,6 +9,6 @@
struct WInfo;
typedef struct WInfo WInfo;
WInfo *info_new (void);
WInfo *info_new (int y, int x, int lines, int cols);
#endif
#endif /* MC_INFO_H */

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

@ -946,20 +946,21 @@ set_display_type (int num, panel_view_mode_t type)
case view_nothing:
case view_listing:
new_widget = restore_into_right_dir_panel (num, old_widget);
widget_set_size (new_widget, y, x, lines, cols);
break;
case view_info:
new_widget = (Widget *) info_new ();
break;
new_widget = (Widget *) info_new (y, x, lines, cols);
break;
case view_tree:
new_widget = (Widget *) tree_new (1, 0, 0, 0, 0);
new_widget = (Widget *) tree_new (y, x, lines, cols, TRUE);
break;
case view_quick:
new_widget = (Widget *) mcview_new (0, 0, 0, 0, 1);
the_other_panel = (WPanel *) panels[the_other].widget;
if (the_other_panel)
new_widget = (Widget *) mcview_new (y, x, lines, cols, TRUE);
the_other_panel = (WPanel *) panels [the_other].widget;
if (the_other_panel != NULL)
file_name = the_other_panel->dir.list[the_other_panel->selected].fname;
else
file_name = "";
@ -976,9 +977,6 @@ set_display_type (int num, panel_view_mode_t type)
panels[num].type = type;
panels[num].widget = new_widget;
/* We set the same size the old widget had */
widget_set_size (new_widget, y, x, lines, cols);
/* We use replace to keep the circular list of the dialog in the */
/* same state. Maybe we could just kill it and then replace it */
if ((midnight_dlg != NULL) && (old_widget != NULL))

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

@ -1123,7 +1123,7 @@ tree_callback (Widget * w, widget_msg_t msg, int parm)
}
WTree *
tree_new (int is_panel, int y, int x, int lines, int cols)
tree_new (int y, int x, int lines, int cols, gboolean is_panel)
{
WTree *tree = g_new (WTree, 1);

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

@ -6,12 +6,14 @@
#ifndef MC_TREE_H
#define MC_TREE_H
#include "lib/global.h"
typedef struct WTree WTree;
extern WTree *the_tree;
extern int xtree_mode;
WTree *tree_new (int is_panel, int y, int x, int lines, int cols);
WTree *tree_new (int y, int x, int lines, int cols, gboolean is_panel);
void tree_chdir (WTree *tree, const char *dir);
char *tree_selected_name (const WTree *tree);
@ -22,4 +24,4 @@ struct Dlg_head;
WTree *find_tree (struct Dlg_head *h);
#endif /* MC_TREE_H */
#endif /* MC_TREE_H */

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

@ -202,7 +202,7 @@ mcview_set_keymap (mcview_t * view)
/* --------------------------------------------------------------------------------------------- */
mcview_t *
mcview_new (int y, int x, int lines, int cols, int is_panel)
mcview_new (int y, int x, int lines, int cols, gboolean is_panel)
{
mcview_t *view = g_new0 (mcview_t, 1);
size_t i;
@ -285,7 +285,7 @@ mcview_viewer (const char *command, const char *file, int *move_dir_p, int start
view_dlg = create_dlg (0, 0, LINES, COLS, NULL, mcview_dialog_callback,
"[Internal File Viewer]", NULL, DLG_WANT_TAB);
lc_mcview = mcview_new (0, 0, LINES - 1, COLS, 0);
lc_mcview = mcview_new (0, 0, LINES - 1, COLS, FALSE);
add_widget (view_dlg, lc_mcview);
add_widget (view_dlg, buttonbar_new (TRUE));

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

@ -5,6 +5,8 @@
#ifndef MC_VIEWER_H
#define MC_VIEWER_H
#include "lib/global.h"
/*** typedefs(not structures) and defined constants ********************/
struct mcview_struct;
@ -35,7 +37,7 @@ extern char *mcview_show_eof;
/* Creates a new mcview_t object with the given properties. Caveat: the
* origin is in y-x order, while the extent is in x-y order. */
extern struct mcview_struct *mcview_new (int y, int x, int lines, int cols, int is_panel);
extern struct mcview_struct *mcview_new (int y, int x, int lines, int cols, gboolean is_panel);
/* Shows {file} or the output of {command} in the internal viewer,