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 | |
parent | b9f32302736031725a3885db2612b14af69c4dd5 (diff) | |
download | rockbox-bb618dbd84389a8625244e97c5f61addd7870810.tar.gz rockbox-bb618dbd84389a8625244e97c5f61addd7870810.zip |
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
-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 { | |||
250 | ACTION_TOUCH_MUTE, | 250 | ACTION_TOUCH_MUTE, |
251 | ACTION_TOUCH_SCROLLBAR, | 251 | ACTION_TOUCH_SCROLLBAR, |
252 | ACTION_TOUCH_VOLUME, | 252 | ACTION_TOUCH_VOLUME, |
253 | ACTION_TOUCH_SOFTLOCK, | ||
253 | #endif | 254 | #endif |
254 | 255 | ||
255 | /* USB HID codes */ | 256 | /* 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, | |||
1039 | struct touchaction {const char* s; int action;}; | 1039 | struct touchaction {const char* s; int action;}; |
1040 | static const struct touchaction touchactions[] = { | 1040 | static const struct touchaction touchactions[] = { |
1041 | /* generic actions, convert to screen actions on use */ | 1041 | /* generic actions, convert to screen actions on use */ |
1042 | {"none", ACTION_TOUCHSCREEN}, | 1042 | {"none", ACTION_TOUCHSCREEN}, {"lock", ACTION_TOUCH_SOFTLOCK }, |
1043 | {"prev", ACTION_STD_PREV }, {"next", ACTION_STD_NEXT }, | 1043 | {"prev", ACTION_STD_PREV }, {"next", ACTION_STD_NEXT }, |
1044 | {"rwd", ACTION_STD_PREVREPEAT }, {"ffwd", ACTION_STD_NEXTREPEAT }, | 1044 | {"rwd", ACTION_STD_PREVREPEAT }, {"ffwd", ACTION_STD_NEXTREPEAT }, |
1045 | {"hotkey", ACTION_STD_HOTKEY}, {"select", ACTION_STD_OK }, | 1045 | {"hotkey", ACTION_STD_HOTKEY}, {"select", ACTION_STD_OK }, |
@@ -1122,17 +1122,23 @@ static int parse_touchregion(struct skin_element *element, | |||
1122 | region->value = 0; | 1122 | region->value = 0; |
1123 | region->last_press = 0xffff; | 1123 | region->last_press = 0xffff; |
1124 | region->press_length = PRESS; | 1124 | region->press_length = PRESS; |
1125 | region->allow_while_locked = false; | ||
1125 | action = element->params[p++].data.text; | 1126 | action = element->params[p++].data.text; |
1126 | 1127 | ||
1127 | strcpy(temp, action); | 1128 | strcpy(temp, action); |
1128 | action = temp; | 1129 | action = temp; |
1129 | 1130 | ||
1130 | if (*action == '!') | 1131 | switch (*action) |
1131 | { | 1132 | { |
1132 | region->reverse_bar = true; | 1133 | case '!': |
1133 | action++; | 1134 | region->reverse_bar = true; |
1135 | action++; | ||
1136 | break; | ||
1137 | case '^': | ||
1138 | action++; | ||
1139 | region->allow_while_locked = true; | ||
1140 | break; | ||
1134 | } | 1141 | } |
1135 | |||
1136 | if(!strcmp(pb_string, action)) | 1142 | if(!strcmp(pb_string, action)) |
1137 | region->action = ACTION_TOUCH_SCROLLBAR; | 1143 | region->action = ACTION_TOUCH_SCROLLBAR; |
1138 | else if(!strcmp(vol_string, action)) | 1144 | 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, | |||
1378 | #endif | 1378 | #endif |
1379 | 1379 | ||
1380 | case SKIN_TOKEN_MAIN_HOLD: | 1380 | case SKIN_TOKEN_MAIN_HOLD: |
1381 | #ifdef HAVE_TOUCHSCREEN | ||
1382 | if (data->touchscreen_locked) | ||
1383 | return "t"; | ||
1384 | #endif | ||
1381 | #ifdef HAS_BUTTON_HOLD | 1385 | #ifdef HAS_BUTTON_HOLD |
1382 | if (button_hold()) | 1386 | if (button_hold()) |
1383 | #else | 1387 | #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, | |||
72 | regions = regions->next; | 72 | regions = regions->next; |
73 | continue; | 73 | continue; |
74 | } | 74 | } |
75 | if (data->touchscreen_locked && | ||
76 | (r->action != ACTION_TOUCH_SOFTLOCK && !r->allow_while_locked)) | ||
77 | { | ||
78 | regions = regions->next; | ||
79 | continue; | ||
80 | } | ||
75 | needs_repeat = r->press_length != PRESS; | 81 | needs_repeat = r->press_length != PRESS; |
76 | /* check if it's inside this viewport */ | 82 | /* check if it's inside this viewport */ |
77 | if (viewport_point_within_vp(&(r->wvp->vp), x, y)) | 83 | 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, | |||
150 | } | 156 | } |
151 | switch (returncode) | 157 | switch (returncode) |
152 | { | 158 | { |
159 | case ACTION_TOUCH_SOFTLOCK: | ||
160 | data->touchscreen_locked = !data->touchscreen_locked; | ||
161 | returncode = ACTION_NONE; | ||
162 | break; | ||
153 | case ACTION_WPS_PLAY: | 163 | case ACTION_WPS_PLAY: |
154 | if (!audio_status()) | 164 | if (!audio_status()) |
155 | { | 165 | { |
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 { | |||
189 | short int width; /* width */ | 189 | short int width; /* width */ |
190 | short int height; /* height */ | 190 | short int height; /* height */ |
191 | bool reverse_bar; /* if true 0% is the left or top */ | 191 | bool reverse_bar; /* if true 0% is the left or top */ |
192 | bool allow_while_locked; | ||
192 | enum { | 193 | enum { |
193 | PRESS, /* quick press only */ | 194 | PRESS, /* quick press only */ |
194 | LONG_PRESS, /* Long press without repeat */ | 195 | LONG_PRESS, /* Long press without repeat */ |
@@ -308,6 +309,7 @@ struct wps_data | |||
308 | 309 | ||
309 | #ifdef HAVE_TOUCHSCREEN | 310 | #ifdef HAVE_TOUCHSCREEN |
310 | struct skin_token_list *touchregions; | 311 | struct skin_token_list *touchregions; |
312 | bool touchscreen_locked; | ||
311 | #endif | 313 | #endif |
312 | #ifdef HAVE_ALBUMART | 314 | #ifdef HAVE_ALBUMART |
313 | struct skin_albumart *albumart; | 315 | struct skin_albumart *albumart; |