help.cpp File Reference

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

#include "global.hpp"
#include "about.hpp"
#include "cursor.hpp"
#include "display.hpp"
#include "events.hpp"
#include "game_config.hpp"
#include "game_preferences.hpp"
#include "gettext.hpp"
#include "help.hpp"
#include "image.hpp"
#include "language.hpp"
#include "marked-up_text.hpp"
#include "log.hpp"
#include "sdl_utils.hpp"
#include "sound.hpp"
#include "construct_dialog.hpp"
#include "unit.hpp"
#include "util.hpp"
#include "video.hpp"
#include "wml_separators.hpp"
#include "serialization/parser.hpp"
#include "serialization/string_utils.hpp"
#include "widgets/button.hpp"
#include "widgets/menu.hpp"
#include "widgets/scrollbar.hpp"
#include "widgets/widget.hpp"
#include <algorithm>
#include <iostream>
#include <list>
#include <locale>
#include <map>
#include <queue>
#include <set>
#include <sstream>

Include dependency graph for help.cpp:

Go to the source code of this file.

Namespaces

namespace  help

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...
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

Defines

#define DBG_HELP   LOG_STREAM(debug, help)
#define LOG_HELP   LOG_STREAM(info, help)
#define ERR_HELP   LOG_STREAM(err, help)

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 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 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].
static bool help::get_bool (const std::string &s)
 Return true if s is a representation of a truth value (yes/true/.
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::to_lower (const std::string &s)
 Return a lowercase copy of s.
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 hidden_symbol (bool hidden=true)
static bool is_visible_id (const std::string &id)
static bool is_valid_id (const std::string &id)
 Return true if the id is valid for user defined topics and sections.
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

const configgame_cfg = NULL
gamemapmap = NULL
help::section toplevel
help::section hidden_sections
int last_num_encountered_units = -1
int last_num_encountered_terrains = -1
bool last_debug_state = game_config::debug
config dummy_cfg
std::vector< std::string > empty_string_vector
const int max_section_level = 15
const int menu_font_size = font::SIZE_NORMAL
const int title_size = font::SIZE_LARGE
const int title2_size = font::SIZE_15
const int box_width = 2
const int normal_font_size = font::SIZE_SMALL
const unsigned max_history = 100
const std::string topic_img = "help/topic.png"
const std::string closed_section_img = "help/closed_section.png"
const std::string open_section_img = "help/open_section.png"
const std::string indentation_img = "help/indentation.png"
const std::string default_show_topic = "introduction_topic"
const std::string unknown_unit_topic = ".unknown_unit"
const std::string unit_prefix = "unit_"
const std::string race_prefix = "race_"


Detailed Description

Routines for showing the help-dialog.

Definition in file help.cpp.


Define Documentation

#define DBG_HELP   LOG_STREAM(debug, help)

Definition at line 55 of file help.cpp.

#define ERR_HELP   LOG_STREAM(err, help)

Definition at line 57 of file help.cpp.

#define LOG_HELP   LOG_STREAM(info, help)

Definition at line 56 of file help.cpp.


Typedef Documentation

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

Definition at line 661 of file help.cpp.


Function Documentation

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

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

Definition at line 666 of file help.cpp.

References jump_to().

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

static std::string @92::hidden_symbol ( bool  hidden = true  )  [static]

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

Definition at line 709 of file help.cpp.

References image::get_image(), and loc.

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

static bool @92::is_valid_id ( const std::string &  id  )  [static]

Return true if the id is valid for user defined topics and sections.

Some IDs are special, such as toplevel and may not be be defined in the config.

Definition at line 602 of file help.cpp.

References hidden_symbol().

Referenced by help::parse_config_internal().

static bool @92::is_visible_id ( const std::string &  id  )  [static]

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

Definition at line 647 of file help.cpp.

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

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

Definition at line 640 of file help.cpp.

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

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

Definition at line 719 of file help.cpp.

References font::line_width().

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


Variable Documentation

const int box_width = 2 [static]

Definition at line 577 of file help.cpp.

const std::string closed_section_img = "help/closed_section.png" [static]

Definition at line 581 of file help.cpp.

const std::string default_show_topic = "introduction_topic" [static]

Definition at line 585 of file help.cpp.

config dummy_cfg [static]

std::vector<std::string> empty_string_vector [static]

Definition at line 572 of file help.cpp.

const config* game_cfg = NULL [static]

Definition at line 560 of file help.cpp.

Definition at line 565 of file help.cpp.

const std::string indentation_img = "help/indentation.png" [static]

Definition at line 583 of file help.cpp.

Definition at line 569 of file help.cpp.

int last_num_encountered_terrains = -1 [static]

Definition at line 568 of file help.cpp.

int last_num_encountered_units = -1 [static]

Definition at line 567 of file help.cpp.

gamemap* map = NULL [static]

const unsigned max_history = 100 [static]

Definition at line 579 of file help.cpp.

const int max_section_level = 15 [static]

Definition at line 573 of file help.cpp.

const int menu_font_size = font::SIZE_NORMAL [static]

const int normal_font_size = font::SIZE_SMALL [static]

Definition at line 578 of file help.cpp.

const std::string open_section_img = "help/open_section.png" [static]

Definition at line 582 of file help.cpp.

const std::string race_prefix = "race_" [static]

Definition at line 588 of file help.cpp.

const int title2_size = font::SIZE_15 [static]

Definition at line 576 of file help.cpp.

const int title_size = font::SIZE_LARGE [static]

Definition at line 575 of file help.cpp.

const std::string topic_img = "help/topic.png" [static]

Definition at line 580 of file help.cpp.

Definition at line 563 of file help.cpp.

const std::string unit_prefix = "unit_" [static]

Definition at line 587 of file help.cpp.

const std::string unknown_unit_topic = ".unknown_unit" [static]

Definition at line 586 of file help.cpp.


Generated by doxygen 1.5.5 on 23 May 2008 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs