Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/bug-1291904 into lp:widelands

2015-06-03 Thread GunChleoc
I can reproduce this now. It also doesn't happen in trunk, so the bug is in 
this branch.
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1291904/+merge/237128
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/bug-1291904.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/authors into lp:widelands

2015-06-03 Thread GunChleoc
> you are removing a lot of translator_credits/*.po files but there are only 2 
> translators/*.json files, why?

Because I don't want to have to keep comparing the data while this
branch is waiting for merging. I will copy the data over in Transifex
when we've merged this. Transifex will then automatically add the
necessary files.


> update_authors.py is not ready for situation when json files would be 
> corrupted, can this situation (corruption of json files) happen?

The built-in JSON parser that comes with Python will throw an error and
abort the script when the input file isn't correct JSON.

-- 
https://code.launchpad.net/~widelands-dev/widelands/authors/+merge/250513
Your team Widelands Developers is requested to review the proposed merge of 
lp:~widelands-dev/widelands/authors into lp:widelands.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/authors into lp:widelands

2015-06-03 Thread TiborB
Review: Approve

I don't know what exactly Transifex is but if you personally guarantee that the 
information will be added later, I am fine with it.

I tested it of course, it looks good...
-- 
https://code.launchpad.net/~widelands-dev/widelands/authors/+merge/250513
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/authors.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


[Widelands-dev] [Merge] lp:~widelands-dev/widelands/bug-1399621 into lp:widelands

2015-06-03 Thread GunChleoc
GunChleoc has proposed merging lp:~widelands-dev/widelands/bug-1399621 into 
lp:widelands.

Requested reviews:
  Widelands Developers (widelands-dev)
Related bugs:
  Bug #849705 in widelands: "Add a column for "stopped" buildings in building 
statistics"
  https://bugs.launchpad.net/widelands/+bug/849705
  Bug #1399621 in widelands: "Building Statistics Window Redesign"
  https://bugs.launchpad.net/widelands/+bug/1399621

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/bug-1399621/+merge/258843

The Building Statistics window now uses a grid layout with tabs, analogous to 
flagaction.

Added "b" hotkey to toggle the window.
-- 
Your team Widelands Developers is requested to review the proposed merge of 
lp:~widelands-dev/widelands/bug-1399621 into lp:widelands.
=== modified file 'src/graphic/color.cc'
--- src/graphic/color.cc	2015-03-01 09:21:20 +
+++ src/graphic/color.cc	2015-06-03 10:36:31 +
@@ -19,12 +19,18 @@
 
 #include "graphic/color.h"
 
+#include 
+
 RGBColor::RGBColor() {
 }
 
 RGBColor::RGBColor(uint8_t const R, uint8_t const G, uint8_t const B) :
 	r(R), g(G), b(B) {}
 
+std::string RGBColor::hex_value() const {
+	return (boost::format ("%02x%02x%02x") % int(r) % int(g) % int(b)).str();
+}
+
 uint32_t RGBColor::map(const SDL_PixelFormat& fmt) const {
 	return SDL_MapRGB(&const_cast(fmt), r, g, b);
 }
@@ -53,6 +59,10 @@
 	a = 255;
 }
 
+std::string RGBAColor::hex_value() const {
+	return (boost::format ("%02x%02x%02x%02x>") % int(r) % int(g) % int(b) % int(a)).str();
+}
+
 uint32_t RGBAColor::map(const SDL_PixelFormat& fmt) const {
 	return SDL_MapRGBA(&const_cast(fmt), r, g, b, a);
 }

=== modified file 'src/graphic/color.h'
--- src/graphic/color.h	2014-07-14 10:45:44 +
+++ src/graphic/color.h	2015-06-03 10:36:31 +
@@ -20,6 +20,8 @@
 #ifndef WL_GRAPHIC_COLOR_H
 #define WL_GRAPHIC_COLOR_H
 
+#include 
+
 #include 
 
 struct RGBColor {
@@ -28,6 +30,9 @@
 	// Initializes the color to black.
 	RGBColor();
 
+	// Returns this color in hex format.
+	std::string hex_value() const;
+
 	// Map this color to the given 'fmt'
 	uint32_t map(const SDL_PixelFormat& fmt) const;
 
@@ -49,6 +54,9 @@
 	// Initializes to opaque color.
 	RGBAColor(const RGBColor& c);
 
+	// Returns this color in hex format.
+	std::string hex_value() const;
+
 	// Map this color to the given 'fmt'
 	uint32_t map(const SDL_PixelFormat& fmt) const;
 

=== modified file 'src/graphic/text_constants.h'
--- src/graphic/text_constants.h	2015-03-01 09:21:20 +
+++ src/graphic/text_constants.h	2015-06-03 10:36:31 +
@@ -42,10 +42,10 @@
 #define UI_FONT_TOOLTIP_CLR  RGBColor(255, 255,   0)
 
 /// Colors for good/ok/bad
-#define UI_FONT_CLR_BRIGHT_HEX"fffaaa"
-#define UI_FONT_CLR_DARK_HEX  "a39013"
-#define UI_FONT_CLR_BAD_HEX   "bb"
-#define UI_FONT_CLR_OK_HEX"ffe11e"
-#define UI_FONT_CLR_GOOD_HEX  "00bb00"
+#define UI_FONT_CLR_BRIGHT   RGBColor(255, 250, 170)
+#define UI_FONT_CLR_DARK RGBColor(163, 144,  19)
+#define UI_FONT_CLR_BAD  RGBColor(187,   0,   0)
+#define UI_FONT_CLR_OK   RGBColor(255, 225,  30)
+#define UI_FONT_CLR_GOOD RGBColor(  0, 187,   0)
 
 #endif  // end of include guard: WL_GRAPHIC_TEXT_CONSTANTS_H

=== modified file 'src/graphic/text_layout.cc'
--- src/graphic/text_layout.cc	2014-12-11 12:38:10 +
+++ src/graphic/text_layout.cc	2015-06-03 10:36:31 +
@@ -39,36 +39,36 @@
 }
 
 std::string as_window_title(const std::string& txt) {
-	static boost::format f("%s");
+	static boost::format f("%s");
 
-	f % int(UI_FONT_CLR_FG.r) % int(UI_FONT_CLR_FG.g) % int(UI_FONT_CLR_FG.b);
+	f % UI_FONT_CLR_FG.hex_value();
 	f % txt;
 	return f.str();
 }
 std::string as_uifont(const std::string & txt, int size, const RGBColor& clr) {
 	// UI Text is always bold due to historic reasons
 	static boost::format
-			f("%s");
+			f("%s");
 
 	f % size;
-	f % int(clr.r) % int(clr.g) % int(clr.b);
+	f % clr.hex_value();
 	f % txt;
 	return f.str();
 }
 
 std::string as_tooltip(const std::string & txt) {
-	static boost::format f("%s");
+	static boost::format f("%s");
 
 	f % UI_FONT_SIZE_SMALL;
-	f % int(UI_FONT_TOOLTIP_CLR.r) % int(UI_FONT_TOOLTIP_CLR.g) % int(UI_FONT_TOOLTIP_CLR.b);
+	f % UI_FONT_TOOLTIP_CLR.hex_value();
 	f % txt;
 	return f.str();
 }
 
 std::string as_waresinfo(const std::string & txt) {
 	static boost::format f
-		("%s");
-	f % int(UI_FONT_TOOLTIP_CLR.r) % int(UI_FONT_TOOLTIP_CLR.g) % int(UI_FONT_TOOLTIP_CLR.b);
+		("%s");
+	f % UI_FONT_TOOLTIP_CLR.hex_value();
 	f % txt;
 	return f.str();
 }

=== modified file 'src/logic/constructionsite.cc'
--- src/logic/constructionsite.cc	2014-12-06 12:22:35 +
+++ src/logic/constructionsite.cc	2015-06-03 10:36:31 +
@@ -84,7 +84,7 @@
 void ConstructionSite::update_statistics_string(std::string* s)
 {
 	unsigned int percent = (get_built_per64k() * 100) >> 16;
-	*s = (boost::format("%s") % UI_FONT_CLR_DARK_HEX %
+	*s = (boost::format("%s") % UI_FONT_CLR_DARK.hex_value() %
 	  (boost::f

Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/bug-1399621 into lp:widelands

2015-06-03 Thread GunChleoc
I had overlooked the diff question. The checks only check for the exact object 
type without inheritance, so I have to teat for all 3 types explicitly.

Diff comments:

> === modified file 'src/wui/building_statistics_menu.cc'
> --- src/wui/building_statistics_menu.cc   2014-11-30 18:49:38 +
> +++ src/wui/building_statistics_menu.cc   2015-05-13 06:02:16 +
> @@ -19,494 +19,441 @@
>  
>  #include "wui/building_statistics_menu.h"
>  
> -#include 
> -
>  #include 
>  #include 
>  
>  #include "base/i18n.h"
> -#include "base/macros.h"
> -#include "graphic/graphic.h"
> -#include "graphic/rendertarget.h"
> -#include "logic/building.h"
>  #include "logic/player.h"
>  #include "logic/productionsite.h"
>  #include "logic/tribe.h"
> -#include "ui_basic/button.h"
> -#include "wui/interactive_player.h"
> -#include "wui/mapviewpixelconstants.h"
> -#include "wui/plot_area.h"
> -
> -#define WINDOW_WIDTH 625
> -#define WINDOW_HEIGHT440
> -#define VMARGIN5
> -#define HMARGIN5
> -#define VSPACING   5
> -#define HSPACING   5
> -#define BUILDING_LIST_HEIGHT 285
> -#define BUILDING_LIST_WIDTH  (WINDOW_WIDTH - HMARGIN - HMARGIN)
> -#define LABEL_X  200
> -#define LABEL_WIDTH  150
> -#define VALUE_X  (LABEL_X + LABEL_WIDTH)
> -#define JUMP_PREV_BUTTON_X   (WINDOW_WIDTH - HMARGIN - 24 - HSPACING - 24)
> -#define JUMP_NEXT_BUTTON_X   (WINDOW_WIDTH - HMARGIN - 24)
> -#define TOTAL_PRODUCTIVITY_Y (VMARGIN + BUILDING_LIST_HEIGHT + VSPACING + 22)
> -#define PROGRESS_BAR_Y   (TOTAL_PRODUCTIVITY_Y + 24)
> -#define OWNED_Y  (PROGRESS_BAR_Y   + 24)
> -#define IN_BUILD_Y   (OWNED_Y  + 24)
> -#define UNPRODUCTIVE_Y   (IN_BUILD_Y   + 24)
> -#define FLAG_POINT   Point(125, WINDOW_HEIGHT - 8)
> -
> -#define LOW_PROD 33
> -
> -#define UPDATE_TIME 1000  //  1 second, gametime
> -
> -
> -namespace Columns {enum {Name, Size, Prod, Owned, Build};}
> -
> -inline InteractivePlayer & BuildingStatisticsMenu::iplayer() const {
> +
> +constexpr int kTabHeight = 35;
> +constexpr int kBuildGridCellSize = 50;
> +constexpr int kColumns = 5;
> +constexpr int32_t kWindowWidth = kColumns * kBuildGridCellSize;
> +constexpr int32_t kWindowHeight = 485;
> +
> +constexpr uint8_t kLowProduction = 33;
> +constexpr int32_t kUpdateTime = 1000;  //  1 second, gametime
> +
> +namespace {
> +// Formats a main text + help text for a tooltip and adds a hint for the 
> shift button.
> +const std::string format_tooltip(const std::string& title, const 
> std::string& helptext) {
> + const std::string color = (boost::format("%02x%02x%02x") % 
> int(UI_FONT_TOOLTIP_CLR.r) %
> +int(UI_FONT_TOOLTIP_CLR.g) % 
> int(UI_FONT_TOOLTIP_CLR.b)).str();
> +
> + const std::string tooltip_format(" bold=1 color=%s>%s"
> +  " size=%i>%s%s");
> +
> + return (boost::format(tooltip_format) % UI_FONT_SIZE_SMALL % color % 
> title % 11 % helptext %
> + _("Hold down SHIFT to step through the buildings from back to 
> front.")).str();
> +}
> +
> +}  // namespace
> +
> +inline InteractivePlayer& BuildingStatisticsMenu::iplayer() const {
>   return dynamic_cast(*get_parent());
>  }
>  
> -BuildingStatisticsMenu::BuildingStatisticsMenu
> - (InteractivePlayer & parent, UI::UniqueWindow::Registry & registry)
> -:
> - UI::UniqueWindow
> - (&parent, "building_statistics",
> -  ®istry,
> -  WINDOW_WIDTH, WINDOW_HEIGHT,
> -  _("Building Statistics")),
> - m_table
> - (this, HMARGIN, VMARGIN, BUILDING_LIST_WIDTH, 
> BUILDING_LIST_HEIGHT),
> - m_progbar
> - (this,
> -  LABEL_X, PROGRESS_BAR_Y, WINDOW_WIDTH - LABEL_X - HMARGIN, 20,
> -  UI::ProgressBar::Horizontal),
> - m_total_productivity_label
> - (this,
> -  LABEL_X, TOTAL_PRODUCTIVITY_Y, LABEL_WIDTH, 24,
> -  _("Total Productivity:"), UI::Align_CenterLeft),
> - m_owned_label
> - (this,
> -  LABEL_X, OWNED_Y, LABEL_WIDTH, 24,
> -  _("Owned:"), UI::Align_CenterLeft),
> - m_owned
> - (this, VALUE_X, OWNED_Y, 100, 24, UI::Align_CenterLeft),
> - m_in_build_label
> - (this,
> -  LABEL_X, IN_BUILD_Y, LABEL_WIDTH, 24,
> -  _("Being built:"), UI::Align_CenterLeft),
> - m_in_build
> - (this, VALUE_X, IN_BUILD_Y, 100, 24, UI::Align_CenterLeft),
> - m_unproductive_label
> - (this,
> -  LABEL_X, UNPRODUCTIVE_Y, LABEL_WIDTH, 24,
> -  _("Jump to unproductive"), UI::Align_CenterLeft),
> - m_anim   (0),
> - m_lastupdate (0),
> - m_last_building_index(0),
> - m_last_table_index   (0)
> -{
> - //  building list
> - m_table.add_column(310, _("Name"));
> - m_tab