15 #define GETTEXT_DOMAIN "wesnoth-lib"
42 const std::vector<std::string>& hidden_categories = viewer_.hidden_label_categories();
44 for(
const std::string& cat : all_categories) {
45 all_labels_[cat] =
true;
48 if(cat.substr(0, 4) ==
"cat:") {
49 labels_display_[cat] = cat.substr(4);
50 }
else if(cat ==
"team") {
51 labels_display_[cat] =
_(
"Team Labels");
55 for(
const std::string& hidden_cat : hidden_categories) {
56 all_labels_[hidden_cat] =
false;
59 for(
const team&
team : viewer_.teams()) {
60 const std::string label_cat_key =
"side:" + std::to_string(
team.
side());
63 labels_display_[label_cat_key] =
"";
68 if(team_name.empty()) {
72 if(team_name.empty()) {
73 team_name =
_(
"Unknown");
77 subst[
"side_number"] = std::to_string(
team.
side());
78 subst[
"name"] = team_name;
79 labels_display_[label_cat_key] =
VGETTEXT(
"Side $side_number ($name)", subst);
85 listbox& cats_listbox = find_widget<listbox>(
"label_types");
89 const std::string& category = label_entry.first;
90 const bool visible = label_entry.second;
93 if(category.substr(0, 5) ==
"side:") {
105 list_data[
"cat_name"][
"label"] = name;
113 if(category.substr(0, 5) ==
"side:") {
123 std::vector<std::string> hidden_categories;
126 if(lbl.second ==
false) {
127 hidden_categories.push_back(lbl.first);
Abstract class for exposing game data that doesn't depend on the GUI, however which for historical re...
virtual const std::vector< std::string > & hidden_label_categories() const =0
virtual const std::vector< team > & teams() const =0
static display * get_singleton()
Returns the display object if a display object exists.
std::map< std::string, t_string > labels_display_
display_context & viewer_
void toggle_category(widget &box, const std::string &category)
Callback for toggling a checkbox state.
virtual void pre_show() override
Actions to be taken before showing the window.
std::map< std::string, bool > all_labels_
The execute function.
virtual void post_show() override
Actions to be taken after the window has been shown.
Abstract base class for all modal dialogs.
int get_retval() const
Returns the cached window exit code.
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.
status
The status of the window.
const std::vector< std::string > & all_categories() const
This class stores all the data for a single 'side' (in game nomenclature).
const std::string & side_name() const
const t_string & user_team_name() const
map_display and display: classes which take care of displaying the map and game-data on the screen.
static std::string _(const char *str)
const std::vector< color_t > & tc_info(std::string_view name)
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.
std::map< std::string, widget_item > widget_data
@ OK
Dialog was closed with the OK button.
std::string span_color(const color_t &color, Args &&... data)
int stoi(std::string_view str)
Same interface as std::stoi and meant as a drop in replacement, except:
std::map< std::string, t_string > string_map
The basic class for representing 8-bit RGB or RGBA colour values.