This was never finished, is not maintained, suffers from a lack of features the "old" listbox
class now has, and seems (according to the logs) to be have been superceded by the pane widget.
At the very least, the pane widget seems to be what mordante was working with in his early
prototype of a new addon manager, and not this 2010 list class.
since this was removed in master, there is little point for keeping it in 1.14
This also covers handling of legacy DescriptionWML for [set_menu_item],
and tweaks its handling in the other cases (mainly [multiplayer_side]).
I added the next_dev_version constant intending to use it, but then
decided not to do so; however I left it in in case someone finds it useful.
This mostly has to do with moving various components into more logical locations instead of
all mushed together in gui/widgets/settings.*pp. To that end, the following changes have been
made:
* The gui2::init function has been moved to its own file in the gui/ toplevel.
* load_settings() has been merged into init().
* All functions and code relating to gui theme definitions have been moved to their own file.
* All code relating to widgets or window static init have been moved to their own file.
* window::update_screen_size has been moved out of the window class and into settings.cpp.
* The unimplemented free-stadnding version of load_widget_definitions has been removed.
* gui_definition::read and gui_defintion::load have been merged into the gui_definition ctor
and greatly simplified.
* Some functions relating to builder_widgets have been renamed for clarity.
* add/remove_single_widget_defintion now access the current gui theme instead of the default.
This looks like it was a mistake made in the original code.
* Since the static registry is now externally linked, the unit tests accessor for window types
has been removed.
* Documentation has been updated. The wikidoc comment for gui_definition has been removed. It
was rather out-of-date and needed to be reworked anyway.
* widget_builder_func_t's signature is now to take a config reference and not a copy, though
REGISRER_WIDGET had already passed register_builder_widget a lambda that took a reference.
* Various other misc cleanups and improvements.
* Dropped unused CVideo class member references.
* Replaced the lone usecase of the CVideo member in loadgame with the singleton and removed said member.
* Removed CVideo references from a bunch of addon management functions.
* Cleaned up a *lot* of now-unnecessary forward CVideo declarations.
This a two part commit. First:
----------------------------------------------------------------------------------------------------
Added and deployed two new helper macros for the standard implementations of the static execute
and display functions. I also made use of a variadic template in order greatly simplify code
maintenance. Now, even if the dialog's ctor parameters change, no one has to worry about updating
the associated execute/display functions (though of course, this only applies if the helper macros
are used). \o/
I did not deploy the macro in cases where there were multiple overloads or the functions did more
than just show their dialogs. I might add an additional __VA_ARGS_ parameter to the macros later.
Do note for the end_credits dialog I moved the default empty-string parameter from the display
function to the ctor.
Second:
----------------------------------------------------------------------------------------------------
Another change is that modal_dialog::show and modeless_dialog::show no longer take CVideo arguments.
Since the video argument couldn't be included in the parameter pack (maintaining the argument would
have meant making it the first one, which would be just as much work), and using CVideo::get_singleton
in the macros would require adding video.hpp includes in a whole bunch of files, I simply removed the
argument. I had been intending to do this for a while anyway.
This therefor also removes the CVideo argument from:
* All dialog display/execute functions.
* modal_dialog::show
* modal_dialog::build_window
* modeless_dialog::show
* modeless_dialog::build_window
* wml_exception::show
* gui2::show_message
* gui2::show_error_message
* gui2::show_transient_message
* gui2::show_transient_error_message
* gui2::show_wml_message
* gui2::build
* gui2:🪟:window
* gui2::dialogs::tip::show
* Various GUI2-related Lua functions. The video_dispatch helper was also removed.
* Any functions that took a CVideo argument for the sole purpose of passing it to one of the above.
Ya know, all these damn CVideo arguments didn't actually do anything, besides an occasional check to
CVideo::faked. At the end of the pipeline, they just got assigned to the video_ member of gui2::window.
Huge code bloat for nothing.
This affects uses of both set_callback_item_change and set_callback_value_change.
Finally we get rid of most of the conditional GUI2_EXPERIMENTAL_LISTBOX handler setups. \o/
[ci skip]
- Support for multimenu buttons
- Support for selecting multiple items in listboxes and stacked widgets
GUI2 C++ API:
- Documentation fixups
- Function to test if a layer of a stacked_widget is selected
- Function to test if a row of a listbox is selected
- listbox::select_row now returns false if it failed to select/deselect anything
- Functions to count and select options of a multimenu_button
- multimenu_button now always has keep_open, so the function to set it is removed
- multimenu_button now assumes every option has a toggle
although stacked_widget supports similar functionality this is currently
not easily doable from the lua gui2 api. In particular
1) stacked_widget cannot add pages dynamically
2) multi_page can only contain one type of widget.
3) a stacked_widget inside a multi_page is ineffective since it
generates many unused widgets
4) a multi_page inside a stacked_widget is just unhandy to use
Any click on a row with a toggle button will now toggle that row's button prior to closing the dialog, unless the
keep_open flag was set, in which case the click will toggle the button but the dialog will not close.
Clicks directly on the toggle buttons themselves are unchanged.
Change all includes to start at the base instead of assuming the directory where included from.
This makes it more apparent exactly which header has been included, since many have the same name.
This also allows moving all header files out of the src directory.
Lua deprecated luaL_typerror. Wesnoth needs it. Traditionally this was handled as a by-hand edit to the Lua source kit. Refactored into Wesnoth as luaW_type_error.
An extension of af73336, hopefully this will remove some more of the warnings which pop up in MSVC compilation. Also try to use more explanatory variable names as code should generally be self-documenting and easy to read.
Some explanations:
- savepng uses setjmp, so I changed it to C; this guarantees that someone does not accidentally introduce a C++ object in it (unlikely though that is)
- The loop in multiplayer.cpp seemed intended to allow the command-line to request repeated plays, so the break was removed rather than refactoring it to an if statement
- Some uninitialized structs were changed to be zero-initialized
- Use luaW_toboolean instead of lua_toboolean
- Needed explicit constructor for vconfig iterators, since their only member is const