* dlg.c: Eliminate all useless x_* functions.

* dlg.h: Likewise.
* panel.h: Likewise.
* textconf.h: Likewise.
* view.c: Likewise.
* view.h: Likewise.
* widget.c: Likewise.
* main.c: Remove panel_update_marks(). Move try_to_select() ...
* screen.c: ... here.  Eliminate x_* functions.
* main.h: Remove panel_update_marks().
This commit is contained in:
Pavel Roskin 2002-07-19 22:16:24 +00:00
parent f61bfaf8f5
commit 6bdeafba4d
11 changed files with 28 additions and 125 deletions

View File

@ -1,5 +1,16 @@
2002-07-19 Pavel Roskin <proski@gnu.org>
* dlg.c: Eliminate all useless x_* functions.
* dlg.h: Likewise.
* panel.h: Likewise.
* textconf.h: Likewise.
* view.c: Likewise.
* view.h: Likewise.
* widget.c: Likewise.
* main.c: Remove panel_update_marks(). Move try_to_select() ...
* screen.c: ... here. Eliminate x_* functions.
* main.h: Remove panel_update_marks().
* screen.c (panel_callback): Only change directory on
WIDGET_FOCUS if current_panel changes.

View File

@ -159,13 +159,9 @@ int default_proc (Dlg_head *h, int Msg, int Par)
return 0; /* Didn't use the key */
case WIDGET_FOCUS: /* We accept FOCUSes */
if (h->current)
x_focus_widget (h->current);
return 1;
case WIDGET_UNFOCUS: /* We accept loose FOCUSes */
if (h->current)
x_unfocus_widget (h->current);
return 1;
case WIDGET_DRAW:
@ -531,7 +527,6 @@ void update_cursor (Dlg_head *h)
do {
if (p->widget->options & W_WANT_CURSOR)
if ((*p->widget->callback)(h, p->widget, WIDGET_CURSOR, 0)){
x_focus_widget (p);
break;
}
p = p->next;
@ -791,7 +786,6 @@ void init_dlg (Dlg_head *h)
h->ret_value = 0;
h->running = 1;
x_init_dlg (h);
}
/* Shutdown the run_dlg */
@ -801,15 +795,6 @@ void dlg_run_done (Dlg_head *h)
(*h->callback) (h, h->current->dlg_id, DLG_END);
current_dlg = (Dlg_head *) h->previous_dialog;
if (current_dlg){
/*
* Special case for the GNOME desktop:
* The desktop will not have any widgets
*/
if (current_dlg->current)
x_focus_widget (current_dlg->current);
}
}
void dlg_process_event (Dlg_head *h, int key, Gpm_Event *event)
@ -881,7 +866,6 @@ destroy_dlg (Dlg_head *h)
if (h->refresh_pushed)
pop_refresh ();
x_destroy_dlg_start (h);
dlg_broadcast_msg (h, WIDGET_DESTROY, 0);
c = h->current;
for (i = 0; i < h->count; i++){
@ -896,7 +880,6 @@ destroy_dlg (Dlg_head *h)
}
if (h->title)
g_free (h->title);
x_destroy_dlg (h);
g_free (h);
if (refresh_list)

View File

@ -250,11 +250,4 @@ void x_set_dialog_title (Dlg_head *h, const char *title);
int dlg_key_event (Dlg_head *h, int d_key);
void update_cursor (Dlg_head *h);
/* FIXME: Remove those functions */
#define x_focus_widget(x) {}
#define x_unfocus_widget(x) {}
#define x_init_dlg(x) {}
#define x_destroy_dlg(x) {}
#define x_destroy_dlg_start(x) {}
#endif /* MC_DLG_H */

View File

@ -318,14 +318,6 @@ get_other_panel (void)
return (WPanel *) get_panel_widget (get_other_index ());
}
void
try_to_select (WPanel *panel, char *name)
{
Xtry_to_select (panel, name);
select_item (panel);
display_mini_info (panel);
}
static void
reload_panelized (WPanel *panel)
{
@ -364,7 +356,7 @@ reload_panelized (WPanel *panel)
mc_chdir (cpanel->cwd);
}
void
static void
update_one_panel_widget (WPanel *panel, int force_update, char *current_file)
{
int free_pointer;
@ -867,8 +859,6 @@ directory_history_add (WPanel * panel, char *s)
panel->dir_history = panel->dir_history->next;
panel->dir_history->text = g_strdup (s);
strip_password (panel->dir_history->text, 1);
panel_update_marks (panel);
}
/*
@ -977,7 +967,6 @@ directory_history_next (WPanel * panel)
return;
if (_do_panel_cd (panel, panel->dir_history->next->text, cd_exact))
panel->dir_history = panel->dir_history->next;
panel_update_marks (panel);
}
void
@ -987,7 +976,6 @@ directory_history_prev (WPanel * panel)
return;
if (_do_panel_cd (panel, panel->dir_history->prev->text, cd_exact))
panel->dir_history = panel->dir_history->prev;
panel_update_marks (panel);
}
void

View File

@ -203,7 +203,6 @@ void exec_shell (void);
#define PANEL_DEFS_DONE
void directory_history_add (WPanel *panel, char *s);
int do_panel_cd (WPanel *panel, char *new_dir, enum cd_enum cd_type);
void update_one_panel_widget (WPanel *panel, int force_update, char *current_file);
int midnight_callback (struct Dlg_head *h, int id, int msg);
#endif /* !PANEL_DEFS_DONE */
#endif /* __PANEL_H */

View File

@ -30,8 +30,6 @@ enum panel_display_enum {
frame_half /* half screen frame */
};
#define is_view_special(x) (((x) == view_info) || ((x) == view_quick))
#define J_LEFT 1
#define J_RIGHT 2
#define J_CENTER 3
@ -164,18 +162,6 @@ void panel_reload (WPanel *panel);
void panel_set_sort_order (WPanel *panel, sortfn *sort_order);
void panel_re_sort (WPanel *panel);
void x_panel_set_size (int index);
void x_create_panel (Dlg_head *h, widget_data parent, WPanel *panel);
void x_fill_panel (WPanel *panel);
void x_adjust_top_file (WPanel *panel);
void x_filter_changed (WPanel *panel);
void x_add_sort_label (WPanel *panel, int index, char *text, char *tag, void *sr);
void x_sort_label_start (WPanel *panel);
void x_reset_sort_labels (WPanel *panel);
void x_panel_destroy (WPanel *panel);
void change_view (WPanel *panel, int view_type);
void x_panel_update_marks (WPanel *panel);
extern void paint_info_panel (WPanel *);
extern void paint_quick_view_panel (WPanel *);
void info_frame (WPanel *panel);
@ -207,12 +193,7 @@ void recalculate_panel_summary (WPanel *panel);
void file_mark (WPanel *panel, int index, int val);
void do_file_mark (WPanel *panel, int index, int val);
void x_panel_select_item (WPanel *panel, int index, int val);
void x_select_item (WPanel *panel);
void x_unselect_item (WPanel *panel);
sortfn *get_sort_fn (char *name);
void update_one_panel_widget (WPanel *panel, int force_update, char *current_file);
void panel_update_marks (WPanel *panel);
void directory_history_next (WPanel * panel);
void directory_history_prev (WPanel * panel);

View File

@ -82,9 +82,6 @@ static void paint_frame (WPanel *panel);
static char *panel_format (WPanel *panel);
static char *mini_status_format (WPanel *panel);
#define x_adjust_top_file(p)
#define x_reset_sort_labels(x)
/* This macro extracts the number of available lines in a panel */
#define llines(p) (p->widget.lines-3 - (show_mini_info ? 2 : 0))
@ -100,11 +97,6 @@ static char *mini_status_format (WPanel *panel);
# define unfocus_unselect_item(x) unselect_item(x)
#endif
#define x_create_panel(x,y,z) 1;
#define x_panel_load_index(p,x)
#define x_panel_select_item(a,b,c)
#define x_panel_destroy(p)
static void
set_colors (WPanel *panel)
{
@ -797,7 +789,6 @@ do_select (WPanel *panel, int i)
panel->top_file = panel->selected - (panel->widget.lines-2)/2;
if (panel->top_file < 0)
panel->top_file = 0;
x_adjust_top_file (panel);
}
}
@ -832,6 +823,14 @@ Xtry_to_select (WPanel *panel, char *name)
g_free (subdir);
}
void
try_to_select (WPanel *panel, char *name)
{
Xtry_to_select (panel, name);
select_item (panel);
display_mini_info (panel);
}
void
panel_update_cols (Widget *widget, int frame_size)
{
@ -879,7 +878,6 @@ panel_destroy (WPanel *p)
char *name = panel_save_name (p);
panel_save_setup (p, name);
x_panel_destroy (p);
panel_clean_dir (p);
/* save and clean history */
@ -913,7 +911,6 @@ static void
panel_format_modified (WPanel *panel)
{
panel->format_modified = 1;
x_reset_sort_labels (panel);
}
/* Panel creation */
@ -1699,7 +1696,6 @@ prev_page (WPanel *panel)
panel->selected = 0;
if (panel->top_file < 0)
panel->top_file = 0;
x_adjust_top_file (panel);
select_item (panel);
paint_dir (panel);
}
@ -1738,7 +1734,6 @@ next_page (WPanel *panel)
panel->selected = panel->count - 1;
if (panel->top_file >= panel->count)
panel->top_file = panel->count - 1;
x_adjust_top_file (panel);
select_item (panel);
paint_dir (panel);
}
@ -2256,7 +2251,6 @@ void
file_mark (WPanel *panel, int index, int val)
{
panel->dir.list [index].f.marked = val;
x_panel_select_item (panel, index, val);
}
/* */
@ -2364,11 +2358,6 @@ panel_event (Gpm_Event *event, WPanel *panel)
return MOU_NORMAL;
}
void
panel_update_marks (WPanel *panel)
{
}
void
panel_re_sort (WPanel *panel)
{

View File

@ -3,8 +3,6 @@
/* Features of the text mode edition */
#define x_flush_events()
extern void version (int verbose);
#endif /* __TEXTCONF_H */

View File

@ -210,7 +210,6 @@ view_destroy (WView *view)
view_done (view);
if (view->have_frame)
delete_hook (&select_file_hook, view_hook);
x_destroy_view (view);
}
static int
@ -2454,7 +2453,6 @@ view_callback (Dlg_head *h, WView *view, int msg, int par)
switch (msg){
case WIDGET_INIT:
x_create_viewer (view);
if (view->have_frame)
add_hook (&select_file_hook, view_hook, view);
else
@ -2490,7 +2488,6 @@ view_callback (Dlg_head *h, WView *view, int msg, int par)
return 1;
case WIDGET_FOCUS:
x_focus_view (view);
view_labels (view);
return 1;
@ -2516,8 +2513,6 @@ view_new (int y, int x, int cols, int lines, int is_panel)
view->last_byte = -1;
view->wrap_mode = global_wrap_mode;
x_init_view (view);
widget_want_cursor (view->widget, 0);
return view;

View File

@ -146,9 +146,4 @@ struct hexedit_change_node {
unsigned char value;
};
#define x_init_view(x)
#define x_destroy_view(x)
#define x_create_viewer(x)
#define x_focus_view(x)
#endif /* __VIEW_H */

View File

@ -43,22 +43,6 @@
#include "key.h" /* XCTRL and ALT macros */
#include "profile.h" /* for history loading and saving */
#define x_create_button(a,b,c) 1
#define x_create_radio(a,b,c) 1
#define x_create_check(a,b,c) 1
#define x_create_label(a,b,c) 1
#define x_create_input(a,b,c) 1
#define x_create_listbox(a,b,c) 1
#define x_create_buttonbar(a,b,c) 1
#define x_create_gauge(a,b,c) 1
#define x_listbox_select_nth(a,b)
#define x_list_insert(a,b,c)
#define x_redefine_label(a,b)
#define x_destroy_cmd(w)
#define x_radio_focus_item(r)
#define x_radio_toggle(r)
static int button_event (Gpm_Event *event, WButton *b);
int quote = 0;
@ -72,7 +56,7 @@ button_callback (Dlg_head *h, WButton *b, int Msg, int Par)
switch (Msg){
case WIDGET_INIT:
return x_create_button (h, h->wdata, b);
return 1;
case WIDGET_HOTKEY:
if (b->hotkey == Par || toupper(b->hotkey) == Par){
@ -177,7 +161,6 @@ button_event (Gpm_Event *event, WButton *b)
static void
button_destroy (WButton *b)
{
x_destroy_cmd (b);
g_free (b->text);
}
@ -265,7 +248,7 @@ radio_callback (Dlg_head *h, WRadio *r, int Msg, int Par)
switch (Msg) {
case WIDGET_INIT:
return x_create_radio (h, h->wdata, r);
return 1;
case WIDGET_HOTKEY:
{
@ -293,14 +276,12 @@ radio_callback (Dlg_head *h, WRadio *r, int Msg, int Par)
r->sel = r->pos;
(*h->callback) (h, h->current->dlg_id, DLG_ACTION);
radio_callback (h, r, WIDGET_FOCUS, ' ');
x_radio_toggle (r);
return 1;
case KEY_UP:
case KEY_LEFT:
if (r->pos > 0){
r->pos--;
x_radio_focus_item (r);
return 1;
}
return 0;
@ -309,7 +290,6 @@ radio_callback (Dlg_head *h, WRadio *r, int Msg, int Par)
case KEY_RIGHT:
if (r->count - 1 > r->pos) {
r->pos++;
x_radio_focus_item (r);
return 1;
}
}
@ -404,7 +384,7 @@ check_callback (Dlg_head *h, WCheck *c, int Msg, int Par)
{
switch (Msg) {
case WIDGET_INIT:
return x_create_check (h, h->wdata, c);
return 1;
case WIDGET_HOTKEY:
if (c->hotkey==Par ||
@ -464,7 +444,6 @@ check_event (Gpm_Event *event, WCheck *c)
static void
check_destroy (WCheck *c)
{
x_destroy_cmd (c);
g_free (c->text);
}
@ -507,7 +486,7 @@ static int
label_callback (Dlg_head *h, WLabel *l, int Msg, int Par)
{
if (Msg == WIDGET_INIT)
return x_create_label (h, h->wdata, l);
return 1;
/* We don't want to get the focus */
if (Msg == WIDGET_FOCUS)
@ -574,7 +553,6 @@ label_set_text (WLabel *label, char *text)
static void
label_destroy (WLabel *l)
{
x_destroy_cmd (l);
if (l->text)
g_free (l->text);
}
@ -612,7 +590,7 @@ gauge_callback (Dlg_head *h, WGauge *g, int Msg, int Par)
{
if (Msg == WIDGET_INIT)
return x_create_gauge (h, h->wdata, g);
return 1;
/* We don't want to get the focus */
if (Msg == WIDGET_FOCUS)
@ -1049,7 +1027,6 @@ input_destroy (WInput *in)
g_free (old);
}
}
x_destroy_cmd (in);
g_free (in->buffer);
free_completions (in);
if (in->history_name)
@ -1563,7 +1540,7 @@ input_callback (Dlg_head *h, WInput *in, int Msg, int Par)
{
switch (Msg){
case WIDGET_INIT:
return x_create_input (h, h->wdata, in);
return 1;
case WIDGET_KEY:
if (Par == XCTRL('q')){
@ -1806,7 +1783,6 @@ listbox_select_last (WListbox *l, int set_top)
l->pos = l->count - 1;
if (set_top)
l->top = l->list->prev;
x_listbox_select_nth (l, l->pos);
}
}
@ -1893,14 +1869,12 @@ listbox_select_entry (WListbox *l, WLEntry *dest)
l->top = l->current;
}
l->pos = pos;
x_listbox_select_nth (l, l->pos);
return;
}
}
/* If we are unable to find it, set decent values */
l->current = l->top = l->list;
l->pos = 0;
x_listbox_select_nth (l, l->pos);
}
/* Selects from base the pos element */
@ -1999,7 +1973,7 @@ listbox_callback (Dlg_head *h, WListbox *l, int msg, int par)
switch (msg){
case WIDGET_INIT:
return x_create_listbox (h, h->wdata, l);
return 1;
case WIDGET_HOTKEY:
if ((e = listbox_check_hotkey (l, par)) != NULL){
@ -2102,7 +2076,6 @@ listbox_destroy (WListbox *l)
WLEntry *n, *p = l->list;
int i;
x_destroy_cmd (l);
for (i = 0; i < l->count; i++){
n = p->next;
g_free (p->text);
@ -2173,7 +2146,6 @@ listbox_append_item (WListbox *l, WLEntry *e, enum append_pos pos)
l->current->next->prev = e;
l->current->next = e;
}
x_list_insert (l, l->list, e);
l->count++;
}
@ -2246,7 +2218,7 @@ buttonbar_callback (Dlg_head *h, WButtonBar *bb, int msg, int par)
switch (msg){
case WIDGET_INIT:
return x_create_buttonbar (h, h->wdata, bb);
return 1;
case WIDGET_FOCUS:
return 0;
@ -2366,7 +2338,6 @@ define_label_data (Dlg_head *h, Widget *paneletc, int idx, char *text,
set_label_text (bb, idx, text);
bb->labels [idx-1].function = cback;
bb->labels [idx-1].data = data;
x_redefine_label (bb, idx);
}
void