This was only ever needed for is_in_dialog (and one thing in text_box_base), and we can use the dispatcher list for the former, since windows are the only dispatchers that register themselves to receive events.
* Functions that return time values now return proper std::chrono::duration units (milliseconds,
seconds, etc.). This removes the need to do manual unit conversions.
* Simple time-to-execute logging was replaced with `utils::optimer`.
* Most uses of `SDL_GetTicks()` have been replaced with `std::chrono::steady_clock`.
* Uses of events::pump_info::ticks() have been replaced with direct calls to steady_clock::now().
This made the countdown_clock code significantly simpler. As for the music_tinker, that needs
to be rethought wholesale.
This has been megasquashed because it was a month-long mess of fixes
and reworks.
In summary:
* objects no-longer draw by hooking a DRAW event. In stead they
inherit from gui2::top_level_drawable, and implement its interface.
* the game display now renders to an offscreen buffer. This is used
to implement hardware scrolling, and to redraw after halos, floating
labels etc. move.
* halos, floating labels, tooltips, and a few more things are now
drawn on top of the game display, rather than as part of it. This
allows them to be updated independently without reading pixels
from the screen.
* surface restorers have been removed. Reading pixels from the screen
should now be unnecessary excepting two cases: (a) screenshots,
(b) background blur. Blur is cached, and screenshots are occasional.
* GUI2 widgets no longer keep track of dirty state. They are redrawn
as necessary. Most places which previously set dirty state now queue
a redraw in their part of the screen in stead.
* A consequence is that active translucency is enabled across all UI
elements, and the game display can (and does) continue to animate
while menus and dialogs are showing.
* performance is drastically increased for basically everything, most
notably map scrolling, floating text, and halos.
* CPU usage is drastically decreased. With animations disabled it is
essentially zero while nothing is moving.
* GPU usage is also minimal. The display is only flipped if something
is drawn.
This additionally:
* Makes all copyright notices identical aside from the starting year for Wesnoth-specific source files. Files not included: mariadbpp, lua, spirit po, xbrz, and bcrypt (crypt_blowfish).
* Removes all attribution from the files, since the vast majority of them are outdated or seemingly just outright incorrect. For example, I would guess that Dave is no longer the sole author of the majority of Wesnoth's current code.
Apparently, even on Boost 1.73 without Boost placeholders specialized as is_placeholder, they were somehow
getting used in the global namespace. Would explain all the "Boost placeholders in the global namespace is
deprecated" warnings I was getting after 23d1db043f9f8266c77c6270ed4ef3eafbc0cf67.
When testing with BOOST_BIND_NO_PLACEHOLDERS, even though I had `using namespace std::placeholders` in utils/functional.hpp,
compilation still failed in places. This confirms even more that Boost global placeholders were being used. Honestly,
it was simplest just to specify std::placeholders for everything. This also means we can remove the hack in utils/functional.hpp
designed to allow Boost placeholders to work with `std::bind`.
This cursor is active when the widget has the mouse focus. You know,
like textboxes are wont to do anywhere else. Took long enough, although
there was an interaction issue with tooltips fixed in the previous
commit.
I still need to figure out how to make this work with GUI1 textboxes
(e.g. in-game console).
The colour version of the cursor was kindly provided by LordBob, and the
B&W version is my own.
This gives GUI2 textboxes (and password boxes since they are a subclass)
a simple hover effect by extending the canvas definitions for the widget
accordingly.
This changes:
utf8::char_t -> char
utf8::string -> std::string
utf16::char_t -> char16_t
utf16::string -> std::u16string
ucs4::char_t -> char32_t
ucs4::string -> std::u32string
utf16::string and ucs4::string are now proper strings instead of vectors of characters too.
In order to get this change to compile at all, I needed to add a ucs4_convert_impl::convert_impl
specialization for wchar_t alongside the new char16_t specialization; both point to the same
conversion implementation type.
This commit doesn't do any additional cleanup. I'm sure if we looked, we could get rid of a
lot of the custom conversion code and probably a bunch of stuff that might have had to do with
supporting utf16::string and ucs4::string being vectors instead of basic_string specializations.
Either way, I don't know the code (or encoding handling in general) to make a call as to what's
needed or not. I'll let someone else do that.
(cherry-picked from commit 1deacd89f640e1ddada75e1286c14a09ab8cce62)
This reverts part of commit 468c6e0f494793d57b0b1264894cd7f0b0383fa2.
Ctrl+A was removed because its emacs meaning is surprising to some
people. Ctrl+E was removed because it was the counterpart of Ctrl+A.
Ctrl+U however doesn't conflict with anything else, and it's useful
to some people (me), so reinstate it.
Use the idiomatic combination.
Update reference to particular comment line of
'src/widgets/textbox.cpp' in comment with the current line where the
comment is now.
Remove `unsigned` as the type for `copypaste_modifier`, because it was
a little bit less future proof that way, it is better as an
`SDL_Keycode`, which at the moment is `Sint32`, which in turn is
`int32_t` ultimately. Reuse the constant for 'select all' so renaming
it to `modifier_key`.
Essentially, this utilizes the second styled_widget overload that takes a builder reference to allow widgets
to initialize themselves without the extra init_control call. It also removes the need for extra functions such
as styled_widget::load_config_extra or styled_widget::init since the widget definition config and canvases are
loaded in the styled_widget ctor. Any code from the uses of the former function were moved either to widget
builders or their ctors.
These were unnecessary since the canvas vector was automatically resized the match the
available number of canvases when a styled_widget was constructed.