Index: apps/lang/english.lang
===================================================================
--- apps/lang/english.lang (revision 15390)
+++ apps/lang/english.lang (working copy)
@@ -11448,3 +11448,20 @@
multivolume: "Not present"
+
+ id: LANG_TWOLINE_INFOLIST
+ desc: 2 line info list setting
+ user:
+
+ *: none
+ lcd_bitmap: "Two line info list"
+
+
+ *: none
+ lcd_bitmap: "Two line info list"
+
+
+ *: none
+ lcd_bitmap: "Two line info list"
+
+
Index: apps/gui/list.c
===================================================================
--- apps/gui/list.c (revision 15390)
+++ apps/gui/list.c (working copy)
@@ -1241,22 +1241,65 @@
vsnprintf(simplelist_text[line_number], SIMPLELIST_MAX_LINELENGTH, fmt, ap);
va_end(ap);
}
-
+struct infolist_cbdata {
+ list_get_name *get_name;
+ void *data;
+};
static char* simplelist_static_getname(int item, void * data, char *buffer)
{
+#ifdef HAVE_LCD_BITMAP
+ struct infolist_cbdata *cb = (struct infolist_cbdata*)data;
+ if (data) /* list is a info list and its only a single line infolist */
+ {
+ char title[MAX_PATH], *t;
+ char value[MAX_PATH], *v;
+ t = cb->get_name(item*2, cb->data, title);
+ v = cb->get_name(item*2 + 1, cb->data, value);
+ snprintf(buffer, MAX_PATH, "%s: %s", t, v);
+ return buffer;
+ }
+#else
(void)data; (void)buffer;
+#endif
return simplelist_text[item];
}
bool simplelist_show_list(struct simplelist_info *info)
{
+ struct infolist_cbdata infolist_data;
struct gui_synclist lists;
- int action, old_line_count = simplelist_line_count;
+ void *data;
+ int action, old_line_count = simplelist_line_count, count;
char* (*getname)(int item, void * data, char *buffer);
- if (info->get_name)
- getname = info->get_name;
- else
- getname = simplelist_static_getname;
- gui_synclist_init(&lists, getname, info->callback_data,
+ if (info->infolist)
+ {
+#ifdef HAVE_LCD_BITMAP
+ if (global_settings.twolineinfolist == false)
+ {
+ getname = simplelist_static_getname;
+ infolist_data.get_name = info->get_name;
+ infolist_data.data = info->callback_data;
+ data = (void*)&infolist_data;
+ count = info->count;
+ info->selection_size = 1;
+ }
+ else
+ {
+#endif
+ count = info->count*2;
+ getname = info->get_name;
+#ifdef HAVE_LCD_BITMAP
+ }
+#endif
+ }
+ else
+ {
+ data = info->callback_data;
+ if (info->get_name)
+ getname = info->get_name;
+ else
+ getname = simplelist_static_getname;
+ }
+ gui_synclist_init(&lists, getname, data,
info->scroll_all, info->selection_size);
if (info->title)
gui_synclist_set_title(&lists, info->title, NOICON);
@@ -1272,6 +1315,8 @@
if (info->get_name == NULL)
gui_synclist_set_nb_items(&lists, simplelist_line_count*info->selection_size);
+ else if (info->infolist)
+ gui_synclist_set_nb_items(&lists, count);
else
gui_synclist_set_nb_items(&lists, info->count*info->selection_size);
Index: apps/gui/list.h
===================================================================
--- apps/gui/list.h (revision 15390)
+++ apps/gui/list.h (working copy)
@@ -268,6 +268,7 @@
bool hide_selection;
bool scroll_all;
int timeout;
+ bool infolist; /* explained in the comment below this struct */
int start_selection; /* the item to select when the list is first displayed */
int (*action_callback)(int action, struct gui_synclist *lists); /* can be NULL */
/* action_callback notes:
@@ -280,6 +281,22 @@
void *callback_data; /* data for callbacks */
};
+/** Infolist explanation **/
+/* An infolist is a list where each/some item is in the form
:
+ for a list to be an infolist infolist = true and get_name != NULL.
+ count is the number of items (title, value pairs) BUT
+ from the POV of the callbacks there will be 2*count items.
+ The first item of each pair (selected_item%2 == 0) is the title,
+ the 2nd one is the value.
+ The exception is the get_talk callback which should speak the full
+ title and value in 1 shot. ((selected_item%2) will always == 0) */
+#ifdef HAVE_LCD_CHARMCELL
+#define infolist_is_twoline() (true)
+#else
+#define infolist_is_twoline() (global_settings.twolineinfolist == true)
+#endif
+
+
#define SIMPLELIST_MAX_LINES 32
#define SIMPLELIST_MAX_LINELENGTH 32
Index: apps/settings.h
===================================================================
--- apps/settings.h (revision 15390)
+++ apps/settings.h (working copy)
@@ -743,6 +743,9 @@
int usb_stack_mode; /* device or host */
unsigned char usb_stack_device_driver[32]; /* usb device driver to load */
#endif
+#ifdef HAVE_LCD_BITMAP
+ bool twolineinfolist; /* display info lists over 2 lines isntead of 1 */
+#endif
};
/** global variables **/
Index: apps/settings_list.c
===================================================================
--- apps/settings_list.c (revision 15390)
+++ apps/settings_list.c (working copy)
@@ -605,12 +605,12 @@
#endif
#ifdef HAVE_LCD_BITMAP
OFFON_SETTING(0, offset_out_of_view, LANG_SCREEN_SCROLL_VIEW,
- false, "Screen Scrolls Out Of View", NULL),
+ false, "Screen Scrolls Out Of View", gui_list_screen_scroll_out_of_view),
INT_SETTING(0, scroll_step, LANG_SCROLL_STEP, 6, "scroll step",
UNIT_PIXEL, 1, LCD_WIDTH, 1, NULL, NULL, lcd_scroll_step),
INT_SETTING(0, screen_scroll_step, LANG_SCREEN_SCROLL_STEP,
16, "screen scroll step",
- UNIT_PIXEL, 1, LCD_WIDTH, 1, NULL, NULL, NULL),
+ UNIT_PIXEL, 1, LCD_WIDTH, 1, NULL, NULL, gui_list_screen_scroll_step),
#endif /* HAVE_LCD_BITMAP */
#ifdef HAVE_LCD_CHARCELLS
INT_SETTING(0, jump_scroll, LANG_JUMP_SCROLL, 0, "jump scroll",
@@ -1273,6 +1273,10 @@
FILENAME_SETTING(0, usb_stack_device_driver, "usb device driver",
"storage", NULL, NULL, 32),
#endif /* HAVE_USBSTACK */
+#ifdef HAVE_LCD_BITMAP
+ OFFON_SETTING(0, twolineinfolist, LANG_TWOLINE_INFOLIST,
+ true, "two line info list", NULL),
+#endif
};
const int nb_settings = sizeof(settings)/sizeof(*settings);
Index: apps/debug_menu.c
===================================================================
--- apps/debug_menu.c (revision 15390)
+++ apps/debug_menu.c (working copy)
@@ -124,38 +124,48 @@
struct thread_entry *thread = NULL;
unsigned status;
int usage;
+ bool title_line = selected_item%2==0;
+ int thread_num = selected_item/2;
#if NUM_CORES > 1
- if (selected_item < (int)NUM_CORES)
+ if (thread_num < (int)NUM_CORES)
{
- usage = idle_stack_usage(selected_item);
- snprintf(buffer, MAX_PATH, "Idle (%d): %2d%%", selected_item, usage);
+ usage = idle_stack_usage(thread_num);
+ if (title_line)
+ snprintf(buffer, MAX_PATH, "Idle (%d)", thread_num);
+ else
+ snprintf(buffer, MAX_PATH, "%2d%%", usage);
return buffer;
}
- selected_item -= NUM_CORES;
+ thread_num -= NUM_CORES;
#endif
- thread = &threads[selected_item];
+ thread = &threads[thread_num];
status = thread_get_status(thread);
if (status == STATE_KILLED)
{
- snprintf(buffer, MAX_PATH, "%2d: ---", selected_item);
+ if (title_line)
+ snprintf(buffer, MAX_PATH, "%2d", thread_num);
+ else
+ snprintf(buffer, MAX_PATH, "-------");
return buffer;
}
thread_get_name(name, 32, thread);
usage = thread_stack_usage(thread);
- snprintf(buffer, MAX_PATH,
- "%2d: " IF_COP("(%d) ") "%c%c " IF_PRIO("%d ") "%2d%% %s",
- selected_item,
- IF_COP(thread->core,)
- (status == STATE_RUNNING) ? '*' : ' ',
- thread_status_char(status),
- IF_PRIO(thread->priority,)
- usage, name);
+ if (title_line)
+ snprintf(buffer, MAX_PATH,
+ "%2d: %s" IF_COP("(%d) ") "%c%c " IF_PRIO("%d "),
+ thread_num, infolist_is_twoline()?name:"",
+ IF_COP(thread->core,)
+ (status == STATE_RUNNING) ? '*' : ' ',
+ thread_status_char(status)
+ IF_PRIO(,thread->priority));
+ else
+ snprintf(buffer, MAX_PATH, "%2d%% %s", usage, infolist_is_twoline()?"":name);
return buffer;
}
@@ -193,6 +203,7 @@
#endif
info.action_callback = dbg_threads_action_callback;
info.get_name = threads_getname;
+ info.infolist = true;
return simplelist_show_list(&info);
}