gui2/tchat_log: Start dialog displaying the last chat log page

This commit is contained in:
Ignacio R. Morelle 2015-06-04 22:02:41 -03:00
parent dd36c4ed5f
commit 292b09e55a
3 changed files with 11 additions and 4 deletions

View file

@ -15,6 +15,8 @@ Version 1.12.2+dev:
* Fixed unit bars, ellipses, and orbs disappearing for individual units in
replay mode when using Skip Animations/Quick Replays if they moved without
attacking or otherwise switching to a new animation.
* Chat Log dialog now starts on the last log page when there are multiple
pages.
* Miscellaneous and bug fixes:
* Fixed bug #23445: set default build type in cmake to "Release" to ensure
that the game is not unoptimized

View file

@ -13,6 +13,8 @@ Version 1.12.2+dev:
* Fixed unit bars, ellipses, and orbs disappearing for individual units in
replay mode when using Skip Animations/Quick Replays if they moved without
attacking or otherwise switching to a new animation.
* Chat Log dialog now starts on the last log page when there are multiple
pages.
Version 1.12.2:

View file

@ -286,17 +286,20 @@ public:
return std::make_pair(first, last);
}
void update_view_from_model()
void update_view_from_model(bool select_last_page = false)
{
LOG_CHAT_LOG << "Entering tchat_log::controller::update_view_from_model"
<< std::endl;
model_.msg_label->set_use_markup(true);
int size = model_.chat_log_history.size();
LOG_CHAT_LOG << "Number of chat messages: " << size << std::endl;
// get page
const int page = model_.page;
// determine count of pages
const int count_of_pages = std::max(1, model_.count_of_pages());
if(select_last_page) {
model_.page = count_of_pages - 1;
}
// get page
const int page = model_.page;
// determine first and last
const std::pair<int, int>& range = calculate_log_line_range();
const int first = range.first;
@ -345,7 +348,7 @@ public:
void pre_show(CVideo& /*video*/, twindow& window)
{
LOG_CHAT_LOG << "Entering tchat_log::view::pre_show" << std::endl;
controller_.update_view_from_model();
controller_.update_view_from_model(true);
window.invalidate_layout(); // workaround for assertion failure
LOG_CHAT_LOG << "Exiting tchat_log::view::pre_show" << std::endl;
}