Removed CVideo argument from help functions
Just used the singleton in the main show_help function.
This commit is contained in:
parent
de1a9724eb
commit
29ff4bd644
17 changed files with 55 additions and 56 deletions
|
@ -991,7 +991,7 @@ bool editor_controller::execute_command(const hotkey::hotkey_command& cmd, int i
|
|||
|
||||
void editor_controller::show_help()
|
||||
{
|
||||
help::show_help(gui_->video(), "..editor");
|
||||
help::show_help("..editor");
|
||||
}
|
||||
|
||||
void editor_controller::show_menu(const std::vector<config>& items_arg, int xloc, int yloc, bool context_menu, display& disp)
|
||||
|
@ -1113,9 +1113,9 @@ void editor_controller::unit_description()
|
|||
const unit_map & units = get_current_map_context().get_units();
|
||||
const unit_map::const_unit_iterator un = units.find(loc);
|
||||
if(un != units.end()) {
|
||||
help::show_unit_help(gui_->video(), un->type_id(), un->type().show_variations_in_help(), false);
|
||||
help::show_unit_help(un->type_id(), un->type().show_variations_in_help(), false);
|
||||
} else {
|
||||
help::show_help(gui_->video(), "..units");
|
||||
help::show_help("..units");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1363,7 +1363,7 @@ void editor_controller::terrain_description()
|
|||
return;
|
||||
|
||||
const terrain_type& type = context_manager_->get_map().get_terrain_info(loc);
|
||||
help::show_terrain_description(gui().video(), type);
|
||||
help::show_terrain_description(type);
|
||||
}
|
||||
|
||||
void editor_controller::process_keyup_event(const SDL_Event& event)
|
||||
|
|
|
@ -63,9 +63,9 @@ addon_connect::addon_connect(std::string& host_name,
|
|||
register_text("host_name", false, host_name, true);
|
||||
}
|
||||
|
||||
void addon_connect::help_button_callback(window& window)
|
||||
void addon_connect::help_button_callback(window& /*window*/)
|
||||
{
|
||||
help::show_help(window.video(), "installing_addons");
|
||||
help::show_help("installing_addons");
|
||||
}
|
||||
|
||||
void addon_connect::pre_show(window& window)
|
||||
|
|
|
@ -403,7 +403,7 @@ void addon_manager::pre_show(window& window)
|
|||
|
||||
connect_signal_mouse_left_click(
|
||||
find_widget<button>(&window, "show_help", false),
|
||||
std::bind(&addon_manager::show_help, this, std::ref(window)));
|
||||
std::bind(&addon_manager::show_help, this));
|
||||
|
||||
if(stacked_widget* stk = find_widget<stacked_widget>(&window, "main_stack", false, false)) {
|
||||
button& btn = find_widget<button>(&window, "details_toggle", false);
|
||||
|
@ -765,9 +765,9 @@ void addon_manager::execute_default_action(const addon_info& addon, window& wind
|
|||
}
|
||||
}
|
||||
|
||||
void addon_manager::show_help(window& window)
|
||||
void addon_manager::show_help()
|
||||
{
|
||||
help::show_help(window.video(), "installing_addons");
|
||||
help::show_help("installing_addons");
|
||||
}
|
||||
|
||||
void addon_manager::browse_url_callback(text_box& url_box)
|
||||
|
|
|
@ -123,7 +123,7 @@ private:
|
|||
void copy_url_callback(text_box& url_box);
|
||||
|
||||
void apply_filters(window& window);
|
||||
void show_help(window& window);
|
||||
void show_help();
|
||||
|
||||
boost::dynamic_bitset<> get_name_filter_visibility(const window& window) const;
|
||||
boost::dynamic_bitset<> get_status_filter_visibility(const window& window) const;
|
||||
|
|
|
@ -293,7 +293,7 @@ void title_screen::pre_show(window& win)
|
|||
}
|
||||
|
||||
help::help_manager help_manager(&game_config_manager::get()->game_config());
|
||||
help::show_help(win.video());
|
||||
help::show_help();
|
||||
});
|
||||
|
||||
//
|
||||
|
|
|
@ -57,7 +57,7 @@ void unit_advance::pre_show(window& window)
|
|||
|
||||
connect_signal_mouse_left_click(
|
||||
find_widget<button>(&window, "show_help", false),
|
||||
std::bind(&unit_advance::show_help, this, std::ref(window)));
|
||||
std::bind(&unit_advance::show_help, this));
|
||||
|
||||
for(size_t i = 0; i < previews_.size(); i++) {
|
||||
const unit& sample = *previews_[i];
|
||||
|
@ -111,9 +111,9 @@ void unit_advance::list_item_clicked(window& window)
|
|||
.set_displayed_unit(*previews_[selected_row]);
|
||||
}
|
||||
|
||||
void unit_advance::show_help(window& window)
|
||||
void unit_advance::show_help()
|
||||
{
|
||||
help::show_help(window.video(), "advancement");
|
||||
help::show_help("advancement");
|
||||
}
|
||||
|
||||
void unit_advance::post_show(window& window)
|
||||
|
|
|
@ -42,7 +42,7 @@ private:
|
|||
|
||||
void list_item_clicked(window& window);
|
||||
|
||||
void show_help(window& window);
|
||||
void show_help();
|
||||
|
||||
const unit_ptr_vector& previews_;
|
||||
|
||||
|
|
|
@ -178,7 +178,7 @@ void unit_recall::pre_show(window& window)
|
|||
|
||||
connect_signal_mouse_left_click(
|
||||
find_widget<button>(&window, "show_help", false),
|
||||
std::bind(&unit_recall::show_help, this, std::ref(window)));
|
||||
std::bind(&unit_recall::show_help, this));
|
||||
|
||||
for(const unit_const_ptr& unit : recall_list_) {
|
||||
std::map<std::string, string_map> row_data;
|
||||
|
@ -314,9 +314,9 @@ void unit_recall::dismiss_unit(window& window)
|
|||
}
|
||||
}
|
||||
|
||||
void unit_recall::show_help(window& window)
|
||||
void unit_recall::show_help()
|
||||
{
|
||||
help::show_help(window.video(), "recruit_and_recall");
|
||||
help::show_help("recruit_and_recall");
|
||||
}
|
||||
|
||||
void unit_recall::list_item_clicked(window& window)
|
||||
|
|
|
@ -59,7 +59,7 @@ private:
|
|||
void list_item_clicked(window& window);
|
||||
void filter_text_changed(text_box_base* textbox, const std::string& text);
|
||||
void dismiss_unit(window& window);
|
||||
void show_help(window& window);
|
||||
void show_help();
|
||||
|
||||
/** Function to sort recall_list_ by default. */
|
||||
static bool unit_recall_default_compare(const unit_const_ptr first, const unit_const_ptr second);
|
||||
|
|
|
@ -70,7 +70,7 @@ void unit_recruit::pre_show(window& window)
|
|||
|
||||
connect_signal_mouse_left_click(
|
||||
find_widget<button>(&window, "show_help", false),
|
||||
std::bind(&unit_recruit::show_help, this, std::ref(window)));
|
||||
std::bind(&unit_recruit::show_help, this));
|
||||
|
||||
for(const auto& recruit : recruit_list_)
|
||||
{
|
||||
|
@ -122,9 +122,9 @@ void unit_recruit::list_item_clicked(window& window)
|
|||
.set_displayed_type(*recruit_list_[selected_row]);
|
||||
}
|
||||
|
||||
void unit_recruit::show_help(window& window)
|
||||
void unit_recruit::show_help()
|
||||
{
|
||||
help::show_help(window.video(), "recruit_and_recall");
|
||||
help::show_help("recruit_and_recall");
|
||||
}
|
||||
|
||||
void unit_recruit::post_show(window& window)
|
||||
|
|
|
@ -43,7 +43,7 @@ private:
|
|||
|
||||
void list_item_clicked(window& window);
|
||||
|
||||
void show_help(window& window);
|
||||
void show_help();
|
||||
|
||||
std::vector<const unit_type*>& recruit_list_;
|
||||
|
||||
|
|
|
@ -533,7 +533,7 @@ void unit_preview_pane::profile_button_callback()
|
|||
if(get_window()) {
|
||||
const unit_type* ut = unit_types.find(current_type_);
|
||||
if(ut != nullptr) {
|
||||
help::show_unit_description((*get_window()).video(), *ut);
|
||||
help::show_unit_description(*ut);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,17 +55,17 @@ static lg::log_domain log_help("help");
|
|||
|
||||
namespace help {
|
||||
|
||||
void show_unit_description(CVideo& video, const unit &u)
|
||||
void show_unit_description(const unit &u)
|
||||
{
|
||||
help::show_unit_description(video, u.type());
|
||||
help::show_unit_description(u.type());
|
||||
}
|
||||
|
||||
void show_terrain_description(CVideo& video, const terrain_type &t)
|
||||
void show_terrain_description(const terrain_type &t)
|
||||
{
|
||||
help::show_terrain_help(video, t.id(), t.hide_in_editor() || t.is_combined());
|
||||
help::show_terrain_help(t.id(), t.hide_in_editor() || t.is_combined());
|
||||
}
|
||||
|
||||
void show_unit_description(CVideo& video, const unit_type &t)
|
||||
void show_unit_description(const unit_type &t)
|
||||
{
|
||||
std::string var_id = t.get_cfg()["variation_id"].str();
|
||||
if (var_id.empty())
|
||||
|
@ -83,9 +83,9 @@ void show_unit_description(CVideo& video, const unit_type &t)
|
|||
}
|
||||
|
||||
if (use_variation)
|
||||
help::show_variation_help(video, t.id(), var_id, hide_help);
|
||||
help::show_variation_help(t.id(), var_id, hide_help);
|
||||
else
|
||||
help::show_unit_help(video, t.id(), t.show_variations_in_help(), hide_help);
|
||||
help::show_unit_help(t.id(), t.show_variations_in_help(), hide_help);
|
||||
}
|
||||
|
||||
extern config dummy_cfg;
|
||||
|
@ -113,9 +113,9 @@ help_manager::~help_manager()
|
|||
*
|
||||
* If show_topic is the empty string, the default topic will be shown.
|
||||
*/
|
||||
void show_help(CVideo& video, const std::string& show_topic, int xloc, int yloc)
|
||||
void show_help(const std::string& show_topic, int xloc, int yloc)
|
||||
{
|
||||
show_help(video, default_toplevel, show_topic, xloc, yloc);
|
||||
show_help(default_toplevel, show_topic, xloc, yloc);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -123,9 +123,9 @@ void show_help(CVideo& video, const std::string& show_topic, int xloc, int yloc)
|
|||
*
|
||||
* If show_topic is the empty string, the default topic will be shown.
|
||||
*/
|
||||
void show_unit_help(CVideo& video, const std::string& show_topic, bool has_variations, bool hidden, int xloc, int yloc)
|
||||
void show_unit_help(const std::string& show_topic, bool has_variations, bool hidden, int xloc, int yloc)
|
||||
{
|
||||
show_help(video, default_toplevel,
|
||||
show_help(default_toplevel,
|
||||
hidden_symbol(hidden) + (has_variations ? ".." : "") + unit_prefix + show_topic, xloc, yloc);
|
||||
}
|
||||
|
||||
|
@ -134,19 +134,17 @@ void show_unit_help(CVideo& video, const std::string& show_topic, bool has_varia
|
|||
*
|
||||
* If show_topic is the empty string, the default topic will be shown.
|
||||
*/
|
||||
void show_terrain_help(CVideo& video, const std::string& show_topic, bool hidden, int xloc, int yloc)
|
||||
void show_terrain_help(const std::string& show_topic, bool hidden, int xloc, int yloc)
|
||||
{
|
||||
show_help(video, default_toplevel, hidden_symbol(hidden) + terrain_prefix + show_topic, xloc, yloc);
|
||||
show_help(default_toplevel, hidden_symbol(hidden) + terrain_prefix + show_topic, xloc, yloc);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Open the help browser, show the variation of the unit matching.
|
||||
*/
|
||||
void show_variation_help(CVideo& video, const std::string& unit, const std::string &variation, bool hidden, int xloc, int yloc)
|
||||
void show_variation_help(const std::string& unit, const std::string &variation, bool hidden, int xloc, int yloc)
|
||||
{
|
||||
show_help(video, default_toplevel, hidden_symbol(hidden) + variation_prefix + unit + "_" + variation, xloc, yloc);
|
||||
show_help(default_toplevel, hidden_symbol(hidden) + variation_prefix + unit + "_" + variation, xloc, yloc);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -155,10 +153,12 @@ void show_variation_help(CVideo& video, const std::string& unit, const std::stri
|
|||
* This allows for complete customization of the contents, although not in a
|
||||
* very easy way.
|
||||
*/
|
||||
void show_help(CVideo& video, const section &toplevel_sec,
|
||||
void show_help(const section &toplevel_sec,
|
||||
const std::string& show_topic,
|
||||
int xloc, int yloc)
|
||||
{
|
||||
CVideo& video = CVideo::get_singleton();
|
||||
|
||||
const events::event_context dialog_events_context;
|
||||
const gui::dialog_manager manager;
|
||||
|
||||
|
|
|
@ -32,28 +32,28 @@ struct section;
|
|||
/// Open a help dialog using a toplevel other than the default. This
|
||||
/// allows for complete customization of the contents, although not in a
|
||||
/// very easy way.
|
||||
void show_help(CVideo& video, const section &toplevel, const std::string& show_topic="",
|
||||
void show_help(const section &toplevel, const std::string& show_topic="",
|
||||
int xloc=-1, int yloc=-1);
|
||||
|
||||
/// Open the help browser. The help browser will have the topic with id
|
||||
/// show_topic open if it is not the empty string. The default topic
|
||||
/// will be shown if show_topic is the empty string.
|
||||
void show_help(CVideo& video, const std::string& show_topic="", int xloc=-1, int yloc=-1);
|
||||
void show_help(const std::string& show_topic="", int xloc=-1, int yloc=-1);
|
||||
|
||||
/// wrapper to add unit prefix and hiding symbol
|
||||
void show_unit_help(CVideo& video, const std::string& unit_id, bool has_variations=false,
|
||||
void show_unit_help(const std::string& unit_id, bool has_variations=false,
|
||||
bool hidden = false, int xloc=-1, int yloc=-1);
|
||||
|
||||
/// wrapper to add variation prefix and hiding symbol
|
||||
void show_variation_help(CVideo& video, const std::string &unit_id, const std::string &variation,
|
||||
void show_variation_help(const std::string &unit_id, const std::string &variation,
|
||||
bool hidden = false, int xloc=-1, int yloc=-1);
|
||||
|
||||
/// wrapper to add terrain prefix and hiding symbol
|
||||
void show_terrain_help(CVideo& video, const std::string& unit_id, bool hidden = false,
|
||||
void show_terrain_help(const std::string& unit_id, bool hidden = false,
|
||||
int xloc = -1, int yloc = -1);
|
||||
|
||||
void show_unit_description(CVideo& video, const unit_type &t);
|
||||
void show_unit_description(CVideo& video, const unit &u);
|
||||
void show_terrain_description(CVideo& video, const terrain_type& t);
|
||||
void show_unit_description(const unit_type &t);
|
||||
void show_unit_description(const unit &u);
|
||||
void show_terrain_description(const terrain_type& t);
|
||||
|
||||
} // End namespace help.
|
||||
|
|
|
@ -217,7 +217,7 @@ void menu_handler::show_chat_log()
|
|||
|
||||
void menu_handler::show_help()
|
||||
{
|
||||
help::show_help(gui_->video());
|
||||
help::show_help();
|
||||
}
|
||||
|
||||
void menu_handler::speak()
|
||||
|
@ -597,7 +597,7 @@ void menu_handler::unit_description()
|
|||
{
|
||||
const unit_map::const_iterator un = current_unit();
|
||||
if(un != units().end()) {
|
||||
help::show_unit_description(pc_.get_display().video(), *un);
|
||||
help::show_unit_description(*un);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -610,7 +610,7 @@ void menu_handler::terrain_description(mouse_handler& mousehandler)
|
|||
|
||||
const terrain_type& type = map().get_terrain_info(loc);
|
||||
// const terrain_type& info = board().map().get_terrain_info(terrain);
|
||||
help::show_terrain_description(pc_.get_display().video(), type);
|
||||
help::show_terrain_description(type);
|
||||
}
|
||||
|
||||
void menu_handler::rename_unit()
|
||||
|
|
|
@ -1404,7 +1404,7 @@ int game_lua_kernel::intf_message(lua_State *L)
|
|||
int game_lua_kernel::intf_open_help(lua_State *L)
|
||||
{
|
||||
if (game_display_) {
|
||||
help::show_help(game_display_->video(), luaL_checkstring(L, 1));
|
||||
help::show_help(luaL_checkstring(L, 1));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -215,8 +215,7 @@ bool click(int mousex, int mousey)
|
|||
{
|
||||
for(std::map<int, tooltip>::const_iterator i = tips.begin(); i != tips.end(); ++i) {
|
||||
if(!i->second.action.empty() && sdl::point_in_rect(mousex, mousey, i->second.rect)) {
|
||||
display* disp = resources::screen;
|
||||
help::show_help(disp->video(), i->second.action);
|
||||
help::show_help(i->second.action);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue