mirror of
https://github.com/libretro/RetroArch
synced 2025-02-12 00:40:26 +00:00
(Menu) Refactors
This commit is contained in:
parent
0c170ab56e
commit
fb31227585
@ -640,10 +640,10 @@ static void rmenu_xui_navigation_alphabet(menu_handle_t *menu, size_t *ptr_out)
|
|||||||
XuiListSetCurSelVisible(m_menulist, *ptr_out);
|
XuiListSetCurSelVisible(m_menulist, *ptr_out);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rmenu_xui_list_insert(void *data,
|
static void rmenu_xui_list_insert(menu_handle_t *menu,
|
||||||
|
file_list_t *list,
|
||||||
const char *path, const char *, size_t list_size)
|
const char *path, const char *, size_t list_size)
|
||||||
{
|
{
|
||||||
(void)data;
|
|
||||||
wchar_t buf[PATH_MAX_LENGTH];
|
wchar_t buf[PATH_MAX_LENGTH];
|
||||||
|
|
||||||
XuiListInsertItems(m_menulist, list_size, 1);
|
XuiListInsertItems(m_menulist, list_size, 1);
|
||||||
@ -651,12 +651,12 @@ static void rmenu_xui_list_insert(void *data,
|
|||||||
XuiListSetText(m_menulist, list_size, buf);
|
XuiListSetText(m_menulist, list_size, buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rmenu_xui_list_delete(void *data, size_t idx,
|
static void rmenu_xui_list_delete(menu_handle_t *menu,
|
||||||
|
file_list_t *list, size_t idx,
|
||||||
size_t list_size)
|
size_t list_size)
|
||||||
{
|
{
|
||||||
int x = XuiListGetItemCount( m_menulist );
|
int x = XuiListGetItemCount( m_menulist );
|
||||||
|
|
||||||
(void)data;
|
|
||||||
(void)idx;
|
(void)idx;
|
||||||
|
|
||||||
if( list_size > x )
|
if( list_size > x )
|
||||||
@ -665,9 +665,8 @@ static void rmenu_xui_list_delete(void *data, size_t idx,
|
|||||||
XuiListDeleteItems(m_menulist, 0, list_size);
|
XuiListDeleteItems(m_menulist, 0, list_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rmenu_xui_list_clear(void *data)
|
static void rmenu_xui_list_clear(menu_handle_t *menu, file_list_t *list)
|
||||||
{
|
{
|
||||||
(void)data;
|
|
||||||
XuiListDeleteItems(m_menulist, 0, XuiListGetItemCount(m_menulist));
|
XuiListDeleteItems(m_menulist, 0, XuiListGetItemCount(m_menulist));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1385,13 +1385,17 @@ static void xmb_navigation_ascend_alphabet(menu_handle_t *menu, size_t *unused)
|
|||||||
xmb_selection_pointer_changed(menu);
|
xmb_selection_pointer_changed(menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void xmb_list_insert(void *data,
|
static void xmb_list_insert(menu_handle_t *menu, file_list_t *list,
|
||||||
const char *path, const char *unused, size_t list_size)
|
const char *path, const char *unused, size_t list_size)
|
||||||
{
|
{
|
||||||
int current = 0, i = list_size;
|
int current = 0, i = list_size;
|
||||||
xmb_node_t *node = NULL;
|
xmb_node_t *node = NULL;
|
||||||
xmb_handle_t *xmb = (xmb_handle_t*)driver.menu->userdata;
|
xmb_handle_t *xmb = NULL;
|
||||||
file_list_t *list = (file_list_t*)data;
|
|
||||||
|
if (!menu)
|
||||||
|
return;
|
||||||
|
|
||||||
|
xmb = (xmb_handle_t*)menu->userdata;
|
||||||
|
|
||||||
if (!list || !xmb)
|
if (!list || !xmb)
|
||||||
return;
|
return;
|
||||||
@ -1409,7 +1413,7 @@ static void xmb_list_insert(void *data,
|
|||||||
if (!node)
|
if (!node)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
current = driver.menu->selection_ptr;
|
current = menu->selection_ptr;
|
||||||
|
|
||||||
node->alpha = xmb->i_passive_alpha;
|
node->alpha = xmb->i_passive_alpha;
|
||||||
node->zoom = xmb->i_passive_zoom;
|
node->zoom = xmb->i_passive_zoom;
|
||||||
@ -1425,11 +1429,10 @@ static void xmb_list_insert(void *data,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void xmb_list_delete(void *data, size_t idx,
|
static void xmb_list_delete(menu_handle_t *menu,
|
||||||
|
file_list_t *list, size_t idx,
|
||||||
size_t list_size)
|
size_t list_size)
|
||||||
{
|
{
|
||||||
file_list_t *list = (file_list_t*)data;
|
|
||||||
|
|
||||||
if (!list)
|
if (!list)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -1438,59 +1441,50 @@ static void xmb_list_delete(void *data, size_t idx,
|
|||||||
list->list[idx].userdata = NULL;
|
list->list[idx].userdata = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void xmb_list_clear(void *data)
|
static void xmb_list_cache(menu_handle_t *menu,
|
||||||
{
|
bool horizontal, unsigned action)
|
||||||
(void)data;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void xmb_list_cache(bool horizontal, unsigned action)
|
|
||||||
{
|
{
|
||||||
size_t stack_size;
|
size_t stack_size;
|
||||||
xmb_handle_t *xmb = (xmb_handle_t*)driver.menu->userdata;
|
xmb_handle_t *xmb = (xmb_handle_t*)menu->userdata;
|
||||||
|
|
||||||
if (!xmb)
|
if (!xmb)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
file_list_copy(driver.menu->menu_list->selection_buf, xmb->selection_buf_old);
|
file_list_copy(menu->menu_list->selection_buf, xmb->selection_buf_old);
|
||||||
file_list_copy(driver.menu->menu_list->menu_stack, xmb->menu_stack_old);
|
file_list_copy(menu->menu_list->menu_stack, xmb->menu_stack_old);
|
||||||
xmb->selection_ptr_old = driver.menu->selection_ptr;
|
xmb->selection_ptr_old = menu->selection_ptr;
|
||||||
|
|
||||||
if(!horizontal)
|
if(!horizontal)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
xmb->cat_selection_ptr_old = driver.menu->cat_selection_ptr;
|
xmb->cat_selection_ptr_old = menu->cat_selection_ptr;
|
||||||
|
|
||||||
switch (action)
|
switch (action)
|
||||||
{
|
{
|
||||||
case MENU_ACTION_LEFT:
|
case MENU_ACTION_LEFT:
|
||||||
driver.menu->cat_selection_ptr--;
|
menu->cat_selection_ptr--;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
driver.menu->cat_selection_ptr++;
|
menu->cat_selection_ptr++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
stack_size = driver.menu->menu_list->menu_stack->size;
|
stack_size = menu->menu_list->menu_stack->size;
|
||||||
|
|
||||||
strlcpy(driver.menu->menu_list->menu_stack->list[stack_size-1].label,
|
strlcpy(menu->menu_list->menu_stack->list[stack_size-1].label,
|
||||||
"Main Menu", PATH_MAX_LENGTH);
|
"Main Menu", PATH_MAX_LENGTH);
|
||||||
driver.menu->menu_list->menu_stack->list[stack_size-1].type =
|
menu->menu_list->menu_stack->list[stack_size-1].type =
|
||||||
MENU_SETTINGS;
|
MENU_SETTINGS;
|
||||||
|
|
||||||
if (driver.menu->cat_selection_ptr == 0)
|
if (menu->cat_selection_ptr == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
strlcpy(driver.menu->menu_list->menu_stack->list[stack_size-1].label,
|
strlcpy(menu->menu_list->menu_stack->list[stack_size-1].label,
|
||||||
"Horizontal Menu", PATH_MAX_LENGTH);
|
"Horizontal Menu", PATH_MAX_LENGTH);
|
||||||
driver.menu->menu_list->menu_stack->list[stack_size-1].type =
|
menu->menu_list->menu_stack->list[stack_size-1].type =
|
||||||
MENU_SETTING_HORIZONTAL_MENU;
|
MENU_SETTING_HORIZONTAL_MENU;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void xmb_list_set_selection(file_list_t *list)
|
|
||||||
{
|
|
||||||
(void)list;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void xmb_context_destroy(menu_handle_t *menu)
|
static void xmb_context_destroy(menu_handle_t *menu)
|
||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
@ -1586,9 +1580,9 @@ menu_ctx_driver_t menu_ctx_xmb = {
|
|||||||
xmb_navigation_ascend_alphabet,
|
xmb_navigation_ascend_alphabet,
|
||||||
xmb_list_insert,
|
xmb_list_insert,
|
||||||
xmb_list_delete,
|
xmb_list_delete,
|
||||||
xmb_list_clear,
|
NULL,
|
||||||
xmb_list_cache,
|
xmb_list_cache,
|
||||||
xmb_list_set_selection,
|
NULL,
|
||||||
xmb_entry_iterate,
|
xmb_entry_iterate,
|
||||||
"xmb",
|
"xmb",
|
||||||
};
|
};
|
||||||
|
@ -199,10 +199,10 @@ typedef struct menu_ctx_driver
|
|||||||
void (*navigation_set_last)(menu_handle_t *menu);
|
void (*navigation_set_last)(menu_handle_t *menu);
|
||||||
void (*navigation_descend_alphabet)(menu_handle_t *menu, size_t *);
|
void (*navigation_descend_alphabet)(menu_handle_t *menu, size_t *);
|
||||||
void (*navigation_ascend_alphabet)(menu_handle_t *menu, size_t *);
|
void (*navigation_ascend_alphabet)(menu_handle_t *menu, size_t *);
|
||||||
void (*list_insert)(void *, const char *, const char *, size_t);
|
void (*list_insert)(menu_handle_t *menu, file_list_t *list, const char *, const char *, size_t);
|
||||||
void (*list_delete)(void *, size_t, size_t);
|
void (*list_delete)(menu_handle_t *menu, file_list_t *list, size_t, size_t);
|
||||||
void (*list_clear)(void *);
|
void (*list_clear)(menu_handle_t *menu, file_list_t *list);
|
||||||
void (*list_cache)(bool, unsigned);
|
void (*list_cache)(menu_handle_t *menu, bool, unsigned);
|
||||||
void (*list_set_selection)(file_list_t *list);
|
void (*list_set_selection)(file_list_t *list);
|
||||||
int (*entry_iterate)(menu_handle_t *menu, unsigned);
|
int (*entry_iterate)(menu_handle_t *menu, unsigned);
|
||||||
const char *ident;
|
const char *ident;
|
||||||
|
@ -2096,7 +2096,7 @@ static int action_toggle_mainmenu(unsigned type, const char *label,
|
|||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
if (driver.menu_ctx->list_cache)
|
if (driver.menu_ctx->list_cache)
|
||||||
driver.menu_ctx->list_cache(true, action);
|
driver.menu_ctx->list_cache(driver.menu, true, action);
|
||||||
|
|
||||||
if (cbs && cbs->action_content_list_switch)
|
if (cbs && cbs->action_content_list_switch)
|
||||||
return cbs->action_content_list_switch(
|
return cbs->action_content_list_switch(
|
||||||
|
@ -136,7 +136,7 @@ void menu_list_destroy(file_list_t *list)
|
|||||||
for (i = 0; i < list->size; i++)
|
for (i = 0; i < list->size; i++)
|
||||||
{
|
{
|
||||||
if (driver.menu_ctx->list_delete)
|
if (driver.menu_ctx->list_delete)
|
||||||
driver.menu_ctx->list_delete(list, i, list->size);
|
driver.menu_ctx->list_delete(driver.menu, list, i, list->size);
|
||||||
menu_common_list_delete(list, i, list->size);
|
menu_common_list_delete(list, i, list->size);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -271,7 +271,7 @@ void menu_list_pop_stack(menu_list_t *list)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (driver.menu_ctx->list_cache)
|
if (driver.menu_ctx->list_cache)
|
||||||
driver.menu_ctx->list_cache(false, 0);
|
driver.menu_ctx->list_cache(driver.menu, false, 0);
|
||||||
|
|
||||||
menu_list_pop(list->menu_stack, &driver.menu->selection_ptr);
|
menu_list_pop(list->menu_stack, &driver.menu->selection_ptr);
|
||||||
driver.menu->need_refresh = true;
|
driver.menu->need_refresh = true;
|
||||||
@ -307,7 +307,7 @@ void menu_list_pop(file_list_t *list, size_t *directory_ptr)
|
|||||||
size_t list_size = list->size - 1;
|
size_t list_size = list->size - 1;
|
||||||
|
|
||||||
if (driver.menu_ctx->list_delete)
|
if (driver.menu_ctx->list_delete)
|
||||||
driver.menu_ctx->list_delete(list, list_size, list_size);
|
driver.menu_ctx->list_delete(driver.menu, list, list_size, list_size);
|
||||||
menu_common_list_delete(list, list_size, list_size);
|
menu_common_list_delete(list, list_size, list_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -329,7 +329,7 @@ void menu_list_clear(file_list_t *list)
|
|||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
if (driver.menu_ctx->list_clear)
|
if (driver.menu_ctx->list_clear)
|
||||||
driver.menu_ctx->list_clear(list);
|
driver.menu_ctx->list_clear(driver.menu, list);
|
||||||
|
|
||||||
end:
|
end:
|
||||||
menu_common_list_clear(list);
|
menu_common_list_clear(list);
|
||||||
@ -343,7 +343,7 @@ static void menu_list_insert(file_list_t *list,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (driver.menu_ctx->list_insert)
|
if (driver.menu_ctx->list_insert)
|
||||||
driver.menu_ctx->list_insert(list, path, label, list->size - 1);
|
driver.menu_ctx->list_insert(driver.menu, list, path, label, list->size - 1);
|
||||||
|
|
||||||
menu_common_list_insert(list, path, label, type, list->size - 1);
|
menu_common_list_insert(list, path, label, type, list->size - 1);
|
||||||
}
|
}
|
||||||
@ -387,7 +387,7 @@ int menu_list_push_stack_refresh(menu_list_t *list,
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (driver.menu_ctx->list_cache)
|
if (driver.menu_ctx->list_cache)
|
||||||
driver.menu_ctx->list_cache(false, 0);
|
driver.menu_ctx->list_cache(driver.menu, false, 0);
|
||||||
|
|
||||||
menu_list_push_stack(list, path, label, type, directory_ptr);
|
menu_list_push_stack(list, path, label, type, directory_ptr);
|
||||||
menu_navigation_clear(driver.menu, true);
|
menu_navigation_clear(driver.menu, true);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user