mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-23 16:09:47 +00:00
Get rid of menu_cbs_down/menu_cbs_up
This commit is contained in:
parent
9f3ea51f77
commit
f502cd9e16
@ -1040,8 +1040,6 @@ ifeq ($(HAVE_MENU_COMMON), 1)
|
|||||||
menu/cbs/menu_cbs_label.o \
|
menu/cbs/menu_cbs_label.o \
|
||||||
menu/cbs/menu_cbs_sublabel.o \
|
menu/cbs/menu_cbs_sublabel.o \
|
||||||
menu/cbs/menu_cbs_title.o \
|
menu/cbs/menu_cbs_title.o \
|
||||||
menu/cbs/menu_cbs_up.o \
|
|
||||||
menu/cbs/menu_cbs_down.o \
|
|
||||||
menu/cbs/menu_cbs_contentlist_switch.o \
|
menu/cbs/menu_cbs_contentlist_switch.o \
|
||||||
menu/menu_displaylist.o
|
menu/menu_displaylist.o
|
||||||
endif
|
endif
|
||||||
|
@ -1388,8 +1388,6 @@ MENU
|
|||||||
#include "../menu/cbs/menu_cbs_get_value.c"
|
#include "../menu/cbs/menu_cbs_get_value.c"
|
||||||
#include "../menu/cbs/menu_cbs_label.c"
|
#include "../menu/cbs/menu_cbs_label.c"
|
||||||
#include "../menu/cbs/menu_cbs_sublabel.c"
|
#include "../menu/cbs/menu_cbs_sublabel.c"
|
||||||
#include "../menu/cbs/menu_cbs_up.c"
|
|
||||||
#include "../menu/cbs/menu_cbs_down.c"
|
|
||||||
#include "../menu/cbs/menu_cbs_contentlist_switch.c"
|
#include "../menu/cbs/menu_cbs_contentlist_switch.c"
|
||||||
#include "../menu/menu_displaylist.c"
|
#include "../menu/menu_displaylist.c"
|
||||||
#ifdef HAVE_LIBRETRODB
|
#ifdef HAVE_LIBRETRODB
|
||||||
|
@ -1,49 +0,0 @@
|
|||||||
/* RetroArch - A frontend for libretro.
|
|
||||||
* Copyright (C) 2011-2017 - Daniel De Matteis
|
|
||||||
*
|
|
||||||
* 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/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "../menu_driver.h"
|
|
||||||
#include "../menu_cbs.h"
|
|
||||||
|
|
||||||
#ifndef BIND_ACTION_DOWN
|
|
||||||
#define BIND_ACTION_DOWN(cbs, name) (cbs)->action_down = (name)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static int action_bind_down_generic(unsigned type, const char *label)
|
|
||||||
{
|
|
||||||
size_t scroll_accel = 0;
|
|
||||||
unsigned scroll_speed = 0;
|
|
||||||
if (!menu_driver_ctl(MENU_NAVIGATION_CTL_GET_SCROLL_ACCEL, &scroll_accel))
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
scroll_speed = (unsigned)((MAX(scroll_accel, 2) - 2) / 4 + 1);
|
|
||||||
|
|
||||||
if (menu_entries_get_size() <= 0)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
menu_driver_ctl(MENU_NAVIGATION_CTL_INCREMENT, &scroll_speed);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int menu_cbs_init_bind_down(menu_file_list_cbs_t *cbs,
|
|
||||||
const char *path, const char *label, unsigned type, size_t idx)
|
|
||||||
{
|
|
||||||
if (!cbs)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
BIND_ACTION_DOWN(cbs, action_bind_down_generic);
|
|
||||||
|
|
||||||
return -1;
|
|
||||||
}
|
|
@ -1,49 +0,0 @@
|
|||||||
/* RetroArch - A frontend for libretro.
|
|
||||||
* Copyright (C) 2011-2017 - Daniel De Matteis
|
|
||||||
*
|
|
||||||
* 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/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "../menu_driver.h"
|
|
||||||
#include "../menu_cbs.h"
|
|
||||||
|
|
||||||
#ifndef BIND_ACTION_UP
|
|
||||||
#define BIND_ACTION_UP(cbs, name) (cbs)->action_up = (name)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static int action_bind_up_generic(unsigned type, const char *label)
|
|
||||||
{
|
|
||||||
size_t scroll_accel = 0;
|
|
||||||
unsigned scroll_speed = 0;
|
|
||||||
if (!menu_driver_ctl(MENU_NAVIGATION_CTL_GET_SCROLL_ACCEL, &scroll_accel))
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
scroll_speed = (unsigned)((MAX(scroll_accel, 2) - 2) / 4 + 1);
|
|
||||||
|
|
||||||
if (menu_entries_get_size() <= 0)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
menu_driver_ctl(MENU_NAVIGATION_CTL_DECREMENT, &scroll_speed);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int menu_cbs_init_bind_up(menu_file_list_cbs_t *cbs,
|
|
||||||
const char *path, const char *label, unsigned type, size_t idx)
|
|
||||||
{
|
|
||||||
if (!cbs)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
BIND_ACTION_UP(cbs, action_bind_up_generic);
|
|
||||||
|
|
||||||
return -1;
|
|
||||||
}
|
|
@ -272,12 +272,6 @@ int menu_cbs_init_bind_label(menu_file_list_cbs_t *cbs,
|
|||||||
int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs,
|
int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs,
|
||||||
const char *path, const char *label, unsigned type, size_t idx);
|
const char *path, const char *label, unsigned type, size_t idx);
|
||||||
|
|
||||||
int menu_cbs_init_bind_up(menu_file_list_cbs_t *cbs,
|
|
||||||
const char *path, const char *label, unsigned type, size_t idx);
|
|
||||||
|
|
||||||
int menu_cbs_init_bind_down(menu_file_list_cbs_t *cbs,
|
|
||||||
const char *path, const char *label, unsigned type, size_t idx);
|
|
||||||
|
|
||||||
int menu_cbs_init_bind_info(menu_file_list_cbs_t *cbs,
|
int menu_cbs_init_bind_info(menu_file_list_cbs_t *cbs,
|
||||||
const char *path, const char *label, unsigned type, size_t idx);
|
const char *path, const char *label, unsigned type, size_t idx);
|
||||||
|
|
||||||
|
@ -112,7 +112,6 @@ typedef struct menu_file_list_cbs
|
|||||||
*path, const char *label, unsigned type);
|
*path, const char *label, unsigned type);
|
||||||
int (*action_left)(unsigned type, const char *label, bool wraparound);
|
int (*action_left)(unsigned type, const char *label, bool wraparound);
|
||||||
int (*action_right)(unsigned type, const char *label, bool wraparound);
|
int (*action_right)(unsigned type, const char *label, bool wraparound);
|
||||||
int (*action_up)(unsigned type, const char *label);
|
|
||||||
int (*action_label)(file_list_t *list,
|
int (*action_label)(file_list_t *list,
|
||||||
unsigned type, unsigned i,
|
unsigned type, unsigned i,
|
||||||
const char *label, const char *path,
|
const char *label, const char *path,
|
||||||
@ -121,7 +120,6 @@ typedef struct menu_file_list_cbs
|
|||||||
unsigned type, unsigned i,
|
unsigned type, unsigned i,
|
||||||
const char *label, const char *path,
|
const char *label, const char *path,
|
||||||
char *s, size_t len);
|
char *s, size_t len);
|
||||||
int (*action_down)(unsigned type, const char *label);
|
|
||||||
void (*action_get_value)(file_list_t* list,
|
void (*action_get_value)(file_list_t* list,
|
||||||
unsigned *w, unsigned type, unsigned i,
|
unsigned *w, unsigned type, unsigned i,
|
||||||
const char *label, char *s, size_t len,
|
const char *label, char *s, size_t len,
|
||||||
|
34
retroarch.c
34
retroarch.c
@ -1656,14 +1656,6 @@ static void menu_cbs_init(
|
|||||||
* menu_cbs_bind_content_list_switch.c, then map this callback to the entry. */
|
* menu_cbs_bind_content_list_switch.c, then map this callback to the entry. */
|
||||||
menu_cbs_init_bind_content_list_switch(cbs, path, label, type, idx);
|
menu_cbs_init_bind_content_list_switch(cbs, path, label, type, idx);
|
||||||
|
|
||||||
/* It will try to find a corresponding callback function inside
|
|
||||||
* menu_cbs_up.c, then map this callback to the entry. */
|
|
||||||
menu_cbs_init_bind_up(cbs, path, label, type, idx);
|
|
||||||
|
|
||||||
/* It will try to find a corresponding callback function inside
|
|
||||||
* menu_cbs_down.c, then map this callback to the entry. */
|
|
||||||
menu_cbs_init_bind_down(cbs, path, label, type, idx);
|
|
||||||
|
|
||||||
/* It will try to find a corresponding callback function inside
|
/* It will try to find a corresponding callback function inside
|
||||||
* menu_cbs_left.c, then map this callback to the entry. */
|
* menu_cbs_left.c, then map this callback to the entry. */
|
||||||
menu_cbs_init_bind_left(cbs, path, label, type, idx, menu_label);
|
menu_cbs_init_bind_left(cbs, path, label, type, idx, menu_label);
|
||||||
@ -2213,12 +2205,20 @@ int generic_menu_entry_action(
|
|||||||
switch (action)
|
switch (action)
|
||||||
{
|
{
|
||||||
case MENU_ACTION_UP:
|
case MENU_ACTION_UP:
|
||||||
if (cbs && cbs->action_up)
|
if (MENU_LIST_GET_SELECTION(menu_list, 0)->size > 0)
|
||||||
ret = cbs->action_up(entry->type, entry->label);
|
{
|
||||||
|
size_t scroll_accel = menu_st->scroll.acceleration;
|
||||||
|
unsigned scroll_speed = (unsigned)((MAX(scroll_accel, 2) - 2) / 4 + 1);
|
||||||
|
menu_driver_ctl(MENU_NAVIGATION_CTL_DECREMENT, &scroll_speed);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case MENU_ACTION_DOWN:
|
case MENU_ACTION_DOWN:
|
||||||
if (cbs && cbs->action_down)
|
if (MENU_LIST_GET_SELECTION(menu_list, 0)->size > 0)
|
||||||
ret = cbs->action_down(entry->type, entry->label);
|
{
|
||||||
|
size_t scroll_accel = menu_st->scroll.acceleration;
|
||||||
|
unsigned scroll_speed = (unsigned)((MAX(scroll_accel, 2) - 2) / 4 + 1);
|
||||||
|
menu_driver_ctl(MENU_NAVIGATION_CTL_INCREMENT, &scroll_speed);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case MENU_ACTION_SCROLL_UP:
|
case MENU_ACTION_SCROLL_UP:
|
||||||
menu_driver_ctl(MENU_NAVIGATION_CTL_DESCEND_ALPHABET, NULL);
|
menu_driver_ctl(MENU_NAVIGATION_CTL_DESCEND_ALPHABET, NULL);
|
||||||
@ -3005,10 +3005,8 @@ void menu_entries_append(
|
|||||||
cbs->action_content_list_switch = NULL;
|
cbs->action_content_list_switch = NULL;
|
||||||
cbs->action_left = NULL;
|
cbs->action_left = NULL;
|
||||||
cbs->action_right = NULL;
|
cbs->action_right = NULL;
|
||||||
cbs->action_up = NULL;
|
|
||||||
cbs->action_label = NULL;
|
cbs->action_label = NULL;
|
||||||
cbs->action_sublabel = NULL;
|
cbs->action_sublabel = NULL;
|
||||||
cbs->action_down = NULL;
|
|
||||||
cbs->action_get_value = NULL;
|
cbs->action_get_value = NULL;
|
||||||
|
|
||||||
list->list[idx].actiondata = cbs;
|
list->list[idx].actiondata = cbs;
|
||||||
@ -3092,10 +3090,8 @@ bool menu_entries_append_enum(
|
|||||||
cbs->action_content_list_switch = NULL;
|
cbs->action_content_list_switch = NULL;
|
||||||
cbs->action_left = NULL;
|
cbs->action_left = NULL;
|
||||||
cbs->action_right = NULL;
|
cbs->action_right = NULL;
|
||||||
cbs->action_up = NULL;
|
|
||||||
cbs->action_label = NULL;
|
cbs->action_label = NULL;
|
||||||
cbs->action_sublabel = NULL;
|
cbs->action_sublabel = NULL;
|
||||||
cbs->action_down = NULL;
|
|
||||||
cbs->action_get_value = NULL;
|
cbs->action_get_value = NULL;
|
||||||
|
|
||||||
list->list[idx].actiondata = cbs;
|
list->list[idx].actiondata = cbs;
|
||||||
@ -3179,10 +3175,8 @@ void menu_entries_prepend(file_list_t *list,
|
|||||||
cbs->action_content_list_switch = NULL;
|
cbs->action_content_list_switch = NULL;
|
||||||
cbs->action_left = NULL;
|
cbs->action_left = NULL;
|
||||||
cbs->action_right = NULL;
|
cbs->action_right = NULL;
|
||||||
cbs->action_up = NULL;
|
|
||||||
cbs->action_label = NULL;
|
cbs->action_label = NULL;
|
||||||
cbs->action_sublabel = NULL;
|
cbs->action_sublabel = NULL;
|
||||||
cbs->action_down = NULL;
|
|
||||||
cbs->action_get_value = NULL;
|
cbs->action_get_value = NULL;
|
||||||
|
|
||||||
list->list[idx].actiondata = cbs;
|
list->list[idx].actiondata = cbs;
|
||||||
@ -23610,9 +23604,7 @@ static unsigned menu_event(
|
|||||||
set_scroll = true;
|
set_scroll = true;
|
||||||
first_held = false;
|
first_held = false;
|
||||||
p_trigger_input->data[0] |= p_input->data[0] & input_repeat;
|
p_trigger_input->data[0] |= p_input->data[0] & input_repeat;
|
||||||
|
new_scroll_accel = menu_st->scroll.acceleration;
|
||||||
menu_driver_ctl(MENU_NAVIGATION_CTL_GET_SCROLL_ACCEL,
|
|
||||||
&new_scroll_accel);
|
|
||||||
|
|
||||||
if (menu_scroll_fast)
|
if (menu_scroll_fast)
|
||||||
new_scroll_accel = MIN(new_scroll_accel + 1, 64);
|
new_scroll_accel = MIN(new_scroll_accel + 1, 64);
|
||||||
|
Loading…
Reference in New Issue
Block a user