(Menu) Refactor menu code -move backend menu code to separate driver

This commit is contained in:
twinaphex 2014-04-14 02:32:54 +02:00
parent dcebbf0202
commit 9dfcded389
13 changed files with 1516 additions and 1458 deletions

View File

@ -95,7 +95,7 @@ ifneq ($(findstring Linux,$(OS)),)
endif
ifeq ($(HAVE_RGUI), 1)
OBJ += frontend/menu/menu_input_line_cb.o frontend/menu/menu_common.o frontend/menu/menu_navigation.o frontend/menu/menu_settings.o frontend/menu/file_list.o frontend/menu/disp/rgui.o frontend/menu/history.o
OBJ += frontend/menu/menu_input_line_cb.o frontend/menu/menu_common.o frontend/menu/menu_navigation.o frontend/menu/menu_settings.o frontend/menu/file_list.o frontend/menu/disp/rgui.o frontend/menu/backend/menu_common_backend.o frontend/menu/history.o
DEFINES += -DHAVE_MENU
ifeq ($(HAVE_LAKKA), 1)
OBJ += frontend/menu/disp/lakka.o

View File

@ -70,7 +70,7 @@ endif
ifeq ($(HAVE_RGUI), 1)
DEFINES += -DHAVE_MENU -DHAVE_RGUI
OBJ += frontend/menu/menu_input_line_cb.o frontend/menu/menu_common.o frontend/menu/menu_settings.o frontend/menu/menu_navigation.o frontend/menu/file_list.o frontend/menu/disp/rgui.o frontend/menu/history.o
OBJ += frontend/menu/menu_input_line_cb.o frontend/menu/menu_common.o frontend/menu/menu_settings.o frontend/menu/menu_navigation.o frontend/menu/file_list.o frontend/menu/disp/rgui.o frontend/menu/disp/menu_common_backend.o frontend/menu/history.o
endif
ifeq ($(HAVE_SDL), 1)

View File

@ -114,7 +114,7 @@ JLIBS =
ifeq ($(HAVE_RGUI), 1)
DEFINES += -DHAVE_RGUI -DHAVE_MENU
OBJ += frontend/menu/menu_input_line_cb.o frontend/menu/menu_common.o frontend/menu/menu_settings.o frontend/menu/menu_navigation.o frontend/menu/file_list.o frontend/menu/disp/rgui.o frontend/menu/history.o
OBJ += frontend/menu/menu_input_line_cb.o frontend/menu/menu_common.o frontend/menu/menu_settings.o frontend/menu/menu_navigation.o frontend/menu/file_list.o frontend/menu/disp/rgui.o frontend/menu/backend/menu_common_backend.o frontend/menu/history.o
endif
ifeq ($(HAVE_SDL), 1)

View File

@ -481,6 +481,13 @@ typedef struct video_driver
void (*poke_interface)(void *data, const video_poke_interface_t **iface);
} video_driver_t;
typedef struct menu_ctx_driver_backend
{
void (*entries_init)(void*, unsigned);
int (*iterate)(void *, unsigned);
const char *ident;
} menu_ctx_driver_backend_t;
typedef struct menu_ctx_driver
{
void (*set_texture)(void*, bool);
@ -506,6 +513,7 @@ typedef struct menu_ctx_driver
void (*list_clear)(void *);
void (*list_set_selection)(void *);
const menu_ctx_driver_backend_t *backend;
// Human readable string.
const char *ident;
} menu_ctx_driver_t;
@ -749,6 +757,8 @@ extern const menu_ctx_driver_t menu_ctx_rmenu_xui;
extern const menu_ctx_driver_t menu_ctx_rgui;
extern const menu_ctx_driver_t menu_ctx_lakka;
extern const menu_ctx_driver_backend_t menu_ctx_backend_common;
#include "driver_funcs.h"
#ifdef __cplusplus

File diff suppressed because it is too large Load Diff

View File

@ -736,5 +736,6 @@ const menu_ctx_driver_t menu_ctx_lakka = {
NULL,
NULL,
NULL,
NULL,
"lakka",
};

View File

@ -628,5 +628,6 @@ const menu_ctx_driver_t menu_ctx_rgui = {
NULL,
NULL,
NULL,
&menu_ctx_backend_common,
"rgui",
};

View File

@ -489,5 +489,6 @@ const menu_ctx_driver_t menu_ctx_rmenu = {
NULL,
NULL,
NULL,
&menu_ctx_backend_common,
"rmenu",
};

View File

@ -725,5 +725,6 @@ const menu_ctx_driver_t menu_ctx_rmenu_xui = {
rmenu_xui_list_delete,
rmenu_xui_list_clear,
rmenu_xui_list_set_selection,
&menu_ctx_backend_common,
"rmenu_xui",
};

File diff suppressed because it is too large Load Diff

View File

@ -456,11 +456,14 @@ int menu_settings_toggle_setting(void *data, unsigned setting, unsigned action,
int menu_set_settings(void *data, unsigned setting, unsigned action);
void menu_set_settings_label(char *type_str, size_t type_str_size, unsigned *w, unsigned type);
void menu_populate_entries(void *data, unsigned menu_type);
unsigned menu_type_is(unsigned type);
uint64_t menu_input(void);
void menu_flush_stack_type(void *data, unsigned final_type);
void menu_update_system_info(void *data, bool *load_no_rom);
void menu_build_scroll_indices(void *data, file_list_t *buf);
#ifdef __cplusplus
}
#endif

View File

@ -581,6 +581,10 @@ MENU
#include "../frontend/menu/history.c"
#include "../frontend/menu/file_list.c"
#if defined(HAVE_RMENU) || defined(HAVE_RGUI) || defined(HAVE_RMENU_XUI)
#include "../frontend/menu/backend/menu_common_backend.c"
#endif
#ifdef HAVE_RMENU
#include "../frontend/menu/disp/rmenu.c"
#endif

View File

@ -217,6 +217,7 @@
<ClCompile Include="..\..\file_extract.c" />
<ClCompile Include="..\..\frontend\menu\history.c" />
<ClCompile Include="..\..\frontend\menu\file_list.c" />
<ClCompile Include="..\..\frontend\menu\backend\menu_common_backend.c" />
<ClCompile Include="..\..\frontend\menu\disp\rgui.c" />
<ClCompile Include="..\..\frontend\menu\menu_common.c" />
<ClCompile Include="..\..\frontend\menu\menu_input_line_cb.c" />