diff options
author | Jonathan Gordon <rockbox@jdgordon.info> | 2011-07-28 11:26:01 +0000 |
---|---|---|
committer | Jonathan Gordon <rockbox@jdgordon.info> | 2011-07-28 11:26:01 +0000 |
commit | bb618dbd84389a8625244e97c5f61addd7870810 (patch) | |
tree | bffbb1d02597b1a732429c0fbbdcf1173dc60d87 /apps | |
parent | b9f32302736031725a3885db2612b14af69c4dd5 (diff) |
skin engine softlock support for touchscreens:
Modify the %Tl() tag to add a new region 'lock' which will lock/unlock the wps/sbs from touches (hardware buttons still work)
You can also specify a region to work when locked by prepending ^ to the action name (this is probably about to change though)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30218 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r-- | apps/action.h | 1 | ||||
-rw-r--r-- | apps/gui/skin_engine/skin_parser.c | 16 | ||||
-rw-r--r-- | apps/gui/skin_engine/skin_tokens.c | 4 | ||||
-rw-r--r-- | apps/gui/skin_engine/skin_touchsupport.c | 10 | ||||
-rw-r--r-- | apps/gui/skin_engine/wps_internals.h | 2 |
5 files changed, 28 insertions, 5 deletions
diff --git a/apps/action.h b/apps/action.h index e380b1289a..ccf3313841 100644 --- a/apps/action.h +++ b/apps/action.h @@ -250,6 +250,7 @@ enum { ACTION_TOUCH_MUTE, ACTION_TOUCH_SCROLLBAR, ACTION_TOUCH_VOLUME, + ACTION_TOUCH_SOFTLOCK, #endif /* USB HID codes */ diff --git a/apps/gui/skin_engine/skin_parser.c b/apps/gui/skin_engine/skin_parser.c index df08fe6115..659d974130 100644 --- a/apps/gui/skin_engine/skin_parser.c +++ b/apps/gui/skin_engine/skin_parser.c @@ -1039,7 +1039,7 @@ static int parse_lasttouch(struct skin_element *element, struct touchaction {const char* s; int action;}; static const struct touchaction touchactions[] = { /* generic actions, convert to screen actions on use */ - {"none", ACTION_TOUCHSCREEN}, + {"none", ACTION_TOUCHSCREEN}, {"lock", ACTION_TOUCH_SOFTLOCK }, {"prev", ACTION_STD_PREV }, {"next", ACTION_STD_NEXT }, {"rwd", ACTION_STD_PREVREPEAT }, {"ffwd", ACTION_STD_NEXTREPEAT }, {"hotkey", ACTION_STD_HOTKEY}, {"select", ACTION_STD_OK }, @@ -1122,17 +1122,23 @@ static int parse_touchregion(struct skin_element *element, region->value = 0; region->last_press = 0xffff; region->press_length = PRESS; + region->allow_while_locked = false; action = element->params[p++].data.text; strcpy(temp, action); action = temp; - if (*action == '!') + switch (*action) { - region->reverse_bar = true; - action++; + case '!': + region->reverse_bar = true; + action++; + break; + case '^': + action++; + region->allow_while_locked = true; + break; } - if(!strcmp(pb_string, action)) region->action = ACTION_TOUCH_SCROLLBAR; else if(!strcmp(vol_string, action)) diff --git a/apps/gui/skin_engine/skin_tokens.c b/apps/gui/skin_engine/skin_tokens.c index 3c6a817ea8..ec6f606938 100644 --- a/apps/gui/skin_engine/skin_tokens.c +++ b/apps/gui/skin_engine/skin_tokens.c @@ -1378,6 +1378,10 @@ const char *get_token_value(struct gui_wps *gwps, #endif case SKIN_TOKEN_MAIN_HOLD: +#ifdef HAVE_TOUCHSCREEN + if (data->touchscreen_locked) + return "t"; +#endif #ifdef HAS_BUTTON_HOLD if (button_hold()) #else diff --git a/apps/gui/skin_engine/skin_touchsupport.c b/apps/gui/skin_engine/skin_touchsupport.c index a0b82dd9da..d4f4fe226b 100644 --- a/apps/gui/skin_engine/skin_touchsupport.c +++ b/apps/gui/skin_engine/skin_touchsupport.c @@ -72,6 +72,12 @@ int skin_get_touchaction(struct wps_data *data, int* edge_offset, regions = regions->next; continue; } + if (data->touchscreen_locked && + (r->action != ACTION_TOUCH_SOFTLOCK && !r->allow_while_locked)) + { + regions = regions->next; + continue; + } needs_repeat = r->press_length != PRESS; /* check if it's inside this viewport */ if (viewport_point_within_vp(&(r->wvp->vp), x, y)) @@ -150,6 +156,10 @@ int skin_get_touchaction(struct wps_data *data, int* edge_offset, } switch (returncode) { + case ACTION_TOUCH_SOFTLOCK: + data->touchscreen_locked = !data->touchscreen_locked; + returncode = ACTION_NONE; + break; case ACTION_WPS_PLAY: if (!audio_status()) { diff --git a/apps/gui/skin_engine/wps_internals.h b/apps/gui/skin_engine/wps_internals.h index 4714609c1e..6de98455a7 100644 --- a/apps/gui/skin_engine/wps_internals.h +++ b/apps/gui/skin_engine/wps_internals.h @@ -189,6 +189,7 @@ struct touchregion { short int width; /* width */ short int height; /* height */ bool reverse_bar; /* if true 0% is the left or top */ + bool allow_while_locked; enum { PRESS, /* quick press only */ LONG_PRESS, /* Long press without repeat */ @@ -308,6 +309,7 @@ struct wps_data #ifdef HAVE_TOUCHSCREEN struct skin_token_list *touchregions; + bool touchscreen_locked; #endif #ifdef HAVE_ALBUMART struct skin_albumart *albumart; |