Merge lp:~widelands-dev/widelands/bug-1502965 into lp:widelands

Proposed by GunChleoc
Status: Merged
Merged at revision: 7653
Proposed branch: lp:~widelands-dev/widelands/bug-1502965
Merge into: lp:widelands
Diff against target: 50 lines (+15/-8)
2 files modified
src/wui/building_statistics_menu.cc (+13/-8)
src/wui/building_statistics_menu.h (+2/-0)
To merge this branch: bzr merge lp:~widelands-dev/widelands/bug-1502965
Reviewer Review Type Date Requested Status
TiborB Approve
Review via email: mp+278885@code.launchpad.net

Description of the change

Fixed minimizing/restoring of Building Statistics window.

To post a comment you must log in.
Revision history for this message
TiborB (tiborb95) wrote :

seems it works now

review: Approve
Revision history for this message
GunChleoc (gunchleoc) wrote :

Thanks :)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/wui/building_statistics_menu.cc'
2--- src/wui/building_statistics_menu.cc 2015-11-20 18:16:22 +0000
3+++ src/wui/building_statistics_menu.cc 2015-11-28 12:35:36 +0000
4@@ -559,20 +559,25 @@
5 */
6 void BuildingStatisticsMenu::think() {
7 // Adjust height to current tab
8- int tab_height =
9- 35 + row_counters_[tab_panel_.active()] * (kBuildGridCellHeight + kLabelHeight + kLabelHeight);
10- tab_panel_.set_size(kWindowWidth, tab_height);
11- set_size(get_w(), tab_height + kMargin + 4 * kButtonRowHeight + get_tborder() + get_bborder());
12- navigation_panel_.set_pos(Point(0, tab_height + kMargin));
13+ if (is_minimal()) {
14+ tab_panel_.set_size(0, 0);
15+ } else {
16+ int tab_height =
17+ 35 + row_counters_[tab_panel_.active()] * (kBuildGridCellHeight + kLabelHeight + kLabelHeight);
18+ tab_panel_.set_size(kWindowWidth, tab_height);
19+ set_size(get_w(), tab_height + kMargin + 4 * kButtonRowHeight + get_tborder() + get_bborder());
20+ navigation_panel_.set_pos(Point(0, tab_height + kMargin));
21+ }
22
23 // Update statistics
24- const Game& game = iplayer().game();
25- const int32_t gametime = game.get_gametime();
26+ const int32_t gametime = iplayer().game().get_gametime();
27
28- if ((gametime - lastupdate_) > kUpdateTimeInGametimeMs) {
29+ if (was_minimized_ || (gametime - lastupdate_) > kUpdateTimeInGametimeMs) {
30 update();
31 lastupdate_ = gametime;
32 }
33+ // Make sure we don't have a delay with displaying labels when we restore the window.
34+ was_minimized_ = is_minimal();
35 }
36
37 /*
38
39=== modified file 'src/wui/building_statistics_menu.h'
40--- src/wui/building_statistics_menu.h 2015-11-11 09:53:54 +0000
41+++ src/wui/building_statistics_menu.h 2015-11-28 12:35:36 +0000
42@@ -126,6 +126,8 @@
43 Widelands::DescriptionIndex last_building_type_;
44 /// The last time the information in this Panel got updated
45 uint32_t lastupdate_;
46+ /// Whether the window was minimized the last time that think() was executed
47+ uint32_t was_minimized_;
48
49 /// At which percent to deem buildings as unproductive
50 int low_production_;

Subscribers

People subscribed via source and target branches

to status/vote changes: