← Back to team overview

widelands-dev team mailing list archive

[Merge] lp:~widelands-dev/widelands/choose-attack-soldiers into lp:widelands

 

Benedikt Straub has proposed merging lp:~widelands-dev/widelands/choose-attack-soldiers into lp:widelands.

Commit message:
Use a MultilineTextarea for the soldier stats in the attack box

Requested reviews:
  GunChleoc (gunchleoc): i18n behaviour
Related bugs:
  Bug #585981 in widelands: "Soldier choice in the attack box"
  https://bugs.launchpad.net/widelands/+bug/585981
  Bug #1828711 in widelands: "Attack box width changes when mouse hovers over soldier"
  https://bugs.launchpad.net/widelands/+bug/1828711

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/choose-attack-soldiers/+merge/367471

Now the height of the attack box changes instead of the width ;)
It´ll change whenever the mouse is moved in or out; the text line is now hidden when no soldier is pointed at, which looks more elegant than an empty space at the bottom IMHO.
-- 
Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/choose-attack-soldiers.
=== modified file 'src/wui/attack_box.cc'
--- src/wui/attack_box.cc	2019-05-11 18:19:20 +0000
+++ src/wui/attack_box.cc	2019-05-15 13:33:32 +0000
@@ -246,7 +246,8 @@
 		mainbox.add(remaining_soldiers_.get(), UI::Box::Resizing::kFullSize);
 	}
 
-	current_soldier_stats_.reset(new UI::Textarea(&mainbox, "", UI::Align::kCenter));
+	current_soldier_stats_.reset(new UI::MultilineTextarea(&mainbox, 0, 0, 0, 0, UI::PanelStyle::kWui,
+			"", UI::Align::kCenter, UI::MultilineTextarea::ScrollMode::kNoScrolling));
 	mainbox.add(current_soldier_stats_.get(), UI::Box::Resizing::kFullSize, UI::Align::kCenter);
 
 	soldiers_slider_->set_enabled(max_attackers > 0);

=== modified file 'src/wui/attack_box.h'
--- src/wui/attack_box.h	2019-05-11 18:19:20 +0000
+++ src/wui/attack_box.h	2019-05-15 13:33:32 +0000
@@ -33,6 +33,7 @@
 #include "logic/player.h"
 #include "ui_basic/box.h"
 #include "ui_basic/button.h"
+#include "ui_basic/multilinetextarea.h"
 #include "ui_basic/slider.h"
 #include "ui_basic/textarea.h"
 
@@ -161,7 +162,7 @@
 
 	std::unique_ptr<ListOfSoldiers> attacking_soldiers_;
 	std::unique_ptr<ListOfSoldiers> remaining_soldiers_;
-	std::unique_ptr<UI::Textarea> current_soldier_stats_;
+	std::unique_ptr<UI::MultilineTextarea> current_soldier_stats_;
 	std::unique_ptr<UI::Button> attack_button_;
 
 	/// The last time the information in this Panel got updated


Follow ups