summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Wilgus <wilgus.william@gmail.com>2024-11-21 12:08:53 -0500
committerWilliam Wilgus <wilgus.william@gmail.com>2024-11-21 12:14:17 -0500
commit00906647b4769acbd7ae62a284b77007bdfef4b4 (patch)
treeea992b3775abd0fd68b1ad51b69f0e467004accd
parentd6e3514c0d75dc26e51eece22cf065311680451f (diff)
downloadrockbox-00906647b4.tar.gz
rockbox-00906647b4.zip
Simplelist remove simplelist_set_line_count(n)
replace with simplelist_reset_lines(void) there was one user saving one short string remove the feature to simplify list code fix scrolling in dircache debug item Change-Id: I71f933f224c2de5f7a68feab904a2fe0b81e1362
-rw-r--r--apps/debug_menu.c44
-rw-r--r--apps/gui/list.c35
-rw-r--r--apps/gui/list.h4
-rw-r--r--apps/gui/skin_engine/skin_engine.c2
4 files changed, 28 insertions, 57 deletions
diff --git a/apps/debug_menu.c b/apps/debug_menu.c
index 628e1642f7..d8b92b7d09 100644
--- a/apps/debug_menu.c
+++ b/apps/debug_menu.c
@@ -1278,7 +1278,7 @@ static int disk_callback(int btn, struct gui_synclist *lists)
}
#endif
- simplelist_set_line_count(0);
+ simplelist_reset_lines();
card = card_get_info(*cardnum);
@@ -1408,7 +1408,7 @@ static int disk_callback(int btn, struct gui_synclist *lists)
bool timing_info_present = false;
(void)btn;
- simplelist_set_line_count(0);
+ simplelist_reset_lines();
for (i=0; i < 20; i++)
((unsigned short*)buf)[i]=htobe16(identify_info[i+27]);
@@ -1750,7 +1750,7 @@ static int ata_smart_callback(int btn, struct gui_synclist *lists)
int rc;
memset(&smart_data, 0, sizeof(struct ata_smart_values));
rc = ata_read_smart(&smart_data);
- simplelist_set_line_count(0);
+ simplelist_reset_lines();
if (rc == 0)
{
int i;
@@ -1887,7 +1887,7 @@ static int dircache_callback(int btn, struct gui_synclist *lists)
}
}
- simplelist_set_line_count(0);
+ simplelist_reset_lines();
simplelist_addline("Cache status: %s", info.statusdesc);
simplelist_addline("Last size: %zu B", info.last_size);
@@ -1902,9 +1902,6 @@ static int dircache_callback(int btn, struct gui_synclist *lists)
ticks / HZ, (ticks*10 / HZ) % 10);
simplelist_addline("Entry count: %u", info.entry_count);
- if (btn == ACTION_NONE)
- btn = ACTION_REDRAW;
-
return btn;
}
@@ -1912,7 +1909,7 @@ static bool dbg_dircache_info(void)
{
struct simplelist_info info;
int syncbuild = 0;
- simplelist_info_init(&info, "Dircache Info", 8, &syncbuild);
+ simplelist_info_init(&info, "Dircache Info", 0, &syncbuild);
info.action_callback = dircache_callback;
info.scroll_all = true;
return simplelist_show_list(&info);
@@ -1928,7 +1925,7 @@ static int database_callback(int btn, struct gui_synclist *lists)
static bool synced = false;
static int update_entries = 0;
- simplelist_set_line_count(0);
+ simplelist_reset_lines();
simplelist_addline("Initialized: %s",
stat->initialized ? "Yes" : "No");
@@ -1981,7 +1978,7 @@ static int database_callback(int btn, struct gui_synclist *lists)
static bool dbg_tagcache_info(void)
{
struct simplelist_info info;
- simplelist_info_init(&info, "Database Info", 8, NULL);
+ simplelist_info_init(&info, "Database Info", 0, NULL);
info.action_callback = database_callback;
info.scroll_all = true;
@@ -2141,7 +2138,8 @@ static int radio_callback(int btn, struct gui_synclist *lists)
(void)lists;
if (btn == ACTION_STD_CANCEL)
return btn;
- simplelist_set_line_count(1);
+ simplelist_reset_lines();
+ simplelist_setline("HW detected: yes");
#if (CONFIG_TUNER & LV24020LP)
simplelist_addline(
@@ -2249,10 +2247,9 @@ static bool dbg_fm_radio(void)
tuner_type = tuner_detect_type();
#endif
info.scroll_all = true;
- simplelist_info_init(&info, "FM Radio", 1, NULL);
- simplelist_set_line_count(0);
- simplelist_addline("HW detected: %s",
- radio_hardware_present() ? "yes" : "no");
+ simplelist_info_init(&info, "FM Radio", 0, NULL);
+ simplelist_reset_lines();
+ simplelist_setline("HW detected: no");
info.action_callback = radio_hardware_present()?radio_callback : NULL;
return simplelist_show_list(&info);
@@ -2467,13 +2464,12 @@ static bool dbg_talk(void)
struct talk_debug_data data;
talk_get_debug_data(&data);
- simplelist_info_init(&list, "Voice Information:", 1, NULL);
+ simplelist_info_init(&list, "Voice Information:", 0, NULL);
list.scroll_all = true;
list.timeout = HZ;
- //list.get_name = dbg_talk_get_name;
- simplelist_set_line_count(0);
+ simplelist_reset_lines();
simplelist_setline("Current voice file:");
if (data.status != TALK_STATUS_ERR_NOFILE)
@@ -2577,8 +2573,8 @@ static bool dbg_boot_data(void)
{
struct simplelist_info info;
info.scroll_all = true;
- simplelist_info_init(&info, "Boot data", 1, NULL);
- simplelist_set_line_count(0);
+ simplelist_info_init(&info, "Boot data", 0, NULL);
+ simplelist_reset_lines();
if (!boot_data_valid)
{
@@ -2622,8 +2618,8 @@ static bool dbg_device_data(void)
{
struct simplelist_info info;
info.scroll_all = true;
- simplelist_info_init(&info, "Device data", 1, NULL);
- simplelist_set_line_count(0);
+ simplelist_info_init(&info, "Device data", 0, NULL);
+ simplelist_reset_lines();
simplelist_setline("Device data");
@@ -2654,8 +2650,8 @@ static bool dbg_syscfg(void) {
size_t syscfg_entry_size = sizeof(struct SysCfgEntry);
struct SysCfgEntry syscfg_entries[SYSCFG_MAX_ENTRIES];
- simplelist_info_init(&info, "SysCfg NOR contents", 1, NULL);
- simplelist_set_line_count(0);
+ simplelist_info_init(&info, "SysCfg NOR contents", 0, NULL);
+ simplelist_reset_lines();
bootflash_init(SPI_PORT);
bootflash_read(SPI_PORT, 0, syscfg_hdr_size, &syscfg_hdr);
diff --git a/apps/gui/list.c b/apps/gui/list.c
index 3853b0049b..d974470a26 100644
--- a/apps/gui/list.c
+++ b/apps/gui/list.c
@@ -804,37 +804,12 @@ static int simplelist_line_pos;
/* buffer shared with bitmap/list code */
char simplelist_buffer[SIMPLELIST_MAX_LINES * SIMPLELIST_MAX_LINELENGTH];
static const char *simplelist_text[SIMPLELIST_MAX_LINES];
-/* set the amount of lines shown in the list */
-void simplelist_set_line_count(int lines)
+/* reset the amount of lines shown in the list to 0 */
+void simplelist_reset_lines(void)
{
- if (lines <= 0) {
- simplelist_line_pos = 0;
- simplelist_line_remaining = sizeof(simplelist_buffer);
- simplelist_line_count = 0;
- }
- else if (lines < simplelist_line_count) {
- const char *end = simplelist_buffer;
- int last_line = 0;
- const char * const bufend = simplelist_buffer + sizeof(simplelist_buffer);
- /* find the last item in the buffer we are still showing */
- for (int line = 0; line <= lines; line++)
- {
- const char *first = simplelist_text[line];
- if (first >= simplelist_buffer && first < bufend)
- {
- last_line = line;
- end = first;
- }
- line++;
- }
-
- if (last_line < lines)
- end += strlen(end) + 1; /* prior to the current line, save contents */
-
- simplelist_line_pos = end - simplelist_buffer;
- simplelist_line_remaining = sizeof(simplelist_buffer) - simplelist_line_pos;
- simplelist_line_count = lines;
- }
+ simplelist_line_pos = 0;
+ simplelist_line_remaining = sizeof(simplelist_buffer);
+ simplelist_line_count = 0;
}
/* get the current amount of lines shown */
int simplelist_get_line_count(void)
diff --git a/apps/gui/list.h b/apps/gui/list.h
index 53454bdc99..a7df83f136 100644
--- a/apps/gui/list.h
+++ b/apps/gui/list.h
@@ -306,9 +306,9 @@ struct simplelist_info {
/** The next three functions are used if the text is mostly static.
These should be called in the action callback for the list.
**/
-/* set the amount of lines shown in the list
+/* reset the amount of lines shown in the list to 0
Only needed if simplelist_info.get_name == NULL */
-void simplelist_set_line_count(int lines);
+void simplelist_reset_lines(void);
/* get the current amount of lines shown */
int simplelist_get_line_count(void);
/* add a line in the list. */
diff --git a/apps/gui/skin_engine/skin_engine.c b/apps/gui/skin_engine/skin_engine.c
index 04d34e11d2..d27f210aa5 100644
--- a/apps/gui/skin_engine/skin_engine.c
+++ b/apps/gui/skin_engine/skin_engine.c
@@ -342,7 +342,7 @@ bool dbg_skin_engine(void)
int path_prefix_len = strlen(ROCKBOX_DIR "/wps/");
#endif
simplelist_info_init(&info, "Skin engine usage", 0, NULL);
- simplelist_set_line_count(0);
+ simplelist_reset_lines();
FOR_NB_SCREENS(j) {
#if NB_SCREENS > 1
simplelist_addline("%s display:",