Unify widget and dialog message handling.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2012-09-28 15:05:43 +04:00
parent 497b69c106
commit 665d238ffa
45 changed files with 478 additions and 465 deletions

View File

@ -58,13 +58,13 @@ static cb_ret_t
button_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data)
{
WButton *b = (WButton *) w;
WDialog *h = w->owner;
int stop = 0;
int off = 0;
WDialog *h = w->owner;
switch (msg)
{
case WIDGET_HOTKEY:
case MSG_HOTKEY:
/*
* Don't let the default button steal Enter from the current
* button. This is a workaround for the flawed event model
@ -73,24 +73,24 @@ button_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *
*/
if (parm == '\n' && WIDGET (h->current->data) == WIDGET (b))
{
send_message (w, sender, WIDGET_KEY, ' ', data);
send_message (w, sender, MSG_KEY, ' ', data);
return MSG_HANDLED;
}
if (parm == '\n' && b->flags == DEFPUSH_BUTTON)
{
send_message (w, sender, WIDGET_KEY, ' ', data);
send_message (w, sender, MSG_KEY, ' ', data);
return MSG_HANDLED;
}
if (b->text.hotkey != NULL && g_ascii_tolower ((gchar) b->text.hotkey[0]) == parm)
{
send_message (w, sender, WIDGET_KEY, ' ', data);
send_message (w, sender, MSG_KEY, ' ', data);
return MSG_HANDLED;
}
return MSG_NOT_HANDLED;
case WIDGET_KEY:
case MSG_KEY:
if (parm != ' ' && parm != '\n')
return MSG_NOT_HANDLED;
@ -103,7 +103,7 @@ button_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *
}
return MSG_HANDLED;
case WIDGET_CURSOR:
case MSG_CURSOR:
switch (b->flags)
{
case DEFPUSH_BUTTON:
@ -123,12 +123,12 @@ button_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *
widget_move (w, 0, b->hotpos + off);
return MSG_HANDLED;
case WIDGET_UNFOCUS:
case WIDGET_FOCUS:
case WIDGET_DRAW:
if (msg == WIDGET_UNFOCUS)
case MSG_UNFOCUS:
case MSG_FOCUS:
case MSG_DRAW:
if (msg == MSG_UNFOCUS)
b->selected = FALSE;
else if (msg == WIDGET_FOCUS)
else if (msg == MSG_FOCUS)
b->selected = TRUE;
widget_selectcolor (w, b->selected, FALSE);
@ -168,12 +168,12 @@ button_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *
}
return MSG_HANDLED;
case WIDGET_DESTROY:
case MSG_DESTROY:
release_hotkey (b->text);
return MSG_HANDLED;
default:
return widget_default_callback (sender, msg, parm, data);
return widget_default_callback (w, sender, msg, parm, data);
}
}
@ -192,8 +192,8 @@ button_event (Gpm_Event * event, void *data)
dlg_select_widget (w);
if ((event->type & GPM_UP) != 0)
{
send_message (w, NULL, WIDGET_KEY, ' ', NULL);
w->owner->callback (w->owner, w, DLG_POST_KEY, ' ', NULL);
send_message (w, NULL, MSG_KEY, ' ', NULL);
send_message (w->owner, w, MSG_POST_KEY, ' ', NULL);
}
}
@ -246,7 +246,7 @@ button_set_text (WButton * b, const char *text)
b->text = parse_hotkey (text);
w->cols = button_get_len (b);
if (w->owner != NULL)
send_message (w, NULL, WIDGET_DRAW, 0, NULL);
send_message (w, NULL, MSG_DRAW, 0, NULL);
}
/* --------------------------------------------------------------------------------------------- */

View File

@ -151,8 +151,7 @@ buttonbar_call (WButtonBar * bb, int i)
Widget *w = WIDGET (bb);
if ((bb != NULL) && (bb->labels[i].command != CK_IgnoreKey))
ret = w->owner->callback (w->owner, w, DLG_ACTION,
bb->labels[i].command, bb->labels[i].receiver);
ret = send_message (w->owner, w, MSG_ACTION, bb->labels[i].command, bb->labels[i].receiver);
return ret;
}
@ -167,16 +166,16 @@ buttonbar_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, voi
switch (msg)
{
case WIDGET_FOCUS:
case MSG_FOCUS:
return MSG_NOT_HANDLED;
case WIDGET_HOTKEY:
case MSG_HOTKEY:
for (i = 0; i < BUTTONBAR_LABELS_NUM; i++)
if (parm == KEY_F (i + 1) && buttonbar_call (bb, i))
return MSG_HANDLED;
return MSG_NOT_HANDLED;
case WIDGET_DRAW:
case MSG_DRAW:
if (bb->visible)
{
buttonbar_init_button_positions (bb);
@ -203,13 +202,13 @@ buttonbar_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, voi
}
return MSG_HANDLED;
case WIDGET_DESTROY:
case MSG_DESTROY:
for (i = 0; i < BUTTONBAR_LABELS_NUM; i++)
g_free (bb->labels[i].text);
return MSG_HANDLED;
default:
return widget_default_callback (sender, msg, parm, data);
return widget_default_callback (w, sender, msg, parm, data);
}
}

View File

@ -49,7 +49,7 @@ static inline void
buttonbar_redraw (WButtonBar * bb)
{
if (bb != NULL)
send_message (WIDGET (bb), NULL, WIDGET_DRAW, 0, NULL);
send_message (bb, NULL, MSG_DRAW, 0, NULL);
}
static inline void

View File

@ -57,49 +57,49 @@ static cb_ret_t
check_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data)
{
WCheck *c = (WCheck *) w;
WDialog *h = w->owner;
switch (msg)
{
case WIDGET_HOTKEY:
case MSG_HOTKEY:
if (c->text.hotkey != NULL)
{
if (g_ascii_tolower ((gchar) c->text.hotkey[0]) == parm)
{
send_message (w, sender, WIDGET_KEY, ' ', data); /* make action */
/* make action */
send_message (w, sender, MSG_KEY, ' ', data);
return MSG_HANDLED;
}
}
return MSG_NOT_HANDLED;
case WIDGET_KEY:
case MSG_KEY:
if (parm != ' ')
return MSG_NOT_HANDLED;
c->state ^= C_BOOL;
c->state ^= C_CHANGE;
h->callback (h, w, DLG_ACTION, 0, NULL);
send_message (w, sender, WIDGET_FOCUS, ' ', data);
send_message (WIDGET (w)->owner, w, MSG_ACTION, 0, NULL);
send_message (w, sender, MSG_FOCUS, ' ', data);
return MSG_HANDLED;
case WIDGET_CURSOR:
case MSG_CURSOR:
widget_move (c, 0, 1);
return MSG_HANDLED;
case WIDGET_FOCUS:
case WIDGET_UNFOCUS:
case WIDGET_DRAW:
widget_selectcolor (w, msg == WIDGET_FOCUS, FALSE);
case MSG_FOCUS:
case MSG_UNFOCUS:
case MSG_DRAW:
widget_selectcolor (w, msg == MSG_FOCUS, FALSE);
widget_move (c, 0, 0);
tty_print_string ((c->state & C_BOOL) ? "[x] " : "[ ] ");
hotkey_draw (w, c->text, msg == WIDGET_FOCUS);
hotkey_draw (w, c->text, msg == MSG_FOCUS);
return MSG_HANDLED;
case WIDGET_DESTROY:
case MSG_DESTROY:
release_hotkey (c->text);
return MSG_HANDLED;
default:
return widget_default_callback (sender, msg, parm, data);
return widget_default_callback (w, sender, msg, parm, data);
}
}
@ -118,9 +118,9 @@ check_event (Gpm_Event * event, void *data)
dlg_select_widget (w);
if ((event->type & GPM_UP) != 0)
{
send_message (w, NULL, WIDGET_KEY, ' ', NULL);
send_message (w, NULL, WIDGET_FOCUS, 0, NULL);
w->owner->callback (w->owner, w, DLG_POST_KEY, ' ', NULL);
send_message (w, NULL, MSG_KEY, ' ', NULL);
send_message (w, NULL, MSG_FOCUS, 0, NULL);
send_message (w->owner, w, MSG_POST_KEY, ' ', NULL);
}
}

View File

@ -123,7 +123,7 @@ dlg_resize_cb (void *data, void *user_data)
(void) user_data;
if (d->state == DLG_ACTIVE)
d->callback (d, NULL, DLG_RESIZE, 0, NULL);
send_message (d, NULL, MSG_RESIZE, 0, NULL);
else
d->winch_pending = TRUE;
}

View File

@ -185,9 +185,9 @@ dlg_unfocus (WDialog * h)
{
Widget *current = WIDGET (h->current->data);
if (send_message (current, NULL, WIDGET_UNFOCUS, 0, NULL) == MSG_HANDLED)
if (send_message (current, NULL, MSG_UNFOCUS, 0, NULL) == MSG_HANDLED)
{
h->callback (h, current, DLG_UNFOCUS, 0, NULL);
send_message (h, current, MSG_UNFOCUS, 0, NULL);
return TRUE;
}
}
@ -248,8 +248,8 @@ do_select_widget (WDialog * h, GList * w, select_dir_t dir)
if (dlg_overlap (w0, WIDGET (h->current->data)))
{
send_message (WIDGET (h->current->data), NULL, WIDGET_DRAW, 0, NULL);
send_message (WIDGET (h->current->data), NULL, WIDGET_FOCUS, 0, NULL);
send_message (h->current->data, NULL, MSG_DRAW, 0, NULL);
send_message (h->current->data, NULL, MSG_FOCUS, 0, NULL);
}
}
@ -347,7 +347,7 @@ dlg_handle_key (WDialog * h, int d_key)
if (command == CK_IgnoreKey)
return MSG_NOT_HANDLED;
if (h->callback (h, NULL, DLG_ACTION, command, NULL) == MSG_HANDLED
if (send_message (h, NULL, MSG_ACTION, command, NULL) == MSG_HANDLED
|| dlg_execute_cmd (h, command) == MSG_HANDLED)
return MSG_HANDLED;
@ -447,7 +447,7 @@ dlg_try_hotkey (WDialog * h, int d_key)
handled = MSG_NOT_HANDLED;
if ((current->options & W_WANT_HOTKEY) != 0)
handled = send_message (current, NULL, WIDGET_HOTKEY, d_key, NULL);
handled = send_message (current, NULL, MSG_HOTKEY, d_key, NULL);
/* If not used, send hotkey to other widgets */
if (handled == MSG_HANDLED)
@ -461,7 +461,7 @@ dlg_try_hotkey (WDialog * h, int d_key)
current = WIDGET (hot_cur->data);
if ((current->options & W_WANT_HOTKEY) != 0 && (current->options & W_DISABLED) == 0)
handled = send_message (current, NULL, WIDGET_HOTKEY, d_key, NULL);
handled = send_message (current, NULL, MSG_HOTKEY, d_key, NULL);
if (handled == MSG_NOT_HANDLED)
hot_cur = dlg_widget_next (h, hot_cur);
@ -502,26 +502,26 @@ dlg_key_event (WDialog * h, int d_key)
}
/* first can dlg_callback handle the key */
handled = h->callback (h, NULL, DLG_KEY, d_key, NULL);
handled = send_message (h, NULL, MSG_KEY, d_key, NULL);
/* next try the hotkey */
if (handled == MSG_NOT_HANDLED)
handled = dlg_try_hotkey (h, d_key);
if (handled == MSG_HANDLED)
h->callback (h, NULL, DLG_HOTKEY_HANDLED, 0, NULL);
send_message (h, NULL, MSG_HOTKEY_HANDLED, 0, NULL);
else
/* not used - then try widget_callback */
handled = send_message (WIDGET (h->current->data), NULL, WIDGET_KEY, d_key, NULL);
handled = send_message (h->current->data, NULL, MSG_KEY, d_key, NULL);
/* not used- try to use the unhandled case */
if (handled == MSG_NOT_HANDLED)
handled = h->callback (h, NULL, DLG_UNHANDLED_KEY, d_key, NULL);
handled = send_message (h, NULL, MSG_UNHANDLED_KEY, d_key, NULL);
if (handled == MSG_NOT_HANDLED)
handled = dlg_handle_key (h, d_key);
h->callback (h, NULL, DLG_POST_KEY, d_key, NULL);
send_message (h, NULL, MSG_POST_KEY, d_key, NULL);
}
/* --------------------------------------------------------------------------------------------- */
@ -537,7 +537,7 @@ frontend_run_dlg (WDialog * h)
/* close opened editors, viewers, etc */
if (!h->modal && mc_global.midnight_shutdown)
{
h->callback (h, NULL, DLG_VALIDATE, 0, NULL);
send_message (h, NULL, MSG_VALIDATE, 0, NULL);
return;
}
@ -552,7 +552,7 @@ frontend_run_dlg (WDialog * h)
execute_hooks (idle_hook);
while ((WIDGET (h)->options & W_WANT_IDLE) != 0 && is_idle ())
h->callback (h, NULL, DLG_IDLE, 0, NULL);
send_message (h, NULL, MSG_IDLE, 0, NULL);
/* Allow terminating the dialog from the idle handler */
if (h->state != DLG_ACTIVE)
@ -568,7 +568,7 @@ frontend_run_dlg (WDialog * h)
dlg_process_event (h, d_key, &event);
if (h->state == DLG_CLOSED)
h->callback (h, NULL, DLG_VALIDATE, 0, NULL);
send_message (h, NULL, MSG_VALIDATE, 0, NULL);
}
}
@ -734,15 +734,17 @@ dlg_set_size (WDialog * h, int lines, int cols)
/** Default dialog callback */
cb_ret_t
dlg_default_callback (WDialog * h, Widget * sender, dlg_msg_t msg, int parm, void *data)
dlg_default_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data)
{
WDialog *h = DIALOG (w);
(void) sender;
(void) parm;
(void) data;
switch (msg)
{
case DLG_DRAW:
case MSG_DRAW:
if (h->color != NULL)
{
dlg_default_repaint (h);
@ -750,11 +752,11 @@ dlg_default_callback (WDialog * h, Widget * sender, dlg_msg_t msg, int parm, voi
}
return MSG_NOT_HANDLED;
case DLG_IDLE:
dlg_broadcast_msg_to (h, WIDGET_IDLE, FALSE, W_WANT_IDLE);
case MSG_IDLE:
dlg_broadcast_msg_to (h, MSG_IDLE, FALSE, W_WANT_IDLE);
return MSG_HANDLED;
case DLG_RESIZE:
case MSG_RESIZE:
/* this is default resizing mechanism */
/* the main idea of this code is to resize dialog
according to flags (if any of flags require automatic
@ -774,7 +776,7 @@ dlg_default_callback (WDialog * h, Widget * sender, dlg_msg_t msg, int parm, voi
WDialog *
create_dlg (gboolean modal, int y1, int x1, int lines, int cols,
const int *colors, dlg_cb_fn callback, mouse_h mouse_handler,
const int *colors, widget_cb_fn callback, mouse_h mouse_handler,
const char *help_ctx, const char *title, dlg_flags_t flags)
{
WDialog *new_d;
@ -782,7 +784,7 @@ create_dlg (gboolean modal, int y1, int x1, int lines, int cols,
new_d = g_new0 (WDialog, 1);
w = WIDGET (new_d);
init_widget (w, y1, x1, lines, cols, NULL, mouse_handler);
init_widget (w, y1, x1, lines, cols, (callback != NULL) ? callback : dlg_default_callback, mouse_handler);
widget_want_cursor (w, FALSE);
new_d->state = DLG_CONSTRUCT;
@ -790,7 +792,6 @@ create_dlg (gboolean modal, int y1, int x1, int lines, int cols,
if (colors != NULL)
memmove (new_d->color, colors, sizeof (dlg_colors_t));
new_d->help_ctx = help_ctx;
new_d->callback = (callback != NULL) ? callback : dlg_default_callback;
new_d->flags = flags;
new_d->data = NULL;
@ -900,9 +901,9 @@ add_widget_autopos (WDialog * h, void *w, widget_pos_flags_t pos_flags, const vo
/* widget has been added in runtime */
if (h->state == DLG_ACTIVE)
{
send_message (widget, NULL, WIDGET_INIT, 0, NULL);
send_message (widget, NULL, WIDGET_DRAW, 0, NULL);
send_message (widget, NULL, WIDGET_FOCUS, 0, NULL);
send_message (widget, NULL, MSG_INIT, 0, NULL);
send_message (widget, NULL, MSG_DRAW, 0, NULL);
send_message (widget, NULL, MSG_FOCUS, 0, NULL);
}
return widget->id;
@ -944,7 +945,7 @@ del_widget (void *w)
h->current = dlg_widget_next (h, d);
h->widgets = g_list_remove_link (h->widgets, d);
send_message (d->data, NULL, WIDGET_DESTROY, 0, NULL);
send_message (d->data, NULL, MSG_DESTROY, 0, NULL);
g_list_free_1 (d);
/* widget has been deleted in runtime */
@ -1000,9 +1001,9 @@ dlg_focus (WDialog * h)
Widget *current = WIDGET (h->current->data);
if (((current->options & W_DISABLED) == 0)
&& (send_message (current, NULL, WIDGET_FOCUS, 0, NULL) == MSG_HANDLED))
&& (send_message (current, NULL, MSG_FOCUS, 0, NULL) == MSG_HANDLED))
{
h->callback (h, current, DLG_FOCUS, 0, NULL);
send_message (h, current, MSG_FOCUS, 0, NULL);
return TRUE;
}
}
@ -1134,7 +1135,7 @@ update_cursor (WDialog * h)
w = WIDGET (p->data);
if (((w->options & W_DISABLED) == 0) && ((w->options & W_WANT_CURSOR) != 0))
send_message (w, NULL, WIDGET_CURSOR, 0, NULL);
send_message (w, NULL, MSG_CURSOR, 0, NULL);
else
do
{
@ -1145,7 +1146,7 @@ update_cursor (WDialog * h)
w = WIDGET (p->data);
if (((w->options & W_DISABLED) == 0) && ((w->options & W_WANT_CURSOR) != 0))
if (send_message (w, NULL, WIDGET_CURSOR, 0, NULL) == MSG_HANDLED)
if (send_message (w, NULL, MSG_CURSOR, 0, NULL) == MSG_HANDLED)
break;
}
while (TRUE);
@ -1167,11 +1168,11 @@ dlg_redraw (WDialog * h)
if (h->winch_pending)
{
h->winch_pending = FALSE;
h->callback (h, NULL, DLG_RESIZE, 0, NULL);
send_message (h, NULL, MSG_RESIZE, 0, NULL);
}
h->callback (h, NULL, DLG_DRAW, 0, NULL);
dlg_broadcast_msg (h, WIDGET_DRAW);
send_message (h, NULL, MSG_DRAW, 0, NULL);
dlg_broadcast_msg (h, MSG_DRAW);
update_cursor (h);
}
@ -1201,8 +1202,8 @@ init_dlg (WDialog * h)
if (!h->modal)
dialog_switch_add (h);
h->callback (h, NULL, DLG_INIT, 0, NULL);
dlg_broadcast_msg (h, WIDGET_INIT);
send_message (h, NULL, MSG_INIT, 0, NULL);
dlg_broadcast_msg (h, MSG_INIT);
dlg_read_history (h);
}
@ -1225,7 +1226,7 @@ dlg_process_event (WDialog * h, int key, Gpm_Event * event)
if (key == EV_NONE)
{
if (tty_got_interrupt ())
if (h->callback (h, NULL, DLG_ACTION, CK_Cancel, NULL) != MSG_HANDLED)
if (send_message (h, NULL, MSG_ACTION, CK_Cancel, NULL) != MSG_HANDLED)
dlg_execute_cmd (h, CK_Cancel);
return;
@ -1247,11 +1248,10 @@ dlg_run_done (WDialog * h)
if (h->state == DLG_CLOSED)
{
h->callback (h, WIDGET (h->current->data), DLG_END, 0, NULL);
send_message (h, h->current->data, MSG_END, 0, NULL);
if (!h->modal)
dialog_switch_remove (h);
}
}
/* --------------------------------------------------------------------------------------------- */
@ -1278,7 +1278,7 @@ destroy_dlg (WDialog * h)
{
/* if some widgets have history, save all history at one moment here */
dlg_save_history (h);
dlg_broadcast_msg (h, WIDGET_DESTROY);
dlg_broadcast_msg (h, MSG_DESTROY);
g_list_foreach (h->widgets, (GFunc) g_free, NULL);
g_list_free (h->widgets);
mc_event_group_del (h->event_group);
@ -1370,14 +1370,14 @@ dlg_replace_widget (Widget * old_w, Widget * new_w)
else
g_list_find (h->widgets, old_w)->data = new_w;
send_message (old_w, NULL, WIDGET_DESTROY, 0, NULL);
send_message (new_w, NULL, WIDGET_INIT, 0, NULL);
send_message (old_w, NULL, MSG_DESTROY, 0, NULL);
send_message (new_w, NULL, MSG_INIT, 0, NULL);
if (should_focus)
dlg_select_widget (new_w);
if (new_w->owner->state == DLG_ACTIVE)
send_message (new_w, NULL, WIDGET_DRAW, 0, NULL);
send_message (new_w, NULL, MSG_DRAW, 0, NULL);
}
/* --------------------------------------------------------------------------------------------- */

View File

@ -29,25 +29,6 @@
/*** enums ***************************************************************************************/
/* Dialog messages */
typedef enum
{
DLG_INIT = 0, /* Initialize dialog */
DLG_IDLE = 1, /* The idle state is active */
DLG_DRAW = 2, /* Draw dialog on screen */
DLG_FOCUS = 3, /* A widget has got focus */
DLG_UNFOCUS = 4, /* A widget has been unfocused */
DLG_RESIZE = 5, /* Window size has changed */
DLG_KEY = 6, /* Key before sending to widget */
DLG_HOTKEY_HANDLED = 7, /* A widget has got the hotkey */
DLG_POST_KEY = 8, /* The key has been handled */
DLG_UNHANDLED_KEY = 9, /* Key that no widget handled */
DLG_ACTION = 10, /* State of check- and radioboxes has changed
* and listbox current entry has changed */
DLG_VALIDATE = 11, /* Dialog is to be closed */
DLG_END = 12 /* Shut down dialog */
} dlg_msg_t;
/* Flags for create_dlg */
typedef enum
{
@ -89,9 +70,6 @@ typedef char *(*dlg_title_str) (const WDialog * h, size_t len);
typedef int dlg_colors_t[DLG_COLOR_COUNT];
/* Dialog callback */
typedef cb_ret_t (*dlg_cb_fn) (WDialog * h, Widget * sender, dlg_msg_t msg, int parm, void *data);
/* menu command execution */
typedef cb_ret_t (*menu_exec_fn) (int command);
@ -124,7 +102,6 @@ struct WDialog
void *data; /* Data can be passed to dialog */
char *event_group; /* Name of event group for this dialog */
dlg_cb_fn callback;
dlg_shortcut_str get_shortcut; /* Shortcut string */
dlg_title_str get_title; /* useless for modal dialogs */
};
@ -152,7 +129,7 @@ void draw_box (const WDialog * h, int y, int x, int ys, int xs, gboolean single)
/* Creates a dialog head */
WDialog *create_dlg (gboolean modal, int y1, int x1, int lines, int cols,
const int *colors, dlg_cb_fn callback, mouse_h mouse_handler,
const int *colors, widget_cb_fn callback, mouse_h mouse_handler,
const char *help_ctx, const char *title, dlg_flags_t flags);
void dlg_set_default_colors (void);
@ -184,7 +161,7 @@ void dlg_redraw (WDialog * h);
void dlg_broadcast_msg (WDialog * h, widget_msg_t message);
/* Default callback for dialogs */
cb_ret_t dlg_default_callback (WDialog * h, Widget * sender, dlg_msg_t msg, int parm, void *data);
cb_ret_t dlg_default_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data);
/* Default paint routine for dialogs */
void dlg_default_repaint (WDialog * h);

View File

@ -64,14 +64,14 @@ gauge_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *d
WGauge *g = (WGauge *) w;
WDialog *h = w->owner;
if (msg == WIDGET_INIT)
if (msg == MSG_INIT)
return MSG_HANDLED;
/* We don't want to get the focus */
if (msg == WIDGET_FOCUS)
if (msg == MSG_FOCUS)
return MSG_NOT_HANDLED;
if (msg == WIDGET_DRAW)
if (msg == MSG_DRAW)
{
widget_move (w, 0, 0);
tty_setcolor (h->color[DLG_COLOR_NORMAL]);
@ -118,7 +118,7 @@ gauge_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *d
return MSG_HANDLED;
}
return widget_default_callback (sender, msg, parm, data);
return widget_default_callback (w, sender, msg, parm, data);
}
/* --------------------------------------------------------------------------------------------- */
@ -160,7 +160,7 @@ gauge_set_value (WGauge * g, int max, int current)
max = 1; /* I do not like division by zero :) */
g->current = current;
g->max = max;
gauge_callback (WIDGET (g), NULL, WIDGET_DRAW, 0, NULL);
gauge_callback (WIDGET (g), NULL, MSG_DRAW, 0, NULL);
}
/* --------------------------------------------------------------------------------------------- */
@ -171,7 +171,7 @@ gauge_show (WGauge * g, gboolean shown)
if (g->shown != shown)
{
g->shown = shown;
gauge_callback (WIDGET (g), NULL, WIDGET_DRAW, 0, NULL);
gauge_callback (WIDGET (g), NULL, MSG_DRAW, 0, NULL);
}
}

View File

@ -59,13 +59,13 @@ groupbox_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void
switch (msg)
{
case WIDGET_INIT:
case MSG_INIT:
return MSG_HANDLED;
case WIDGET_FOCUS:
case MSG_FOCUS:
return MSG_NOT_HANDLED;
case WIDGET_DRAW:
case MSG_DRAW:
{
Widget *wo = WIDGET (w->owner);
@ -82,12 +82,12 @@ groupbox_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void
return MSG_HANDLED;
}
case WIDGET_DESTROY:
case MSG_DESTROY:
g_free (g->title);
return MSG_HANDLED;
default:
return widget_default_callback (sender, msg, parm, data);
return widget_default_callback (w, sender, msg, parm, data);
}
}
@ -135,7 +135,7 @@ groupbox_set_title (WGroupbox *g, const char *title)
}
if (w->owner != NULL)
send_message (w, NULL, WIDGET_DRAW, 0, NULL);
send_message (w, NULL, MSG_DRAW, 0, NULL);
}
/* --------------------------------------------------------------------------------------------- */

View File

@ -117,15 +117,15 @@ history_dlg_reposition (WDialog * dlg_head)
/* --------------------------------------------------------------------------------------------- */
static cb_ret_t
history_dlg_callback (WDialog * h, Widget * sender, dlg_msg_t msg, int parm, void *data)
history_dlg_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data)
{
switch (msg)
{
case DLG_RESIZE:
return history_dlg_reposition (h);
case MSG_RESIZE:
return history_dlg_reposition (DIALOG (w));
default:
return dlg_default_callback (h, sender, msg, parm, data);
return dlg_default_callback (w, sender, msg, parm, data);
}
}
@ -336,7 +336,7 @@ history_show (GList ** history, Widget * widget, int current)
The main idea - create 4x4 dialog and add 2x2 list in
center of it, and let dialog function resize it to needed
size. */
history_dlg_callback (query_dlg, NULL, DLG_RESIZE, 0, NULL);
send_message (query_dlg, NULL, MSG_RESIZE, 0, NULL);
if (WIDGET (query_dlg)->y < widget->y)
{

View File

@ -61,8 +61,8 @@ hline_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *d
switch (msg)
{
case WIDGET_INIT:
case WIDGET_RESIZED:
case MSG_INIT:
case MSG_RESIZE:
if (l->auto_adjust_cols)
{
Widget *wo = WIDGET (h);
@ -79,11 +79,11 @@ hline_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *d
}
}
case WIDGET_FOCUS:
case MSG_FOCUS:
/* We don't want to get the focus */
return MSG_NOT_HANDLED;
case WIDGET_DRAW:
case MSG_DRAW:
if (l->transparent)
tty_setcolor (DEFAULT_COLOR);
else
@ -101,7 +101,7 @@ hline_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *d
return MSG_HANDLED;
default:
return widget_default_callback (sender, msg, parm, data);
return widget_default_callback (w, sender, msg, parm, data);
}
}

View File

@ -981,7 +981,7 @@ input_event (Gpm_Event * event, void *data)
* @param enable TRUE if specified options should be added, FALSE if options should be removed
*/
static void
input_set_options_callback (Widget *w, widget_options_t options, gboolean enable)
input_set_options_callback (Widget * w, widget_options_t options, gboolean enable)
{
WInput *in = (WInput *) w;
@ -1064,14 +1064,14 @@ input_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *d
switch (msg)
{
case WIDGET_INIT:
case MSG_INIT:
/* subscribe to "history_load" event */
mc_event_add (w->owner->event_group, MCEVENT_HISTORY_LOAD, input_load_history, w, NULL);
/* subscribe to "history_save" event */
mc_event_add (w->owner->event_group, MCEVENT_HISTORY_SAVE, input_save_history, w, NULL);
return MSG_HANDLED;
case WIDGET_KEY:
case MSG_KEY:
if (parm == XCTRL ('q'))
{
quote = 1;
@ -1096,21 +1096,21 @@ input_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *d
return input_handle_char (in, parm);
case WIDGET_COMMAND:
case MSG_ACTION:
return input_execute_cmd (in, parm);
case WIDGET_FOCUS:
case WIDGET_UNFOCUS:
case WIDGET_DRAW:
case WIDGET_RESIZED:
case MSG_FOCUS:
case MSG_UNFOCUS:
case MSG_DRAW:
case MSG_RESIZE:
input_update (in, FALSE);
return MSG_HANDLED;
case WIDGET_CURSOR:
case MSG_CURSOR:
widget_move (in, 0, str_term_width2 (in->buffer, in->point) - in->term_first_shown);
return MSG_HANDLED;
case WIDGET_DESTROY:
case MSG_DESTROY:
/* unsubscribe from "history_load" event */
mc_event_del (w->owner->event_group, MCEVENT_HISTORY_LOAD, input_load_history, w);
/* unsubscribe from "history_save" event */
@ -1119,7 +1119,7 @@ input_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *d
return MSG_HANDLED;
default:
return widget_default_callback (sender, msg, parm, data);
return widget_default_callback (w, sender, msg, parm, data);
}
}

View File

@ -1048,14 +1048,16 @@ insert_text (WInput * in, char *text, ssize_t size)
/* --------------------------------------------------------------------------------------------- */
static cb_ret_t
query_callback (WDialog * h, Widget * sender, dlg_msg_t msg, int parm, void *data)
query_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data)
{
static char buff[MB_LEN_MAX] = "";
static int bl = 0;
WDialog *h = DIALOG (w);
switch (msg)
{
case DLG_KEY:
case MSG_KEY:
switch (parm)
{
case KEY_LEFT:
@ -1100,7 +1102,7 @@ query_callback (WDialog * h, Widget * sender, dlg_msg_t msg, int parm, void *dat
listbox_select_entry ((WListbox *) h->current->data, i);
end = new_end;
input_handle_char (input, parm);
send_message (WIDGET (h->current->data), NULL, WIDGET_DRAW, 0, NULL);
send_message (h->current->data, NULL, MSG_DRAW, 0, NULL);
break;
}
}
@ -1203,7 +1205,7 @@ query_callback (WDialog * h, Widget * sender, dlg_msg_t msg, int parm, void *dat
if (need_redraw == 2)
{
insert_text (input, last_text, low);
send_message (WIDGET (h->current->data), NULL, WIDGET_DRAW, 0, NULL);
send_message (h->current->data, NULL, MSG_DRAW, 0, NULL);
}
else if (need_redraw == 1)
{
@ -1217,7 +1219,7 @@ query_callback (WDialog * h, Widget * sender, dlg_msg_t msg, int parm, void *dat
break;
default:
return dlg_default_callback (h, sender, msg, parm, data);
return dlg_default_callback (w, sender, msg, parm, data);
}
}

View File

@ -64,14 +64,14 @@ label_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *d
switch (msg)
{
case WIDGET_INIT:
case MSG_INIT:
return MSG_HANDLED;
/* We don't want to get the focus */
case WIDGET_FOCUS:
case MSG_FOCUS:
return MSG_NOT_HANDLED;
case WIDGET_DRAW:
case MSG_DRAW:
{
char *p = l->text;
int y = 0;
@ -116,12 +116,12 @@ label_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *d
return MSG_HANDLED;
}
case WIDGET_DESTROY:
case MSG_DESTROY:
g_free (l->text);
return MSG_HANDLED;
default:
return widget_default_callback (sender, msg, parm, data);
return widget_default_callback (w, sender, msg, parm, data);
}
}
@ -183,7 +183,7 @@ label_set_text (WLabel * label, const char *text)
}
if (w->owner != NULL)
send_message (w, NULL, WIDGET_DRAW, 0, NULL);
send_message (w, NULL, MSG_DRAW, 0, NULL);
if (newcols < w->cols)
w->cols = newcols;

View File

@ -373,10 +373,10 @@ listbox_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void
switch (msg)
{
case WIDGET_INIT:
case MSG_INIT:
return MSG_HANDLED;
case WIDGET_HOTKEY:
case MSG_HOTKEY:
{
int pos, action;
@ -385,7 +385,7 @@ listbox_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void
return MSG_NOT_HANDLED;
listbox_select_entry (l, pos);
h->callback (h, w, DLG_ACTION, l->pos, NULL);
send_message (h, w, MSG_ACTION, l->pos, NULL);
if (l->callback != NULL)
action = l->callback (l);
@ -401,38 +401,38 @@ listbox_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void
return MSG_HANDLED;
}
case WIDGET_KEY:
case MSG_KEY:
ret_code = listbox_key (l, parm);
if (ret_code != MSG_NOT_HANDLED)
{
listbox_draw (l, TRUE);
h->callback (h, w, DLG_ACTION, l->pos, NULL);
send_message (h, w, MSG_ACTION, l->pos, NULL);
}
return ret_code;
case WIDGET_COMMAND:
case MSG_ACTION:
return listbox_execute_cmd (l, parm);
case WIDGET_CURSOR:
case MSG_CURSOR:
widget_move (l, l->cursor_y, 0);
h->callback (h, w, DLG_ACTION, l->pos, NULL);
send_message (h, w, MSG_ACTION, l->pos, NULL);
return MSG_HANDLED;
case WIDGET_FOCUS:
case WIDGET_UNFOCUS:
case WIDGET_DRAW:
listbox_draw (l, msg != WIDGET_UNFOCUS);
case MSG_FOCUS:
case MSG_UNFOCUS:
case MSG_DRAW:
listbox_draw (l, msg != MSG_UNFOCUS);
return MSG_HANDLED;
case WIDGET_DESTROY:
case MSG_DESTROY:
listbox_destroy (l);
return MSG_HANDLED;
case WIDGET_RESIZED:
case MSG_RESIZE:
return MSG_HANDLED;
default:
return widget_default_callback (sender, msg, parm, data);
return widget_default_callback (w, sender, msg, parm, data);
}
}

View File

@ -318,7 +318,7 @@ menubar_execute (WMenuBar * menubar)
mc_global.widget.is_right = (menubar->selected != 0);
menubar_finish (menubar);
w->owner->callback (w->owner, w, DLG_ACTION, entry->command, NULL);
send_message (w->owner, w, MSG_ACTION, entry->command, NULL);
do_refresh ();
}
}
@ -549,7 +549,7 @@ menubar_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void
switch (msg)
{
/* We do not want the focus unless we have been activated */
case WIDGET_FOCUS:
case MSG_FOCUS:
if (!menubar->is_active)
return MSG_NOT_HANDLED;
@ -562,8 +562,8 @@ menubar_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void
return MSG_HANDLED;
/* We don't want the buttonbar to activate while using the menubar */
case WIDGET_HOTKEY:
case WIDGET_KEY:
case MSG_HOTKEY:
case MSG_KEY:
if (menubar->is_active)
{
menubar_handle_key (menubar, parm);
@ -571,14 +571,14 @@ menubar_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void
}
return MSG_NOT_HANDLED;
case WIDGET_CURSOR:
case MSG_CURSOR:
/* Put the cursor in a suitable place */
return MSG_NOT_HANDLED;
case WIDGET_UNFOCUS:
case MSG_UNFOCUS:
return menubar->is_active ? MSG_NOT_HANDLED : MSG_HANDLED;
case WIDGET_DRAW:
case MSG_DRAW:
if (menubar->is_visible)
{
menubar_draw (menubar);
@ -586,18 +586,18 @@ menubar_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void
}
/* fall through */
case WIDGET_RESIZED:
case MSG_RESIZE:
/* try show menu after screen resize */
send_message (w, sender, WIDGET_FOCUS, 0, data);
send_message (w, sender, MSG_FOCUS, 0, data);
return MSG_HANDLED;
case WIDGET_DESTROY:
case MSG_DESTROY:
menubar_set_menu (menubar, NULL);
return MSG_HANDLED;
default:
return widget_default_callback (sender, msg, parm, data);
return widget_default_callback (w, sender, msg, parm, data);
}
}

View File

@ -334,7 +334,7 @@ typedef struct
const char *title;
const char *help;
quick_widget_t *widgets;
dlg_cb_fn callback;
widget_cb_fn callback;
mouse_h mouse;
} quick_dialog_t;

View File

@ -58,11 +58,10 @@ radio_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *d
{
WRadio *r = (WRadio *) w;
int i;
WDialog *h = w->owner;
switch (msg)
{
case WIDGET_HOTKEY:
case MSG_HOTKEY:
{
for (i = 0; i < r->count; i++)
{
@ -75,20 +74,20 @@ radio_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *d
r->pos = i;
/* Take action */
send_message (w, sender, WIDGET_KEY, ' ', data);
send_message (w, sender, MSG_KEY, ' ', data);
return MSG_HANDLED;
}
}
}
return MSG_NOT_HANDLED;
case WIDGET_KEY:
case MSG_KEY:
switch (parm)
{
case ' ':
r->sel = r->pos;
h->callback (h, w, DLG_ACTION, 0, NULL);
send_message (w, sender, WIDGET_FOCUS, ' ', data);
send_message (w->owner, w, MSG_ACTION, 0, NULL);
send_message (w, sender, MSG_FOCUS, ' ', data);
return MSG_HANDLED;
case KEY_UP:
@ -110,18 +109,18 @@ radio_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *d
}
return MSG_NOT_HANDLED;
case WIDGET_CURSOR:
h->callback (h, w, DLG_ACTION, 0, NULL);
send_message (w, sender, WIDGET_FOCUS, ' ', data);
case MSG_CURSOR:
send_message (w->owner, w, MSG_ACTION, 0, NULL);
send_message (w, sender, MSG_FOCUS, ' ', data);
widget_move (r, r->pos, 1);
return MSG_HANDLED;
case WIDGET_UNFOCUS:
case WIDGET_FOCUS:
case WIDGET_DRAW:
case MSG_UNFOCUS:
case MSG_FOCUS:
case MSG_DRAW:
for (i = 0; i < r->count; i++)
{
const gboolean focused = (i == r->pos && msg == WIDGET_FOCUS);
const gboolean focused = (i == r->pos && msg == MSG_FOCUS);
widget_selectcolor (w, focused, FALSE);
widget_move (r, i, 0);
@ -131,14 +130,14 @@ radio_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *d
}
return MSG_HANDLED;
case WIDGET_DESTROY:
case MSG_DESTROY:
for (i = 0; i < r->count; i++)
release_hotkey (r->texts[i]);
g_free (r->texts);
return MSG_HANDLED;
default:
return widget_default_callback (sender, msg, parm, data);
return widget_default_callback (w, sender, msg, parm, data);
}
}
@ -163,8 +162,8 @@ radio_event (Gpm_Event * event, void *data)
dlg_select_widget (w);
if ((event->type & GPM_UP) != 0)
{
radio_callback (w, NULL, WIDGET_KEY, ' ', NULL);
w->owner->callback (w->owner, w, DLG_POST_KEY, ' ', NULL);
radio_callback (w, NULL, MSG_KEY, ' ', NULL);
send_message (w->owner, w, MSG_POST_KEY, ' ', NULL);
}
}

View File

@ -158,21 +158,22 @@ init_widget (Widget * w, int y, int x, int lines, int cols,
/* Default callback for widgets */
cb_ret_t
widget_default_callback (Widget * sender, widget_msg_t msg, int parm, void *data)
widget_default_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data)
{
(void) w;
(void) sender;
(void) parm;
(void) data;
switch (msg)
{
case WIDGET_INIT:
case WIDGET_FOCUS:
case WIDGET_UNFOCUS:
case WIDGET_DRAW:
case WIDGET_DESTROY:
case WIDGET_CURSOR:
case WIDGET_IDLE:
case MSG_INIT:
case MSG_FOCUS:
case MSG_UNFOCUS:
case MSG_DRAW:
case MSG_DESTROY:
case MSG_CURSOR:
case MSG_IDLE:
return MSG_HANDLED;
default:
@ -198,7 +199,7 @@ widget_default_set_options_callback (Widget *w, widget_options_t options, gboole
w->options &= ~options;
if (w->owner != NULL && (options & W_DISABLED) != 0)
send_message (w, NULL, WIDGET_DRAW, 0, NULL);
send_message (w, NULL, MSG_DRAW, 0, NULL);
}
/* --------------------------------------------------------------------------------------------- */
@ -225,7 +226,7 @@ widget_set_size (Widget * widget, int y, int x, int lines, int cols)
widget->y = y;
widget->cols = cols;
widget->lines = lines;
send_message (widget, NULL, WIDGET_RESIZED, 0, NULL);
send_message (widget, NULL, MSG_RESIZE, 0, NULL);
}
/* --------------------------------------------------------------------------------------------- */

View File

@ -24,25 +24,31 @@
/* Widget messages */
typedef enum
{
WIDGET_INIT, /* Initialize widget */
WIDGET_FOCUS, /* Draw widget in focused state */
WIDGET_UNFOCUS, /* Draw widget in unfocused state */
WIDGET_DRAW, /* Sent to widget to draw themselves */
WIDGET_KEY, /* Sent to widgets on key press */
WIDGET_HOTKEY, /* Sent to widget to catch preprocess key */
WIDGET_COMMAND, /* Send to widget to handle command */
WIDGET_DESTROY, /* Sent to widget at destruction time */
WIDGET_CURSOR, /* Sent to widget to position the cursor */
WIDGET_IDLE, /* Sent to widgets with options & W_WANT_IDLE */
WIDGET_RESIZED /* Sent after a widget has been resized */
MSG_INIT = 0, /* Initialize widget */
MSG_FOCUS, /* Draw widget in focused state or widget has got focus */
MSG_UNFOCUS, /* Draw widget in unfocused state or widget has been unfocused */
MSG_DRAW, /* Draw widget on screen */
MSG_KEY, /* Sent to widgets on key press */
MSG_HOTKEY, /* Sent to widget to catch preprocess key */
MSG_HOTKEY_HANDLED, /* A widget has got the hotkey */
MSG_UNHANDLED_KEY, /* Key that no widget handled */
MSG_POST_KEY, /* The key has been handled */
MSG_ACTION, /* Send to widget to handle command or
* state of check- and radiobuttons has changed
* and listbox current entry has changed */
MSG_CURSOR, /* Sent to widget to position the cursor */
MSG_IDLE, /* The idle state is active */
MSG_RESIZE, /* Screen size has changed */
MSG_VALIDATE, /* Dialog is to be closed */
MSG_END, /* Shut down dialog */
MSG_DESTROY /* Sent to widget at destruction time */
} widget_msg_t;
/* Widgets are expected to answer to the following messages:
WIDGET_FOCUS: 1 if the accept the focus, 0 if they do not.
WIDGET_UNFOCUS: 1 if they accept to release the focus, 0 if they don't.
WIDGET_KEY: 1 if they actually used the key, 0 if not.
WIDGET_HOTKEY: 1 if they actually used the key, 0 if not.
MSG_FOCUS: MSG_HANDLED if the accept the focus, MSG_NOT_HANDLED if they do not.
MSG_UNFOCUS: MSG_HANDLED if they accept to release the focus, MSG_NOT_HANDLED if they don't.
MSG_KEY: MSG_HANDLED if they actually used the key, MSG_NOT_HANDLED if not.
MSG_HOTKEY: MSG_HANDLED if they actually used the key, MSG_NOT_HANDLED if not.
*/
typedef enum
@ -84,7 +90,8 @@ typedef enum
/*** structures declarations (and typedefs of structures)*****************************************/
/* Widget callback */
typedef cb_ret_t (*widget_cb_fn) (struct Widget * widget, Widget * sender, widget_msg_t msg, int parm, void *data);
typedef cb_ret_t (*widget_cb_fn) (Widget * widget, Widget * sender, widget_msg_t msg, int parm,
void *data);
/* Every Widget must have this as its first element */
struct Widget
@ -122,18 +129,18 @@ void release_hotkey (const hotkey_t hotkey);
/* return width on terminal of hotkey */
int hotkey_width (const hotkey_t hotkey);
/* draw hotkey of widget */
void hotkey_draw (struct Widget *w, const hotkey_t hotkey, gboolean focused);
void hotkey_draw (Widget *w, const hotkey_t hotkey, gboolean focused);
/* widget initialization */
void init_widget (Widget * w, int y, int x, int lines, int cols,
widget_cb_fn callback, mouse_h mouse_handler);
/* Default callback for widgets */
cb_ret_t widget_default_callback (Widget * sender, widget_msg_t msg, int parm, void *data);
cb_ret_t widget_default_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data);
void widget_default_set_options_callback (Widget *w, widget_options_t options, gboolean enable);
void widget_set_options (Widget *w, widget_options_t options, gboolean enable);
void widget_set_size (Widget * widget, int y, int x, int lines, int cols);
/* select color for widget in dependance of state */
void widget_selectcolor (struct Widget *w, gboolean focused, gboolean hotkey);
void widget_selectcolor (Widget *w, gboolean focused, gboolean hotkey);
void widget_erase (Widget * w);
/* get mouse pointer location within widget */
@ -143,9 +150,9 @@ gboolean mouse_global_in_widget (const Gpm_Event * event, const Widget * w);
/*** inline functions ****************************************************************************/
static inline cb_ret_t
send_message (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data)
send_message (void *w, void *sender, widget_msg_t msg, int parm, void *data)
{
return w->callback (w, sender, msg, parm, data);
return WIDGET (w)->callback (WIDGET (w), WIDGET (sender), msg, parm, data);
}
#endif /* MC__WIDGET_INTERNAL_H */

View File

@ -63,14 +63,15 @@ static int sel_pos = 0;
/** default query callback, used to reposition query */
static cb_ret_t
query_default_callback (WDialog * h, Widget * sender, dlg_msg_t msg, int parm, void *data)
query_default_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data)
{
WDialog *h = DIALOG (w);
switch (msg)
{
case DLG_RESIZE:
case MSG_RESIZE:
if ((h->flags & DLG_CENTER) == 0)
{
Widget *wh = WIDGET (h);
WDialog *prev_dlg = NULL;
int ypos, xpos;
@ -93,21 +94,21 @@ query_default_callback (WDialog * h, Widget * sender, dlg_msg_t msg, int parm, v
/* if previous dialog is not fullscreen'd -- overlap it */
if (prev_dlg == NULL || prev_dlg->fullscreen)
ypos = LINES / 3 - (wh->lines - 3) / 2;
ypos = LINES / 3 - (w->lines - 3) / 2;
else
ypos = WIDGET (prev_dlg)->y + 2;
xpos = COLS / 2 - wh->cols / 2;
xpos = COLS / 2 - w->cols / 2;
/* set position */
dlg_set_position (h, ypos, xpos, ypos + wh->lines, xpos + wh->cols);
dlg_set_position (h, ypos, xpos, ypos + w->lines, xpos + w->cols);
return MSG_HANDLED;
}
/* fallthrough */
default:
return dlg_default_callback (h, sender, msg, parm, data);
return dlg_default_callback (w, sender, msg, parm, data);
}
}
@ -126,7 +127,7 @@ do_create_message (int flags, const char *title, const char *text)
d = last_query_dlg;
/* do resize before initing and running */
query_default_callback (d, NULL, DLG_RESIZE, 0, NULL);
send_message (d, NULL, MSG_RESIZE, 0, NULL);
init_dlg (d);
g_free (p);
@ -334,7 +335,7 @@ query_dialog (const char *header, const char *text, int flags, int count, ...)
va_end (ap);
/* do resize before running and selecting any widget */
query_default_callback (query_dlg, NULL, DLG_RESIZE, 0, NULL);
send_message (query_dlg, NULL, MSG_RESIZE, 0, NULL);
if (defbutton != NULL)
dlg_select_widget (defbutton);

View File

@ -2438,7 +2438,7 @@ dview_init (WDiff * dview, const char *args, const char *file1, const char *file
ndiff = redo_diff (dview);
if (ndiff < 0)
{
/* goto WIDGET_DESTROY stage: dview_fini() */
/* goto MSG_DESTROY stage: dview_fini() */
f_close (f[DIFF_LEFT]);
f_close (f[DIFF_RIGHT]);
return -1;
@ -3312,18 +3312,18 @@ dview_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *d
switch (msg)
{
case WIDGET_INIT:
case MSG_INIT:
dview_labels (dview);
dview_load_options (dview);
dview_update (dview);
return MSG_HANDLED;
case WIDGET_DRAW:
case MSG_DRAW:
dview->new_frame = 1;
dview_update (dview);
return MSG_HANDLED;
case WIDGET_KEY:
case MSG_KEY:
i = dview_handle_key (dview, parm);
if (dview->view_quit)
dlg_stop (h);
@ -3331,7 +3331,7 @@ dview_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *d
dview_update (dview);
return i;
case WIDGET_COMMAND:
case MSG_ACTION:
i = dview_execute_cmd (dview, parm);
if (dview->view_quit)
dlg_stop (h);
@ -3339,13 +3339,13 @@ dview_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *d
dview_update (dview);
return i;
case WIDGET_DESTROY:
case MSG_DESTROY:
dview_save_options (dview);
dview_fini (dview);
return MSG_HANDLED;
default:
return widget_default_callback (sender, msg, parm, data);
return widget_default_callback (w, sender, msg, parm, data);
}
}
@ -3369,17 +3369,18 @@ dview_adjust_size (WDialog * h)
/* --------------------------------------------------------------------------------------------- */
static cb_ret_t
dview_dialog_callback (WDialog * h, Widget * sender, dlg_msg_t msg, int parm, void *data)
dview_dialog_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data)
{
WDiff *dview = (WDiff *) data;
WDialog *h = DIALOG (w);
switch (msg)
{
case DLG_RESIZE:
case MSG_RESIZE:
dview_adjust_size (h);
return MSG_HANDLED;
case DLG_ACTION:
case MSG_ACTION:
/* shortcut */
if (sender == NULL)
return dview_execute_cmd (NULL, parm);
@ -3387,14 +3388,14 @@ dview_dialog_callback (WDialog * h, Widget * sender, dlg_msg_t msg, int parm, vo
if (sender == WIDGET (find_buttonbar (h)))
{
if (data != NULL)
return send_message (WIDGET (data), NULL, WIDGET_COMMAND, parm, NULL);
return send_message (data, NULL, MSG_ACTION, parm, NULL);
dview = (WDiff *) find_widget_type (h, dview_callback);
return dview_execute_cmd (dview, parm);
}
return MSG_NOT_HANDLED;
case DLG_VALIDATE:
case MSG_VALIDATE:
dview = (WDiff *) find_widget_type (h, dview_callback);
h->state = DLG_ACTIVE; /* don't stop the dialog before final decision */
if (dview_ok_to_exit (dview))
@ -3402,7 +3403,7 @@ dview_dialog_callback (WDialog * h, Widget * sender, dlg_msg_t msg, int parm, vo
return MSG_HANDLED;
default:
return dlg_default_callback (h, sender, msg, parm, data);
return dlg_default_callback (w, sender, msg, parm, data);
}
}

View File

@ -1807,7 +1807,7 @@ user_menu (WEdit * edit, const char *menu_file, int selected_entry)
edit_cursor_move (edit, curs - edit->curs1);
edit->force |= REDRAW_PAGE;
send_message (WIDGET (edit), NULL, WIDGET_DRAW, 0, NULL);
send_message (edit, NULL, MSG_DRAW, 0, NULL);
}
/* --------------------------------------------------------------------------------------------- */
@ -3472,7 +3472,7 @@ edit_find_bracket (WEdit * edit)
/* --------------------------------------------------------------------------------------------- */
/**
* This executes a command as though the user initiated it through a key
* press. Callback with WIDGET_KEY as a message calls this after
* press. Callback with MSG_KEY as a message calls this after
* translating the key press. This function can be used to pass any
* command to the editor. Note that the screen wouldn't update
* automatically. Either of command or char_for_insertion must be

View File

@ -118,24 +118,24 @@ static unsigned long edit_save_mode_radio_id, edit_save_mode_input_id;
/* --------------------------------------------------------------------------------------------- */
static cb_ret_t
edit_save_mode_callback (WDialog * h, Widget * sender, dlg_msg_t msg, int parm, void *data)
edit_save_mode_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data)
{
switch (msg)
{
case DLG_ACTION:
case MSG_ACTION:
if (sender != NULL && sender->id == edit_save_mode_radio_id)
{
Widget *w;
Widget *ww;
w = dlg_find_by_id (h, edit_save_mode_input_id);
widget_disable (w, ((WRadio *) sender)->sel != 2);
ww = dlg_find_by_id (DIALOG (w), edit_save_mode_input_id);
widget_disable (ww, ((WRadio *) sender)->sel != 2);
return MSG_HANDLED;
}
return MSG_NOT_HANDLED;
default:
return dlg_default_callback (h, sender, msg, parm, data);
return dlg_default_callback (w, sender, msg, parm, data);
}
}
@ -3406,7 +3406,7 @@ edit_select_codepage_cmd (WEdit * edit)
edit_set_codeset (edit);
edit->force = REDRAW_PAGE;
send_message (WIDGET (edit), NULL, WIDGET_DRAW, 0, NULL);
send_message (edit, NULL, MSG_DRAW, 0, NULL);
}
#endif

View File

@ -68,16 +68,18 @@ edit_search_options_t edit_search_options = {
/* --------------------------------------------------------------------------------------------- */
static cb_ret_t
editcmd_dialog_raw_key_query_cb (WDialog *h, Widget * sender, dlg_msg_t msg, int parm, void *data)
editcmd_dialog_raw_key_query_cb (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data)
{
WDialog *h = DIALOG (w);
switch (msg)
{
case DLG_KEY:
case MSG_KEY:
h->ret_value = parm;
dlg_stop (h);
return MSG_HANDLED;
default:
return dlg_default_callback (h, sender, msg, parm, data);
return dlg_default_callback (w, sender, msg, parm, data);
}
}

View File

@ -84,7 +84,7 @@ static unsigned int edit_dlg_init_refcounter = 0;
/*** file scope functions ************************************************************************/
static cb_ret_t edit_dialog_callback (WDialog * h, Widget * sender, dlg_msg_t msg, int parm,
static cb_ret_t edit_dialog_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm,
void *data);
/* --------------------------------------------------------------------------------------------- */
@ -442,7 +442,7 @@ edit_event (Gpm_Event * event, void *data)
if (local.x == w->cols - dx - 1)
{
edit_dialog_callback (w->owner, NULL, DLG_ACTION, CK_Close, NULL);
send_message (w->owner, NULL, MSG_ACTION, CK_Close, NULL);
return MOU_NORMAL;
}
@ -694,7 +694,7 @@ edit_dialog_event (Gpm_Event * event, void *data)
if (x <= 2)
edit_toggle_fullscreen (e);
else
edit_dialog_callback (h, NULL, DLG_ACTION, CK_Close, NULL);
send_message (h, NULL, MSG_ACTION, CK_Close, NULL);
ret = MOU_NORMAL;
}
@ -865,37 +865,37 @@ edit_set_buttonbar (WEdit * edit, WButtonBar * bb)
/** Callback for the edit dialog */
static cb_ret_t
edit_dialog_callback (WDialog * h, Widget * sender, dlg_msg_t msg, int parm, void *data)
edit_dialog_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data)
{
WMenuBar *menubar;
WButtonBar *buttonbar;
Widget *wh = WIDGET (h);
WDialog *h = DIALOG (w);
switch (msg)
{
case DLG_INIT:
case MSG_INIT:
edit_dlg_init ();
return MSG_HANDLED;
case DLG_DRAW:
case MSG_DRAW:
/* don't use dlg_default_repaint() -- we don't need a frame */
tty_setcolor (EDITOR_BACKGROUND);
dlg_erase (h);
return MSG_HANDLED;
case DLG_RESIZE:
case MSG_RESIZE:
menubar = find_menubar (h);
buttonbar = find_buttonbar (h);
/* dlg_set_size() is surplus for this case */
wh->lines = LINES;
wh->cols = COLS;
widget_set_size (WIDGET (buttonbar), wh->lines - 1, wh->x, 1, wh->cols);
widget_set_size (WIDGET (menubar), wh->y, wh->x, 1, wh->cols);
w->lines = LINES;
w->cols = COLS;
widget_set_size (WIDGET (buttonbar), w->lines - 1, w->x, 1, w->cols);
widget_set_size (WIDGET (menubar), w->y, w->x, 1, w->cols);
menubar_arrange (menubar);
g_list_foreach (h->widgets, (GFunc) edit_dialog_resize_cb, NULL);
return MSG_HANDLED;
case DLG_ACTION:
case MSG_ACTION:
/* shortcut */
if (sender == NULL)
return edit_dialog_command_execute (h, parm);
@ -906,26 +906,26 @@ edit_dialog_callback (WDialog * h, Widget * sender, dlg_msg_t msg, int parm, voi
if (edit_dialog_command_execute (h, parm) == MSG_HANDLED)
return MSG_HANDLED;
/* try send command to the current window */
return send_message (WIDGET (h->current->data), NULL, WIDGET_COMMAND, parm, NULL);
return send_message (h->current->data, NULL, MSG_ACTION, parm, NULL);
}
/* message from buttonbar */
buttonbar = find_buttonbar (h);
if (sender == WIDGET (buttonbar))
{
if (data != NULL)
return send_message (WIDGET (data), NULL, WIDGET_COMMAND, parm, NULL);
return send_message (data, NULL, MSG_ACTION, parm, NULL);
return edit_dialog_command_execute (h, parm);
}
return MSG_NOT_HANDLED;
case DLG_KEY:
case MSG_KEY:
{
Widget *w = h->current->data;
Widget *we = WIDGET (h->current->data);
cb_ret_t ret = MSG_NOT_HANDLED;
if (edit_widget_is_editor (w))
if (edit_widget_is_editor (we))
{
WEdit *e = (WEdit *) w;
WEdit *e = (WEdit *) we;
unsigned long command;
if (!e->extmod)
@ -944,19 +944,19 @@ edit_dialog_callback (WDialog * h, Widget * sender, dlg_msg_t msg, int parm, voi
}
/* hardcoded menu hotkeys (see edit_drop_hotkey_menu) */
case DLG_UNHANDLED_KEY:
case MSG_UNHANDLED_KEY:
return edit_drop_hotkey_menu (h, parm) ? MSG_HANDLED : MSG_NOT_HANDLED;
case DLG_VALIDATE:
case MSG_VALIDATE:
edit_quit (h);
return MSG_HANDLED;
case DLG_END:
case MSG_END:
edit_dlg_deinit ();
return MSG_HANDLED;
default:
return dlg_default_callback (h, sender, msg, parm, data);
return dlg_default_callback (w, sender, msg, parm, data);
}
}
@ -969,21 +969,21 @@ edit_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *da
switch (msg)
{
case WIDGET_FOCUS:
case MSG_FOCUS:
edit_set_buttonbar (e, find_buttonbar (w->owner));
/* fall through */
case WIDGET_DRAW:
case MSG_DRAW:
e->force |= REDRAW_COMPLETELY;
edit_update_screen (e);
return MSG_HANDLED;
case WIDGET_UNFOCUS:
case MSG_UNFOCUS:
/* redraw frame and status */
edit_status (e, FALSE);
return MSG_HANDLED;
case WIDGET_KEY:
case MSG_KEY:
{
int cmd, ch;
cb_ret_t ret = MSG_NOT_HANDLED;
@ -1004,13 +1004,13 @@ edit_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *da
return ret;
}
case WIDGET_COMMAND:
case MSG_ACTION:
/* command from menubar or buttonbar */
edit_execute_key_command (e, parm, -1);
edit_update_screen (e);
return MSG_HANDLED;
case WIDGET_CURSOR:
case MSG_CURSOR:
{
int y, x;
@ -1022,12 +1022,12 @@ edit_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *da
return MSG_HANDLED;
}
case WIDGET_DESTROY:
case MSG_DESTROY:
edit_clean (e);
return MSG_HANDLED;
default:
return widget_default_callback (sender, msg, parm, data);
return widget_default_callback (w, sender, msg, parm, data);
}
}

View File

@ -283,27 +283,31 @@ update_mode (WDialog * h)
{
print_flags ();
chown_info_update ();
send_message (WIDGET (h->current->data), NULL, WIDGET_FOCUS, 0, NULL);
send_message (h->current->data, NULL, MSG_FOCUS, 0, NULL);
}
/* --------------------------------------------------------------------------------------------- */
static cb_ret_t
chl_callback (WDialog * h, Widget * sender, dlg_msg_t msg, int parm, void *data)
chl_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data)
{
switch (msg)
{
case DLG_KEY:
case MSG_KEY:
switch (parm)
{
case KEY_LEFT:
case KEY_RIGHT:
h->ret_value = parm;
dlg_stop (h);
{
WDialog *h = DIALOG (w);
h->ret_value = parm;
dlg_stop (h);
}
}
default:
return dlg_default_callback (h, sender, msg, parm, data);
return dlg_default_callback (w, sender, msg, parm, data);
}
}
@ -458,8 +462,9 @@ b_setpos (int f_pos)
/* --------------------------------------------------------------------------------------------- */
static cb_ret_t
advanced_chown_callback (WDialog * h, Widget * sender, dlg_msg_t msg, int parm, void *data)
advanced_chown_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data)
{
WDialog *h = DIALOG (w);
int i;
int f_pos;
unsigned int id;
@ -475,17 +480,17 @@ advanced_chown_callback (WDialog * h, Widget * sender, dlg_msg_t msg, int parm,
switch (msg)
{
case DLG_DRAW:
case MSG_DRAW:
chown_refresh ();
chown_info_update ();
return MSG_HANDLED;
case DLG_POST_KEY:
case MSG_POST_KEY:
if (f_pos < 3)
b_setpos (f_pos);
return MSG_HANDLED;
case DLG_FOCUS:
case MSG_FOCUS:
if (f_pos < 3)
{
if ((flag_pos / 3) != f_pos)
@ -496,7 +501,7 @@ advanced_chown_callback (WDialog * h, Widget * sender, dlg_msg_t msg, int parm,
flag_pos = f_pos + 6;
return MSG_HANDLED;
case DLG_KEY:
case MSG_KEY:
switch (parm)
{
case XCTRL ('b'):
@ -535,8 +540,8 @@ advanced_chown_callback (WDialog * h, Widget * sender, dlg_msg_t msg, int parm,
ch_flags[i * 3 + parm - 3] = (x_toggle & (1 << parm)) ? '-' : '+';
x_toggle ^= (1 << parm);
update_mode (h);
dlg_broadcast_msg (h, WIDGET_DRAW);
send_message (WIDGET (h->current->data), NULL, WIDGET_FOCUS, 0, NULL);
dlg_broadcast_msg (h, MSG_DRAW);
send_message (h->current->data, NULL, MSG_FOCUS, 0, NULL);
break;
case XCTRL ('x'):
@ -551,8 +556,8 @@ advanced_chown_callback (WDialog * h, Widget * sender, dlg_msg_t msg, int parm,
ch_flags[i * 3 + parm] = (x_toggle & (1 << parm)) ? '-' : '+';
x_toggle ^= (1 << parm);
update_mode (h);
dlg_broadcast_msg (h, WIDGET_DRAW);
send_message (WIDGET (h->current->data), NULL, WIDGET_FOCUS, 0, NULL);
dlg_broadcast_msg (h, MSG_DRAW);
send_message (h->current->data, NULL, MSG_FOCUS, 0, NULL);
break;
case 'x':
@ -601,7 +606,7 @@ advanced_chown_callback (WDialog * h, Widget * sender, dlg_msg_t msg, int parm,
{
ch_flags[flag_pos] = parm;
update_mode (h);
advanced_chown_callback (h, sender, DLG_KEY, KEY_RIGHT, NULL);
send_message (h, sender, MSG_KEY, KEY_RIGHT, NULL);
if (flag_pos > 8 || (flag_pos % 3) == 0)
dlg_one_down (h);
}
@ -610,7 +615,7 @@ advanced_chown_callback (WDialog * h, Widget * sender, dlg_msg_t msg, int parm,
return MSG_NOT_HANDLED;
default:
return dlg_default_callback (h, sender, msg, parm, data);
return dlg_default_callback (w, sender, msg, parm, data);
}
}

View File

@ -118,11 +118,13 @@ static WListbox *bg_list = NULL;
/* --------------------------------------------------------------------------------------------- */
static cb_ret_t
panel_listing_callback (WDialog * h, Widget * sender, dlg_msg_t msg, int parm, void *data)
panel_listing_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data)
{
WDialog *h = DIALOG (w);
switch (msg)
{
case DLG_KEY:
case MSG_KEY:
if (parm == '\n')
{
Widget *wi;
@ -170,14 +172,14 @@ panel_listing_callback (WDialog * h, Widget * sender, dlg_msg_t msg, int parm, v
r = (WRadio *) dlg_find_by_id (h, panel_listing_types_id);
r->pos = r->sel = panel_listing_user_idx;
dlg_select_widget (WIDGET (r)); /* force redraw */
h->callback (h, WIDGET (r), DLG_ACTION, 0, NULL);
send_message (h, r, MSG_ACTION, 0, NULL);
return MSG_HANDLED;
}
}
}
return MSG_NOT_HANDLED;
case DLG_ACTION:
case MSG_ACTION:
if (sender != NULL && sender->id == panel_listing_types_id)
{
WCheck *ch;
@ -221,7 +223,7 @@ panel_listing_callback (WDialog * h, Widget * sender, dlg_msg_t msg, int parm, v
return MSG_NOT_HANDLED;
default:
return dlg_default_callback (h, sender, msg, parm, data);
return dlg_default_callback (w, sender, msg, parm, data);
}
}
@ -262,11 +264,13 @@ sel_charset_button (WButton * button, int action)
/* --------------------------------------------------------------------------------------------- */
static cb_ret_t
tree_callback (WDialog * h, Widget * sender, dlg_msg_t msg, int parm, void *data)
tree_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data)
{
WDialog *h = DIALOG (w);
switch (msg)
{
case DLG_POST_KEY:
case MSG_POST_KEY:
/* The enter key will be processed by the tree widget */
if (parm == '\n')
{
@ -275,7 +279,7 @@ tree_callback (WDialog * h, Widget * sender, dlg_msg_t msg, int parm, void *data
}
return MSG_HANDLED;
case DLG_RESIZE:
case MSG_RESIZE:
{
Widget *bar;
@ -287,11 +291,11 @@ tree_callback (WDialog * h, Widget * sender, dlg_msg_t msg, int parm, void *data
return MSG_HANDLED;
}
case DLG_ACTION:
return send_message (WIDGET (find_tree (h)), NULL, WIDGET_COMMAND, parm, NULL);
case MSG_ACTION:
return send_message (find_tree (h), NULL, MSG_ACTION, parm, NULL);
default:
return dlg_default_callback (h, sender, msg, parm, data);
return dlg_default_callback (w, sender, msg, parm, data);
}
}
@ -299,26 +303,26 @@ tree_callback (WDialog * h, Widget * sender, dlg_msg_t msg, int parm, void *data
#if defined(ENABLE_VFS) && defined (ENABLE_VFS_FTP)
static cb_ret_t
confvfs_callback (WDialog * h, Widget * sender, dlg_msg_t msg, int parm, void *data)
confvfs_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data)
{
switch (msg)
{
case DLG_ACTION:
case MSG_ACTION:
/* message from "Always use ftp proxy" checkbutton */
if (sender != NULL && sender->id == ftpfs_always_use_proxy_id)
{
const gboolean not_use = !(((WCheck *) sender)->state & C_BOOL);
Widget *w;
Widget *wi;
/* input */
w = dlg_find_by_id (h, ftpfs_proxy_host_id);
widget_disable (w, not_use);
wi = dlg_find_by_id (DIALOG (w), ftpfs_proxy_host_id);
widget_disable (wi, not_use);
return MSG_HANDLED;
}
return MSG_NOT_HANDLED;
default:
return dlg_default_callback (h, sender, msg, parm, data);
return dlg_default_callback (w, sender, msg, parm, data);
}
}
#endif /* ENABLE_VFS && ENABLE_VFS_FTP */

View File

@ -216,11 +216,13 @@ chmod_refresh (WDialog * h)
/* --------------------------------------------------------------------------------------------- */
static cb_ret_t
chmod_callback (WDialog * h, Widget * sender, dlg_msg_t msg, int parm, void *data)
chmod_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data)
{
WDialog *h = DIALOG (w);
switch (msg)
{
case DLG_ACTION:
case MSG_ACTION:
{
/* handle checkboxes */
unsigned int i;
@ -249,7 +251,7 @@ chmod_callback (WDialog * h, Widget * sender, dlg_msg_t msg, int parm, void *dat
return MSG_NOT_HANDLED;
case DLG_KEY:
case MSG_KEY:
if (parm == 'T' || parm == 't' || parm == KEY_IC)
{
unsigned int i;
@ -270,12 +272,12 @@ chmod_callback (WDialog * h, Widget * sender, dlg_msg_t msg, int parm, void *dat
}
return MSG_NOT_HANDLED;
case DLG_DRAW:
case MSG_DRAW:
chmod_refresh (h);
return MSG_HANDLED;
default:
return dlg_default_callback (h, sender, msg, parm, data);
return dlg_default_callback (w, sender, msg, parm, data);
}
}

View File

@ -178,16 +178,16 @@ next_file (void)
/* --------------------------------------------------------------------------------------------- */
static cb_ret_t
chown_callback (WDialog * h, Widget * sender, dlg_msg_t msg, int parm, void *data)
chown_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data)
{
switch (msg)
{
case DLG_DRAW:
chown_refresh (h);
case MSG_DRAW:
chown_refresh (DIALOG (w));
return MSG_HANDLED;
default:
return dlg_default_callback (h, sender, msg, parm, data);
return dlg_default_callback (w, sender, msg, parm, data);
}
}

View File

@ -1580,7 +1580,7 @@ single_dirsize_cmd (void)
}
if (panels_options.mark_moves_down)
send_message (WIDGET (panel), NULL, WIDGET_COMMAND, CK_Down, NULL);
send_message (panel, NULL, MSG_ACTION, CK_Down, NULL);
recalculate_panel_summary (panel);

View File

@ -341,11 +341,11 @@ command_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void
switch (msg)
{
case WIDGET_FOCUS:
case MSG_FOCUS:
/* Never accept focus, otherwise panels will be unselected */
return MSG_NOT_HANDLED;
case WIDGET_KEY:
case MSG_KEY:
/* Special case: we handle the enter key */
if (parm == '\n')
return enter (cmd);

View File

@ -407,11 +407,13 @@ find_check_regexp (const char *r)
*/
static cb_ret_t
find_parm_callback (WDialog * h, Widget * sender, dlg_msg_t msg, int parm, void *data)
find_parm_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data)
{
WDialog *h = DIALOG (w);
switch (msg)
{
case DLG_ACTION:
case MSG_ACTION:
if (sender == WIDGET (content_use_cbox))
{
gboolean disable = !(content_use_cbox->state & C_BOOL);
@ -440,7 +442,7 @@ find_parm_callback (WDialog * h, Widget * sender, dlg_msg_t msg, int parm, void
return MSG_NOT_HANDLED;
case DLG_VALIDATE:
case MSG_VALIDATE:
if (h->ret_value != B_ENTER)
return MSG_HANDLED;
@ -467,7 +469,7 @@ find_parm_callback (WDialog * h, Widget * sender, dlg_msg_t msg, int parm, void
return MSG_HANDLED;
default:
return dlg_default_callback (h, sender, msg, parm, data);
return dlg_default_callback (w, sender, msg, parm, data);
}
}
@ -920,7 +922,7 @@ find_add_match (const char *dir, const char *file)
/* Don't scroll */
if (matches == 0)
listbox_select_first (find_list);
send_message (WIDGET (find_list), NULL, WIDGET_DRAW, 0, NULL);
send_message (find_list, NULL, MSG_DRAW, 0, NULL);
matches++;
found_num_update ();
@ -1469,11 +1471,13 @@ find_relocate_buttons (const WDialog * h, gboolean all_buttons)
/* --------------------------------------------------------------------------------------------- */
static cb_ret_t
find_callback (WDialog * h, Widget * sender, dlg_msg_t msg, int parm, void *data)
find_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data)
{
WDialog *h = DIALOG (w);
switch (msg)
{
case DLG_KEY:
case MSG_KEY:
if (parm == KEY_F (3) || parm == KEY_F (13))
{
int unparsed_view = (parm == KEY_F (13));
@ -1483,17 +1487,17 @@ find_callback (WDialog * h, Widget * sender, dlg_msg_t msg, int parm, void *data
return view_edit_currently_selected_file (0, 1);
return MSG_NOT_HANDLED;
case DLG_RESIZE:
case MSG_RESIZE:
dlg_set_size (h, LINES - 4, COLS - 16);
find_relocate_buttons (h, TRUE);
return MSG_HANDLED;
case DLG_IDLE:
case MSG_IDLE:
do_search (h);
return MSG_HANDLED;
default:
return dlg_default_callback (h, sender, msg, parm, data);
return dlg_default_callback (w, sender, msg, parm, data);
}
}

View File

@ -552,29 +552,31 @@ hotlist_handle_key (WDialog * h, int key)
/* --------------------------------------------------------------------------------------------- */
static cb_ret_t
hotlist_callback (WDialog * h, Widget * sender, dlg_msg_t msg, int parm, void *data)
hotlist_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data)
{
WDialog *h = DIALOG (w);
switch (msg)
{
case DLG_UNHANDLED_KEY:
case MSG_UNHANDLED_KEY:
return hotlist_handle_key (h, parm);
case DLG_POST_KEY:
case MSG_POST_KEY:
dlg_select_widget (h == hotlist_dlg ? l_hotlist : l_movelist);
/* always stay on hotlist */
/* fall through */
case DLG_INIT:
case MSG_INIT:
update_path_name ();
return MSG_HANDLED;
case DLG_RESIZE:
case MSG_RESIZE:
/* simply call dlg_set_size() with new size */
dlg_set_size (h, LINES - (h == hotlist_dlg ? 2 : 6), COLS - 6);
return MSG_HANDLED;
default:
return dlg_default_callback (h, sender, msg, parm, data);
return dlg_default_callback (w, sender, msg, parm, data);
}
}
@ -604,7 +606,7 @@ hotlist_listbox_callback (WListbox * list)
else
{
hotlist_button_callback (NULL, B_ENTER);
hotlist_callback (dlg, NULL, DLG_POST_KEY, '\n', NULL);
send_message (dlg, NULL, MSG_POST_KEY, '\n', NULL);
return LISTBOX_CONT;
}
}
@ -617,7 +619,7 @@ hotlist_listbox_callback (WListbox * list)
}
hotlist_button_callback (NULL, B_UP_GROUP);
hotlist_callback (dlg, NULL, DLG_POST_KEY, 'u', NULL);
send_message (dlg, NULL, MSG_POST_KEY, 'u', NULL);
return LISTBOX_CONT;
}

View File

@ -292,31 +292,28 @@ info_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *da
{
struct WInfo *info = (struct WInfo *) w;
(void) sender;
(void) data;
switch (msg)
{
case WIDGET_INIT:
case MSG_INIT:
init_my_statfs ();
add_hook (&select_file_hook, info_hook, info);
info->ready = 0;
return MSG_HANDLED;
case WIDGET_DRAW:
case MSG_DRAW:
info_hook (info);
return MSG_HANDLED;
case WIDGET_FOCUS:
case MSG_FOCUS:
return MSG_NOT_HANDLED;
case WIDGET_DESTROY:
case MSG_DESTROY:
delete_hook (&select_file_hook, info_hook);
free_my_statfs ();
return MSG_HANDLED;
default:
return widget_default_callback (sender, msg, parm, data);
return widget_default_callback (w, sender, msg, parm, data);
}
}

View File

@ -233,7 +233,7 @@ update_split (const WDialog * h)
check_options[0].widget->state = _panels_layout.horizontal_equal ? 1 : 0;
else
check_options[0].widget->state = _panels_layout.vertical_equal ? 1 : 0;
send_message (WIDGET (check_options[0].widget), NULL, WIDGET_DRAW, 0, NULL);
send_message (check_options[0].widget, NULL, MSG_DRAW, 0, NULL);
tty_setcolor (check_options[0].widget->state & C_BOOL ? DISABLED_COLOR : COLOR_NORMAL);
@ -308,11 +308,13 @@ bminus_cback (WButton * button, int action)
/* --------------------------------------------------------------------------------------------- */
static cb_ret_t
layout_callback (WDialog * h, Widget * sender, dlg_msg_t msg, int parm, void *data)
layout_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data)
{
WDialog * h = DIALOG (w);
switch (msg)
{
case DLG_DRAW:
case MSG_DRAW:
/* When repainting the whole dialog (e.g. with C-l) we have to
update everything */
dlg_default_repaint (h);
@ -336,7 +338,7 @@ layout_callback (WDialog * h, Widget * sender, dlg_msg_t msg, int parm, void *da
}
return MSG_HANDLED;
case DLG_POST_KEY:
case MSG_POST_KEY:
_menubar_visible = check_options[1].widget->state & C_BOOL;
_command_prompt = (check_options[2].widget->state & C_BOOL) != 0;
_keybar_visible = check_options[3].widget->state & C_BOOL;
@ -372,7 +374,7 @@ layout_callback (WDialog * h, Widget * sender, dlg_msg_t msg, int parm, void *da
}
return MSG_HANDLED;
case DLG_ACTION:
case MSG_ACTION:
if (sender == WIDGET (radio_widget))
{
if (_panels_layout.horizontal_split != radio_widget->sel)
@ -422,7 +424,7 @@ layout_callback (WDialog * h, Widget * sender, dlg_msg_t msg, int parm, void *da
return MSG_NOT_HANDLED;
default:
return dlg_default_callback (h, sender, msg, parm, data);
return dlg_default_callback (w, sender, msg, parm, data);
}
}

View File

@ -1094,10 +1094,10 @@ static void
update_dirty_panels (void)
{
if (get_current_type () == view_listing && current_panel->dirty)
send_message (WIDGET (current_panel), NULL, WIDGET_DRAW, 0, NULL);
send_message (current_panel, NULL, MSG_DRAW, 0, NULL);
if (get_other_type () == view_listing && other_panel->dirty)
send_message (WIDGET (other_panel), NULL, WIDGET_DRAW, 0, NULL);
send_message (other_panel, NULL, MSG_DRAW, 0, NULL);
}
/* --------------------------------------------------------------------------------------------- */
@ -1110,7 +1110,7 @@ midnight_execute_cmd (Widget * sender, unsigned long command)
(void) sender;
/* stop quick search before executing any command */
send_message (WIDGET (current_panel), NULL, WIDGET_COMMAND, CK_SearchStop, NULL);
send_message (current_panel, NULL, MSG_ACTION, CK_SearchStop, NULL);
switch (command)
{
@ -1238,7 +1238,7 @@ midnight_execute_cmd (Widget * sender, unsigned long command)
break;
case CK_History:
/* show the history of command line widget */
send_message (WIDGET (cmdline), NULL, WIDGET_COMMAND, CK_History, NULL);
send_message (cmdline, NULL, MSG_ACTION, CK_History, NULL);
break;
case CK_PanelInfo:
if (sender == WIDGET (the_menubar))
@ -1401,18 +1401,18 @@ midnight_execute_cmd (Widget * sender, unsigned long command)
/* --------------------------------------------------------------------------------------------- */
static cb_ret_t
midnight_callback (WDialog * h, Widget * sender, dlg_msg_t msg, int parm, void *data)
midnight_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data)
{
unsigned long command;
switch (msg)
{
case DLG_INIT:
case MSG_INIT:
panel_init ();
setup_panels ();
return MSG_HANDLED;
case DLG_DRAW:
case MSG_DRAW:
load_hint (1);
/* We handle the special case of the output lines */
if (mc_global.tty.console_flag != '\0' && output_lines)
@ -1421,14 +1421,14 @@ midnight_callback (WDialog * h, Widget * sender, dlg_msg_t msg, int parm, void *
1, LINES - mc_global.keybar_visible - 1);
return MSG_HANDLED;
case DLG_RESIZE:
case MSG_RESIZE:
setup_panels ();
menubar_arrange (the_menubar);
return MSG_HANDLED;
case DLG_IDLE:
case MSG_IDLE:
/* We only need the first idle event to show user menu after start */
widget_want_idle (WIDGET (h), FALSE);
widget_want_idle (w, FALSE);
if (boot_current_is_left)
dlg_select_widget (get_panel_widget (0));
@ -1439,7 +1439,7 @@ midnight_callback (WDialog * h, Widget * sender, dlg_msg_t msg, int parm, void *
midnight_execute_cmd (NULL, CK_UserMenu);
return MSG_HANDLED;
case DLG_KEY:
case MSG_KEY:
if (ctl_x_map_enabled)
{
ctl_x_map_enabled = FALSE;
@ -1465,7 +1465,7 @@ midnight_callback (WDialog * h, Widget * sender, dlg_msg_t msg, int parm, void *
if (cmdline->buffer[i] != '\0')
{
send_message (WIDGET (cmdline), NULL, WIDGET_KEY, parm, NULL);
send_message (cmdline, NULL, MSG_KEY, parm, NULL);
return MSG_HANDLED;
}
@ -1540,15 +1540,15 @@ midnight_callback (WDialog * h, Widget * sender, dlg_msg_t msg, int parm, void *
}
return MSG_NOT_HANDLED;
case DLG_HOTKEY_HANDLED:
case MSG_HOTKEY_HANDLED:
if ((get_current_type () == view_listing) && current_panel->searching)
{
current_panel->dirty = 1; /* FIXME: unneeded? */
send_message (WIDGET (current_panel), NULL, WIDGET_COMMAND, CK_SearchStop, NULL);
send_message (current_panel, NULL, MSG_ACTION, CK_SearchStop, NULL);
}
return MSG_HANDLED;
case DLG_UNHANDLED_KEY:
case MSG_UNHANDLED_KEY:
{
cb_ret_t v = MSG_NOT_HANDLED;
@ -1564,17 +1564,17 @@ midnight_callback (WDialog * h, Widget * sender, dlg_msg_t msg, int parm, void *
v = midnight_execute_cmd (NULL, command);
if (v == MSG_NOT_HANDLED && command_prompt)
v = send_message (WIDGET (cmdline), NULL, WIDGET_KEY, parm, NULL);
v = send_message (cmdline, NULL, MSG_KEY, parm, NULL);
return v;
}
case DLG_POST_KEY:
case MSG_POST_KEY:
if (!the_menubar->is_active)
update_dirty_panels ();
return MSG_HANDLED;
case DLG_ACTION:
case MSG_ACTION:
/* shortcut */
if (sender == NULL)
return midnight_execute_cmd (NULL, parm);
@ -1585,17 +1585,17 @@ midnight_callback (WDialog * h, Widget * sender, dlg_msg_t msg, int parm, void *
if (sender == WIDGET (the_bar))
{
if (data != NULL)
return send_message (WIDGET (data), NULL, WIDGET_COMMAND, parm, NULL);
return send_message (data, NULL, MSG_ACTION, parm, NULL);
return midnight_execute_cmd (sender, parm);
}
return MSG_NOT_HANDLED;
case DLG_END:
case MSG_END:
panel_deinit ();
return MSG_HANDLED;
default:
return dlg_default_callback (h, sender, msg, parm, data);
return dlg_default_callback (w, sender, msg, parm, data);
}
}

View File

@ -62,27 +62,27 @@ unsigned long configure_old_esc_mode_id, configure_time_out_id;
/* --------------------------------------------------------------------------------------------- */
static cb_ret_t
configure_callback (WDialog * h, Widget * sender, dlg_msg_t msg, int parm, void *data)
configure_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data)
{
switch (msg)
{
case DLG_ACTION:
case MSG_ACTION:
/* message from "Single press" checkbutton */
if (sender != NULL && sender->id == configure_old_esc_mode_id)
{
const gboolean not_single = !(((WCheck *) sender)->state & C_BOOL);
Widget *w;
Widget *ww;
/* input line */
w = dlg_find_by_id (h, configure_time_out_id);
widget_disable (w, not_single);
ww = dlg_find_by_id (DIALOG (w), configure_time_out_id);
widget_disable (ww, not_single);
return MSG_HANDLED;
}
return MSG_NOT_HANDLED;
default:
return dlg_default_callback (h, sender, msg, parm, data);
return dlg_default_callback (w, sender, msg, parm, data);
}
}

View File

@ -2498,7 +2498,7 @@ do_search (WPanel * panel, int c_code)
unselect_item (panel);
panel->selected = sel;
select_item (panel);
send_message (WIDGET (panel), NULL, WIDGET_DRAW, 0, NULL);
send_message (panel, NULL, MSG_DRAW, 0, NULL);
}
else if (c_code != KEY_BACKSPACE)
{
@ -3423,14 +3423,14 @@ panel_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *d
switch (msg)
{
case WIDGET_INIT:
case MSG_INIT:
/* subscribe to "history_load" event */
mc_event_add (w->owner->event_group, MCEVENT_HISTORY_LOAD, panel_load_history, w, NULL);
/* subscribe to "history_save" event */
mc_event_add (w->owner->event_group, MCEVENT_HISTORY_SAVE, panel_save_history, w, NULL);
return MSG_HANDLED;
case WIDGET_DRAW:
case MSG_DRAW:
/* Repaint everything, including frame and separator */
paint_frame (panel); /* including show_dir */
paint_dir (panel);
@ -3439,7 +3439,7 @@ panel_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *d
panel->dirty = 0;
return MSG_HANDLED;
case WIDGET_FOCUS:
case MSG_FOCUS:
state_mark = -1;
current_panel = panel;
panel->active = 1;
@ -3466,7 +3466,7 @@ panel_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *d
buttonbar_redraw (bb);
return MSG_HANDLED;
case WIDGET_UNFOCUS:
case MSG_UNFOCUS:
/* Janne: look at this for the multiple panel options */
stop_search (panel);
panel->active = 0;
@ -3474,13 +3474,13 @@ panel_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *d
unselect_item (panel);
return MSG_HANDLED;
case WIDGET_KEY:
case MSG_KEY:
return panel_key (panel, parm);
case WIDGET_COMMAND:
case MSG_ACTION:
return panel_execute_cmd (panel, parm);
case WIDGET_DESTROY:
case MSG_DESTROY:
/* unsubscribe from "history_load" event */
mc_event_del (w->owner->event_group, MCEVENT_HISTORY_LOAD, panel_load_history, w);
/* unsubscribe from "history_save" event */
@ -3490,7 +3490,7 @@ panel_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *d
return MSG_HANDLED;
default:
return widget_default_callback (sender, msg, parm, data);
return widget_default_callback (w, sender, msg, parm, data);
}
}
@ -3643,7 +3643,7 @@ panel_event (Gpm_Event * event, void *data)
/* "." button show/hide hidden files */
if (mouse_down && local.x == w->cols - 5)
{
midnight_dlg->callback (midnight_dlg, NULL, DLG_ACTION, CK_ShowHidden, NULL);
send_message (midnight_dlg, NULL, MSG_ACTION, CK_ShowHidden, NULL);
goto finish;
}
@ -3719,7 +3719,7 @@ panel_event (Gpm_Event * event, void *data)
finish:
if (panel->dirty)
send_message (w, NULL, WIDGET_DRAW, 0, NULL);
send_message (w, NULL, MSG_DRAW, 0, NULL);
return MOU_NORMAL;
}

View File

@ -109,19 +109,19 @@ update_command (void)
/* --------------------------------------------------------------------------------------------- */
static cb_ret_t
panelize_callback (WDialog * h, Widget * sender, dlg_msg_t msg, int parm, void *data)
panelize_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data)
{
switch (msg)
{
case DLG_INIT:
case DLG_POST_KEY:
case DLG_FOCUS:
case MSG_INIT:
case MSG_POST_KEY:
case MSG_FOCUS:
tty_setcolor (MENU_ENTRY_COLOR);
update_command ();
return MSG_HANDLED;
default:
return dlg_default_callback (h, sender, msg, parm, data);
return dlg_default_callback (w, sender, msg, parm, data);
}
}

View File

@ -1211,12 +1211,12 @@ tree_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *da
switch (msg)
{
case WIDGET_DRAW:
case MSG_DRAW:
tree_frame (h, tree);
show_tree (tree);
return MSG_HANDLED;
case WIDGET_FOCUS:
case MSG_FOCUS:
tree->active = 1;
buttonbar_set_label (b, 1, Q_ ("ButtonBar|Help"), tree_map, w);
buttonbar_set_label (b, 2, Q_ ("ButtonBar|Rescan"), tree_map, w);
@ -1242,25 +1242,25 @@ tree_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *da
/* FIXME: Should find a better way of changing the color of the
selected item */
case WIDGET_UNFOCUS:
case MSG_UNFOCUS:
tree->active = 0;
tree->searching = 0;
show_tree (tree);
return MSG_HANDLED;
case WIDGET_KEY:
case MSG_KEY:
return tree_key (tree, parm);
case WIDGET_COMMAND:
case MSG_ACTION:
/* command from buttonbar */
return tree_execute_cmd (tree, parm);
case WIDGET_DESTROY:
case MSG_DESTROY:
tree_destroy (tree);
return MSG_HANDLED;
default:
return widget_default_callback (sender, msg, parm, data);
return widget_default_callback (w, sender, msg, parm, data);
}
}

View File

@ -115,7 +115,7 @@ static struct
static GSList *link_area = NULL;
static gboolean inside_link_area = FALSE;
static cb_ret_t help_callback (WDialog * h, Widget * sender, dlg_msg_t msg, int parm, void *data);
static cb_ret_t help_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data);
/*** file scope functions ************************************************************************/
/* --------------------------------------------------------------------------------------------- */
@ -627,7 +627,7 @@ help_event (Gpm_Event * event, void *vp)
if (history_ptr < 0)
history_ptr = HISTORY_SIZE - 1;
help_callback (w->owner, NULL, DLG_DRAW, 0, NULL);
send_message (w->owner, NULL, MSG_DRAW, 0, NULL);
return MOU_NORMAL;
}
@ -675,7 +675,7 @@ help_event (Gpm_Event * event, void *vp)
move_forward (1);
/* Show the new node */
help_callback (w->owner, NULL, DLG_DRAW, 0, NULL);
send_message (w->owner, NULL, MSG_DRAW, 0, NULL);
return MOU_NORMAL;
}
@ -697,7 +697,7 @@ help_help (WDialog * h)
{
currentpoint = p + 1; /* Skip the newline following the start of the node */
selected_item = NULL;
help_callback (h, NULL, DLG_DRAW, 0, NULL);
send_message (h, NULL, MSG_DRAW, 0, NULL);
}
}
@ -720,7 +720,7 @@ help_index (WDialog * h)
currentpoint = new_item + 1; /* Skip the newline following the start of the node */
selected_item = NULL;
help_callback (h, NULL, DLG_DRAW, 0, NULL);
send_message (h, NULL, MSG_DRAW, 0, NULL);
}
}
@ -735,7 +735,7 @@ help_back (WDialog * h)
if (history_ptr < 0)
history_ptr = HISTORY_SIZE - 1;
help_callback (h, NULL, DLG_DRAW, 0, NULL); /* FIXME: unneeded? */
send_message (h, NULL, MSG_DRAW, 0, NULL); /* FIXME: unneeded? */
}
/* --------------------------------------------------------------------------------------------- */
@ -934,35 +934,39 @@ help_handle_key (WDialog * h, int c)
if ((command == CK_IgnoreKey) || (help_execute_cmd (command) == MSG_NOT_HANDLED))
return MSG_NOT_HANDLED;
help_callback (h, NULL, DLG_DRAW, 0, NULL);
send_message (h, NULL, MSG_DRAW, 0, NULL);
return MSG_HANDLED;
}
/* --------------------------------------------------------------------------------------------- */
static cb_ret_t
help_callback (WDialog * h, Widget * sender, dlg_msg_t msg, int parm, void *data)
help_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data)
{
WButtonBar *bb;
WDialog *h = DIALOG (w);
switch (msg)
{
case DLG_RESIZE:
help_lines = min (LINES - 4, max (2 * LINES / 3, 18));
dlg_set_size (h, help_lines + 4, HELP_WINDOW_WIDTH + 4);
bb = find_buttonbar (h);
widget_set_size (WIDGET (bb), LINES - 1, 0, 1, COLS);
return MSG_HANDLED;
case MSG_RESIZE:
{
WButtonBar *bb;
case DLG_DRAW:
help_lines = min (LINES - 4, max (2 * LINES / 3, 18));
dlg_set_size (h, help_lines + 4, HELP_WINDOW_WIDTH + 4);
bb = find_buttonbar (h);
widget_set_size (WIDGET (bb), LINES - 1, 0, 1, COLS);
return MSG_HANDLED;
}
case MSG_DRAW:
dlg_default_repaint (h);
help_show (h, currentpoint);
return MSG_HANDLED;
case DLG_KEY:
case MSG_KEY:
return help_handle_key (h, parm);
case DLG_ACTION:
case MSG_ACTION:
/* shortcut */
if (sender == NULL)
return help_execute_cmd (parm);
@ -970,13 +974,13 @@ help_callback (WDialog * h, Widget * sender, dlg_msg_t msg, int parm, void *data
if (sender == WIDGET (find_buttonbar (h)))
{
if (data != NULL)
return send_message (WIDGET (data), NULL, WIDGET_COMMAND, parm, NULL);
return send_message (data, NULL, MSG_ACTION, parm, NULL);
return help_execute_cmd (parm);
}
return MSG_NOT_HANDLED;
default:
return dlg_default_callback (h, sender, msg, parm, data);
return dlg_default_callback (w, sender, msg, parm, data);
}
}
@ -1026,12 +1030,12 @@ md_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data
{
switch (msg)
{
case WIDGET_RESIZED:
case MSG_RESIZE:
w->lines = help_lines;
return MSG_HANDLED;
default:
return widget_default_callback (sender, msg, parm, data);
return widget_default_callback (w, sender, msg, parm, data);
}
}
@ -1040,7 +1044,9 @@ md_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data
static Widget *
mousedispatch_new (int y, int x, int yl, int xl)
{
Widget *w = g_new (Widget, 1);
Widget *w;
w = g_new (Widget, 1);
init_widget (w, y, x, yl, xl, md_callback, help_event);
return w;
}

View File

@ -232,15 +232,15 @@ learn_check_key (int c)
/* --------------------------------------------------------------------------------------------- */
static cb_ret_t
learn_callback (WDialog * h, Widget * sender, dlg_msg_t msg, int parm, void *data)
learn_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data)
{
switch (msg)
{
case DLG_KEY:
case MSG_KEY:
return learn_check_key (parm) ? MSG_HANDLED : MSG_NOT_HANDLED;
default:
return dlg_default_callback (h, sender, msg, parm, data);
return dlg_default_callback (w, sender, msg, parm, data);
}
}

View File

@ -583,38 +583,38 @@ mcview_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *
switch (msg)
{
case WIDGET_INIT:
case MSG_INIT:
if (mcview_is_in_panel (view))
add_hook (&select_file_hook, mcview_hook, view);
else
view->dpy_bbar_dirty = TRUE;
return MSG_HANDLED;
case WIDGET_DRAW:
case MSG_DRAW:
mcview_display (view);
return MSG_HANDLED;
case WIDGET_CURSOR:
case MSG_CURSOR:
if (view->hex_mode)
mcview_place_cursor (view);
return MSG_HANDLED;
case WIDGET_KEY:
case MSG_KEY:
i = mcview_handle_key (view, parm);
mcview_update (view);
return i;
case WIDGET_COMMAND:
case MSG_ACTION:
i = mcview_execute_cmd (view, parm);
mcview_update (view);
return i;
case WIDGET_FOCUS:
case MSG_FOCUS:
view->dpy_bbar_dirty = TRUE;
mcview_update (view);
return MSG_HANDLED;
case WIDGET_DESTROY:
case MSG_DESTROY:
if (mcview_is_in_panel (view))
{
delete_hook (&select_file_hook, mcview_hook);
@ -626,24 +626,25 @@ mcview_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *
return MSG_HANDLED;
default:
return widget_default_callback (sender, msg, parm, data);
return widget_default_callback (w, sender, msg, parm, data);
}
}
/* --------------------------------------------------------------------------------------------- */
cb_ret_t
mcview_dialog_callback (WDialog * h, Widget * sender, dlg_msg_t msg, int parm, void *data)
mcview_dialog_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data)
{
WDialog *h = DIALOG (w);
mcview_t *view;
switch (msg)
{
case DLG_RESIZE:
case MSG_RESIZE:
mcview_adjust_size (h);
return MSG_HANDLED;
case DLG_ACTION:
case MSG_ACTION:
/* shortcut */
if (sender == NULL)
return mcview_execute_cmd (NULL, parm);
@ -651,14 +652,14 @@ mcview_dialog_callback (WDialog * h, Widget * sender, dlg_msg_t msg, int parm, v
if (sender == WIDGET (find_buttonbar (h)))
{
if (data != NULL)
return send_message (WIDGET (data), NULL, WIDGET_COMMAND, parm, NULL);
return send_message (data, NULL, MSG_ACTION, parm, NULL);
view = (mcview_t *) find_widget_type (h, mcview_callback);
return mcview_execute_cmd (view, parm);
}
return MSG_NOT_HANDLED;
case DLG_VALIDATE:
case MSG_VALIDATE:
view = (mcview_t *) find_widget_type (h, mcview_callback);
h->state = DLG_ACTIVE; /* don't stop the dialog before final decision */
if (mcview_ok_to_quit (view))
@ -668,7 +669,7 @@ mcview_dialog_callback (WDialog * h, Widget * sender, dlg_msg_t msg, int parm, v
return MSG_HANDLED;
default:
return dlg_default_callback (h, sender, msg, parm, data);
return dlg_default_callback (w, sender, msg, parm, data);
}
}

View File

@ -215,7 +215,8 @@ extern mcview_search_options_t mcview_search_options;
/* actions_cmd.c: */
cb_ret_t mcview_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data);
cb_ret_t mcview_dialog_callback (WDialog * h, Widget * sender, dlg_msg_t msg, int parm, void *data);
cb_ret_t mcview_dialog_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm,
void *data);
/* coord_cache.c: */
coord_cache_t *coord_cache_new (void);