widelands-dev team mailing list archive
-
widelands-dev team
-
Mailing list archive
-
Message #06990
[Merge] lp:~widelands-dev/widelands/string-fixes into lp:widelands
GunChleoc has proposed merging lp:~widelands-dev/widelands/string-fixes into lp:widelands.
Commit message:
Various string fixes:
- Fixed overlap with slider labels in statistics windows
- Improved/fixed TRANSLATORS comments
- Tweaked ship transport strings.
- Fixed missing localization markers for some strings, including AI names.
Requested reviews:
Widelands Developers (widelands-dev)
Related bugs:
Bug #1421942 in widelands: "Unified term for "Black" and "Wasteland""
https://bugs.launchpad.net/widelands/+bug/1421942
Bug #1487887 in widelands: "Translation missing in editor and in replay tooltip"
https://bugs.launchpad.net/widelands/+bug/1487887
Bug #1530240 in widelands: "wrong text in the tribal encyclopedia for the battle ax"
https://bugs.launchpad.net/widelands/+bug/1530240
Bug #1530398 in widelands: "Wrong text above marble mine"
https://bugs.launchpad.net/widelands/+bug/1530398
Bug #1547909 in widelands: "Some strings in the editor cannot be translated"
https://bugs.launchpad.net/widelands/+bug/1547909
For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/string-fixes/+merge/290399
Various string fixes.
--
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/string-fixes into lp:widelands.
=== modified file 'data/tribes/scripting/starting_conditions/atlanteans/fortified_village.lua'
--- data/tribes/scripting/starting_conditions/atlanteans/fortified_village.lua 2016-03-02 16:28:30 +0000
+++ data/tribes/scripting/starting_conditions/atlanteans/fortified_village.lua 2016-03-30 07:31:26 +0000
@@ -7,7 +7,9 @@
set_textdomain("tribes")
return {
+ -- TRANSLATORS: This is the name of a starting condition
descname = _ "Fortified Village",
+ -- TRANSLATORS: This is the tooltip for the "Fortified Village" starting condition
tooltip = _" Start the game with a fortified military installation",
func = function(plr, shared_in_start)
=== modified file 'data/tribes/scripting/starting_conditions/atlanteans/headquarters.lua'
--- data/tribes/scripting/starting_conditions/atlanteans/headquarters.lua 2016-03-02 16:28:30 +0000
+++ data/tribes/scripting/starting_conditions/atlanteans/headquarters.lua 2016-03-30 07:31:26 +0000
@@ -7,7 +7,9 @@
set_textdomain("tribes")
init = {
+ -- TRANSLATORS: This is the name of a starting condition
descname = _ "Headquarters",
+ -- TRANSLATORS: This is the tooltip for the "Headquarters" starting condition
tooltip = _"Start the game with your headquarters only",
func = function(plr, shared_in_start)
=== modified file 'data/tribes/scripting/starting_conditions/atlanteans/trading_outpost.lua'
--- data/tribes/scripting/starting_conditions/atlanteans/trading_outpost.lua 2016-03-08 07:40:58 +0000
+++ data/tribes/scripting/starting_conditions/atlanteans/trading_outpost.lua 2016-03-30 07:31:26 +0000
@@ -7,7 +7,9 @@
set_textdomain("tribes")
return {
+ -- TRANSLATORS: This is the name of a starting condition
descname = _"Trading Outpost",
+ -- TRANSLATORS: This is the tooltip for the "Trading Outpost" starting condition
tooltip = _"If this player runs low on important wares, they will be replenished for free",
func = function(player, shared_in_start)
=== modified file 'data/tribes/scripting/starting_conditions/barbarians/fortified_village.lua'
--- data/tribes/scripting/starting_conditions/barbarians/fortified_village.lua 2016-03-02 16:28:30 +0000
+++ data/tribes/scripting/starting_conditions/barbarians/fortified_village.lua 2016-03-30 07:31:26 +0000
@@ -7,7 +7,9 @@
set_textdomain("tribes")
return {
+ -- TRANSLATORS: This is the name of a starting condition
descname = _ "Fortified Village",
+ -- TRANSLATORS: This is the tooltip for the "Fortified Village" starting condition
tooltip = _" Start the game with a fortified military installation",
func = function(plr, shared_in_start)
=== modified file 'data/tribes/scripting/starting_conditions/barbarians/headquarters.lua'
--- data/tribes/scripting/starting_conditions/barbarians/headquarters.lua 2016-03-11 07:02:57 +0000
+++ data/tribes/scripting/starting_conditions/barbarians/headquarters.lua 2016-03-30 07:31:26 +0000
@@ -7,7 +7,9 @@
set_textdomain("tribes")
init = {
+ -- TRANSLATORS: This is the name of a starting condition
descname = _ "Headquarters",
+ -- TRANSLATORS: This is the tooltip for the "Headquarters" starting condition
tooltip = _"Start the game with your headquarters only",
func = function(player, shared_in_start)
=== modified file 'data/tribes/scripting/starting_conditions/barbarians/trading_outpost.lua'
--- data/tribes/scripting/starting_conditions/barbarians/trading_outpost.lua 2016-03-08 07:40:58 +0000
+++ data/tribes/scripting/starting_conditions/barbarians/trading_outpost.lua 2016-03-30 07:31:26 +0000
@@ -7,7 +7,9 @@
set_textdomain("tribes")
return {
+ -- TRANSLATORS: This is the name of a starting condition
descname = _"Trading Outpost",
+ -- TRANSLATORS: This is the tooltip for the "Trading Outpost" starting condition
tooltip = _"If this player runs low on important wares, they will be replenished for free",
func = function(player, shared_in_start)
=== modified file 'data/tribes/scripting/starting_conditions/empire/fortified_village.lua'
--- data/tribes/scripting/starting_conditions/empire/fortified_village.lua 2016-03-02 16:28:30 +0000
+++ data/tribes/scripting/starting_conditions/empire/fortified_village.lua 2016-03-30 07:31:26 +0000
@@ -7,7 +7,9 @@
set_textdomain("tribes")
return {
+ -- TRANSLATORS: This is the name of a starting condition
descname = _ "Fortified Village",
+ -- TRANSLATORS: This is the tooltip for the "Fortified Village" starting condition
tooltip = _" Start the game with a fortified military installation",
func = function(plr, shared_in_start)
=== modified file 'data/tribes/scripting/starting_conditions/empire/headquarters.lua'
--- data/tribes/scripting/starting_conditions/empire/headquarters.lua 2016-03-02 16:28:30 +0000
+++ data/tribes/scripting/starting_conditions/empire/headquarters.lua 2016-03-30 07:31:26 +0000
@@ -7,7 +7,9 @@
set_textdomain("tribes")
return {
+ -- TRANSLATORS: This is the name of a starting condition
descname = _ "Headquarters",
+ -- TRANSLATORS: This is the tooltip for the "Headquarters" starting condition
tooltip = _"Start the game with your headquarters only",
func = function(p, shared_in_start)
=== modified file 'data/tribes/scripting/starting_conditions/empire/trading_outpost.lua'
--- data/tribes/scripting/starting_conditions/empire/trading_outpost.lua 2016-03-08 07:40:58 +0000
+++ data/tribes/scripting/starting_conditions/empire/trading_outpost.lua 2016-03-30 07:31:26 +0000
@@ -7,7 +7,9 @@
set_textdomain("tribes")
return {
+ -- TRANSLATORS: This is the name of a starting condition
descname = _"Trading Outpost",
+ -- TRANSLATORS: This is the tooltip for the "Trading Outpost" starting condition
tooltip = _"If this player runs low on important wares, they will be replenished for free",
func = function(player, shared_in_start)
=== modified file 'src/editor/ui_menus/editor_tool_set_terrain_options_menu.cc'
--- src/editor/ui_menus/editor_tool_set_terrain_options_menu.cc 2016-01-28 05:24:34 +0000
+++ src/editor/ui_menus/editor_tool_set_terrain_options_menu.cc 2016-03-30 07:31:26 +0000
@@ -78,7 +78,7 @@
offscreen_images->emplace_back(texture);
/** TRANSLATORS: %1% = terrain name, %2% = list of terrain types */
- const std::string tooltip = ((boost::format("%1%: %2%"))
+ const std::string tooltip = ((boost::format(_("%1%: %2%")))
% terrain_descr.descname()
% i18n::localize_list(tooltips, i18n::ConcatenateWith::AND)).str();
=== modified file 'src/logic/map_objects/tribes/militarysite.cc'
--- src/logic/map_objects/tribes/militarysite.cc 2016-03-10 15:00:32 +0000
+++ src/logic/map_objects/tribes/militarysite.cc 2016-03-30 07:31:26 +0000
@@ -124,9 +124,7 @@
if (capacity_ > stationed) {
/** TRANSLATORS: %1% is the number of soldiers the plural refers to */
/** TRANSLATORS: %2% is the maximum number of soldier slots in the building */
- *s = (boost::format(ngettext("%1% soldier (+%2%)",
- "%1% soldiers (+%2%)",
- stationed))
+ *s = (boost::format(ngettext("%1% soldier (+%2%)", "%1% soldiers (+%2%)", stationed))
% stationed % (capacity_ - stationed)).str();
} else {
*s = (boost::format(ngettext("%u soldier", "%u soldiers", stationed))
@@ -137,8 +135,7 @@
/** TRANSLATORS: %1% is the number of soldiers the plural refers to */
/** TRANSLATORS: %2% are currently open soldier slots in the building */
/** TRANSLATORS: %3% is the maximum number of soldier slots in the building */
- *s =
- (boost::format(ngettext("%1%(+%2%) soldier (+%3%)", "%1%(+%2%) soldiers (+%3%)", stationed))
+ *s = (boost::format(ngettext("%1%(+%2%) soldier (+%3%)", "%1%(+%2%) soldiers (+%3%)", stationed))
% present % (stationed - present) % (capacity_ - stationed)).str();
} else {
/** TRANSLATORS: %1% is the number of soldiers the plural refers to */
=== modified file 'src/logic/map_objects/tribes/production_program.cc'
--- src/logic/map_objects/tribes/production_program.cc 2016-03-12 07:07:12 +0000
+++ src/logic/map_objects/tribes/production_program.cc 2016-03-30 07:31:26 +0000
@@ -1049,7 +1049,6 @@
for (const auto& item_pair : produced_wares_) {
count += item_pair.second;
std::string ware_descname = tribe.get_ware_descr(item_pair.first)->descname();
- // TODO(GunChleoc): would be nice with pngettext whenever it gets added to xgettext for Lua.
if (1 < item_pair.second || 1 < produced_wares_.size()) {
/** TRANSLATORS: This is an item in a list of wares, e.g. "Produced 2x Coal": */
/** TRANSLATORS: %%1$i = "2" */
@@ -1145,7 +1144,6 @@
for (const auto& item_pair : recruited_workers_) {
count += item_pair.second;
std::string worker_descname = tribe.get_worker_descr(item_pair.first)->descname();
- // TODO(GunChleoc): would be nice with pngettext whenever it gets added to xgettext for Lua.
if (1 < item_pair.second || 1 < recruited_workers_.size()) {
/** TRANSLATORS: This is an item in a list of workers, e.g. "Recruited 2x Ox": */
/** TRANSLATORS: %1$i = "2" */
=== modified file 'src/logic/map_objects/tribes/ship.cc'
--- src/logic/map_objects/tribes/ship.cc 2016-03-21 10:36:49 +0000
+++ src/logic/map_objects/tribes/ship.cc 2016-03-30 07:31:26 +0000
@@ -957,20 +957,20 @@
statistics_string = pgettext("ship_state", "Shipping");
break;
case (ShipStates::kExpeditionWaiting):
- /** TRANSLATORS: This is a ship state */
+ /** TRANSLATORS: This is a ship state. An expedition is waiting for your commands. */
statistics_string = pgettext("ship_state", "Waiting");
break;
case (ShipStates::kExpeditionScouting):
- /** TRANSLATORS: This is a ship state */
+ /** TRANSLATORS: This is a ship state. An expedition is scouting for port spaces. */
statistics_string = pgettext("ship_state", "Scouting");
break;
case (ShipStates::kExpeditionPortspaceFound):
- /** TRANSLATORS: This is a ship state */
+ /** TRANSLATORS: This is a ship state. An expedition has found a port space. */
statistics_string = pgettext("ship_state", "Port Space Found");
break;
case (ShipStates::kExpeditionColonizing):
- /** TRANSLATORS: This is a ship state */
- statistics_string = pgettext("ship_state", "Expedition Landing");
+ /** TRANSLATORS: This is a ship state. An expedition is unloading wares/workers to build a port. */
+ statistics_string = pgettext("ship_state", "Founding a Colony");
break;
case (ShipStates::kSinkRequest):
case (ShipStates::kSinkAnimation):
=== modified file 'src/network/nethost.cc'
--- src/network/nethost.cc 2016-03-19 18:13:58 +0000
+++ src/network/nethost.cc 2016-03-30 07:31:26 +0000
@@ -355,23 +355,23 @@
if (cmd == "help") {
c.msg = (boost::format("<br>%s<br>%s<br>%s<br>%s<br>%s<br>%s<br>%s") %
_("Available host commands are:")
- /** TRANSLATORS: Available host command */
%
+ /** TRANSLATORS: Available host command */
_("/help - Shows this help")
- /** TRANSLATORS: Available host command */
%
+ /** TRANSLATORS: Available host command */
_("/announce <msg> - Send a chatmessage as announcement (system chat)")
- /** TRANSLATORS: Available host command */
%
+ /** TRANSLATORS: Available host command */
_("/warn <name> <reason> - Warn the user <name> because of <reason>")
- /** TRANSLATORS: Available host command */
%
+ /** TRANSLATORS: Available host command */
_("/kick <name> <reason> - Kick the user <name> because of <reason>")
- /** TRANSLATORS: Available host command */
%
+ /** TRANSLATORS: Available host command */
_("/forcePause - Force the game to pause.")
- /** TRANSLATORS: Available host command */
%
+ /** TRANSLATORS: Available host command */
_("/endForcedPause - Return game to normal speed.")).str();
}
=== modified file 'src/ui_basic/slider.cc'
--- src/ui_basic/slider.cc 2016-03-08 07:54:22 +0000
+++ src/ui_basic/slider.cc 2016-03-30 07:31:26 +0000
@@ -551,7 +551,8 @@
// here, we take into account the h_gap introduced by HorizontalSlider
w / (2 * labels_in.size()) - cursor_size / 2, 0,
w - (w / labels_in.size()) + cursor_size,
- h - UI::g_fh1->render(as_uifont(UI::g_fh1->fontset()->representative_character()))->height() - 2,
+ h - UI::g_fh1->render(as_condensed(UI::g_fh1->fontset()->representative_character(),
+ UI::Align::kLeft, UI_FONT_SIZE_SMALL - 2))->height() - 2,
0, labels_in.size() - 1, value_,
background_picture_id,
tooltip_text,
@@ -577,7 +578,7 @@
for (uint32_t i = 0; i < labels.size(); i++) {
dst.blit(Point(gap_1 + i * gap_n, get_h()),
- UI::g_fh1->render(as_uifont(labels[i])),
+ UI::g_fh1->render(as_condensed(labels[i], UI::Align::kBottomCenter, UI_FONT_SIZE_SMALL - 2)),
BlendMode::UseAlpha,
UI::Align::kBottomCenter);
}
@@ -597,7 +598,8 @@
slider.set_pos(Point(w / (2 * labels.size()) - slider.cursor_size_ / 2, 0));
slider.set_size
(w - (w / labels.size()) + slider.cursor_size_,
- h - UI::g_fh1->render(as_uifont(UI::g_fh1->fontset()->representative_character()))->height() + 2);
+ h - UI::g_fh1->render(as_condensed(UI::g_fh1->fontset()->representative_character(),
+ UI::Align::kLeft, UI_FONT_SIZE_SMALL - 2))->height() + 2);
Panel::layout();
}
=== modified file 'src/ui_fsmenu/campaign_select.cc'
--- src/ui_fsmenu/campaign_select.cc 2016-02-18 18:27:52 +0000
+++ src/ui_fsmenu/campaign_select.cc 2016-03-30 07:31:26 +0000
@@ -346,7 +346,6 @@
table_.double_clicked.connect
(boost::bind(&FullscreenMenuCampaignMapSelect::clicked_ok, boost::ref(*this)));
- /** TRANSLATORS: Campaign scenario number table header */
std::string number_tooltip;
std::string name_tooltip;
if (is_tutorial_) {
@@ -356,6 +355,8 @@
number_tooltip = _("The number of this scenario in the campaign");
name_tooltip = _("Scenario Name");
}
+
+ /** TRANSLATORS: Campaign scenario number table header */
table_.add_column(35, _("#"), number_tooltip, UI::Align::kLeft);
table_.add_column(table_.get_w() - 35, name_tooltip, name_tooltip, UI::Align::kLeft);
table_.set_sort_column(0);
=== modified file 'src/wui/buildingwindow.cc'
--- src/wui/buildingwindow.cc 2016-03-18 08:22:55 +0000
+++ src/wui/buildingwindow.cc 2016-03-30 07:31:26 +0000
@@ -206,8 +206,11 @@
g_gr->images().get((is_stopped ?
"images/ui_basic/continue.png" :
"images/ui_basic/stop.png")),
- /** TRANSLATORS: Stop/Continue toggle button for production sites. */
- is_stopped ? _("Continue") : _("Stop"));
+ is_stopped ?
+ /** TRANSLATORS: Stop/Continue toggle button for production sites. */
+ _("Continue") :
+ /** TRANSLATORS: Stop/Continue toggle button for production sites. */
+ _("Stop"));
stopbtn->sigclicked.connect(boost::bind(&BuildingWindow::act_start_stop, boost::ref(*this)));
capsbuttons->add
(stopbtn,
=== modified file 'src/wui/multiplayersetupgroup.cc'
--- src/wui/multiplayersetupgroup.cc 2016-03-29 06:41:46 +0000
+++ src/wui/multiplayersetupgroup.cc 2016-03-30 07:31:26 +0000
@@ -321,7 +321,7 @@
} else {
const ComputerPlayer::Implementation* impl =
ComputerPlayer::get_implementation(player_setting.ai);
- title = impl->descname;
+ title = _(impl->descname);
pic = impl->icon_filename;
}
}
=== modified file 'src/wui/playerdescrgroup.cc'
--- src/wui/playerdescrgroup.cc 2016-03-02 16:28:30 +0000
+++ src/wui/playerdescrgroup.cc 2016-03-30 07:31:26 +0000
@@ -171,7 +171,7 @@
} else {
const ComputerPlayer::Implementation* impl =
ComputerPlayer::get_implementation(player.ai);
- title = impl->descname;
+ title = _(impl->descname);
}
}
} else { // PlayerSettings::stateHuman
=== modified file 'src/wui/plot_area.cc'
--- src/wui/plot_area.cc 2016-03-19 17:30:37 +0000
+++ src/wui/plot_area.cc 2016-03-30 07:31:26 +0000
@@ -24,7 +24,6 @@
#include <string>
#include <boost/format.hpp>
-#include <boost/lexical_cast.hpp>
#include "base/i18n.h"
#include "base/wexception.h"
@@ -66,10 +65,13 @@
constexpr float kPlotLinesWidth = 3.f;
const RGBColor kZeroLineColor(255, 255, 255);
-enum UNIT {
- UNIT_MIN,
- UNIT_HOUR,
- UNIT_DAY,
+enum class Units {
+ kMinutesNarrow,
+ kHourNarrow,
+ kDayNarrow,
+ kMinutesGeneric,
+ kHourGeneric,
+ kDayGeneric
};
string ytick_text_style(const string& text, const RGBColor& clr) {
@@ -94,34 +96,70 @@
return yline_length / (static_cast<float>(highest_scale) / static_cast<float>(value));
}
-UNIT get_suggested_unit(uint32_t game_time) {
+Units get_suggested_unit(uint32_t game_time, bool is_generic = false) {
// Find a nice unit for max_x
- if (game_time > 4 * days) {
- return UNIT_DAY;
- } else if (game_time > 4 * hours) {
- return UNIT_HOUR;
- } else {
- return UNIT_MIN;
- }
-}
-
-std::string get_unit_name(UNIT unit) {
- switch (unit) {
- /** TRANSLATOR: day(s). Used in statistics. */
- case UNIT_DAY: return _("%1% d");
- /** TRANSLATOR: hour(s). Used in statistics. */
- case UNIT_HOUR: return _("%1% h");
- /** TRANSLATOR: minute(s). Used in statistics. */
- case UNIT_MIN: return _("%1% min");
- }
- NEVER_HERE();
-}
-
-uint32_t ms_to_unit(UNIT unit, uint32_t ms) {
- switch (unit) {
- case UNIT_DAY: return ms / days;
- case UNIT_HOUR: return ms / hours;
- case UNIT_MIN: return ms / minutes;
+ if (is_generic) {
+ if (game_time > 4 * days) {
+ return Units::kDayGeneric;
+ } else if (game_time > 4 * hours) {
+ return Units::kHourGeneric;
+ } else {
+ return Units::kMinutesGeneric;
+ }
+ }
+ else {
+ if (game_time > 4 * days) {
+ return Units::kDayNarrow;
+ } else if (game_time > 4 * hours) {
+ return Units::kHourNarrow;
+ } else {
+ return Units::kMinutesNarrow;
+ }
+ }
+}
+
+std::string get_value_with_unit(Units unit, int value) {
+ switch (unit) {
+ case Units::kDayNarrow:
+ /** TRANSLATORS: day(s). Keep this as short as possible. Used in statistics. */
+ return (boost::format(npgettext("unit_narrow", "%1%d", "%1%d", value)) % value).str();
+ case Units::kHourNarrow:
+ /** TRANSLATORS: hour(s). Keep this as short as possible. Used in statistics. */
+ return (boost::format(npgettext("unit_narrow", "%1%h", "%1%h", value)) % value).str();
+ case Units::kMinutesNarrow:
+ /** TRANSLATORS: minute(s). Keep this as short as possible. Used in statistics. */
+ return (boost::format(npgettext("unit_narrow", "%1%m", "%1%m", value)) % value).str();
+ default: NEVER_HERE();
+ }
+}
+
+std::string get_generic_unit_name(Units unit) {
+ switch (unit) {
+ case Units::kDayGeneric:
+ /** TRANSLATORS: Generic unit label. Used in statistics. */
+ return pgettext("unit_generic", "days");
+ case Units::kHourGeneric:
+ /** TRANSLATORS: Generic unit label. Used in statistics. */
+ return pgettext("unit_generic", "hours");
+ case Units::kMinutesGeneric:
+ /** TRANSLATORS: Generic unit label. Used in statistics. */
+ return pgettext("unit_generic", "minutes");
+ default: NEVER_HERE();
+ }
+}
+
+
+uint32_t ms_to_unit(Units unit, uint32_t ms) {
+ switch (unit) {
+ case Units::kDayGeneric:
+ case Units::kDayNarrow:
+ return ms / days;
+ case Units::kHourGeneric:
+ case Units::kHourNarrow:
+ return ms / hours;
+ case Units::kMinutesGeneric:
+ case Units::kMinutesNarrow:
+ return ms / minutes;
}
NEVER_HERE();
}
@@ -159,7 +197,7 @@
{
uint32_t how_many_ticks, max_x;
- UNIT unit = get_suggested_unit(time_ms);
+ Units unit = get_suggested_unit(time_ms, true);
max_x = ms_to_unit(unit, time_ms);
// Make sure that we always have a tick
max_x = std::max(max_x, 1u);
@@ -237,7 +275,7 @@
kAxisLineColor, kAxisLinesWidth);
// print the used unit
- const Image* xtick = UI::g_fh1->render(xtick_text_style((boost::format(get_unit_name(unit)) % "").str()));
+ const Image* xtick = UI::g_fh1->render(xtick_text_style(get_generic_unit_name(unit)));
dst.blit(Point(2, spacing + 2), xtick, BlendMode::UseAlpha, UI::Align::kCenterLeft);
}
@@ -275,9 +313,8 @@
std::vector<std::string> WuiPlotArea::get_labels() {
std::vector<std::string> labels;
for (int32_t i = 0; i < game_time_id_; i++) {
- UNIT unit = get_suggested_unit(time_in_ms[i]);
- uint32_t val = ms_to_unit(unit, time_in_ms[i]);
- labels.push_back((boost::format(get_unit_name(unit)) % boost::lexical_cast<std::string>(val)).str());
+ Units unit = get_suggested_unit(time_in_ms[i], false);
+ labels.push_back(get_value_with_unit(unit, ms_to_unit(unit, time_in_ms[i])));
}
labels.push_back(_("game"));
return labels;
=== modified file 'src/wui/ware_statistics_menu.cc'
--- src/wui/ware_statistics_menu.cc 2016-02-18 18:27:52 +0000
+++ src/wui/ware_statistics_menu.cc 2016-03-30 07:31:26 +0000
@@ -35,7 +35,9 @@
#include "wui/plot_area.h"
#include "wui/waresdisplay.h"
-#define PLOT_HEIGHT 100
+constexpr int kPlotHeight = 130;
+constexpr int kPlotWidth = 250;
+constexpr int kSpacing = 5;
#define INACTIVE 0
@@ -137,7 +139,7 @@
(InteractivePlayer & parent, UI::UniqueWindow::Registry & registry)
:
UI::UniqueWindow
- (&parent, "ware_statistics", ®istry, 400, 270, _("Ware Statistics")),
+ (&parent, "ware_statistics", ®istry, kPlotWidth + 2 * kSpacing, 270, _("Ware Statistics")),
parent_(&parent)
{
uint8_t const nr_wares = parent.get_player()->egbase().tribes().nrwares();
@@ -150,25 +152,19 @@
// First, we must decide about the size.
UI::Box * box = new UI::Box(this, 0, 0, UI::Box::Vertical, 0, 0, 5);
- box->set_border(5, 5, 5, 5);
+ box->set_border(kSpacing, kSpacing, kSpacing, kSpacing);
set_center_panel(box);
// Setup plot widgets
// Create a tabbed environment for the different plots
- uint8_t const tab_offset = 30;
- uint8_t const spacing = 5;
- uint8_t const plot_width = get_inner_w() - 2 * spacing;
- uint8_t const plot_height = PLOT_HEIGHT + tab_offset + spacing;
-
UI::TabPanel * tabs =
new UI::TabPanel
- (box, spacing, 0, g_gr->images().get("images/ui_basic/but1.png"));
-
+ (box, kSpacing, 0, g_gr->images().get("images/ui_basic/but1.png"));
plot_production_ =
new WuiPlotArea
(tabs,
- 0, 0, plot_width, plot_height);
+ 0, 0, kPlotWidth, kPlotHeight + kSpacing);
plot_production_->set_sample_rate(STATISTICS_SAMPLE_TIME);
plot_production_->set_plotmode(WuiPlotArea::PLOTMODE_RELATIVE);
@@ -179,7 +175,7 @@
plot_consumption_ =
new WuiPlotArea
(tabs,
- 0, 0, plot_width, plot_height);
+ 0, 0, kPlotWidth, kPlotHeight + kSpacing);
plot_consumption_->set_sample_rate(STATISTICS_SAMPLE_TIME);
plot_consumption_->set_plotmode(WuiPlotArea::PLOTMODE_RELATIVE);
@@ -190,7 +186,7 @@
plot_economy_ =
new DifferentialPlotArea
(tabs,
- 0, 0, plot_width, plot_height);
+ 0, 0, kPlotWidth, kPlotHeight + kSpacing);
plot_economy_->set_sample_rate(STATISTICS_SAMPLE_TIME);
plot_economy_->set_plotmode(WuiPlotArea::PLOTMODE_RELATIVE);
@@ -200,7 +196,7 @@
plot_stock_ = new WuiPlotArea
(tabs,
- 0, 0, plot_width, plot_height);
+ 0, 0, kPlotWidth, kPlotHeight + kSpacing);
plot_stock_->set_sample_rate(STATISTICS_SAMPLE_TIME);
plot_stock_->set_plotmode(WuiPlotArea::PLOTMODE_ABSOLUTE);
@@ -254,7 +250,7 @@
box->add
(new WuiPlotGenericAreaSlider
(this, *plot_production_, this,
- 0, 0, 100, 45,
+ 0, 0, kPlotWidth, 45,
g_gr->images().get("images/ui_basic/but1.png")),
UI::Align::kLeft, true);
}
=== modified file 'src/wui/ware_statistics_menu.h'
--- src/wui/ware_statistics_menu.h 2016-02-18 18:27:52 +0000
+++ src/wui/ware_statistics_menu.h 2016-03-30 07:31:26 +0000
@@ -61,7 +61,7 @@
(Panel * const parent,
WuiPlotArea & plot_area,
WareStatisticsMenu * signal_listener,
- const int32_t x, const int32_t y, const uint32_t w, const uint32_t h,
+ const int32_t x, const int32_t y, const int w, const int h,
const Image* background_picture_id,
const std::string & tooltip_text = std::string(),
const uint32_t cursor_size = 20,
Follow ups