1
1

* dlg.h: Use new types for dialog callbacks.

(dlg_cb_fn): Swap msg and parm arguments for consistency with
widget callbacks.  Adjust all dependencies.
Этот коммит содержится в:
Pavel Roskin 2003-09-07 21:24:01 +00:00
родитель 1ec8dad250
Коммит 13a02ef978
21 изменённых файлов: 363 добавлений и 326 удалений

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

@ -526,16 +526,17 @@ edit_save_as_cmd (WEdit *edit)
/* {{{ Macro stuff starts here */ /* {{{ Macro stuff starts here */
static int static cb_ret_t
raw_callback (struct Dlg_head *h, int key, int Msg) raw_callback (struct Dlg_head *h, dlg_msg_t msg, int parm)
{ {
switch (Msg) { switch (msg) {
case DLG_KEY: case DLG_KEY:
h->running = 0; h->running = 0;
h->ret_value = key; h->ret_value = parm;
return MSG_HANDLED; return MSG_HANDLED;
default:
return default_dlg_callback (h, msg, parm);
} }
return default_dlg_callback (h, key, Msg);;
} }
/* gets a raw key from the keyboard. Passing cancel = 1 draws /* gets a raw key from the keyboard. Passing cancel = 1 draws

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

@ -140,8 +140,8 @@ edit_adjust_size (Dlg_head *h)
} }
/* Callback for the edit dialog */ /* Callback for the edit dialog */
static int static cb_ret_t
edit_dialog_callback (Dlg_head *h, int id, int msg) edit_dialog_callback (Dlg_head *h, dlg_msg_t msg, int parm)
{ {
WEdit *edit; WEdit *edit;
@ -149,13 +149,17 @@ edit_dialog_callback (Dlg_head *h, int id, int msg)
case DLG_RESIZE: case DLG_RESIZE:
edit_adjust_size (h); edit_adjust_size (h);
return MSG_HANDLED; return MSG_HANDLED;
case DLG_VALIDATE: case DLG_VALIDATE:
edit = (WEdit *) find_widget_type (h, edit_callback); edit = (WEdit *) find_widget_type (h, edit_callback);
if (!edit_ok_to_exit (edit)) { if (!edit_ok_to_exit (edit)) {
h->running = 1; h->running = 1;
} }
return MSG_HANDLED;
default:
return default_dlg_callback (h, msg, parm);
} }
return default_dlg_callback (h, id, msg);
} }
int int

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

@ -1,5 +1,9 @@
2003-09-07 Pavel Roskin <proski@gnu.org> 2003-09-07 Pavel Roskin <proski@gnu.org>
* dlg.h: Use new types for dialog callbacks.
(dlg_cb_fn): Swap msg and parm arguments for consistency with
widget callbacks. Adjust all dependencies.
* dlg.h: Remove WIDGET_USER. Define new types dlg_msg_t, * dlg.h: Remove WIDGET_USER. Define new types dlg_msg_t,
widget_msg_t and cb_ret_t. widget_msg_t and cb_ret_t.

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

@ -110,24 +110,24 @@ static int inc_flag_pos (int f_pos)
{ {
if (flag_pos == 10) { if (flag_pos == 10) {
flag_pos = 0; flag_pos = 0;
return 0; return MSG_NOT_HANDLED;
} }
flag_pos++; flag_pos++;
if (!(flag_pos % 3) || f_pos > 2) if (!(flag_pos % 3) || f_pos > 2)
return 0; return MSG_NOT_HANDLED;
return 1; return MSG_HANDLED;
} }
static int dec_flag_pos (int f_pos) static cb_ret_t dec_flag_pos (int f_pos)
{ {
if (!flag_pos) { if (!flag_pos) {
flag_pos = 10; flag_pos = 10;
return 0; return MSG_NOT_HANDLED;
} }
flag_pos--; flag_pos--;
if (!((flag_pos + 1) % 3) || f_pos > 2) if (!((flag_pos + 1) % 3) || f_pos > 2)
return 0; return MSG_NOT_HANDLED;
return 1; return MSG_HANDLED;
} }
static void set_perm_by_flags (char *s, int f_p) static void set_perm_by_flags (char *s, int f_p)
@ -217,22 +217,21 @@ static void update_mode (Dlg_head * h)
send_message (h->current->widget, WIDGET_FOCUS, 0); send_message (h->current->widget, WIDGET_FOCUS, 0);
} }
static int chl_callback (Dlg_head * h, int Par, int Msg) static cb_ret_t
chl_callback (Dlg_head *h, dlg_msg_t msg, int parm)
{ {
switch (Msg) { switch (msg) {
case DLG_DRAW:
common_dialog_repaint (h);
break;
case DLG_KEY: case DLG_KEY:
switch (Par) { switch (parm) {
case KEY_LEFT: case KEY_LEFT:
case KEY_RIGHT: case KEY_RIGHT:
h->ret_value = Par; h->ret_value = parm;
dlg_stop (h); dlg_stop (h);
} }
default:
return default_dlg_callback (h, msg, parm);
} }
return 0;
} }
static void static void
@ -388,20 +387,21 @@ static void b_setpos (int f_pos) {
b_att[f_pos]->hotpos = (flag_pos % 3); b_att[f_pos]->hotpos = (flag_pos % 3);
} }
static int advanced_chown_callback (Dlg_head * h, int Par, int Msg) static cb_ret_t
advanced_chown_callback (Dlg_head *h, dlg_msg_t msg, int parm)
{ {
int i = 0, f_pos = BUTTONS - h->current->dlg_id - single_set - 1; int i = 0, f_pos = BUTTONS - h->current->dlg_id - single_set - 1;
switch (Msg) { switch (msg) {
case DLG_DRAW: case DLG_DRAW:
chown_refresh (); chown_refresh ();
chown_info_update (); chown_info_update ();
return 1; return MSG_HANDLED;
case DLG_POST_KEY: case DLG_POST_KEY:
if (f_pos < 3) if (f_pos < 3)
b_setpos (f_pos); b_setpos (f_pos);
break; return MSG_HANDLED;
case DLG_FOCUS: case DLG_FOCUS:
if (f_pos < 3) { if (f_pos < 3) {
@ -410,18 +410,18 @@ static int advanced_chown_callback (Dlg_head * h, int Par, int Msg)
b_setpos (f_pos); b_setpos (f_pos);
} else if (f_pos < 5) } else if (f_pos < 5)
flag_pos = f_pos + 6; flag_pos = f_pos + 6;
break; return MSG_HANDLED;
case DLG_KEY: case DLG_KEY:
switch (Par) { switch (parm) {
case XCTRL('b'): case XCTRL ('b'):
case KEY_LEFT: case KEY_LEFT:
if (f_pos < 5) if (f_pos < 5)
return (dec_flag_pos (f_pos)); return (dec_flag_pos (f_pos));
break; break;
case XCTRL('f'): case XCTRL ('f'):
case KEY_RIGHT: case KEY_RIGHT:
if (f_pos < 5) if (f_pos < 5)
return (inc_flag_pos (f_pos)); return (inc_flag_pos (f_pos));
@ -429,7 +429,7 @@ static int advanced_chown_callback (Dlg_head * h, int Par, int Msg)
case ' ': case ' ':
if (f_pos < 3) if (f_pos < 3)
return 1; return MSG_HANDLED;
break; break;
case '\n': case '\n':
@ -437,7 +437,7 @@ static int advanced_chown_callback (Dlg_head * h, int Par, int Msg)
if (f_pos <= 2 || f_pos >= 5) if (f_pos <= 2 || f_pos >= 5)
break; break;
do_enter_key (h, f_pos); do_enter_key (h, f_pos);
return 1; return MSG_HANDLED;
case ALT ('x'): case ALT ('x'):
i++; i++;
@ -446,10 +446,11 @@ static int advanced_chown_callback (Dlg_head * h, int Par, int Msg)
i++; i++;
case ALT ('r'): case ALT ('r'):
Par = i + 3; parm = i + 3;
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
ch_flags[i * 3 + Par - 3] = (x_toggle & (1 << Par)) ? '-' : '+'; ch_flags[i * 3 + parm - 3] =
x_toggle ^= (1 << Par); (x_toggle & (1 << parm)) ? '-' : '+';
x_toggle ^= (1 << parm);
update_mode (h); update_mode (h);
dlg_broadcast_msg (h, WIDGET_DRAW, 0); dlg_broadcast_msg (h, WIDGET_DRAW, 0);
send_message (h->current->widget, WIDGET_FOCUS, 0); send_message (h->current->widget, WIDGET_FOCUS, 0);
@ -462,10 +463,11 @@ static int advanced_chown_callback (Dlg_head * h, int Par, int Msg)
i++; i++;
case XCTRL ('r'): case XCTRL ('r'):
Par = i; parm = i;
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
ch_flags[i * 3 + Par] = (x_toggle & (1 << Par)) ? '-' : '+'; ch_flags[i * 3 + parm] =
x_toggle ^= (1 << Par); (x_toggle & (1 << parm)) ? '-' : '+';
x_toggle ^= (1 << parm);
update_mode (h); update_mode (h);
dlg_broadcast_msg (h, WIDGET_DRAW, 0); dlg_broadcast_msg (h, WIDGET_DRAW, 0);
send_message (h->current->widget, WIDGET_FOCUS, 0); send_message (h->current->widget, WIDGET_FOCUS, 0);
@ -480,8 +482,9 @@ static int advanced_chown_callback (Dlg_head * h, int Par, int Msg)
case 'r': case 'r':
if (f_pos > 2) if (f_pos > 2)
break; break;
flag_pos = f_pos * 3 + i; /* (strchr(ch_perm,Par)-ch_perm); */ flag_pos = f_pos * 3 + i; /* (strchr(ch_perm,parm)-ch_perm); */
if (((WButton *) h->current->widget)->text[(flag_pos % 3)] == '-') if (((WButton *) h->current->widget)->text[(flag_pos % 3)] ==
'-')
ch_flags[flag_pos] = '+'; ch_flags[flag_pos] = '+';
else else
ch_flags[flag_pos] = '-'; ch_flags[flag_pos] = '-';
@ -507,23 +510,26 @@ static int advanced_chown_callback (Dlg_head * h, int Par, int Msg)
break; break;
case '*': case '*':
if (Par == '*') if (parm == '*')
Par = '='; parm = '=';
case '=': case '=':
case '+': case '+':
if (f_pos > 4) if (f_pos > 4)
break; break;
ch_flags[flag_pos] = Par; ch_flags[flag_pos] = parm;
update_mode (h); update_mode (h);
advanced_chown_callback (h, KEY_RIGHT, DLG_KEY); advanced_chown_callback (h, KEY_RIGHT, DLG_KEY);
if (flag_pos>8 || !(flag_pos%3)) dlg_one_down (h); if (flag_pos > 8 || !(flag_pos % 3))
dlg_one_down (h);
break; break;
} }
return 0; return MSG_NOT_HANDLED;
default:
return default_dlg_callback (h, msg, parm);
} }
return 0;
} }
static void static void

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

@ -81,51 +81,51 @@ static char *displays [LIST_TYPES] = {
static int user_hotkey = 'u'; static int user_hotkey = 'u';
static int static cb_ret_t
display_callback (struct Dlg_head *h, int id, int Msg) display_callback (struct Dlg_head *h, dlg_msg_t msg, int parm)
{ {
switch (Msg){ switch (msg) {
case DLG_DRAW:
common_dialog_repaint (h);
break;
case DLG_UNFOCUS: case DLG_UNFOCUS:
if((WRadio *) h->current->widget == my_radio){ if ((WRadio *) h->current->widget == my_radio) {
assign_text (status, displays_status [my_radio->sel]); assign_text (status, displays_status[my_radio->sel]);
input_set_point (status, 0); input_set_point (status, 0);
} }
break; return MSG_HANDLED;
case DLG_KEY: case DLG_KEY:
if (id == '\n'){ if (parm == '\n') {
if((WRadio *) h->current->widget == my_radio){ if ((WRadio *) h->current->widget == my_radio) {
assign_text (status, displays_status [my_radio->sel]); assign_text (status, displays_status[my_radio->sel]);
dlg_stop (h); dlg_stop (h);
break; return MSG_HANDLED;
} }
if ((WInput *) h->current->widget == user){ if ((WInput *) h->current->widget == user) {
h->ret_value = B_USER + 6; h->ret_value = B_USER + 6;
dlg_stop (h); dlg_stop (h);
break; return MSG_HANDLED;
} }
if ((WInput *) h->current->widget == status){ if ((WInput *) h->current->widget == status) {
h->ret_value = B_USER + 7; h->ret_value = B_USER + 7;
dlg_stop (h); dlg_stop (h);
break; return MSG_HANDLED;
} }
} }
if (tolower(id) == user_hotkey && h->current->widget != (Widget *) user if (tolower (parm) == user_hotkey
&& h->current->widget != (Widget *) status){ && h->current->widget != (Widget *) user
&& h->current->widget != (Widget *) status) {
my_radio->sel = 3; my_radio->sel = 3;
dlg_select_widget (h, my_radio); /* force redraw */ dlg_select_widget (h, my_radio); /* force redraw */
dlg_select_widget (h, user); dlg_select_widget (h, user);
return MSG_HANDLED; return MSG_HANDLED;
} }
return MSG_NOT_HANDLED;
default:
return default_dlg_callback (h, msg, parm);
} }
return MSG_NOT_HANDLED;
} }
static void static void
@ -637,24 +637,22 @@ display_bits_box (void)
#define TREE_Y 20 #define TREE_Y 20
#define TREE_X 60 #define TREE_X 60
static int static cb_ret_t
tree_callback (struct Dlg_head *h, int id, int msg) tree_callback (struct Dlg_head *h, dlg_msg_t msg, int parm)
{ {
switch (msg){ switch (msg) {
case DLG_POST_KEY: case DLG_POST_KEY:
/* The enter key will be processed by the tree widget */ /* The enter key will be processed by the tree widget */
if (id == '\n') { if (parm == '\n') {
h->ret_value = B_ENTER; h->ret_value = B_ENTER;
dlg_stop (h); dlg_stop (h);
} }
return MSG_HANDLED; return MSG_HANDLED;
case DLG_DRAW: default:
common_dialog_repaint (h); return default_dlg_callback (h, msg, parm);
break;
} }
return MSG_NOT_HANDLED;
} }
/* Show tree in a box, not on a panel */ /* Show tree in a box, not on a panel */

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

@ -149,36 +149,39 @@ static void chmod_refresh (Dlg_head *h)
addstr (_(" File ")); addstr (_(" File "));
} }
static int chmod_callback (Dlg_head *h, int Par, int Msg) static cb_ret_t
chmod_callback (Dlg_head *h, dlg_msg_t msg, int parm)
{ {
char buffer [BUF_TINY]; char buffer[BUF_TINY];
switch (Msg) { switch (msg) {
case DLG_ACTION: case DLG_ACTION:
if (Par >= BUTTONS - single_set * 2){ if (parm >= BUTTONS - single_set * 2) {
c_stat ^= check_perm[Par - BUTTONS + single_set * 2].mode; c_stat ^= check_perm[parm - BUTTONS + single_set * 2].mode;
g_snprintf (buffer, sizeof (buffer), "%o", c_stat); g_snprintf (buffer, sizeof (buffer), "%o", c_stat);
label_set_text (statl, buffer); label_set_text (statl, buffer);
chmod_toggle_select (h); chmod_toggle_select (h);
mode_change = 1; mode_change = 1;
} }
break; return MSG_HANDLED;
case DLG_KEY: case DLG_KEY:
if ((Par == 'T' || Par == 't' || Par == KEY_IC) && if ((parm == 'T' || parm == 't' || parm == KEY_IC)
h->current->dlg_id >= BUTTONS - single_set * 2) { && h->current->dlg_id >= BUTTONS - single_set * 2) {
chmod_toggle_select (h); chmod_toggle_select (h);
if (Par == KEY_IC) if (parm == KEY_IC)
dlg_one_down (h); dlg_one_down (h);
return 1; return MSG_HANDLED;
} }
break; return MSG_NOT_HANDLED;
case DLG_DRAW: case DLG_DRAW:
chmod_refresh (h); chmod_refresh (h);
break; return MSG_HANDLED;
default:
return default_dlg_callback (h, msg, parm);
} }
return 0;
} }
static Dlg_head * static Dlg_head *

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

@ -130,15 +130,17 @@ next_file (void)
return cpanel->dir.list[current_file].fname; return cpanel->dir.list[current_file].fname;
} }
static int static cb_ret_t
chown_callback (Dlg_head * h, int Par, int Msg) chown_callback (Dlg_head *h, dlg_msg_t msg, int parm)
{ {
switch (Msg) { switch (msg) {
case DLG_DRAW: case DLG_DRAW:
chown_refresh (h); chown_refresh (h);
break; return MSG_HANDLED;
default:
return default_dlg_callback (h, msg, parm);
} }
return 0;
} }
static Dlg_head * static Dlg_head *

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

@ -807,16 +807,12 @@ static int insert_text (WInput *in, char *text, int len)
return len != 0; return len != 0;
} }
static int static cb_ret_t
query_callback (Dlg_head * h, int Par, int Msg) query_callback (Dlg_head *h, dlg_msg_t msg, int parm)
{ {
switch (Msg) { switch (msg) {
case DLG_DRAW:
common_dialog_repaint (h);
break;
case DLG_KEY: case DLG_KEY:
switch (Par) { switch (parm) {
case KEY_LEFT: case KEY_LEFT:
case KEY_RIGHT: case KEY_RIGHT:
h->ret_value = 0; h->ret_value = 0;
@ -838,7 +834,7 @@ query_callback (Dlg_head * h, int Par, int Msg)
end - start - 1)) { end - start - 1)) {
listbox_select_entry ((WListbox *) (h->current-> listbox_select_entry ((WListbox *) (h->current->
widget), e1); widget), e1);
handle_char (input, Par); handle_char (input, parm);
end--; end--;
send_message (h->current->widget, WIDGET_DRAW, 0); send_message (h->current->widget, WIDGET_DRAW, 0);
break; break;
@ -849,8 +845,8 @@ query_callback (Dlg_head * h, int Par, int Msg)
return 1; return 1;
default: default:
if (Par > 0xff || !is_printable (Par)) { if (parm > 0xff || !is_printable (parm)) {
if (is_in_input_map (input, Par) == 2) { if (is_in_input_map (input, parm) == 2) {
if (end == min_end) if (end == min_end)
return 1; return 1;
h->ret_value = B_USER; /* This means we want to refill the h->ret_value = B_USER; /* This means we want to refill the
@ -869,13 +865,13 @@ query_callback (Dlg_head * h, int Par, int Msg)
do { do {
if (!strncmp if (!strncmp
(input->buffer + start, e1->text, end - start)) { (input->buffer + start, e1->text, end - start)) {
if (e1->text[end - start] == Par) { if (e1->text[end - start] == parm) {
if (need_redraw) { if (need_redraw) {
register int c1, c2, si; register int c1, c2, si;
for (si = end - start + 1; for (si = end - start + 1;
(c1 = last_text[si]) && (c1 = last_text[si])
(c2 = e1->text[si]); si++) && (c2 = e1->text[si]); si++)
if (c1 != c2) if (c1 != c2)
break; break;
if (low > si) if (low > si)
@ -902,11 +898,13 @@ query_callback (Dlg_head * h, int Par, int Msg)
dlg_stop (h); dlg_stop (h);
} }
} }
return 1; return MSG_HANDLED;
} }
break; break;
default:
return default_dlg_callback (h, msg, parm);
} }
return 0;
} }
#define DO_INSERTION 1 #define DO_INSERTION 1

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

@ -191,7 +191,7 @@ common_dialog_repaint (struct Dlg_head *h)
} }
/* Default dialog callback */ /* Default dialog callback */
int default_dlg_callback (Dlg_head *h, int id, int msg) cb_ret_t default_dlg_callback (Dlg_head *h, dlg_msg_t msg, int parm)
{ {
if (msg == DLG_DRAW && h->color) { if (msg == DLG_DRAW && h->color) {
common_dialog_repaint (h); common_dialog_repaint (h);
@ -348,7 +348,7 @@ int dlg_focus (Dlg_head *h)
return 0; return 0;
if (send_message (h->current->widget, WIDGET_FOCUS, 0)){ if (send_message (h->current->widget, WIDGET_FOCUS, 0)){
(*h->callback) (h, h->current->dlg_id, DLG_FOCUS); (*h->callback) (h, DLG_FOCUS, h->current->dlg_id);
return 1; return 1;
} }
return 0; return 0;
@ -361,7 +361,7 @@ dlg_unfocus (Dlg_head *h)
return 0; return 0;
if (send_message (h->current->widget, WIDGET_UNFOCUS, 0)){ if (send_message (h->current->widget, WIDGET_UNFOCUS, 0)){
(*h->callback) (h, h->current->dlg_id, DLG_UNFOCUS); (*h->callback) (h, DLG_UNFOCUS, h->current->dlg_id);
return 1; return 1;
} }
return 0; return 0;
@ -500,7 +500,7 @@ void update_cursor (Dlg_head *h)
*/ */
void dlg_redraw (Dlg_head *h) void dlg_redraw (Dlg_head *h)
{ {
(h->callback)(h, 0, DLG_DRAW); (h->callback)(h, DLG_DRAW, 0);
dlg_broadcast_msg (h, WIDGET_DRAW, 1); dlg_broadcast_msg (h, WIDGET_DRAW, 1);
@ -645,14 +645,14 @@ dlg_key_event (Dlg_head *h, int d_key)
} else { } else {
/* first can dlg_callback handle the key */ /* first can dlg_callback handle the key */
handled = (*h->callback) (h, d_key, DLG_KEY); handled = (*h->callback) (h, DLG_KEY, d_key);
/* next try the hotkey */ /* next try the hotkey */
if (!handled) if (!handled)
handled = dlg_try_hotkey (h, d_key); handled = dlg_try_hotkey (h, d_key);
if (handled) if (handled)
(*h->callback) (h, 0, DLG_HOTKEY_HANDLED); (*h->callback) (h, DLG_HOTKEY_HANDLED, 0);
/* not used - then try widget_callback */ /* not used - then try widget_callback */
if (!handled) if (!handled)
@ -660,11 +660,11 @@ dlg_key_event (Dlg_head *h, int d_key)
/* not used- try to use the unhandled case */ /* not used- try to use the unhandled case */
if (!handled) if (!handled)
handled = (*h->callback) (h, d_key, DLG_UNHANDLED_KEY); handled = (*h->callback) (h, DLG_UNHANDLED_KEY, d_key);
if (!handled) if (!handled)
dialog_handle_key (h, d_key); dialog_handle_key (h, d_key);
(*h->callback) (h, d_key, DLG_POST_KEY); (*h->callback) (h, DLG_POST_KEY, d_key);
return handled; return handled;
} }
@ -716,7 +716,7 @@ void init_dlg (Dlg_head *h)
int refresh_mode; int refresh_mode;
/* Initialize dialog manager and widgets */ /* Initialize dialog manager and widgets */
(*h->callback) (h, 0, DLG_INIT); (*h->callback) (h, DLG_INIT, 0);
dlg_broadcast_msg (h, WIDGET_INIT, 0); dlg_broadcast_msg (h, WIDGET_INIT, 0);
if (h->x == 0 && h->y == 0 && h->cols == COLS && h->lines == LINES) if (h->x == 0 && h->y == 0 && h->cols == COLS && h->lines == LINES)
@ -755,7 +755,7 @@ void init_dlg (Dlg_head *h)
void dlg_run_done (Dlg_head *h) void dlg_run_done (Dlg_head *h)
{ {
if (h->current) if (h->current)
(*h->callback) (h, h->current->dlg_id, DLG_END); (*h->callback) (h, DLG_END, h->current->dlg_id);
current_dlg = (Dlg_head *) h->previous_dialog; current_dlg = (Dlg_head *) h->previous_dialog;
} }
@ -791,7 +791,7 @@ frontend_run_dlg (Dlg_head *h)
execute_hooks (idle_hook); execute_hooks (idle_hook);
while ((h->flags & DLG_WANT_IDLE) && is_idle ()) while ((h->flags & DLG_WANT_IDLE) && is_idle ())
(*h->callback) (h, 0, DLG_IDLE); (*h->callback) (h, DLG_IDLE, 0);
/* Allow terminating the dialog from the idle handler */ /* Allow terminating the dialog from the idle handler */
if (!h->running) if (!h->running)
@ -807,7 +807,7 @@ frontend_run_dlg (Dlg_head *h)
dlg_process_event (h, d_key, &event); dlg_process_event (h, d_key, &event);
if (!h->running) if (!h->running)
(*h->callback) (h, 0, DLG_VALIDATE); (*h->callback) (h, DLG_VALIDATE, 0);
} }
} }

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

@ -61,7 +61,7 @@ typedef enum {
/* Dialog callback */ /* Dialog callback */
struct Dlg_head; struct Dlg_head;
typedef int (*dlg_cb_fn)(struct Dlg_head *h, int Par, int Msg); typedef cb_ret_t (*dlg_cb_fn)(struct Dlg_head *h, dlg_msg_t msg, int parm);
typedef struct Dlg_head { typedef struct Dlg_head {
@ -170,7 +170,7 @@ void init_widget (Widget *w, int y, int x, int lines, int cols,
mouse_h mouse_handler); mouse_h mouse_handler);
/* Default callback for dialogs */ /* Default callback for dialogs */
int default_dlg_callback (Dlg_head *h, int id, int msg); cb_ret_t default_dlg_callback (Dlg_head *h, dlg_msg_t msg, int parm);
/* Default callback for widgets */ /* Default callback for widgets */
int default_proc (int Msg, int Par); int default_proc (int Msg, int Par);

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

@ -123,12 +123,12 @@ static int case_sensitive = 1;
* Callback for the parameter dialog. * Callback for the parameter dialog.
* Validate regex, prevent closing the dialog if it's invalid. * Validate regex, prevent closing the dialog if it's invalid.
*/ */
static int static cb_ret_t
find_parm_callback (struct Dlg_head *h, int id, int Msg) find_parm_callback (struct Dlg_head *h, dlg_msg_t msg, int parm)
{ {
int flags; int flags;
switch (Msg) { switch (msg) {
case DLG_VALIDATE: case DLG_VALIDATE:
if ((h->ret_value != B_ENTER) || !in_with->buffer[0]) if ((h->ret_value != B_ENTER) || !in_with->buffer[0])
return MSG_HANDLED; return MSG_HANDLED;
@ -144,8 +144,10 @@ find_parm_callback (struct Dlg_head *h, int id, int Msg)
h->running = 1; /* Don't stop the dialog */ h->running = 1; /* Don't stop the dialog */
} }
return MSG_HANDLED; return MSG_HANDLED;
default:
return default_dlg_callback (h, msg, parm);
} }
return default_dlg_callback (h, id, Msg);
} }
/* /*
@ -696,29 +698,27 @@ view_edit_currently_selected_file (int unparsed_view, int edit)
return MSG_HANDLED; return MSG_HANDLED;
} }
static int static cb_ret_t
find_callback (struct Dlg_head *h, int id, int Msg) find_callback (struct Dlg_head *h, dlg_msg_t msg, int parm)
{ {
switch (Msg){ switch (msg) {
case DLG_DRAW:
common_dialog_repaint (h);
break;
case DLG_KEY: case DLG_KEY:
if (id == KEY_F(3) || id == KEY_F(13)){ if (parm == KEY_F (3) || parm == KEY_F (13)) {
int unparsed_view = (id == KEY_F(13)); int unparsed_view = (parm == KEY_F (13));
return view_edit_currently_selected_file (unparsed_view, 0); return view_edit_currently_selected_file (unparsed_view, 0);
} }
if (id == KEY_F(4)){ if (parm == KEY_F (4)) {
return view_edit_currently_selected_file (0, 1); return view_edit_currently_selected_file (0, 1);
} }
return MSG_NOT_HANDLED; return MSG_NOT_HANDLED;
case DLG_IDLE: case DLG_IDLE:
do_search (h); do_search (h);
break; return MSG_HANDLED;
}
return 0; default:
return default_dlg_callback (h, msg, parm);
}
} }
/* Handles the Stop/Start button in the find window */ /* Handles the Stop/Start button in the find window */

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

@ -90,7 +90,7 @@ typedef struct Link_Area {
static Link_Area *link_area = NULL; static Link_Area *link_area = NULL;
static int inside_link_area = 0; static int inside_link_area = 0;
static int help_callback (struct Dlg_head *h, int id, int msg); static cb_ret_t help_callback (struct Dlg_head *h, dlg_msg_t, int parm);
#ifdef HAS_ACS_AS_PCCHARS #ifdef HAS_ACS_AS_PCCHARS
static const struct { static const struct {
@ -483,7 +483,7 @@ static int help_event (Gpm_Event *event, Widget *w)
if (history_ptr < 0) if (history_ptr < 0)
history_ptr = HISTORY_SIZE-1; history_ptr = HISTORY_SIZE-1;
help_callback (w->parent, 0, DLG_DRAW); help_callback (w->parent, DLG_DRAW, 0);
return 0; return 0;
} }
@ -529,7 +529,7 @@ static int help_event (Gpm_Event *event, Widget *w)
} }
/* Show the new node */ /* Show the new node */
help_callback (w->parent, 0, DLG_DRAW); help_callback (w->parent, DLG_DRAW, 0);
return 0; return 0;
} }
@ -543,7 +543,7 @@ help_help_cmd (Dlg_head *h)
history [history_ptr].link = selected_item; history [history_ptr].link = selected_item;
currentpoint = startpoint = search_string (data, "[How to use help]") + 1; currentpoint = startpoint = search_string (data, "[How to use help]") + 1;
selected_item = NULL; selected_item = NULL;
help_callback (h, 0, DLG_DRAW); help_callback (h, DLG_DRAW, 0);
} }
static void static void
@ -563,7 +563,7 @@ help_index_cmd (Dlg_head * h)
currentpoint = startpoint = new_item + 1; currentpoint = startpoint = new_item + 1;
selected_item = NULL; selected_item = NULL;
help_callback (h, 0, DLG_DRAW); help_callback (h, DLG_DRAW, 0);
} }
static void help_quit_cmd (void *x) static void help_quit_cmd (void *x)
@ -579,7 +579,7 @@ static void prev_node_cmd (Dlg_head *h)
if (history_ptr < 0) if (history_ptr < 0)
history_ptr = HISTORY_SIZE-1; history_ptr = HISTORY_SIZE-1;
help_callback (h, 0, DLG_DRAW); help_callback (h, DLG_DRAW, 0);
} }
static int md_callback (Widget *w, int msg, int par) static int md_callback (Widget *w, int msg, int par)
@ -597,7 +597,8 @@ static Widget *mousedispatch_new (int y, int x, int yl, int xl)
return w; return w;
} }
static int help_handle_key (struct Dlg_head *h, int c) static cb_ret_t
help_handle_key (struct Dlg_head *h, int c)
{ {
char *new_item; char *new_item;
@ -715,25 +716,28 @@ static int help_handle_key (struct Dlg_head *h, int c)
break; break;
default: default:
return 0; return MSG_NOT_HANDLED;
} }
help_callback (h, 0, DLG_DRAW); help_callback (h, DLG_DRAW, 0);
return 1; return MSG_HANDLED;
} }
static int help_callback (struct Dlg_head *h, int id, int msg) static cb_ret_t
help_callback (struct Dlg_head *h, dlg_msg_t msg, int parm)
{ {
switch (msg){ switch (msg) {
case DLG_DRAW: case DLG_DRAW:
common_dialog_repaint (h); common_dialog_repaint (h);
help_show (h, currentpoint); help_show (h, currentpoint);
break; return MSG_HANDLED;
case DLG_KEY: case DLG_KEY:
return help_handle_key (h, id); return help_handle_key (h, parm);
default:
return default_dlg_callback (h, msg, parm);
} }
return 0;
} }
static void static void

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

@ -267,19 +267,20 @@ static void add_name_to_list (char *path)
} }
#endif /* !USE_VFS */ #endif /* !USE_VFS */
static int hotlist_button_callback (int action) static int
hotlist_button_callback (int action)
{ {
switch (action) { switch (action) {
case B_MOVE: case B_MOVE:
{ {
struct hotlist *saved = current_group; struct hotlist *saved = current_group;
struct hotlist *item; struct hotlist *item;
struct hotlist *moveto_item = 0; struct hotlist *moveto_item = 0;
struct hotlist *moveto_group = 0; struct hotlist *moveto_group = 0;
int ret; int ret;
if (!l_hotlist->current) if (!l_hotlist->current)
return 0; /* empty group - nothing to do */ return MSG_NOT_HANDLED; /* empty group - nothing to do */
item = l_hotlist->current->data; item = l_hotlist->current->data;
hotlist_state.moving = 1; hotlist_state.moving = 1;
init_movelist (LIST_MOVELIST, item); init_movelist (LIST_MOVELIST, item);
@ -292,9 +293,9 @@ static int hotlist_button_callback (int action)
destroy_dlg (movelist_dlg); destroy_dlg (movelist_dlg);
current_group = saved; current_group = saved;
if (ret == B_CANCEL) if (ret == B_CANCEL)
return 0; return MSG_NOT_HANDLED;
if (moveto_item == item) if (moveto_item == item)
return 0; /* If we insert/append a before/after a return MSG_NOT_HANDLED; /* If we insert/append a before/after a
it hardly changes anything ;) */ it hardly changes anything ;) */
unlink_entry (item); unlink_entry (item);
listbox_remove_current (l_hotlist, 1); listbox_remove_current (l_hotlist, 1);
@ -314,104 +315,105 @@ static int hotlist_button_callback (int action)
else { else {
item->next = moveto_item->next; item->next = moveto_item->next;
moveto_item->next = item; moveto_item->next = item;
} } else if (moveto_group->head == moveto_item) {
else if (moveto_group->head == moveto_item) { moveto_group->head = item;
moveto_group->head = item; item->next = moveto_item;
item->next = moveto_item; } else {
} else { struct hotlist *p = moveto_group->head;
struct hotlist *p = moveto_group->head;
while (p->next != moveto_item) while (p->next != moveto_item)
p = p->next; p = p->next;
item->next = p->next; item->next = p->next;
p->next = item; p->next = item;
} }
listbox_remove_list (l_hotlist); listbox_remove_list (l_hotlist);
fill_listbox (); fill_listbox ();
repaint_screen (); repaint_screen ();
hotlist_state.modified = 1; hotlist_state.modified = 1;
return 0; return MSG_NOT_HANDLED;
break; break;
} }
case B_REMOVE: case B_REMOVE:
if (l_hotlist->current && l_hotlist->current->data) if (l_hotlist->current && l_hotlist->current->data)
remove_from_hotlist (l_hotlist->current->data); remove_from_hotlist (l_hotlist->current->data);
return 0; return MSG_NOT_HANDLED;
break; break;
case B_NEW_GROUP: case B_NEW_GROUP:
add_new_group_cmd (); add_new_group_cmd ();
return 0; return MSG_NOT_HANDLED;
break; break;
case B_ADD_CURRENT: case B_ADD_CURRENT:
add2hotlist_cmd (); add2hotlist_cmd ();
return 0; return MSG_NOT_HANDLED;
break; break;
case B_NEW_ENTRY: case B_NEW_ENTRY:
add_new_entry_cmd (); add_new_entry_cmd ();
return 0; return MSG_NOT_HANDLED;
break; break;
case B_ENTER: case B_ENTER:
{ {
WListbox *list = hotlist_state.moving ? l_movelist : l_hotlist; WListbox *list = hotlist_state.moving ? l_movelist : l_hotlist;
if (list->current){ if (list->current) {
if (list->current->data) { if (list->current->data) {
struct hotlist *hlp = (struct hotlist*) list->current->data; struct hotlist *hlp =
if (hlp->type == HL_TYPE_ENTRY) (struct hotlist *) list->current->data;
return 1; if (hlp->type == HL_TYPE_ENTRY)
else { return MSG_HANDLED;
listbox_remove_list (list); else {
current_group = hlp; listbox_remove_list (list);
fill_listbox (); current_group = hlp;
return 0; fill_listbox ();
} return MSG_NOT_HANDLED;
} else }
return 1; } else
} return MSG_HANDLED;
}
} }
/* Fall through if list empty - just go up */ /* Fall through if list empty - just go up */
case B_UP_GROUP: case B_UP_GROUP:
{ {
WListbox *list = hotlist_state.moving ? l_movelist : l_hotlist; WListbox *list = hotlist_state.moving ? l_movelist : l_hotlist;
listbox_remove_list (list); listbox_remove_list (list);
current_group = current_group->up; current_group = current_group->up;
fill_listbox (); fill_listbox ();
return 0; return MSG_NOT_HANDLED;
break; break;
} }
#ifdef USE_VFS #ifdef USE_VFS
case B_FREE_ALL_VFS: case B_FREE_ALL_VFS:
vfs_expire (1); vfs_expire (1);
/* fall through */ /* fall through */
case B_REFRESH_VFS: case B_REFRESH_VFS:
listbox_remove_list (l_hotlist); listbox_remove_list (l_hotlist);
listbox_add_item (l_hotlist, 0, 0, home_dir, 0); listbox_add_item (l_hotlist, 0, 0, home_dir, 0);
vfs_fill_names (add_name_to_list); vfs_fill_names (add_name_to_list);
return 0; return MSG_NOT_HANDLED;
#endif /* USE_VFS */ #endif /* USE_VFS */
default: default:
return 1; return MSG_HANDLED;
break; break;
} }
} }
static int hotlist_callback (Dlg_head * h, int Par, int Msg) static cb_ret_t
hotlist_callback (Dlg_head *h, dlg_msg_t msg, int parm)
{ {
switch (Msg) { switch (msg) {
case DLG_DRAW: case DLG_DRAW:
hotlist_refresh (h); hotlist_refresh (h);
break; return MSG_HANDLED;
case DLG_UNHANDLED_KEY: case DLG_UNHANDLED_KEY:
switch (Par) { switch (parm) {
case KEY_M_CTRL | '\n': case KEY_M_CTRL | '\n':
goto l1; goto l1;
case '\n': case '\n':
@ -421,44 +423,43 @@ static int hotlist_callback (Dlg_head * h, int Par, int Msg)
h->ret_value = B_ENTER; h->ret_value = B_ENTER;
dlg_stop (h); dlg_stop (h);
}; };
return 1; return MSG_HANDLED;
break; break;
case KEY_LEFT: case KEY_LEFT:
if (hotlist_state.type != LIST_VFSLIST ) if (hotlist_state.type != LIST_VFSLIST)
return !hotlist_button_callback (B_UP_GROUP); return !hotlist_button_callback (B_UP_GROUP);
else else
return 0; return MSG_NOT_HANDLED;
break; break;
case KEY_DC: case KEY_DC:
if (!hotlist_state.moving) { if (!hotlist_state.moving) {
hotlist_button_callback (B_REMOVE); hotlist_button_callback (B_REMOVE);
return 1; return MSG_HANDLED;
} }
break; break;
l1: l1:
case ALT('\n'): case ALT ('\n'):
case ALT('\r'): case ALT ('\r'):
if (!hotlist_state.moving) if (!hotlist_state.moving) {
{ if (l_hotlist->current) {
if (l_hotlist->current){
if (l_hotlist->current->data) { if (l_hotlist->current->data) {
struct hotlist *hlp = (struct hotlist*) l_hotlist->current->data; struct hotlist *hlp =
(struct hotlist *) l_hotlist->current->data;
if (hlp->type == HL_TYPE_ENTRY) { if (hlp->type == HL_TYPE_ENTRY) {
char *tmp = g_strconcat ( "cd ", hlp->directory, NULL); char *tmp =
g_strconcat ("cd ", hlp->directory, NULL);
stuff (cmdline, tmp, 0); stuff (cmdline, tmp, 0);
g_free (tmp); g_free (tmp);
dlg_stop (h); dlg_stop (h);
h->ret_value = B_CANCEL; h->ret_value = B_CANCEL;
return 1; return MSG_HANDLED;
} }
} }
} }
} }
return 1; /* ignore key */ return MSG_HANDLED; /* ignore key */
default:
return 0;
} }
break; return MSG_NOT_HANDLED;
case DLG_POST_KEY: case DLG_POST_KEY:
if (hotlist_state.moving) if (hotlist_state.moving)
@ -471,9 +472,11 @@ l1:
case DLG_INIT: case DLG_INIT:
attrset (MENU_ENTRY_COLOR); attrset (MENU_ENTRY_COLOR);
update_path_name (); update_path_name ();
break; return MSG_HANDLED;
default:
return default_dlg_callback (h, msg, parm);
} }
return 0;
} }
static int l_call (WListbox *list) static int l_call (WListbox *list)

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

@ -264,9 +264,10 @@ static int bminus_cback (int action)
return 0; return 0;
} }
static int layout_callback (struct Dlg_head *h, int Id, int Msg) static cb_ret_t
layout_callback (struct Dlg_head *h, dlg_msg_t msg, int parm)
{ {
switch (Msg){ switch (msg) {
case DLG_DRAW: case DLG_DRAW:
/*When repainting the whole dialog (e.g. with C-l) we have to /*When repainting the whole dialog (e.g. with C-l) we have to
update everything*/ update everything*/
@ -301,7 +302,7 @@ static int layout_callback (struct Dlg_head *h, int Id, int Msg)
printw ("%02d", _output_lines); printw ("%02d", _output_lines);
} }
} }
break; return MSG_HANDLED;
case DLG_POST_KEY: case DLG_POST_KEY:
_filetype_mode = check_options [8].widget->state & C_BOOL; _filetype_mode = check_options [8].widget->state & C_BOOL;
@ -343,12 +344,11 @@ static int layout_callback (struct Dlg_head *h, int Id, int Msg)
printw ("%02d", _output_lines); printw ("%02d", _output_lines);
} }
} }
break; return MSG_HANDLED;
case DLG_END: default:
break; return default_dlg_callback (h, msg, parm);
} }
return 0;
} }
static void init_layout (void) static void init_layout (void)

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

@ -207,16 +207,20 @@ learn_check_key (int c)
return 0; return 0;
} }
static int learn_callback (Dlg_head * h, int Par, int Msg) static cb_ret_t
learn_callback (Dlg_head *h, dlg_msg_t msg, int parm)
{ {
switch (Msg) { switch (msg) {
case DLG_DRAW: case DLG_DRAW:
common_dialog_repaint (h); common_dialog_repaint (h);
break; return MSG_HANDLED;
case DLG_KEY: case DLG_KEY:
return learn_check_key (Par); return learn_check_key (parm);
default:
return default_dlg_callback (h, msg, parm);
} }
return 0;
} }
static void static void

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

@ -158,17 +158,18 @@ bremove_cback (int action)
return 0; return 0;
} }
static int static cb_ret_t
listmode_callback (Dlg_head *h, int Par, int Msg) listmode_callback (Dlg_head *h, dlg_msg_t msg, int parm)
{ {
switch (Msg) { switch (msg) {
case DLG_DRAW: case DLG_DRAW:
listmode_refresh (h); listmode_refresh (h);
break; return MSG_HANDLED;
default:
return default_dlg_callback (h, msg, parm);
} }
return 0;
} }
static Dlg_head * static Dlg_head *

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

@ -1477,8 +1477,8 @@ done_mc_profile (void)
free_profiles (); free_profiles ();
} }
static int static cb_ret_t
midnight_callback (struct Dlg_head *h, int id, int msg) midnight_callback (struct Dlg_head *h, dlg_msg_t msg, int parm)
{ {
int i; int i;
@ -1496,32 +1496,32 @@ midnight_callback (struct Dlg_head *h, int id, int msg)
if (ctl_x_map_enabled) { if (ctl_x_map_enabled) {
ctl_x_map_enabled = 0; ctl_x_map_enabled = 0;
for (i = 0; ctl_x_map[i].key_code; i++) for (i = 0; ctl_x_map[i].key_code; i++)
if (id == ctl_x_map[i].key_code) { if (parm == ctl_x_map[i].key_code) {
(*ctl_x_map[i].fn) (id); (*ctl_x_map[i].fn) (parm);
return MSG_HANDLED; return MSG_HANDLED;
} }
} }
/* FIXME: should handle all menu shortcuts before this point */ /* FIXME: should handle all menu shortcuts before this point */
if (the_menubar->active) if (the_menubar->active)
break; return MSG_NOT_HANDLED;
if (id == KEY_F (10)) { if (parm == KEY_F (10)) {
quit_cmd (); quit_cmd ();
return MSG_HANDLED; return MSG_HANDLED;
} }
if (id == '\t') if (parm == '\t')
free_completions (cmdline); free_completions (cmdline);
if (id == '\n' && cmdline->buffer[0]) { if (parm == '\n' && cmdline->buffer[0]) {
send_message ((Widget *) cmdline, WIDGET_KEY, id); send_message ((Widget *) cmdline, WIDGET_KEY, parm);
return MSG_HANDLED; return MSG_HANDLED;
} }
/* Ctrl-Enter and Alt-Enter */ /* Ctrl-Enter and Alt-Enter */
if (((id & ~(KEY_M_CTRL | KEY_M_ALT)) == '\n') if (((parm & ~(KEY_M_CTRL | KEY_M_ALT)) == '\n')
&& (id & (KEY_M_CTRL | KEY_M_ALT))) { && (parm & (KEY_M_CTRL | KEY_M_ALT))) {
copy_prog_name (); copy_prog_name ();
return MSG_HANDLED; return MSG_HANDLED;
} }
@ -1530,17 +1530,17 @@ midnight_callback (struct Dlg_head *h, int id, int msg)
&& !quote && !cpanel->searching) { && !quote && !cpanel->searching) {
if (!only_leading_plus_minus) { if (!only_leading_plus_minus) {
/* Special treatement, since the input line will eat them */ /* Special treatement, since the input line will eat them */
if (id == '+') { if (parm == '+') {
select_cmd (); select_cmd ();
return MSG_HANDLED; return MSG_HANDLED;
} }
if (id == '\\' || id == '-') { if (parm == '\\' || parm == '-') {
unselect_cmd (); unselect_cmd ();
return MSG_HANDLED; return MSG_HANDLED;
} }
if (id == '*') { if (parm == '*') {
reverse_selection_cmd (); reverse_selection_cmd ();
return MSG_HANDLED; return MSG_HANDLED;
} }
@ -1549,50 +1549,50 @@ midnight_callback (struct Dlg_head *h, int id, int msg)
* first char on input line * first char on input line
*/ */
if (id == '+') { if (parm == '+') {
select_cmd (); select_cmd ();
return MSG_HANDLED; return MSG_HANDLED;
} }
if (id == '\\' || id == '-') { if (parm == '\\' || parm == '-') {
unselect_cmd (); unselect_cmd ();
return MSG_HANDLED; return MSG_HANDLED;
} }
if (id == '*') { if (parm == '*') {
reverse_selection_cmd (); reverse_selection_cmd ();
return MSG_HANDLED; return MSG_HANDLED;
} }
} }
} }
break; return MSG_NOT_HANDLED;
case DLG_HOTKEY_HANDLED: case DLG_HOTKEY_HANDLED:
if ((get_current_type () == view_listing) && cpanel->searching) { if ((get_current_type () == view_listing) && cpanel->searching) {
cpanel->searching = 0; cpanel->searching = 0;
panel_update_contents (cpanel); panel_update_contents (cpanel);
} }
break; return MSG_HANDLED;
case DLG_UNHANDLED_KEY: case DLG_UNHANDLED_KEY:
if (command_prompt) { if (command_prompt) {
int v; int v;
v = send_message ((Widget *) cmdline, WIDGET_KEY, id); v = send_message ((Widget *) cmdline, WIDGET_KEY, parm);
if (v) if (v)
return v; return v;
} }
if (ctl_x_map_enabled) { if (ctl_x_map_enabled) {
ctl_x_map_enabled = 0; ctl_x_map_enabled = 0;
for (i = 0; ctl_x_map[i].key_code; i++) for (i = 0; ctl_x_map[i].key_code; i++)
if (id == ctl_x_map[i].key_code) { if (parm == ctl_x_map[i].key_code) {
(*ctl_x_map[i].fn) (id); (*ctl_x_map[i].fn) (parm);
return MSG_HANDLED; return MSG_HANDLED;
} }
} else { } else {
for (i = 0; default_map[i].key_code; i++) { for (i = 0; default_map[i].key_code; i++) {
if (id == default_map[i].key_code) { if (parm == default_map[i].key_code) {
(*default_map[i].fn) (id); (*default_map[i].fn) (parm);
return MSG_HANDLED; return MSG_HANDLED;
} }
} }
@ -1607,8 +1607,9 @@ midnight_callback (struct Dlg_head *h, int id, int msg)
1, LINES - keybar_visible - 1); 1, LINES - keybar_visible - 1);
return MSG_HANDLED; return MSG_HANDLED;
default:
return default_dlg_callback (h, msg, parm);
} }
return default_dlg_callback (h, id, msg);
} }
#define xtoolkit_panel_setup() #define xtoolkit_panel_setup()

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

@ -107,9 +107,10 @@ static char *pause_options [3] = {
#define RX X_MARGIN #define RX X_MARGIN
#define OX (first_width + X_MARGIN + X_PANE_GAP) #define OX (first_width + X_MARGIN + X_PANE_GAP)
static int configure_callback (struct Dlg_head *h, int Id, int Msg) static cb_ret_t
configure_callback (struct Dlg_head *h, dlg_msg_t msg, int parm)
{ {
switch (Msg) { switch (msg) {
case DLG_DRAW: case DLG_DRAW:
common_dialog_repaint (h); common_dialog_repaint (h);
@ -125,13 +126,15 @@ static int configure_callback (struct Dlg_head *h, int Id, int Msg)
addstr (title2); addstr (title2);
dlg_move (h, PY, PX+1); dlg_move (h, PY, PX+1);
addstr (title1); addstr (title1);
break; return MSG_HANDLED;
case DLG_END: case DLG_END:
r_but = Id; r_but = parm;
break; return MSG_HANDLED;
default:
return default_dlg_callback (h, msg, parm);
} }
return 0;
} }
/* Create the "Configure options" dialog */ /* Create the "Configure options" dialog */

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

@ -93,24 +93,26 @@ update_command (void)
} }
} }
static int static cb_ret_t
panelize_callback (Dlg_head * h, int Par, int Msg) panelize_callback (Dlg_head *h, dlg_msg_t msg, int parm)
{ {
switch (Msg) { switch (msg) {
case DLG_DRAW: case DLG_DRAW:
common_dialog_repaint (h); common_dialog_repaint (h);
attrset (COLOR_NORMAL); attrset (COLOR_NORMAL);
draw_box (h, UY, UX, h->lines - 10, h->cols - 10); draw_box (h, UY, UX, h->lines - 10, h->cols - 10);
break; return MSG_HANDLED;
case DLG_POST_KEY: case DLG_POST_KEY:
/* fall */ /* fall */
case DLG_INIT: case DLG_INIT:
attrset (MENU_ENTRY_COLOR); attrset (MENU_ENTRY_COLOR);
update_command (); update_command ();
break; return MSG_HANDLED;
default:
return default_dlg_callback (h, msg, parm);
} }
return 0;
} }
static void static void

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

@ -2608,15 +2608,17 @@ view_adjust_size (Dlg_head *h)
} }
/* Callback for the view dialog */ /* Callback for the view dialog */
static int static cb_ret_t
view_dialog_callback (Dlg_head *h, int id, int msg) view_dialog_callback (Dlg_head *h, dlg_msg_t msg, int parm)
{ {
switch (msg) { switch (msg) {
case DLG_RESIZE: case DLG_RESIZE:
view_adjust_size (h); view_adjust_size (h);
return MSG_HANDLED; return MSG_HANDLED;
default:
return default_dlg_callback (h, msg, parm);
} }
return default_dlg_callback (h, id, msg);
} }
/* Real view only */ /* Real view only */

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

@ -235,20 +235,21 @@ message (int error, char *header, const char *text, ...)
/* {{{ Quick dialog routines */ /* {{{ Quick dialog routines */
static int quick_callback (struct Dlg_head *h, int id, int Msg) static cb_ret_t
quick_callback (struct Dlg_head *h, dlg_msg_t msg, int parm)
{ {
switch (Msg){ switch (msg) {
case DLG_DRAW:
common_dialog_repaint (h);
break;
case DLG_KEY: case DLG_KEY:
if (id == '\n'){ if (parm == '\n') {
h->ret_value = B_ENTER; h->ret_value = B_ENTER;
dlg_stop (h); dlg_stop (h);
break; return MSG_HANDLED;
} }
return MSG_NOT_HANDLED;
default:
return default_dlg_callback (h, msg, parm);
} }
return 0;
} }
#define I18N(x) (do_int && *x ? (x = _(x)): x) #define I18N(x) (do_int && *x ? (x = _(x)): x)