statistics_dialog: Hide the "This Turn" header when no data is shown in that column
This commit is contained in:
parent
aa901478c2
commit
a4da90f921
2 changed files with 18 additions and 4 deletions
|
@ -108,7 +108,7 @@
|
|||
[/listbox]
|
||||
#enddef
|
||||
|
||||
#define _GUI_DAMAGE_STATS_LIST TOP_LEFT_LABEL OVERALL_ID COLID_TYPE COLID_OVERALL COLID_THIS_TURN RATIO_TOOLTIP PERCENT_TOOLTIP
|
||||
#define _GUI_DAMAGE_STATS_LIST TOP_LEFT_LABEL THIS_TURN_HEADER_ID OVERALL_ID COLID_TYPE COLID_OVERALL COLID_THIS_TURN RATIO_TOOLTIP PERCENT_TOOLTIP
|
||||
[listbox]
|
||||
id = {OVERALL_ID}
|
||||
definition = "default"
|
||||
|
@ -149,8 +149,8 @@
|
|||
border_size = 5
|
||||
|
||||
[label]
|
||||
id = {THIS_TURN_HEADER_ID}
|
||||
definition = "default_small"
|
||||
label = _ "This Turn"
|
||||
linked_group = "cost"
|
||||
[/label]
|
||||
[/column]
|
||||
|
@ -546,7 +546,7 @@
|
|||
vertical_grow = true
|
||||
|
||||
{_GUI_DAMAGE_STATS_LIST
|
||||
(_ "Damage") stats_list_damage damage_type damage_overall damage_this_turn
|
||||
(_ "Damage") damage_this_turn_header stats_list_damage damage_type damage_overall damage_this_turn
|
||||
(_"stats dialog^Amount of hitpoints (actual / expected)")
|
||||
(_"stats dialog^Ratio of actual to expected")}
|
||||
[/column]
|
||||
|
@ -563,7 +563,7 @@
|
|||
vertical_grow = true
|
||||
|
||||
{_GUI_DAMAGE_STATS_LIST
|
||||
(_ "Hits") stats_list_hits hits_type hits_overall hits_this_turn
|
||||
(_ "Hits") hits_this_turn_header stats_list_hits hits_type hits_overall hits_this_turn
|
||||
(_"stats dialog^Number of hits (actual / expected)")
|
||||
(_"stats dialog^<i>A priori</i> probabilities of hitting less than and more than the actual number of hits")}
|
||||
[/column]
|
||||
|
|
|
@ -170,11 +170,18 @@ void statistics_dialog::add_damage_row(
|
|||
data.emplace("overall_percent", item);
|
||||
|
||||
if(show_this_turn) {
|
||||
label& this_turn_header = find_widget<label>(&window, "damage_this_turn_header", false);
|
||||
this_turn_header.set_label(_("This Turn"));
|
||||
|
||||
item["label"] = damage_str(turn_damage, turn_expected);
|
||||
data.emplace("damage_this_turn", item);
|
||||
|
||||
item["label"] = percent_str(dst, turn_expected);
|
||||
data.emplace("this_turn_percent", item);
|
||||
} else {
|
||||
// TODO: Setting the label to "" causes "This Turn" not to be drawn when changing back to the current scenraio view, so set the label to " " (a single space) instead.
|
||||
label& this_turn_header = find_widget<label>(&window, "damage_this_turn_header", false);
|
||||
this_turn_header.set_label(" ");
|
||||
}
|
||||
|
||||
damage_list.add_row(data);
|
||||
|
@ -305,11 +312,18 @@ void statistics_dialog::add_hits_row(
|
|||
data.emplace("overall_percent", item);
|
||||
|
||||
if(show_this_turn) {
|
||||
label& this_turn_header = find_widget<label>(&window, "hits_this_turn_header", false);
|
||||
this_turn_header.set_label(_("This Turn"));
|
||||
|
||||
element = tally(turn_by_cth, more_is_better);
|
||||
item["label"] = element.hitrate_str;
|
||||
data.emplace("hits_this_turn", item);
|
||||
item["label"] = element.percentage_str;
|
||||
data.emplace("this_turn_percent", item);
|
||||
} else {
|
||||
// TODO: Setting the label to "" causes "This Turn" not to be drawn when changing back to the current scenraio view, so set the label to " " (a single space) instead.
|
||||
label& this_turn_header = find_widget<label>(&window, "hits_this_turn_header", false);
|
||||
this_turn_header.set_label(" ");
|
||||
}
|
||||
|
||||
hits_list.add_row(data);
|
||||
|
|
Loading…
Add table
Reference in a new issue