summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2009-08-09 17:30:05 +0000
committerJonathan Gordon <rockbox@jdgordon.info>2009-08-09 17:30:05 +0000
commitdc4e90341ccf97d1451f46fa1bd4acde5e950298 (patch)
treebfed22e00dd47bc2bdb9acaf1676f4807b2a691f
parent9bd7b23e9980247e97e54a275769e5f1dd3b443e (diff)
downloadrockbox-dc4e90341ccf97d1451f46fa1bd4acde5e950298.tar.gz
rockbox-dc4e90341ccf97d1451f46fa1bd4acde5e950298.zip
r22135 overwrote mcuelenaere's changes in r22068 to add slider-type regions for the touchscreen... so bring them back (spotted by kkurbjun)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22223 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/gui/skin_engine/wps_internals.h5
-rw-r--r--apps/gui/skin_engine/wps_parser.c53
2 files changed, 39 insertions, 19 deletions
diff --git a/apps/gui/skin_engine/wps_internals.h b/apps/gui/skin_engine/wps_internals.h
index a64ec93f08..ffebed7bad 100644
--- a/apps/gui/skin_engine/wps_internals.h
+++ b/apps/gui/skin_engine/wps_internals.h
@@ -390,6 +390,11 @@ struct touchregion {
390 short int y; /* y-pos */ 390 short int y; /* y-pos */
391 short int width; /* width */ 391 short int width; /* width */
392 short int height; /* height */ 392 short int height; /* height */
393 enum {
394 WPS_TOUCHREGION_ACTION,
395 WPS_TOUCHREGION_SCROLLBAR,
396 WPS_TOUCHREGION_VOLUME
397 } type; /* type of touch region */
393 bool repeat; /* requires the area be held for the action */ 398 bool repeat; /* requires the area be held for the action */
394 int action; /* action this button will return */ 399 int action; /* action this button will return */
395}; 400};
diff --git a/apps/gui/skin_engine/wps_parser.c b/apps/gui/skin_engine/wps_parser.c
index 3df2c5f0aa..9671d7c4dc 100644
--- a/apps/gui/skin_engine/wps_parser.c
+++ b/apps/gui/skin_engine/wps_parser.c
@@ -1093,6 +1093,8 @@ static int parse_touchregion(const char *wps_bufptr,
1093 struct touchregion *region; 1093 struct touchregion *region;
1094 const char *ptr = wps_bufptr; 1094 const char *ptr = wps_bufptr;
1095 const char *action; 1095 const char *action;
1096 const char pb_string[] = "progressbar";
1097 const char vol_string[] = "volume";
1096 int x,y,w,h; 1098 int x,y,w,h;
1097 1099
1098 /* format: %T|x|y|width|height|action| 1100 /* format: %T|x|y|width|height|action|
@@ -1132,28 +1134,41 @@ static int parse_touchregion(const char *wps_bufptr,
1132 region->width = w; 1134 region->width = w;
1133 region->height = h; 1135 region->height = h;
1134 region->wvp = &wps_data->viewports[wps_data->num_viewports]; 1136 region->wvp = &wps_data->viewports[wps_data->num_viewports];
1135 i = 0; 1137
1136 if (*action == '&') 1138 if(!strncmp(pb_string, action, sizeof(pb_string)-1)
1137 { 1139 && *(action + sizeof(pb_string)-1) == '|')
1138 action++; 1140 region->type = WPS_TOUCHREGION_SCROLLBAR;
1139 region->repeat = true; 1141 else if(!strncmp(vol_string, action, sizeof(vol_string)-1)
1140 } 1142 && *(action + sizeof(vol_string)-1) == '|')
1143 region->type = WPS_TOUCHREGION_VOLUME;
1141 else 1144 else
1142 region->repeat = false;
1143
1144 imax = ARRAYLEN(touchactions);
1145 while ((region->action == ACTION_NONE) &&
1146 (i < imax))
1147 { 1145 {
1148 /* try to match with one of our touchregion screens */ 1146 region->type = WPS_TOUCHREGION_ACTION;
1149 int len = strlen(touchactions[i].s); 1147
1150 if (!strncmp(touchactions[i].s, action, len) 1148 if (*action == '&')
1151 && *(action+len) == '|') 1149 {
1152 region->action = touchactions[i].action; 1150 action++;
1153 i++; 1151 region->repeat = true;
1152 }
1153 else
1154 region->repeat = false;
1155
1156 i = 0;
1157 imax = ARRAYLEN(touchactions);
1158 while ((region->action == ACTION_NONE) &&
1159 (i < imax))
1160 {
1161 /* try to match with one of our touchregion screens */
1162 int len = strlen(touchactions[i].s);
1163 if (!strncmp(touchactions[i].s, action, len)
1164 && *(action+len) == '|')
1165 region->action = touchactions[i].action;
1166 i++;
1167 }
1168 if (region->action == ACTION_NONE)
1169 return WPS_ERROR_INVALID_PARAM;
1154 } 1170 }
1155 if (region->action == ACTION_NONE) 1171
1156 return WPS_ERROR_INVALID_PARAM;
1157 wps_data->touchregion_count++; 1172 wps_data->touchregion_count++;
1158 return skip_end_of_line(wps_bufptr); 1173 return skip_end_of_line(wps_bufptr);
1159} 1174}