summaryrefslogtreecommitdiff
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
parent1a92ff099499a657c55e1282dab00276100f99f7 (diff)
downloadrockbox-4caa8326abd590eb01279dde3f4dc6611a9255c8.tar.gz
rockbox-4caa8326abd590eb01279dde3f4dc6611a9255c8.zip
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
-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
-rw-r--r--apps/radio/radio_skin.c11
-rw-r--r--lib/skin_parser/tag_table.c2
10 files changed, 66 insertions, 8 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)
225 return 0; 225 return 0;
226} 226}
227 227
228#if defined(HAVE_QUICKSCREEN) || defined(HAVE_RECORDING) 228#if defined(HAVE_QUICKSCREEN) || defined(HAVE_RECORDING) || defined(HAVE_TOUCHSCREEN)
229 /* only the quickscreen and recording trigger needs this */ 229 /* only the quickscreen and recording trigger needs this */
230void option_select_next_val(const struct settings_list *setting, 230void option_select_next_val(const struct settings_list *setting,
231 bool previous, bool apply) 231 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,
29 struct viewport parent[NB_SCREENS], 29 struct viewport parent[NB_SCREENS],
30 bool use_temp_var, unsigned char* option_title); 30 bool use_temp_var, unsigned char* option_title);
31 31
32#if defined(HAVE_QUICKSCREEN) || defined(HAVE_RECORDING) 32#if defined(HAVE_QUICKSCREEN) || defined(HAVE_RECORDING) || defined(HAVE_TOUCHSCREEN)
33void option_select_next_val(const struct settings_list *setting, 33void option_select_next_val(const struct settings_list *setting,
34 bool previous, bool apply); 34 bool previous, bool apply);
35#endif 35#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 {
67 67
68 68
69#ifdef HAVE_TOUCHSCREEN 69#ifdef HAVE_TOUCHSCREEN
70int skin_get_touchaction(struct wps_data *data, int* edge_offset); 70int skin_get_touchaction(struct wps_data *data, int* edge_offset,
71 struct touchregion **retregion);
71void skin_disarm_touchregions(struct wps_data *data); 72void skin_disarm_touchregions(struct wps_data *data);
72#endif 73#endif
73 74
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[] = {
826 {"contextmenu", ACTION_STD_CONTEXT},{"quickscreen", ACTION_STD_QUICKSCREEN }, 826 {"contextmenu", ACTION_STD_CONTEXT},{"quickscreen", ACTION_STD_QUICKSCREEN },
827 /* not really WPS specific, but no equivilant ACTION_STD_* */ 827 /* not really WPS specific, but no equivilant ACTION_STD_* */
828 {"voldown", ACTION_WPS_VOLDOWN}, {"volup", ACTION_WPS_VOLUP}, 828 {"voldown", ACTION_WPS_VOLDOWN}, {"volup", ACTION_WPS_VOLUP},
829
830 /* generic settings changers */
831 {"setting_inc", ACTION_SETTINGS_INC}, {"setting_dec", ACTION_SETTINGS_DEC},
829 832
830 /* WPS specific actions */ 833 /* WPS specific actions */
831 {"browse", ACTION_WPS_BROWSE }, 834 {"browse", ACTION_WPS_BROWSE },
@@ -888,6 +891,7 @@ static int parse_touchregion(struct skin_element *element,
888 region->wvp = curr_vp; 891 region->wvp = curr_vp;
889 region->armed = false; 892 region->armed = false;
890 region->reverse_bar = false; 893 region->reverse_bar = false;
894 region->extradata = NULL;
891 action = element->params[4].data.text; 895 action = element->params[4].data.text;
892 896
893 strcpy(temp, action); 897 strcpy(temp, action);
@@ -922,6 +926,27 @@ static int parse_touchregion(struct skin_element *element,
922 if (!strcmp(touchactions[i].s, action)) 926 if (!strcmp(touchactions[i].s, action))
923 { 927 {
924 region->action = touchactions[i].action; 928 region->action = touchactions[i].action;
929 if (region->action == ACTION_SETTINGS_INC ||
930 region->action == ACTION_SETTINGS_DEC)
931 {
932 if (element->params_count < 6)
933 {
934 return WPS_ERROR_INVALID_PARAM;
935 }
936 else
937 {
938 char *name = element->params[5].data.text;
939 int j;
940 /* Find the setting */
941 for (j=0; j<nb_settings; j++)
942 if (settings[j].cfg_name &&
943 !strcmp(settings[j].cfg_name, name))
944 break;
945 if (j==nb_settings)
946 return WPS_ERROR_INVALID_PARAM;
947 region->extradata = &settings[j];
948 }
949 }
925 break; 950 break;
926 } 951 }
927 } 952 }
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)
40 * egde_offset is a percentage value for the position of the touch 40 * egde_offset is a percentage value for the position of the touch
41 * inside the bar for regions which arnt WPS_TOUCHREGION_ACTION type. 41 * inside the bar for regions which arnt WPS_TOUCHREGION_ACTION type.
42 */ 42 */
43int skin_get_touchaction(struct wps_data *data, int* edge_offset) 43int skin_get_touchaction(struct wps_data *data, int* edge_offset,
44 struct touchregion **retregion)
44{ 45{
45 int returncode = ACTION_NONE; 46 int returncode = ACTION_NONE;
46 short x,y; 47 short x,y;
@@ -84,6 +85,8 @@ int skin_get_touchaction(struct wps_data *data, int* edge_offset)
84 { 85 {
85 last_action = r->action; 86 last_action = r->action;
86 returncode = r->action; 87 returncode = r->action;
88 if (retregion)
89 *retregion = r;
87 } 90 }
88 if (pressed) 91 if (pressed)
89 r->armed = true; 92 r->armed = true;
@@ -99,6 +102,8 @@ int skin_get_touchaction(struct wps_data *data, int* edge_offset)
99 *edge_offset = 100 - *edge_offset; 102 *edge_offset = 100 - *edge_offset;
100 } 103 }
101 returncode = r->type; 104 returncode = r->type;
105 if (retregion)
106 *retregion = r;
102 break; 107 break;
103 } 108 }
104 } 109 }
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 {
196 int action; /* action this button will return */ 196 int action; /* action this button will return */
197 bool armed; /* A region is armed on press. Only armed regions are triggered 197 bool armed; /* A region is armed on press. Only armed regions are triggered
198 on repeat or release. */ 198 on repeat or release. */
199 void* extradata;
199}; 200};
200#endif 201#endif
201 202
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 @@
38#include "debug.h" 38#include "debug.h"
39#include "font.h" 39#include "font.h"
40#include "icon.h" 40#include "icon.h"
41#include "option_select.h"
41 42
42 43
43/* currently only one wps_state is needed */ 44/* currently only one wps_state is needed */
@@ -359,6 +360,7 @@ void sb_bypass_touchregions(bool enable)
359 360
360int sb_touch_to_button(int context) 361int sb_touch_to_button(int context)
361{ 362{
363 struct touchregion *region;
362 static int last_context = -1; 364 static int last_context = -1;
363 int button, offset; 365 int button, offset;
364 if (bypass_sb_touchregions) 366 if (bypass_sb_touchregions)
@@ -367,7 +369,7 @@ int sb_touch_to_button(int context)
367 if (last_context != context) 369 if (last_context != context)
368 skin_disarm_touchregions(&sb_skin_data[SCREEN_MAIN]); 370 skin_disarm_touchregions(&sb_skin_data[SCREEN_MAIN]);
369 last_context = context; 371 last_context = context;
370 button = skin_get_touchaction(&sb_skin_data[SCREEN_MAIN], &offset); 372 button = skin_get_touchaction(&sb_skin_data[SCREEN_MAIN], &offset, &region);
371 373
372 switch (button) 374 switch (button)
373 { 375 {
@@ -377,6 +379,13 @@ int sb_touch_to_button(int context)
377 case ACTION_WPS_VOLDOWN: 379 case ACTION_WPS_VOLDOWN:
378 return ACTION_LIST_VOLDOWN; 380 return ACTION_LIST_VOLDOWN;
379#endif 381#endif
382 case ACTION_SETTINGS_INC:
383 case ACTION_SETTINGS_DEC:
384 {
385 const struct settings_list *setting = region->extradata;
386 option_select_next_val(setting, button == ACTION_SETTINGS_DEC, true);
387 }
388 return ACTION_REDRAW;
380 /* TODO */ 389 /* TODO */
381 } 390 }
382 return button; 391 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)
227static int skintouch_to_wps(struct wps_data *data) 227static int skintouch_to_wps(struct wps_data *data)
228{ 228{
229 int offset = 0; 229 int offset = 0;
230 int button = skin_get_touchaction(data, &offset); 230 struct touchregion *region;
231 int button = skin_get_touchaction(data, &offset, &region);
231 switch (button) 232 switch (button)
232 { 233 {
233 case ACTION_STD_PREV: 234 case ACTION_STD_PREV:
@@ -271,6 +272,13 @@ static int skintouch_to_wps(struct wps_data *data)
271 setvol(); 272 setvol();
272 } 273 }
273 return ACTION_TOUCHSCREEN; 274 return ACTION_TOUCHSCREEN;
275 case ACTION_SETTINGS_INC:
276 case ACTION_SETTINGS_DEC:
277 {
278 const struct settings_list *setting = region->extradata;
279 option_select_next_val(setting, button == ACTION_SETTINGS_DEC, true);
280 }
281 return ACTION_REDRAW;
274 } 282 }
275 return button; 283 return button;
276} 284}
diff --git a/apps/radio/radio_skin.c b/apps/radio/radio_skin.c
index 26e6daccbc..28bd784ad4 100644
--- a/apps/radio/radio_skin.c
+++ b/apps/radio/radio_skin.c
@@ -30,6 +30,7 @@
30#include "action.h" 30#include "action.h"
31#include "appevents.h" 31#include "appevents.h"
32#include "statusbar-skinned.h" 32#include "statusbar-skinned.h"
33#include "option_select.h"
33 34
34 35
35extern struct wps_state wps_state; /* from wps.c */ 36extern struct wps_state wps_state; /* from wps.c */
@@ -116,9 +117,10 @@ int fms_do_button_loop(bool update_screen)
116 int button = skin_wait_for_action(fms_skin, CONTEXT_FM, 117 int button = skin_wait_for_action(fms_skin, CONTEXT_FM,
117 update_screen ? TIMEOUT_NOBLOCK : HZ/5); 118 update_screen ? TIMEOUT_NOBLOCK : HZ/5);
118#ifdef HAVE_TOUCHSCREEN 119#ifdef HAVE_TOUCHSCREEN
120 struct touchregion *region;
119 int offset; 121 int offset;
120 if (button == ACTION_TOUCHSCREEN) 122 if (button == ACTION_TOUCHSCREEN)
121 button = skin_get_touchaction(&fms_skin_data[SCREEN_MAIN], &offset); 123 button = skin_get_touchaction(&fms_skin_data[SCREEN_MAIN], &offset, &region);
122 switch (button) 124 switch (button)
123 { 125 {
124 case ACTION_WPS_STOP: 126 case ACTION_WPS_STOP:
@@ -136,6 +138,13 @@ int fms_do_button_loop(bool update_screen)
136 case WPS_TOUCHREGION_SCROLLBAR: 138 case WPS_TOUCHREGION_SCROLLBAR:
137 /* TODO */ 139 /* TODO */
138 break; 140 break;
141 case ACTION_SETTINGS_INC:
142 case ACTION_SETTINGS_DEC:
143 {
144 const struct settings_list *setting = region->extradata;
145 option_select_next_val(setting, button == ACTION_SETTINGS_DEC, true);
146 }
147 return ACTION_REDRAW;
139 } 148 }
140#endif 149#endif
141 return button; 150 return button;
diff --git a/lib/skin_parser/tag_table.c b/lib/skin_parser/tag_table.c
index e6d9aaf0a5..71a9510ec0 100644
--- a/lib/skin_parser/tag_table.c
+++ b/lib/skin_parser/tag_table.c
@@ -199,7 +199,7 @@ static const struct tag_info legal_tags[] =
199 199
200 { SKIN_TOKEN_LASTTOUCH, "Tl" , "|D", SKIN_REFRESH_DYNAMIC }, 200 { SKIN_TOKEN_LASTTOUCH, "Tl" , "|D", SKIN_REFRESH_DYNAMIC },
201 { SKIN_TOKEN_CURRENT_SCREEN, "cs", "", SKIN_REFRESH_DYNAMIC }, 201 { SKIN_TOKEN_CURRENT_SCREEN, "cs", "", SKIN_REFRESH_DYNAMIC },
202 { SKIN_TOKEN_TOUCHREGION, "T" , "IIiiS", 0|NOBREAK }, 202 { SKIN_TOKEN_TOUCHREGION, "T" , "IIiiS|S", 0|NOBREAK },
203 203
204 { SKIN_TOKEN_HAVE_RECORDING, "Rp" , "", SKIN_REFRESH_STATIC }, 204 { SKIN_TOKEN_HAVE_RECORDING, "Rp" , "", SKIN_REFRESH_STATIC },
205 { SKIN_TOKEN_IS_RECORDING, "Rr" , "", SKIN_REFRESH_DYNAMIC }, 205 { SKIN_TOKEN_IS_RECORDING, "Rr" , "", SKIN_REFRESH_DYNAMIC },