diff options
author | Jonathan Gordon <rockbox@jdgordon.info> | 2013-03-27 22:43:40 +1100 |
---|---|---|
committer | Jonathan Gordon <rockbox@jdgordon.info> | 2013-03-28 22:32:57 +1100 |
commit | 83d3f1d3f65e4115bc5a8348d126b6ab7cbbcf64 (patch) | |
tree | 48172c3cce071f1d099146cb9324f54ab1e66b13 | |
parent | ddf55200dc89b2917c6c541546b64c2ece73cd5b (diff) | |
download | rockbox-83d3f1d3f65e4115bc5a8348d126b6ab7cbbcf64.tar.gz rockbox-83d3f1d3f65e4115bc5a8348d126b6ab7cbbcf64.zip |
simplelist: Fix simplelist_set_line_count() so it actually sets the count
(hopefully) Fixes FS#12838
Change-Id: I932184afaf7b65121a0c459cd03c8482e3bad22b
-rw-r--r-- | apps/debug_menu.c | 26 | ||||
-rw-r--r-- | apps/gui/list.c | 8 |
2 files changed, 32 insertions, 2 deletions
diff --git a/apps/debug_menu.c b/apps/debug_menu.c index 265d8988b5..59a58212ad 100644 --- a/apps/debug_menu.c +++ b/apps/debug_menu.c | |||
@@ -1838,6 +1838,31 @@ static bool dbg_save_roms(void) | |||
1838 | } | 1838 | } |
1839 | #endif /* CPU */ | 1839 | #endif /* CPU */ |
1840 | 1840 | ||
1841 | static int radio_callback(int btn, struct gui_synclist *lists) | ||
1842 | { | ||
1843 | (void)lists; | ||
1844 | if (btn == ACTION_STD_CANCEL) | ||
1845 | return btn; | ||
1846 | simplelist_set_line_count(1); | ||
1847 | simplelist_addline("test one"); | ||
1848 | simplelist_addline("test two"); | ||
1849 | simplelist_addline("test dsaf"); | ||
1850 | simplelist_addline("test asdfsad"); | ||
1851 | simplelist_addline("-------------"); | ||
1852 | return ACTION_REDRAW; | ||
1853 | } | ||
1854 | static bool dbg_fm_radio(void) | ||
1855 | { | ||
1856 | struct simplelist_info info; | ||
1857 | info.scroll_all = true; | ||
1858 | simplelist_info_init(&info, "FM Radio", 1, NULL); | ||
1859 | simplelist_set_line_count(0); | ||
1860 | simplelist_addline("HW detected: %s", "no"); | ||
1861 | |||
1862 | info.action_callback = radio_callback; | ||
1863 | info.hide_selection = true; | ||
1864 | return simplelist_show_list(&info); | ||
1865 | } | ||
1841 | #ifndef SIMULATOR | 1866 | #ifndef SIMULATOR |
1842 | #if CONFIG_TUNER | 1867 | #if CONFIG_TUNER |
1843 | 1868 | ||
@@ -2324,6 +2349,7 @@ static const struct { | |||
2324 | { "FM Radio", dbg_fm_radio }, | 2349 | { "FM Radio", dbg_fm_radio }, |
2325 | #endif | 2350 | #endif |
2326 | #endif | 2351 | #endif |
2352 | { "TEST HERE", dbg_fm_radio}, | ||
2327 | #if defined(HAVE_EEPROM) && !defined(HAVE_EEPROM_SETTINGS) | 2353 | #if defined(HAVE_EEPROM) && !defined(HAVE_EEPROM_SETTINGS) |
2328 | { "Write back EEPROM", dbg_write_eeprom }, | 2354 | { "Write back EEPROM", dbg_write_eeprom }, |
2329 | #endif | 2355 | #endif |
diff --git a/apps/gui/list.c b/apps/gui/list.c index cc43843e46..27032378c3 100644 --- a/apps/gui/list.c +++ b/apps/gui/list.c | |||
@@ -843,8 +843,12 @@ void simplelist_set_line_count(int lines) | |||
843 | simplelist_line_remaining = sizeof(simplelist_buffer); | 843 | simplelist_line_remaining = sizeof(simplelist_buffer); |
844 | simplelist_line_count = 0; | 844 | simplelist_line_count = 0; |
845 | } | 845 | } |
846 | else if (lines >= SIMPLELIST_MAX_LINES) | 846 | else if (lines < simplelist_line_count) { |
847 | simplelist_line_count = SIMPLELIST_MAX_LINES; | 847 | char *end = simplelist_text[lines]; |
848 | simplelist_line_pos = end - simplelist_buffer; | ||
849 | simplelist_line_remaining = sizeof(simplelist_buffer) - simplelist_line_pos; | ||
850 | simplelist_line_count = lines; | ||
851 | } | ||
848 | } | 852 | } |
849 | /* get the current amount of lines shown */ | 853 | /* get the current amount of lines shown */ |
850 | int simplelist_get_line_count(void) | 854 | int simplelist_get_line_count(void) |