mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-11-10 13:42:29 -05:00
2 new touch region options... "settings_inc" and "settings_dec" which will increase or decrease most of the available settings. To use it put the config name of the setting as the next param after settings_inc... i.e %T(0, 0, 32, 32, settings_inc, repeat)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28009 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
1a92ff0994
commit
4caa8326ab
10 changed files with 66 additions and 8 deletions
|
|
@ -225,7 +225,7 @@ static int option_talk(int selected_item, void * data)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(HAVE_QUICKSCREEN) || defined(HAVE_RECORDING)
|
#if defined(HAVE_QUICKSCREEN) || defined(HAVE_RECORDING) || defined(HAVE_TOUCHSCREEN)
|
||||||
/* only the quickscreen and recording trigger needs this */
|
/* only the quickscreen and recording trigger needs this */
|
||||||
void option_select_next_val(const struct settings_list *setting,
|
void option_select_next_val(const struct settings_list *setting,
|
||||||
bool previous, bool apply)
|
bool previous, bool apply)
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ bool option_screen(const struct settings_list *setting,
|
||||||
struct viewport parent[NB_SCREENS],
|
struct viewport parent[NB_SCREENS],
|
||||||
bool use_temp_var, unsigned char* option_title);
|
bool use_temp_var, unsigned char* option_title);
|
||||||
|
|
||||||
#if defined(HAVE_QUICKSCREEN) || defined(HAVE_RECORDING)
|
#if defined(HAVE_QUICKSCREEN) || defined(HAVE_RECORDING) || defined(HAVE_TOUCHSCREEN)
|
||||||
void option_select_next_val(const struct settings_list *setting,
|
void option_select_next_val(const struct settings_list *setting,
|
||||||
bool previous, bool apply);
|
bool previous, bool apply);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,8 @@ enum skinnable_screens {
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_TOUCHSCREEN
|
#ifdef HAVE_TOUCHSCREEN
|
||||||
int skin_get_touchaction(struct wps_data *data, int* edge_offset);
|
int skin_get_touchaction(struct wps_data *data, int* edge_offset,
|
||||||
|
struct touchregion **retregion);
|
||||||
void skin_disarm_touchregions(struct wps_data *data);
|
void skin_disarm_touchregions(struct wps_data *data);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -827,6 +827,9 @@ static const struct touchaction touchactions[] = {
|
||||||
/* not really WPS specific, but no equivilant ACTION_STD_* */
|
/* not really WPS specific, but no equivilant ACTION_STD_* */
|
||||||
{"voldown", ACTION_WPS_VOLDOWN}, {"volup", ACTION_WPS_VOLUP},
|
{"voldown", ACTION_WPS_VOLDOWN}, {"volup", ACTION_WPS_VOLUP},
|
||||||
|
|
||||||
|
/* generic settings changers */
|
||||||
|
{"setting_inc", ACTION_SETTINGS_INC}, {"setting_dec", ACTION_SETTINGS_DEC},
|
||||||
|
|
||||||
/* WPS specific actions */
|
/* WPS specific actions */
|
||||||
{"browse", ACTION_WPS_BROWSE },
|
{"browse", ACTION_WPS_BROWSE },
|
||||||
{"play", ACTION_WPS_PLAY }, {"stop", ACTION_WPS_STOP },
|
{"play", ACTION_WPS_PLAY }, {"stop", ACTION_WPS_STOP },
|
||||||
|
|
@ -888,6 +891,7 @@ static int parse_touchregion(struct skin_element *element,
|
||||||
region->wvp = curr_vp;
|
region->wvp = curr_vp;
|
||||||
region->armed = false;
|
region->armed = false;
|
||||||
region->reverse_bar = false;
|
region->reverse_bar = false;
|
||||||
|
region->extradata = NULL;
|
||||||
action = element->params[4].data.text;
|
action = element->params[4].data.text;
|
||||||
|
|
||||||
strcpy(temp, action);
|
strcpy(temp, action);
|
||||||
|
|
@ -922,6 +926,27 @@ static int parse_touchregion(struct skin_element *element,
|
||||||
if (!strcmp(touchactions[i].s, action))
|
if (!strcmp(touchactions[i].s, action))
|
||||||
{
|
{
|
||||||
region->action = touchactions[i].action;
|
region->action = touchactions[i].action;
|
||||||
|
if (region->action == ACTION_SETTINGS_INC ||
|
||||||
|
region->action == ACTION_SETTINGS_DEC)
|
||||||
|
{
|
||||||
|
if (element->params_count < 6)
|
||||||
|
{
|
||||||
|
return WPS_ERROR_INVALID_PARAM;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
char *name = element->params[5].data.text;
|
||||||
|
int j;
|
||||||
|
/* Find the setting */
|
||||||
|
for (j=0; j<nb_settings; j++)
|
||||||
|
if (settings[j].cfg_name &&
|
||||||
|
!strcmp(settings[j].cfg_name, name))
|
||||||
|
break;
|
||||||
|
if (j==nb_settings)
|
||||||
|
return WPS_ERROR_INVALID_PARAM;
|
||||||
|
region->extradata = &settings[j];
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,8 @@ void skin_disarm_touchregions(struct wps_data *data)
|
||||||
* egde_offset is a percentage value for the position of the touch
|
* egde_offset is a percentage value for the position of the touch
|
||||||
* inside the bar for regions which arnt WPS_TOUCHREGION_ACTION type.
|
* inside the bar for regions which arnt WPS_TOUCHREGION_ACTION type.
|
||||||
*/
|
*/
|
||||||
int skin_get_touchaction(struct wps_data *data, int* edge_offset)
|
int skin_get_touchaction(struct wps_data *data, int* edge_offset,
|
||||||
|
struct touchregion **retregion)
|
||||||
{
|
{
|
||||||
int returncode = ACTION_NONE;
|
int returncode = ACTION_NONE;
|
||||||
short x,y;
|
short x,y;
|
||||||
|
|
@ -84,6 +85,8 @@ int skin_get_touchaction(struct wps_data *data, int* edge_offset)
|
||||||
{
|
{
|
||||||
last_action = r->action;
|
last_action = r->action;
|
||||||
returncode = r->action;
|
returncode = r->action;
|
||||||
|
if (retregion)
|
||||||
|
*retregion = r;
|
||||||
}
|
}
|
||||||
if (pressed)
|
if (pressed)
|
||||||
r->armed = true;
|
r->armed = true;
|
||||||
|
|
@ -99,6 +102,8 @@ int skin_get_touchaction(struct wps_data *data, int* edge_offset)
|
||||||
*edge_offset = 100 - *edge_offset;
|
*edge_offset = 100 - *edge_offset;
|
||||||
}
|
}
|
||||||
returncode = r->type;
|
returncode = r->type;
|
||||||
|
if (retregion)
|
||||||
|
*retregion = r;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -196,6 +196,7 @@ struct touchregion {
|
||||||
int action; /* action this button will return */
|
int action; /* action this button will return */
|
||||||
bool armed; /* A region is armed on press. Only armed regions are triggered
|
bool armed; /* A region is armed on press. Only armed regions are triggered
|
||||||
on repeat or release. */
|
on repeat or release. */
|
||||||
|
void* extradata;
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,7 @@
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "font.h"
|
#include "font.h"
|
||||||
#include "icon.h"
|
#include "icon.h"
|
||||||
|
#include "option_select.h"
|
||||||
|
|
||||||
|
|
||||||
/* currently only one wps_state is needed */
|
/* currently only one wps_state is needed */
|
||||||
|
|
@ -359,6 +360,7 @@ void sb_bypass_touchregions(bool enable)
|
||||||
|
|
||||||
int sb_touch_to_button(int context)
|
int sb_touch_to_button(int context)
|
||||||
{
|
{
|
||||||
|
struct touchregion *region;
|
||||||
static int last_context = -1;
|
static int last_context = -1;
|
||||||
int button, offset;
|
int button, offset;
|
||||||
if (bypass_sb_touchregions)
|
if (bypass_sb_touchregions)
|
||||||
|
|
@ -367,7 +369,7 @@ int sb_touch_to_button(int context)
|
||||||
if (last_context != context)
|
if (last_context != context)
|
||||||
skin_disarm_touchregions(&sb_skin_data[SCREEN_MAIN]);
|
skin_disarm_touchregions(&sb_skin_data[SCREEN_MAIN]);
|
||||||
last_context = context;
|
last_context = context;
|
||||||
button = skin_get_touchaction(&sb_skin_data[SCREEN_MAIN], &offset);
|
button = skin_get_touchaction(&sb_skin_data[SCREEN_MAIN], &offset, ®ion);
|
||||||
|
|
||||||
switch (button)
|
switch (button)
|
||||||
{
|
{
|
||||||
|
|
@ -377,6 +379,13 @@ int sb_touch_to_button(int context)
|
||||||
case ACTION_WPS_VOLDOWN:
|
case ACTION_WPS_VOLDOWN:
|
||||||
return ACTION_LIST_VOLDOWN;
|
return ACTION_LIST_VOLDOWN;
|
||||||
#endif
|
#endif
|
||||||
|
case ACTION_SETTINGS_INC:
|
||||||
|
case ACTION_SETTINGS_DEC:
|
||||||
|
{
|
||||||
|
const struct settings_list *setting = region->extradata;
|
||||||
|
option_select_next_val(setting, button == ACTION_SETTINGS_DEC, true);
|
||||||
|
}
|
||||||
|
return ACTION_REDRAW;
|
||||||
/* TODO */
|
/* TODO */
|
||||||
}
|
}
|
||||||
return button;
|
return button;
|
||||||
|
|
|
||||||
|
|
@ -227,7 +227,8 @@ static bool update_onvol_change(struct gui_wps * gwps)
|
||||||
static int skintouch_to_wps(struct wps_data *data)
|
static int skintouch_to_wps(struct wps_data *data)
|
||||||
{
|
{
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
int button = skin_get_touchaction(data, &offset);
|
struct touchregion *region;
|
||||||
|
int button = skin_get_touchaction(data, &offset, ®ion);
|
||||||
switch (button)
|
switch (button)
|
||||||
{
|
{
|
||||||
case ACTION_STD_PREV:
|
case ACTION_STD_PREV:
|
||||||
|
|
@ -271,6 +272,13 @@ static int skintouch_to_wps(struct wps_data *data)
|
||||||
setvol();
|
setvol();
|
||||||
}
|
}
|
||||||
return ACTION_TOUCHSCREEN;
|
return ACTION_TOUCHSCREEN;
|
||||||
|
case ACTION_SETTINGS_INC:
|
||||||
|
case ACTION_SETTINGS_DEC:
|
||||||
|
{
|
||||||
|
const struct settings_list *setting = region->extradata;
|
||||||
|
option_select_next_val(setting, button == ACTION_SETTINGS_DEC, true);
|
||||||
|
}
|
||||||
|
return ACTION_REDRAW;
|
||||||
}
|
}
|
||||||
return button;
|
return button;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@
|
||||||
#include "action.h"
|
#include "action.h"
|
||||||
#include "appevents.h"
|
#include "appevents.h"
|
||||||
#include "statusbar-skinned.h"
|
#include "statusbar-skinned.h"
|
||||||
|
#include "option_select.h"
|
||||||
|
|
||||||
|
|
||||||
extern struct wps_state wps_state; /* from wps.c */
|
extern struct wps_state wps_state; /* from wps.c */
|
||||||
|
|
@ -116,9 +117,10 @@ int fms_do_button_loop(bool update_screen)
|
||||||
int button = skin_wait_for_action(fms_skin, CONTEXT_FM,
|
int button = skin_wait_for_action(fms_skin, CONTEXT_FM,
|
||||||
update_screen ? TIMEOUT_NOBLOCK : HZ/5);
|
update_screen ? TIMEOUT_NOBLOCK : HZ/5);
|
||||||
#ifdef HAVE_TOUCHSCREEN
|
#ifdef HAVE_TOUCHSCREEN
|
||||||
|
struct touchregion *region;
|
||||||
int offset;
|
int offset;
|
||||||
if (button == ACTION_TOUCHSCREEN)
|
if (button == ACTION_TOUCHSCREEN)
|
||||||
button = skin_get_touchaction(&fms_skin_data[SCREEN_MAIN], &offset);
|
button = skin_get_touchaction(&fms_skin_data[SCREEN_MAIN], &offset, ®ion);
|
||||||
switch (button)
|
switch (button)
|
||||||
{
|
{
|
||||||
case ACTION_WPS_STOP:
|
case ACTION_WPS_STOP:
|
||||||
|
|
@ -136,6 +138,13 @@ int fms_do_button_loop(bool update_screen)
|
||||||
case WPS_TOUCHREGION_SCROLLBAR:
|
case WPS_TOUCHREGION_SCROLLBAR:
|
||||||
/* TODO */
|
/* TODO */
|
||||||
break;
|
break;
|
||||||
|
case ACTION_SETTINGS_INC:
|
||||||
|
case ACTION_SETTINGS_DEC:
|
||||||
|
{
|
||||||
|
const struct settings_list *setting = region->extradata;
|
||||||
|
option_select_next_val(setting, button == ACTION_SETTINGS_DEC, true);
|
||||||
|
}
|
||||||
|
return ACTION_REDRAW;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return button;
|
return button;
|
||||||
|
|
|
||||||
|
|
@ -199,7 +199,7 @@ static const struct tag_info legal_tags[] =
|
||||||
|
|
||||||
{ SKIN_TOKEN_LASTTOUCH, "Tl" , "|D", SKIN_REFRESH_DYNAMIC },
|
{ SKIN_TOKEN_LASTTOUCH, "Tl" , "|D", SKIN_REFRESH_DYNAMIC },
|
||||||
{ SKIN_TOKEN_CURRENT_SCREEN, "cs", "", SKIN_REFRESH_DYNAMIC },
|
{ SKIN_TOKEN_CURRENT_SCREEN, "cs", "", SKIN_REFRESH_DYNAMIC },
|
||||||
{ SKIN_TOKEN_TOUCHREGION, "T" , "IIiiS", 0|NOBREAK },
|
{ SKIN_TOKEN_TOUCHREGION, "T" , "IIiiS|S", 0|NOBREAK },
|
||||||
|
|
||||||
{ SKIN_TOKEN_HAVE_RECORDING, "Rp" , "", SKIN_REFRESH_STATIC },
|
{ SKIN_TOKEN_HAVE_RECORDING, "Rp" , "", SKIN_REFRESH_STATIC },
|
||||||
{ SKIN_TOKEN_IS_RECORDING, "Rr" , "", SKIN_REFRESH_DYNAMIC },
|
{ SKIN_TOKEN_IS_RECORDING, "Rr" , "", SKIN_REFRESH_DYNAMIC },
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue