summaryrefslogtreecommitdiff
path: root/include/expo.h
AgeCommit message (Collapse)Author
2025-05-30expo: Provide a way to position things relative to displaySimon Glass
It is often necessary to centre objects within the display area. Add a special position value to indicate this. Signed-off-by: Simon Glass <[email protected]>
2025-05-30expo: Drop the render from expo_poll()Simon Glass
Within tests it is useful to be able to control rendering of the expo. Drop the automatic call to expo_render() within expo_poll() and adjust its callers to handle this instead. Signed-off-by: Simon Glass <[email protected]>
2025-05-30expo: Support highlighting menu itemsSimon Glass
Expo normally uses a pointer to show the current item. Add support for highlighting as well, since this makes it easier for the user to see the current item. Signed-off-by: Simon Glass <[email protected]>
2025-05-30expo: Begin implementation of a text editorSimon Glass
It is useful to be able to edit text, e.g. to allow the user to edit the environment or the command-line arguments for the OS. Add the beginnings of an implementation. Future work is needed to finish this: keypress handling and scrolling. For now it just displays the text. Signed-off-by: Simon Glass <[email protected]>
2025-05-30expo: Support object alignmentSimon Glass
Add support for left, right and centred alignment for text, in the horizontal dimension. Also support top, bottom and centred in the vertical dimension, for the text object as a whole. Alignment is not yet implemented for images. It has no meaning for menus. A textline object uses a text object internally, so alignment is supported there. Provide some documentation to explain how objects are positioned. Signed-off-by: Simon Glass <[email protected]>
2025-05-30expo: Implement a boxSimon Glass
It is useful to be able to draw a box around elements in the menu. Add support for an unfilled box with a selectable thickness. Note that there is no support for selecting the colour for any expo objects yet. Signed-off-by: Simon Glass <[email protected]>
2025-05-30expo: Support rendering multiple lines of textSimon Glass
Use the measurement info to write each line of text separately, thus respecting word-wrapping and newlines. Fix up the comment for scene_obj_render() while we are here. Since a lineedit does not support alignment, add a special case to just display the text if there is no measurement. This happens assuming the lineedit is initially empty. Signed-off-by: Simon Glass <[email protected]>
2025-05-30expo: Allow strings to be editableSimon Glass
In some cases dynamic text is needed, e.g. for a menu countdown. Add a function which handles this, allowing the caller to take control of the text that is shown on each render. Signed-off-by: Simon Glass <[email protected]>
2025-05-30expo: Create a struct for generic text attributesSimon Glass
In preparation for adding more text types, refactor the common fields into a new structure. This will allow common code to be used. Signed-off-by: Simon Glass <[email protected]>
2025-05-30expo: Support setting the size and bounds of an objectSimon Glass
Add a function to allow the size of an object to be set independently of its position. Also add a function to permit the object's bounding box to be set independently of its dimensions. Signed-off-by: Simon Glass <[email protected]>
2025-05-30expo: Separate dimensions from the bounding boxSimon Glass
At present each object has a width and height and the bounding box is implicit in that. This is not flexible enough to handle objects which are larger than their contents might need. For example, when centring a text object we might want to have it stretch across the whole width of the display even if the text itself does not need that much space. Create a new 'dimensions' field and convert the existing width/height into x1/y1 coordinates. Signed-off-by: Simon Glass <[email protected]>
2025-05-30expo: Use an abuf to hold stringsSimon Glass
It is more convenient to put strings in an abuf so they can easily be resized. Adjust the struct accordingly. Signed-off-by: Simon Glass <[email protected]>
2025-05-30expo: Rename x and y in struct scene_obj_bboxSimon Glass
These coordinates are the top left values, so rename them to x0 and y0 in preparation for changing the width and height to x1 and y1 Signed-off-by: Simon Glass <[email protected]>
2025-05-30expo: Rename scene_dim to scene_obj_bboxSimon Glass
At present we assume that each object is a simple box and that it fills the whole box. This is quite limiting for text objects, which we may want to centre within the box. We need a position within the box where drawing starts. Rename the scene_dim struct to indicate that it is a bounding box. Signed-off-by: Simon Glass <[email protected]>
2025-05-30expo: Provide access to the current menu itemSimon Glass
Add functions to allow a caller to find out the current menu item and to select a different one. Update the event handling so that an attempt to change the current item (e.g. by pressing the up-arrow key) is reported to the caller, since this may be used to cancel an autoboot timeout. Signed-off-by: Simon Glass <[email protected]>
2025-05-30expo: Move cedit-state fields into expoSimon Glass
Move the boolean flags into struct expo so that the state can be maintained over function calls. Signed-off-by: Simon Glass <[email protected]>
2025-05-30expo: Add a function to poll for inputSimon Glass
Both bootflow_menu and cedit use similar logic to poll an expo. Move this into the expo library so the code can be shared. Update bootflow_menu_run() to return -EPIPE when the user quits without choosing anything, since -EAGAIN is ambiguous and elsewhere means that there is no input yet. Signed-off-by: Simon Glass <[email protected]>
2025-05-30expo: Add CLI context to the expoSimon Glass
An expo generally needs to keep track of the keyboard state while it is running, so move the context into struct expo Signed-off-by: Simon Glass <[email protected]>
2024-11-03x86: coreboot: Allow building an expo for editing CMOS configSimon Glass
Coreboot provides the CMOS layout in the tables it passes to U-Boot. Use that to build an editor for the CMOS settings. Signed-off-by: Simon Glass <[email protected]>
2024-10-18expo: Drop scene_title_set()Simon Glass
This function is really just an assignment, so serves no useful purpose. Drop it. Signed-off-by: Simon Glass <[email protected]>
2024-10-18expo: Allow menu items to have valuesSimon Glass
At present menu items are stored according to their sequence number in the menu. In some cases we may want to have holes in that sequence, or not use a sequence at all. Add a new 'value' property for menu items. This will be used for reading and writing, if present. If there is no 'value' property, then the normal sequence number will be used instead. Signed-off-by: Simon Glass <[email protected]>
2024-10-18expo: Use standard numbering for save and discardSimon Glass
Set aside some expo IDs for 'save' and 'discard' buttons. This avoids needing to store the IDs for these. Adjust the documentation and expo tool for the new EXPOID_BASE_ID value. Ignore these objects when saving and loading the cedit, since they do not contain real data. Adjust 'cedit run' to return failure when the user exits the expo without saving. Update the test for this change as well. Signed-off-by: Simon Glass <[email protected]>
2024-10-18expo: Place menu items to the right of all labelsSimon Glass
At present a fixed position is used for menu items, 200 pixels to the right of the left side of the labels. This means that a menu item with a very long label may overlap the items. It seems better to calculate the maximum label width and then place the items to the right of all of them. To implement this, add a new struct to containing arrangement information. Calculate it before doing the actual arrangement. Add a new style item which sets the amount of space from the right side of the labels to left side of the items. Signed-off-by: Simon Glass <[email protected]>
2024-09-21boot: correct struct expo_action descriptionHeinrich Schuchardt
Correct the description of the select.id member to fix a kernel-doc warning. Signed-off-by: Heinrich Schuchardt <[email protected]> Reviewed-by: Simon Glass <[email protected]>
2023-10-11expo: Add basic support for textline objectsSimon Glass
A textline is a line of text which can be edited by the user. It has a maximum length (in chracters) but otherwise there are no restrictions. Signed-off-by: Simon Glass <[email protected]>
2023-10-11expo: Add some scene fields needed for text entrySimon Glass
Add the CLI state, a buffer to hold the old value of the text being edited and a place to save vidconsole entry context. These will be use by the textline object. Set an upper limit on the maximum number of characters in a textline object supported by expo, at least for now. Signed-off-by: Simon Glass <[email protected]>
2023-10-11expo: Allow highlighting other scene-object typesSimon Glass
So far only menus can be highlighted. With the coming addition of text lines we need to be able to highlight other objects. Add a function to determine whether an object can be highlighted. Signed-off-by: Simon Glass <[email protected]>
2023-10-11expo: Fix up comments for get_cur_menuitem_text() et alSimon Glass
This internal function could use a comment. Add one. Also tidy up a few other comments. Signed-off-by: Simon Glass <[email protected]> fixup: comments
2023-10-02Merge branch 'next'Tom Rini
Signed-off-by: Tom Rini <[email protected]>
2023-09-16expo: Fix documentation referenceMassimo Pegorer
Fix typo: doc/develop/expo.rst instead of doc/developer/expo.rst Signed-off-by: Massimo Pegorer <[email protected]> Reviewed-by: Simon Glass <[email protected]> Signed-off-by: Heinrich Schuchardt <[email protected]>
2023-08-25expo: cedit: Support writing settings to CMOS RAMSimon Glass
Add a command to write cedit settings to CMOS RAM so that it can be preserved across a reboot. This uses a simple bit-encoding, where each field has a 'bit position' and a 'bit length' in the schema. Signed-off-by: Simon Glass <[email protected]>
2023-08-25expo: Split out cedit into its own headerSimon Glass
Before adding more functions to this interface, create a new header for the configuration editor. Fix up the expo header guard while we are here. Signed-off-by: Simon Glass <[email protected]>
2023-07-14expo: Add a configuration editorSimon Glass
Add a new 'cedit' command which allows editing configuration using an expo. The configuration items appear as menus on the display. This is extremely basic, only supporting menus and not providing any way to load or save the configuration. Signed-off-by: Simon Glass <[email protected]>
2023-07-14expo: Support building an expo from a description fileSimon Glass
The only way to create an expo at present is by calling the functions to create each object. It is useful to have more data-driven approach, where the objects can be specified in a suitable file format and created from that. This makes testing easier as well. Add support for describing an expo in a devicetree node. This allows more complex tests to be set up, as well as providing an easier format for users. It also provides a better basis for the upcoming configuration editor. Signed-off-by: Simon Glass <[email protected]>
2023-07-14expo: Implement the keypress logic for popup menusSimon Glass
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 <[email protected]>
2023-07-14expo: Draw popup menus in both opened and closed statesSimon Glass
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 <[email protected]>
2023-07-14expo: Rename EXPOACT_POINT to EXPOACT_POINT_ITEMSimon Glass
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 <[email protected]>
2023-07-14expo: Support drawing of popup menusSimon Glass
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 <[email protected]>
2023-07-14expo: Support simple themesSimon Glass
It is a pain to manually set the fonts of all objects to be consistent. Some spacing settings are also better set globally than by manually positioning each object. Add a 'theme' to the expo, to hold this information. For now it includes only the font size. Signed-off-by: Simon Glass <[email protected]>
2023-07-14expo: Set up the width and height of objectsSimon Glass
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 <[email protected]>
2023-07-14expo: Use flags for objectsSimon Glass
We currently have just a 'hide' property for each object. In preparation for adding more properties, convert the struct to use a flags value, instead of individual booleans. This is more extensible. Signed-off-by: Simon Glass <[email protected]>
2023-07-14expo: Add width and height to objectsSimon Glass
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 <[email protected]>
2023-07-14expo: Allow setting the start of the dynamic-ID rangeSimon Glass
Provide a way to set this value so that it is easy to separate the statically allocated IDs (generated by the caller) from those generated dynamically by expo itself. Signed-off-by: Simon Glass <[email protected]>
2023-07-14expo: Rename exp_set_text_mode()Simon Glass
Rename this function to match its peers, using the full "expo' prefix. Signed-off-by: Simon Glass <[email protected]>
2023-07-14expo: Store the console in the expoSimon Glass
Rather than finding this each time, keep a pointer to it. This simplifies the code a little. Signed-off-by: Simon Glass <[email protected]>
2023-07-14expo: Convert to using a string ID for the scene titleSimon Glass
This is easier to deal with if it uses the existing string handling, since we will be able to use translations, etc. in the future. Update it to use an ID instead of a string. Signed-off-by: Simon Glass <[email protected]>
2023-01-16expo: Add basic implementationSimon Glass
An expo is a way of presenting and collecting information from the user. It consists of a collection of 'scenes' of which only one is presented at a time. An expo is typically used to show a boot menu and allow settings to be changed. One created, the same expo can be automatically presented in graphical form using a vidconsole, or in text form on a serial console. Add an initial implementation of the expo itself. Supports for scenes and objects is provided later. Signed-off-by: Simon Glass <[email protected]>