Commit graph

92 commits

Author SHA1 Message Date
Charles Dang
cb43d8b35f Convert a bunch more C-style casts I missed in 0dc5656 to static_cast 2018-10-07 23:01:34 +02:00
Charles Dang
f726a86ba5 GUI2: removed 2010 experimental listbox
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
2018-10-07 23:01:32 +02:00
josteph
8000a86828 Lua: Invalidate layout in set_dialog_value()
Needed when the new value is longer than the old one.

Fixes #3572.
2018-09-29 21:15:47 +00:00
Martin Hrubý (hrubymar10)
c18537edc0 Migrate links to https if available 2018-07-15 13:22:56 +11:00
Celtic Minstrel
100d3d4840 Fix two of the dialog functions not accepting translatable strings 2018-04-15 02:20:09 -04:00
Celtic Minstrel
709ecedad7 Lua show_menu: allow specifying markup but not initial selection 2018-03-17 18:11:34 -04:00
Gregory A Lundberg
2d6392adc3
Fix variable hides variable 2018-03-13 19:11:06 -05:00
Charles Dang
26e8c148b1 GUI2: split default return value enum into its own file
This avoid having to include gui/widgets/window.hpp every time you just want to
check a dialog's return value.
2018-03-12 12:03:48 +11:00
Celtic Minstrel
ab354737ef Fix wesnoth.show_message_box ignoring user-specified case for button label 2018-03-11 13:50:53 -04:00
Celtic Minstrel
5fc9d8d173 Use new deprecated_message() function wherever possible (C++)
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.
2018-03-04 21:21:33 -05:00
Celtic Minstrel
0e9935593d Lua GUI2: Support sliders in set_dialog_callback 2018-02-13 10:44:23 +11:00
Gregory A Lundberg
b5f76eff79
Bump copyright to 2018 2018-01-19 00:02:20 -06:00
Charles Dang
6759f41b1e GUI2: cleaned up and restructured initialization process
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.
2017-12-11 14:49:58 +11:00
Charles Dang
c67f5c352a Cleaned up more unnecessary CVideo function arguments and class members
* 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.
2017-11-21 03:07:23 +11:00
Charles Dang
f2b31ba082 Massive cleanup of GUI2 display/show and execute functions implementations and related CVideo arguments
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.
2017-11-20 19:24:41 +11:00
Charles Dang
19bbfedb32 Deployed unique_ptrs in a bunch more places
The changes from stack::push to stack::emplace in ai::handler are since the unique_ptrs make the copy
ctor malformed.
2017-09-04 03:18:21 +11:00
Charles Dang
2a1c1a81fc GUI2: convert uses of 'state changed' callbacks to NOTIFY_MODIFIED signal handlers 2017-08-26 10:49:06 +11:00
Charles Dang
e58bbd7a20 GUI2: use signal handlers for listbox event handling
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]
2017-08-26 10:49:06 +11:00
Celtic Minstrel
e6fce88d21 Minor fixups to [story] 2017-06-04 12:26:02 -04:00
Charles Dang
cdc9ce1fea Fixup cef3e0d 2017-05-05 12:00:02 +11:00
Celtic Minstrel
cef3e0d266 Add wesnoth.show_message_box function 2017-05-04 20:09:52 -04:00
Celtic Minstrel
efb0fe05e9 Accept [story] as ActionWML 2017-05-02 20:49:10 -04:00
Charles Dang
3236d0d8bf Don't copy-initialize SDL_Rects (or arrays of rects) 2017-04-25 04:27:09 +11:00
Celtic Minstrel
22980629f7 Fixup 1954bb67b 2017-04-21 15:45:38 -04:00
Celtic Minstrel
8923978c70 Squash some MSVC warnings 2017-04-19 04:08:10 -04:00
Celtic Minstrel
1954bb67b4 Lua GUI2: A few additions
- 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
2017-04-18 14:26:29 -04:00
Celtic Minstrel
3c5a9aa57c Some style/formatting cleanup 2017-04-18 14:26:28 -04:00
Celtic Minstrel
3802fda221 Rename some labels to be more explanatory 2017-04-18 14:26:26 -04:00
gfgtdf
75c21815f6 allow multi_page to contain differnt types of pages
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
2017-04-12 15:14:58 +02:00
gfgtdf
4608c2d368 wesnoth.set_dialog_value can now unfold treeview nodes (#978) 2017-04-11 03:59:22 +02:00
Charles Dang
a4647b5300 Styled Widget: renamed multi-canvas getter get_canvases()
The single-canvas getter remains, and I deployed it in a few cases where multi-canvas fetching doesn't make sense.
2017-03-22 02:13:29 +11:00
Celtic Minstrel
b4dc11ce36 Belated 2017 copyright update 2017-03-19 10:05:38 -04:00
Charles Dang
84903c99d2 Drop Down Menu: several improvements to embedded toggle button handling
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.
2017-02-17 08:22:07 +11:00
gfgtdf
283fd32077 remove added widget definitions on lua kernel destruction. 2016-12-07 04:10:11 +01:00
gfgtdf
118d18ec7a add lua add_widget_definition function
http://gna.org/bugs/?25337
2016-12-07 04:10:10 +01:00
Celtic Minstrel
67ea79d86f Rename some GUI2 files to match the contained class 2016-11-19 17:16:10 -05:00
Gregory A Lundberg
d31555f8cf Pedantic includes
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.
2016-11-11 11:00:22 -06:00
Charles Dang
5872f52879 Fix some missed rename instances and wrong widget/window IDs 2016-11-10 11:04:09 -05:00
Celtic Minstrel
3da8a27ae7 Fix unit tests 2016-11-09 12:52:41 -05:00
Celtic Minstrel
b6c88df9e7 Final sweep of renames to drop t- prefix 2016-11-09 01:28:24 -05:00
Celtic Minstrel
10b6a34615 Rename all GUI2 dialogs to drop t- prefix
This also places them in a new dialogs namespace.
2016-11-09 01:27:30 -05:00
Celtic Minstrel
3c0470ad93 Rename GUI2 auxiliary types to avoid t- prefix 2016-11-09 01:27:30 -05:00
Celtic Minstrel
c09125096b Rename GUI2 widget classes to drop t- prefix 2016-11-09 01:27:30 -05:00
Celtic Minstrel
f9609c4bb1 Rename GUI2 widget support classes to drop t- prefix 2016-11-09 01:24:25 -05:00
Celtic Minstrel
749f68716d Rename GUI2 canvas classes to avoid t- prefix 2016-11-09 01:17:14 -05:00
Gregory A Lundberg
36ab1f9a5c wesnoth.show_message_dialog: Don't expose has_input flag to Lua
Adjustment of PR 841 (as PR #843)
2016-10-26 00:51:38 -04:00
Gregory A Lundberg
9d08723236 [text_input] Fix bug 25173
Added an internal flag to indicate [text_input] appeared so we no longer require label= to be present.
2016-10-24 21:58:26 -05:00
Gregory A Lundberg
1528a8bb5a Refactor luaL_typerror
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.
2016-10-10 10:19:41 -05:00
Wedge009
2e9a9fc2c9 Avoid hidden variable warnings produced in MSVC compilation.
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.
2016-10-06 19:56:29 +11:00
Celtic Minstrel
0180a72573 Fix lots of warnings in MSVC12
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
2016-09-06 17:55:00 -04:00