summaryrefslogtreecommitdiff
path: root/apps/gui
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2010-09-06 13:33:49 +0000
committerJonathan Gordon <rockbox@jdgordon.info>2010-09-06 13:33:49 +0000
commit4caa8326abd590eb01279dde3f4dc6611a9255c8 (patch)
treec7f0f858ecda565e688b945ab89cd000d8c4fe2c /apps/gui
parent1a92ff099499a657c55e1282dab00276100f99f7 (diff)
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
Diffstat (limited to 'apps/gui')
-rw-r--r--apps/gui/option_select.c2
-rw-r--r--apps/gui/option_select.h2
-rw-r--r--apps/gui/skin_engine/skin_engine.h3
-rw-r--r--apps/gui/skin_engine/skin_parser.c25
-rw-r--r--apps/gui/skin_engine/skin_touchsupport.c7
-rw-r--r--apps/gui/skin_engine/wps_internals.h1
-rw-r--r--apps/gui/statusbar-skinned.c11
-rw-r--r--apps/gui/wps.c10
8 files changed, 55 insertions, 6 deletions
diff --git a/apps/gui/option_select.c b/apps/gui/option_select.c
index ac8ba43793..1dab41ee22 100644
--- a/apps/gui/option_select.c
+++ b/apps/gui/option_select.c
@@ -225,7 +225,7 @@ static int option_talk(int selected_item, void * data)
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 */
void option_select_next_val(const struct settings_list *setting,
bool previous, bool apply)
diff --git a/apps/gui/option_select.h b/apps/gui/option_select.h
index a8661fb8ad..04493e93eb 100644
--- a/apps/gui/option_select.h
+++ b/apps/gui/option_select.h
@@ -29,7 +29,7 @@ bool option_screen(const struct settings_list *setting,
struct viewport parent[NB_SCREENS],
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,
bool previous, bool apply);
#endif
diff --git a/apps/gui/skin_engine/skin_engine.h b/apps/gui/skin_engine/skin_engine.h
index 9845d8ca8a..6beedd90a2 100644
--- a/apps/gui/skin_engine/skin_engine.h
+++ b/apps/gui/skin_engine/skin_engine.h
@@ -67,7 +67,8 @@ enum skinnable_screens {
#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);
#endif
diff --git a/apps/gui/skin_engine/skin_parser.c b/apps/gui/skin_engine/skin_parser.c
index a486436816..3d796f8032 100644
--- a/apps/gui/skin_engine/skin_parser.c
+++ b/apps/gui/skin_engine/skin_parser.c
@@ -826,6 +826,9 @@ static const struct touchaction touchactions[] = {
{"contextmenu", ACTION_STD_CONTEXT},{"quickscreen", ACTION_STD_QUICKSCREEN },
/* not really WPS specific, but no equivilant ACTION_STD_* */
{"voldown", ACTION_WPS_VOLDOWN}, {"volup", ACTION_WPS_VOLUP},
+
+ /* generic settings changers */
+ {"setting_inc", ACTION_SETTINGS_INC}, {"setting_dec", ACTION_SETTINGS_DEC},
/* WPS specific actions */
{"browse", ACTION_WPS_BROWSE },
@@ -888,6 +891,7 @@ static int parse_touchregion(struct skin_element *element,
region->wvp = curr_vp;
region->armed = false;
region->reverse_bar = false;
+ region->extradata = NULL;
action = element->params[4].data.text;
strcpy(temp, action);
@@ -922,6 +926,27 @@ static int parse_touchregion(struct skin_element *element,
if (!strcmp(touchactions[i].s, 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;
}
}
diff --git a/apps/gui/skin_engine/skin_touchsupport.c b/apps/gui/skin_engine/skin_touchsupport.c
index 09fbd86acd..850c1c0647 100644
--- a/apps/gui/skin_engine/skin_touchsupport.c
+++ b/apps/gui/skin_engine/skin_touchsupport.c
@@ -40,7 +40,8 @@ void skin_disarm_touchregions(struct wps_data *data)
* egde_offset is a percentage value for the position of the touch
* 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;
short x,y;
@@ -84,6 +85,8 @@ int skin_get_touchaction(struct wps_data *data, int* edge_offset)
{
last_action = r->action;
returncode = r->action;
+ if (retregion)
+ *retregion = r;
}
if (pressed)
r->armed = true;
@@ -99,6 +102,8 @@ int skin_get_touchaction(struct wps_data *data, int* edge_offset)
*edge_offset = 100 - *edge_offset;
}
returncode = r->type;
+ if (retregion)
+ *retregion = r;
break;
}
}
diff --git a/apps/gui/skin_engine/wps_internals.h b/apps/gui/skin_engine/wps_internals.h
index 81958c7966..0767f50279 100644
--- a/apps/gui/skin_engine/wps_internals.h
+++ b/apps/gui/skin_engine/wps_internals.h
@@ -196,6 +196,7 @@ struct touchregion {
int action; /* action this button will return */
bool armed; /* A region is armed on press. Only armed regions are triggered
on repeat or release. */
+ void* extradata;
};
#endif
diff --git a/apps/gui/statusbar-skinned.c b/apps/gui/statusbar-skinned.c
index 8928378781..e22ab28f13 100644
--- a/apps/gui/statusbar-skinned.c
+++ b/apps/gui/statusbar-skinned.c
@@ -38,6 +38,7 @@
#include "debug.h"
#include "font.h"
#include "icon.h"
+#include "option_select.h"
/* currently only one wps_state is needed */
@@ -359,6 +360,7 @@ void sb_bypass_touchregions(bool enable)
int sb_touch_to_button(int context)
{
+ struct touchregion *region;
static int last_context = -1;
int button, offset;
if (bypass_sb_touchregions)
@@ -367,7 +369,7 @@ int sb_touch_to_button(int context)
if (last_context != context)
skin_disarm_touchregions(&sb_skin_data[SCREEN_MAIN]);
last_context = context;
- button = skin_get_touchaction(&sb_skin_data[SCREEN_MAIN], &offset);
+ button = skin_get_touchaction(&sb_skin_data[SCREEN_MAIN], &offset, &region);
switch (button)
{
@@ -377,6 +379,13 @@ int sb_touch_to_button(int context)
case ACTION_WPS_VOLDOWN:
return ACTION_LIST_VOLDOWN;
#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 */
}
return button;
diff --git a/apps/gui/wps.c b/apps/gui/wps.c
index 6ab016f88d..1489ff0026 100644
--- a/apps/gui/wps.c
+++ b/apps/gui/wps.c
@@ -227,7 +227,8 @@ static bool update_onvol_change(struct gui_wps * gwps)
static int skintouch_to_wps(struct wps_data *data)
{
int offset = 0;
- int button = skin_get_touchaction(data, &offset);
+ struct touchregion *region;
+ int button = skin_get_touchaction(data, &offset, &region);
switch (button)
{
case ACTION_STD_PREV:
@@ -271,6 +272,13 @@ static int skintouch_to_wps(struct wps_data *data)
setvol();
}
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;
}