2014-09-11 04:07:07 +02:00
|
|
|
/* RetroArch - A frontend for libretro.
|
2016-01-10 04:06:50 +01:00
|
|
|
* Copyright (C) 2011-2016 - Daniel De Matteis
|
2015-01-07 17:46:50 +01:00
|
|
|
* Copyright (C) 2014-2015 - Jean-André Santoni
|
2014-09-11 04:07:07 +02:00
|
|
|
*
|
|
|
|
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
|
|
|
* of the GNU General Public License as published by the Free Software Found-
|
|
|
|
* ation, either version 3 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
|
|
|
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
|
|
* PURPOSE. See the GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along with RetroArch.
|
|
|
|
* If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2015-01-26 10:54:13 +01:00
|
|
|
#include <stdint.h>
|
2014-09-11 04:07:07 +02:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stddef.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <limits.h>
|
|
|
|
|
2015-06-05 18:22:15 +02:00
|
|
|
#include <compat/posix_string.h>
|
|
|
|
#include <file/file_path.h>
|
2015-11-08 01:30:07 +01:00
|
|
|
#include <formats/image.h>
|
|
|
|
#include <gfx/math/matrix_4x4.h>
|
2015-12-26 07:37:44 +01:00
|
|
|
#include <string/stdstring.h>
|
2016-03-20 14:53:54 +01:00
|
|
|
#include <lists/string_list.h>
|
2015-06-05 18:22:15 +02:00
|
|
|
|
2015-10-03 03:15:47 +02:00
|
|
|
#include "menu_generic.h"
|
|
|
|
|
2015-06-04 10:39:48 +02:00
|
|
|
#include "../menu_driver.h"
|
2015-09-27 01:10:15 +02:00
|
|
|
#include "../menu_animation.h"
|
2015-12-09 09:53:43 +01:00
|
|
|
#include "../menu_navigation.h"
|
2015-04-21 14:44:14 +02:00
|
|
|
#include "../menu_display.h"
|
2015-02-11 03:40:29 +01:00
|
|
|
|
2015-12-11 13:56:00 +01:00
|
|
|
#include "../../core_info.h"
|
2015-11-08 01:30:07 +01:00
|
|
|
#include "../../configuration.h"
|
2016-02-04 11:28:12 +01:00
|
|
|
#include "../../frontend/frontend_driver.h"
|
2016-03-21 19:23:45 +01:00
|
|
|
#include "../../retroarch.h"
|
2016-01-13 11:36:17 +01:00
|
|
|
#include "../../system.h"
|
2015-11-08 01:30:07 +01:00
|
|
|
#include "../../runloop.h"
|
2015-11-23 12:03:38 +01:00
|
|
|
#include "../../verbosity.h"
|
2016-02-09 17:12:39 +01:00
|
|
|
#include "../../tasks/tasks_internal.h"
|
2014-09-11 04:07:07 +02:00
|
|
|
|
2016-06-11 19:41:26 +02:00
|
|
|
#include "../../file_path_special.h"
|
|
|
|
|
2015-10-27 18:18:56 +07:00
|
|
|
enum
|
|
|
|
{
|
2015-11-05 16:53:14 +07:00
|
|
|
MUI_TEXTURE_POINTER = 0,
|
|
|
|
MUI_TEXTURE_BACK,
|
|
|
|
MUI_TEXTURE_SWITCH_ON,
|
|
|
|
MUI_TEXTURE_SWITCH_OFF,
|
2016-07-11 12:39:00 +01:00
|
|
|
MUI_TEXTURE_TAB_MAIN,
|
|
|
|
MUI_TEXTURE_TAB_PLAYLISTS,
|
|
|
|
MUI_TEXTURE_TAB_SETTINGS,
|
2015-11-05 16:53:14 +07:00
|
|
|
MUI_TEXTURE_LAST
|
2015-10-27 18:18:56 +07:00
|
|
|
};
|
|
|
|
|
2015-10-29 00:59:06 +07:00
|
|
|
enum
|
|
|
|
{
|
2015-11-05 16:53:14 +07:00
|
|
|
MUI_SYSTEM_TAB_MAIN = 0,
|
|
|
|
MUI_SYSTEM_TAB_PLAYLISTS,
|
|
|
|
MUI_SYSTEM_TAB_SETTINGS
|
2015-10-29 00:59:06 +07:00
|
|
|
};
|
|
|
|
|
2015-11-05 16:53:14 +07:00
|
|
|
#define MUI_SYSTEM_TAB_END MUI_SYSTEM_TAB_SETTINGS
|
2015-10-29 00:59:06 +07:00
|
|
|
|
2015-11-05 16:55:32 +07:00
|
|
|
typedef struct mui_handle
|
2014-10-10 16:23:12 +02:00
|
|
|
{
|
2015-10-29 02:05:38 +07:00
|
|
|
unsigned tabs_height;
|
2014-10-10 16:23:12 +02:00
|
|
|
unsigned line_height;
|
2015-11-05 17:27:00 +07:00
|
|
|
unsigned shadow_height;
|
2015-11-05 17:42:36 +07:00
|
|
|
unsigned scrollbar_width;
|
2015-10-27 22:49:48 +07:00
|
|
|
unsigned icon_size;
|
2014-10-11 03:15:02 +02:00
|
|
|
unsigned margin;
|
2015-07-16 03:38:07 +02:00
|
|
|
unsigned glyph_width;
|
2015-01-07 20:42:36 +01:00
|
|
|
char box_message[PATH_MAX_LENGTH];
|
2015-04-21 14:20:18 +07:00
|
|
|
|
2016-04-19 07:35:26 +02:00
|
|
|
struct
|
|
|
|
{
|
|
|
|
int size;
|
|
|
|
} cursor;
|
|
|
|
|
2015-10-27 18:18:56 +07:00
|
|
|
struct
|
2015-02-13 00:20:39 +01:00
|
|
|
{
|
|
|
|
struct
|
|
|
|
{
|
2015-10-27 18:18:56 +07:00
|
|
|
float alpha;
|
|
|
|
} arrow;
|
|
|
|
|
2016-03-05 08:40:28 +01:00
|
|
|
menu_texture_item bg;
|
|
|
|
menu_texture_item list[MUI_TEXTURE_LAST];
|
2015-02-13 00:20:39 +01:00
|
|
|
} textures;
|
2015-03-25 11:04:53 -03:00
|
|
|
|
2015-10-29 00:59:06 +07:00
|
|
|
struct
|
|
|
|
{
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
unsigned idx;
|
|
|
|
unsigned idx_old;
|
|
|
|
} active;
|
|
|
|
|
|
|
|
float x_pos;
|
|
|
|
size_t selection_ptr_old;
|
|
|
|
size_t selection_ptr;
|
|
|
|
} categories;
|
|
|
|
|
2016-05-10 02:42:02 +02:00
|
|
|
video_font_raster_block_t list_block;
|
2015-12-10 14:50:43 +01:00
|
|
|
float scroll_y;
|
2015-11-05 16:55:32 +07:00
|
|
|
} mui_handle_t;
|
2014-09-11 04:07:07 +02:00
|
|
|
|
2016-07-10 17:06:43 +02:00
|
|
|
static void hex32_to_rgba_normalized(uint32_t hex, float* rgba, float alpha)
|
|
|
|
{
|
|
|
|
rgba[0] = rgba[4] = rgba[8] = rgba[12] = ((hex >> 16) & 0xFF) * (1.0f / 255.0f); /* r */
|
|
|
|
rgba[1] = rgba[5] = rgba[9] = rgba[13] = ((hex >> 8 ) & 0xFF) * (1.0f / 255.0f); /* g */
|
|
|
|
rgba[2] = rgba[6] = rgba[10] = rgba[14] = ((hex >> 0 ) & 0xFF) * (1.0f / 255.0f); /* b */
|
|
|
|
rgba[3] = rgba[7] = rgba[11] = rgba[15] = alpha;
|
|
|
|
}
|
|
|
|
|
2016-04-18 02:24:37 +02:00
|
|
|
static const char *mui_texture_path(unsigned id)
|
|
|
|
{
|
|
|
|
switch (id)
|
|
|
|
{
|
|
|
|
case MUI_TEXTURE_POINTER:
|
|
|
|
return "pointer.png";
|
|
|
|
case MUI_TEXTURE_BACK:
|
|
|
|
return "back.png";
|
|
|
|
case MUI_TEXTURE_SWITCH_ON:
|
|
|
|
return "on.png";
|
|
|
|
case MUI_TEXTURE_SWITCH_OFF:
|
|
|
|
return "off.png";
|
2016-07-11 12:39:00 +01:00
|
|
|
case MUI_TEXTURE_TAB_MAIN:
|
2016-04-18 02:24:37 +02:00
|
|
|
return "main_tab_passive.png";
|
2016-07-11 12:39:00 +01:00
|
|
|
case MUI_TEXTURE_TAB_PLAYLISTS:
|
2016-04-18 02:24:37 +02:00
|
|
|
return "playlists_tab_passive.png";
|
2016-07-11 12:39:00 +01:00
|
|
|
case MUI_TEXTURE_TAB_SETTINGS:
|
2016-04-18 02:24:37 +02:00
|
|
|
return "settings_tab_passive.png";
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2016-06-11 19:43:14 +02:00
|
|
|
static void mui_context_reset_textures(mui_handle_t *mui)
|
2015-10-27 18:18:56 +07:00
|
|
|
{
|
|
|
|
unsigned i;
|
2016-06-11 19:43:14 +02:00
|
|
|
char iconpath[PATH_MAX_LENGTH] = {0};
|
|
|
|
|
2016-06-11 19:55:27 +02:00
|
|
|
fill_pathname_application_special(iconpath, sizeof(iconpath),
|
|
|
|
APPLICATION_SPECIAL_DIRECTORY_ASSETS_MATERIALUI_ICONS);
|
2015-10-27 18:18:56 +07:00
|
|
|
|
2015-11-05 16:53:14 +07:00
|
|
|
for (i = 0; i < MUI_TEXTURE_LAST; i++)
|
2015-10-27 18:18:56 +07:00
|
|
|
{
|
|
|
|
struct texture_image ti = {0};
|
|
|
|
char path[PATH_MAX_LENGTH] = {0};
|
2016-04-18 02:24:37 +02:00
|
|
|
const char *texture_path = mui_texture_path(i);
|
2015-10-27 18:18:56 +07:00
|
|
|
|
2016-04-18 02:24:37 +02:00
|
|
|
if (texture_path != NULL)
|
|
|
|
fill_pathname_join(path, iconpath, texture_path, sizeof(path));
|
2015-10-27 18:18:56 +07:00
|
|
|
|
2015-12-26 07:37:44 +01:00
|
|
|
if (string_is_empty(path) || !path_file_exists(path))
|
2015-10-27 18:18:56 +07:00
|
|
|
continue;
|
|
|
|
|
2016-05-18 12:57:44 +02:00
|
|
|
image_texture_load(&ti, path);
|
2016-02-09 01:45:37 +01:00
|
|
|
video_driver_texture_load(&ti,
|
2016-03-02 22:17:05 +01:00
|
|
|
TEXTURE_FILTER_MIPMAP_LINEAR, &mui->textures.list[i]);
|
2016-05-18 12:57:44 +02:00
|
|
|
image_texture_free(&ti);
|
2015-10-27 18:18:56 +07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-04-21 09:28:22 +02:00
|
|
|
static void mui_draw_icon(
|
|
|
|
unsigned icon_size,
|
2015-11-08 01:30:07 +01:00
|
|
|
uintptr_t texture,
|
2015-10-27 22:49:48 +07:00
|
|
|
float x, float y,
|
|
|
|
unsigned width, unsigned height,
|
|
|
|
float rotation, float scale_factor,
|
2015-11-08 01:30:07 +01:00
|
|
|
float *color)
|
2015-10-27 22:49:48 +07:00
|
|
|
{
|
2016-02-09 04:43:15 +01:00
|
|
|
menu_display_ctx_rotate_draw_t rotate_draw;
|
2016-02-09 04:34:07 +01:00
|
|
|
menu_display_ctx_draw_t draw;
|
2016-05-10 02:32:49 +02:00
|
|
|
struct video_coords coords;
|
2015-11-02 19:47:25 +01:00
|
|
|
math_matrix_4x4 mymat;
|
2015-10-27 22:49:48 +07:00
|
|
|
|
2016-05-08 12:33:28 +02:00
|
|
|
menu_display_blend_begin();
|
2015-10-28 16:00:30 +01:00
|
|
|
|
2016-02-09 04:43:15 +01:00
|
|
|
rotate_draw.matrix = &mymat;
|
|
|
|
rotate_draw.rotation = rotation;
|
|
|
|
rotate_draw.scale_x = scale_factor;
|
|
|
|
rotate_draw.scale_y = scale_factor;
|
|
|
|
rotate_draw.scale_z = 1;
|
|
|
|
rotate_draw.scale_enable = true;
|
|
|
|
|
2016-05-08 12:33:28 +02:00
|
|
|
menu_display_rotate_z(&rotate_draw);
|
2015-10-27 22:49:48 +07:00
|
|
|
|
|
|
|
coords.vertices = 4;
|
2015-11-02 22:37:29 +01:00
|
|
|
coords.vertex = NULL;
|
2015-11-02 22:46:23 +01:00
|
|
|
coords.tex_coord = NULL;
|
|
|
|
coords.lut_tex_coord = NULL;
|
2015-10-27 22:49:48 +07:00
|
|
|
coords.color = (const float*)color;
|
|
|
|
|
2016-04-21 09:28:22 +02:00
|
|
|
draw.x = x;
|
|
|
|
draw.y = height - y - icon_size;
|
|
|
|
draw.width = icon_size;
|
|
|
|
draw.height = icon_size;
|
|
|
|
draw.coords = &coords;
|
|
|
|
draw.matrix_data = &mymat;
|
|
|
|
draw.texture = texture;
|
|
|
|
draw.prim_type = MENU_DISPLAY_PRIM_TRIANGLESTRIP;
|
2016-05-08 11:11:28 +02:00
|
|
|
draw.pipeline.id = 0;
|
2016-02-09 04:34:07 +01:00
|
|
|
|
2016-05-08 12:33:28 +02:00
|
|
|
menu_display_draw(&draw);
|
|
|
|
menu_display_blend_end();
|
2015-10-27 22:49:48 +07:00
|
|
|
}
|
2015-10-27 18:18:56 +07:00
|
|
|
|
2015-11-15 01:42:04 +01:00
|
|
|
static void mui_draw_tab(mui_handle_t *mui,
|
|
|
|
unsigned i,
|
|
|
|
unsigned width, unsigned height,
|
2016-07-11 01:30:45 +02:00
|
|
|
float *tab_color,
|
|
|
|
float *active_tab_color)
|
2015-11-15 01:42:04 +01:00
|
|
|
{
|
2016-05-26 17:32:27 +02:00
|
|
|
unsigned tab_icon = 0;
|
|
|
|
|
2015-11-15 01:42:04 +01:00
|
|
|
switch (i)
|
|
|
|
{
|
|
|
|
case MUI_SYSTEM_TAB_MAIN:
|
2016-07-11 12:39:00 +01:00
|
|
|
tab_icon = MUI_TEXTURE_TAB_MAIN;
|
2016-04-21 09:28:22 +02:00
|
|
|
if (i == mui->categories.selection_ptr)
|
2016-07-11 01:30:45 +02:00
|
|
|
tab_color = active_tab_color;
|
2015-11-15 01:42:04 +01:00
|
|
|
break;
|
|
|
|
case MUI_SYSTEM_TAB_PLAYLISTS:
|
2016-07-11 12:39:00 +01:00
|
|
|
tab_icon = MUI_TEXTURE_TAB_PLAYLISTS;
|
2016-04-21 09:28:22 +02:00
|
|
|
if (i == mui->categories.selection_ptr)
|
2016-07-11 01:30:45 +02:00
|
|
|
tab_color = active_tab_color;
|
2015-11-15 01:42:04 +01:00
|
|
|
break;
|
|
|
|
case MUI_SYSTEM_TAB_SETTINGS:
|
2016-07-11 12:39:00 +01:00
|
|
|
tab_icon = MUI_TEXTURE_TAB_SETTINGS;
|
2016-04-21 09:28:22 +02:00
|
|
|
if (i == mui->categories.selection_ptr)
|
2016-07-11 01:30:45 +02:00
|
|
|
tab_color = active_tab_color;
|
2015-11-15 01:42:04 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2016-04-22 08:07:03 +02:00
|
|
|
mui_draw_icon(
|
|
|
|
mui->icon_size,
|
2016-04-21 09:28:22 +02:00
|
|
|
mui->textures.list[tab_icon],
|
2015-11-15 01:42:04 +01:00
|
|
|
width / (MUI_SYSTEM_TAB_END+1) * (i+0.5) - mui->icon_size/2,
|
|
|
|
height - mui->tabs_height,
|
2016-04-21 09:28:22 +02:00
|
|
|
width,
|
|
|
|
height,
|
|
|
|
0,
|
|
|
|
1,
|
2016-07-03 16:35:07 +01:00
|
|
|
&tab_color[0]); /* default color is pure_white */
|
2015-11-15 01:42:04 +01:00
|
|
|
}
|
|
|
|
|
2016-04-20 07:07:14 +02:00
|
|
|
static void mui_draw_text(float x, float y, unsigned width, unsigned height,
|
2016-04-20 06:56:19 +02:00
|
|
|
const char *msg, uint32_t color, enum text_alignment text_align)
|
2014-09-11 04:07:07 +02:00
|
|
|
{
|
2016-04-20 23:25:52 +07:00
|
|
|
int font_size;
|
2015-12-06 14:46:50 +01:00
|
|
|
struct font_params params;
|
2015-04-21 08:36:09 +07:00
|
|
|
|
2016-05-08 12:33:28 +02:00
|
|
|
font_size = menu_display_get_font_size();
|
2016-04-20 23:25:52 +07:00
|
|
|
|
|
|
|
params.x = x / width;
|
|
|
|
params.y = 1.0f - (y + font_size / 3) / height;
|
2015-12-06 14:46:50 +01:00
|
|
|
params.scale = 1.0f;
|
|
|
|
params.drop_mod = 0.0f;
|
|
|
|
params.drop_x = 0.0f;
|
|
|
|
params.drop_y = 0.0f;
|
2015-03-14 19:44:27 -03:00
|
|
|
params.color = color;
|
2014-09-11 04:07:07 +02:00
|
|
|
params.full_screen = true;
|
2015-04-04 21:26:11 +02:00
|
|
|
params.text_align = text_align;
|
2015-01-19 06:44:46 +01:00
|
|
|
|
2016-04-20 06:56:19 +02:00
|
|
|
menu_display_draw_text(msg, width, height, ¶ms);
|
2014-09-11 04:07:07 +02:00
|
|
|
}
|
|
|
|
|
2015-12-10 15:49:37 +01:00
|
|
|
static void mui_render_quad(mui_handle_t *mui,
|
|
|
|
int x, int y, unsigned w, unsigned h,
|
2015-09-06 20:38:45 +02:00
|
|
|
unsigned width, unsigned height,
|
2015-11-08 01:30:07 +01:00
|
|
|
float *coord_color)
|
2014-10-27 00:55:14 +01:00
|
|
|
{
|
2016-02-09 04:34:07 +01:00
|
|
|
menu_display_ctx_draw_t draw;
|
2016-05-10 02:32:49 +02:00
|
|
|
struct video_coords coords;
|
2015-11-02 18:47:19 +01:00
|
|
|
|
2015-01-10 23:45:14 +01:00
|
|
|
coords.vertices = 4;
|
2015-11-02 22:37:29 +01:00
|
|
|
coords.vertex = NULL;
|
2015-11-02 22:46:23 +01:00
|
|
|
coords.tex_coord = NULL;
|
|
|
|
coords.lut_tex_coord = NULL;
|
2015-09-06 20:36:17 +02:00
|
|
|
coords.color = coord_color;
|
2014-10-27 00:55:14 +01:00
|
|
|
|
2016-05-08 12:33:28 +02:00
|
|
|
menu_display_blend_begin();
|
2015-11-01 19:24:35 +01:00
|
|
|
|
2016-02-09 04:34:07 +01:00
|
|
|
draw.x = x;
|
|
|
|
draw.y = (int)height - y - (int)h;
|
|
|
|
draw.width = w;
|
|
|
|
draw.height = h;
|
|
|
|
draw.coords = &coords;
|
|
|
|
draw.matrix_data = NULL;
|
2016-04-12 04:30:25 +07:00
|
|
|
draw.texture = menu_display_white_texture;
|
2016-02-09 04:34:07 +01:00
|
|
|
draw.prim_type = MENU_DISPLAY_PRIM_TRIANGLESTRIP;
|
2016-05-08 11:11:28 +02:00
|
|
|
draw.pipeline.id = 0;
|
2016-02-09 04:34:07 +01:00
|
|
|
|
2016-05-08 12:33:28 +02:00
|
|
|
menu_display_draw(&draw);
|
|
|
|
menu_display_blend_end();
|
2014-10-27 00:55:14 +01:00
|
|
|
}
|
|
|
|
|
2015-11-15 01:42:04 +01:00
|
|
|
static void mui_draw_tab_begin(mui_handle_t *mui,
|
|
|
|
unsigned width, unsigned height,
|
2016-07-03 16:35:07 +01:00
|
|
|
float *tabs_bg_color, float *tabs_separator_color)
|
2015-11-15 01:42:04 +01:00
|
|
|
{
|
2016-05-08 12:33:28 +02:00
|
|
|
float scale_factor = menu_display_get_dpi();
|
2015-11-15 01:42:04 +01:00
|
|
|
|
|
|
|
mui->tabs_height = scale_factor / 3;
|
|
|
|
|
|
|
|
/* tabs background */
|
2015-12-10 15:49:37 +01:00
|
|
|
mui_render_quad(mui, 0, height - mui->tabs_height, width,
|
2015-11-15 01:42:04 +01:00
|
|
|
mui->tabs_height,
|
|
|
|
width, height,
|
2016-07-03 16:35:07 +01:00
|
|
|
tabs_bg_color); /* white_bg */
|
2015-11-15 01:42:04 +01:00
|
|
|
|
|
|
|
/* tabs separator */
|
2015-12-10 15:49:37 +01:00
|
|
|
mui_render_quad(mui, 0, height - mui->tabs_height, width,
|
2015-11-15 01:42:04 +01:00
|
|
|
1,
|
|
|
|
width, height,
|
2016-07-03 16:35:07 +01:00
|
|
|
tabs_separator_color); /* grey_bg */
|
2015-11-15 01:42:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void mui_draw_tab_end(mui_handle_t *mui,
|
|
|
|
unsigned width, unsigned height,
|
|
|
|
unsigned header_height,
|
2016-07-03 16:35:07 +01:00
|
|
|
float *active_tab_marker_color)
|
2015-11-15 01:42:04 +01:00
|
|
|
{
|
|
|
|
/* active tab marker */
|
|
|
|
unsigned tab_width = width / (MUI_SYSTEM_TAB_END+1);
|
|
|
|
|
2015-12-10 15:49:37 +01:00
|
|
|
mui_render_quad(mui, mui->categories.selection_ptr * tab_width,
|
2015-11-15 01:42:04 +01:00
|
|
|
height - (header_height/16),
|
|
|
|
tab_width,
|
|
|
|
header_height/16,
|
|
|
|
width, height,
|
2016-07-10 17:06:43 +02:00
|
|
|
&active_tab_marker_color[0]); /* blue_500 */
|
2015-11-15 01:42:04 +01:00
|
|
|
}
|
|
|
|
|
2015-12-10 15:31:17 +01:00
|
|
|
static void mui_draw_scrollbar(mui_handle_t *mui,
|
|
|
|
unsigned width, unsigned height, float *coord_color)
|
2015-04-21 09:47:02 +07:00
|
|
|
{
|
2015-09-25 21:52:04 +02:00
|
|
|
unsigned header_height;
|
2016-02-04 21:31:41 +01:00
|
|
|
float content_height, total_height,
|
|
|
|
scrollbar_height, scrollbar_margin, y;
|
2015-04-21 09:47:02 +07:00
|
|
|
|
2015-11-05 17:52:37 +07:00
|
|
|
if (!mui)
|
2015-04-21 09:47:02 +07:00
|
|
|
return;
|
|
|
|
|
2016-05-08 12:33:28 +02:00
|
|
|
header_height = menu_display_get_header_height();
|
2015-09-25 21:52:04 +02:00
|
|
|
|
2015-11-05 17:42:36 +07:00
|
|
|
content_height = menu_entries_get_end() * mui->line_height;
|
|
|
|
total_height = height - header_height - mui->tabs_height;
|
|
|
|
scrollbar_margin = mui->scrollbar_width;
|
|
|
|
scrollbar_height = total_height / (content_height / total_height);
|
2015-12-10 14:50:43 +01:00
|
|
|
y = total_height * mui->scroll_y / content_height;
|
2015-11-05 17:42:36 +07:00
|
|
|
|
|
|
|
/* apply a margin on the top and bottom of the scrollbar for aestetic */
|
|
|
|
scrollbar_height -= scrollbar_margin * 2;
|
|
|
|
y += scrollbar_margin;
|
2015-04-21 09:47:02 +07:00
|
|
|
|
2015-09-06 20:14:40 +02:00
|
|
|
if (content_height >= total_height)
|
2015-09-28 23:00:22 +02:00
|
|
|
{
|
2015-11-05 17:42:36 +07:00
|
|
|
/* if the scrollbar is extremely short, display it as a square */
|
|
|
|
if (scrollbar_height <= mui->scrollbar_width)
|
|
|
|
scrollbar_height = mui->scrollbar_width;
|
2015-09-28 23:00:22 +02:00
|
|
|
|
2015-12-10 15:49:37 +01:00
|
|
|
mui_render_quad(mui,
|
2015-11-05 17:42:36 +07:00
|
|
|
width - mui->scrollbar_width - scrollbar_margin,
|
|
|
|
header_height + y,
|
|
|
|
mui->scrollbar_width,
|
2015-10-28 06:05:05 +01:00
|
|
|
scrollbar_height,
|
2015-09-06 20:38:45 +02:00
|
|
|
width, height,
|
2015-09-06 20:36:17 +02:00
|
|
|
coord_color);
|
2015-09-28 23:00:22 +02:00
|
|
|
}
|
2015-04-21 09:47:02 +07:00
|
|
|
}
|
|
|
|
|
2015-12-10 14:40:56 +01:00
|
|
|
static void mui_get_message(void *data, const char *message)
|
2014-09-15 12:36:52 +02:00
|
|
|
{
|
2015-12-10 14:40:56 +01:00
|
|
|
mui_handle_t *mui = (mui_handle_t*)data;
|
2014-09-15 12:36:52 +02:00
|
|
|
|
2015-11-05 17:52:37 +07:00
|
|
|
if (!mui || !message || !*message)
|
2014-09-15 12:36:52 +02:00
|
|
|
return;
|
|
|
|
|
2015-11-05 17:52:37 +07:00
|
|
|
strlcpy(mui->box_message, message, sizeof(mui->box_message));
|
2014-09-15 12:36:52 +02:00
|
|
|
}
|
|
|
|
|
2015-11-05 16:55:32 +07:00
|
|
|
static void mui_render_messagebox(const char *message)
|
2014-09-11 04:07:07 +02:00
|
|
|
{
|
2015-11-05 17:52:37 +07:00
|
|
|
unsigned i, width, height;
|
2016-07-03 16:35:07 +01:00
|
|
|
uint32_t font_normal_color;
|
2015-09-26 23:37:25 +02:00
|
|
|
int x, y, font_size;
|
2015-06-05 18:12:57 +02:00
|
|
|
settings_t *settings = config_get_ptr();
|
2015-12-10 13:48:41 +01:00
|
|
|
struct string_list *list = (struct string_list*)
|
|
|
|
string_split(message, "\n");
|
2014-10-10 16:23:12 +02:00
|
|
|
|
2014-09-15 12:36:52 +02:00
|
|
|
if (!list)
|
|
|
|
return;
|
|
|
|
if (list->elems == 0)
|
2015-02-02 18:51:48 +01:00
|
|
|
goto end;
|
2014-09-15 12:36:52 +02:00
|
|
|
|
2015-05-20 00:29:46 +02:00
|
|
|
video_driver_get_size(&width, &height);
|
2015-05-20 00:26:50 +02:00
|
|
|
|
2016-05-08 12:33:28 +02:00
|
|
|
font_size = menu_display_get_font_size();
|
2015-09-26 23:37:25 +02:00
|
|
|
|
2015-05-20 00:26:50 +02:00
|
|
|
x = width / 2;
|
2015-09-26 23:37:25 +02:00
|
|
|
y = height / 2 - list->size * font_size / 2;
|
2014-10-10 16:23:12 +02:00
|
|
|
|
2016-07-03 16:35:07 +01:00
|
|
|
font_normal_color = FONT_COLOR_ARGB_TO_RGBA(settings->menu.entry_normal_color);
|
2015-03-15 12:51:55 -03:00
|
|
|
|
2014-09-15 12:36:52 +02:00
|
|
|
for (i = 0; i < list->size; i++)
|
|
|
|
{
|
|
|
|
const char *msg = list->elems[i].data;
|
2015-02-02 18:51:48 +01:00
|
|
|
if (msg)
|
2016-04-20 07:07:14 +02:00
|
|
|
mui_draw_text(x, y + i * font_size,
|
2015-09-06 20:14:40 +02:00
|
|
|
width, height,
|
2016-07-03 16:35:07 +01:00
|
|
|
msg, font_normal_color, TEXT_ALIGN_CENTER);
|
2014-09-15 12:36:52 +02:00
|
|
|
}
|
|
|
|
|
2015-02-02 18:51:48 +01:00
|
|
|
end:
|
2014-09-15 12:36:52 +02:00
|
|
|
string_list_free(list);
|
2014-09-11 04:07:07 +02:00
|
|
|
}
|
|
|
|
|
2015-12-10 14:45:34 +01:00
|
|
|
static void mui_render(void *data)
|
2014-09-11 04:07:07 +02:00
|
|
|
{
|
2015-12-12 14:39:35 +01:00
|
|
|
size_t i = 0;
|
2016-02-25 16:05:30 +01:00
|
|
|
menu_animation_ctx_delta_t delta;
|
|
|
|
float delta_time;
|
2015-11-05 17:52:37 +07:00
|
|
|
unsigned bottom, width, height, header_height;
|
2015-12-10 14:45:34 +01:00
|
|
|
mui_handle_t *mui = (mui_handle_t*)data;
|
2015-11-05 17:05:26 +07:00
|
|
|
settings_t *settings = config_get_ptr();
|
2015-02-13 19:00:34 +01:00
|
|
|
|
2015-11-05 17:52:37 +07:00
|
|
|
if (!mui)
|
2015-02-13 19:00:34 +01:00
|
|
|
return;
|
2014-09-11 04:07:07 +02:00
|
|
|
|
2015-05-20 00:29:46 +02:00
|
|
|
video_driver_get_size(&width, &height);
|
2015-05-20 00:26:50 +02:00
|
|
|
|
2015-09-25 23:37:02 +02:00
|
|
|
menu_animation_ctl(MENU_ANIMATION_CTL_DELTA_TIME, &delta_time);
|
2016-02-25 16:05:30 +01:00
|
|
|
|
|
|
|
delta.current = delta_time;
|
|
|
|
|
|
|
|
if (menu_animation_ctl(MENU_ANIMATION_CTL_IDEAL_DELTA_TIME_GET, &delta))
|
|
|
|
menu_animation_ctl(MENU_ANIMATION_CTL_UPDATE, &delta.ideal);
|
2015-04-20 21:22:55 +07:00
|
|
|
|
2016-05-08 12:33:28 +02:00
|
|
|
menu_display_set_width(width);
|
|
|
|
menu_display_set_height(height);
|
|
|
|
header_height = menu_display_get_header_height();
|
2015-02-27 07:27:58 +01:00
|
|
|
|
2015-04-04 21:26:11 +02:00
|
|
|
if (settings->menu.pointer.enable)
|
|
|
|
{
|
2015-09-24 17:21:50 +02:00
|
|
|
int16_t pointer_y = menu_input_pointer_state(MENU_POINTER_Y_AXIS);
|
2015-09-24 20:32:21 +02:00
|
|
|
float old_accel_val, new_accel_val;
|
2015-09-24 19:56:53 +02:00
|
|
|
unsigned new_pointer_val =
|
2015-12-10 14:50:43 +01:00
|
|
|
(pointer_y - mui->line_height + mui->scroll_y - 16)
|
2015-11-05 16:55:32 +07:00
|
|
|
/ mui->line_height;
|
2015-04-04 21:26:11 +02:00
|
|
|
|
2015-09-26 02:52:05 +02:00
|
|
|
menu_input_ctl(MENU_INPUT_CTL_POINTER_ACCEL_READ, &old_accel_val);
|
|
|
|
menu_input_ctl(MENU_INPUT_CTL_POINTER_PTR, &new_pointer_val);
|
2015-09-24 19:56:53 +02:00
|
|
|
|
2015-12-10 14:50:43 +01:00
|
|
|
mui->scroll_y -= old_accel_val / 60.0;
|
2015-09-24 20:32:21 +02:00
|
|
|
|
|
|
|
new_accel_val = old_accel_val * 0.96;
|
|
|
|
|
2015-09-26 02:52:05 +02:00
|
|
|
menu_input_ctl(MENU_INPUT_CTL_POINTER_ACCEL_WRITE, &new_accel_val);
|
2015-04-04 21:26:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (settings->menu.mouse.enable)
|
|
|
|
{
|
2015-09-24 23:33:41 +02:00
|
|
|
int16_t mouse_y = menu_input_mouse_state(MENU_MOUSE_Y_AXIS);
|
2015-09-24 17:34:44 +02:00
|
|
|
|
2015-10-27 18:18:56 +07:00
|
|
|
unsigned new_pointer_val =
|
2015-12-10 14:50:43 +01:00
|
|
|
(mouse_y - mui->line_height + mui->scroll_y - 16)
|
2015-11-05 16:55:32 +07:00
|
|
|
/ mui->line_height;
|
2015-11-05 17:05:26 +07:00
|
|
|
|
2015-10-27 18:18:56 +07:00
|
|
|
menu_input_ctl(MENU_INPUT_CTL_MOUSE_PTR, &new_pointer_val);
|
2015-04-04 21:26:11 +02:00
|
|
|
}
|
2014-09-11 04:07:07 +02:00
|
|
|
|
2015-12-10 14:50:43 +01:00
|
|
|
if (mui->scroll_y < 0)
|
|
|
|
mui->scroll_y = 0;
|
2015-04-04 21:26:11 +02:00
|
|
|
|
2015-11-05 16:55:32 +07:00
|
|
|
bottom = menu_entries_get_end() * mui->line_height
|
|
|
|
- height + header_height + mui->tabs_height;
|
2015-12-10 14:50:43 +01:00
|
|
|
if (mui->scroll_y > bottom)
|
|
|
|
mui->scroll_y = bottom;
|
2015-04-04 21:26:11 +02:00
|
|
|
|
2015-11-05 16:55:32 +07:00
|
|
|
if (menu_entries_get_end() * mui->line_height
|
|
|
|
< height - header_height - mui->tabs_height)
|
2015-12-10 14:50:43 +01:00
|
|
|
mui->scroll_y = 0;
|
2015-07-14 00:38:16 +02:00
|
|
|
|
2015-12-12 14:39:35 +01:00
|
|
|
if (menu_entries_get_end() < height / mui->line_height) { }
|
2015-07-14 00:38:16 +02:00
|
|
|
else
|
2015-12-12 14:39:35 +01:00
|
|
|
i = mui->scroll_y / mui->line_height;
|
|
|
|
|
|
|
|
menu_entries_ctl(MENU_ENTRIES_CTL_SET_START, &i);
|
2015-03-08 19:50:12 +01:00
|
|
|
}
|
|
|
|
|
2015-11-05 16:55:32 +07:00
|
|
|
static void mui_render_label_value(mui_handle_t *mui,
|
2015-09-06 20:14:40 +02:00
|
|
|
int y, unsigned width, unsigned height,
|
2015-10-28 00:51:22 +07:00
|
|
|
uint64_t index, uint32_t color, bool selected, const char *label,
|
2016-07-11 12:39:00 +01:00
|
|
|
const char *value, float *label_color)
|
2015-07-15 19:27:19 -03:00
|
|
|
{
|
2016-07-11 12:39:00 +01:00
|
|
|
/* This will be used instead of label_color if texture_switch is 'off' icon */
|
|
|
|
float pure_white[16]= {
|
|
|
|
1.00, 1.00, 1.00, 1.00,
|
|
|
|
1.00, 1.00, 1.00, 1.00,
|
|
|
|
1.00, 1.00, 1.00, 1.00,
|
|
|
|
1.00, 1.00, 1.00, 1.00,
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2016-02-25 15:19:33 +01:00
|
|
|
menu_animation_ctx_ticker_t ticker;
|
2016-06-03 04:12:18 +02:00
|
|
|
char label_str[PATH_MAX_LENGTH] = {0};
|
|
|
|
char value_str[PATH_MAX_LENGTH] = {0};
|
|
|
|
int value_len = strlen(value);
|
|
|
|
int ticker_limit = 0;
|
|
|
|
uintptr_t texture_switch = 0;
|
|
|
|
bool do_draw_text = false;
|
|
|
|
size_t usable_width = width - (mui->margin * 2);
|
2015-07-15 20:55:43 -03:00
|
|
|
|
2015-11-05 16:55:32 +07:00
|
|
|
if (value_len * mui->glyph_width > usable_width / 2)
|
|
|
|
value_len = (usable_width/2) / mui->glyph_width;
|
2015-07-16 03:38:07 +02:00
|
|
|
|
2015-11-05 16:55:32 +07:00
|
|
|
ticker_limit = (usable_width / mui->glyph_width) - (value_len + 2);
|
2015-07-16 03:38:07 +02:00
|
|
|
|
2016-02-25 15:19:33 +01:00
|
|
|
ticker.s = label_str;
|
|
|
|
ticker.len = ticker_limit;
|
|
|
|
ticker.idx = index;
|
|
|
|
ticker.str = label;
|
|
|
|
ticker.selected = selected;
|
|
|
|
|
|
|
|
menu_animation_ctl(MENU_ANIMATION_CTL_TICKER, &ticker);
|
|
|
|
|
|
|
|
ticker.s = value_str;
|
|
|
|
ticker.len = value_len;
|
|
|
|
ticker.str = value;
|
|
|
|
|
|
|
|
menu_animation_ctl(MENU_ANIMATION_CTL_TICKER, &ticker);
|
2015-07-15 19:27:19 -03:00
|
|
|
|
2016-04-20 07:07:14 +02:00
|
|
|
mui_draw_text(mui->margin, y + mui->line_height / 2,
|
2015-11-05 16:33:49 +07:00
|
|
|
width, height, label_str, color, TEXT_ALIGN_LEFT);
|
2015-10-28 00:51:22 +07:00
|
|
|
|
2016-07-11 12:55:40 +01:00
|
|
|
bool switch_is_on = true;
|
2016-01-20 04:54:17 +01:00
|
|
|
if (string_is_equal(value, "disabled") || string_is_equal(value, "off"))
|
2015-10-28 00:51:22 +07:00
|
|
|
{
|
2016-07-11 12:39:00 +01:00
|
|
|
if (mui->textures.list[MUI_TEXTURE_SWITCH_OFF]) {
|
2016-03-02 22:17:05 +01:00
|
|
|
texture_switch = mui->textures.list[MUI_TEXTURE_SWITCH_OFF];
|
2016-07-11 12:55:40 +01:00
|
|
|
switch_is_on = false;
|
2016-07-11 12:39:00 +01:00
|
|
|
}
|
2015-10-28 01:36:36 +01:00
|
|
|
else
|
|
|
|
do_draw_text = true;
|
|
|
|
}
|
2016-01-20 04:54:17 +01:00
|
|
|
else if (string_is_equal(value, "enabled") || string_is_equal(value, "on"))
|
2015-10-28 01:36:36 +01:00
|
|
|
{
|
2016-07-11 12:39:00 +01:00
|
|
|
if (mui->textures.list[MUI_TEXTURE_SWITCH_ON]) {
|
2016-03-02 22:17:05 +01:00
|
|
|
texture_switch = mui->textures.list[MUI_TEXTURE_SWITCH_ON];
|
2016-07-11 12:55:40 +01:00
|
|
|
switch_is_on = true;
|
2016-07-11 12:39:00 +01:00
|
|
|
}
|
2015-10-28 01:36:36 +01:00
|
|
|
else
|
2015-10-28 00:51:22 +07:00
|
|
|
do_draw_text = true;
|
2015-10-28 01:36:36 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2016-06-20 15:33:22 +02:00
|
|
|
switch (msg_hash_to_file_type(msg_hash_calculate(value)))
|
2015-10-28 01:36:36 +01:00
|
|
|
{
|
2016-06-20 15:50:37 +02:00
|
|
|
case FILE_TYPE_COMPRESSED:
|
|
|
|
case FILE_TYPE_MORE:
|
|
|
|
case FILE_TYPE_CORE:
|
|
|
|
case FILE_TYPE_RDB:
|
|
|
|
case FILE_TYPE_CURSOR:
|
|
|
|
case FILE_TYPE_PLAIN:
|
|
|
|
case FILE_TYPE_DIRECTORY:
|
|
|
|
case FILE_TYPE_MUSIC:
|
|
|
|
case FILE_TYPE_IMAGE:
|
|
|
|
case FILE_TYPE_MOVIE:
|
2015-10-28 01:36:36 +01:00
|
|
|
break;
|
2016-06-20 15:50:37 +02:00
|
|
|
case FILE_TYPE_BOOL_ON:
|
2016-07-11 12:55:40 +01:00
|
|
|
if (mui->textures.list[MUI_TEXTURE_SWITCH_ON]) {
|
2016-03-02 22:17:05 +01:00
|
|
|
texture_switch = mui->textures.list[MUI_TEXTURE_SWITCH_ON];
|
2016-07-11 12:55:40 +01:00
|
|
|
switch_is_on = true;
|
|
|
|
}
|
2015-10-28 01:36:36 +01:00
|
|
|
else
|
|
|
|
do_draw_text = true;
|
|
|
|
break;
|
2016-06-20 15:50:37 +02:00
|
|
|
case FILE_TYPE_BOOL_OFF:
|
2016-07-11 12:55:40 +01:00
|
|
|
if (mui->textures.list[MUI_TEXTURE_SWITCH_OFF]) {
|
2016-03-02 22:17:05 +01:00
|
|
|
texture_switch = mui->textures.list[MUI_TEXTURE_SWITCH_OFF];
|
2016-07-11 12:55:40 +01:00
|
|
|
switch_is_on = false;
|
|
|
|
}
|
2015-10-28 01:36:36 +01:00
|
|
|
else
|
|
|
|
do_draw_text = true;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
do_draw_text = true;
|
|
|
|
break;
|
|
|
|
}
|
2015-10-28 00:51:22 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
if (do_draw_text)
|
2016-04-20 07:07:14 +02:00
|
|
|
mui_draw_text(width - mui->margin,
|
2015-11-05 16:55:32 +07:00
|
|
|
y + mui->line_height / 2,
|
2015-11-05 16:33:49 +07:00
|
|
|
width, height, value_str, color, TEXT_ALIGN_RIGHT);
|
2015-10-28 00:51:22 +07:00
|
|
|
|
|
|
|
if (texture_switch)
|
2016-04-22 08:07:03 +02:00
|
|
|
mui_draw_icon(
|
|
|
|
mui->icon_size,
|
2016-04-21 09:28:22 +02:00
|
|
|
texture_switch,
|
|
|
|
width - mui->margin - mui->icon_size,
|
|
|
|
y,
|
|
|
|
width,
|
|
|
|
height,
|
|
|
|
0,
|
|
|
|
1,
|
2016-07-11 12:55:40 +01:00
|
|
|
switch_is_on ? &label_color[0] : &pure_white[0]
|
2016-07-11 12:39:00 +01:00
|
|
|
);
|
2015-07-15 19:27:19 -03:00
|
|
|
}
|
|
|
|
|
2015-11-05 16:55:32 +07:00
|
|
|
static void mui_render_menu_list(mui_handle_t *mui,
|
2015-09-06 20:14:40 +02:00
|
|
|
unsigned width, unsigned height,
|
2016-07-03 16:35:07 +01:00
|
|
|
uint32_t font_normal_color,
|
|
|
|
uint32_t font_hover_color,
|
|
|
|
float *menu_list_color)
|
2015-04-15 21:53:35 +02:00
|
|
|
{
|
2015-09-25 21:52:04 +02:00
|
|
|
unsigned header_height;
|
2015-11-20 15:08:27 +01:00
|
|
|
uint64_t *frame_count;
|
2015-07-14 00:38:16 +02:00
|
|
|
size_t i = 0;
|
|
|
|
size_t end = menu_entries_get_end();
|
2016-05-08 14:00:51 +02:00
|
|
|
frame_count = video_driver_get_frame_count_ptr();
|
2015-04-15 21:53:35 +02:00
|
|
|
|
2016-05-08 12:33:28 +02:00
|
|
|
if (!menu_display_get_update_pending())
|
2015-04-24 22:46:19 +02:00
|
|
|
return;
|
2015-04-15 21:53:35 +02:00
|
|
|
|
2016-05-08 12:33:28 +02:00
|
|
|
header_height = menu_display_get_header_height();
|
2015-09-25 21:52:04 +02:00
|
|
|
|
2015-11-05 16:55:32 +07:00
|
|
|
mui->list_block.carr.coords.vertices = 0;
|
2015-04-15 21:53:35 +02:00
|
|
|
|
2015-12-12 14:39:35 +01:00
|
|
|
menu_entries_ctl(MENU_ENTRIES_CTL_START_GET, &i);
|
|
|
|
|
|
|
|
for (; i < end; i++)
|
2015-04-15 21:53:35 +02:00
|
|
|
{
|
2015-09-25 14:57:37 +02:00
|
|
|
int y;
|
|
|
|
size_t selection;
|
2016-07-08 16:55:21 +02:00
|
|
|
char rich_label[PATH_MAX_LENGTH] = {0};
|
|
|
|
bool entry_selected = false;
|
|
|
|
menu_entry_t entry = {{0}};
|
2015-07-15 19:27:19 -03:00
|
|
|
|
2015-09-25 14:57:37 +02:00
|
|
|
if (!menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection))
|
|
|
|
continue;
|
|
|
|
|
2015-12-10 14:50:43 +01:00
|
|
|
y = header_height - mui->scroll_y + (mui->line_height * i);
|
2015-06-05 14:05:05 -03:00
|
|
|
|
2015-11-05 16:55:32 +07:00
|
|
|
if ((y - (int)mui->line_height) > (int)height
|
|
|
|
|| ((y + (int)mui->line_height) < 0))
|
2015-06-05 14:05:05 -03:00
|
|
|
continue;
|
|
|
|
|
2015-10-27 23:52:20 +01:00
|
|
|
menu_entry_get(&entry, 0, i, NULL, true);
|
2016-07-08 16:55:21 +02:00
|
|
|
menu_entry_get_rich_label(i, rich_label, sizeof(rich_label));
|
2015-07-14 00:38:16 +02:00
|
|
|
|
2015-09-25 14:57:37 +02:00
|
|
|
entry_selected = selection == i;
|
2015-04-15 21:53:35 +02:00
|
|
|
|
2016-07-03 16:35:07 +01:00
|
|
|
mui_render_label_value(
|
|
|
|
mui,
|
|
|
|
y,
|
|
|
|
width,
|
|
|
|
height,
|
|
|
|
*frame_count / 20,
|
|
|
|
entry_selected ? font_hover_color : font_normal_color,
|
|
|
|
entry_selected,
|
|
|
|
rich_label,
|
|
|
|
entry.value,
|
|
|
|
menu_list_color /* pure_white */
|
|
|
|
);
|
2015-04-15 21:53:35 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-10-27 18:18:56 +07:00
|
|
|
|
2016-02-25 19:27:06 +01:00
|
|
|
static size_t mui_list_get_size(void *data, enum menu_list_type type)
|
2015-10-29 18:36:57 +07:00
|
|
|
{
|
2015-10-30 16:28:27 +07:00
|
|
|
switch (type)
|
2015-10-29 18:36:57 +07:00
|
|
|
{
|
2015-10-30 16:28:27 +07:00
|
|
|
case MENU_LIST_PLAIN:
|
2016-03-03 06:59:54 +01:00
|
|
|
return menu_entries_get_stack_size(0);
|
2015-10-30 16:28:27 +07:00
|
|
|
case MENU_LIST_TABS:
|
2016-03-03 06:59:54 +01:00
|
|
|
return MUI_SYSTEM_TAB_END;
|
2015-10-30 16:28:27 +07:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2015-10-29 18:36:57 +07:00
|
|
|
|
2016-03-03 06:59:54 +01:00
|
|
|
return 0;
|
2015-10-29 18:36:57 +07:00
|
|
|
}
|
|
|
|
|
2016-01-13 11:36:17 +01:00
|
|
|
static int mui_get_core_title(char *s, size_t len)
|
|
|
|
{
|
|
|
|
struct retro_system_info *system = NULL;
|
|
|
|
rarch_system_info_t *info = NULL;
|
|
|
|
settings_t *settings = config_get_ptr();
|
|
|
|
const char *core_name = NULL;
|
|
|
|
const char *core_version = NULL;
|
|
|
|
|
|
|
|
menu_driver_ctl(RARCH_MENU_CTL_SYSTEM_INFO_GET,
|
|
|
|
&system);
|
|
|
|
|
|
|
|
core_name = system->library_name;
|
|
|
|
core_version = system->library_version;
|
|
|
|
|
|
|
|
if (!settings->menu.core_enable)
|
|
|
|
return -1;
|
|
|
|
|
2016-05-26 18:09:46 +02:00
|
|
|
if (runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &info))
|
|
|
|
{
|
2016-06-01 05:18:59 +02:00
|
|
|
if (info)
|
|
|
|
{
|
|
|
|
if (string_is_empty(core_name))
|
|
|
|
core_name = info->info.library_name;
|
|
|
|
if (!core_version)
|
|
|
|
core_version = info->info.library_version;
|
|
|
|
}
|
2016-05-26 18:09:46 +02:00
|
|
|
}
|
2016-01-13 11:36:17 +01:00
|
|
|
|
2016-05-26 18:09:46 +02:00
|
|
|
if (string_is_empty(core_name))
|
2016-06-20 00:31:13 +02:00
|
|
|
core_name = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NO_CORE);
|
2016-01-13 11:36:17 +01:00
|
|
|
if (!core_version)
|
|
|
|
core_version = "";
|
|
|
|
|
|
|
|
snprintf(s, len, "%s %s", core_name, core_version);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2016-04-12 22:24:33 +02:00
|
|
|
static void mui_draw_bg(menu_display_ctx_draw_t *draw)
|
|
|
|
{
|
2016-05-08 12:33:28 +02:00
|
|
|
menu_display_blend_begin();
|
|
|
|
|
2016-04-19 07:58:50 +02:00
|
|
|
draw->x = 0;
|
|
|
|
draw->y = 0;
|
2016-05-08 11:11:28 +02:00
|
|
|
draw->pipeline.id = 0;
|
2016-05-08 12:33:28 +02:00
|
|
|
|
|
|
|
menu_display_draw_bg(draw);
|
|
|
|
menu_display_draw(draw);
|
|
|
|
menu_display_blend_end();
|
2016-04-12 22:24:33 +02:00
|
|
|
}
|
|
|
|
|
2015-12-10 15:44:26 +01:00
|
|
|
static void mui_frame(void *data)
|
2015-03-08 19:50:12 +01:00
|
|
|
{
|
2015-11-08 01:30:07 +01:00
|
|
|
float black_bg[16] = {
|
2015-10-27 16:44:56 +07:00
|
|
|
0, 0, 0, 0.75,
|
|
|
|
0, 0, 0, 0.75,
|
|
|
|
0, 0, 0, 0.75,
|
|
|
|
0, 0, 0, 0.75,
|
|
|
|
};
|
2015-11-08 01:30:07 +01:00
|
|
|
float pure_white[16]= {
|
2016-07-10 17:06:43 +02:00
|
|
|
1.00, 1.00, 1.00, 1.00,
|
|
|
|
1.00, 1.00, 1.00, 1.00,
|
|
|
|
1.00, 1.00, 1.00, 1.00,
|
|
|
|
1.00, 1.00, 1.00, 1.00,
|
2015-10-28 00:51:22 +07:00
|
|
|
};
|
2015-11-08 01:30:07 +01:00
|
|
|
float white_bg[16]= {
|
2016-07-10 17:06:43 +02:00
|
|
|
0.98, 0.98, 0.98, 1.00,
|
|
|
|
0.98, 0.98, 0.98, 1.00,
|
|
|
|
0.98, 0.98, 0.98, 1.00,
|
|
|
|
0.98, 0.98, 0.98, 1.00,
|
2015-10-27 16:44:56 +07:00
|
|
|
};
|
2015-11-08 01:30:07 +01:00
|
|
|
float white_transp_bg[16]= {
|
2015-11-01 21:01:26 +01:00
|
|
|
0.98, 0.98, 0.98, 0.90,
|
|
|
|
0.98, 0.98, 0.98, 0.90,
|
|
|
|
0.98, 0.98, 0.98, 0.90,
|
|
|
|
0.98, 0.98, 0.98, 0.90,
|
2015-10-27 16:44:56 +07:00
|
|
|
};
|
2015-11-08 01:30:07 +01:00
|
|
|
float grey_bg[16]= {
|
2016-07-09 13:56:16 +02:00
|
|
|
0.78, 0.78, 0.78, 0.90,
|
|
|
|
0.78, 0.78, 0.78, 0.90,
|
|
|
|
0.78, 0.78, 0.78, 0.90,
|
|
|
|
0.78, 0.78, 0.78, 0.90,
|
2015-10-27 16:44:56 +07:00
|
|
|
};
|
2015-11-08 01:30:07 +01:00
|
|
|
float shadow_bg[16]= {
|
2016-07-10 17:06:43 +02:00
|
|
|
0.00, 0.00, 0.00, 0.00,
|
|
|
|
0.00, 0.00, 0.00, 0.00,
|
|
|
|
0.00, 0.00, 0.00, 0.2,
|
|
|
|
0.00, 0.00, 0.00, 0.2,
|
2015-10-27 20:03:38 +07:00
|
|
|
};
|
2016-07-03 16:35:07 +01:00
|
|
|
float greyish_blue[16] = {
|
2016-07-10 17:06:43 +02:00
|
|
|
0.22, 0.28, 0.31, 1.00,
|
|
|
|
0.22, 0.28, 0.31, 1.00,
|
|
|
|
0.22, 0.28, 0.31, 1.00,
|
|
|
|
0.22, 0.28, 0.31, 1.00,
|
2016-07-03 16:35:07 +01:00
|
|
|
};
|
2016-07-05 10:46:15 +01:00
|
|
|
float almost_black[16] = {
|
2016-07-09 13:17:29 +02:00
|
|
|
0.13, 0.13, 0.13, 0.90,
|
|
|
|
0.13, 0.13, 0.13, 0.90,
|
|
|
|
0.13, 0.13, 0.13, 0.90,
|
|
|
|
0.13, 0.13, 0.13, 0.90,
|
2016-07-05 10:46:15 +01:00
|
|
|
};
|
2016-07-03 16:35:07 +01:00
|
|
|
|
2016-07-11 12:39:00 +01:00
|
|
|
uint32_t black_opaque_54 = 0x0000008a;
|
|
|
|
uint32_t black_opaque_87 = 0x000000de;
|
|
|
|
uint32_t white_opaque_70 = 0xffffffb3;
|
|
|
|
|
2016-07-09 12:55:46 +02:00
|
|
|
/* This controls the main background color */
|
|
|
|
menu_display_ctx_clearcolor_t clearcolor;
|
|
|
|
menu_animation_ctx_ticker_t ticker;
|
|
|
|
menu_display_ctx_draw_t draw;
|
2016-07-10 17:06:43 +02:00
|
|
|
|
|
|
|
/* https://material.google.com/style/color.html#color-color-palette */
|
|
|
|
/* Hex values converted to RGB normalized decimals, alpha set to 1 */
|
|
|
|
float blue_500[16] = {0};
|
|
|
|
float blue_50[16] = {0};
|
|
|
|
float green_500[16] = {0};
|
|
|
|
float green_50[16] = {0};
|
|
|
|
float red_500[16] = {0};
|
|
|
|
float red_50[16] = {0};
|
|
|
|
float yellow_500[16] = {0};
|
2016-07-10 21:23:57 +02:00
|
|
|
float blue_grey_500[16] = {0};
|
2016-07-10 21:31:19 +02:00
|
|
|
float blue_grey_50[16] = {0};
|
2016-07-10 17:06:43 +02:00
|
|
|
float yellow_200[16] = {0};
|
2016-07-11 00:55:07 +02:00
|
|
|
float color_nv_header[16] = {0};
|
|
|
|
float color_nv_body[16] = {0};
|
|
|
|
float color_nv_accent[16] = {0};
|
2016-07-09 12:55:46 +02:00
|
|
|
unsigned width = 0;
|
|
|
|
unsigned height = 0;
|
|
|
|
unsigned ticker_limit = 0;
|
|
|
|
unsigned i = 0;
|
|
|
|
unsigned header_height = 0;
|
|
|
|
size_t selection = 0;
|
|
|
|
size_t title_margin = 0;
|
|
|
|
bool display_kb = false;
|
|
|
|
mui_handle_t *mui = (mui_handle_t*)data;
|
|
|
|
uint64_t *frame_count = video_driver_get_frame_count_ptr();
|
|
|
|
char msg[256] = {0};
|
|
|
|
char title[256] = {0};
|
|
|
|
char title_buf[256] = {0};
|
|
|
|
char title_msg[256] = {0};
|
|
|
|
bool background_rendered = false;
|
|
|
|
bool libretro_running = menu_display_libretro_running();
|
2016-07-10 17:06:43 +02:00
|
|
|
|
|
|
|
/* Default is blue theme */
|
|
|
|
float *header_bg_color = blue_500;
|
|
|
|
float *highlighted_entry_color = blue_50;
|
2016-07-09 12:55:46 +02:00
|
|
|
float *footer_bg_color = white_bg;
|
|
|
|
float *body_bg_color = white_transp_bg;
|
2016-07-09 13:17:29 +02:00
|
|
|
settings_t *settings = config_get_ptr();
|
2016-07-10 17:06:43 +02:00
|
|
|
float *active_tab_marker_color = blue_500;
|
2016-07-03 16:35:07 +01:00
|
|
|
|
2016-07-11 12:39:00 +01:00
|
|
|
uint32_t font_normal_color = black_opaque_54;
|
|
|
|
uint32_t font_hover_color = black_opaque_87;
|
2016-07-09 12:55:46 +02:00
|
|
|
uint32_t font_header_color = 0xffffffff;
|
2016-07-03 16:35:07 +01:00
|
|
|
|
2016-07-10 00:08:54 +02:00
|
|
|
#if 0
|
2016-07-09 12:55:46 +02:00
|
|
|
uint32_t activetab_color = 0x0096f2ff;
|
|
|
|
uint32_t passivetab_color = 0x9e9e9eff;
|
2016-07-10 00:08:54 +02:00
|
|
|
#endif
|
2016-07-09 12:55:46 +02:00
|
|
|
|
|
|
|
if (!mui)
|
|
|
|
return;
|
2016-07-03 16:35:07 +01:00
|
|
|
|
2016-07-10 21:23:57 +02:00
|
|
|
hex32_to_rgba_normalized(0x2196F3, blue_500, 1.00);
|
|
|
|
hex32_to_rgba_normalized(0xE3F2FD, blue_50, 0.90);
|
2016-07-10 17:06:43 +02:00
|
|
|
|
2016-07-03 16:35:07 +01:00
|
|
|
clearcolor.r = 1.0f;
|
|
|
|
clearcolor.g = 1.0f;
|
|
|
|
clearcolor.b = 1.0f;
|
|
|
|
clearcolor.a = 0.75f;
|
|
|
|
|
2016-07-09 13:57:19 +02:00
|
|
|
switch (settings->menu.materialui.menu_color_theme)
|
2016-07-05 10:46:15 +01:00
|
|
|
{
|
2016-07-10 16:11:03 +02:00
|
|
|
case MATERIALUI_THEME_BLUE:
|
2016-07-09 13:57:19 +02:00
|
|
|
break;
|
2016-07-10 21:23:57 +02:00
|
|
|
case MATERIALUI_THEME_BLUE_GREY:
|
2016-07-11 01:01:38 +02:00
|
|
|
hex32_to_rgba_normalized(0x607D8B, blue_grey_500, 1.00);
|
|
|
|
hex32_to_rgba_normalized(0xCFD8DC, blue_grey_50, 0.90);
|
|
|
|
|
2016-07-10 21:23:57 +02:00
|
|
|
header_bg_color = blue_grey_500;
|
|
|
|
body_bg_color = white_transp_bg;
|
2016-07-10 21:31:19 +02:00
|
|
|
highlighted_entry_color = blue_grey_50;
|
2016-07-10 21:23:57 +02:00
|
|
|
footer_bg_color = white_bg;
|
|
|
|
active_tab_marker_color = blue_grey_500;
|
|
|
|
|
2016-07-11 12:39:00 +01:00
|
|
|
font_normal_color = black_opaque_54;
|
|
|
|
font_hover_color = black_opaque_87;
|
2016-07-10 21:23:57 +02:00
|
|
|
font_header_color = 0xffffffff;
|
|
|
|
break;
|
2016-07-10 17:06:43 +02:00
|
|
|
case MATERIALUI_THEME_GREEN:
|
2016-07-11 01:01:38 +02:00
|
|
|
hex32_to_rgba_normalized(0x4CAF50, green_500, 1.00);
|
|
|
|
hex32_to_rgba_normalized(0xC8E6C9, green_50, 0.90);
|
|
|
|
|
2016-07-10 17:06:43 +02:00
|
|
|
header_bg_color = green_500;
|
|
|
|
body_bg_color = white_transp_bg;
|
|
|
|
highlighted_entry_color = green_50;
|
|
|
|
footer_bg_color = white_bg;
|
|
|
|
active_tab_marker_color = green_500;
|
|
|
|
|
2016-07-11 12:39:00 +01:00
|
|
|
font_normal_color = black_opaque_54;
|
|
|
|
font_hover_color = black_opaque_87;
|
2016-07-10 17:06:43 +02:00
|
|
|
font_header_color = 0xffffffff;
|
|
|
|
break;
|
|
|
|
case MATERIALUI_THEME_RED:
|
2016-07-11 01:01:38 +02:00
|
|
|
hex32_to_rgba_normalized(0xF44336, red_500, 1.00);
|
|
|
|
hex32_to_rgba_normalized(0xFFEBEE, red_50, 0.90);
|
|
|
|
|
2016-07-10 17:06:43 +02:00
|
|
|
header_bg_color = red_500;
|
|
|
|
body_bg_color = white_transp_bg;
|
|
|
|
highlighted_entry_color = red_50;
|
|
|
|
footer_bg_color = white_bg;
|
|
|
|
body_bg_color = white_transp_bg;
|
|
|
|
active_tab_marker_color = red_500;
|
|
|
|
|
2016-07-11 12:39:00 +01:00
|
|
|
font_normal_color = black_opaque_54;
|
|
|
|
font_hover_color = black_opaque_87;
|
2016-07-10 17:06:43 +02:00
|
|
|
font_header_color = 0xffffffff;
|
|
|
|
break;
|
|
|
|
case MATERIALUI_THEME_YELLOW:
|
2016-07-11 01:01:38 +02:00
|
|
|
hex32_to_rgba_normalized(0xFFEB3B, yellow_500, 1.00);
|
|
|
|
hex32_to_rgba_normalized(0xFFF9C4, yellow_200, 0.90);
|
|
|
|
|
2016-07-10 17:06:43 +02:00
|
|
|
header_bg_color = yellow_500;
|
|
|
|
body_bg_color = white_transp_bg;
|
|
|
|
highlighted_entry_color = yellow_200;
|
|
|
|
footer_bg_color = white_bg;
|
|
|
|
active_tab_marker_color = yellow_500;
|
|
|
|
|
2016-07-11 12:39:00 +01:00
|
|
|
font_normal_color = black_opaque_54;
|
|
|
|
font_hover_color = black_opaque_87;
|
|
|
|
font_header_color = black_opaque_54;
|
2016-07-10 17:06:43 +02:00
|
|
|
break;
|
2016-07-10 16:11:03 +02:00
|
|
|
case MATERIALUI_THEME_DARK_BLUE:
|
2016-07-09 13:57:19 +02:00
|
|
|
header_bg_color = greyish_blue;
|
2016-07-10 17:06:43 +02:00
|
|
|
body_bg_color = almost_black;
|
2016-07-09 13:57:19 +02:00
|
|
|
highlighted_entry_color = grey_bg;
|
|
|
|
footer_bg_color = almost_black;
|
2016-07-10 17:06:43 +02:00
|
|
|
active_tab_marker_color = greyish_blue;
|
2016-07-09 13:57:19 +02:00
|
|
|
|
2016-07-11 12:39:00 +01:00
|
|
|
font_normal_color = white_opaque_70;
|
|
|
|
font_hover_color = 0xffffffff;
|
|
|
|
font_header_color = 0xffffffff;
|
2016-07-09 13:57:19 +02:00
|
|
|
|
2016-07-11 12:39:00 +01:00
|
|
|
clearcolor.r = body_bg_color[0];
|
|
|
|
clearcolor.g = body_bg_color[1];
|
|
|
|
clearcolor.b = body_bg_color[2];
|
2016-07-11 00:55:07 +02:00
|
|
|
break;
|
|
|
|
case MATERIALUI_THEME_NVIDIA_SHIELD:
|
2016-07-11 01:01:38 +02:00
|
|
|
hex32_to_rgba_normalized(0x282F37, color_nv_header,1.00);
|
|
|
|
hex32_to_rgba_normalized(0x202427, color_nv_body, 1.00);
|
2016-07-11 01:36:24 +02:00
|
|
|
hex32_to_rgba_normalized(0x77B900, color_nv_accent,0.90);
|
2016-07-11 01:01:38 +02:00
|
|
|
|
2016-07-11 00:55:07 +02:00
|
|
|
header_bg_color = color_nv_header;
|
|
|
|
body_bg_color = color_nv_body;
|
|
|
|
highlighted_entry_color = color_nv_accent;
|
|
|
|
footer_bg_color = color_nv_body;
|
|
|
|
active_tab_marker_color = color_nv_accent;
|
|
|
|
|
|
|
|
font_normal_color = 0xbbc0c4ff;
|
|
|
|
font_hover_color = 0xffffffff;
|
2016-07-11 12:39:00 +01:00
|
|
|
font_header_color = 0xffffffff;
|
2016-07-11 00:55:07 +02:00
|
|
|
|
|
|
|
clearcolor.r = color_nv_body[0];
|
|
|
|
clearcolor.g = color_nv_body[1];
|
|
|
|
clearcolor.b = color_nv_body[2];
|
2016-07-09 13:57:19 +02:00
|
|
|
break;
|
2016-07-03 16:35:07 +01:00
|
|
|
}
|
|
|
|
|
2015-05-20 00:29:46 +02:00
|
|
|
video_driver_get_size(&width, &height);
|
2015-05-20 00:26:50 +02:00
|
|
|
|
2016-05-08 12:33:28 +02:00
|
|
|
menu_display_set_viewport();
|
|
|
|
header_height = menu_display_get_header_height();
|
2014-09-11 04:07:07 +02:00
|
|
|
|
2015-11-01 19:49:19 +01:00
|
|
|
if (libretro_running)
|
2015-10-31 17:06:08 +01:00
|
|
|
{
|
2016-02-09 04:34:07 +01:00
|
|
|
memset(&draw, 0, sizeof(menu_display_ctx_draw_t));
|
|
|
|
|
|
|
|
draw.width = width;
|
|
|
|
draw.height = height;
|
2016-04-12 04:30:25 +07:00
|
|
|
draw.texture = menu_display_white_texture;
|
2016-07-05 10:53:33 +01:00
|
|
|
draw.color = &body_bg_color[0];
|
2016-02-09 04:34:07 +01:00
|
|
|
draw.vertex = NULL;
|
|
|
|
draw.tex_coord = NULL;
|
|
|
|
draw.vertex_count = 4;
|
|
|
|
draw.prim_type = MENU_DISPLAY_PRIM_TRIANGLESTRIP;
|
|
|
|
|
2016-05-08 12:33:28 +02:00
|
|
|
if (!menu_display_libretro_running() && draw.texture)
|
2016-04-12 20:07:23 +02:00
|
|
|
draw.color = &white_bg[0];
|
|
|
|
|
2016-04-12 22:24:33 +02:00
|
|
|
mui_draw_bg(&draw);
|
2015-11-01 19:49:19 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2016-05-08 12:33:28 +02:00
|
|
|
menu_display_clear_color(&clearcolor);
|
2015-11-01 19:49:19 +01:00
|
|
|
|
2016-03-02 22:17:05 +01:00
|
|
|
if (mui->textures.bg)
|
2015-10-31 23:09:14 +01:00
|
|
|
{
|
|
|
|
background_rendered = true;
|
2015-11-01 21:01:26 +01:00
|
|
|
|
2016-04-21 04:34:02 +02:00
|
|
|
menu_display_set_alpha(white_transp_bg, 0.30);
|
2015-11-01 21:01:26 +01:00
|
|
|
|
2016-02-09 04:34:07 +01:00
|
|
|
memset(&draw, 0, sizeof(menu_display_ctx_draw_t));
|
|
|
|
|
|
|
|
draw.width = width;
|
|
|
|
draw.height = height;
|
2016-03-02 22:17:05 +01:00
|
|
|
draw.texture = mui->textures.bg;
|
2016-02-09 04:34:07 +01:00
|
|
|
draw.color = &white_transp_bg[0];
|
|
|
|
draw.vertex = NULL;
|
|
|
|
draw.tex_coord = NULL;
|
|
|
|
draw.vertex_count = 4;
|
|
|
|
draw.prim_type = MENU_DISPLAY_PRIM_TRIANGLESTRIP;
|
|
|
|
|
2016-05-08 12:33:28 +02:00
|
|
|
if (!menu_display_libretro_running() && draw.texture)
|
2016-04-12 20:07:23 +02:00
|
|
|
draw.color = &white_bg[0];
|
|
|
|
|
2016-04-12 22:24:33 +02:00
|
|
|
mui_draw_bg(&draw);
|
2015-11-01 21:01:26 +01:00
|
|
|
|
2015-11-01 21:02:45 +01:00
|
|
|
/* Restore opacity of transposed white background */
|
2016-04-21 04:34:02 +02:00
|
|
|
menu_display_set_alpha(white_transp_bg, 0.90);
|
2015-10-31 23:09:14 +01:00
|
|
|
}
|
2015-10-31 17:06:08 +01:00
|
|
|
}
|
|
|
|
|
2015-05-15 00:07:07 +02:00
|
|
|
menu_entries_get_title(title, sizeof(title));
|
2014-09-11 04:07:07 +02:00
|
|
|
|
2015-09-25 14:57:37 +02:00
|
|
|
if (!menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection))
|
|
|
|
return;
|
|
|
|
|
2015-10-31 23:09:14 +01:00
|
|
|
if (background_rendered || libretro_running)
|
2016-07-10 17:06:43 +02:00
|
|
|
menu_display_set_alpha(blue_50, 0.75);
|
2015-10-31 23:09:14 +01:00
|
|
|
else
|
2016-07-10 17:06:43 +02:00
|
|
|
menu_display_set_alpha(blue_50, 1.0);
|
2015-11-05 17:19:42 +07:00
|
|
|
|
2015-10-28 15:56:45 +01:00
|
|
|
/* highlighted entry */
|
2016-07-03 16:35:07 +01:00
|
|
|
mui_render_quad(
|
|
|
|
mui,
|
|
|
|
0,
|
|
|
|
header_height - mui->scroll_y + mui->line_height *selection,
|
|
|
|
width,
|
|
|
|
mui->line_height,
|
|
|
|
width,
|
|
|
|
height,
|
|
|
|
&highlighted_entry_color[0]
|
|
|
|
);
|
2015-10-27 16:44:56 +07:00
|
|
|
|
2016-05-08 12:33:28 +02:00
|
|
|
menu_display_font_bind_block(&mui->list_block);
|
2015-10-27 16:44:56 +07:00
|
|
|
|
2016-07-03 16:35:07 +01:00
|
|
|
mui_render_menu_list(
|
|
|
|
mui,
|
|
|
|
width,
|
|
|
|
height,
|
|
|
|
font_normal_color,
|
|
|
|
font_hover_color,
|
2016-07-11 12:55:40 +01:00
|
|
|
&active_tab_marker_color[0]
|
2016-07-03 16:35:07 +01:00
|
|
|
);
|
2015-10-27 16:44:56 +07:00
|
|
|
|
2016-05-08 12:33:28 +02:00
|
|
|
menu_display_font_flush_block();
|
2015-09-25 23:42:00 +02:00
|
|
|
menu_animation_ctl(MENU_ANIMATION_CTL_SET_ACTIVE, NULL);
|
2015-04-04 21:26:11 +02:00
|
|
|
|
2015-10-28 15:56:45 +01:00
|
|
|
/* header */
|
2016-07-03 16:35:07 +01:00
|
|
|
mui_render_quad(
|
|
|
|
mui,
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
width,
|
|
|
|
header_height,
|
|
|
|
width,
|
|
|
|
height,
|
|
|
|
&header_bg_color[0]);
|
2015-04-04 21:26:11 +02:00
|
|
|
|
2015-11-15 01:42:04 +01:00
|
|
|
mui->tabs_height = 0;
|
|
|
|
|
2015-10-29 18:36:57 +07:00
|
|
|
/* display tabs if depth equal one, if not hide them */
|
2015-12-10 15:23:43 +01:00
|
|
|
if (mui_list_get_size(mui, MENU_LIST_PLAIN) == 1)
|
2015-10-29 18:36:57 +07:00
|
|
|
{
|
2016-07-03 16:35:07 +01:00
|
|
|
mui_draw_tab_begin(mui, width, height, &footer_bg_color[0], &grey_bg[0]);
|
2015-10-29 02:05:38 +07:00
|
|
|
|
2015-11-05 16:53:14 +07:00
|
|
|
for (i = 0; i <= MUI_SYSTEM_TAB_END; i++)
|
2016-07-11 01:30:45 +02:00
|
|
|
mui_draw_tab(mui, i, width, height, &pure_white[0], &active_tab_marker_color[0]);
|
2015-10-29 02:34:52 +07:00
|
|
|
|
2016-07-10 17:06:43 +02:00
|
|
|
mui_draw_tab_end(mui, width, height, header_height, &active_tab_marker_color[0]);
|
2015-10-29 02:05:38 +07:00
|
|
|
}
|
|
|
|
|
2016-07-03 16:35:07 +01:00
|
|
|
mui_render_quad(
|
|
|
|
mui,
|
|
|
|
0,
|
|
|
|
header_height,
|
|
|
|
width,
|
|
|
|
mui->shadow_height,
|
|
|
|
width,
|
|
|
|
height,
|
|
|
|
&shadow_bg[0]);
|
2015-10-27 20:03:38 +07:00
|
|
|
|
2015-11-05 16:55:32 +07:00
|
|
|
title_margin = mui->margin;
|
2015-04-04 21:26:11 +02:00
|
|
|
|
2015-12-11 21:34:27 +01:00
|
|
|
if (menu_entries_ctl(MENU_ENTRIES_CTL_SHOW_BACK, NULL))
|
2015-10-28 09:54:08 +07:00
|
|
|
{
|
2015-11-05 16:55:32 +07:00
|
|
|
title_margin = mui->icon_size;
|
2016-04-22 08:07:03 +02:00
|
|
|
mui_draw_icon(
|
2016-07-03 16:35:07 +01:00
|
|
|
mui->icon_size,
|
|
|
|
mui->textures.list[MUI_TEXTURE_BACK],
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
width,
|
|
|
|
height,
|
|
|
|
0,
|
|
|
|
1,
|
|
|
|
&pure_white[0]
|
|
|
|
);
|
2015-10-28 09:54:08 +07:00
|
|
|
}
|
|
|
|
|
2015-11-05 16:55:32 +07:00
|
|
|
ticker_limit = (width - mui->margin*2) / mui->glyph_width;
|
2016-02-25 15:19:33 +01:00
|
|
|
|
|
|
|
ticker.s = title_buf;
|
|
|
|
ticker.len = ticker_limit;
|
|
|
|
ticker.idx = *frame_count / 100;
|
|
|
|
ticker.str = title;
|
|
|
|
ticker.selected = true;
|
|
|
|
|
|
|
|
menu_animation_ctl(MENU_ANIMATION_CTL_TICKER, &ticker);
|
2015-10-28 15:56:45 +01:00
|
|
|
|
|
|
|
/* Title */
|
2016-01-13 11:36:17 +01:00
|
|
|
if (mui_get_core_title(title_msg, sizeof(title_msg)) == 0)
|
|
|
|
{
|
2016-01-13 11:52:44 +01:00
|
|
|
int ticker_limit, value_len;
|
2016-06-03 04:12:18 +02:00
|
|
|
char title_buf_msg_tmp[256] = {0};
|
|
|
|
char title_buf_msg[256] = {0};
|
|
|
|
size_t usable_width = width - (mui->margin * 2);
|
2016-01-13 11:52:44 +01:00
|
|
|
|
2016-02-04 21:31:41 +01:00
|
|
|
snprintf(title_buf_msg, sizeof(title_buf), "%s (%s)",
|
|
|
|
title_buf, title_msg);
|
2016-01-13 11:52:44 +01:00
|
|
|
value_len = strlen(title_buf);
|
|
|
|
ticker_limit = (usable_width / mui->glyph_width) - (value_len + 2);
|
|
|
|
|
2016-02-25 15:19:33 +01:00
|
|
|
ticker.s = title_buf_msg_tmp;
|
|
|
|
ticker.len = ticker_limit;
|
|
|
|
ticker.idx = *frame_count / 20;
|
|
|
|
ticker.str = title_buf_msg;
|
|
|
|
ticker.selected = true;
|
|
|
|
|
|
|
|
menu_animation_ctl(MENU_ANIMATION_CTL_TICKER, &ticker);
|
2016-01-13 11:52:44 +01:00
|
|
|
|
|
|
|
strlcpy(title_buf, title_buf_msg_tmp, sizeof(title_buf));
|
2016-01-13 11:36:17 +01:00
|
|
|
}
|
|
|
|
|
2016-04-20 07:07:14 +02:00
|
|
|
mui_draw_text(title_margin, header_height / 2, width, height,
|
2016-07-03 16:35:07 +01:00
|
|
|
title_buf, font_header_color, TEXT_ALIGN_LEFT);
|
2015-04-04 21:26:11 +02:00
|
|
|
|
2015-12-10 15:31:17 +01:00
|
|
|
mui_draw_scrollbar(mui, width, height, &grey_bg[0]);
|
2015-04-21 09:47:02 +07:00
|
|
|
|
2015-09-26 02:52:05 +02:00
|
|
|
menu_input_ctl(MENU_INPUT_CTL_KEYBOARD_DISPLAY, &display_kb);
|
2015-09-24 20:08:11 +02:00
|
|
|
|
|
|
|
if (display_kb)
|
2014-09-11 04:07:07 +02:00
|
|
|
{
|
2015-09-24 20:08:11 +02:00
|
|
|
const char *str = NULL, *label = NULL;
|
2015-09-26 02:52:05 +02:00
|
|
|
menu_input_ctl(MENU_INPUT_CTL_KEYBOARD_BUFF_PTR, &str);
|
|
|
|
menu_input_ctl(MENU_INPUT_CTL_KEYBOARD_LABEL, &label);
|
2015-06-13 00:09:09 +02:00
|
|
|
|
2014-09-11 04:07:07 +02:00
|
|
|
if (!str)
|
|
|
|
str = "";
|
2015-12-10 15:49:37 +01:00
|
|
|
mui_render_quad(mui, 0, 0, width, height, width, height, &black_bg[0]);
|
2015-09-24 20:08:11 +02:00
|
|
|
snprintf(msg, sizeof(msg), "%s\n%s", label, str);
|
2015-11-05 16:55:32 +07:00
|
|
|
mui_render_messagebox(msg);
|
2014-09-11 04:07:07 +02:00
|
|
|
}
|
|
|
|
|
2015-12-26 07:37:44 +01:00
|
|
|
if (!string_is_empty(mui->box_message))
|
2014-09-15 12:36:52 +02:00
|
|
|
{
|
2015-12-10 15:49:37 +01:00
|
|
|
mui_render_quad(mui, 0, 0, width, height, width, height, &black_bg[0]);
|
2015-11-05 16:55:32 +07:00
|
|
|
mui_render_messagebox(mui->box_message);
|
|
|
|
mui->box_message[0] = '\0';
|
2014-09-15 12:36:52 +02:00
|
|
|
}
|
|
|
|
|
2016-04-21 05:08:36 +02:00
|
|
|
menu_display_draw_cursor(
|
|
|
|
&white_bg[0],
|
|
|
|
mui->cursor.size,
|
|
|
|
mui->textures.list[MUI_TEXTURE_POINTER],
|
|
|
|
menu_input_mouse_state(MENU_MOUSE_X_AXIS),
|
|
|
|
menu_input_mouse_state(MENU_MOUSE_Y_AXIS),
|
|
|
|
width,
|
|
|
|
height);
|
2015-03-27 16:17:11 -03:00
|
|
|
|
2016-05-08 12:33:28 +02:00
|
|
|
menu_display_restore_clear_color();
|
|
|
|
menu_display_unset_viewport();
|
2014-09-11 04:07:07 +02:00
|
|
|
}
|
|
|
|
|
2015-12-10 15:31:17 +01:00
|
|
|
static void mui_layout(mui_handle_t *mui)
|
2015-11-15 04:18:51 +01:00
|
|
|
{
|
|
|
|
void *fb_buf;
|
|
|
|
float scale_factor;
|
|
|
|
int new_font_size;
|
|
|
|
unsigned width, height, new_header_height;
|
|
|
|
|
|
|
|
video_driver_get_size(&width, &height);
|
|
|
|
|
2016-02-04 21:31:41 +01:00
|
|
|
/* Mobiles platforms may have very small display metrics
|
|
|
|
* coupled to a high resolution, so we should be DPI aware
|
|
|
|
* to ensure the entries hitboxes are big enough.
|
|
|
|
*
|
|
|
|
* On desktops, we just care about readability, with every widget
|
|
|
|
* size proportional to the display width. */
|
2016-05-08 12:33:28 +02:00
|
|
|
scale_factor = menu_display_get_dpi();
|
2015-11-15 04:18:51 +01:00
|
|
|
|
|
|
|
new_header_height = scale_factor / 3;
|
|
|
|
new_font_size = scale_factor / 9;
|
|
|
|
|
|
|
|
mui->shadow_height = scale_factor / 36;
|
|
|
|
mui->scrollbar_width = scale_factor / 36;
|
|
|
|
mui->tabs_height = scale_factor / 3;
|
|
|
|
mui->line_height = scale_factor / 3;
|
|
|
|
mui->margin = scale_factor / 9;
|
|
|
|
mui->icon_size = scale_factor / 3;
|
|
|
|
|
2016-05-08 12:33:28 +02:00
|
|
|
menu_display_set_header_height(new_header_height);
|
|
|
|
menu_display_set_font_size(new_font_size);
|
2015-11-15 04:18:51 +01:00
|
|
|
|
|
|
|
/* we assume the average glyph aspect ratio is close to 3:4 */
|
|
|
|
mui->glyph_width = new_font_size * 3/4;
|
|
|
|
|
2016-06-11 21:11:57 +02:00
|
|
|
menu_display_font(APPLICATION_SPECIAL_DIRECTORY_ASSETS_MATERIALUI_FONT);
|
2015-11-15 04:18:51 +01:00
|
|
|
|
2016-05-08 12:33:28 +02:00
|
|
|
fb_buf = menu_display_get_font_buffer();
|
2015-11-15 04:18:51 +01:00
|
|
|
|
|
|
|
if (fb_buf) /* calculate a more realistic ticker_limit */
|
|
|
|
{
|
2016-02-04 21:31:41 +01:00
|
|
|
unsigned m_width =
|
|
|
|
font_driver_get_message_width(fb_buf, "a", 1, 1);
|
2015-11-15 04:18:51 +01:00
|
|
|
|
|
|
|
if (m_width)
|
|
|
|
mui->glyph_width = m_width;
|
|
|
|
}
|
|
|
|
}
|
2015-07-06 19:38:34 +07:00
|
|
|
|
2015-12-11 15:14:39 +01:00
|
|
|
static void *mui_init(void **userdata)
|
2014-09-11 04:07:07 +02:00
|
|
|
{
|
2015-11-05 17:05:26 +07:00
|
|
|
mui_handle_t *mui = NULL;
|
2016-02-04 21:31:41 +01:00
|
|
|
menu_handle_t *menu = (menu_handle_t*)
|
|
|
|
calloc(1, sizeof(*menu));
|
2014-09-12 17:18:44 -03:00
|
|
|
|
2015-11-02 20:41:42 +01:00
|
|
|
if (!menu)
|
2015-09-25 21:52:04 +02:00
|
|
|
goto error;
|
2014-09-11 04:07:07 +02:00
|
|
|
|
2016-05-08 12:33:28 +02:00
|
|
|
if (!menu_display_init_first_driver())
|
2015-02-02 18:51:48 +01:00
|
|
|
goto error;
|
2014-09-11 04:07:07 +02:00
|
|
|
|
2015-12-11 14:55:04 +01:00
|
|
|
mui = (mui_handle_t*)calloc(1, sizeof(mui_handle_t));
|
2014-10-10 16:23:12 +02:00
|
|
|
|
2015-12-11 14:55:04 +01:00
|
|
|
if (!mui)
|
2015-02-02 18:51:48 +01:00
|
|
|
goto error;
|
2014-10-10 16:23:12 +02:00
|
|
|
|
2015-12-11 15:14:39 +01:00
|
|
|
*userdata = mui;
|
2014-10-10 16:23:12 +02:00
|
|
|
|
2015-12-10 15:31:17 +01:00
|
|
|
mui_layout(mui);
|
2016-04-12 04:30:25 +07:00
|
|
|
menu_display_allocate_white_texture();
|
2015-05-09 12:24:24 +02:00
|
|
|
|
2016-04-19 07:35:26 +02:00
|
|
|
mui->cursor.size = 64.0;
|
2015-12-11 15:14:39 +01:00
|
|
|
|
2014-09-11 04:07:07 +02:00
|
|
|
return menu;
|
2015-02-02 18:51:48 +01:00
|
|
|
error:
|
|
|
|
if (menu)
|
|
|
|
free(menu);
|
|
|
|
return NULL;
|
2014-09-11 04:07:07 +02:00
|
|
|
}
|
|
|
|
|
2015-11-05 16:55:32 +07:00
|
|
|
static void mui_free(void *data)
|
2014-09-11 04:07:07 +02:00
|
|
|
{
|
2015-12-11 14:38:57 +01:00
|
|
|
mui_handle_t *mui = (mui_handle_t*)data;
|
2015-03-24 17:28:53 -03:00
|
|
|
|
2015-11-05 17:14:51 +07:00
|
|
|
if (!mui)
|
2015-03-29 19:25:48 +02:00
|
|
|
return;
|
|
|
|
|
2016-05-10 02:32:49 +02:00
|
|
|
video_coord_array_free(&mui->list_block.carr);
|
2015-03-24 17:28:53 -03:00
|
|
|
|
2015-12-05 11:34:56 +01:00
|
|
|
font_driver_bind_block(NULL, NULL);
|
2014-09-11 04:07:07 +02:00
|
|
|
}
|
|
|
|
|
2015-11-05 16:55:32 +07:00
|
|
|
static void mui_context_bg_destroy(mui_handle_t *mui)
|
2015-04-25 06:03:26 +02:00
|
|
|
{
|
2015-11-05 16:55:32 +07:00
|
|
|
if (!mui)
|
2015-10-25 02:33:23 +01:00
|
|
|
return;
|
2015-05-11 13:49:46 -03:00
|
|
|
|
2016-03-02 22:17:05 +01:00
|
|
|
video_driver_texture_unload(&mui->textures.bg);
|
2016-04-12 04:30:25 +07:00
|
|
|
video_driver_texture_unload(&menu_display_white_texture);
|
2015-04-25 06:03:26 +02:00
|
|
|
}
|
|
|
|
|
2015-12-10 16:57:48 +01:00
|
|
|
static void mui_context_destroy(void *data)
|
2015-02-13 00:20:39 +01:00
|
|
|
{
|
2015-10-29 00:06:05 +07:00
|
|
|
unsigned i;
|
2015-12-10 16:57:48 +01:00
|
|
|
mui_handle_t *mui = (mui_handle_t*)data;
|
2015-02-13 00:20:39 +01:00
|
|
|
|
2015-11-05 16:55:32 +07:00
|
|
|
if (!mui)
|
2015-10-29 00:06:05 +07:00
|
|
|
return;
|
|
|
|
|
2015-11-05 16:53:14 +07:00
|
|
|
for (i = 0; i < MUI_TEXTURE_LAST; i++)
|
2016-03-02 22:17:05 +01:00
|
|
|
video_driver_texture_unload(&mui->textures.list[i]);
|
2015-10-29 00:06:05 +07:00
|
|
|
|
2016-05-08 12:33:28 +02:00
|
|
|
menu_display_font_main_deinit();
|
2015-05-01 09:02:03 -03:00
|
|
|
|
2015-11-05 16:55:32 +07:00
|
|
|
mui_context_bg_destroy(mui);
|
2015-02-13 00:20:39 +01:00
|
|
|
}
|
|
|
|
|
2016-02-25 19:30:14 +01:00
|
|
|
static bool mui_load_image(void *userdata, void *data, enum menu_image_type type)
|
2015-02-13 00:20:39 +01:00
|
|
|
{
|
2015-12-10 16:51:59 +01:00
|
|
|
mui_handle_t *mui = (mui_handle_t*)userdata;
|
2015-02-13 00:20:39 +01:00
|
|
|
|
2015-06-04 10:39:48 +02:00
|
|
|
switch (type)
|
|
|
|
{
|
|
|
|
case MENU_IMAGE_NONE:
|
|
|
|
break;
|
|
|
|
case MENU_IMAGE_WALLPAPER:
|
2015-11-05 16:55:32 +07:00
|
|
|
mui_context_bg_destroy(mui);
|
2016-02-09 01:45:37 +01:00
|
|
|
video_driver_texture_load(data,
|
2016-03-02 22:17:05 +01:00
|
|
|
TEXTURE_FILTER_MIPMAP_LINEAR, &mui->textures.bg);
|
2016-04-12 04:30:25 +07:00
|
|
|
menu_display_allocate_white_texture();
|
2015-06-04 10:39:48 +02:00
|
|
|
break;
|
2016-04-08 01:42:53 +07:00
|
|
|
case MENU_IMAGE_THUMBNAIL:
|
2015-06-04 10:39:48 +02:00
|
|
|
break;
|
|
|
|
}
|
2015-02-13 00:20:39 +01:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2015-12-10 15:31:17 +01:00
|
|
|
static float mui_get_scroll(mui_handle_t *mui)
|
2014-10-27 00:55:14 +01:00
|
|
|
{
|
2015-09-25 14:57:37 +02:00
|
|
|
size_t selection;
|
2015-11-05 17:09:00 +07:00
|
|
|
unsigned width, height, half = 0;
|
2015-09-25 14:57:37 +02:00
|
|
|
|
2015-12-10 15:31:17 +01:00
|
|
|
if (!mui)
|
2015-09-25 14:57:37 +02:00
|
|
|
return 0;
|
2015-12-10 15:31:17 +01:00
|
|
|
if (!menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection))
|
2015-04-21 11:43:52 +07:00
|
|
|
return 0;
|
2015-04-21 16:59:02 +02:00
|
|
|
|
2015-07-13 22:05:14 +02:00
|
|
|
video_driver_get_size(&width, &height);
|
2015-05-20 00:26:50 +02:00
|
|
|
|
2015-11-05 16:55:32 +07:00
|
|
|
if (mui->line_height)
|
|
|
|
half = (height / mui->line_height) / 2;
|
2015-04-04 21:26:11 +02:00
|
|
|
|
2015-11-05 17:09:00 +07:00
|
|
|
if (selection < half)
|
2015-04-21 11:43:52 +07:00
|
|
|
return 0;
|
2015-11-05 17:05:26 +07:00
|
|
|
|
2015-11-05 16:55:32 +07:00
|
|
|
return ((selection + 2 - half) * mui->line_height);
|
2015-04-21 11:43:52 +07:00
|
|
|
}
|
|
|
|
|
2015-12-11 14:26:51 +01:00
|
|
|
static void mui_navigation_set(void *data, bool scroll)
|
2015-04-21 11:43:52 +07:00
|
|
|
{
|
2016-02-25 15:44:30 +01:00
|
|
|
menu_animation_ctx_entry_t entry;
|
2015-12-11 14:26:51 +01:00
|
|
|
mui_handle_t *mui = (mui_handle_t*)data;
|
|
|
|
float scroll_pos = mui ? mui_get_scroll(mui) : 0.0f;
|
2015-04-20 21:22:55 +07:00
|
|
|
|
2015-12-10 14:50:43 +01:00
|
|
|
if (!mui || !scroll)
|
2015-04-21 11:43:52 +07:00
|
|
|
return;
|
|
|
|
|
2016-02-25 15:44:30 +01:00
|
|
|
entry.duration = 10;
|
|
|
|
entry.target_value = scroll_pos;
|
|
|
|
entry.subject = &mui->scroll_y;
|
|
|
|
entry.easing_enum = EASING_IN_OUT_QUAD;
|
|
|
|
entry.tag = -1;
|
|
|
|
entry.cb = NULL;
|
|
|
|
|
|
|
|
menu_animation_ctl(MENU_ANIMATION_CTL_PUSH, &entry);
|
2014-10-27 00:55:14 +01:00
|
|
|
}
|
|
|
|
|
2015-12-11 14:26:51 +01:00
|
|
|
static void mui_list_set_selection(void *data, file_list_t *list)
|
2015-09-06 01:47:54 +02:00
|
|
|
{
|
2015-12-11 14:26:51 +01:00
|
|
|
mui_navigation_set(data, true);
|
2015-09-06 01:47:54 +02:00
|
|
|
}
|
|
|
|
|
2015-12-10 17:24:56 +01:00
|
|
|
static void mui_navigation_clear(void *data, bool pending_push)
|
2014-12-15 19:03:47 +01:00
|
|
|
{
|
2015-12-12 14:39:35 +01:00
|
|
|
size_t i = 0;
|
2015-12-10 17:24:56 +01:00
|
|
|
mui_handle_t *mui = (mui_handle_t*)data;
|
2015-12-10 14:50:43 +01:00
|
|
|
if (!mui)
|
2015-04-21 11:43:52 +07:00
|
|
|
return;
|
|
|
|
|
2015-12-12 14:39:35 +01:00
|
|
|
menu_entries_ctl(MENU_ENTRIES_CTL_SET_START, &i);
|
2015-12-10 14:50:43 +01:00
|
|
|
mui->scroll_y = 0;
|
2015-04-21 11:43:52 +07:00
|
|
|
}
|
|
|
|
|
2015-12-11 14:26:51 +01:00
|
|
|
static void mui_navigation_set_last(void *data)
|
2015-04-21 11:43:52 +07:00
|
|
|
{
|
2015-12-11 14:26:51 +01:00
|
|
|
mui_navigation_set(data, true);
|
2014-12-15 19:03:47 +01:00
|
|
|
}
|
|
|
|
|
2015-12-11 14:26:51 +01:00
|
|
|
static void mui_navigation_alphabet(void *data, size_t *unused)
|
2015-04-21 11:43:52 +07:00
|
|
|
{
|
2015-12-11 14:26:51 +01:00
|
|
|
mui_navigation_set(data, true);
|
2015-04-21 11:43:52 +07:00
|
|
|
}
|
|
|
|
|
2015-12-10 16:45:38 +01:00
|
|
|
static void mui_populate_entries(
|
|
|
|
void *data, const char *path,
|
2015-09-21 21:32:31 +02:00
|
|
|
const char *label, unsigned i)
|
2014-12-15 19:03:47 +01:00
|
|
|
{
|
2015-12-10 16:45:38 +01:00
|
|
|
mui_handle_t *mui = (mui_handle_t*)data;
|
2015-12-10 14:50:43 +01:00
|
|
|
if (!mui)
|
2015-04-21 11:43:52 +07:00
|
|
|
return;
|
|
|
|
|
2015-12-10 15:31:17 +01:00
|
|
|
mui->scroll_y = mui_get_scroll(mui);
|
2014-12-15 19:03:47 +01:00
|
|
|
}
|
|
|
|
|
2015-12-10 17:01:06 +01:00
|
|
|
static void mui_context_reset(void *data)
|
2015-04-21 14:20:18 +07:00
|
|
|
{
|
2015-12-10 17:01:06 +01:00
|
|
|
mui_handle_t *mui = (mui_handle_t*)data;
|
2015-11-05 17:05:26 +07:00
|
|
|
settings_t *settings = config_get_ptr();
|
2015-05-01 09:02:03 -03:00
|
|
|
|
2015-11-05 17:14:51 +07:00
|
|
|
if (!mui || !settings)
|
2015-10-27 18:18:56 +07:00
|
|
|
return;
|
|
|
|
|
|
|
|
|
2015-12-10 15:31:17 +01:00
|
|
|
mui_layout(mui);
|
2015-11-05 16:55:32 +07:00
|
|
|
mui_context_bg_destroy(mui);
|
2016-04-12 04:30:25 +07:00
|
|
|
menu_display_allocate_white_texture();
|
2016-06-11 19:43:14 +02:00
|
|
|
mui_context_reset_textures(mui);
|
2015-04-25 06:03:26 +02:00
|
|
|
|
2016-06-20 16:14:59 +02:00
|
|
|
task_push_image_load(settings->path.menu_wallpaper,
|
|
|
|
MENU_ENUM_LABEL_CB_MENU_WALLPAPER,
|
2015-11-24 13:50:37 -03:00
|
|
|
menu_display_handle_wallpaper_upload, NULL);
|
2015-04-21 14:20:18 +07:00
|
|
|
}
|
|
|
|
|
2016-02-25 19:30:14 +01:00
|
|
|
static int mui_environ(enum menu_environ_cb type, void *data, void *userdata)
|
2015-07-08 00:37:44 +02:00
|
|
|
{
|
|
|
|
switch (type)
|
|
|
|
{
|
2015-07-09 00:24:10 +02:00
|
|
|
case 0:
|
2015-07-08 00:37:44 +02:00
|
|
|
default:
|
2015-07-14 16:21:08 +02:00
|
|
|
break;
|
2015-07-08 00:37:44 +02:00
|
|
|
}
|
|
|
|
|
2015-07-14 16:21:08 +02:00
|
|
|
return -1;
|
2015-07-08 00:37:44 +02:00
|
|
|
}
|
|
|
|
|
2015-12-10 15:33:10 +01:00
|
|
|
static void mui_preswitch_tabs(mui_handle_t *mui, unsigned action)
|
2015-11-02 01:44:45 +07:00
|
|
|
{
|
2015-11-09 05:24:09 +01:00
|
|
|
size_t idx = 0;
|
2015-11-05 17:05:26 +07:00
|
|
|
size_t stack_size = 0;
|
|
|
|
file_list_t *menu_stack = NULL;
|
2015-11-02 01:44:45 +07:00
|
|
|
|
2015-11-05 16:55:32 +07:00
|
|
|
if (!mui)
|
2015-11-02 01:44:45 +07:00
|
|
|
return;
|
|
|
|
|
2015-11-03 17:06:53 +07:00
|
|
|
menu_navigation_ctl(MENU_NAVIGATION_CTL_SET_SELECTION, &idx);
|
|
|
|
|
2015-11-02 23:35:41 +01:00
|
|
|
menu_stack = menu_entries_get_menu_stack_ptr(0);
|
|
|
|
stack_size = menu_stack->size;
|
2015-11-02 01:44:45 +07:00
|
|
|
|
|
|
|
if (menu_stack->list[stack_size - 1].label)
|
|
|
|
free(menu_stack->list[stack_size - 1].label);
|
|
|
|
menu_stack->list[stack_size - 1].label = NULL;
|
|
|
|
|
2015-11-05 16:55:32 +07:00
|
|
|
switch (mui->categories.selection_ptr)
|
2015-11-02 01:44:45 +07:00
|
|
|
{
|
2015-11-05 16:53:14 +07:00
|
|
|
case MUI_SYSTEM_TAB_MAIN:
|
2015-11-02 01:44:45 +07:00
|
|
|
menu_stack->list[stack_size - 1].label =
|
2016-06-20 00:31:13 +02:00
|
|
|
strdup(msg_hash_to_str(MENU_ENUM_LABEL_MAIN_MENU));
|
2015-11-02 01:44:45 +07:00
|
|
|
menu_stack->list[stack_size - 1].type =
|
|
|
|
MENU_SETTINGS;
|
|
|
|
break;
|
2015-11-05 16:53:14 +07:00
|
|
|
case MUI_SYSTEM_TAB_PLAYLISTS:
|
2015-11-02 01:44:45 +07:00
|
|
|
menu_stack->list[stack_size - 1].label =
|
2016-06-20 00:31:13 +02:00
|
|
|
strdup(msg_hash_to_str(MENU_ENUM_LABEL_PLAYLISTS_TAB));
|
2015-11-02 01:44:45 +07:00
|
|
|
menu_stack->list[stack_size - 1].type =
|
|
|
|
MENU_PLAYLISTS_TAB;
|
|
|
|
break;
|
2015-11-05 16:53:14 +07:00
|
|
|
case MUI_SYSTEM_TAB_SETTINGS:
|
2015-11-02 01:44:45 +07:00
|
|
|
menu_stack->list[stack_size - 1].label =
|
2016-06-20 00:31:13 +02:00
|
|
|
strdup(msg_hash_to_str(MENU_ENUM_LABEL_SETTINGS_TAB));
|
2015-11-02 01:44:45 +07:00
|
|
|
menu_stack->list[stack_size - 1].type =
|
|
|
|
MENU_SETTINGS;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-02-25 19:27:06 +01:00
|
|
|
static void mui_list_cache(void *data,
|
|
|
|
enum menu_list_type type, unsigned action)
|
2015-10-29 00:59:06 +07:00
|
|
|
{
|
2015-11-01 21:47:36 +01:00
|
|
|
size_t list_size;
|
2015-12-10 16:17:23 +01:00
|
|
|
mui_handle_t *mui = (mui_handle_t*)data;
|
2015-10-29 00:59:06 +07:00
|
|
|
|
2015-11-05 16:55:32 +07:00
|
|
|
if (!mui)
|
2015-10-29 00:59:06 +07:00
|
|
|
return;
|
|
|
|
|
2015-11-05 16:53:14 +07:00
|
|
|
list_size = MUI_SYSTEM_TAB_END;
|
2015-10-29 00:59:06 +07:00
|
|
|
|
|
|
|
switch (type)
|
|
|
|
{
|
|
|
|
case MENU_LIST_PLAIN:
|
|
|
|
break;
|
|
|
|
case MENU_LIST_HORIZONTAL:
|
2015-11-05 16:55:32 +07:00
|
|
|
mui->categories.selection_ptr_old = mui->categories.selection_ptr;
|
2015-10-29 00:59:06 +07:00
|
|
|
|
|
|
|
switch (action)
|
|
|
|
{
|
|
|
|
case MENU_ACTION_LEFT:
|
2015-11-05 16:55:32 +07:00
|
|
|
if (mui->categories.selection_ptr == 0)
|
2015-10-29 00:59:06 +07:00
|
|
|
{
|
2015-11-05 16:55:32 +07:00
|
|
|
mui->categories.selection_ptr = list_size;
|
|
|
|
mui->categories.active.idx = list_size - 1;
|
2015-10-29 00:59:06 +07:00
|
|
|
}
|
|
|
|
else
|
2015-11-05 16:55:32 +07:00
|
|
|
mui->categories.selection_ptr--;
|
2015-10-29 00:59:06 +07:00
|
|
|
break;
|
|
|
|
default:
|
2015-11-05 16:55:32 +07:00
|
|
|
if (mui->categories.selection_ptr == list_size)
|
2015-10-29 00:59:06 +07:00
|
|
|
{
|
2015-11-05 16:55:32 +07:00
|
|
|
mui->categories.selection_ptr = 0;
|
|
|
|
mui->categories.active.idx = 1;
|
2015-10-29 00:59:06 +07:00
|
|
|
}
|
|
|
|
else
|
2015-11-05 16:55:32 +07:00
|
|
|
mui->categories.selection_ptr++;
|
2015-10-29 00:59:06 +07:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2015-12-10 15:33:10 +01:00
|
|
|
mui_preswitch_tabs(mui, action);
|
2015-10-29 00:59:06 +07:00
|
|
|
break;
|
2015-10-30 16:28:27 +07:00
|
|
|
default:
|
|
|
|
break;
|
2015-10-29 00:59:06 +07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-12-10 19:02:01 +01:00
|
|
|
static int mui_list_push(void *data, void *userdata,
|
|
|
|
menu_displaylist_info_t *info, unsigned type)
|
2015-10-29 13:35:15 +01:00
|
|
|
{
|
2016-03-04 07:37:40 +01:00
|
|
|
menu_displaylist_ctx_parse_entry_t entry;
|
2015-12-11 13:51:17 +01:00
|
|
|
int ret = -1;
|
|
|
|
core_info_list_t *list = NULL;
|
|
|
|
menu_handle_t *menu = (menu_handle_t*)data;
|
2015-10-29 13:35:15 +01:00
|
|
|
|
2015-12-10 19:02:01 +01:00
|
|
|
(void)userdata;
|
|
|
|
|
2015-10-29 13:35:15 +01:00
|
|
|
switch (type)
|
|
|
|
{
|
2015-10-30 18:32:17 +01:00
|
|
|
case DISPLAYLIST_LOAD_CONTENT_LIST:
|
2016-02-24 22:45:21 +01:00
|
|
|
menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list);
|
2016-06-15 14:23:13 +02:00
|
|
|
menu_entries_add_enum(info->list,
|
2016-06-20 00:31:13 +02:00
|
|
|
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_LOAD_CONTENT),
|
|
|
|
msg_hash_to_str(MENU_ENUM_LABEL_LOAD_CONTENT),
|
2016-06-15 14:23:13 +02:00
|
|
|
MENU_ENUM_LABEL_LOAD_CONTENT,
|
2015-10-30 18:32:17 +01:00
|
|
|
MENU_SETTING_ACTION, 0, 0);
|
|
|
|
|
2016-05-09 18:11:17 +02:00
|
|
|
core_info_get_list(&list);
|
2016-02-11 07:20:04 +01:00
|
|
|
if (core_info_list_num_info_files(list))
|
2015-10-30 18:32:17 +01:00
|
|
|
{
|
2016-06-15 14:23:13 +02:00
|
|
|
menu_entries_add_enum(info->list,
|
2016-06-20 00:31:13 +02:00
|
|
|
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DETECT_CORE_LIST),
|
|
|
|
msg_hash_to_str(MENU_ENUM_LABEL_DETECT_CORE_LIST),
|
2016-06-15 14:23:13 +02:00
|
|
|
MENU_ENUM_LABEL_DETECT_CORE_LIST,
|
2015-10-30 18:32:17 +01:00
|
|
|
MENU_SETTING_ACTION, 0, 0);
|
|
|
|
|
2016-06-15 14:23:13 +02:00
|
|
|
menu_entries_add_enum(info->list,
|
2016-06-20 00:31:13 +02:00
|
|
|
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DOWNLOADED_FILE_DETECT_CORE_LIST),
|
|
|
|
msg_hash_to_str(MENU_ENUM_LABEL_DOWNLOADED_FILE_DETECT_CORE_LIST),
|
2016-06-15 14:23:13 +02:00
|
|
|
MENU_ENUM_LABEL_DOWNLOADED_FILE_DETECT_CORE_LIST,
|
2015-10-30 18:32:17 +01:00
|
|
|
MENU_SETTING_ACTION, 0, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
info->need_push = true;
|
|
|
|
info->need_refresh = true;
|
|
|
|
ret = 0;
|
|
|
|
break;
|
2015-10-29 13:35:15 +01:00
|
|
|
case DISPLAYLIST_MAIN_MENU:
|
2016-02-24 22:45:21 +01:00
|
|
|
menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list);
|
2015-10-29 13:35:15 +01:00
|
|
|
|
2016-03-04 07:37:40 +01:00
|
|
|
entry.data = menu;
|
|
|
|
entry.info = info;
|
|
|
|
entry.parse_type = PARSE_ACTION;
|
|
|
|
entry.add_empty_entry = false;
|
|
|
|
|
2016-01-19 23:44:32 +01:00
|
|
|
if (!rarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL))
|
2016-01-24 01:51:05 +01:00
|
|
|
{
|
2016-06-15 10:57:59 +02:00
|
|
|
entry.enum_idx = MENU_ENUM_LABEL_CONTENT_SETTINGS;
|
|
|
|
menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry);
|
2016-01-24 01:51:05 +01:00
|
|
|
}
|
2015-10-29 13:35:15 +01:00
|
|
|
|
2016-07-01 12:18:38 +02:00
|
|
|
if (menu_driver_ctl(RARCH_MENU_CTL_HAS_LOAD_NO_CONTENT, NULL))
|
|
|
|
{
|
|
|
|
entry.enum_idx = MENU_ENUM_LABEL_START_CORE;
|
|
|
|
menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry);
|
|
|
|
}
|
2016-01-31 14:36:41 -06:00
|
|
|
|
2016-06-15 10:57:59 +02:00
|
|
|
entry.enum_idx = MENU_ENUM_LABEL_START_NET_RETROPAD;
|
|
|
|
menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry);
|
2016-05-27 19:18:46 +02:00
|
|
|
|
2016-02-03 12:31:29 +01:00
|
|
|
#ifndef HAVE_DYNAMIC
|
|
|
|
if (frontend_driver_has_fork())
|
2015-10-29 13:35:15 +01:00
|
|
|
#endif
|
2016-02-03 12:31:29 +01:00
|
|
|
{
|
2016-06-15 10:57:59 +02:00
|
|
|
entry.enum_idx = MENU_ENUM_LABEL_CORE_LIST;
|
|
|
|
menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry);
|
2016-02-03 12:31:29 +01:00
|
|
|
}
|
2016-03-04 07:37:40 +01:00
|
|
|
|
2016-06-15 10:57:59 +02:00
|
|
|
entry.enum_idx = MENU_ENUM_LABEL_LOAD_CONTENT_LIST;
|
|
|
|
menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry);
|
2016-03-04 07:37:40 +01:00
|
|
|
|
2016-06-15 10:57:59 +02:00
|
|
|
entry.enum_idx = MENU_ENUM_LABEL_LOAD_CONTENT_HISTORY;
|
|
|
|
menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry);
|
2016-03-04 07:37:40 +01:00
|
|
|
|
2015-10-29 13:35:15 +01:00
|
|
|
#if defined(HAVE_NETWORKING)
|
|
|
|
#if defined(HAVE_LIBRETRODB)
|
2016-06-15 10:57:59 +02:00
|
|
|
entry.enum_idx = MENU_ENUM_LABEL_ADD_CONTENT_LIST;
|
|
|
|
menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry);
|
2015-10-29 13:35:15 +01:00
|
|
|
#endif
|
2016-06-15 10:57:59 +02:00
|
|
|
entry.enum_idx = MENU_ENUM_LABEL_ONLINE_UPDATER;
|
|
|
|
menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry);
|
2015-10-29 13:35:15 +01:00
|
|
|
#endif
|
2016-06-15 10:57:59 +02:00
|
|
|
entry.enum_idx = MENU_ENUM_LABEL_INFORMATION_LIST;
|
|
|
|
menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry);
|
2015-10-29 13:35:15 +01:00
|
|
|
#ifndef HAVE_DYNAMIC
|
2016-06-15 10:57:59 +02:00
|
|
|
entry.enum_idx = MENU_ENUM_LABEL_RESTART_RETROARCH;
|
|
|
|
menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry);
|
2015-10-29 13:35:15 +01:00
|
|
|
#endif
|
2016-06-15 10:57:59 +02:00
|
|
|
entry.enum_idx = MENU_ENUM_LABEL_CONFIGURATIONS;
|
|
|
|
menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry);
|
2016-03-04 07:37:40 +01:00
|
|
|
|
2016-06-15 10:57:59 +02:00
|
|
|
entry.enum_idx = MENU_ENUM_LABEL_SAVE_CURRENT_CONFIG;
|
|
|
|
menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry);
|
2016-03-04 07:37:40 +01:00
|
|
|
|
2016-06-15 10:57:59 +02:00
|
|
|
entry.enum_idx = MENU_ENUM_LABEL_SAVE_NEW_CONFIG;
|
|
|
|
menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry);
|
2016-03-04 07:37:40 +01:00
|
|
|
|
2016-06-15 10:57:59 +02:00
|
|
|
entry.enum_idx = MENU_ENUM_LABEL_HELP_LIST;
|
|
|
|
menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry);
|
2015-10-29 13:35:15 +01:00
|
|
|
#if !defined(IOS)
|
2016-06-15 10:57:59 +02:00
|
|
|
entry.enum_idx = MENU_ENUM_LABEL_QUIT_RETROARCH;
|
|
|
|
menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry);
|
2015-10-29 13:35:15 +01:00
|
|
|
#endif
|
2016-01-22 14:56:43 +01:00
|
|
|
#if defined(HAVE_LAKKA)
|
2016-06-15 10:57:59 +02:00
|
|
|
entry.enum_idx = MENU_ENUM_LABEL_SHUTDOWN;
|
|
|
|
menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry);
|
2016-01-22 14:56:43 +01:00
|
|
|
#endif
|
2015-10-29 13:35:15 +01:00
|
|
|
info->need_push = true;
|
|
|
|
ret = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2015-11-05 16:55:32 +07:00
|
|
|
static size_t mui_list_get_selection(void *data)
|
2015-10-30 16:28:27 +07:00
|
|
|
{
|
2015-12-11 14:50:06 +01:00
|
|
|
mui_handle_t *mui = (mui_handle_t*)data;
|
2015-10-30 16:28:27 +07:00
|
|
|
|
2015-11-05 16:55:32 +07:00
|
|
|
if (!mui)
|
2015-10-30 16:28:27 +07:00
|
|
|
return 0;
|
|
|
|
|
2015-11-05 16:55:32 +07:00
|
|
|
return mui->categories.selection_ptr;
|
2015-10-30 16:28:27 +07:00
|
|
|
}
|
|
|
|
|
2015-12-10 16:26:40 +01:00
|
|
|
static int mui_pointer_tap(void *userdata,
|
|
|
|
unsigned x, unsigned y,
|
2015-11-01 20:44:04 +01:00
|
|
|
unsigned ptr, menu_file_list_cbs_t *cbs,
|
2015-11-01 20:35:43 +01:00
|
|
|
menu_entry_t *entry, unsigned action)
|
2015-11-02 01:17:06 +07:00
|
|
|
{
|
2016-06-22 06:48:35 +02:00
|
|
|
size_t selection;
|
|
|
|
unsigned width, height;
|
|
|
|
unsigned header_height, i;
|
2015-12-10 16:26:40 +01:00
|
|
|
mui_handle_t *mui = (mui_handle_t*)userdata;
|
2015-11-02 01:44:45 +07:00
|
|
|
|
2015-11-05 16:55:32 +07:00
|
|
|
if (!mui)
|
2015-11-02 01:44:45 +07:00
|
|
|
return 0;
|
|
|
|
|
2016-05-08 12:33:28 +02:00
|
|
|
header_height = menu_display_get_header_height();
|
2016-06-22 06:48:35 +02:00
|
|
|
video_driver_get_size(&width, &height);
|
2015-11-02 01:17:06 +07:00
|
|
|
|
2015-11-01 20:44:04 +01:00
|
|
|
if (y < header_height)
|
2015-11-02 01:17:06 +07:00
|
|
|
{
|
2016-06-22 06:48:35 +02:00
|
|
|
menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection);
|
|
|
|
return menu_entry_action(entry, selection, MENU_ACTION_CANCEL);
|
2015-11-02 01:17:06 +07:00
|
|
|
}
|
2015-11-05 16:55:32 +07:00
|
|
|
else if (y > height - mui->tabs_height)
|
2015-11-02 01:44:45 +07:00
|
|
|
{
|
2016-06-22 06:48:35 +02:00
|
|
|
file_list_t *menu_stack = menu_entries_get_menu_stack_ptr(0);
|
|
|
|
file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0);
|
|
|
|
|
2015-11-05 16:53:14 +07:00
|
|
|
for (i = 0; i <= MUI_SYSTEM_TAB_END; i++)
|
2015-11-02 01:44:45 +07:00
|
|
|
{
|
2015-11-05 16:53:14 +07:00
|
|
|
unsigned tab_width = width / (MUI_SYSTEM_TAB_END + 1);
|
2015-11-02 01:44:45 +07:00
|
|
|
unsigned start = tab_width * i;
|
|
|
|
|
2015-11-01 20:44:04 +01:00
|
|
|
if ((x >= start) && (x < (start + tab_width)))
|
2015-11-02 01:44:45 +07:00
|
|
|
{
|
2015-11-05 16:55:32 +07:00
|
|
|
mui->categories.selection_ptr = i;
|
2015-11-02 01:44:45 +07:00
|
|
|
|
2015-12-10 15:33:10 +01:00
|
|
|
mui_preswitch_tabs(mui, action);
|
2015-11-02 01:44:45 +07:00
|
|
|
|
|
|
|
if (cbs && cbs->action_content_list_switch)
|
|
|
|
return cbs->action_content_list_switch(selection_buf, menu_stack,
|
|
|
|
"", "", 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2015-11-01 20:44:04 +01:00
|
|
|
else if (ptr <= (menu_entries_get_size() - 1))
|
2015-11-02 01:17:06 +07:00
|
|
|
{
|
2016-06-22 06:48:35 +02:00
|
|
|
size_t idx;
|
|
|
|
bool scroll = false;
|
|
|
|
menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection);
|
2015-11-01 20:44:04 +01:00
|
|
|
if (ptr == selection && cbs && cbs->action_select)
|
2015-11-02 01:17:06 +07:00
|
|
|
return menu_entry_action(entry, selection, MENU_ACTION_SELECT);
|
|
|
|
|
2015-11-01 20:44:04 +01:00
|
|
|
idx = ptr;
|
2015-11-02 01:17:06 +07:00
|
|
|
|
|
|
|
menu_navigation_ctl(MENU_NAVIGATION_CTL_SET_SELECTION, &idx);
|
|
|
|
menu_navigation_ctl(MENU_NAVIGATION_CTL_SET, &scroll);
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2015-11-05 16:55:32 +07:00
|
|
|
menu_ctx_driver_t menu_ctx_mui = {
|
2014-09-11 04:07:07 +02:00
|
|
|
NULL,
|
2015-11-05 16:55:32 +07:00
|
|
|
mui_get_message,
|
2015-10-03 05:08:29 +02:00
|
|
|
generic_menu_iterate,
|
2015-11-05 16:55:32 +07:00
|
|
|
mui_render,
|
|
|
|
mui_frame,
|
|
|
|
mui_init,
|
|
|
|
mui_free,
|
|
|
|
mui_context_reset,
|
|
|
|
mui_context_destroy,
|
|
|
|
mui_populate_entries,
|
2014-09-11 04:07:07 +02:00
|
|
|
NULL,
|
2015-11-05 16:55:32 +07:00
|
|
|
mui_navigation_clear,
|
2014-09-11 04:07:07 +02:00
|
|
|
NULL,
|
|
|
|
NULL,
|
2015-11-05 16:55:32 +07:00
|
|
|
mui_navigation_set,
|
|
|
|
mui_navigation_set_last,
|
|
|
|
mui_navigation_alphabet,
|
|
|
|
mui_navigation_alphabet,
|
2015-10-03 04:32:38 +02:00
|
|
|
generic_menu_init_list,
|
2014-09-11 04:07:07 +02:00
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
2016-04-11 23:31:49 +07:00
|
|
|
NULL,
|
2015-11-05 16:55:32 +07:00
|
|
|
mui_list_cache,
|
|
|
|
mui_list_push,
|
|
|
|
mui_list_get_selection,
|
|
|
|
mui_list_get_size,
|
2015-10-22 04:12:32 +02:00
|
|
|
NULL,
|
2015-11-05 16:55:32 +07:00
|
|
|
mui_list_set_selection,
|
2015-06-15 19:00:52 +02:00
|
|
|
NULL,
|
2015-11-05 16:55:32 +07:00
|
|
|
mui_load_image,
|
2014-09-11 04:07:07 +02:00
|
|
|
"glui",
|
2015-11-05 16:55:32 +07:00
|
|
|
mui_environ,
|
|
|
|
mui_pointer_tap,
|
2014-09-11 04:07:07 +02:00
|
|
|
};
|