Commit graph

17 commits

Author SHA1 Message Date
Simon Glass
94598d5b0a expo: Allow rendering the background of any object
So far only menus have a background. When other object types are
rendered, they may have a background too. Make this code more generic
so it will be usable by new object types.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-11 15:43:55 -04:00
Simon Glass
8bc69b4b24 expo: Make calculation of an object bounding box generic
We want to support this for any object, not just menus. Move the code
around to allow this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-11 15:43:55 -04:00
Simon Glass
cfc402db39 expo: cedit: Support reading settings from CMOS RAM
Add a command to read edit settings from CMOS RAM, using the cedit
definition to indicate which registers and bits are used.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-08-25 13:54:33 -04:00
Simon Glass
6e648fa781 expo: Export scene_menuitem_find() for use in internal code
Make this function available to other expo code so we can use it to look
up a menu item.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-08-25 13:54:33 -04:00
Dan Carpenter
d864bd0e21 expo: allocate correct amount of memory
This should be allocating the memory for "item" instead of "menu".
The item struct is 48 bytes instead of 96 (assuming a 64bit system)
so this saves a little memory.

Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-08-08 17:41:52 -04:00
Simon Glass
7230fdb383 expo: Add spacing around menus and items
It looks better if menus have a bit of an inset, rather than be drawn hard
up against the background. Also, menu items look better if they have a bit
of spacing between them.

Add theme options for these and implement the required changes.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14 12:54:51 -04:00
Simon Glass
4e64beeba7 expo: Implement the keypress logic for popup menus
In 'popup' mode, the expo allows moving around the objects in a scene.
When 'enter' is pressed on a menu, it opens and the user can move around
the items in the menu.

Implement this using keypress handles and actions.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14 12:54:51 -04:00
Simon Glass
4c87e073a4 expo: Draw the current opened menu on top
When a menu is opened, it must be displayed over all other objects in
the scene, so that all its items are visible.

Handle this by drawing the menu object a second time, after all other
objects have been drawn. Draw all of the objects which are dependent
on the menu object.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14 12:54:51 -04:00
Simon Glass
756c9559e6 expo: Draw popup menus in both opened and closed states
When a popup menu is closed it shows only the selected item. When it is
open it shows a background and all items, with a highlight that can be
moved between the items.

Add the drawing logic for this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14 12:54:51 -04:00
Simon Glass
3f33b9c722 expo: Rename EXPOACT_POINT to EXPOACT_POINT_ITEM
At present we only support a single menu, so all that can be pointed to
is the current menu item. Rename this action so that we can also add
an action for pointing to an object. This will allow cycling through
the objects in a scene.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14 12:54:51 -04:00
Simon Glass
d3db0216dc expo: Support drawing of popup menus
At present only a single menu is supported. All items are shown and a
pointer object points to the current item.

Add support for multiple menus, one of which is highlighted, indicated
by the highlight_id property in the scene.

The highlighted menu item has a SCENEOF_POINT flag, indicating that it
is currently pointed to.

The popup menu is normally closed, in which case it shows only the
current menu item. When it is opened, it shows all items, allowing the
user to select one.

Rather than requiring the menu item to have a description, require it to
have a label. Use the label (only) for the popup menu.

With this, most of the drawing and layout logic is complete.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14 12:54:51 -04:00
Simon Glass
8872bc7f9d expo: Move menu-item selection into a function
The current implementation supports a 'pointer' object which points to
the currently highlighted menu item. We want to support highlighting the
label of the menu item instead, e.g. with inverse video. In this case we
will need to 'unhighlight' the old item and highlight the new one.

As a first step, move the pointer logic into a function. This fixes a
bug where the item is hidden when it should not be.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14 12:54:51 -04:00
Simon Glass
699b0acb52 expo: Set up the width and height of objects
Provide a way to set the full dimensions of objects, i.e. including the
width and height.

For menus, calculate the bounding box of all objects in the menu. Set all
labels to be the same size, so that highlighting works correct, once
implemented.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14 12:54:51 -04:00
Simon Glass
ae45d6cf5a expo: Add width and height to objects
At present objects only have a position so it is not possible to determine
the amount of space they take up on the display.

Add width and height properties, using a struct to keep all the dimensions
together.

For now this is not used. Future work will set up these new properties.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14 12:54:51 -04:00
Simon Glass
c98cb51252 bootstd: Add a separate log category for expo
This feature is different enough from bootstd that it probably deserves
its own log category. It cannot use a uclass since it is not a device.

Add a new category.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14 12:54:51 -04:00
Simon Glass
14a86a5107 expo: Avoid automatically arranging the scene
This should ideally be done once after all scene changes have been made.
Require an explicit call when everything is ready.

Always arrange after a key it sent, just for convenience.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14 12:54:51 -04:00
Simon Glass
226777f170 expo: Add support for scene menus
A menu is a key part of the expo design. It consists of a number of items
which the user can select from.

Add the initial implementation of this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-16 18:26:50 -05:00