mirror of
https://github.com/rkd77/elinks.git
synced 2025-01-03 14:57:44 -05:00
hierbox_ev_kbd(): use a switch().
This commit is contained in:
parent
9dc2a7ffb7
commit
a05b6c0636
@ -157,13 +157,15 @@ hierbox_ev_kbd(struct dialog_data *dlg_data)
|
|||||||
selected = box->sel;
|
selected = box->sel;
|
||||||
action_id = kbd_action(KEYMAP_MENU, ev, NULL);
|
action_id = kbd_action(KEYMAP_MENU, ev, NULL);
|
||||||
|
|
||||||
if (action_id == ACT_MENU_SELECT) {
|
switch (action_id) {
|
||||||
|
case ACT_MENU_SELECT:
|
||||||
if (!selected) return EVENT_PROCESSED;
|
if (!selected) return EVENT_PROCESSED;
|
||||||
if (selected->type != BI_FOLDER)
|
if (selected->type != BI_FOLDER)
|
||||||
return EVENT_NOT_PROCESSED;
|
return EVENT_NOT_PROCESSED;
|
||||||
selected->expanded = !selected->expanded;
|
selected->expanded = !selected->expanded;
|
||||||
|
break;
|
||||||
|
|
||||||
} else if (action_id == ACT_MENU_UNEXPAND) {
|
case ACT_MENU_UNEXPAND:
|
||||||
/* Recursively unexpand all folders */
|
/* Recursively unexpand all folders */
|
||||||
if (!selected) return EVENT_PROCESSED;
|
if (!selected) return EVENT_PROCESSED;
|
||||||
|
|
||||||
@ -173,8 +175,9 @@ hierbox_ev_kbd(struct dialog_data *dlg_data)
|
|||||||
* whole parent folder will be closed. */
|
* whole parent folder will be closed. */
|
||||||
if (list_empty(selected->child)
|
if (list_empty(selected->child)
|
||||||
|| !selected->expanded) {
|
|| !selected->expanded) {
|
||||||
struct listbox_item *root = box->ops->get_root(selected);
|
struct listbox_item *root;
|
||||||
|
|
||||||
|
root = box->ops->get_root(selected);
|
||||||
if (root) {
|
if (root) {
|
||||||
listbox_sel(widget_data, root);
|
listbox_sel(widget_data, root);
|
||||||
}
|
}
|
||||||
@ -182,23 +185,25 @@ hierbox_ev_kbd(struct dialog_data *dlg_data)
|
|||||||
} else if (selected->type == BI_FOLDER) {
|
} else if (selected->type == BI_FOLDER) {
|
||||||
recursively_set_expanded(selected, 0);
|
recursively_set_expanded(selected, 0);
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
} else if (action_id == ACT_MENU_EXPAND) {
|
case ACT_MENU_EXPAND:
|
||||||
/* Recursively expand all folders */
|
/* Recursively expand all folders */
|
||||||
|
|
||||||
if (!selected || selected->type != BI_FOLDER)
|
if (!selected || selected->type != BI_FOLDER)
|
||||||
return EVENT_PROCESSED;
|
return EVENT_PROCESSED;
|
||||||
|
|
||||||
recursively_set_expanded(selected, 1);
|
recursively_set_expanded(selected, 1);
|
||||||
|
break;
|
||||||
|
|
||||||
} else if (action_id == ACT_MENU_SEARCH) {
|
case ACT_MENU_SEARCH:
|
||||||
if (!box->ops->match)
|
if (!box->ops->match)
|
||||||
return EVENT_NOT_PROCESSED;
|
return EVENT_NOT_PROCESSED;
|
||||||
|
|
||||||
push_hierbox_search_button(dlg_data, NULL);
|
push_hierbox_search_button(dlg_data, NULL);
|
||||||
return EVENT_PROCESSED;
|
return EVENT_PROCESSED;
|
||||||
|
|
||||||
} else {
|
default:
|
||||||
return EVENT_NOT_PROCESSED;
|
return EVENT_NOT_PROCESSED;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user