1
0
mirror of https://github.com/rkd77/elinks.git synced 2025-01-03 14:57:44 -05:00

kbd_listbox(): converts if {} stuff to a switch{}.

This commit is contained in:
Laurent MONIN 2005-12-26 10:53:39 +01:00 committed by Laurent MONIN
parent 9683cf429b
commit 918fed9966

View File

@ -622,22 +622,21 @@ kbd_listbox(struct dialog_data *dlg_data, struct widget_data *widget_data)
case EVENT_KBD: case EVENT_KBD:
action_id = kbd_action(KEYMAP_MENU, ev, NULL); action_id = kbd_action(KEYMAP_MENU, ev, NULL);
/* Moving the box */ switch (action_id) {
if (action_id == ACT_MENU_DOWN) { case ACT_MENU_DOWN:
listbox_sel_move(dlg_item, 1); listbox_sel_move(dlg_item, 1);
display_widget(dlg_data, dlg_item); display_widget(dlg_data, dlg_item);
return EVENT_PROCESSED; return EVENT_PROCESSED;
}
if (action_id == ACT_MENU_UP) { case ACT_MENU_UP:
listbox_sel_move(dlg_item, -1); listbox_sel_move(dlg_item, -1);
display_widget(dlg_data, dlg_item); display_widget(dlg_data, dlg_item);
return EVENT_PROCESSED; return EVENT_PROCESSED;
}
if (action_id == ACT_MENU_PAGE_DOWN) { case ACT_MENU_PAGE_DOWN:
{
struct listbox_data *box; struct listbox_data *box;
box = get_listbox_widget_data(dlg_item); box = get_listbox_widget_data(dlg_item);
@ -651,7 +650,8 @@ kbd_listbox(struct dialog_data *dlg_data, struct widget_data *widget_data)
return EVENT_PROCESSED; return EVENT_PROCESSED;
} }
if (action_id == ACT_MENU_PAGE_UP) { case ACT_MENU_PAGE_UP:
{
struct listbox_data *box; struct listbox_data *box;
box = get_listbox_widget_data(dlg_item); box = get_listbox_widget_data(dlg_item);
@ -665,21 +665,20 @@ kbd_listbox(struct dialog_data *dlg_data, struct widget_data *widget_data)
return EVENT_PROCESSED; return EVENT_PROCESSED;
} }
if (action_id == ACT_MENU_HOME) { case ACT_MENU_HOME:
listbox_sel_move(dlg_item, -INT_MAX); listbox_sel_move(dlg_item, -INT_MAX);
display_widget(dlg_data, dlg_item); display_widget(dlg_data, dlg_item);
return EVENT_PROCESSED; return EVENT_PROCESSED;
}
if (action_id == ACT_MENU_END) { case ACT_MENU_END:
listbox_sel_move(dlg_item, INT_MAX); listbox_sel_move(dlg_item, INT_MAX);
display_widget(dlg_data, dlg_item); display_widget(dlg_data, dlg_item);
return EVENT_PROCESSED; return EVENT_PROCESSED;
}
if (action_id == ACT_MENU_MARK_ITEM) { case ACT_MENU_MARK_ITEM:
{
struct listbox_data *box; struct listbox_data *box;
box = get_listbox_widget_data(dlg_item); box = get_listbox_widget_data(dlg_item);
@ -692,7 +691,8 @@ kbd_listbox(struct dialog_data *dlg_data, struct widget_data *widget_data)
return EVENT_PROCESSED; return EVENT_PROCESSED;
} }
if (action_id == ACT_MENU_DELETE) { case ACT_MENU_DELETE:
{
struct listbox_data *box; struct listbox_data *box;
box = get_listbox_widget_data(dlg_item); box = get_listbox_widget_data(dlg_item);
@ -705,6 +705,10 @@ kbd_listbox(struct dialog_data *dlg_data, struct widget_data *widget_data)
return EVENT_PROCESSED; return EVENT_PROCESSED;
} }
default:
return EVENT_NOT_PROCESSED;
}
/* Selecting a button; most probably ;). */ /* Selecting a button; most probably ;). */
break; break;