[Commits] [wesnoth/wesnoth] f2b31b: Massive cleanup of GUI2 display/show and execute f...

GitHub noreply at github.com
Mon Nov 20 08:25:36 UTC 2017


  Branch: refs/heads/master
  Home:   https://github.com/wesnoth/wesnoth
  Commit: f2b31ba082e1ff47443120469e06b89318f37284
      https://github.com/wesnoth/wesnoth/commit/f2b31ba082e1ff47443120469e06b89318f37284
  Author: Charles Dang <exodia339 at gmail.com>
  Date:   2017-11-20 (Mon, 20 Nov 2017)

  Changed paths:
    M src/actions/advancement.cpp
    M src/addon/client.cpp
    M src/addon/manager_ui.cpp
    M src/editor/action/mouse/mouse_action_map_label.cpp
    M src/editor/controller/editor_controller.cpp
    M src/editor/map/context_manager.cpp
    M src/editor/palette/location_palette.cpp
    M src/formula/debugger.cpp
    M src/game_config_manager.cpp
    M src/game_events/action_wml.cpp
    M src/game_initialization/create_engine.cpp
    M src/game_initialization/depcheck.cpp
    M src/game_initialization/multiplayer.cpp
    M src/game_initialization/multiplayer.hpp
    M src/game_initialization/playcampaign.cpp
    M src/game_initialization/singleplayer.cpp
    M src/game_initialization/singleplayer.hpp
    M src/game_launcher.cpp
    M src/generators/default_map_generator.cpp
    M src/gui/core/window_builder.cpp
    M src/gui/core/window_builder.hpp
    M src/gui/dialogs/addon/manager.cpp
    M src/gui/dialogs/advanced_graphics_options.hpp
    M src/gui/dialogs/attack_predictions.hpp
    M src/gui/dialogs/edit_label.hpp
    M src/gui/dialogs/edit_text.hpp
    M src/gui/dialogs/editor/custom_tod.cpp
    M src/gui/dialogs/editor/custom_tod.hpp
    M src/gui/dialogs/editor/edit_label.hpp
    M src/gui/dialogs/editor/edit_scenario.hpp
    M src/gui/dialogs/editor/edit_side.hpp
    M src/gui/dialogs/editor/generator_settings.hpp
    M src/gui/dialogs/editor/new_map.hpp
    M src/gui/dialogs/editor/resize_map.hpp
    M src/gui/dialogs/end_credits.hpp
    M src/gui/dialogs/file_dialog.cpp
    M src/gui/dialogs/folder_create.hpp
    M src/gui/dialogs/game_cache_options.cpp
    M src/gui/dialogs/game_cache_options.hpp
    M src/gui/dialogs/game_delete.hpp
    M src/gui/dialogs/game_load.cpp
    M src/gui/dialogs/game_load.hpp
    M src/gui/dialogs/game_save.hpp
    M src/gui/dialogs/game_stats.hpp
    M src/gui/dialogs/game_version.hpp
    M src/gui/dialogs/gamestate_inspector.cpp
    M src/gui/dialogs/help_browser.hpp
    M src/gui/dialogs/label_settings.cpp
    M src/gui/dialogs/label_settings.hpp
    M src/gui/dialogs/loading_screen.cpp
    M src/gui/dialogs/log_settings.hpp
    M src/gui/dialogs/lua_interpreter.cpp
    M src/gui/dialogs/lua_interpreter.hpp
    M src/gui/dialogs/message.cpp
    M src/gui/dialogs/message.hpp
    M src/gui/dialogs/modal_dialog.cpp
    M src/gui/dialogs/modal_dialog.hpp
    M src/gui/dialogs/modeless_dialog.cpp
    M src/gui/dialogs/modeless_dialog.hpp
    M src/gui/dialogs/multiplayer/lobby.cpp
    M src/gui/dialogs/multiplayer/mp_alerts_options.hpp
    M src/gui/dialogs/multiplayer/mp_connect.cpp
    M src/gui/dialogs/multiplayer/mp_connect.hpp
    M src/gui/dialogs/multiplayer/mp_create_game.cpp
    M src/gui/dialogs/multiplayer/mp_host_game_prompt.hpp
    M src/gui/dialogs/multiplayer/mp_join_game.cpp
    M src/gui/dialogs/multiplayer/mp_join_game.hpp
    M src/gui/dialogs/multiplayer/mp_join_game_password_prompt.hpp
    M src/gui/dialogs/multiplayer/mp_staging.cpp
    M src/gui/dialogs/multiplayer/mp_staging.hpp
    M src/gui/dialogs/outro.hpp
    M src/gui/dialogs/preferences_dialog.cpp
    M src/gui/dialogs/preferences_dialog.hpp
    M src/gui/dialogs/screenshot_notification.hpp
    M src/gui/dialogs/select_orb_colors.hpp
    M src/gui/dialogs/sp_options_configure.hpp
    M src/gui/dialogs/statistics_dialog.hpp
    M src/gui/dialogs/story_viewer.hpp
    M src/gui/dialogs/terrain_layers.hpp
    M src/gui/dialogs/title_screen.cpp
    M src/gui/dialogs/title_screen.hpp
    M src/gui/dialogs/tooltip.cpp
    M src/gui/dialogs/tooltip.hpp
    M src/gui/dialogs/transient_message.cpp
    M src/gui/dialogs/transient_message.hpp
    M src/gui/dialogs/unit_attack.cpp
    M src/gui/dialogs/unit_list.cpp
    M src/gui/dialogs/unit_list.hpp
    M src/gui/dialogs/unit_recall.cpp
    M src/gui/dialogs/wml_error.hpp
    M src/gui/dialogs/wml_message.cpp
    M src/gui/dialogs/wml_message.hpp
    M src/gui/widgets/label.cpp
    M src/gui/widgets/menu_button.cpp
    M src/gui/widgets/multimenu_button.cpp
    M src/gui/widgets/window.cpp
    M src/gui/widgets/window.hpp
    M src/help/help.cpp
    M src/help/help_browser.cpp
    M src/hotkey/command_executor.cpp
    M src/hotkey/hotkey_handler_sp.cpp
    M src/menu_events.cpp
    M src/mouse_events.cpp
    M src/play_controller.cpp
    M src/playsingle_controller.cpp
    M src/playturn.cpp
    M src/preferences/display.cpp
    M src/preferences/display.hpp
    M src/quit_confirmation.cpp
    M src/savegame.cpp
    M src/scripting/game_lua_kernel.cpp
    M src/scripting/lua_gui2.cpp
    M src/scripting/lua_gui2.hpp
    M src/scripting/lua_kernel_base.cpp
    M src/scripting/lua_kernel_base.hpp
    M src/synced_user_choice.cpp
    M src/tests/gui/test_gui2.cpp
    M src/wesnoth.cpp
    M src/whiteboard/manager.cpp
    M src/wml_exception.cpp
    M src/wml_exception.hpp

  Log Message:
  -----------
  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::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.


  Commit: 30291078472edef3dd0e61fd83bc7812dfd175e1
      https://github.com/wesnoth/wesnoth/commit/30291078472edef3dd0e61fd83bc7812dfd175e1
  Author: Charles Dang <exodia339 at gmail.com>
  Date:   2017-11-20 (Mon, 20 Nov 2017)

  Changed paths:
    M src/tests/gui/test_gui2.cpp

  Log Message:
  -----------
  Update tests for 335ffa1b8100


  Commit: 7fad7144d7d8728353d77ce048d3fe98950c2930
      https://github.com/wesnoth/wesnoth/commit/7fad7144d7d8728353d77ce048d3fe98950c2930
  Author: Charles Dang <exodia339 at gmail.com>
  Date:   2017-11-20 (Mon, 20 Nov 2017)

  Changed paths:
    M src/actions/advancement.cpp
    M src/addon/client.cpp
    M src/addon/manager_ui.cpp
    M src/editor/action/mouse/mouse_action_map_label.cpp
    M src/editor/controller/editor_controller.cpp
    M src/editor/map/context_manager.cpp
    M src/editor/palette/location_palette.cpp
    M src/formula/debugger.cpp
    M src/game_config_manager.cpp
    M src/game_events/action_wml.cpp
    M src/game_initialization/create_engine.cpp
    M src/game_initialization/depcheck.cpp
    M src/game_initialization/multiplayer.cpp
    M src/game_initialization/multiplayer.hpp
    M src/game_initialization/playcampaign.cpp
    M src/game_initialization/singleplayer.cpp
    M src/game_initialization/singleplayer.hpp
    M src/game_launcher.cpp
    M src/generators/default_map_generator.cpp
    M src/gui/core/window_builder.cpp
    M src/gui/core/window_builder.hpp
    M src/gui/dialogs/addon/manager.cpp
    M src/gui/dialogs/advanced_graphics_options.hpp
    M src/gui/dialogs/attack_predictions.hpp
    M src/gui/dialogs/edit_label.hpp
    M src/gui/dialogs/edit_text.hpp
    M src/gui/dialogs/editor/custom_tod.cpp
    M src/gui/dialogs/editor/custom_tod.hpp
    M src/gui/dialogs/editor/edit_label.hpp
    M src/gui/dialogs/editor/edit_scenario.hpp
    M src/gui/dialogs/editor/edit_side.hpp
    M src/gui/dialogs/editor/generator_settings.hpp
    M src/gui/dialogs/editor/new_map.hpp
    M src/gui/dialogs/editor/resize_map.hpp
    M src/gui/dialogs/end_credits.hpp
    M src/gui/dialogs/file_dialog.cpp
    M src/gui/dialogs/folder_create.hpp
    M src/gui/dialogs/game_cache_options.cpp
    M src/gui/dialogs/game_cache_options.hpp
    M src/gui/dialogs/game_delete.hpp
    M src/gui/dialogs/game_load.cpp
    M src/gui/dialogs/game_load.hpp
    M src/gui/dialogs/game_save.hpp
    M src/gui/dialogs/game_stats.hpp
    M src/gui/dialogs/game_version.hpp
    M src/gui/dialogs/gamestate_inspector.cpp
    M src/gui/dialogs/help_browser.hpp
    M src/gui/dialogs/label_settings.cpp
    M src/gui/dialogs/label_settings.hpp
    M src/gui/dialogs/loading_screen.cpp
    M src/gui/dialogs/log_settings.hpp
    M src/gui/dialogs/lua_interpreter.cpp
    M src/gui/dialogs/lua_interpreter.hpp
    M src/gui/dialogs/message.cpp
    M src/gui/dialogs/message.hpp
    M src/gui/dialogs/modal_dialog.cpp
    M src/gui/dialogs/modal_dialog.hpp
    M src/gui/dialogs/modeless_dialog.cpp
    M src/gui/dialogs/modeless_dialog.hpp
    M src/gui/dialogs/multiplayer/lobby.cpp
    M src/gui/dialogs/multiplayer/mp_alerts_options.hpp
    M src/gui/dialogs/multiplayer/mp_connect.cpp
    M src/gui/dialogs/multiplayer/mp_connect.hpp
    M src/gui/dialogs/multiplayer/mp_create_game.cpp
    M src/gui/dialogs/multiplayer/mp_host_game_prompt.hpp
    M src/gui/dialogs/multiplayer/mp_join_game.cpp
    M src/gui/dialogs/multiplayer/mp_join_game.hpp
    M src/gui/dialogs/multiplayer/mp_join_game_password_prompt.hpp
    M src/gui/dialogs/multiplayer/mp_staging.cpp
    M src/gui/dialogs/multiplayer/mp_staging.hpp
    M src/gui/dialogs/outro.hpp
    M src/gui/dialogs/preferences_dialog.cpp
    M src/gui/dialogs/preferences_dialog.hpp
    M src/gui/dialogs/screenshot_notification.hpp
    M src/gui/dialogs/select_orb_colors.hpp
    M src/gui/dialogs/sp_options_configure.hpp
    M src/gui/dialogs/statistics_dialog.hpp
    M src/gui/dialogs/story_viewer.hpp
    M src/gui/dialogs/terrain_layers.hpp
    M src/gui/dialogs/title_screen.cpp
    M src/gui/dialogs/title_screen.hpp
    M src/gui/dialogs/tooltip.cpp
    M src/gui/dialogs/tooltip.hpp
    M src/gui/dialogs/transient_message.cpp
    M src/gui/dialogs/transient_message.hpp
    M src/gui/dialogs/unit_attack.cpp
    M src/gui/dialogs/unit_list.cpp
    M src/gui/dialogs/unit_list.hpp
    M src/gui/dialogs/unit_recall.cpp
    M src/gui/dialogs/wml_error.hpp
    M src/gui/dialogs/wml_message.cpp
    M src/gui/dialogs/wml_message.hpp
    M src/gui/widgets/label.cpp
    M src/gui/widgets/menu_button.cpp
    M src/gui/widgets/multimenu_button.cpp
    M src/gui/widgets/window.cpp
    M src/gui/widgets/window.hpp
    M src/help/help.cpp
    M src/help/help_browser.cpp
    M src/hotkey/command_executor.cpp
    M src/hotkey/hotkey_handler_sp.cpp
    M src/menu_events.cpp
    M src/mouse_events.cpp
    M src/play_controller.cpp
    M src/playsingle_controller.cpp
    M src/playturn.cpp
    M src/preferences/display.cpp
    M src/preferences/display.hpp
    M src/quit_confirmation.cpp
    M src/savegame.cpp
    M src/scripting/game_lua_kernel.cpp
    M src/scripting/lua_gui2.cpp
    M src/scripting/lua_gui2.hpp
    M src/scripting/lua_kernel_base.cpp
    M src/scripting/lua_kernel_base.hpp
    M src/synced_user_choice.cpp
    M src/tests/gui/test_gui2.cpp
    M src/wesnoth.cpp
    M src/whiteboard/manager.cpp
    M src/wml_exception.cpp
    M src/wml_exception.hpp

  Log Message:
  -----------
  Merge pull request #2221 from Vultraz/master

Removed CVideo parameters from dialog show() functions, simplified display/execute implementation


Compare: https://github.com/wesnoth/wesnoth/compare/321c350d7618...7fad7144d7d8


More information about the Commits mailing list