From 10f65ac83dbc46fffc93e30719bf94689ca9fe5a Mon Sep 17 00:00:00 2001 From: Pavel Roskin Date: Sun, 31 Aug 2003 23:29:49 +0000 Subject: [PATCH] * dlg.h (struct Widget): Remove tkname field. (init_widget): Remove tkname argument. * widget.h (listbox_new): Likewise. Adjust all dependencies. --- edit/editcmd.c | 2 +- edit/editwidget.c | 2 +- src/ChangeLog | 7 +++++++ src/achown.c | 2 +- src/boxes.c | 2 +- src/chown.c | 4 ++-- src/complete.c | 2 +- src/dlg.c | 7 +------ src/dlg.h | 3 +-- src/find.c | 9 ++++----- src/help.c | 2 +- src/hotlist.c | 5 ++--- src/info.c | 2 +- src/listmode.c | 2 +- src/menu.c | 14 +++++++------- src/panelize.c | 2 +- src/screen.c | 2 +- src/tree.c | 2 +- src/view.c | 2 +- src/widget.c | 48 +++++++++++++++++++++++------------------------ src/widget.h | 3 +-- src/wtools.c | 2 +- 22 files changed, 62 insertions(+), 64 deletions(-) diff --git a/edit/editcmd.c b/edit/editcmd.c index 685fb3c1c..ddf8534a6 100644 --- a/edit/editcmd.c +++ b/edit/editcmd.c @@ -2767,7 +2767,7 @@ edit_completion_dialog (WEdit *edit, int max_len, int word_len, /* create the listbox */ compl_list = listbox_new (1, 1, compl_dlg_w - 2, compl_dlg_h - 2, 0, - compllist_callback, NULL); + compllist_callback); /* add the dialog */ add_widget (compl_dlg, compl_list); diff --git a/edit/editwidget.c b/edit/editwidget.c index eece55023..709319fd8 100644 --- a/edit/editwidget.c +++ b/edit/editwidget.c @@ -187,7 +187,7 @@ edit (const char *_file, int line) init_widget (&(wedit->widget), 0, 0, LINES - 1, COLS, (callback_fn) edit_callback, (destroy_fn) edit_clean, - (mouse_h) edit_mouse_event, 0); + (mouse_h) edit_mouse_event); widget_want_cursor (wedit->widget, 1); diff --git a/src/ChangeLog b/src/ChangeLog index 339746497..b2f193b7c 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2003-08-31 Pavel Roskin + + * dlg.h (struct Widget): Remove tkname field. + (init_widget): Remove tkname argument. + * widget.h (listbox_new): Likewise. + Adjust all dependencies. + 2003-08-29 Andrew V. Samoilov * cmd.c (edit_symlink_cmd): Fix possible off-by-one after diff --git a/src/achown.c b/src/achown.c index b639a8431..637753b8d 100644 --- a/src/achown.c +++ b/src/achown.c @@ -265,7 +265,7 @@ do_enter_key (Dlg_head * h, int f_pos) "[Advanced Chown]", title, DLG_COMPACT); /* get new listboxes */ - chl_list = listbox_new (1, 1, 15, 11, 0, l_call, NULL); + chl_list = listbox_new (1, 1, 15, 11, 0, l_call); listbox_add_item (chl_list, 0, 0, "", NULL); diff --git a/src/boxes.c b/src/boxes.c index 65fde9a30..d52b752db 100644 --- a/src/boxes.c +++ b/src/boxes.c @@ -975,7 +975,7 @@ jobs_cmd (void) "[Background jobs]", _("Background Jobs"), DLG_CENTER); - bg_list = listbox_new (2, 3, JOBS_X-7, JOBS_Y-9, listbox_nothing, 0, "listbox"); + bg_list = listbox_new (2, 3, JOBS_X-7, JOBS_Y-9, listbox_nothing, 0); add_widget (jobs_dlg, bg_list); i = n_buttons; diff --git a/src/chown.c b/src/chown.c index f1181f05a..2a63a89f8 100644 --- a/src/chown.c +++ b/src/chown.c @@ -177,8 +177,8 @@ init_chown (void) } /* get new listboxes */ - l_user = listbox_new (UY + 1, UX + 1, 19, 10, 0, l_call, NULL); - l_group = listbox_new (GY + 1, GX + 1, 19, 10, 0, l_call, NULL); + l_user = listbox_new (UY + 1, UX + 1, 19, 10, 0, l_call); + l_group = listbox_new (GY + 1, GX + 1, 19, 10, 0, l_call); /* add fields for unknown names (numbers) */ listbox_add_item (l_user, 0, 0, _(""), NULL); diff --git a/src/complete.c b/src/complete.c index 79817b256..8ee5a3587 100644 --- a/src/complete.c +++ b/src/complete.c @@ -985,7 +985,7 @@ complete_engine (WInput *in, int what_to_do) query_dlg = create_dlg (y, x, query_height, query_width, dialog_colors, query_callback, "[Completion]", NULL, DLG_COMPACT); - query_list = listbox_new (1, 1, w - 2, h - 2, 0, querylist_callback, NULL); + query_list = listbox_new (1, 1, w - 2, h - 2, 0, querylist_callback); add_widget (query_dlg, query_list); for (p = in->completions + 1; *p; p++) listbox_add_item (query_list, 0, 0, *p, NULL); diff --git a/src/dlg.c b/src/dlg.c index 1bc59cad1..d0df7c114 100644 --- a/src/dlg.c +++ b/src/dlg.c @@ -119,7 +119,7 @@ void dlg_erase (Dlg_head *h) void init_widget (Widget *w, int y, int x, int lines, int cols, callback_fn callback, destroy_fn destroy, - mouse_h mouse_handler, char *tkname) + mouse_h mouse_handler) { w->x = x; w->y = y; @@ -129,12 +129,7 @@ init_widget (Widget *w, int y, int x, int lines, int cols, w->destroy = destroy; w->mouse = mouse_handler; w->parent = 0; - w->tkname = tkname; - if (tkname && *tkname == 0) { - fprintf (stderr, "Got a null string for the tkname\n"); - abort (); - } /* Almost all widgets want to put the cursor in a suitable place */ w->options = W_WANT_CURSOR; } diff --git a/src/dlg.h b/src/dlg.h index 55cca5a13..e37e63d0b 100644 --- a/src/dlg.h +++ b/src/dlg.h @@ -112,7 +112,6 @@ typedef struct Widget { destroy_fn destroy; mouse_h mouse; struct Dlg_head *parent; - char *tkname; /* name used for history saving */ } Widget; /* The options for the widgets */ @@ -171,7 +170,7 @@ void dlg_broadcast_msg (Dlg_head *h, int message, int reverse); void init_widget (Widget *w, int y, int x, int lines, int cols, callback_fn callback, destroy_fn destroy, - mouse_h mouse_handler, char *tkname); + mouse_h mouse_handler); /* Default callback for dialogs */ int default_dlg_callback (Dlg_head *h, int id, int msg); diff --git a/src/find.c b/src/find.c index 309591e69..99bb1c621 100644 --- a/src/find.c +++ b/src/find.c @@ -802,9 +802,9 @@ setup_gui (void) fbuts[7].x = fbuts[6].x + fbuts[6].len + l2; } - find_dlg = create_dlg (0, 0, FIND2_Y, FIND2_X, dialog_colors, - find_callback, "[Find File]", _("Find File"), - DLG_CENTER); + find_dlg = + create_dlg (0, 0, FIND2_Y, FIND2_X, dialog_colors, find_callback, + "[Find File]", _("Find File"), DLG_CENTER); add_widget (find_dlg, button_new (FIND2_Y - 3, fbuts[7].x, B_VIEW, NORMAL_BUTTON, @@ -841,8 +841,7 @@ setup_gui (void) add_widget (find_dlg, status_label); find_list = - listbox_new (2, 2, FIND2_X - 4, FIND2_Y - 9, listbox_finish, 0, - "listbox"); + listbox_new (2, 2, FIND2_X - 4, FIND2_Y - 9, listbox_finish, 0); add_widget (find_dlg, find_list); } diff --git a/src/help.c b/src/help.c index a5805d802..4e7631576 100644 --- a/src/help.c +++ b/src/help.c @@ -592,7 +592,7 @@ static Widget *mousedispatch_new (int y, int x, int yl, int xl) Widget *w = g_new (Widget, 1); init_widget (w, y, x, yl, xl, - (callback_fn) md_callback, 0, (mouse_h) help_event, NULL); + (callback_fn) md_callback, 0, (mouse_h) help_event); return w; } diff --git a/src/hotlist.c b/src/hotlist.c index 566c47b95..9e356e92c 100644 --- a/src/hotlist.c +++ b/src/hotlist.c @@ -645,7 +645,7 @@ init_hotlist (int list_type) /* get new listbox */ l_hotlist = listbox_new (UY + 1, UX + 1, COLS - 2 * UX - 8, LINES - 14, - listbox_cback, l_call, "listbox"); + listbox_cback, l_call); /* Fill the hotlist with the active VFS or the hotlist */ #ifdef USE_VFS @@ -694,8 +694,7 @@ init_movelist (int list_type, struct hotlist *item) /* get new listbox */ l_movelist = listbox_new (UY + 1, UX + 1, movelist_dlg->cols - 2 * UX - 2, - movelist_dlg->lines - 8, listbox_cback, l_call, - "listbox"); + movelist_dlg->lines - 8, listbox_cback, l_call); fill_listbox (); diff --git a/src/info.c b/src/info.c index 4a5aa96bd..99c99ed04 100644 --- a/src/info.c +++ b/src/info.c @@ -248,7 +248,7 @@ WInfo *info_new () init_widget (&info->widget, 0, 0, 0, 0, (callback_fn) info_callback, (destroy_fn) info_destroy, - (mouse_h) info_event, NULL); + (mouse_h) info_event); /* We do not want the cursor */ widget_want_cursor (info->widget, 0); diff --git a/src/listmode.c b/src/listmode.c index f66904c8f..a8ad0a01c 100644 --- a/src/listmode.c +++ b/src/listmode.c @@ -195,7 +195,7 @@ init_listmode (char *oldlistformat) radio_justify->sel = 1; /* get new listbox */ - l_listmode = listbox_new (UY + 5, UX + 1, 16, 9, 0, l_call, NULL); + l_listmode = listbox_new (UY + 5, UX + 1, 16, 9, 0, l_call); if (strncmp (oldlistformat, "full ", 5) == 0) { format_width = 1; diff --git a/src/menu.c b/src/menu.c index ec3b10388..e149a7ced 100644 --- a/src/menu.c +++ b/src/menu.c @@ -531,21 +531,21 @@ destroy_menu (Menu *menu) g_free (menu); } -WMenu *menubar_new (int y, int x, int cols, Menu *menu [], int items) +WMenu * +menubar_new (int y, int x, int cols, Menu *menu[], int items) { - WMenu *menubar = g_new0 (WMenu, 1); /* FIXME: subsel used w/o being set */ - + WMenu *menubar = g_new0 (WMenu, 1); /* FIXME: subsel used w/o being set */ + init_widget (&menubar->widget, y, x, 1, cols, - (callback_fn) menubar_callback, - (destroy_fn) menubar_destroy, - (mouse_h) menubar_event, NULL); + (callback_fn) menubar_callback, + (destroy_fn) menubar_destroy, (mouse_h) menubar_event); menubar->menu = menu; menubar->active = 0; menubar->dropped = 0; menubar->items = items; menubar->selected = 0; widget_want_cursor (menubar->widget, 0); - menubar_arrange(menubar); + menubar_arrange (menubar); return menubar; } diff --git a/src/panelize.c b/src/panelize.c index bd315d16f..688371db0 100644 --- a/src/panelize.c +++ b/src/panelize.c @@ -170,7 +170,7 @@ static void init_panelize (void) add_widget (panelize_dlg, label_new (UY+13, UX, _("Command"), "label-command")); /* get new listbox */ - l_panelize = listbox_new (UY + 1, UX + 1, panelize_dlg->cols-12, 10, 0, l_call, "li"); + l_panelize = listbox_new (UY + 1, UX + 1, panelize_dlg->cols-12, 10, 0, l_call); while (current){ listbox_add_item (l_panelize, 0, 0, current->label, current); diff --git a/src/screen.c b/src/screen.c index 4f3bed53a..fb725fcc7 100644 --- a/src/screen.c +++ b/src/screen.c @@ -934,7 +934,7 @@ panel_new (const char *panel_name) /* No know sizes of the panel at startup */ init_widget (&panel->widget, 0, 0, 0, 0, (callback_fn) panel_callback, (destroy_fn) panel_destroy, - (mouse_h) panel_event, NULL); + (mouse_h) panel_event); /* We do not want the cursor */ widget_want_cursor (panel->widget, 0); diff --git a/src/tree.c b/src/tree.c index 055c39213..197052d6d 100644 --- a/src/tree.c +++ b/src/tree.c @@ -1072,7 +1072,7 @@ tree_new (int is_panel, int y, int x, int lines, int cols) init_widget (&tree->widget, y, x, lines, cols, (callback_fn) tree_callback, (destroy_fn) tree_destroy, - (mouse_h) event_callback, NULL); + (mouse_h) event_callback); tree->is_panel = is_panel; tree->selected_ptr = 0; diff --git a/src/view.c b/src/view.c index 174d81f10..4fd692ead 100644 --- a/src/view.c +++ b/src/view.c @@ -2745,7 +2745,7 @@ view_new (int y, int x, int cols, int lines, int is_panel) init_widget (&view->widget, y, x, lines, cols, (callback_fn) view_callback, (destroy_fn) view_destroy, - (mouse_h) real_view_event, NULL); + (mouse_h) real_view_event); view->hex_mode = default_hex_mode; view->hexedit_mode = default_hexedit_mode; diff --git a/src/widget.c b/src/widget.c index 4999629dd..7eddfefad 100644 --- a/src/widget.c +++ b/src/widget.c @@ -210,7 +210,7 @@ button_new (int y, int x, int action, int flags, char *text, init_widget (&b->widget, y, x, 1, button_len (text, flags), (callback_fn) button_callback, - (destroy_fn) button_destroy, (mouse_h)button_event, tkname); + (destroy_fn) button_destroy, (mouse_h)button_event); b->action = action; b->flags = flags; @@ -362,7 +362,7 @@ radio_new (int y, int x, int count, char **texts, int use_hotkey, char *tkname) } init_widget (&r->widget, y, x, count, max, (callback_fn) radio_callback, - 0, (mouse_h) radio_event, tkname); + 0, (mouse_h) radio_event); r->state = 1; r->pos = 0; r->sel = 0; @@ -457,7 +457,7 @@ check_new (int y, int x, int state, char *text, char *tkname) init_widget (&c->widget, y, x, 1, strlen (text), (callback_fn)check_callback, - (destroy_fn)check_destroy, (mouse_h) check_event, tkname); + (destroy_fn)check_destroy, (mouse_h) check_event); c->state = state ? C_BOOL : 0; c->text = g_strdup (text); c->hotkey = 0; @@ -576,7 +576,7 @@ label_new (int y, int x, const char *text, char *tkname) l = g_new (WLabel, 1); init_widget (&l->widget, y, x, 1, width, (callback_fn) label_callback, - (destroy_fn) label_destroy, NULL, tkname); + (destroy_fn) label_destroy, NULL); l->text = text ? g_strdup (text) : 0; l->auto_adjust_cols = 1; l->transparent = 0; @@ -668,7 +668,7 @@ gauge_new (int y, int x, int shown, int max, int current, char *tkname) init_widget (&g->widget, y, x, 1, gauge_len, (callback_fn) gauge_callback, - (destroy_fn) gauge_destroy, NULL, tkname); + (destroy_fn) gauge_destroy, NULL); g->shown = shown; if (max == 0) max = 1; /* I do not like division by zero :) */ @@ -954,7 +954,7 @@ show_hist (GList *history, int widget_x, int widget_y) query_dlg = create_dlg (y, x, h, w, dialog_colors, NULL, "[History-query]", i18n_htitle (), DLG_COMPACT); - query_list = listbox_new (1, 1, w - 2, h - 2, listbox_finish, 0, NULL); + query_list = listbox_new (1, 1, w - 2, h - 2, listbox_finish, 0); add_widget (query_dlg, query_list); hi = z; if (y < widget_y) { @@ -1606,7 +1606,7 @@ input_new (int y, int x, int color, int len, const char *def_text, char *tkname) init_widget (&in->widget, y, x, 1, len, (callback_fn) input_callback, - (destroy_fn) input_destroy, (mouse_h) input_event, tkname); + (destroy_fn) input_destroy, (mouse_h) input_event); /* history setup */ in->history = NULL; @@ -2089,32 +2089,32 @@ listbox_destroy (WListbox *l) } WListbox * -listbox_new (int y, int x, int width, int height, - int action, lcback callback, char *tkname) +listbox_new (int y, int x, int width, int height, int action, + lcback callback) { WListbox *l = g_new (WListbox, 1); extern int slow_terminal; - - init_widget (&l->widget, y, x, height, width, - (callback_fn)listbox_callback, - (destroy_fn) listbox_destroy, (mouse_h)listbox_event, tkname); - l->list = l->top = l->current = 0; - l->pos = 0; - l->width = width; + init_widget (&l->widget, y, x, height, width, + (callback_fn) listbox_callback, + (destroy_fn) listbox_destroy, (mouse_h) listbox_event); + + l->list = l->top = l->current = 0; + l->pos = 0; + l->width = width; if (height <= 0) - l->height = 1; + l->height = 1; else - l->height = height; - l->count = 0; - l->top = 0; - l->current= 0; - l->cback = callback; + l->height = height; + l->count = 0; + l->top = 0; + l->current = 0; + l->cback = callback; l->action = action; l->allow_duplicates = 1; l->scrollbar = slow_terminal ? 0 : 1; widget_want_hotkey (l->widget, 1); - + return l; } @@ -2291,7 +2291,7 @@ buttonbar_new (int visible) init_widget (&bb->widget, LINES-1, 0, 1, COLS, (callback_fn) buttonbar_callback, - (destroy_fn) buttonbar_destroy, (mouse_h) buttonbar_event, NULL); + (destroy_fn) buttonbar_destroy, (mouse_h) buttonbar_event); bb->visible = visible; for (i = 0; i < 10; i++){ diff --git a/src/widget.h b/src/widget.h index 68a1cae5b..8a64e27c6 100644 --- a/src/widget.h +++ b/src/widget.h @@ -141,8 +141,7 @@ WCheck *check_new (int y, int x, int state, char *text, char *tkname); WInput *input_new (int y, int x, int color, int len, const char *text, char *tkname); WLabel *label_new (int y, int x, const char *text, char *tkname); WGauge *gauge_new (int y, int x, int shown, int max, int current, char *tkname); -WListbox *listbox_new (int x, int y, int width, int height, int action, - lcback, char *tkname); +WListbox *listbox_new (int x, int y, int width, int height, int action, lcback callback); /* Input lines */ void winput_set_origin (WInput *i, int x, int field_len); diff --git a/src/wtools.c b/src/wtools.c index 563c1e91e..a71725801 100644 --- a/src/wtools.c +++ b/src/wtools.c @@ -76,7 +76,7 @@ Listbox *create_listbox_window (int cols, int lines, char *title, char *help) listbox->dlg = create_dlg (ypos, xpos, lines+6, cols+4, dialog_colors, NULL, help, title, DLG_CENTER); - listbox->list = listbox_new (2, 2, cols, lines, listbox_finish, 0, "li"); + listbox->list = listbox_new (2, 2, cols, lines, listbox_finish, 0); add_widget (listbox->dlg, button_new (lines+3, (cols/2 + 2) - len/2,