14 #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);
91 std::map<std::string, string_map> list_data;
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);
#define REGISTER_DIALOG(window_id)
Wrapper for REGISTER_DIALOG2.
static display * get_singleton()
Returns the display object if a display object exists.
virtual void post_show(window &window) override
Inherited from modal_dialog.
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
A label displays a text, the text can be wrapped but no scrollbars are provided.
display_context & viewer_
static std::string _(const char *str)
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).
void connect_signal_notify_modified(dispatcher &dispatcher, const signal_notification_function &signal)
Connects a signal handler for getting a notification upon modification.
This file contains the settings handling of the widget library.
virtual void pre_show(window &window) override
Inherited from modal_dialog.
map_display and display: classes which take care of displaying the map and game-data on the screen...
Various uncategorised dialogs.
std::map< std::string, bool > all_labels_
The execute function.
virtual const std::vector< team > & teams() const =0
grid & add_row(const string_map &item, const int index=-1)
When an item in the list is selected by the user we need to update the state.
int get_retval() const
Returns the cached window exit code.
const std::vector< color_t > & tc_info(const std::string &name)
std::map< std::string, t_string > labels_display_
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