mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-12-19 14:27:28 +00:00
poppy: Highlight menu selection
Reverse foreground/background colors for highlighted selection. BUG=chrome-os-partner:61275 BRANCH=None TEST=reboot and make sure selection is highlighted CQ-DEPEND=CL:442747 Change-Id: Iaf33cf6140a3ce774a67e3ac7d381d5e05feeddb Signed-off-by: Shelley Chen <shchen@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/442690 Reviewed-by: Randall Spangler <rspangler@chromium.org>
This commit is contained in:
@@ -329,41 +329,30 @@ VbError_t vb2_get_current_menu_size(VB_MENU menu, char ***menu_array, int *size)
|
|||||||
*
|
*
|
||||||
* @return VBERROR_SUCCESS, or non-zero error code if error.
|
* @return VBERROR_SUCCESS, or non-zero error code if error.
|
||||||
*/
|
*/
|
||||||
// TODO: will probably have to print menu a
|
|
||||||
// line at a time to center the text at X.
|
|
||||||
// Otherwise, only the first line will be lined up
|
|
||||||
// vertically properly.
|
|
||||||
// which is why x is currently 0.
|
|
||||||
// also, want to calculate what center is eventually instead of
|
|
||||||
// hard-coding it.
|
|
||||||
// at least right now there's no overlapping with the debug
|
|
||||||
// printouts.
|
|
||||||
VbError_t vb2_print_current_menu()
|
VbError_t vb2_print_current_menu()
|
||||||
{
|
{
|
||||||
char m_str[1024];
|
|
||||||
const char *selected = "==> ";
|
|
||||||
const char *deselected = " ";
|
|
||||||
int size = 0;
|
int size = 0;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
static char **m = NULL;
|
static char **m = NULL;
|
||||||
|
int highlight = 0;
|
||||||
|
// TODO: We probably want to center this text.
|
||||||
|
int xindex = 50;
|
||||||
|
int yindex = 30;
|
||||||
|
|
||||||
memset(m_str, 0, strlen(m_str));
|
|
||||||
// TODO: need to check for error code.
|
// TODO: need to check for error code.
|
||||||
vb2_get_current_menu_size(current_menu, &m, &size);
|
vb2_get_current_menu_size(current_menu, &m, &size);
|
||||||
VB2_DEBUG("vb2_print_current_menu:\n");
|
VB2_DEBUG("vb2_print_current_menu:\n");
|
||||||
|
|
||||||
|
// TODO: do clear screen here.
|
||||||
/* Create menu string */
|
/* Create menu string */
|
||||||
for (i = 0; i < size; i++) {
|
for (i = 0; i < size; i++) {
|
||||||
if (current_menu_idx == i) {
|
highlight = !!(current_menu_idx == i);
|
||||||
strncat(m_str, selected, strlen(selected));
|
VbExDisplayText(xindex, yindex, m[i], highlight);
|
||||||
} else {
|
VB2_DEBUG("[%d,%d]: %s", xindex, yindex, m[i]);
|
||||||
strncat(m_str, deselected, strlen(deselected));
|
yindex++;
|
||||||
}
|
}
|
||||||
strncat(m_str, m[i], strlen(m[i]));
|
|
||||||
}
|
|
||||||
VB2_DEBUG("%s", m_str);
|
|
||||||
|
|
||||||
return VbExDisplayText(0,30,m_str);
|
return VBERROR_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user