The expo now has all that is needed to apply a suitable theme, so drop
this unnecessary code. Any further tweaks can be added to the generic
expo code.
Signed-off-by: Simon Glass <sjg@chromium.org>
Apply the theme, calculate dimensions, highlight the menu and arrange
the scene correctly, so that everything is ready to go when the expo
is rendered.
Signed-off-by: Simon Glass <sjg@chromium.org>
Some callers may wish to add items later as they are discovered. Split
the setup code into its own function, to permit this.
Signed-off-by: Simon Glass <sjg@chromium.org>
Rather than returning a bootflow, return the index of the bootflow. This
will allow callers to do their own translation to bootflows or some
other data structure.
Also return a special code when the user tries to move the pointer, so
that the caller can cancel the boot-menu timeout, if this is in use.
Signed-off-by: Simon Glass <sjg@chromium.org>
The menu is currently quite basic. Make use of some recently added
features in expo, to:
- Show proper prompts
- Highlight the current item
- Centre text
- Use multi-line text instead of two independent lines
- Put a box around the items
Signed-off-by: Simon Glass <sjg@chromium.org>
It is often necessary to centre objects within the display area. Add a
special position value to indicate this.
Signed-off-by: Simon Glass <sjg@chromium.org>
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 <sjg@chromium.org>
If the user does not quickly provide some input, exit so that other
things can be done, such as searching for the next OS.
Signed-off-by: Simon Glass <sjg@chromium.org>
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 <sjg@chromium.org>
Provide some forward declarations for types used in this file, to keep
the LSP happy and avoid errors if the caller happens not to include the
required header.
Signed-off-by: Simon Glass <sjg@chromium.org>
The gap is intended to separate options which are on different bootdevs,
but most of the time there is only one. So drop this gap.
Keep the code around in case it becomes useful to have it in the style,
or based on some other mechanism.
Signed-off-by: Simon Glass <sjg@chromium.org>
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 <sjg@chromium.org>
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 <sjg@chromium.org>
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 <sjg@chromium.org>
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.
Signed-off-by: Simon Glass <sjg@chromium.org>
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 <sjg@chromium.org>
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 <sjg@chromium.org>
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 <sjg@chromium.org>
In some cases it is useful to obtain more than just two bounding boxes
from a menu, e.g. to line up all descriptions vertically.
Use an array to obtain bounding-box information and calculate it
separately for each item.
Signed-off-by: Simon Glass <sjg@chromium.org>
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 <sjg@chromium.org>
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 <sjg@chromium.org>
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 <sjg@chromium.org>
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 <sjg@chromium.org>
Refactor bootflow_menu_add_all() to call a new bootflow_menu_add() to
add each of its bootflows.
Move the last_bootdev value into struct menu_priv to make this work.
Signed-off-by: Simon Glass <sjg@chromium.org>
Split the iteration piece of this function into bootflow_menu_add_all()
so that it is possible for the caller to be in control of adding items
to the menu.
Move the expo_destroy() call into the caller.
Signed-off-by: Simon Glass <sjg@chromium.org>
Split the starting piece of this function into bootflow_menu_start()
and the polling part into bootflow_menu_poll() so that it is possible
for the caller to be in control of the event loop.
Move the expo_destroy() call into the caller.
Signed-off-by: Simon Glass <sjg@chromium.org>
At present when the user moves to a new menu item, the menu code
handles this immediately. This means it is not possible to use an expo
action to effect the same change.
Update this so that EXPOACT_POINT_ITEM is handled in cedit_do_action().
Expand the test to cover this.
Signed-off-by: Simon Glass <sjg@chromium.org>
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 <sjg@chromium.org>
Refactor the action-processing code into a new cedit_do_action()
function so we can call it from a test. Check moving to a new field and
opening the menu, to ensure that rendering is correct.
Signed-off-by: Simon Glass <sjg@chromium.org>
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 <sjg@chromium.org>
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 <sjg@chromium.org>
Add more info in this function so that the partition number and the call
to bootmeth_read_bootflow() are logged.
Signed-off-by: Simon Glass <sjg@chromium.org>
The function is used to handle the boot_targets variable so must support
space-separated items. Update the comment to show this.
Signed-off-by: Simon Glass <sjg@chromium.org>
The current implementation of labels uses the ordering of the media
devices to start its scan but then uses the ordering of the (child)
bootdev devices to iterate from then on. This is inconsistent and can
miss some bootdevs.
Update bootdev_next_label() so that it uses the ordering of the bootdev
devices to perform its scan. Check for running out of labels as well.
Signed-off-by: Simon Glass <sjg@chromium.org>
The driver name is typically not unique so using that as a basis for the
block and bootdev devices makes them hard to distinguish. This happens
when there are multiple USB controllers using the same driver.
Make use of the parent-device name and the hub port number. This gives a
reasonable chance that the name is unique.
Signed-off-by: Simon Glass <sjg@chromium.org>
In some cases we want to show a signed value to the user without needing
to use the full printf() implementation. Add a new version of the
simple_itoa() function to handle this.
Update the existing function to use ulong instead of long, to avoid
confusion about which it actually uses.
Signed-off-by: Simon Glass <sjg@chromium.org>
Sandbox is special in that we use the bitness of the host. This should
extend to PHYS_64BIT as well, so enable this option when building on a
64-bit host.
Update the conditions in io.h so that 64-bit access is available.
Signed-off-by: Simon Glass <sjg@chromium.org>
In some cases it is useful to set up a buffer with some data to read,
e.g. when reading lines from a text file. Add a helper for this.
Tidy up the comment for membuf_init() while we are here.
Signed-off-by: Simon Glass <sjg@chromium.org>
Using an abuf for this function simplifies returning the size and also
makes it easier to free memory afterwards. Update the API and callers.
Signed-off-by: Simon Glass <sjg@chromium.org>
Using an abuf for this function simplifies returning the size and also
makes it easier to free memory afterwards. Update the API and callers.
Signed-off-by: Simon Glass <sjg@chromium.org>
Using an abuf for this functions simplifies returning the size and also
makes it easier to free memory afterwards. Update the API and callers.
Signed-off-by: Simon Glass <sjg@chromium.org>
Provide a way to draw an unfilled box of a certain width. This is useful
for grouping menu items together.
Add a comment showing how to see the copy-framebuffer, for testing.
Signed-off-by: Simon Glass <sjg@chromium.org>
When using expo we want to be able to control the information on the
display and avoid other messages (such as USB scanning) appearing.
Add a 'quiet' flag for the console, to help with this.
Signed-off-by: Simon Glass <sjg@chromium.org>
We want to check the display contents in expo tests, so move the two
needed functions to a new header file.
Signed-off-by: Simon Glass <sjg@chromium.org>
Add a console_printf_select_stderr() function so that it is not
necessary for the caller to process the format string.
Signed-off-by: Simon Glass <sjg@chromium.org>
When writing multiple lines of text we need to be able to control which
text goes on each line. Add a new vidconsole_put_stringn() function to
help with this.
Signed-off-by: Simon Glass <sjg@chromium.org>
Expo needs to be able to word-wrap lines so that they are displayed as
the user expects. Add a limit on the width of each line and support this
in the measurement algorithm.
Add a log category to truetype while we are here.
Signed-off-by: Simon Glass <sjg@chromium.org>
It is useful to be able to embed newline characters in the string and
have the text measured into multiple lines. Add support for this.
Signed-off-by: Simon Glass <sjg@chromium.org>
Update the vidconsole API so that measure() can measure multiple lines
of text. This will make it easier to implement multi-line fields in
expo.
Tidy up the function comments while we are here.
Signed-off-by: Simon Glass <sjg@chromium.org>
The CONFIG_WHITE_ON_BLACK setting is hard-coded at build-time. It is
useful to be able to control this when showing menus.
Create a property to hold this information, using the CONFIG as the
initial value.
Signed-off-by: Simon Glass <sjg@chromium.org>
It is useful to format a string into a buffer, with the sizing handled
automatically. Add a function for this.
Signed-off-by: Simon Glass <sjg@chromium.org>
It is useful to be able to copy an abuf, to allow changes while
preserving the original. Add a function for this.
Signed-off-by: Simon Glass <sjg@chromium.org>
Logging of function return-values is used very frequently in U-Boot now.
Add a few helper macros to make it less verbose to use.
Signed-off-by: Simon Glass <sjg@chromium.org>
Add an extlinux image that contains a few Ubuntu entries.
Increase the number of sandbox-USB-hub ports to permit this.
Signed-off-by: Simon Glass <sjg@chromium.org>
To permit easier adding of other images, move the Fedora-specific
portions of setup_bootflow_image() into a separate function.
Signed-off-by: Simon Glass <sjg@chromium.org>
When trying all bootdevs in a uclass, the method flags are not preserved
in the iterator.
This has no impact on the first bootdev, since that is the one which
sets the flags. For the next one, iter_inc() is used and it finds the
next bootdev. However it sets the method_flags to 0
The result is that the third scan is conducted without the required
BOOTFLOW_METHF_SINGLE_UCLASS flag, so iteration procees to the next
label. This can miss bootdev if there three or more USB-storage devices,
for example.
Fix this by keeping the method flags around in this case.
Signed-off-by: Simon Glass <sjg@chromium.org>
At present when one bootmeth fails on the final partition, the next
bootmeth is not tried. Adjust the logic to go to the next bootmeth,
which is the more natural behaviour.
Signed-off-by: Simon Glass <sjg@chromium.org>
constchar*test_string="There is always much\nto be said for not "
"attempting more than you can do and for making a certainty of "
"what you try. But this principle, like others in life and "
"war, has its exceptions.";
constchar*test_string="There is always much\nto be said for not attempting more than you can do and for making a certainty of what you try. But this principle, like others in life and war, has its exceptions.";
conststructvidconsole_mline*line;
structvidconsole_bboxbbox;
structvideo_priv*priv;
@@ -840,9 +837,7 @@ static int dm_test_font_measure(struct unit_test_state *uts)
ut_asserteq_strn("to be said for not attempting more than you can do "
"and for making a certainty of what you try. But this "
"principle, like others in",
ut_asserteq_strn("to be said for not attempting more than you can do and for making a certainty of what you try. But this principle, like others in",
test_string+line->start);
line++;
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.