statistics_dialog: Fix wrong uses of linked_group

Remove extraneous columns, add grids in the bottom two tables where it's
needed for two columns to match the width of one column of the first
table.
This commit is contained in:
josteph 2019-05-18 16:48:02 +00:00
parent ea2be9919e
commit d451238b25
2 changed files with 86 additions and 86 deletions

View file

@ -143,18 +143,6 @@
[/label]
[/column]
[column]
horizontal_grow = true
border = "all"
border_size = 5
[label]
definition = "default_small"
label = "" # percentage
linked_group = "detail"
[/label]
[/column]
[column]
horizontal_grow = true
border = "all"
@ -167,18 +155,6 @@
[/label]
[/column]
[column]
horizontal_grow = true
border = "all"
border_size = 5
[label]
definition = "default_small"
label = "" # percentage
linked_group = "detail"
[/label]
[/column]
[/row]
[/header]
@ -201,7 +177,7 @@
[column]
grow_factor = 1
border = "all"
border_size = 5
border_size = 0
horizontal_grow = true
[label]
@ -211,65 +187,95 @@
[/label]
[/column]
[column]
grow_factor = 1
border = "all"
border_size = 5
horizontal_grow = true
[column]
grow_factor = 1
border = "all"
border_size = 0
horizontal_grow = true
[grid]
linked_group = "detail"
[row]
[label]
id = {colid_overall}
definition = "default_small"
linked_group = "detail"
tooltip = {ratio_tooltip}
[/label]
[/column]
[column]
grow_factor = 1
border = "all"
border_size = 5
horizontal_grow = true
[column]
grow_factor = 0
border = "all"
border_size = 5
horizontal_grow = false
[label]
id = {colid_overall}
definition = "default_small"
tooltip = {ratio_tooltip}
[/label]
[/column]
[label]
id = "overall_percent"
definition = "default_small"
linked_group = "detail"
text_alignment = "right"
use_markup = true
tooltip = {percent_tooltip}
[/label]
[/column]
[column]
grow_factor = 0
border = "all"
border_size = 5
horizontal_grow = false
[column]
grow_factor = 1
border = "all"
border_size = 5
horizontal_grow = true
[label]
id = "overall_percent"
definition = "default_small"
text_alignment = "right"
use_markup = true
tooltip = {percent_tooltip}
[/label]
[/column]
[label]
id = {colid_this_turn}
definition = "default_small"
linked_group = "cost"
tooltip = {ratio_tooltip}
[/label]
[/column]
[column]
[column]
grow_factor = 0
border = "all"
border_size = 5
horizontal_grow = false
# Spacer to make up for showing only one percentage, not two as in the next table
[spacer]
width=10 # TODO: Wild guess. Feel free to adjust
[/spacer]
[/column]
[label]
id = "this_turn_percent"
definition = "default_small"
linked_group = "detail"
text_alignment = "right"
use_markup = true
tooltip = {percent_tooltip}
[/label]
[/column]
[/row]
[/grid]
[/column]
[column]
grow_factor = 1
border = "all"
border_size = 0
horizontal_grow = true
[grid]
linked_group = "cost"
[row]
[column]
grow_factor = 1
border = "all"
border_size = 5
horizontal_grow = true
[label]
id = {colid_this_turn}
definition = "default_small"
tooltip = {ratio_tooltip}
[/label]
[/column]
[column]
grow_factor = 0
border = "all"
border_size = 5
horizontal_grow = false
[label]
id = "this_turn_percent"
definition = "default_small"
text_alignment = "right"
use_markup = true
tooltip = {percent_tooltip}
[/label]
[/column]
[/row]
[/grid]
[/column]
[/row]

View file

@ -129,9 +129,6 @@ void statistics_dialog::add_stat_row(window& window, const std::string& type, co
main_stat_table_.push_back(&value);
}
// TODO: This is used to adjust the horizontal spacing around the percentages column, but it's ugly. Find a better way.
static const auto& spacer = " ";
void statistics_dialog::add_damage_row(
window& window,
const std::string& type,
@ -162,8 +159,7 @@ void statistics_dialog::add_damage_row(
str.str("");
str << (((dsa < 0) ^ (expected < 0)) ? "" : "+")
<< (expected == 0 ? 0 : 100 * dsa / expected) << '%'
<< spacer;
<< (expected == 0 ? 0 : 100 * dsa / expected) << '%';
item["label"] = str.str();
data.emplace("overall_percent", item);
@ -176,8 +172,7 @@ void statistics_dialog::add_damage_row(
str.str("");
str << (((dst < 0) ^ (turn_expected < 0)) ? "" : "+")
<< (turn_expected == 0 ? 0 : 100 * dst / turn_expected) << '%'
<< spacer;
<< (turn_expected == 0 ? 0 : 100 * dst / turn_expected) << '%';
item["label"] = str.str();
data.emplace("this_turn_percent", item);
}
@ -270,8 +265,7 @@ static hitrate_table_element tally(const statistics::stats::hitrate_map& by_cth)
}
// TODO: document for users what this value is.
str2 << font::span_color(game_config::red_to_green(probability * 100.0, true))
<< get_probability_string(probability) << "</span>"
<< spacer;
<< get_probability_string(probability) << "</span>";
}
return hitrate_table_element{str.str(), str2.str()};