@@ -32,13 +32,54 @@ struct menu_priv {
struct udevice *last_bootdev;
};
+int bootflow_menu_set_props(struct expo *exp, struct scene *scn, bool has_logo)
+{
+ int ret = 0;
+ bool use_font;
+
+ ret |= scene_obj_set_bbox(scn, OBJ_BOX, 30, 90, 1366 - 30, 720);
+ ret |= scene_obj_set_pos(scn, OBJ_MENU, MARGIN_LEFT, 100);
+ ret |= scene_obj_set_bbox(scn, OBJ_MENU_TITLE, 0, 32,
+ 1366, 60);
+ ret |= scene_obj_set_halign(scn, OBJ_MENU_TITLE, SCENEOA_CENTRE);
+
+ if (has_logo)
+ ret |= scene_obj_set_pos(scn, OBJ_U_BOOT_LOGO, 1165, 100);
+
+ ret |= scene_obj_set_bbox(scn, OBJ_PROMPT1A, 0, 590,
+ 1366, 590 + 40);
+ ret |= scene_obj_set_bbox(scn, OBJ_PROMPT1B, 0, 620,
+ 1366, 620 + 40);
+ ret |= scene_obj_set_bbox(scn, OBJ_PROMPT2, 100, 650,
+ 1366 - 100, 700);
+ ret |= scene_obj_set_bbox(scn, OBJ_AUTOBOOT, 0, 720,
+ 1366, 750);
+ ret |= scene_obj_set_halign(scn, OBJ_PROMPT1A, SCENEOA_CENTRE);
+ ret |= scene_obj_set_halign(scn, OBJ_PROMPT1B, SCENEOA_CENTRE);
+ ret |= scene_obj_set_halign(scn, OBJ_PROMPT2, SCENEOA_CENTRE);
+ ret |= scene_obj_set_valign(scn, OBJ_PROMPT2, SCENEOA_CENTRE);
+ ret |= scene_obj_set_halign(scn, OBJ_AUTOBOOT, SCENEOA_CENTRE);
+ ret |= scene_menu_set_pointer(scn, OBJ_MENU, OBJ_POINTER);
+
+ if (ret)
+ return log_msg_ret("msp", ret);
+
+ use_font = IS_ENABLED(CONFIG_CONSOLE_TRUETYPE);
+ scene_obj_set_hide(scn, OBJ_PROMPT1A, use_font);
+ scene_obj_set_hide(scn, OBJ_PROMPT1B, !use_font);
+ scene_obj_set_hide(scn, OBJ_AUTOBOOT, use_font);
+
+ exp->show_highlight = true;
+
+ return 0;
+}
+
int bootflow_menu_new(struct expo **expp)
{
struct scene_obj_menu *menu;
struct menu_priv *priv;
struct scene *scn;
struct expo *exp;
- bool use_font;
void *logo;
int ret;
@@ -60,21 +101,14 @@ int bootflow_menu_new(struct expo **expp)
ret = scene_box(scn, "box", OBJ_BOX, 2, false, NULL);
if (ret < 0)
return log_msg_ret("bmb", ret);
- ret |= scene_obj_set_bbox(scn, OBJ_BOX, 30, 90, 1366 - 30, 720);
ret = scene_menu(scn, "main", OBJ_MENU, &menu);
- ret |= scene_obj_set_pos(scn, OBJ_MENU, MARGIN_LEFT, 100);
ret |= scene_txt_str(scn, "title", OBJ_MENU_TITLE, STR_MENU_TITLE,
"U-Boot - Boot Menu", NULL);
- ret |= scene_obj_set_bbox(scn, OBJ_MENU_TITLE, 0, 32,
- 1366, 60);
- ret |= scene_obj_set_halign(scn, OBJ_MENU_TITLE, SCENEOA_CENTRE);
logo = video_get_u_boot_logo(NULL);
- if (logo) {
+ if (logo)
ret |= scene_img(scn, "ulogo", OBJ_U_BOOT_LOGO, logo, NULL);
- ret |= scene_obj_set_pos(scn, OBJ_U_BOOT_LOGO, 1165, 100);
- }
ret |= scene_txt_str(scn, "prompt1a", OBJ_PROMPT1A, STR_PROMPT1A,
"Use the \x18 and \x19 keys to select which entry is highlighted.",
@@ -89,32 +123,15 @@ int bootflow_menu_new(struct expo **expp)
ret |= scene_txt_str(scn, "autoboot", OBJ_AUTOBOOT, STR_AUTOBOOT,
"The highlighted entry will be executed automatically in %ds.",
NULL);
- ret |= scene_obj_set_bbox(scn, OBJ_PROMPT1A, 0, 590,
- 1366, 590 + 40);
- ret |= scene_obj_set_bbox(scn, OBJ_PROMPT1B, 0, 620,
- 1366, 620 + 40);
- ret |= scene_obj_set_bbox(scn, OBJ_PROMPT2, 100, 650,
- 1366 - 100, 700);
- ret |= scene_obj_set_bbox(scn, OBJ_AUTOBOOT, 0, 720,
- 1366, 750);
- ret |= scene_obj_set_halign(scn, OBJ_PROMPT1A, SCENEOA_CENTRE);
- ret |= scene_obj_set_halign(scn, OBJ_PROMPT1B, SCENEOA_CENTRE);
- ret |= scene_obj_set_halign(scn, OBJ_PROMPT2, SCENEOA_CENTRE);
- ret |= scene_obj_set_valign(scn, OBJ_PROMPT2, SCENEOA_CENTRE);
- ret |= scene_obj_set_halign(scn, OBJ_AUTOBOOT, SCENEOA_CENTRE);
-
- use_font = IS_ENABLED(CONFIG_CONSOLE_TRUETYPE);
- scene_obj_set_hide(scn, OBJ_PROMPT1A, use_font);
- scene_obj_set_hide(scn, OBJ_PROMPT1B, !use_font);
- scene_obj_set_hide(scn, OBJ_AUTOBOOT, use_font);
ret |= scene_txt_str(scn, "cur_item", OBJ_POINTER, STR_POINTER, ">",
NULL);
- ret |= scene_menu_set_pointer(scn, OBJ_MENU, OBJ_POINTER);
if (ret < 0)
return log_msg_ret("new", -EINVAL);
- exp->show_highlight = true;
+ ret = bootflow_menu_set_props(exp, scn, logo);
+ if (ret < 0)
+ return log_msg_ret("nep", -EINVAL);
*expp = exp;
@@ -560,6 +560,18 @@ int bootflow_menu_add(struct expo *exp, struct bootflow *bflow, int seq,
*/
int bootflow_menu_apply_theme(struct expo *exp, ofnode node);
+/**
+ * bootflow_menu_set_props() - Apply properties for the menu
+ *
+ * This sets up the positions of the objects in the basic menu. It also
+ * enables show_highlight
+ *
+ * @exp: Expo to update
+ * @scn: Scene to update
+ * @has_logo: true if a logo should be visible
+ */
+int bootflow_menu_set_props(struct expo *exp, struct scene *scn, bool has_logo);
+
#define BOOTFLOWCL_EMPTY ((void *)1)
/**