15 #define GETTEXT_DOMAIN "wesnoth-lib" 45 const std::vector<std::string>& hidden_categories = viewer_.hidden_label_categories();
47 for(
const std::string& cat : all_categories) {
48 all_labels_[cat] =
true;
51 if(cat.substr(0, 4) ==
"cat:") {
52 labels_display_[cat] = cat.substr(4);
53 }
else if(cat ==
"team") {
54 labels_display_[cat] =
_(
"Team Labels");
58 for(
const std::string& hidden_cat : hidden_categories) {
59 all_labels_[hidden_cat] =
false;
62 for(std::size_t
i = 0;
i < viewer_.teams().size();
i++) {
64 const std::string label_cat_key =
"side:" + std::to_string(
i + 1);
67 labels_display_[label_cat_key] =
"";
73 if(team_name.empty()) {
77 if(team_name.empty()) {
78 team_name =
_(
"Unknown");
82 subst[
"side_number"] = std::to_string(
i + 1);
83 subst[
"name"] = team_name;
84 labels_display_[label_cat_key] =
VGETTEXT(
"Side $side_number ($name)", subst);
90 listbox& cats_listbox = find_widget<listbox>(&
window,
"label_types",
false);
94 const std::string& category = label_entry.first;
95 const bool visible = label_entry.second;
98 if(category.substr(0, 5) ==
"side:") {
104 const int team = std::stoi(category.substr(5)) - 1;
110 list_data[
"cat_name"][
"label"] = name;
118 if(category.substr(0, 5) ==
"side:") {
119 label& cat_name = find_widget<label>(
grid,
"cat_name",
false);
128 std::vector<std::string> hidden_categories;
131 if(lbl.second ==
false) {
132 hidden_categories.push_back(lbl.first);
window(const builder_window::window_resolution &definition)
< Needs to be initialized in show.
#define REGISTER_DIALOG(window_id)
Wrapper for REGISTER_DIALOG2.
static display * get_singleton()
Returns the display object if a display object exists.
std::map< std::string, t_string > string_map
virtual void post_show(window &window) override
Actions to be taken after the window has been shown.
void toggle_category(widget &box, const std::string &category)
Callback for toggling a checkbox state.
const std::vector< std::string > & all_categories() const
const std::string & side_name() const
grid & add_row(const widget_item &item, const int index=-1)
When an item in the list is selected by the user we need to update the state.
A label displays a text, the text can be wrapped but no scrollbars are provided.
display_context & viewer_
static std::string _(const char *str)
status
The status of the window.
std::string span_color(const color_t &color)
Returns a Pango formatting string using the provided color_t object.
This class stores all the data for a single 'side' (in game nomenclature).
This file contains the settings handling of the widget library.
virtual void pre_show(window &window) override
Actions to be taken before showing the window.
The basic class for representing 8-bit RGB or RGBA colour values.
map_display and display: classes which take care of displaying the map and game-data on the screen...
std::map< std::string, bool > all_labels_
The execute function.
virtual const std::vector< team > & teams() const =0
int get_retval() const
Returns the cached window exit code.
Abstract base class for all modal dialogs.
const std::vector< color_t > & tc_info(const std::string &name)
std::map< std::string, t_string > labels_display_
std::map< std::string, widget_item > widget_data
Dialog was closed with the OK button.
virtual const std::vector< std::string > & hidden_label_categories() const =0
base class of top level items, the only item which needs to store the final canvases to draw on...
const t_string & user_team_name() const
void connect_signal_notify_modified(dispatcher &dispatcher, const signal_notification &signal)
Connects a signal handler for getting a notification upon modification.