widelands-dev team mailing list archive
-
widelands-dev team
-
Mailing list archive
-
Message #08755
Re: [Merge] lp:~widelands-dev/widelands/scrollbar_beautification into lp:widelands
Review: Approve
lgtm.
Unrelated: have you started the game at 800x600 lately? The 'Widelands' logo is partly covered by the edge images.
Diff comments:
>
> === modified file 'src/ui_basic/table.cc'
> --- src/ui_basic/table.cc 2016-10-24 14:04:00 +0000
> +++ src/ui_basic/table.cc 2016-11-03 07:34:45 +0000
> @@ -523,6 +543,34 @@
> return columns_[sort_column_].compare(a, b);
> }
>
> +void Table<void*>::layout() {
> + // If we have a flexible column, adjust the column sizes.
> + if (flexible_column_ != std::numeric_limits<size_t>::max()) {
Instead of if (){} use if (!()) {return}; to avoid right drift.
> + int all_columns_width = scrollbar_->is_enabled() ? scrollbar_->get_w() : 0;
> + for (const auto& column : columns_) {
> + all_columns_width += column.width;
> + }
> + if (all_columns_width != get_w()) {
> + Column& column = columns_.at(flexible_column_);
> + column.width = column.width + get_w() - all_columns_width;
> + column.btn->set_size(column.width, column.btn->get_h());
> + int offset = 0;
> + for (const auto& col : columns_) {
> + col.btn->set_pos(Vector2i(offset, col.btn->get_y()));
> + offset = col.btn->get_x() + col.btn->get_w();
> + }
> + if (scrollbar_->is_enabled()) {
> + const UI::Button* last_column_btn = columns_.back().btn;
> + scrollbar_filler_button_->set_pos(
> + Vector2i(last_column_btn->get_x() + last_column_btn->get_w(), 0));
> + scrollbar_filler_button_->set_visible(true);
> + } else {
> + scrollbar_filler_button_->set_visible(false);
> + }
> + }
> + }
> +}
> +
> /**
> * Sort the table alphabetically. Make sure that the current selection stays
> * valid (though it might scroll out of visibility).
--
https://code.launchpad.net/~widelands-dev/widelands/scrollbar_beautification/+merge/309635
Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/scrollbar_beautification.
References