Fixes#6724, where scrolling with the mousewheel could reach the last row, but
scrolling with keys or buttons couldn't. Although can_scroll_up() and
can_scroll_down() already existed, can_scroll_down() didn't allow access to the
last line when that line had less than the full number of items. The mousewheel
still worked, because it ignored that logic.
Remove a feature that was seen when the last row is visible - things jumped
between columns to fill the spaces. If you have 10 items, with 4 columns and 2
visible rows then it will appear like this:
a b c d
e f g h
when scrolling down it used to move items sideways to fill the last line, which
seems bad UI because it made items harder to find:
c d e f
g h i j
the new code is simpler, and will instead show the following when scrolling down:
e f g h
i j
Move the layout code into adjust_size(), so that it runs one time when the number
of buttons changes. That could be separated from this commit, but the code
would still be touched in this commit (`counter_from_zero` would still be
replaced by `i`), so doing it and testing the changes together made sense.
Note for the master branch only: scrolling the palettes up and down is
noticeably laggy, which is a regression from last week. That's not caused by
this commit, we're just at a point in the rendering refactor where
`surface_restorer::update()` and thus `gui::widget::hide()` are slow. The fix
for that is already in progress and going to be in 1.17.5.
Contains primitive drawing functions, such as fill, points, line, etc,
and also texture drawing functions blit, flipped, tiled.
This removes specialty drawing code from several places, most notably
CVideo and gui/core/canvas.
Functions to draw to the screen should now go in draw.cpp.
Places where usage is clear have been converted to the new calls.
Places that need extra work to convert are still using get_image(),
as are places that will be clobbered as part of general rendering
system upgrades anyway.
For some reason MinGW doesn't like using template argument deduction on the array... Make it explicit when building there. Also moves the `sized_array` alias to `enum_base` since we don't need it defined in the definition class. Also makes the two versions of ENUM_AND_ARRAY cleaner.
- Cleaned up code and documentation
- Made both overloads of get_enum constexpr (one now takes a string_view instead of a string)
- Used type deduction for the values array. For existing uses this will deduce the same as before (const char*)
This also means it's not explicit, and some classes can use string_view.
Since this is the only way to add things to the hotkey list, there can be at most one
matching entry in the list. Since order doesn't matter, just swap in the new hotkey at
that position rather than erasing and re-adding at end. If we want efficient mid-list
removal we should use std::list.