Classes | Namespaces | Defines | Typedefs | Enumerations | Functions | Variables

help.cpp File Reference

Routines for showing the help-dialog. More...

#include "global.hpp"
#include "help.hpp"
#include "about.hpp"
#include "display.hpp"
#include "exceptions.hpp"
#include "foreach.hpp"
#include "game_preferences.hpp"
#include "gettext.hpp"
#include "gui/dialogs/transient_message.hpp"
#include "language.hpp"
#include "log.hpp"
#include "map.hpp"
#include "marked-up_text.hpp"
#include "sound.hpp"
#include "unit.hpp"
#include "wml_separators.hpp"
#include "serialization/parser.hpp"
#include <queue>
Include dependency graph for help.cpp:

Go to the source code of this file.

Classes

class  help::topic_generator
 Generate a topic text on the fly. More...
class  help::text_topic_generator
class  help::topic_text
 The text displayed in a topic. More...
struct  help::topic
 A topic contains a title, an id and some text. More...
struct  help::section
 A section contains topics and sections along with title and ID. More...
class  help::has_id
 To be used as a function object to locate sections and topics with a specified ID. More...
class  help::title_less
 To be used as a function object when sorting topic lists on the title. More...
class  help::section_less
 To be used as a function object when sorting section lists on the title. More...
class  help::string_less
struct  help::delete_section
struct  help::create_section
class  help::help_menu
 The menu to the left in the help browser, where topics can be navigated through and chosen. More...
struct  help::help_menu::visible_item
 Information about an item that is visible in the menu. More...
struct  help::parse_error
 Thrown when the help system fails to parse something. More...
class  help::help_text_area
 The area where the content is shown in the help browser. More...
struct  help::help_text_area::item
 An item that is displayed in the text area. More...
class  help::help_text_area::item_at
 Function object to find an item at the specified coordinates. More...
class  help::help_browser
 A help browser widget. More...
class  help::unit_topic_generator

Namespaces

namespace  help

Defines

#define GETTEXT_DOMAIN   "wesnoth-help"
#define WRN_DP   LOG_STREAM(warn, log_display)
#define TRY(name)

Typedefs

typedef std::vector< section * > help::section_list
typedef std::list< topic > help::topic_list
typedef std::vector
< std::vector< std::pair
< std::string, unsigned int > > > 
table_spec

Enumerations

enum  help::UNIT_DESCRIPTION_TYPE { help::FULL_DESCRIPTION, help::NO_DESCRIPTION, help::NON_REVEALING_DESCRIPTION }

Functions

static void help::generate_contents ()
 Generate the help contents from the configurations given to the manager.
static void help::generate_sections (const config *help_cfg, const std::string &generator, section &sec, int level)
 Dispatch generators to their appropriate functions.
static std::vector< topic > help::generate_topics (const bool sort_topics, const std::string &generator)
static std::string help::generate_topic_text (const std::string &generator, const config *help_cfg, const section &sec, const std::vector< topic > &generated_topics)
static std::string help::generate_about_text ()
static std::string help::generate_contents_links (const std::string &section_name, config const *help_cfg)
static std::string help::generate_contents_links (const section &sec, const std::vector< topic > &topics)
static std::string help::make_unit_link (const std::string &type_id)
 return a hyperlink with the unit's name and pointing to the unit page return empty string if this unit is hidden.
static std::vector< std::string > help::make_unit_links_list (const std::vector< std::string > &type_id_list, bool ordered=false)
 return a list of hyperlinks to unit's pages (ordered or not)
static void help::generate_races_sections (const config *help_cfg, section &sec, int level)
static std::vector< topic > help::generate_unit_topics (const bool, const std::string &race)
static UNIT_DESCRIPTION_TYPE help::description_type (const unit_type &type)
 Return the type of description that should be shown for a unit of the given kind.
static std::vector< topic > help::generate_ability_topics (const bool)
static std::vector< topic > help::generate_weapon_special_topics (const bool)
static std::vector< topic > help::generate_faction_topics (const bool)
static section help::parse_config (const config *cfg)
 Parse a help config, return the top level section.
static void help::parse_config_internal (const config *help_cfg, const config *section_cfg, section &sec, int level=0)
 Recursive function used by parse_config.
static bool help::section_is_referenced (const std::string &section_id, const config &cfg)
 Return true if the section with id section_id is referenced from another section in the config, or the toplevel.
static bool help::topic_is_referenced (const std::string &topic_id, const config &cfg)
 Return true if the topic with id topic_id is referenced from another section in the config, or the toplevel.
static const topic * help::find_topic (const section &sec, const std::string &id)
 Search for the topic with the specified identifier in the section and its subsections.
static const section * help::find_section (const section &sec, const std::string &id)
 Search for the section with the specified identifier in the section and its subsections.
static std::vector< std::string > help::parse_text (const std::string &text)
 Parse a text string.
static std::string help::convert_to_wml (const std::string &element_name, const std::string &contents)
 Convert the contents to wml attributes, surrounded within [element_name]...[/element_name].
static SDL_Color help::string_to_color (const std::string &s)
 Return the color the string represents.
static std::vector< std::string > help::split_in_width (const std::string &s, const int font_size, const unsigned width)
 Make a best effort to word wrap s. All parts are less than width.
static std::string help::remove_first_space (const std::string &text)
static std::string help::escape (const std::string &s)
 Prepend all chars with meaning inside attributes with a backslash.
static std::string help::get_first_word (const std::string &s)
 Return the first word in s, not removing any spaces in the start of it.
static std::string make_link (const std::string &text, const std::string &dst)
static std::string jump_to (const unsigned pos)
static std::string jump (const unsigned amount)
static std::string bold (const std::string &s)
static std::string generate_table (const table_spec &tab, const unsigned int spacing=font::relative_size(20))
static unsigned image_width (const std::string &filename)
static void push_tab_pair (std::vector< std::pair< std::string, unsigned int > > &v, const std::string &s)
void help::show_help (display &disp, const std::string &show_topic, int xloc, int yloc)
 Open the help browser, show topic with id show_topic.
void help::show_unit_help (display &disp, const std::string &show_topic, bool hidden, int xloc, int yloc)
 Open the help browser, show unit with id unit_id.
void help::show_help (display &disp, const section &toplevel_sec, const std::string &show_topic, int xloc, int yloc)
 Open a help dialog using a toplevel other than the default.

Variables

static lg::log_domain log_display ("display")

Detailed Description

Routines for showing the help-dialog.

Definition in file help.cpp.


Define Documentation

#define GETTEXT_DOMAIN   "wesnoth-help"

Definition at line 21 of file help.cpp.

#define TRY (   name  ) 
Value:
do { \
                if (config &child = cfg.child(#name)) \
                    handle_##name##_cfg(child); \
                } while (0)
#define WRN_DP   LOG_STREAM(warn, log_display)

Definition at line 46 of file help.cpp.

Referenced by help::help_text_area::add_img_item().


Typedef Documentation

typedef std::vector<std::vector<std::pair<std::string, unsigned int > > > table_spec

Definition at line 706 of file help.cpp.


Function Documentation

static std::string bold ( const std::string &  s  )  [static]

Definition at line 699 of file help.cpp.

References help::escape().

Referenced by help::help_text_area::handle_format_cfg(), help::unit_topic_generator::push_header(), and help::help_text_area::set_items().

Here is the call graph for this function:

Here is the caller graph for this function:

static std::string generate_table ( const table_spec tab,
const unsigned int  spacing = font::relative_size(20) 
) [static]

Definition at line 711 of file help.cpp.

References jump_to().

Referenced by help::unit_topic_generator::operator()().

Here is the call graph for this function:

Here is the caller graph for this function:

static unsigned image_width ( const std::string &  filename  )  [static]

Definition at line 754 of file help.cpp.

References image::get_image().

Referenced by gui::dialog::layout(), and help::unit_topic_generator::operator()().

Here is the call graph for this function:

Here is the caller graph for this function:

static std::string jump ( const unsigned  amount  )  [static]

Definition at line 692 of file help.cpp.

Referenced by help::unit_topic_generator::operator()(), and help::help_text_area::set_items().

Here is the caller graph for this function:

static std::string jump_to ( const unsigned  pos  )  [static]

Definition at line 685 of file help.cpp.

Referenced by generate_table(), and help::help_text_area::handle_jump_cfg().

Here is the caller graph for this function:

static std::string make_link ( const std::string &  text,
const std::string &  dst 
) [static]

Definition at line 679 of file help.cpp.

References help::escape().

Referenced by help::generate_faction_topics(), and help::make_unit_link().

Here is the call graph for this function:

Here is the caller graph for this function:

static void push_tab_pair ( std::vector< std::pair< std::string, unsigned int > > &  v,
const std::string &  s 
) [static]

Definition at line 764 of file help.cpp.

References font::line_width().

Referenced by help::unit_topic_generator::operator()().

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

lg::log_domain log_display("display") [static]
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated by doxygen 1.7.1 on Fri May 25 2012 01:05:23 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs