16 #define GETTEXT_DOMAIN "wesnoth-lib"
35 #define ERR_HP LOG_STREAM(err, log_help)
36 #define WRN_HP LOG_STREAM(warn, log_help)
37 #define DBG_HP LOG_STREAM(debug, log_help)
58 if(initial_topic_.compare(0, 2,
"..") == 0) {
59 initial_topic_.replace(0, 2,
"+");
61 initial_topic_.insert(0,
"-");
68 tree_view& topic_tree = find_widget<tree_view>(
"topic_tree");
70 button& back_button = find_widget<button>(
"back");
71 button& next_button = find_widget<button>(
"next");
73 rich_label& topic_text = find_widget<rich_label>(
"topic_text");
80 toggle_button& contents = find_widget<toggle_button>(
"contents");
87 if ((
parent !=
nullptr) && (win_w == 0)) {
97 topic_text.
set_width(win_w - (is_contents_visible ? 0 : tree_w) - 20 );
123 tree_view& topic_tree = find_widget<tree_view>(
"topic_tree");
133 bool topics_added =
false;
140 if (subtopics_added || (match(section.
id) || match(section.
title))) {
141 if (!filter_text.empty()) {
146 find_widget<tree_view>(
"topic_tree").remove_node(§ion_node);
151 if ((match(topic.
id) || match(topic.
title)) && (topic.
id.compare(0, 2,
"..") != 0)) {
166 item[
"label"] = topic_title;
167 data.emplace(
"topic_name", item);
170 new_node.
set_id(std::string(expands ?
"+" :
"-") + topic_id);
183 if(topic_id[0] ==
'+') {
184 topic_id.replace(topic_id.begin(), topic_id.begin() + 1, 2,
'.');
187 if(topic_id[0] ==
'-') {
188 topic_id.erase(topic_id.begin(), topic_id.begin() + 1);
195 ERR_HP <<
"Help browser tried to show topic with id '" << topic_id
196 <<
"' but that topic could not be found." << std::endl;
200 DBG_HP <<
"Showing topic: " << topic->
id <<
": " << topic->
title;
202 std::string topic_id_temp = topic->
id;
203 if(topic_id_temp.compare(0, 2,
"..") == 0) {
204 topic_id_temp.replace(0, 2,
"+");
206 topic_id_temp.insert(0,
"-");
208 tree_view& topic_tree = find_widget<tree_view>(
"topic_tree");
212 find_widget<label>(
"topic_title").set_label(topic->
title);
213 find_widget<rich_label>(
"topic_text").set_dom(topic->
text.
parsed_text());
218 if (add_to_history) {
230 find_widget<button>(
"back").set_active(
history_pos_ != 0);
236 tree_view& topic_tree = find_widget<tree_view>(
"topic_tree");
238 if(topic_tree.
empty()) {
const help::section & toplevel_
std::string initial_topic_
void update_list(const std::string &)
bool add_topics_for_section(const help::section &parent_section, tree_view_node &parent_node, const std::string &filter_text="")
void show_topic(std::string topic_id, bool add_to_history=true)
std::map< std::string, int > parsed_pages_
virtual void pre_show() override
Actions to be taken before showing the window.
void on_history_navigate(bool backwards)
tree_view_node & add_topic(const std::string &topic_id, const std::string &topic_title, bool expands, tree_view_node &parent)
std::string current_topic_
std::vector< std::string > history_
Abstract base class for all modal dialogs.
A rich_label takes marked up text and shows it correctly formatted and wrapped but no scrollbars are ...
void set_width(const int width)
void register_link_callback(std::function< void(std::string)> link_handler)
A widget that allows the user to input text in single line.
void select_node(bool expand_parents=false)
void unfold(const bool recursive=false)
const tree_view_node & get_root_node() const
tree_view_node * selected_item()
void keyboard_capture(widget *widget)
void invalidate_layout()
Updates the size of the window.
void add_to_keyboard_chain(widget *widget)
Adds the widget to the keyboard chain.
const config & parsed_text() const
static lg::log_domain log_help("help")
REGISTER_DIALOG(editor_edit_unit)
void connect_signal_notify_modified(dispatcher &dispatcher, const signal_notification &signal)
Connects a signal handler for getting a notification upon modification.
void connect_signal_mouse_left_click(dispatcher &dispatcher, const signal &signal)
Connects a signal handler for a left mouse button click.
std::map< std::string, widget_item > widget_data
std::map< std::string, t_string > widget_item
const topic * find_topic(const section &sec, const std::string &id)
Search for the topic with the specified identifier in the section and its subsections.
const std::string default_show_topic
auto make_ci_matcher(std::string_view filter_text)
Returns a function which performs locale-aware case-insensitive search.
A section contains topics and sections along with title and ID.
A topic contains a title, an id and some text.