diff options
-rw-r--r-- | apps/bookmark.c | 8 | ||||
-rw-r--r-- | apps/debug_menu.c | 34 | ||||
-rw-r--r-- | apps/main_menu.c | 42 | ||||
-rw-r--r-- | apps/menu.c | 19 | ||||
-rw-r--r-- | apps/menu.h | 8 | ||||
-rw-r--r-- | apps/onplay.c | 42 | ||||
-rw-r--r-- | apps/playlist_menu.c | 12 | ||||
-rw-r--r-- | apps/playlist_viewer.c | 21 | ||||
-rw-r--r-- | apps/recorder/radio.c | 9 | ||||
-rw-r--r-- | apps/settings.c | 4 | ||||
-rw-r--r-- | apps/settings.h | 28 | ||||
-rw-r--r-- | apps/settings_menu.c | 240 | ||||
-rw-r--r-- | apps/sound_menu.c | 68 | ||||
-rw-r--r-- | apps/talk.h | 4 | ||||
-rw-r--r-- | uisimulator/common/stubs.c | 5 |
15 files changed, 268 insertions, 276 deletions
diff --git a/apps/bookmark.c b/apps/bookmark.c index 7cc11ac0c3..993ea7e0ca 100644 --- a/apps/bookmark.c +++ b/apps/bookmark.c | |||
@@ -93,10 +93,10 @@ bool bookmark_menu(void) | |||
93 | int m; | 93 | int m; |
94 | bool result; | 94 | bool result; |
95 | 95 | ||
96 | struct menu_item items[] = { | 96 | static const struct menu_item items[] = { |
97 | { STR(LANG_BOOKMARK_MENU_CREATE), bookmark_create_menu}, | 97 | { ID2P(LANG_BOOKMARK_MENU_CREATE), bookmark_create_menu}, |
98 | { STR(LANG_BOOKMARK_MENU_LIST), bookmark_load_menu}, | 98 | { ID2P(LANG_BOOKMARK_MENU_LIST), bookmark_load_menu}, |
99 | { STR(LANG_BOOKMARK_MENU_RECENT_BOOKMARKS), bookmark_mrb_load}, | 99 | { ID2P(LANG_BOOKMARK_MENU_RECENT_BOOKMARKS), bookmark_mrb_load}, |
100 | }; | 100 | }; |
101 | 101 | ||
102 | m=menu_init( items, sizeof items / sizeof(struct menu_item), NULL, | 102 | m=menu_init( items, sizeof items / sizeof(struct menu_item), NULL, |
diff --git a/apps/debug_menu.c b/apps/debug_menu.c index cd6ad08154..b89b4e4ce3 100644 --- a/apps/debug_menu.c +++ b/apps/debug_menu.c | |||
@@ -1514,38 +1514,38 @@ bool debug_menu(void) | |||
1514 | int m; | 1514 | int m; |
1515 | bool result; | 1515 | bool result; |
1516 | 1516 | ||
1517 | struct menu_item items[] = { | 1517 | static const struct menu_item items[] = { |
1518 | { "Dump ROM contents", -1, dbg_save_roms }, | 1518 | { "Dump ROM contents", dbg_save_roms }, |
1519 | { "View I/O ports", -1, dbg_ports }, | 1519 | { "View I/O ports", dbg_ports }, |
1520 | #ifdef HAVE_LCD_BITMAP | 1520 | #ifdef HAVE_LCD_BITMAP |
1521 | #ifdef HAVE_RTC | 1521 | #ifdef HAVE_RTC |
1522 | { "View/clr RTC RAM", -1, dbg_rtc }, | 1522 | { "View/clr RTC RAM", dbg_rtc }, |
1523 | #endif /* HAVE_RTC */ | 1523 | #endif /* HAVE_RTC */ |
1524 | #endif /* HAVE_LCD_BITMAP */ | 1524 | #endif /* HAVE_LCD_BITMAP */ |
1525 | { "View OS stacks", -1, dbg_os }, | 1525 | { "View OS stacks", dbg_os }, |
1526 | #ifdef HAVE_MAS3507D | 1526 | #ifdef HAVE_MAS3507D |
1527 | { "View MAS info", -1, dbg_mas_info }, | 1527 | { "View MAS info", dbg_mas_info }, |
1528 | #endif | 1528 | #endif |
1529 | { "View MAS regs", -1, dbg_mas }, | 1529 | { "View MAS regs", dbg_mas }, |
1530 | #ifdef HAVE_MAS3587F | 1530 | #ifdef HAVE_MAS3587F |
1531 | { "View MAS codec", -1, dbg_mas_codec }, | 1531 | { "View MAS codec", dbg_mas_codec }, |
1532 | #endif | 1532 | #endif |
1533 | #ifdef HAVE_LCD_BITMAP | 1533 | #ifdef HAVE_LCD_BITMAP |
1534 | { "View battery", -1, view_battery }, | 1534 | { "View battery", view_battery }, |
1535 | { "Screendump", -1, dbg_screendump }, | 1535 | { "Screendump", dbg_screendump }, |
1536 | #endif | 1536 | #endif |
1537 | { "View HW info", -1, dbg_hw_info }, | 1537 | { "View HW info", dbg_hw_info }, |
1538 | { "View partitions", -1, dbg_partitions }, | 1538 | { "View partitions", dbg_partitions }, |
1539 | { "View disk info", -1, dbg_disk_info }, | 1539 | { "View disk info", dbg_disk_info }, |
1540 | #ifdef HAVE_LCD_BITMAP | 1540 | #ifdef HAVE_LCD_BITMAP |
1541 | { "View mpeg thread", -1, dbg_mpeg_thread }, | 1541 | { "View mpeg thread", dbg_mpeg_thread }, |
1542 | #ifdef PM_DEBUG | 1542 | #ifdef PM_DEBUG |
1543 | { "pm histogram", -1, peak_meter_histogram}, | 1543 | { "pm histogram", peak_meter_histogram}, |
1544 | #endif /* PM_DEBUG */ | 1544 | #endif /* PM_DEBUG */ |
1545 | #endif /* HAVE_LCD_BITMAP */ | 1545 | #endif /* HAVE_LCD_BITMAP */ |
1546 | { "View runtime", -1, view_runtime }, | 1546 | { "View runtime", view_runtime }, |
1547 | #ifdef HAVE_FMRADIO | 1547 | #ifdef HAVE_FMRADIO |
1548 | { "FM Radio", -1, dbg_fm_radio }, | 1548 | { "FM Radio", dbg_fm_radio }, |
1549 | #endif | 1549 | #endif |
1550 | }; | 1550 | }; |
1551 | 1551 | ||
diff --git a/apps/main_menu.c b/apps/main_menu.c index cdf8c575e3..462d10df0d 100644 --- a/apps/main_menu.c +++ b/apps/main_menu.c | |||
@@ -278,9 +278,9 @@ bool rec_menu(void) | |||
278 | bool result; | 278 | bool result; |
279 | 279 | ||
280 | /* recording menu */ | 280 | /* recording menu */ |
281 | struct menu_item items[] = { | 281 | static const struct menu_item items[] = { |
282 | { STR(LANG_RECORDING_MENU), recording_screen }, | 282 | { ID2P(LANG_RECORDING_MENU), recording_screen }, |
283 | { STR(LANG_RECORDING_SETTINGS), recording_settings}, | 283 | { ID2P(LANG_RECORDING_SETTINGS), recording_settings}, |
284 | }; | 284 | }; |
285 | 285 | ||
286 | m=menu_init( items, sizeof(items) / sizeof(*items), NULL, | 286 | m=menu_init( items, sizeof(items) / sizeof(*items), NULL, |
@@ -298,14 +298,14 @@ bool info_menu(void) | |||
298 | bool result; | 298 | bool result; |
299 | 299 | ||
300 | /* info menu */ | 300 | /* info menu */ |
301 | struct menu_item items[] = { | 301 | static const struct menu_item items[] = { |
302 | { STR(LANG_MENU_SHOW_ID3_INFO), browse_id3 }, | 302 | { ID2P(LANG_MENU_SHOW_ID3_INFO), browse_id3 }, |
303 | { STR(LANG_INFO_MENU), show_info }, | 303 | { ID2P(LANG_INFO_MENU), show_info }, |
304 | { STR(LANG_VERSION), show_credits }, | 304 | { ID2P(LANG_VERSION), show_credits }, |
305 | #ifndef SIMULATOR | 305 | #ifndef SIMULATOR |
306 | { STR(LANG_DEBUG), debug_menu }, | 306 | { ID2P(LANG_DEBUG), debug_menu }, |
307 | #else | 307 | #else |
308 | { STR(LANG_USB), simulate_usb }, | 308 | { ID2P(LANG_USB), simulate_usb }, |
309 | #endif | 309 | #endif |
310 | }; | 310 | }; |
311 | 311 | ||
@@ -326,42 +326,34 @@ bool main_menu(void) | |||
326 | /* main menu */ | 326 | /* main menu */ |
327 | struct menu_item items[8]; | 327 | struct menu_item items[8]; |
328 | 328 | ||
329 | items[i].desc = str(LANG_BOOKMARK_MENU); | 329 | items[i].desc = ID2P(LANG_BOOKMARK_MENU); |
330 | items[i].voice_id = LANG_BOOKMARK_MENU; | ||
331 | items[i++].function = bookmark_menu; | 330 | items[i++].function = bookmark_menu; |
332 | 331 | ||
333 | items[i].desc = str(LANG_SOUND_SETTINGS); | 332 | items[i].desc = ID2P(LANG_SOUND_SETTINGS); |
334 | items[i].voice_id = LANG_SOUND_SETTINGS; | ||
335 | items[i++].function = sound_menu; | 333 | items[i++].function = sound_menu; |
336 | 334 | ||
337 | items[i].desc = str(LANG_GENERAL_SETTINGS); | 335 | items[i].desc = ID2P(LANG_GENERAL_SETTINGS); |
338 | items[i].voice_id = LANG_GENERAL_SETTINGS; | ||
339 | items[i++].function = settings_menu; | 336 | items[i++].function = settings_menu; |
340 | 337 | ||
341 | #ifdef HAVE_FMRADIO | 338 | #ifdef HAVE_FMRADIO |
342 | if(radio_hardware_present()) { | 339 | if(radio_hardware_present()) { |
343 | items[i].desc = str(LANG_FM_RADIO); | 340 | items[i].desc = ID2P(LANG_FM_RADIO); |
344 | items[i].voice_id = LANG_FM_RADIO; | ||
345 | items[i++].function = radio_screen; | 341 | items[i++].function = radio_screen; |
346 | } | 342 | } |
347 | #endif | 343 | #endif |
348 | 344 | ||
349 | #ifdef HAVE_MAS3587F | 345 | #ifdef HAVE_MAS3587F |
350 | items[i].desc = str(LANG_RECORDING); | 346 | items[i].desc = ID2P(LANG_RECORDING); |
351 | items[i].voice_id = LANG_RECORDING; | ||
352 | items[i++].function = rec_menu; | 347 | items[i++].function = rec_menu; |
353 | #endif | 348 | #endif |
354 | 349 | ||
355 | items[i].desc = str(LANG_PLAYLIST_MENU); | 350 | items[i].desc = ID2P(LANG_PLAYLIST_MENU); |
356 | items[i].voice_id = LANG_PLAYLIST_MENU; | ||
357 | items[i++].function = playlist_menu; | 351 | items[i++].function = playlist_menu; |
358 | 352 | ||
359 | items[i].desc = str(LANG_PLUGINS); | 353 | items[i].desc = ID2P(LANG_PLUGINS); |
360 | items[i].voice_id = LANG_PLUGINS; | ||
361 | items[i++].function = plugin_browse; | 354 | items[i++].function = plugin_browse; |
362 | 355 | ||
363 | items[i].desc = str(LANG_INFO); | 356 | items[i].desc = ID2P(LANG_INFO); |
364 | items[i].voice_id = LANG_INFO; | ||
365 | items[i++].function = info_menu; | 357 | items[i++].function = info_menu; |
366 | 358 | ||
367 | m=menu_init( items, i, NULL, NULL, NULL, NULL ); | 359 | m=menu_init( items, i, NULL, NULL, NULL, NULL ); |
diff --git a/apps/menu.c b/apps/menu.c index e47523d4e4..72e4289fc5 100644 --- a/apps/menu.c +++ b/apps/menu.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include "status.h" | 33 | #include "status.h" |
34 | #include "screens.h" | 34 | #include "screens.h" |
35 | #include "talk.h" | 35 | #include "talk.h" |
36 | #include "lang.h" | ||
36 | 37 | ||
37 | #ifdef HAVE_LCD_BITMAP | 38 | #ifdef HAVE_LCD_BITMAP |
38 | #include "icons.h" | 39 | #include "icons.h" |
@@ -177,12 +178,12 @@ void menu_draw(int m) | |||
177 | #ifdef HAVE_LCD_BITMAP | 178 | #ifdef HAVE_LCD_BITMAP |
178 | if (global_settings.invert_cursor) | 179 | if (global_settings.invert_cursor) |
179 | lcd_puts_scroll_style(LINE_X, i-menus[m].top, | 180 | lcd_puts_scroll_style(LINE_X, i-menus[m].top, |
180 | menus[m].items[i].desc, STYLE_INVERT); | 181 | P2STR(menus[m].items[i].desc), STYLE_INVERT); |
181 | else | 182 | else |
182 | #endif | 183 | #endif |
183 | lcd_puts_scroll(LINE_X, i-menus[m].top, menus[m].items[i].desc); | 184 | lcd_puts_scroll(LINE_X, i-menus[m].top, P2STR(menus[m].items[i].desc)); |
184 | else | 185 | else |
185 | lcd_puts(LINE_X, i-menus[m].top, menus[m].items[i].desc); | 186 | lcd_puts(LINE_X, i-menus[m].top, P2STR(menus[m].items[i].desc)); |
186 | } | 187 | } |
187 | 188 | ||
188 | /* place the cursor */ | 189 | /* place the cursor */ |
@@ -216,13 +217,13 @@ static void put_cursor(int m, int target) | |||
216 | /* "say" the entry under the cursor */ | 217 | /* "say" the entry under the cursor */ |
217 | if(global_settings.talk_menu) | 218 | if(global_settings.talk_menu) |
218 | { | 219 | { |
219 | voice_id = menus[m].items[menus[m].cursor].voice_id; | 220 | voice_id = P2ID(menus[m].items[menus[m].cursor].desc); |
220 | if (voice_id >= 0) /* valid ID given? */ | 221 | if (voice_id >= 0) /* valid ID given? */ |
221 | talk_id(voice_id, false); /* say it */ | 222 | talk_id(voice_id, false); /* say it */ |
222 | } | 223 | } |
223 | } | 224 | } |
224 | 225 | ||
225 | int menu_init(struct menu_item* mitems, int count, int (*callback)(int, int), | 226 | int menu_init(const struct menu_item* mitems, int count, int (*callback)(int, int), |
226 | char *button1, char *button2, char *button3) | 227 | char *button1, char *button2, char *button3) |
227 | { | 228 | { |
228 | int i; | 229 | int i; |
@@ -237,7 +238,7 @@ int menu_init(struct menu_item* mitems, int count, int (*callback)(int, int), | |||
237 | DEBUGF("Out of menus!\n"); | 238 | DEBUGF("Out of menus!\n"); |
238 | return -1; | 239 | return -1; |
239 | } | 240 | } |
240 | menus[i].items = mitems; | 241 | menus[i].items = (struct menu_item*)mitems; /* de-const */ |
241 | menus[i].itemcount = count; | 242 | menus[i].itemcount = count; |
242 | menus[i].top = 0; | 243 | menus[i].top = 0; |
243 | menus[i].cursor = 0; | 244 | menus[i].cursor = 0; |
@@ -417,7 +418,7 @@ int menu_cursor(int menu) | |||
417 | 418 | ||
418 | char* menu_description(int menu, int position) | 419 | char* menu_description(int menu, int position) |
419 | { | 420 | { |
420 | return menus[menu].items[position].desc; | 421 | return P2STR(menus[menu].items[position].desc); |
421 | } | 422 | } |
422 | 423 | ||
423 | /* | 424 | /* |
@@ -440,8 +441,7 @@ void menu_delete(int menu, int position) | |||
440 | menus[menu].cursor = menus[menu].itemcount - 1; | 441 | menus[menu].cursor = menus[menu].itemcount - 1; |
441 | } | 442 | } |
442 | 443 | ||
443 | void menu_insert(int menu, int position, char *desc, int voice_id, | 444 | void menu_insert(int menu, int position, char *desc, bool (*function) (void)) |
444 | bool (*function) (void)) | ||
445 | { | 445 | { |
446 | int i; | 446 | int i; |
447 | 447 | ||
@@ -457,7 +457,6 @@ void menu_insert(int menu, int position, char *desc, int voice_id, | |||
457 | 457 | ||
458 | /* Update the current item */ | 458 | /* Update the current item */ |
459 | menus[menu].items[position].desc = desc; | 459 | menus[menu].items[position].desc = desc; |
460 | menus[menu].items[position].voice_id = voice_id; | ||
461 | menus[menu].items[position].function = function; | 460 | menus[menu].items[position].function = function; |
462 | } | 461 | } |
463 | 462 | ||
diff --git a/apps/menu.h b/apps/menu.h index 55c480aaab..d097f73a0f 100644 --- a/apps/menu.h +++ b/apps/menu.h | |||
@@ -23,12 +23,11 @@ | |||
23 | #include <stdbool.h> | 23 | #include <stdbool.h> |
24 | 24 | ||
25 | struct menu_item { | 25 | struct menu_item { |
26 | unsigned char *desc; /* string */ | 26 | unsigned char *desc; /* string or ID */ |
27 | int voice_id; /* the associated voice clip, -1 if none */ | ||
28 | bool (*function) (void); /* return true if USB was connected */ | 27 | bool (*function) (void); /* return true if USB was connected */ |
29 | }; | 28 | }; |
30 | 29 | ||
31 | int menu_init(struct menu_item* mitems, int count, int (*callback)(int, int), | 30 | int menu_init(const struct menu_item* mitems, int count, int (*callback)(int, int), |
32 | char *button1, char *button2, char *button3); | 31 | char *button1, char *button2, char *button3); |
33 | void menu_exit(int menu); | 32 | void menu_exit(int menu); |
34 | 33 | ||
@@ -47,7 +46,6 @@ int menu_count(int menu); | |||
47 | bool menu_moveup(int menu); | 46 | bool menu_moveup(int menu); |
48 | bool menu_movedown(int menu); | 47 | bool menu_movedown(int menu); |
49 | void menu_draw(int menu); | 48 | void menu_draw(int menu); |
50 | void menu_insert(int menu, int position, char *desc, int voice_id, | 49 | void menu_insert(int menu, int position, char *desc, bool (*function) (void)); |
51 | bool (*function) (void)); | ||
52 | 50 | ||
53 | #endif /* End __MENU_H__ */ | 51 | #endif /* End __MENU_H__ */ |
diff --git a/apps/onplay.c b/apps/onplay.c index e2a6c29374..3ea08fd9e5 100644 --- a/apps/onplay.c +++ b/apps/onplay.c | |||
@@ -174,8 +174,7 @@ static bool playlist_options(void) | |||
174 | 174 | ||
175 | if ((selected_file_attr & TREE_ATTR_MASK) == TREE_ATTR_M3U) | 175 | if ((selected_file_attr & TREE_ATTR_MASK) == TREE_ATTR_M3U) |
176 | { | 176 | { |
177 | items[i].desc = str(LANG_VIEW); | 177 | items[i].desc = ID2P(LANG_VIEW); |
178 | items[i].voice_id = LANG_VIEW; | ||
179 | items[i].function = view_playlist; | 178 | items[i].function = view_playlist; |
180 | i++; | 179 | i++; |
181 | pstart++; | 180 | pstart++; |
@@ -183,38 +182,32 @@ static bool playlist_options(void) | |||
183 | 182 | ||
184 | if (mpeg_status() & MPEG_STATUS_PLAY) | 183 | if (mpeg_status() & MPEG_STATUS_PLAY) |
185 | { | 184 | { |
186 | items[i].desc = str(LANG_INSERT); | 185 | items[i].desc = ID2P(LANG_INSERT); |
187 | items[i].voice_id = LANG_INSERT; | ||
188 | args[i].position = PLAYLIST_INSERT; | 186 | args[i].position = PLAYLIST_INSERT; |
189 | args[i].queue = false; | 187 | args[i].queue = false; |
190 | i++; | 188 | i++; |
191 | 189 | ||
192 | items[i].desc = str(LANG_INSERT_FIRST); | 190 | items[i].desc = ID2P(LANG_INSERT_FIRST); |
193 | items[i].voice_id = LANG_INSERT_FIRST; | ||
194 | args[i].position = PLAYLIST_INSERT_FIRST; | 191 | args[i].position = PLAYLIST_INSERT_FIRST; |
195 | args[i].queue = false; | 192 | args[i].queue = false; |
196 | i++; | 193 | i++; |
197 | 194 | ||
198 | items[i].desc = str(LANG_INSERT_LAST); | 195 | items[i].desc = ID2P(LANG_INSERT_LAST); |
199 | items[i].voice_id = LANG_INSERT_LAST; | ||
200 | args[i].position = PLAYLIST_INSERT_LAST; | 196 | args[i].position = PLAYLIST_INSERT_LAST; |
201 | args[i].queue = false; | 197 | args[i].queue = false; |
202 | i++; | 198 | i++; |
203 | 199 | ||
204 | items[i].desc = str(LANG_QUEUE); | 200 | items[i].desc = ID2P(LANG_QUEUE); |
205 | items[i].voice_id = LANG_QUEUE; | ||
206 | args[i].position = PLAYLIST_INSERT; | 201 | args[i].position = PLAYLIST_INSERT; |
207 | args[i].queue = true; | 202 | args[i].queue = true; |
208 | i++; | 203 | i++; |
209 | 204 | ||
210 | items[i].desc = str(LANG_QUEUE_FIRST); | 205 | items[i].desc = ID2P(LANG_QUEUE_FIRST); |
211 | items[i].voice_id = LANG_QUEUE_FIRST; | ||
212 | args[i].position = PLAYLIST_INSERT_FIRST; | 206 | args[i].position = PLAYLIST_INSERT_FIRST; |
213 | args[i].queue = true; | 207 | args[i].queue = true; |
214 | i++; | 208 | i++; |
215 | 209 | ||
216 | items[i].desc = str(LANG_QUEUE_LAST); | 210 | items[i].desc = ID2P(LANG_QUEUE_LAST); |
217 | items[i].voice_id = LANG_QUEUE_LAST; | ||
218 | args[i].position = PLAYLIST_INSERT_LAST; | 211 | args[i].position = PLAYLIST_INSERT_LAST; |
219 | args[i].queue = true; | 212 | args[i].queue = true; |
220 | i++; | 213 | i++; |
@@ -222,8 +215,7 @@ static bool playlist_options(void) | |||
222 | else if (((selected_file_attr & TREE_ATTR_MASK) == TREE_ATTR_MPA) || | 215 | else if (((selected_file_attr & TREE_ATTR_MASK) == TREE_ATTR_MPA) || |
223 | (selected_file_attr & ATTR_DIRECTORY)) | 216 | (selected_file_attr & ATTR_DIRECTORY)) |
224 | { | 217 | { |
225 | items[i].desc = str(LANG_INSERT); | 218 | items[i].desc = ID2P(LANG_INSERT); |
226 | items[i].voice_id = LANG_INSERT; | ||
227 | args[i].position = PLAYLIST_INSERT; | 219 | args[i].position = PLAYLIST_INSERT; |
228 | args[i].queue = false; | 220 | args[i].queue = false; |
229 | i++; | 221 | i++; |
@@ -419,8 +411,7 @@ int onplay(char* file, int attr) | |||
419 | 411 | ||
420 | if (!(attr & ATTR_DIRECTORY)) | 412 | if (!(attr & ATTR_DIRECTORY)) |
421 | { | 413 | { |
422 | items[i].desc = str(LANG_ONPLAY_OPEN_WITH); | 414 | items[i].desc = ID2P(LANG_ONPLAY_OPEN_WITH); |
423 | items[i].voice_id = LANG_ONPLAY_OPEN_WITH; | ||
424 | items[i].function = list_viewers; | 415 | items[i].function = list_viewers; |
425 | i++; | 416 | i++; |
426 | } | 417 | } |
@@ -429,35 +420,30 @@ int onplay(char* file, int attr) | |||
429 | (attr & ATTR_DIRECTORY) || | 420 | (attr & ATTR_DIRECTORY) || |
430 | ((attr & TREE_ATTR_MASK) == TREE_ATTR_M3U)) | 421 | ((attr & TREE_ATTR_MASK) == TREE_ATTR_M3U)) |
431 | { | 422 | { |
432 | items[i].desc = str(LANG_PLAYINDICES_PLAYLIST); | 423 | items[i].desc = ID2P(LANG_PLAYINDICES_PLAYLIST); |
433 | items[i].voice_id = LANG_PLAYINDICES_PLAYLIST; | ||
434 | items[i].function = playlist_options; | 424 | items[i].function = playlist_options; |
435 | i++; | 425 | i++; |
436 | } | 426 | } |
437 | 427 | ||
438 | items[i].desc = str(LANG_RENAME); | 428 | items[i].desc = ID2P(LANG_RENAME); |
439 | items[i].voice_id = LANG_RENAME; | ||
440 | items[i].function = rename_file; | 429 | items[i].function = rename_file; |
441 | i++; | 430 | i++; |
442 | 431 | ||
443 | if (!(attr & ATTR_DIRECTORY)) | 432 | if (!(attr & ATTR_DIRECTORY)) |
444 | { | 433 | { |
445 | items[i].desc = str(LANG_DELETE); | 434 | items[i].desc = ID2P(LANG_DELETE); |
446 | items[i].voice_id = LANG_DELETE; | ||
447 | items[i].function = delete_file; | 435 | items[i].function = delete_file; |
448 | i++; | 436 | i++; |
449 | } | 437 | } |
450 | else | 438 | else |
451 | { | 439 | { |
452 | items[i].desc = str(LANG_DELETE_DIR); | 440 | items[i].desc = ID2P(LANG_DELETE_DIR); |
453 | items[i].voice_id = LANG_DELETE_DIR; | ||
454 | items[i].function = delete_dir; | 441 | items[i].function = delete_dir; |
455 | i++; | 442 | i++; |
456 | } | 443 | } |
457 | } | 444 | } |
458 | 445 | ||
459 | items[i].desc = str(LANG_CREATE_DIR); | 446 | items[i].desc = ID2P(LANG_CREATE_DIR); |
460 | items[i].voice_id = LANG_CREATE_DIR; | ||
461 | items[i].function = create_dir; | 447 | items[i].function = create_dir; |
462 | i++; | 448 | i++; |
463 | 449 | ||
diff --git a/apps/playlist_menu.c b/apps/playlist_menu.c index d1c69bfdae..3497b1d54d 100644 --- a/apps/playlist_menu.c +++ b/apps/playlist_menu.c | |||
@@ -50,7 +50,7 @@ static bool save_playlist(void) | |||
50 | 50 | ||
51 | static bool recurse_directory(void) | 51 | static bool recurse_directory(void) |
52 | { | 52 | { |
53 | struct opt_items names[] = { | 53 | static const struct opt_items names[] = { |
54 | { STR(LANG_OFF) }, | 54 | { STR(LANG_OFF) }, |
55 | { STR(LANG_ON) }, | 55 | { STR(LANG_ON) }, |
56 | { STR(LANG_RESUME_SETTING_ASK)}, | 56 | { STR(LANG_RESUME_SETTING_ASK)}, |
@@ -66,11 +66,11 @@ bool playlist_menu(void) | |||
66 | int m; | 66 | int m; |
67 | bool result; | 67 | bool result; |
68 | 68 | ||
69 | struct menu_item items[] = { | 69 | static const struct menu_item items[] = { |
70 | { STR(LANG_CREATE_PLAYLIST), create_playlist }, | 70 | { ID2P(LANG_CREATE_PLAYLIST), create_playlist }, |
71 | { STR(LANG_VIEW_DYNAMIC_PLAYLIST), playlist_viewer }, | 71 | { ID2P(LANG_VIEW_DYNAMIC_PLAYLIST), playlist_viewer }, |
72 | { STR(LANG_SAVE_DYNAMIC_PLAYLIST), save_playlist }, | 72 | { ID2P(LANG_SAVE_DYNAMIC_PLAYLIST), save_playlist }, |
73 | { STR(LANG_RECURSE_DIRECTORY), recurse_directory }, | 73 | { ID2P(LANG_RECURSE_DIRECTORY), recurse_directory }, |
74 | }; | 74 | }; |
75 | 75 | ||
76 | m = menu_init( items, sizeof items / sizeof(struct menu_item), NULL, | 76 | m = menu_init( items, sizeof items / sizeof(struct menu_item), NULL, |
diff --git a/apps/playlist_viewer.c b/apps/playlist_viewer.c index c30daf48ba..4b9a3e3752 100644 --- a/apps/playlist_viewer.c +++ b/apps/playlist_viewer.c | |||
@@ -681,16 +681,13 @@ static int onplay_menu(int index) | |||
681 | int m, i=0, result, ret = 0; | 681 | int m, i=0, result, ret = 0; |
682 | bool current = (tracks[index].index == viewer.current_playing_track); | 682 | bool current = (tracks[index].index == viewer.current_playing_track); |
683 | 683 | ||
684 | items[i].desc = str(LANG_REMOVE); | 684 | items[i].desc = ID2P(LANG_REMOVE); |
685 | items[i].voice_id = LANG_REMOVE; | ||
686 | i++; | 685 | i++; |
687 | 686 | ||
688 | items[i].desc = str(LANG_MOVE); | 687 | items[i].desc = ID2P(LANG_MOVE); |
689 | items[i].voice_id = LANG_MOVE; | ||
690 | i++; | 688 | i++; |
691 | 689 | ||
692 | items[i].desc = str(LANG_FILE_OPTIONS); | 690 | items[i].desc = ID2P(LANG_FILE_OPTIONS); |
693 | items[i].voice_id = LANG_FILE_OPTIONS; | ||
694 | i++; | 691 | i++; |
695 | 692 | ||
696 | m = menu_init(items, i, NULL, NULL, NULL, NULL); | 693 | m = menu_init(items, i, NULL, NULL, NULL, NULL); |
@@ -757,11 +754,11 @@ static bool viewer_menu(void) | |||
757 | int m; | 754 | int m; |
758 | bool result; | 755 | bool result; |
759 | 756 | ||
760 | struct menu_item items[] = { | 757 | static const struct menu_item items[] = { |
761 | { STR(LANG_SHOW_ICONS), show_icons }, | 758 | { ID2P(LANG_SHOW_ICONS), show_icons }, |
762 | { STR(LANG_SHOW_INDICES), show_indices }, | 759 | { ID2P(LANG_SHOW_INDICES), show_indices }, |
763 | { STR(LANG_TRACK_DISPLAY), track_display }, | 760 | { ID2P(LANG_TRACK_DISPLAY), track_display }, |
764 | { STR(LANG_SAVE_DYNAMIC_PLAYLIST), save_playlist }, | 761 | { ID2P(LANG_SAVE_DYNAMIC_PLAYLIST), save_playlist }, |
765 | }; | 762 | }; |
766 | 763 | ||
767 | m=menu_init( items, sizeof(items) / sizeof(*items), NULL, | 764 | m=menu_init( items, sizeof(items) / sizeof(*items), NULL, |
@@ -791,7 +788,7 @@ static bool show_indices(void) | |||
791 | /* How to display a track */ | 788 | /* How to display a track */ |
792 | static bool track_display(void) | 789 | static bool track_display(void) |
793 | { | 790 | { |
794 | struct opt_items names[] = { | 791 | static const struct opt_items names[] = { |
795 | { STR(LANG_DISPLAY_TRACK_NAME_ONLY) }, | 792 | { STR(LANG_DISPLAY_TRACK_NAME_ONLY) }, |
796 | { STR(LANG_DISPLAY_FULL_PATH) } | 793 | { STR(LANG_DISPLAY_FULL_PATH) } |
797 | }; | 794 | }; |
diff --git a/apps/recorder/radio.c b/apps/recorder/radio.c index 00223a070e..ee57e8927c 100644 --- a/apps/recorder/radio.c +++ b/apps/recorder/radio.c | |||
@@ -641,7 +641,7 @@ static bool radio_add_preset(void) | |||
641 | strcpy(presets[num_presets].name, buf); | 641 | strcpy(presets[num_presets].name, buf); |
642 | presets[num_presets].frequency = curr_freq; | 642 | presets[num_presets].frequency = curr_freq; |
643 | menu_insert(preset_menu, -1, | 643 | menu_insert(preset_menu, -1, |
644 | presets[num_presets].name, 0, 0); | 644 | presets[num_presets].name, 0); |
645 | /* We must still rebuild the menu table, since the | 645 | /* We must still rebuild the menu table, since the |
646 | item name pointers must be updated */ | 646 | item name pointers must be updated */ |
647 | rebuild_preset_menu(); | 647 | rebuild_preset_menu(); |
@@ -832,12 +832,11 @@ bool radio_menu(void) | |||
832 | m = menu_init(items, 0, NULL, NULL, NULL, NULL); | 832 | m = menu_init(items, 0, NULL, NULL, NULL, NULL); |
833 | 833 | ||
834 | create_monomode_menu(); | 834 | create_monomode_menu(); |
835 | menu_insert(m, -1, monomode_menu_string, LANG_FM_MONO_MODE, | 835 | menu_insert(m, -1, monomode_menu_string, toggle_mono_mode); |
836 | toggle_mono_mode); | 836 | menu_insert(m, -1, ID2P(LANG_SOUND_SETTINGS), sound_menu); |
837 | menu_insert(m, -1, STR(LANG_SOUND_SETTINGS), sound_menu); | ||
838 | 837 | ||
839 | #ifndef SIMULATOR | 838 | #ifndef SIMULATOR |
840 | menu_insert(m, -1, STR(LANG_RECORDING_SETTINGS), fm_recording_settings); | 839 | menu_insert(m, -1, ID2P(LANG_RECORDING_SETTINGS), fm_recording_settings); |
841 | #endif | 840 | #endif |
842 | 841 | ||
843 | result = menu_run(m); | 842 | result = menu_run(m); |
diff --git a/apps/settings.c b/apps/settings.c index 4c1f8afc3b..31d9232851 100644 --- a/apps/settings.c +++ b/apps/settings.c | |||
@@ -1390,7 +1390,7 @@ bool set_int(char* string, | |||
1390 | code. */ | 1390 | code. */ |
1391 | 1391 | ||
1392 | bool set_option(char* string, void* variable, enum optiontype type, | 1392 | bool set_option(char* string, void* variable, enum optiontype type, |
1393 | struct opt_items* options, int numoptions, void (*function)(int)) | 1393 | const struct opt_items* options, int numoptions, void (*function)(int)) |
1394 | { | 1394 | { |
1395 | bool done = false; | 1395 | bool done = false; |
1396 | int button; | 1396 | int button; |
@@ -1416,7 +1416,7 @@ bool set_option(char* string, void* variable, enum optiontype type, | |||
1416 | 1416 | ||
1417 | while ( !done ) { | 1417 | while ( !done ) { |
1418 | index = type==INT ? *intvar : (int)*boolvar; | 1418 | index = type==INT ? *intvar : (int)*boolvar; |
1419 | lcd_puts(0, 1, options[index].string); | 1419 | lcd_puts(0, 1, P2STR(options[index].string)); |
1420 | if (global_settings.talk_menu && index != oldindex) | 1420 | if (global_settings.talk_menu && index != oldindex) |
1421 | { | 1421 | { |
1422 | talk_id(options[index].voice_id, false); | 1422 | talk_id(options[index].voice_id, false); |
diff --git a/apps/settings.h b/apps/settings.h index cf53ae736c..fc9a004cfc 100644 --- a/apps/settings.h +++ b/apps/settings.h | |||
@@ -62,6 +62,30 @@ | |||
62 | #define FF_REWIND_60000 13 | 62 | #define FF_REWIND_60000 13 |
63 | 63 | ||
64 | 64 | ||
65 | /* These define "virtual pointers", which could either be a literal string, | ||
66 | or a mean a string ID if the pointer is in a certain range. | ||
67 | This helps to save space for menus and options. */ | ||
68 | |||
69 | #define VIRT_SIZE 0xFFFF /* more than enough for our string ID range */ | ||
70 | #ifdef SIMULATOR | ||
71 | /* a space which is defined in stubs.c */ | ||
72 | extern unsigned char vp_dummy[VIRT_SIZE]; | ||
73 | #define VIRT_PTR vp_dummy | ||
74 | #else | ||
75 | /* a location where we won't store strings, 0 is the fastest */ | ||
76 | #define VIRT_PTR ((unsigned char*)0) | ||
77 | #endif | ||
78 | |||
79 | /* form a "virtual pointer" out of a language ID */ | ||
80 | #define ID2P(id) (VIRT_PTR + id) | ||
81 | |||
82 | /* resolve a pointer which could be a virtualized ID or a literal */ | ||
83 | #define P2STR(p) ((p>=VIRT_PTR && p<=VIRT_PTR+VIRT_SIZE) ? str(p-VIRT_PTR) : p) | ||
84 | |||
85 | /* get the string ID from a virtual pointer, -1 if not virtual */ | ||
86 | #define P2ID(p) ((p>=VIRT_PTR && p<=VIRT_PTR+VIRT_SIZE) ? p-VIRT_PTR : -1) | ||
87 | |||
88 | |||
65 | struct user_settings | 89 | struct user_settings |
66 | { | 90 | { |
67 | /* audio settings */ | 91 | /* audio settings */ |
@@ -224,7 +248,7 @@ struct user_settings | |||
224 | enum optiontype { INT, BOOL }; | 248 | enum optiontype { INT, BOOL }; |
225 | 249 | ||
226 | struct opt_items { | 250 | struct opt_items { |
227 | char* string; | 251 | unsigned char* string; |
228 | int voice_id; | 252 | int voice_id; |
229 | }; | 253 | }; |
230 | 254 | ||
@@ -247,7 +271,7 @@ bool set_bool_options(char* string, bool* variable, | |||
247 | 271 | ||
248 | bool set_bool(char* string, bool* variable ); | 272 | bool set_bool(char* string, bool* variable ); |
249 | bool set_option(char* string, void* variable, enum optiontype type, | 273 | bool set_option(char* string, void* variable, enum optiontype type, |
250 | struct opt_items* options, int numoptions, void (*function)(int)); | 274 | const struct opt_items* options, int numoptions, void (*function)(int)); |
251 | bool set_int(char* string, char* unit, int voice_unit, int* variable, | 275 | bool set_int(char* string, char* unit, int voice_unit, int* variable, |
252 | void (*function)(int), int step, int min, int max ); | 276 | void (*function)(int), int step, int min, int max ); |
253 | bool set_time_screen(char* string, struct tm *tm); | 277 | bool set_time_screen(char* string, struct tm *tm); |
diff --git a/apps/settings_menu.c b/apps/settings_menu.c index 057191e603..5da733c1df 100644 --- a/apps/settings_menu.c +++ b/apps/settings_menu.c | |||
@@ -136,7 +136,7 @@ static bool flip_display(void) | |||
136 | */ | 136 | */ |
137 | static bool battery_type(void) | 137 | static bool battery_type(void) |
138 | { | 138 | { |
139 | struct opt_items names[] = { | 139 | static const struct opt_items names[] = { |
140 | { STR(LANG_DISPLAY_GRAPHIC) }, | 140 | { STR(LANG_DISPLAY_GRAPHIC) }, |
141 | { STR(LANG_DISPLAY_NUMERIC) } | 141 | { STR(LANG_DISPLAY_NUMERIC) } |
142 | }; | 142 | }; |
@@ -149,7 +149,7 @@ static bool battery_type(void) | |||
149 | */ | 149 | */ |
150 | static bool volume_type(void) | 150 | static bool volume_type(void) |
151 | { | 151 | { |
152 | struct opt_items names[] = { | 152 | static const struct opt_items names[] = { |
153 | { STR(LANG_DISPLAY_GRAPHIC) }, | 153 | { STR(LANG_DISPLAY_GRAPHIC) }, |
154 | { STR(LANG_DISPLAY_NUMERIC) } | 154 | { STR(LANG_DISPLAY_NUMERIC) } |
155 | }; | 155 | }; |
@@ -172,7 +172,7 @@ static bool peak_meter_fps_menu(void) { | |||
172 | */ | 172 | */ |
173 | static bool peak_meter_hold(void) { | 173 | static bool peak_meter_hold(void) { |
174 | bool retval = false; | 174 | bool retval = false; |
175 | struct opt_items names[] = { | 175 | static const struct opt_items names[] = { |
176 | { STR(LANG_OFF) }, | 176 | { STR(LANG_OFF) }, |
177 | { "200 ms " , TALK_ID(200, UNIT_MS) }, | 177 | { "200 ms " , TALK_ID(200, UNIT_MS) }, |
178 | { "300 ms " , TALK_ID(300, UNIT_MS) }, | 178 | { "300 ms " , TALK_ID(300, UNIT_MS) }, |
@@ -209,7 +209,7 @@ static bool peak_meter_hold(void) { | |||
209 | static bool peak_meter_clip_hold(void) { | 209 | static bool peak_meter_clip_hold(void) { |
210 | bool retval = false; | 210 | bool retval = false; |
211 | 211 | ||
212 | struct opt_items names[] = { | 212 | static const struct opt_items names[] = { |
213 | { STR(LANG_PM_ETERNAL) }, | 213 | { STR(LANG_PM_ETERNAL) }, |
214 | { "1s " , TALK_ID(1, UNIT_SEC) }, | 214 | { "1s " , TALK_ID(1, UNIT_SEC) }, |
215 | { "2s " , TALK_ID(2, UNIT_SEC) }, | 215 | { "2s " , TALK_ID(2, UNIT_SEC) }, |
@@ -409,17 +409,17 @@ static bool peak_meter_menu(void) | |||
409 | int m; | 409 | int m; |
410 | bool result; | 410 | bool result; |
411 | 411 | ||
412 | struct menu_item items[] = { | 412 | static const struct menu_item items[] = { |
413 | { STR(LANG_PM_RELEASE) , peak_meter_release }, | 413 | { ID2P(LANG_PM_RELEASE) , peak_meter_release }, |
414 | { STR(LANG_PM_PEAK_HOLD), peak_meter_hold }, | 414 | { ID2P(LANG_PM_PEAK_HOLD), peak_meter_hold }, |
415 | { STR(LANG_PM_CLIP_HOLD), peak_meter_clip_hold }, | 415 | { ID2P(LANG_PM_CLIP_HOLD), peak_meter_clip_hold }, |
416 | { STR(LANG_PM_PERFORMANCE), peak_meter_performance }, | 416 | { ID2P(LANG_PM_PERFORMANCE), peak_meter_performance }, |
417 | #ifdef PM_DEBUG | 417 | #ifdef PM_DEBUG |
418 | { "Refresh rate" , -1 , peak_meter_fps_menu }, | 418 | { "Refresh rate" , -1 , peak_meter_fps_menu }, |
419 | #endif | 419 | #endif |
420 | { STR(LANG_PM_SCALE) , peak_meter_scale }, | 420 | { ID2P(LANG_PM_SCALE) , peak_meter_scale }, |
421 | { STR(LANG_PM_MIN) , peak_meter_min }, | 421 | { ID2P(LANG_PM_MIN) , peak_meter_min }, |
422 | { STR(LANG_PM_MAX) , peak_meter_max }, | 422 | { ID2P(LANG_PM_MAX) , peak_meter_max }, |
423 | }; | 423 | }; |
424 | 424 | ||
425 | m=menu_init( items, sizeof(items) / sizeof(*items), NULL, | 425 | m=menu_init( items, sizeof(items) / sizeof(*items), NULL, |
@@ -438,7 +438,7 @@ static bool shuffle(void) | |||
438 | static bool repeat_mode(void) | 438 | static bool repeat_mode(void) |
439 | { | 439 | { |
440 | bool result; | 440 | bool result; |
441 | struct opt_items names[] = { | 441 | static const struct opt_items names[] = { |
442 | { STR(LANG_OFF) }, | 442 | { STR(LANG_OFF) }, |
443 | { STR(LANG_REPEAT_ALL) }, | 443 | { STR(LANG_REPEAT_ALL) }, |
444 | { STR(LANG_REPEAT_ONE) } | 444 | { STR(LANG_REPEAT_ONE) } |
@@ -461,7 +461,7 @@ static bool play_selected(void) | |||
461 | 461 | ||
462 | static bool dir_filter(void) | 462 | static bool dir_filter(void) |
463 | { | 463 | { |
464 | struct opt_items names[] = { | 464 | static const struct opt_items names[] = { |
465 | { STR(LANG_FILTER_ALL) }, | 465 | { STR(LANG_FILTER_ALL) }, |
466 | { STR(LANG_FILTER_SUPPORTED) }, | 466 | { STR(LANG_FILTER_SUPPORTED) }, |
467 | { STR(LANG_FILTER_MUSIC) }, | 467 | { STR(LANG_FILTER_MUSIC) }, |
@@ -480,7 +480,7 @@ static bool sort_file(void) | |||
480 | { | 480 | { |
481 | int oldval = global_settings.sort_file; | 481 | int oldval = global_settings.sort_file; |
482 | bool ret; | 482 | bool ret; |
483 | struct opt_items names[] = { | 483 | static const struct opt_items names[] = { |
484 | { STR(LANG_SORT_ALPHA) }, | 484 | { STR(LANG_SORT_ALPHA) }, |
485 | { STR(LANG_SORT_DATE) }, | 485 | { STR(LANG_SORT_DATE) }, |
486 | { STR(LANG_SORT_DATE_REVERSE) }, | 486 | { STR(LANG_SORT_DATE_REVERSE) }, |
@@ -497,7 +497,7 @@ static bool sort_dir(void) | |||
497 | { | 497 | { |
498 | int oldval = global_settings.sort_dir; | 498 | int oldval = global_settings.sort_dir; |
499 | bool ret; | 499 | bool ret; |
500 | struct opt_items names[] = { | 500 | static const struct opt_items names[] = { |
501 | { STR(LANG_SORT_ALPHA) }, | 501 | { STR(LANG_SORT_ALPHA) }, |
502 | { STR(LANG_SORT_DATE) }, | 502 | { STR(LANG_SORT_DATE) }, |
503 | { STR(LANG_SORT_DATE_REVERSE) } | 503 | { STR(LANG_SORT_DATE_REVERSE) } |
@@ -511,7 +511,7 @@ static bool sort_dir(void) | |||
511 | 511 | ||
512 | static bool resume(void) | 512 | static bool resume(void) |
513 | { | 513 | { |
514 | struct opt_items names[] = { | 514 | static const struct opt_items names[] = { |
515 | { STR(LANG_SET_BOOL_NO) }, | 515 | { STR(LANG_SET_BOOL_NO) }, |
516 | { STR(LANG_RESUME_SETTING_ASK) }, | 516 | { STR(LANG_RESUME_SETTING_ASK) }, |
517 | { STR(LANG_RESUME_SETTING_ASK_ONCE) }, | 517 | { STR(LANG_RESUME_SETTING_ASK_ONCE) }, |
@@ -524,7 +524,7 @@ static bool resume(void) | |||
524 | static bool autocreatebookmark(void) | 524 | static bool autocreatebookmark(void) |
525 | { | 525 | { |
526 | bool retval = false; | 526 | bool retval = false; |
527 | struct opt_items names[] = { | 527 | static const struct opt_items names[] = { |
528 | { STR(LANG_SET_BOOL_NO) }, | 528 | { STR(LANG_SET_BOOL_NO) }, |
529 | { STR(LANG_SET_BOOL_YES) }, | 529 | { STR(LANG_SET_BOOL_YES) }, |
530 | { STR(LANG_RESUME_SETTING_ASK) }, | 530 | { STR(LANG_RESUME_SETTING_ASK) }, |
@@ -547,7 +547,7 @@ static bool autocreatebookmark(void) | |||
547 | 547 | ||
548 | static bool autoloadbookmark(void) | 548 | static bool autoloadbookmark(void) |
549 | { | 549 | { |
550 | struct opt_items names[] = { | 550 | static const struct opt_items names[] = { |
551 | { STR(LANG_SET_BOOL_NO) }, | 551 | { STR(LANG_SET_BOOL_NO) }, |
552 | { STR(LANG_SET_BOOL_YES) }, | 552 | { STR(LANG_SET_BOOL_YES) }, |
553 | { STR(LANG_RESUME_SETTING_ASK) } | 553 | { STR(LANG_RESUME_SETTING_ASK) } |
@@ -559,7 +559,7 @@ static bool autoloadbookmark(void) | |||
559 | 559 | ||
560 | static bool useMRB(void) | 560 | static bool useMRB(void) |
561 | { | 561 | { |
562 | struct opt_items names[] = { | 562 | static const struct opt_items names[] = { |
563 | { STR(LANG_SET_BOOL_NO) }, | 563 | { STR(LANG_SET_BOOL_NO) }, |
564 | { STR(LANG_SET_BOOL_YES) }, | 564 | { STR(LANG_SET_BOOL_YES) }, |
565 | { STR(LANG_BOOKMARK_SETTINGS_UNIQUE_ONLY) } | 565 | { STR(LANG_BOOKMARK_SETTINGS_UNIQUE_ONLY) } |
@@ -578,7 +578,7 @@ static bool backlight_on_when_charging(void) | |||
578 | 578 | ||
579 | static bool backlight_timer(void) | 579 | static bool backlight_timer(void) |
580 | { | 580 | { |
581 | struct opt_items names[] = { | 581 | static const struct opt_items names[] = { |
582 | { STR(LANG_OFF) }, | 582 | { STR(LANG_OFF) }, |
583 | { STR(LANG_ON) }, | 583 | { STR(LANG_ON) }, |
584 | { "1s ", TALK_ID(1, UNIT_SEC) }, | 584 | { "1s ", TALK_ID(1, UNIT_SEC) }, |
@@ -605,7 +605,7 @@ static bool backlight_timer(void) | |||
605 | 605 | ||
606 | static bool poweroff_idle_timer(void) | 606 | static bool poweroff_idle_timer(void) |
607 | { | 607 | { |
608 | struct opt_items names[] = { | 608 | static const struct opt_items names[] = { |
609 | { STR(LANG_OFF) }, | 609 | { STR(LANG_OFF) }, |
610 | { "1m ", TALK_ID(1, UNIT_MIN) }, | 610 | { "1m ", TALK_ID(1, UNIT_MIN) }, |
611 | { "2m ", TALK_ID(2, UNIT_MIN) }, | 611 | { "2m ", TALK_ID(2, UNIT_MIN) }, |
@@ -663,7 +663,7 @@ static bool bidir_limit(void) | |||
663 | #ifdef HAVE_LCD_CHARCELLS | 663 | #ifdef HAVE_LCD_CHARCELLS |
664 | static bool jump_scroll(void) | 664 | static bool jump_scroll(void) |
665 | { | 665 | { |
666 | struct opt_items names[] = { | 666 | static const struct opt_items names[] = { |
667 | { STR(LANG_OFF) }, | 667 | { STR(LANG_OFF) }, |
668 | { STR(LANG_ONE_TIME) }, | 668 | { STR(LANG_ONE_TIME) }, |
669 | { "2", TALK_ID(2, UNIT_INT) }, | 669 | { "2", TALK_ID(2, UNIT_INT) }, |
@@ -758,7 +758,7 @@ static bool timedate_set(void) | |||
758 | 758 | ||
759 | static bool timeformat_set(void) | 759 | static bool timeformat_set(void) |
760 | { | 760 | { |
761 | struct opt_items names[] = { | 761 | static const struct opt_items names[] = { |
762 | { STR(LANG_24_HOUR_CLOCK) }, | 762 | { STR(LANG_24_HOUR_CLOCK) }, |
763 | { STR(LANG_12_HOUR_CLOCK) } | 763 | { STR(LANG_12_HOUR_CLOCK) } |
764 | }; | 764 | }; |
@@ -815,7 +815,7 @@ static bool buffer_margin(void) | |||
815 | 815 | ||
816 | static bool ff_rewind_min_step(void) | 816 | static bool ff_rewind_min_step(void) |
817 | { | 817 | { |
818 | struct opt_items names[] = { | 818 | static const struct opt_items names[] = { |
819 | { "1s", TALK_ID(1, UNIT_SEC) }, | 819 | { "1s", TALK_ID(1, UNIT_SEC) }, |
820 | { "2s", TALK_ID(2, UNIT_SEC) }, | 820 | { "2s", TALK_ID(2, UNIT_SEC) }, |
821 | { "3s", TALK_ID(3, UNIT_SEC) }, | 821 | { "3s", TALK_ID(3, UNIT_SEC) }, |
@@ -843,7 +843,7 @@ static bool set_fade_on_stop(void) | |||
843 | 843 | ||
844 | static bool ff_rewind_accel(void) | 844 | static bool ff_rewind_accel(void) |
845 | { | 845 | { |
846 | struct opt_items names[] = { | 846 | static const struct opt_items names[] = { |
847 | { STR(LANG_OFF) }, | 847 | { STR(LANG_OFF) }, |
848 | { "2x/1s", TALK_ID(1, UNIT_SEC) }, | 848 | { "2x/1s", TALK_ID(1, UNIT_SEC) }, |
849 | { "2x/2s", TALK_ID(2, UNIT_SEC) }, | 849 | { "2x/2s", TALK_ID(2, UNIT_SEC) }, |
@@ -899,7 +899,7 @@ static bool voice_menus(void) | |||
899 | 899 | ||
900 | static bool voice_dirs(void) | 900 | static bool voice_dirs(void) |
901 | { | 901 | { |
902 | struct opt_items names[] = { | 902 | static const struct opt_items names[] = { |
903 | { STR(LANG_OFF) }, | 903 | { STR(LANG_OFF) }, |
904 | { STR(LANG_VOICE_NUMBER) }, | 904 | { STR(LANG_VOICE_NUMBER) }, |
905 | { STR(LANG_VOICE_SPELL) }, | 905 | { STR(LANG_VOICE_SPELL) }, |
@@ -912,7 +912,7 @@ static bool voice_dirs(void) | |||
912 | 912 | ||
913 | static bool voice_files(void) | 913 | static bool voice_files(void) |
914 | { | 914 | { |
915 | struct opt_items names[] = { | 915 | static const struct opt_items names[] = { |
916 | { STR(LANG_OFF) }, | 916 | { STR(LANG_OFF) }, |
917 | { STR(LANG_VOICE_NUMBER) }, | 917 | { STR(LANG_VOICE_NUMBER) }, |
918 | { STR(LANG_VOICE_SPELL) } | 918 | { STR(LANG_VOICE_SPELL) } |
@@ -926,10 +926,10 @@ static bool voice_menu(void) | |||
926 | int m; | 926 | int m; |
927 | bool result; | 927 | bool result; |
928 | 928 | ||
929 | struct menu_item items[] = { | 929 | static const struct menu_item items[] = { |
930 | { STR(LANG_VOICE_MENU), voice_menus }, | 930 | { ID2P(LANG_VOICE_MENU), voice_menus }, |
931 | { STR(LANG_VOICE_DIR), voice_dirs }, | 931 | { ID2P(LANG_VOICE_DIR), voice_dirs }, |
932 | { STR(LANG_VOICE_FILE), voice_files } | 932 | { ID2P(LANG_VOICE_FILE), voice_files } |
933 | }; | 933 | }; |
934 | 934 | ||
935 | m=menu_init( items, sizeof(items) / sizeof(*items), NULL, | 935 | m=menu_init( items, sizeof(items) / sizeof(*items), NULL, |
@@ -966,9 +966,9 @@ static bool ff_rewind_settings_menu(void) | |||
966 | int m; | 966 | int m; |
967 | bool result; | 967 | bool result; |
968 | 968 | ||
969 | struct menu_item items[] = { | 969 | static const struct menu_item items[] = { |
970 | { STR(LANG_FFRW_STEP), ff_rewind_min_step }, | 970 | { ID2P(LANG_FFRW_STEP), ff_rewind_min_step }, |
971 | { STR(LANG_FFRW_ACCEL), ff_rewind_accel }, | 971 | { ID2P(LANG_FFRW_ACCEL), ff_rewind_accel }, |
972 | }; | 972 | }; |
973 | 973 | ||
974 | m=menu_init( items, sizeof(items) / sizeof(*items), NULL, | 974 | m=menu_init( items, sizeof(items) / sizeof(*items), NULL, |
@@ -984,14 +984,14 @@ static bool playback_settings_menu(void) | |||
984 | int m; | 984 | int m; |
985 | bool result; | 985 | bool result; |
986 | 986 | ||
987 | struct menu_item items[] = { | 987 | static const struct menu_item items[] = { |
988 | { STR(LANG_SHUFFLE), shuffle }, | 988 | { ID2P(LANG_SHUFFLE), shuffle }, |
989 | { STR(LANG_REPEAT), repeat_mode }, | 989 | { ID2P(LANG_REPEAT), repeat_mode }, |
990 | { STR(LANG_PLAY_SELECTED), play_selected }, | 990 | { ID2P(LANG_PLAY_SELECTED), play_selected }, |
991 | { STR(LANG_RESUME), resume }, | 991 | { ID2P(LANG_RESUME), resume }, |
992 | { STR(LANG_WIND_MENU), ff_rewind_settings_menu }, | 992 | { ID2P(LANG_WIND_MENU), ff_rewind_settings_menu }, |
993 | { STR(LANG_MP3BUFFER_MARGIN), buffer_margin }, | 993 | { ID2P(LANG_MP3BUFFER_MARGIN), buffer_margin }, |
994 | { STR(LANG_FADE_ON_STOP), set_fade_on_stop }, | 994 | { ID2P(LANG_FADE_ON_STOP), set_fade_on_stop }, |
995 | }; | 995 | }; |
996 | 996 | ||
997 | bool old_shuffle = global_settings.playlist_shuffle; | 997 | bool old_shuffle = global_settings.playlist_shuffle; |
@@ -1020,10 +1020,10 @@ static bool bookmark_settings_menu(void) | |||
1020 | int m; | 1020 | int m; |
1021 | bool result; | 1021 | bool result; |
1022 | 1022 | ||
1023 | struct menu_item items[] = { | 1023 | static const struct menu_item items[] = { |
1024 | { STR(LANG_BOOKMARK_SETTINGS_AUTOCREATE), autocreatebookmark}, | 1024 | { ID2P(LANG_BOOKMARK_SETTINGS_AUTOCREATE), autocreatebookmark}, |
1025 | { STR(LANG_BOOKMARK_SETTINGS_AUTOLOAD), autoloadbookmark}, | 1025 | { ID2P(LANG_BOOKMARK_SETTINGS_AUTOLOAD), autoloadbookmark}, |
1026 | { STR(LANG_BOOKMARK_SETTINGS_MAINTAIN_RECENT_BOOKMARKS), useMRB}, | 1026 | { ID2P(LANG_BOOKMARK_SETTINGS_MAINTAIN_RECENT_BOOKMARKS), useMRB}, |
1027 | }; | 1027 | }; |
1028 | 1028 | ||
1029 | m=menu_init( items, sizeof(items) / sizeof(*items), NULL, | 1029 | m=menu_init( items, sizeof(items) / sizeof(*items), NULL, |
@@ -1088,13 +1088,13 @@ static bool fileview_settings_menu(void) | |||
1088 | int m; | 1088 | int m; |
1089 | bool result; | 1089 | bool result; |
1090 | 1090 | ||
1091 | struct menu_item items[] = { | 1091 | static const struct menu_item items[] = { |
1092 | { STR(LANG_SORT_CASE), sort_case }, | 1092 | { ID2P(LANG_SORT_CASE), sort_case }, |
1093 | { STR(LANG_SORT_DIR), sort_dir }, | 1093 | { ID2P(LANG_SORT_DIR), sort_dir }, |
1094 | { STR(LANG_SORT_FILE), sort_file }, | 1094 | { ID2P(LANG_SORT_FILE), sort_file }, |
1095 | { STR(LANG_FILTER), dir_filter }, | 1095 | { ID2P(LANG_FILTER), dir_filter }, |
1096 | { STR(LANG_FOLLOW), browse_current }, | 1096 | { ID2P(LANG_FOLLOW), browse_current }, |
1097 | { STR(LANG_SHOW_ICONS), show_icons }, | 1097 | { ID2P(LANG_SHOW_ICONS), show_icons }, |
1098 | }; | 1098 | }; |
1099 | 1099 | ||
1100 | m=menu_init( items, sizeof(items) / sizeof(*items), NULL, | 1100 | m=menu_init( items, sizeof(items) / sizeof(*items), NULL, |
@@ -1110,16 +1110,16 @@ static bool scroll_settings_menu(void) | |||
1110 | int m; | 1110 | int m; |
1111 | bool result; | 1111 | bool result; |
1112 | 1112 | ||
1113 | struct menu_item items[] = { | 1113 | static const struct menu_item items[] = { |
1114 | { STR(LANG_SCROLL_SPEED), scroll_speed }, | 1114 | { ID2P(LANG_SCROLL_SPEED), scroll_speed }, |
1115 | { STR(LANG_SCROLL_DELAY), scroll_delay }, | 1115 | { ID2P(LANG_SCROLL_DELAY), scroll_delay }, |
1116 | #ifdef HAVE_LCD_BITMAP | 1116 | #ifdef HAVE_LCD_BITMAP |
1117 | { STR(LANG_SCROLL_STEP), scroll_step }, | 1117 | { ID2P(LANG_SCROLL_STEP), scroll_step }, |
1118 | #endif | 1118 | #endif |
1119 | { STR(LANG_BIDIR_SCROLL), bidir_limit }, | 1119 | { ID2P(LANG_BIDIR_SCROLL), bidir_limit }, |
1120 | #ifdef HAVE_LCD_CHARCELLS | 1120 | #ifdef HAVE_LCD_CHARCELLS |
1121 | { STR(LANG_JUMP_SCROLL), jump_scroll }, | 1121 | { ID2P(LANG_JUMP_SCROLL), jump_scroll }, |
1122 | { STR(LANG_JUMP_SCROLL_DELAY), jump_scroll_delay }, | 1122 | { ID2P(LANG_JUMP_SCROLL_DELAY), jump_scroll_delay }, |
1123 | #endif | 1123 | #endif |
1124 | }; | 1124 | }; |
1125 | 1125 | ||
@@ -1135,15 +1135,15 @@ static bool lcd_settings_menu(void) | |||
1135 | int m; | 1135 | int m; |
1136 | bool result; | 1136 | bool result; |
1137 | 1137 | ||
1138 | struct menu_item items[] = { | 1138 | static const struct menu_item items[] = { |
1139 | { STR(LANG_BACKLIGHT), backlight_timer }, | 1139 | { ID2P(LANG_BACKLIGHT), backlight_timer }, |
1140 | { STR(LANG_BACKLIGHT_ON_WHEN_CHARGING), backlight_on_when_charging }, | 1140 | { ID2P(LANG_BACKLIGHT_ON_WHEN_CHARGING), backlight_on_when_charging }, |
1141 | { STR(LANG_CAPTION_BACKLIGHT), caption_backlight }, | 1141 | { ID2P(LANG_CAPTION_BACKLIGHT), caption_backlight }, |
1142 | { STR(LANG_CONTRAST), contrast }, | 1142 | { ID2P(LANG_CONTRAST), contrast }, |
1143 | #ifdef HAVE_LCD_BITMAP | 1143 | #ifdef HAVE_LCD_BITMAP |
1144 | { STR(LANG_INVERT), invert }, | 1144 | { ID2P(LANG_INVERT), invert }, |
1145 | { STR(LANG_FLIP_DISPLAY), flip_display }, | 1145 | { ID2P(LANG_FLIP_DISPLAY), flip_display }, |
1146 | { STR(LANG_INVERT_CURSOR), invert_cursor }, | 1146 | { ID2P(LANG_INVERT_CURSOR), invert_cursor }, |
1147 | #endif | 1147 | #endif |
1148 | }; | 1148 | }; |
1149 | 1149 | ||
@@ -1160,12 +1160,12 @@ static bool bars_settings_menu(void) | |||
1160 | int m; | 1160 | int m; |
1161 | bool result; | 1161 | bool result; |
1162 | 1162 | ||
1163 | struct menu_item items[] = { | 1163 | static const struct menu_item items[] = { |
1164 | { STR(LANG_SCROLL_BAR), scroll_bar }, | 1164 | { ID2P(LANG_SCROLL_BAR), scroll_bar }, |
1165 | { STR(LANG_STATUS_BAR), status_bar }, | 1165 | { ID2P(LANG_STATUS_BAR), status_bar }, |
1166 | { STR(LANG_BUTTON_BAR), button_bar }, | 1166 | { ID2P(LANG_BUTTON_BAR), button_bar }, |
1167 | { STR(LANG_VOLUME_DISPLAY), volume_type }, | 1167 | { ID2P(LANG_VOLUME_DISPLAY), volume_type }, |
1168 | { STR(LANG_BATTERY_DISPLAY), battery_type }, | 1168 | { ID2P(LANG_BATTERY_DISPLAY), battery_type }, |
1169 | }; | 1169 | }; |
1170 | 1170 | ||
1171 | m=menu_init( items, sizeof(items) / sizeof(*items), NULL, | 1171 | m=menu_init( items, sizeof(items) / sizeof(*items), NULL, |
@@ -1182,16 +1182,16 @@ static bool display_settings_menu(void) | |||
1182 | int m; | 1182 | int m; |
1183 | bool result; | 1183 | bool result; |
1184 | 1184 | ||
1185 | struct menu_item items[] = { | 1185 | static const struct menu_item items[] = { |
1186 | #ifdef HAVE_LCD_BITMAP | 1186 | #ifdef HAVE_LCD_BITMAP |
1187 | { STR(LANG_CUSTOM_FONT), font_browse }, | 1187 | { ID2P(LANG_CUSTOM_FONT), font_browse }, |
1188 | #endif | 1188 | #endif |
1189 | { STR(LANG_WHILE_PLAYING), custom_wps_browse }, | 1189 | { ID2P(LANG_WHILE_PLAYING), custom_wps_browse }, |
1190 | { STR(LANG_LCD_MENU), lcd_settings_menu }, | 1190 | { ID2P(LANG_LCD_MENU), lcd_settings_menu }, |
1191 | { STR(LANG_SCROLL_MENU), scroll_settings_menu }, | 1191 | { ID2P(LANG_SCROLL_MENU), scroll_settings_menu }, |
1192 | #ifdef HAVE_LCD_BITMAP | 1192 | #ifdef HAVE_LCD_BITMAP |
1193 | { STR(LANG_BARS_MENU), bars_settings_menu }, | 1193 | { ID2P(LANG_BARS_MENU), bars_settings_menu }, |
1194 | { STR(LANG_PM_MENU), peak_meter_menu }, | 1194 | { ID2P(LANG_PM_MENU), peak_meter_menu }, |
1195 | #endif | 1195 | #endif |
1196 | }; | 1196 | }; |
1197 | 1197 | ||
@@ -1213,16 +1213,16 @@ static bool battery_settings_menu(void) | |||
1213 | int m; | 1213 | int m; |
1214 | bool result; | 1214 | bool result; |
1215 | 1215 | ||
1216 | struct menu_item items[] = { | 1216 | static const struct menu_item items[] = { |
1217 | #ifdef HAVE_CHARGE_CTRL | 1217 | #ifdef HAVE_CHARGE_CTRL |
1218 | { STR(LANG_DISCHARGE), deep_discharge }, | 1218 | { ID2P(LANG_DISCHARGE), deep_discharge }, |
1219 | { STR(LANG_TRICKLE_CHARGE), trickle_charge }, | 1219 | { ID2P(LANG_TRICKLE_CHARGE), trickle_charge }, |
1220 | #endif | 1220 | #endif |
1221 | #ifndef SIMULATOR | 1221 | #ifndef SIMULATOR |
1222 | { STR(LANG_BATTERY_CAPACITY), battery_capacity }, | 1222 | { ID2P(LANG_BATTERY_CAPACITY), battery_capacity }, |
1223 | #else | 1223 | #else |
1224 | #ifndef HAVE_CHARGE_CTRL | 1224 | #ifndef HAVE_CHARGE_CTRL |
1225 | { "Dummy", -1, NULL }, /* to have an entry at all, in the simulator */ | 1225 | { "Dummy", NULL }, /* to have an entry at all, in the simulator */ |
1226 | #endif | 1226 | #endif |
1227 | #endif | 1227 | #endif |
1228 | }; | 1228 | }; |
@@ -1239,10 +1239,10 @@ static bool disk_settings_menu(void) | |||
1239 | int m; | 1239 | int m; |
1240 | bool result; | 1240 | bool result; |
1241 | 1241 | ||
1242 | struct menu_item items[] = { | 1242 | static const struct menu_item items[] = { |
1243 | { STR(LANG_SPINDOWN), spindown }, | 1243 | { ID2P(LANG_SPINDOWN), spindown }, |
1244 | #ifdef HAVE_ATA_POWER_OFF | 1244 | #ifdef HAVE_ATA_POWER_OFF |
1245 | { STR(LANG_POWEROFF), poweroff }, | 1245 | { ID2P(LANG_POWEROFF), poweroff }, |
1246 | #endif | 1246 | #endif |
1247 | }; | 1247 | }; |
1248 | 1248 | ||
@@ -1259,9 +1259,9 @@ static bool time_settings_menu(void) | |||
1259 | int m; | 1259 | int m; |
1260 | bool result; | 1260 | bool result; |
1261 | 1261 | ||
1262 | struct menu_item items[] = { | 1262 | static const struct menu_item items[] = { |
1263 | { STR(LANG_TIME), timedate_set }, | 1263 | { ID2P(LANG_TIME), timedate_set }, |
1264 | { STR(LANG_TIMEFORMAT), timeformat_set }, | 1264 | { ID2P(LANG_TIMEFORMAT), timeformat_set }, |
1265 | }; | 1265 | }; |
1266 | 1266 | ||
1267 | m=menu_init( items, sizeof(items) / sizeof(*items), NULL, | 1267 | m=menu_init( items, sizeof(items) / sizeof(*items), NULL, |
@@ -1277,11 +1277,11 @@ static bool manage_settings_menu(void) | |||
1277 | int m; | 1277 | int m; |
1278 | bool result; | 1278 | bool result; |
1279 | 1279 | ||
1280 | struct menu_item items[] = { | 1280 | static const struct menu_item items[] = { |
1281 | { STR(LANG_CUSTOM_CFG), custom_cfg_browse }, | 1281 | { ID2P(LANG_CUSTOM_CFG), custom_cfg_browse }, |
1282 | { STR(LANG_FIRMWARE), firmware_browse }, | 1282 | { ID2P(LANG_FIRMWARE), firmware_browse }, |
1283 | { STR(LANG_RESET), reset_settings }, | 1283 | { ID2P(LANG_RESET), reset_settings }, |
1284 | { STR(LANG_SAVE_SETTINGS), settings_save_config }, | 1284 | { ID2P(LANG_SAVE_SETTINGS), settings_save_config }, |
1285 | }; | 1285 | }; |
1286 | 1286 | ||
1287 | m=menu_init( items, sizeof(items) / sizeof(*items), NULL, | 1287 | m=menu_init( items, sizeof(items) / sizeof(*items), NULL, |
@@ -1296,9 +1296,9 @@ static bool limits_settings_menu(void) | |||
1296 | int m; | 1296 | int m; |
1297 | bool result; | 1297 | bool result; |
1298 | 1298 | ||
1299 | struct menu_item items[] = { | 1299 | static const struct menu_item items[] = { |
1300 | { STR(LANG_MAX_FILES_IN_DIR), max_files_in_dir }, | 1300 | { ID2P(LANG_MAX_FILES_IN_DIR), max_files_in_dir }, |
1301 | { STR(LANG_MAX_FILES_IN_PLAYLIST), max_files_in_playlist }, | 1301 | { ID2P(LANG_MAX_FILES_IN_PLAYLIST), max_files_in_playlist }, |
1302 | }; | 1302 | }; |
1303 | 1303 | ||
1304 | m=menu_init( items, sizeof(items) / sizeof(*items), NULL, | 1304 | m=menu_init( items, sizeof(items) / sizeof(*items), NULL, |
@@ -1314,23 +1314,23 @@ static bool system_settings_menu(void) | |||
1314 | int m; | 1314 | int m; |
1315 | bool result; | 1315 | bool result; |
1316 | 1316 | ||
1317 | struct menu_item items[] = { | 1317 | static const struct menu_item items[] = { |
1318 | { STR(LANG_BATTERY_MENU), battery_settings_menu }, | 1318 | { ID2P(LANG_BATTERY_MENU), battery_settings_menu }, |
1319 | { STR(LANG_DISK_MENU), disk_settings_menu }, | 1319 | { ID2P(LANG_DISK_MENU), disk_settings_menu }, |
1320 | #ifdef HAVE_RTC | 1320 | #ifdef HAVE_RTC |
1321 | { STR(LANG_TIME_MENU), time_settings_menu }, | 1321 | { ID2P(LANG_TIME_MENU), time_settings_menu }, |
1322 | #endif | 1322 | #endif |
1323 | { STR(LANG_POWEROFF_IDLE), poweroff_idle_timer }, | 1323 | { ID2P(LANG_POWEROFF_IDLE), poweroff_idle_timer }, |
1324 | { STR(LANG_SLEEP_TIMER), sleeptimer_screen }, | 1324 | { ID2P(LANG_SLEEP_TIMER), sleeptimer_screen }, |
1325 | #ifdef HAVE_ALARM_MOD | 1325 | #ifdef HAVE_ALARM_MOD |
1326 | { STR(LANG_ALARM_MOD_ALARM_MENU), alarm_screen }, | 1326 | { ID2P(LANG_ALARM_MOD_ALARM_MENU), alarm_screen }, |
1327 | #endif | 1327 | #endif |
1328 | { STR(LANG_LIMITS_MENU), limits_settings_menu }, | 1328 | { ID2P(LANG_LIMITS_MENU), limits_settings_menu }, |
1329 | #ifdef HAVE_MAS3507D | 1329 | #ifdef HAVE_MAS3507D |
1330 | { STR(LANG_LINE_IN), line_in }, | 1330 | { ID2P(LANG_LINE_IN), line_in }, |
1331 | #endif | 1331 | #endif |
1332 | { STR(LANG_CAR_ADAPTER_MODE), car_adapter_mode }, | 1332 | { ID2P(LANG_CAR_ADAPTER_MODE), car_adapter_mode }, |
1333 | { STR(LANG_MANAGE_MENU), manage_settings_menu }, | 1333 | { ID2P(LANG_MANAGE_MENU), manage_settings_menu }, |
1334 | }; | 1334 | }; |
1335 | 1335 | ||
1336 | m=menu_init( items, sizeof(items) / sizeof(*items), NULL, | 1336 | m=menu_init( items, sizeof(items) / sizeof(*items), NULL, |
@@ -1345,14 +1345,14 @@ bool settings_menu(void) | |||
1345 | int m; | 1345 | int m; |
1346 | bool result; | 1346 | bool result; |
1347 | 1347 | ||
1348 | struct menu_item items[] = { | 1348 | static const struct menu_item items[] = { |
1349 | { STR(LANG_PLAYBACK), playback_settings_menu }, | 1349 | { ID2P(LANG_PLAYBACK), playback_settings_menu }, |
1350 | { STR(LANG_FILE), fileview_settings_menu }, | 1350 | { ID2P(LANG_FILE), fileview_settings_menu }, |
1351 | { STR(LANG_DISPLAY), display_settings_menu }, | 1351 | { ID2P(LANG_DISPLAY), display_settings_menu }, |
1352 | { STR(LANG_SYSTEM), system_settings_menu }, | 1352 | { ID2P(LANG_SYSTEM), system_settings_menu }, |
1353 | { STR(LANG_BOOKMARK_SETTINGS),bookmark_settings_menu }, | 1353 | { ID2P(LANG_BOOKMARK_SETTINGS),bookmark_settings_menu }, |
1354 | { STR(LANG_LANGUAGE), language_browse }, | 1354 | { ID2P(LANG_LANGUAGE), language_browse }, |
1355 | { STR(LANG_VOICE), voice_menu }, | 1355 | { ID2P(LANG_VOICE), voice_menu }, |
1356 | }; | 1356 | }; |
1357 | 1357 | ||
1358 | m=menu_init( items, sizeof(items) / sizeof(*items), NULL, | 1358 | m=menu_init( items, sizeof(items) / sizeof(*items), NULL, |
diff --git a/apps/sound_menu.c b/apps/sound_menu.c index 8b762823f3..4c9087e5f5 100644 --- a/apps/sound_menu.c +++ b/apps/sound_menu.c | |||
@@ -239,7 +239,7 @@ static void set_avc(int val) | |||
239 | 239 | ||
240 | static bool avc(void) | 240 | static bool avc(void) |
241 | { | 241 | { |
242 | struct opt_items names[] = { | 242 | static const struct opt_items names[] = { |
243 | { STR(LANG_OFF) }, | 243 | { STR(LANG_OFF) }, |
244 | { "20ms", TALK_ID(20, UNIT_MS) }, | 244 | { "20ms", TALK_ID(20, UNIT_MS) }, |
245 | { "2s", TALK_ID(2, UNIT_SEC) }, | 245 | { "2s", TALK_ID(2, UNIT_SEC) }, |
@@ -252,7 +252,7 @@ static bool avc(void) | |||
252 | 252 | ||
253 | static bool recsource(void) | 253 | static bool recsource(void) |
254 | { | 254 | { |
255 | struct opt_items names[] = { | 255 | static const struct opt_items names[] = { |
256 | { STR(LANG_RECORDING_SRC_MIC) }, | 256 | { STR(LANG_RECORDING_SRC_MIC) }, |
257 | { STR(LANG_RECORDING_SRC_LINE) }, | 257 | { STR(LANG_RECORDING_SRC_LINE) }, |
258 | { STR(LANG_RECORDING_SRC_DIGITAL) } | 258 | { STR(LANG_RECORDING_SRC_DIGITAL) } |
@@ -264,7 +264,7 @@ static bool recsource(void) | |||
264 | 264 | ||
265 | static bool recfrequency(void) | 265 | static bool recfrequency(void) |
266 | { | 266 | { |
267 | struct opt_items names[] = { | 267 | static const struct opt_items names[] = { |
268 | { "44.1kHz", TALK_ID(44, UNIT_KHZ) }, | 268 | { "44.1kHz", TALK_ID(44, UNIT_KHZ) }, |
269 | { "48kHz", TALK_ID(48, UNIT_KHZ) }, | 269 | { "48kHz", TALK_ID(48, UNIT_KHZ) }, |
270 | { "32kHz", TALK_ID(32, UNIT_KHZ) }, | 270 | { "32kHz", TALK_ID(32, UNIT_KHZ) }, |
@@ -279,7 +279,7 @@ static bool recfrequency(void) | |||
279 | 279 | ||
280 | static bool recchannels(void) | 280 | static bool recchannels(void) |
281 | { | 281 | { |
282 | struct opt_items names[] = { | 282 | static const struct opt_items names[] = { |
283 | { STR(LANG_CHANNEL_STEREO) }, | 283 | { STR(LANG_CHANNEL_STEREO) }, |
284 | { STR(LANG_CHANNEL_MONO) } | 284 | { STR(LANG_CHANNEL_MONO) } |
285 | }; | 285 | }; |
@@ -303,7 +303,7 @@ static bool receditable(void) | |||
303 | 303 | ||
304 | static bool rectimesplit(void) | 304 | static bool rectimesplit(void) |
305 | { | 305 | { |
306 | struct opt_items names[] = { | 306 | static const struct opt_items names[] = { |
307 | { STR(LANG_OFF) }, | 307 | { STR(LANG_OFF) }, |
308 | { "00:05" , TALK_ID(5, UNIT_MIN) }, | 308 | { "00:05" , TALK_ID(5, UNIT_MIN) }, |
309 | { "00:10" , TALK_ID(10, UNIT_MIN) }, | 309 | { "00:10" , TALK_ID(10, UNIT_MIN) }, |
@@ -326,7 +326,7 @@ static bool rectimesplit(void) | |||
326 | 326 | ||
327 | static bool recprerecord(void) | 327 | static bool recprerecord(void) |
328 | { | 328 | { |
329 | struct opt_items names[] = { | 329 | static const struct opt_items names[] = { |
330 | { STR(LANG_OFF) }, | 330 | { STR(LANG_OFF) }, |
331 | { "1s", TALK_ID(1, UNIT_SEC) }, | 331 | { "1s", TALK_ID(1, UNIT_SEC) }, |
332 | { "2s", TALK_ID(2, UNIT_SEC) }, | 332 | { "2s", TALK_ID(2, UNIT_SEC) }, |
@@ -366,7 +366,7 @@ static bool recprerecord(void) | |||
366 | 366 | ||
367 | static bool recdirectory(void) | 367 | static bool recdirectory(void) |
368 | { | 368 | { |
369 | struct opt_items names[] = { | 369 | static const struct opt_items names[] = { |
370 | { rec_base_directory, -1 }, | 370 | { rec_base_directory, -1 }, |
371 | { STR(LANG_RECORD_CURRENT_DIR) } | 371 | { STR(LANG_RECORD_CURRENT_DIR) } |
372 | }; | 372 | }; |
@@ -384,7 +384,7 @@ static void set_chanconf(int val) | |||
384 | 384 | ||
385 | static bool chanconf(void) | 385 | static bool chanconf(void) |
386 | { | 386 | { |
387 | struct opt_items names[] = { | 387 | static const struct opt_items names[] = { |
388 | { STR(LANG_CHANNEL_STEREO) }, | 388 | { STR(LANG_CHANNEL_STEREO) }, |
389 | #ifdef HAVE_LCD_CHARCELLS | 389 | #ifdef HAVE_LCD_CHARCELLS |
390 | { STR(LANG_CHANNEL_STEREO_NARROW_PLAYER) }, | 390 | { STR(LANG_CHANNEL_STEREO_NARROW_PLAYER) }, |
@@ -405,21 +405,21 @@ bool sound_menu(void) | |||
405 | { | 405 | { |
406 | int m; | 406 | int m; |
407 | bool result; | 407 | bool result; |
408 | struct menu_item items[] = { | 408 | static const struct menu_item items[] = { |
409 | { STR(LANG_VOLUME), volume }, | 409 | { ID2P(LANG_VOLUME), volume }, |
410 | { STR(LANG_BASS), bass }, | 410 | { ID2P(LANG_BASS), bass }, |
411 | { STR(LANG_TREBLE), treble }, | 411 | { ID2P(LANG_TREBLE), treble }, |
412 | { STR(LANG_BALANCE), balance }, | 412 | { ID2P(LANG_BALANCE), balance }, |
413 | { STR(LANG_CHANNEL_MENU), chanconf }, | 413 | { ID2P(LANG_CHANNEL_MENU), chanconf }, |
414 | #ifdef HAVE_MAS3587F | 414 | #ifdef HAVE_MAS3587F |
415 | { STR(LANG_LOUDNESS), loudness }, | 415 | { ID2P(LANG_LOUDNESS), loudness }, |
416 | { STR(LANG_AUTOVOL), avc }, | 416 | { ID2P(LANG_AUTOVOL), avc }, |
417 | { STR(LANG_SUPERBASS), superbass }, | 417 | { ID2P(LANG_SUPERBASS), superbass }, |
418 | { STR(LANG_MDB_ENABLE), mdb_enable }, | 418 | { ID2P(LANG_MDB_ENABLE), mdb_enable }, |
419 | { STR(LANG_MDB_STRENGTH), mdb_strength }, | 419 | { ID2P(LANG_MDB_STRENGTH), mdb_strength }, |
420 | { STR(LANG_MDB_HARMONICS), mdb_harmonics }, | 420 | { ID2P(LANG_MDB_HARMONICS), mdb_harmonics }, |
421 | { STR(LANG_MDB_CENTER), mdb_center }, | 421 | { ID2P(LANG_MDB_CENTER), mdb_center }, |
422 | { STR(LANG_MDB_SHAPE), mdb_shape }, | 422 | { ID2P(LANG_MDB_SHAPE), mdb_shape }, |
423 | #endif | 423 | #endif |
424 | }; | 424 | }; |
425 | 425 | ||
@@ -439,31 +439,23 @@ bool recording_menu(bool no_source) | |||
439 | struct menu_item items[8]; | 439 | struct menu_item items[8]; |
440 | bool result; | 440 | bool result; |
441 | 441 | ||
442 | items[i].desc = str(LANG_RECORDING_QUALITY); | 442 | items[i].desc = ID2P(LANG_RECORDING_QUALITY); |
443 | items[i].voice_id = LANG_RECORDING_QUALITY; | ||
444 | items[i++].function = recquality; | 443 | items[i++].function = recquality; |
445 | items[i].desc = str(LANG_RECORDING_FREQUENCY); | 444 | items[i].desc = ID2P(LANG_RECORDING_FREQUENCY); |
446 | items[i].voice_id = LANG_RECORDING_FREQUENCY; | ||
447 | items[i++].function = recfrequency; | 445 | items[i++].function = recfrequency; |
448 | if(!no_source) { | 446 | if(!no_source) { |
449 | items[i].desc = str(LANG_RECORDING_SOURCE); | 447 | items[i].desc = ID2P(LANG_RECORDING_SOURCE); |
450 | items[i].voice_id = LANG_RECORDING_SOURCE; | ||
451 | items[i++].function = recsource; | 448 | items[i++].function = recsource; |
452 | } | 449 | } |
453 | items[i].desc = str(LANG_RECORDING_CHANNELS); | 450 | items[i].desc = ID2P(LANG_RECORDING_CHANNELS); |
454 | items[i].voice_id = LANG_RECORDING_CHANNELS; | ||
455 | items[i++].function = recchannels; | 451 | items[i++].function = recchannels; |
456 | items[i].desc = str(LANG_RECORDING_EDITABLE); | 452 | items[i].desc = ID2P(LANG_RECORDING_EDITABLE); |
457 | items[i].voice_id = LANG_RECORDING_EDITABLE; | ||
458 | items[i++].function = receditable; | 453 | items[i++].function = receditable; |
459 | items[i].desc = str(LANG_RECORD_TIMESPLIT); | 454 | items[i].desc = ID2P(LANG_RECORD_TIMESPLIT); |
460 | items[i].voice_id = LANG_RECORD_TIMESPLIT; | ||
461 | items[i++].function = rectimesplit; | 455 | items[i++].function = rectimesplit; |
462 | items[i].desc = str(LANG_RECORD_PRERECORD_TIME); | 456 | items[i].desc = ID2P(LANG_RECORD_PRERECORD_TIME); |
463 | items[i].voice_id = LANG_RECORD_PRERECORD_TIME; | ||
464 | items[i++].function = recprerecord; | 457 | items[i++].function = recprerecord; |
465 | items[i].desc = str(LANG_RECORD_DIRECTORY); | 458 | items[i].desc = ID2P(LANG_RECORD_DIRECTORY); |
466 | items[i].voice_id = LANG_RECORD_DIRECTORY; | ||
467 | items[i++].function = recdirectory; | 459 | items[i++].function = recdirectory; |
468 | 460 | ||
469 | m=menu_init( items, i, NULL, NULL, NULL, NULL); | 461 | m=menu_init( items, i, NULL, NULL, NULL, NULL); |
diff --git a/apps/talk.h b/apps/talk.h index 51504c1a7c..2476c8ec02 100644 --- a/apps/talk.h +++ b/apps/talk.h | |||
@@ -51,8 +51,8 @@ enum { | |||
51 | unit is upper 4 bits, number the remaining (in regular 2's complement) */ | 51 | unit is upper 4 bits, number the remaining (in regular 2's complement) */ |
52 | #define TALK_ID(n,u) ((u)<<UNIT_SHIFT | ((n) & ~(-1<<UNIT_SHIFT))) | 52 | #define TALK_ID(n,u) ((u)<<UNIT_SHIFT | ((n) & ~(-1<<UNIT_SHIFT))) |
53 | 53 | ||
54 | /* convenience macro to have both string and ID as arguments */ | 54 | /* convenience macro to have both virtual pointer and ID as arguments */ |
55 | #define STR(id) str(id), id | 55 | #define STR(id) ID2P(id), id |
56 | 56 | ||
57 | /* publish this string, so it's stored only once (better than #define) */ | 57 | /* publish this string, so it's stored only once (better than #define) */ |
58 | extern const char* dir_thumbnail_name; | 58 | extern const char* dir_thumbnail_name; |
diff --git a/uisimulator/common/stubs.c b/uisimulator/common/stubs.c index ceb8ba1ebe..700188fe2a 100644 --- a/uisimulator/common/stubs.c +++ b/uisimulator/common/stubs.c | |||
@@ -28,6 +28,7 @@ | |||
28 | 28 | ||
29 | #include "string.h" | 29 | #include "string.h" |
30 | #include "lcd.h" | 30 | #include "lcd.h" |
31 | #include "settings.h" | ||
31 | 32 | ||
32 | extern char having_new_lcd; | 33 | extern char having_new_lcd; |
33 | 34 | ||
@@ -277,3 +278,7 @@ void remove_thread(int threadnum) | |||
277 | { | 278 | { |
278 | (void)threadnum; | 279 | (void)threadnum; |
279 | } | 280 | } |
281 | |||
282 | /* assure an unused place to direct virtual pointers to */ | ||
283 | unsigned char vp_dummy[VIRT_SIZE]; | ||
284 | |||