forked from len0rd/rockbox
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
This commit is contained in:
parent
9bd7b23e99
commit
dc4e90341c
2 changed files with 39 additions and 19 deletions
|
|
@ -390,6 +390,11 @@ struct touchregion {
|
||||||
short int y; /* y-pos */
|
short int y; /* y-pos */
|
||||||
short int width; /* width */
|
short int width; /* width */
|
||||||
short int height; /* height */
|
short int height; /* height */
|
||||||
|
enum {
|
||||||
|
WPS_TOUCHREGION_ACTION,
|
||||||
|
WPS_TOUCHREGION_SCROLLBAR,
|
||||||
|
WPS_TOUCHREGION_VOLUME
|
||||||
|
} type; /* type of touch region */
|
||||||
bool repeat; /* requires the area be held for the action */
|
bool repeat; /* requires the area be held for the action */
|
||||||
int action; /* action this button will return */
|
int action; /* action this button will return */
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1093,6 +1093,8 @@ static int parse_touchregion(const char *wps_bufptr,
|
||||||
struct touchregion *region;
|
struct touchregion *region;
|
||||||
const char *ptr = wps_bufptr;
|
const char *ptr = wps_bufptr;
|
||||||
const char *action;
|
const char *action;
|
||||||
|
const char pb_string[] = "progressbar";
|
||||||
|
const char vol_string[] = "volume";
|
||||||
int x,y,w,h;
|
int x,y,w,h;
|
||||||
|
|
||||||
/* format: %T|x|y|width|height|action|
|
/* format: %T|x|y|width|height|action|
|
||||||
|
|
@ -1132,28 +1134,41 @@ static int parse_touchregion(const char *wps_bufptr,
|
||||||
region->width = w;
|
region->width = w;
|
||||||
region->height = h;
|
region->height = h;
|
||||||
region->wvp = &wps_data->viewports[wps_data->num_viewports];
|
region->wvp = &wps_data->viewports[wps_data->num_viewports];
|
||||||
i = 0;
|
|
||||||
if (*action == '&')
|
|
||||||
{
|
|
||||||
action++;
|
|
||||||
region->repeat = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
region->repeat = false;
|
|
||||||
|
|
||||||
imax = ARRAYLEN(touchactions);
|
if(!strncmp(pb_string, action, sizeof(pb_string)-1)
|
||||||
while ((region->action == ACTION_NONE) &&
|
&& *(action + sizeof(pb_string)-1) == '|')
|
||||||
(i < imax))
|
region->type = WPS_TOUCHREGION_SCROLLBAR;
|
||||||
|
else if(!strncmp(vol_string, action, sizeof(vol_string)-1)
|
||||||
|
&& *(action + sizeof(vol_string)-1) == '|')
|
||||||
|
region->type = WPS_TOUCHREGION_VOLUME;
|
||||||
|
else
|
||||||
{
|
{
|
||||||
/* try to match with one of our touchregion screens */
|
region->type = WPS_TOUCHREGION_ACTION;
|
||||||
int len = strlen(touchactions[i].s);
|
|
||||||
if (!strncmp(touchactions[i].s, action, len)
|
if (*action == '&')
|
||||||
&& *(action+len) == '|')
|
{
|
||||||
region->action = touchactions[i].action;
|
action++;
|
||||||
i++;
|
region->repeat = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
region->repeat = false;
|
||||||
|
|
||||||
|
i = 0;
|
||||||
|
imax = ARRAYLEN(touchactions);
|
||||||
|
while ((region->action == ACTION_NONE) &&
|
||||||
|
(i < imax))
|
||||||
|
{
|
||||||
|
/* try to match with one of our touchregion screens */
|
||||||
|
int len = strlen(touchactions[i].s);
|
||||||
|
if (!strncmp(touchactions[i].s, action, len)
|
||||||
|
&& *(action+len) == '|')
|
||||||
|
region->action = touchactions[i].action;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
if (region->action == ACTION_NONE)
|
||||||
|
return WPS_ERROR_INVALID_PARAM;
|
||||||
}
|
}
|
||||||
if (region->action == ACTION_NONE)
|
|
||||||
return WPS_ERROR_INVALID_PARAM;
|
|
||||||
wps_data->touchregion_count++;
|
wps_data->touchregion_count++;
|
||||||
return skip_end_of_line(wps_bufptr);
|
return skip_end_of_line(wps_bufptr);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue