diff options
Diffstat (limited to 'apps/settings.c')
-rw-r--r-- | apps/settings.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/apps/settings.c b/apps/settings.c index dfd211e3fa..7ce4beacaf 100644 --- a/apps/settings.c +++ b/apps/settings.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include "lcd.h" | 32 | #include "lcd.h" |
33 | #include "mpeg.h" | 33 | #include "mpeg.h" |
34 | #include "mp3_playback.h" | 34 | #include "mp3_playback.h" |
35 | #include "talk.h" | ||
35 | #include "string.h" | 36 | #include "string.h" |
36 | #include "ata.h" | 37 | #include "ata.h" |
37 | #include "fat.h" | 38 | #include "fat.h" |
@@ -1643,8 +1644,10 @@ void settings_reset(void) { | |||
1643 | 1644 | ||
1644 | bool set_bool(char* string, bool* variable ) | 1645 | bool set_bool(char* string, bool* variable ) |
1645 | { | 1646 | { |
1646 | return set_bool_options(string, variable, str(LANG_SET_BOOL_YES), | 1647 | return set_bool_options(string, variable, |
1647 | str(LANG_SET_BOOL_NO), NULL); | 1648 | STR(LANG_SET_BOOL_YES), |
1649 | STR(LANG_SET_BOOL_NO), | ||
1650 | NULL); | ||
1648 | } | 1651 | } |
1649 | 1652 | ||
1650 | /* wrapper to convert from int param to bool param in set_option */ | 1653 | /* wrapper to convert from int param to bool param in set_option */ |
@@ -1658,9 +1661,11 @@ void bool_funcwrapper(int value) | |||
1658 | } | 1661 | } |
1659 | 1662 | ||
1660 | bool set_bool_options(char* string, bool* variable, | 1663 | bool set_bool_options(char* string, bool* variable, |
1661 | char* yes_str, char* no_str, void (*function)(bool)) | 1664 | char* yes_str, int yes_voice, |
1665 | char* no_str, int no_voice, | ||
1666 | void (*function)(bool)) | ||
1662 | { | 1667 | { |
1663 | char* names[] = { no_str, yes_str }; | 1668 | struct opt_items names[] = { {no_str, no_voice}, {yes_str, yes_voice} }; |
1664 | bool result; | 1669 | bool result; |
1665 | 1670 | ||
1666 | boolfunction = function; | 1671 | boolfunction = function; |
@@ -1775,13 +1780,14 @@ bool set_int(char* string, | |||
1775 | code. */ | 1780 | code. */ |
1776 | 1781 | ||
1777 | bool set_option(char* string, void* variable, enum optiontype type, | 1782 | bool set_option(char* string, void* variable, enum optiontype type, |
1778 | char* options[], int numoptions, void (*function)(int)) | 1783 | struct opt_items* options, int numoptions, void (*function)(int)) |
1779 | { | 1784 | { |
1780 | bool done = false; | 1785 | bool done = false; |
1781 | int button; | 1786 | int button; |
1782 | int* intvar = (int*)variable; | 1787 | int* intvar = (int*)variable; |
1783 | bool* boolvar = (bool*)variable; | 1788 | bool* boolvar = (bool*)variable; |
1784 | int oldval = 0; | 1789 | int oldval = 0; |
1790 | int index, oldindex = -1; /* remember what we said */ | ||
1785 | 1791 | ||
1786 | if (type==INT) | 1792 | if (type==INT) |
1787 | oldval=*intvar; | 1793 | oldval=*intvar; |
@@ -1799,7 +1805,13 @@ bool set_option(char* string, void* variable, enum optiontype type, | |||
1799 | lcd_puts_scroll(0, 0, string); | 1805 | lcd_puts_scroll(0, 0, string); |
1800 | 1806 | ||
1801 | while ( !done ) { | 1807 | while ( !done ) { |
1802 | lcd_puts(0, 1, options[type==INT ? *intvar : (int)*boolvar]); | 1808 | index = type==INT ? *intvar : (int)*boolvar; |
1809 | lcd_puts(0, 1, options[index].string); | ||
1810 | if (index != oldindex) | ||
1811 | { | ||
1812 | talk_id(options[index].voice_id, false); | ||
1813 | oldindex = index; | ||
1814 | } | ||
1803 | #ifdef HAVE_LCD_BITMAP | 1815 | #ifdef HAVE_LCD_BITMAP |
1804 | status_draw(true); | 1816 | status_draw(true); |
1805 | #endif | 1817 | #endif |