From 85ff9e5418c98f2c6b484dcfe9c789818ccca46a Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 28 Oct 2015 15:56:45 +0100 Subject: [PATCH] Can now press driver options --- menu/cbs/menu_cbs_right.c | 2 +- menu/cbs/menu_cbs_select.c | 17 +++++++++++++++++ menu/drivers/glui.c | 14 ++++++++------ menu/menu_cbs.h | 3 +++ 4 files changed, 29 insertions(+), 7 deletions(-) diff --git a/menu/cbs/menu_cbs_right.c b/menu/cbs/menu_cbs_right.c index e264abd361..3c112a6b19 100644 --- a/menu/cbs/menu_cbs_right.c +++ b/menu/cbs/menu_cbs_right.c @@ -365,7 +365,7 @@ static int disk_options_disk_idx_right(unsigned type, const char *label, return 0; } -static int bind_right_generic(unsigned type, const char *label, +int bind_right_generic(unsigned type, const char *label, bool wraparound) { return menu_setting_set(type, label, MENU_ACTION_RIGHT, wraparound); diff --git a/menu/cbs/menu_cbs_select.c b/menu/cbs/menu_cbs_select.c index ed340c8edd..dedc634dc5 100644 --- a/menu/cbs/menu_cbs_select.c +++ b/menu/cbs/menu_cbs_select.c @@ -95,6 +95,12 @@ static int action_select_directory(const char *path, const char *label, unsigned return action_ok_directory_push(path, label, type, idx, 0 /* ignored */); } +static int action_select_driver_setting(const char *path, const char *label, unsigned type, + size_t idx) +{ + return bind_right_generic(type, label, true); +} + static int action_select_core_setting(const char *path, const char *label, unsigned type, size_t idx) { @@ -186,6 +192,17 @@ int menu_cbs_init_bind_select(menu_file_list_cbs_t *cbs, BIND_ACTION_SELECT(cbs, action_select_default); + if (cbs->setting) + { + uint64_t flags = menu_setting_get_flags(cbs->setting); + + if (flags & SD_FLAG_IS_DRIVER) + { + BIND_ACTION_SELECT(cbs, action_select_driver_setting); + return 0; + } + } + if ((type >= MENU_SETTINGS_CORE_OPTION_START)) { BIND_ACTION_SELECT(cbs, action_select_core_setting); diff --git a/menu/drivers/glui.c b/menu/drivers/glui.c index 6f9f37c3be..95b48de59e 100644 --- a/menu/drivers/glui.c +++ b/menu/drivers/glui.c @@ -132,15 +132,12 @@ static void glui_draw_icon(gl_t *gl, glui_handle_t *glui, float rotation, float scale_factor, GRfloat *color) { - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - - if (gl->shader && gl->shader->use) - gl->shader->use(gl, GL_SHADER_STOCK_BLEND); - struct gfx_coords coords; math_matrix_4x4 mymat, mrot, mscal; + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + matrix_4x4_rotate_z(&mrot, rotation); matrix_4x4_multiply(&mymat, &mrot, &gl->mvp_no_rot); @@ -653,6 +650,7 @@ static void glui_frame(void) if (!menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection)) return; + /* highlighted entry */ glui_render_quad(gl, 0, header_height - menu->scroll_y + glui->line_height * selection, width, glui->line_height, @@ -667,11 +665,13 @@ static void glui_frame(void) menu_animation_ctl(MENU_ANIMATION_CTL_SET_ACTIVE, NULL); + /* header */ glui_render_quad(gl, 0, 0, width, header_height, width, height, &blue_bg[0]); + /* shadow underneath header */ glui_render_quad(gl, 0, header_height, width, header_height/12, width, height, @@ -689,6 +689,8 @@ static void glui_frame(void) ticker_limit = (width - glui->margin*2) / glui->glyph_width; menu_animation_ticker_str(title_buf, ticker_limit, *frame_count / 100, title, true); + + /* Title */ glui_blit_line(title_margin, 0, width, height, title_buf, title_color, TEXT_ALIGN_LEFT); diff --git a/menu/menu_cbs.h b/menu/menu_cbs.h index 0045d1f435..9254e30ec1 100644 --- a/menu/menu_cbs.h +++ b/menu/menu_cbs.h @@ -194,6 +194,9 @@ int action_scan_directory(const char *path, int action_scan_file(const char *path, const char *label, unsigned type, size_t idx); +int bind_right_generic(unsigned type, const char *label, + bool wraparound); + void menu_cbs_init(void *data, menu_file_list_cbs_t *cbs, const char *path, const char *label,