widelands-dev team mailing list archive
-
widelands-dev team
-
Mailing list archive
-
Message #09733
[Merge] lp:~widelands-dev/widelands/align-align into lp:widelands
Klaus Halfmann has proposed merging lp:~widelands-dev/widelands/align-align into lp:widelands.
Requested reviews:
Widelands Developers (widelands-dev)
For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/align-align/+merge/317871
Split Align in into Align, HAlign and VAlign.
moved back to simple enum. Reviewd all the code to use either of them.
Rule of thumb:
- Use HAlign if you need a plain horizontal alignment
- Use VAlign if you need a plain Vertical alignment
- Use Align for all mixed case.
Use the correct enums, fall back to int if you _must_ use some mixed case.
This cleans up some "misuse" of alignment but some things might still be improved:
- Some Textdrawing (Textbox?) uses alignment instead of a boolean RTOL flag.
- Box has a seperate Horinzontal / Vertical enum
- some switch cases are still "overdefined"
I played this for a while and found no Problems so far.
I did not merge trunk yet, as this will become (another) pain.
If you think this is to hard I may start over wit a less radical aproach.
Thi work gave me some good insight into some aspects over the code in any case
--
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/align-align into lp:widelands.
=== modified file 'src/editor/ui_menus/categorized_item_selection_menu.h'
--- src/editor/ui_menus/categorized_item_selection_menu.h 2017-01-25 18:55:59 +0000
+++ src/editor/ui_menus/categorized_item_selection_menu.h 2017-02-21 15:47:40 +0000
@@ -85,18 +85,15 @@
protect_against_recursive_select_(false),
tab_panel_(this, 0, 0, g_gr->images().get("images/wui/window_background_dark.png")),
current_selection_names_(this,
- 0,
- 0,
- 20,
- 20,
+ 0, 0, 20, 20,
"",
- UI::Align::kCenter,
+ UI::HAlign::kHCenter,
g_gr->images().get("images/ui_basic/but1.png"),
UI::MultilineTextarea::ScrollMode::kNoScrolling),
tool_(tool) {
current_selection_names_.set_background(
g_gr->images().get("images/wui/window_background_dark.png"));
- add(&tab_panel_, UI::Align::kCenter);
+ add(&tab_panel_, UI::HAlign::kHCenter);
for (uint32_t category_index = 0; category_index < categories.size(); ++category_index) {
const Widelands::EditorCategory& category = categories.get(category_index);
@@ -120,7 +117,7 @@
horizontal = new UI::Box(vertical, 0, 0, UI::Box::Horizontal);
horizontal->add_space(kSpacing);
- vertical->add(horizontal, UI::Align::kLeft);
+ vertical->add(horizontal, UI::HAlign::kLeft);
vertical->add_space(kSpacing);
}
assert(horizontal != nullptr);
@@ -129,13 +126,13 @@
cb->set_state(tool_->is_enabled(i));
cb->changedto.connect(boost::bind(&CategorizedItemSelectionMenu::selected, this, i, _1));
checkboxes_[i] = cb;
- horizontal->add(cb, UI::Align::kLeft);
+ horizontal->add(cb, UI::HAlign::kLeft);
horizontal->add_space(kSpacing);
++nitems_handled;
}
tab_panel_.add(category.name(), category.picture(), vertical, category.descname());
}
- add(¤t_selection_names_, UI::Align::kCenter, true);
+ add(¤t_selection_names_, UI::HAlign::kHCenter, true);
tab_panel_.sigclicked.connect(boost::bind(&CategorizedItemSelectionMenu::update_label, this));
update_label();
}
=== modified file 'src/editor/ui_menus/main_menu.cc'
--- src/editor/ui_menus/main_menu.cc 2017-01-25 18:55:59 +0000
+++ src/editor/ui_menus/main_menu.cc 2017-02-21 15:47:40 +0000
@@ -44,58 +44,52 @@
box_(this, margin, margin, UI::Box::Vertical, width, get_h() - 2 * margin, vspacing),
button_new_map_(&box_,
"new_map",
- 0,
- 0,
+ 0, 0,
width,
0,
g_gr->images().get("images/ui_basic/but1.png"),
_("New Map")),
button_new_random_map_(&box_,
"new_random_map",
- 0,
- 0,
+ 0, 0,
width,
0,
g_gr->images().get("images/ui_basic/but1.png"),
_("New Random Map")),
button_load_map_(&box_,
"load_map",
- 0,
- 0,
+ 0, 0,
width,
0,
g_gr->images().get("images/ui_basic/but1.png"),
_("Load Map")),
button_save_map_(&box_,
"save_map",
- 0,
- 0,
+ 0, 0,
width,
0,
g_gr->images().get("images/ui_basic/but1.png"),
_("Save Map")),
button_map_options_(&box_,
"map_options",
- 0,
- 0,
+ 0, 0,
width,
0,
g_gr->images().get("images/ui_basic/but1.png"),
_("Map Options")),
button_exit_editor_(&box_,
"exit",
- 0,
- 0,
+ 0, 0,
width,
0,
g_gr->images().get("images/ui_basic/but5.png"),
_("Exit Editor")) {
- box_.add(&button_new_map_, UI::Align::kHCenter);
- box_.add(&button_new_random_map_, UI::Align::kHCenter);
- box_.add(&button_load_map_, UI::Align::kHCenter);
- box_.add(&button_save_map_, UI::Align::kHCenter);
- box_.add(&button_map_options_, UI::Align::kHCenter);
- box_.add(&button_exit_editor_, UI::Align::kHCenter);
+ box_.add(&button_new_map_, UI::HAlign::kHCenter);
+ box_.add(&button_new_random_map_, UI::HAlign::kHCenter);
+ box_.add(&button_load_map_, UI::HAlign::kHCenter);
+ box_.add(&button_save_map_, UI::HAlign::kHCenter);
+ box_.add(&button_map_options_, UI::HAlign::kHCenter);
+ box_.add(&button_exit_editor_, UI::HAlign::kHCenter);
box_.set_size(width, 6 * button_new_map_.get_h() + 5 * vspacing);
set_inner_size(get_inner_w(), box_.get_h() + 2 * margin);
=== modified file 'src/editor/ui_menus/main_menu_load_or_save_map.cc'
--- src/editor/ui_menus/main_menu_load_or_save_map.cc 2017-01-25 18:55:59 +0000
+++ src/editor/ui_menus/main_menu_load_or_save_map.cc 2017-02-21 15:47:40 +0000
@@ -57,7 +57,7 @@
tableh_,
MapDetails::Style::kWui),
directory_info_(
- this, padding_, get_inner_h() - 2 * buth_ - 4 * padding_, "", UI::Align::kLeft),
+ this, padding_, get_inner_h() - 2 * buth_ - 4 * padding_, "", UI::Align::kTopLeft),
ok_(this,
"ok",
UI::g_fh1->fontset()->is_rtl() ? get_inner_w() / 2 - butw_ - padding_ :
@@ -86,14 +86,14 @@
show_mapnames_ =
new UI::Button(vbox, "show_mapnames", 0, 0, 2 * butw_, buth_,
g_gr->images().get("images/ui_basic/but1.png"), _("Show Map Names"));
- vbox->add(show_mapnames_, UI::Align::kLeft, true);
+ vbox->add(show_mapnames_, UI::HAlign::kLeft, true);
/** TRANSLATORS: Checkbox title. If this checkbox is enabled, map names aren't translated. */
cb_dont_localize_mapnames_ =
new UI::Checkbox(vbox, Vector2i(0, 0), _("Show original map names"));
cb_dont_localize_mapnames_->set_state(false);
vbox->add_space(2 * padding_);
- vbox->add(cb_dont_localize_mapnames_, UI::Align::kLeft, true);
+ vbox->add(cb_dont_localize_mapnames_, UI::HAlign::kLeft, true);
vbox->set_size(get_inner_w(), buth_);
table_.set_column_compare(0, boost::bind(&MainMenuLoadOrSaveMap::compare_players, this, _1, _2));
=== modified file 'src/editor/ui_menus/main_menu_map_options.cc'
--- src/editor/ui_menus/main_menu_map_options.cc 2017-01-25 18:55:59 +0000
+++ src/editor/ui_menus/main_menu_map_options.cc 2017-02-21 15:47:40 +0000
@@ -109,29 +109,29 @@
g_gr->images().get("images/ui_basic/but1.png"));
main_box_.add(
- new UI::Textarea(&main_box_, 0, 0, max_w_, labelh_, _("Map Name:")), UI::Align::kLeft);
- main_box_.add(&name_, UI::Align::kLeft);
- main_box_.add_space(indent_);
-
- main_box_.add(
- new UI::Textarea(&main_box_, 0, 0, max_w_, labelh_, _("Authors:")), UI::Align::kLeft);
- main_box_.add(&author_, UI::Align::kLeft);
- main_box_.add_space(indent_);
-
- main_box_.add(
- new UI::Textarea(&main_box_, 0, 0, max_w_, labelh_, _("Description:")), UI::Align::kLeft);
- main_box_.add(descr_, UI::Align::kLeft);
- main_box_.add_space(indent_);
-
- main_box_.add(
- new UI::Textarea(&main_box_, 0, 0, max_w_, labelh_, _("Hint (optional):")), UI::Align::kLeft);
- main_box_.add(hint_, UI::Align::kLeft);
- main_box_.add_space(indent_);
-
- main_box_.add(&size_, UI::Align::kLeft);
- main_box_.add_space(indent_);
-
- tags_box_.add(new UI::Textarea(&tags_box_, 0, 0, max_w_, labelh_, _("Tags:")), UI::Align::kLeft);
+ new UI::Textarea(&main_box_, 0, 0, max_w_, labelh_, _("Map Name:")), UI::HAlign::kLeft);
+ main_box_.add(&name_, UI::HAlign::kLeft);
+ main_box_.add_space(indent_);
+
+ main_box_.add(
+ new UI::Textarea(&main_box_, 0, 0, max_w_, labelh_, _("Authors:")), UI::HAlign::kLeft);
+ main_box_.add(&author_, UI::HAlign::kLeft);
+ main_box_.add_space(indent_);
+
+ main_box_.add(
+ new UI::Textarea(&main_box_, 0, 0, max_w_, labelh_, _("Description:")), UI::HAlign::kLeft);
+ main_box_.add(descr_, UI::HAlign::kLeft);
+ main_box_.add_space(indent_);
+
+ main_box_.add(
+ new UI::Textarea(&main_box_, 0, 0, max_w_, labelh_, _("Hint (optional):")), UI::HAlign::kLeft);
+ main_box_.add(hint_, UI::HAlign::kLeft);
+ main_box_.add_space(indent_);
+
+ main_box_.add(&size_, UI::HAlign::kLeft);
+ main_box_.add_space(indent_);
+
+ tags_box_.add(new UI::Textarea(&tags_box_, 0, 0, max_w_, labelh_, _("Tags:")), UI::HAlign::kLeft);
add_tag_checkbox(&tags_box_, "unbalanced", localize_tag("unbalanced"));
add_tag_checkbox(&tags_box_, "ffa", localize_tag("ffa"));
add_tag_checkbox(&tags_box_, "1v1", localize_tag("1v1"));
@@ -140,8 +140,8 @@
add_tag_checkbox(&tags_box_, "4teams", localize_tag("4teams"));
teams_box_.add(new UI::Textarea(&teams_box_, 0, 0, max_w_, labelh_, _("Suggested Teams:")),
- UI::Align::kLeft);
- teams_box_.add(&teams_list_, UI::Align::kLeft);
+ UI::HAlign::kLeft);
+ teams_box_.add(&teams_list_, UI::HAlign::kLeft);
// TODO(GunChleoc): We need team images in the listselect here,
// so map editors will be able to delete entries.
// This is waiting for the new RT renderer.
@@ -150,9 +150,9 @@
unsigned int nr_players = static_cast<unsigned int>(eia().egbase().map().get_nrplayers());
std::string players =
(boost::format(ngettext("%u Player", "%u Players", nr_players)) % nr_players).str();
- teams_box_.add(new UI::Textarea(&teams_box_, 0, 0, max_w_, labelh_, players), UI::Align::kLeft);
+ teams_box_.add(new UI::Textarea(&teams_box_, 0, 0, max_w_, labelh_, players), UI::HAlign::kLeft);
- tab_box_.add(&tabs_, UI::Align::kLeft, true);
+ tab_box_.add(&tabs_, UI::HAlign::kLeft, true);
tabs_.add("main_map_options", g_gr->images().get("images/wui/menus/menu_toggle_minimap.png"),
&main_box_, _("Main Options"));
tabs_.add("map_tags", g_gr->images().get("images/ui_basic/checkbox_checked.png"), &tags_box_,
@@ -236,9 +236,9 @@
std::string displ_name) {
UI::Box* box = new UI::Box(parent, 0, 0, UI::Box::Horizontal, max_w_, checkbox_space_, 0);
UI::Checkbox* cb = new UI::Checkbox(box, Vector2i(0, 0), displ_name);
- box->add(cb, UI::Align::kLeft, true);
+ box->add(cb, UI::HAlign::kLeft, true);
box->add_space(checkbox_space_);
- parent->add(box, UI::Align::kLeft);
+ parent->add(box, UI::HAlign::kLeft);
parent->add_space(padding_);
tags_checkboxes_[tag] = cb;
}
=== modified file 'src/editor/ui_menus/main_menu_new_map.cc'
--- src/editor/ui_menus/main_menu_new_map.cc 2017-01-25 18:55:59 +0000
+++ src/editor/ui_menus/main_menu_new_map.cc 2017-02-21 15:47:40 +0000
@@ -109,24 +109,24 @@
height_.set_value(height_index);
}
- box_.add(&width_, UI::Align::kLeft);
- box_.add(&height_, UI::Align::kLeft);
+ box_.add(&width_, UI::HAlign::kLeft);
+ box_.add(&height_, UI::HAlign::kLeft);
box_.add_space(margin_);
UI::Textarea* terrain_label = new UI::Textarea(&box_, _("Terrain:"));
- box_.add(terrain_label, UI::Align::kLeft);
- box_.add(&list_, UI::Align::kLeft);
+ box_.add(terrain_label, UI::HAlign::kLeft);
+ box_.add(&list_, UI::HAlign::kLeft);
box_.add_space(2 * margin_);
cancel_button_.sigclicked.connect(boost::bind(&MainMenuNewMap::clicked_cancel, this));
ok_button_.sigclicked.connect(boost::bind(&MainMenuNewMap::clicked_create_map, this));
if (UI::g_fh1->fontset()->is_rtl()) {
- button_box_.add(&ok_button_, UI::Align::kLeft);
- button_box_.add(&cancel_button_, UI::Align::kLeft);
+ button_box_.add(&ok_button_, UI::HAlign::kLeft);
+ button_box_.add(&cancel_button_, UI::HAlign::kLeft);
} else {
- button_box_.add(&cancel_button_, UI::Align::kLeft);
- button_box_.add(&ok_button_, UI::Align::kLeft);
+ button_box_.add(&cancel_button_, UI::HAlign::kLeft);
+ button_box_.add(&ok_button_, UI::HAlign::kLeft);
}
- box_.add(&button_box_, UI::Align::kLeft);
+ box_.add(&button_box_, UI::HAlign::kLeft);
box_.set_size(box_width_, width_.get_h() + height_.get_h() + terrain_label->get_h() +
list_.get_h() + button_box_.get_h() + 9 * margin_);
=== modified file 'src/editor/ui_menus/main_menu_random_map.cc'
--- src/editor/ui_menus/main_menu_random_map.cc 2017-01-25 18:55:59 +0000
+++ src/editor/ui_menus/main_menu_random_map.cc 2017-02-21 15:47:40 +0000
@@ -167,8 +167,7 @@
UI::SpinBox::Type::kSmall,
5),
wasteland_(&box_,
- 0,
- 0,
+ 0, 0,
box_width_,
box_width_ / 3,
wastelandval_,
@@ -182,46 +181,39 @@
mountains_box_(&box_, 0, 0, UI::Box::Horizontal, 0, 0, margin_),
mountains_label_(&mountains_box_, 0, 0, _("Mountains:")),
mountains_(&mountains_box_,
- 0,
- 0,
+ 0, 0,
box_width_ / 3,
resources_label_.get_h(),
(boost::format(_("%i %%")) % mountainsval_).str(),
- UI::Align::kHCenter),
+ UI::Align::kTopCenter),
island_mode_(&box_, Vector2i(0, 0), _("Island mode")),
// Geeky stuff
map_number_box_(&box_, 0, 0, UI::Box::Horizontal, 0, 0, margin_),
map_number_label_(&map_number_box_, 0, 0, _("Random Number:")),
map_number_edit_(&map_number_box_,
- 0,
- 0,
+ 0, 0,
box_width_ - 2 * margin_ - map_number_label_.get_w(),
- 0,
- 2,
+ 0, 2,
g_gr->images().get("images/ui_basic/but1.png")),
map_id_box_(&box_, 0, 0, UI::Box::Horizontal, 0, 0, margin_),
map_id_label_(&map_id_box_, 0, 0, _("Map ID:")),
map_id_edit_(&map_id_box_,
- 0,
- 0,
+ 0, 0,
box_width_ - 2 * margin_ - map_id_label_.get_w(),
- 0,
- 2,
+ 0, 2,
g_gr->images().get("images/ui_basic/but1.png")),
// Buttons
button_box_(&box_, 0, 0, UI::Box::Horizontal, 0, 0, margin_),
ok_button_(&button_box_,
"generate_map",
- 0,
- 0,
+ 0, 0,
box_width_ / 2 - margin_,
0,
g_gr->images().get("images/ui_basic/but5.png"),
_("Generate Map")),
cancel_button_(&button_box_,
"generate_map",
- 0,
- 0,
+ 0, 0,
box_width_ / 2 - margin_,
0,
g_gr->images().get("images/ui_basic/but1.png"),
@@ -248,14 +240,14 @@
height_.get_buttons()[1]->sigclicked.connect(
boost::bind(&MainMenuNewRandomMap::button_clicked, this, ButtonId::kMapSize));
- box_.add(&width_, UI::Align::kLeft);
- box_.add(&height_, UI::Align::kLeft);
+ box_.add(&width_, UI::HAlign::kLeft);
+ box_.add(&height_, UI::HAlign::kLeft);
box_height += margin_ + width_.get_h();
box_height += margin_ + height_.get_h();
// ---------- Players -----------
- box_.add(&players_, UI::Align::kLeft);
+ box_.add(&players_, UI::HAlign::kLeft);
box_height += margin_ + players_.get_h();
box_.add_space(margin_);
@@ -266,30 +258,30 @@
// ---------- Worlds ----------
- world_box_.add(&world_label_, UI::Align::kLeft);
+ world_box_.add(&world_label_, UI::HAlign::kLeft);
if (world_label_.get_w() < resources_label_.get_w()) {
world_box_.add_space(resources_label_.get_w() - world_label_.get_w() - margin_);
}
world_.sigclicked.connect(
boost::bind(&MainMenuNewRandomMap::button_clicked, this, ButtonId::kWorld));
- world_box_.add(&world_, UI::Align::kLeft);
- box_.add(&world_box_, UI::Align::kLeft);
+ world_box_.add(&world_, UI::HAlign::kLeft);
+ box_.add(&world_box_, UI::HAlign::kLeft);
box_height += margin_ + world_box_.get_h();
box_.add_space(margin_);
box_height += margin_;
// ---------- Amount of Resources (Low/Medium/High) ----------
- resources_box_.add(&resources_label_, UI::Align::kLeft);
+ resources_box_.add(&resources_label_, UI::HAlign::kLeft);
if (resources_label_.get_w() < world_label_.get_w()) {
resources_box_.add_space(world_label_.get_w() - resources_label_.get_w() - margin_);
}
resources_.sigclicked.connect(
boost::bind(&MainMenuNewRandomMap::button_clicked, this, ButtonId::kResources));
- resources_box_.add(&resources_, UI::Align::kLeft);
- box_.add(&resources_box_, UI::Align::kLeft);
+ resources_box_.add(&resources_, UI::HAlign::kLeft);
+ box_.add(&resources_box_, UI::HAlign::kLeft);
box_height += margin_ + resources_box_.get_h();
box_.add_space(margin_);
box_height += margin_;
@@ -300,7 +292,7 @@
water_.get_buttons()[1]->sigclicked.connect(
boost::bind(&MainMenuNewRandomMap::button_clicked, this, ButtonId::kWater));
- box_.add(&water_, UI::Align::kLeft);
+ box_.add(&water_, UI::HAlign::kLeft);
box_height += margin_ + water_.get_h();
// ---------- Land -----------
@@ -310,7 +302,7 @@
land_.get_buttons()[1]->sigclicked.connect(
boost::bind(&MainMenuNewRandomMap::button_clicked, this, ButtonId::kLand));
- box_.add(&land_, UI::Align::kLeft);
+ box_.add(&land_, UI::HAlign::kLeft);
box_height += margin_ + land_.get_h();
// ---------- Wasteland -----------
@@ -320,21 +312,21 @@
wasteland_.get_buttons()[1]->sigclicked.connect(
boost::bind(&MainMenuNewRandomMap::button_clicked, this, ButtonId::kWasteland));
- box_.add(&wasteland_, UI::Align::kLeft);
+ box_.add(&wasteland_, UI::HAlign::kLeft);
box_height += margin_ + wasteland_.get_h();
// ---------- Mountains -----------
- mountains_box_.add(&mountains_label_, UI::Align::kLeft);
+ mountains_box_.add(&mountains_label_, UI::HAlign::kLeft);
// Convince the value label to align with the spinbox labels above
mountains_box_.add_space(box_width_ - box_width_ / 6 - mountains_label_.get_w() -
mountains_.get_w() + margin_ + 3);
mountains_.set_fixed_width(box_width_ / 3 - margin_);
- mountains_box_.add(&mountains_, UI::Align::kLeft);
+ mountains_box_.add(&mountains_, UI::HAlign::kLeft);
mountains_box_.set_size(box_width_, mountains_label_.get_h());
- box_.add(&mountains_box_, UI::Align::kLeft);
+ box_.add(&mountains_box_, UI::HAlign::kLeft);
box_height += margin_ + mountains_box_.get_h();
box_.add_space(margin_);
box_height += margin_;
@@ -342,7 +334,7 @@
// ---------- Island mode ----------
island_mode_.set_state(true);
- box_.add(&island_mode_, UI::Align::kLeft);
+ box_.add(&island_mode_, UI::HAlign::kLeft);
box_height += margin_ + island_mode_.get_h();
box_.add_space(margin_);
box_height += margin_;
@@ -352,7 +344,7 @@
// ---------- Random map number edit ----------
- map_number_box_.add(&map_number_label_, UI::Align::kLeft);
+ map_number_box_.add(&map_number_label_, UI::HAlign::kLeft);
map_number_edit_.changed.connect(boost::bind(&MainMenuNewRandomMap::nr_edit_box_changed, this));
RNG rng;
@@ -360,8 +352,8 @@
rng.rand();
map_number_ = rng.rand();
map_number_edit_.set_text(std::to_string(static_cast<unsigned int>(map_number_)));
- map_number_box_.add(&map_number_edit_, UI::Align::kLeft);
- box_.add(&map_number_box_, UI::Align::kLeft);
+ map_number_box_.add(&map_number_edit_, UI::HAlign::kLeft);
+ box_.add(&map_number_box_, UI::HAlign::kLeft);
box_height += margin_ + map_number_box_.get_h();
box_.add_space(margin_);
@@ -369,12 +361,12 @@
// ---------- Map ID String edit ----------
- map_id_box_.add(&map_id_label_, UI::Align::kLeft);
+ map_id_box_.add(&map_id_label_, UI::HAlign::kLeft);
map_id_edit_.set_text("abcd-efgh-ijkl-mnop");
map_id_edit_.changed.connect(boost::bind(&MainMenuNewRandomMap::id_edit_box_changed, this));
- map_id_box_.add(&map_id_edit_, UI::Align::kLeft);
- box_.add(&map_id_box_, UI::Align::kLeft);
+ map_id_box_.add(&map_id_edit_, UI::HAlign::kLeft);
+ box_.add(&map_id_box_, UI::HAlign::kLeft);
box_height += margin_ + map_id_edit_.get_h();
box_.add_space(margin_);
box_height += margin_;
@@ -383,13 +375,13 @@
cancel_button_.sigclicked.connect(boost::bind(&MainMenuNewRandomMap::clicked_cancel, this));
ok_button_.sigclicked.connect(boost::bind(&MainMenuNewRandomMap::clicked_create_map, this));
if (UI::g_fh1->fontset()->is_rtl()) {
- button_box_.add(&ok_button_, UI::Align::kLeft);
- button_box_.add(&cancel_button_, UI::Align::kLeft);
+ button_box_.add(&ok_button_, UI::HAlign::kLeft);
+ button_box_.add(&cancel_button_, UI::HAlign::kLeft);
} else {
- button_box_.add(&cancel_button_, UI::Align::kLeft);
- button_box_.add(&ok_button_, UI::Align::kLeft);
+ button_box_.add(&cancel_button_, UI::HAlign::kLeft);
+ button_box_.add(&ok_button_, UI::HAlign::kLeft);
}
- box_.add(&button_box_, UI::Align::kLeft);
+ box_.add(&button_box_, UI::HAlign::kLeft);
box_height += margin_ + button_box_.get_h();
box_height += 6 * margin_;
=== modified file 'src/editor/ui_menus/main_menu_save_map.cc'
--- src/editor/ui_menus/main_menu_save_map.cc 2017-01-25 18:55:59 +0000
+++ src/editor/ui_menus/main_menu_save_map.cc 2017-02-21 15:47:40 +0000
@@ -73,7 +73,7 @@
butw_,
buth_,
_("Filename:"),
- UI::Align::kLeft) {
+ UI::Align::kTopLeft) {
set_current_directory(curdir_);
// Make room for edit_options_ button
=== modified file 'src/editor/ui_menus/main_menu_save_map_make_directory.cc'
--- src/editor/ui_menus/main_menu_save_map_make_directory.cc 2017-01-25 18:55:59 +0000
+++ src/editor/ui_menus/main_menu_save_map_make_directory.cc 2017-02-21 15:47:40 +0000
@@ -39,18 +39,15 @@
get_inner_h() - 3 * padding_ - buth_,
padding_ / 2),
label_(&vbox_,
- 0,
- 0,
+ 0, 0,
get_inner_w() - 2 * padding_,
buth_,
_("Enter Directory Name:"),
- UI::Align::kLeft),
+ UI::Align::kTopLeft),
edit_(&vbox_,
- 0,
- 0,
+ 0, 0,
get_inner_w() - 2 * padding_,
- 0,
- 4,
+ 0, 4,
g_gr->images().get("images/ui_basic/but1.png")),
ok_button_(this,
"ok",
@@ -69,9 +66,9 @@
g_gr->images().get("images/ui_basic/but1.png"),
_("Cancel")) {
- vbox_.add(&label_, UI::Align::kLeft);
+ vbox_.add(&label_, UI::HAlign::kLeft);
vbox_.add_space(padding_);
- vbox_.add(&edit_, UI::Align::kLeft);
+ vbox_.add(&edit_, UI::HAlign::kLeft);
vbox_.set_size(get_inner_w() - 2 * padding_, get_inner_h() - 3 * padding_ - buth_);
edit_.set_text(dirname_);
=== modified file 'src/editor/ui_menus/tool_change_height_options_menu.cc'
--- src/editor/ui_menus/tool_change_height_options_menu.cc 2017-01-25 18:55:59 +0000
+++ src/editor/ui_menus/tool_change_height_options_menu.cc 2017-02-21 15:47:40 +0000
@@ -37,8 +37,7 @@
increase_tool_(increase_tool),
box_(this, hmargin(), vmargin(), UI::Box::Vertical, 0, 0, vspacing()),
change_by_(&box_,
- 0,
- 0,
+ 0, 0,
get_inner_w() - 2 * hmargin(),
80,
increase_tool_.get_change_by(),
@@ -72,8 +71,8 @@
set_to_.changed.connect(
boost::bind(&EditorToolChangeHeightOptionsMenu::update_set_to, boost::ref(*this)));
- box_.add(&change_by_, UI::Align::kLeft);
- box_.add(&set_to_, UI::Align::kLeft);
+ box_.add(&change_by_, UI::HAlign::kLeft);
+ box_.add(&set_to_, UI::HAlign::kLeft);
box_.set_size(get_inner_w() - 2 * hmargin(), change_by_.get_h() + set_to_.get_h() + vspacing());
set_inner_size(box_.get_w() + 2 * hmargin(), box_.get_h() + 2 * vspacing());
}
=== modified file 'src/editor/ui_menus/tool_change_resources_options_menu.cc'
--- src/editor/ui_menus/tool_change_resources_options_menu.cc 2017-01-25 18:55:59 +0000
+++ src/editor/ui_menus/tool_change_resources_options_menu.cc 2017-02-21 15:47:40 +0000
@@ -75,7 +75,7 @@
g_gr->images().get("images/ui_basic/but1.png"),
UI::SpinBox::Type::kSmall),
resources_box_(&box_, 0, 0, UI::Box::Horizontal, 0, 0, 1),
- cur_selection_(&box_, 0, 0, "", UI::Align::kCenter) {
+ cur_selection_(&box_, 0, 0, "", UI::Align::kTopCenter) {
// Configure spin boxes
change_by_.set_tooltip(
/** TRANSLATORS: Editor change rseources access keys. **/
@@ -90,8 +90,8 @@
set_to_.changed.connect(
boost::bind(&EditorToolChangeResourcesOptionsMenu::update_set_to, boost::ref(*this)));
- box_.add(&change_by_, UI::Align::kLeft);
- box_.add(&set_to_, UI::Align::kLeft);
+ box_.add(&change_by_, UI::HAlign::kLeft);
+ box_.add(&set_to_, UI::HAlign::kLeft);
box_.set_size(get_inner_w() - 2 * hmargin(), change_by_.get_h() + set_to_.get_h() + vspacing());
// Add resource buttons
@@ -103,11 +103,11 @@
radiogroup_.add_button(&resources_box_, Vector2i(0, 0),
g_gr->images().get(resource.representative_image()),
resource.descname());
- resources_box_.add(radiogroup_.get_first_button(), UI::Align::kLeft, false, true);
+ resources_box_.add(radiogroup_.get_first_button(), UI::HAlign::kLeft, false, true);
}
box_.add_space(vspacing());
- box_.add(&resources_box_, UI::Align::kLeft, true);
+ box_.add(&resources_box_, UI::HAlign::kLeft, true);
box_.set_size(box_.get_w(), box_.get_h() + 4 * vspacing() + resources_box_.get_h());
radiogroup_.set_state(increase_tool_.get_cur_res());
@@ -119,7 +119,7 @@
// Add label
cur_selection_.set_fixed_width(box_.get_inner_w());
- box_.add(&cur_selection_, UI::Align::kLeft);
+ box_.add(&cur_selection_, UI::HAlign::kLeft);
box_.set_size(box_.get_w(), box_.get_h() + vspacing() + cur_selection_.get_h());
set_inner_size(get_inner_w(), box_.get_h() + 1 * vmargin());
=== modified file 'src/editor/ui_menus/tool_noise_height_options_menu.cc'
--- src/editor/ui_menus/tool_noise_height_options_menu.cc 2017-01-25 18:55:59 +0000
+++ src/editor/ui_menus/tool_noise_height_options_menu.cc 2017-02-21 15:47:40 +0000
@@ -95,15 +95,15 @@
UI::Textarea* label =
new UI::Textarea(&box_, 0, 0, 0, 0, _("Random Height"), UI::Align::kCenter);
label->set_fixed_width(get_inner_w() - 2 * hmargin());
- box_.add(label, UI::Align::kLeft);
- box_.add(&upper_, UI::Align::kLeft);
- box_.add(&lower_, UI::Align::kLeft);
+ box_.add(label, UI::HAlign::kLeft);
+ box_.add(&upper_, UI::HAlign::kLeft);
+ box_.add(&lower_, UI::HAlign::kLeft);
box_.add_space(2 * vspacing());
label = new UI::Textarea(&box_, 0, 0, 0, 0, _("Fixed Height"), UI::Align::kCenter);
label->set_fixed_width(get_inner_w() - 2 * hmargin());
- box_.add(label, UI::Align::kLeft);
- box_.add(&set_to_, UI::Align::kLeft);
+ box_.add(label, UI::HAlign::kLeft);
+ box_.add(&set_to_, UI::HAlign::kLeft);
box_.set_size(get_inner_w() - 2 * hmargin(), upper_.get_h() + lower_.get_h() + set_to_.get_h() +
2 * label->get_h() + 7 * vspacing());
=== modified file 'src/graphic/align.cc'
--- src/graphic/align.cc 2017-01-25 18:55:59 +0000
+++ src/graphic/align.cc 2017-02-21 15:47:40 +0000
@@ -24,55 +24,72 @@
namespace UI {
-// This mirrors the horizontal alignment for RTL languages.
-Align mirror_alignment(Align alignment) {
+/**
+ * This mirrors the horizontal alignment for RTL languages.
+ *
+ * Do not store this value as it is based on the global font setting.
+ */
+HAlign mirror_alignment(HAlign alignment) {
if (UI::g_fh1->fontset()->is_rtl()) {
switch (alignment) {
- case Align::kBottomLeft:
- alignment = Align::kBottomRight;
- break;
- case Align::kBottomRight:
- alignment = Align::kBottomLeft;
- break;
- case Align::kCenterLeft:
- alignment = Align::kCenterRight;
- break;
- case Align::kCenterRight:
- alignment = Align::kCenterLeft;
- break;
- case Align::kTopLeft:
- alignment = Align::kTopRight;
- break;
- case Align::kTopRight:
- alignment = Align::kTopLeft;
- break;
- default:
- break;
+ case HAlign::kLeft: return HAlign::kRight;
+ case HAlign::kRight: return HAlign::kLeft;
+ case HAlign::kHCenter:
+ case HAlign::kHorizontal: ; // no change
}
}
return alignment;
}
+/**
+ * This mirrors the horizontal alignment for RTL languages.
+ *
+ * Do not store this value as it is based on the global font setting.
+ */
+Align mirror_alignment(Align alignment) {
+ if (UI::g_fh1->fontset()->is_rtl()) {
+ int valign = alignment & VAlign::kVertical; // Using VALign correctly will reuslt in more cast only ...
+ return static_cast<Align>(valign | mirror_alignment(static_cast<HAlign>(alignment & HAlign::kHorizontal)));
+ }
+ return alignment;
+}
+
+/**
+ * Align pt horizontly to match align based on width w and height h.
+ *
+ * When correcting for align, we never move from pixel boundaries to
+ * sub-pixels, because this might lead from pixel-perfect rendering to
+ * subsampled rendering - this can lead to blurry texts. That is why we
+ * never do float divisions in this function.
+ */
+void correct_for_align(HAlign align, uint32_t w, Vector2f* pt) {
+
+ if (align & HAlign::kHCenter)
+ pt->x -= w / 2;
+ else if (align & HAlign::kRight)
+ pt->x -= w;
+}
+
+/**
+ * Align pt to match align based on width w and height h.
+ *
+ * When correcting for align, we never move from pixel boundaries to
+ * sub-pixels, because this might lead from pixel-perfect rendering to
+ * subsampled rendering - this can lead to blurry texts. That is why we
+ * never do float divisions in this function.
+ */
void correct_for_align(Align align, uint32_t w, uint32_t h, Vector2f* pt) {
- // When correcting for align, we never move from pixel boundaries to
- // sub-pixels, because this might lead from pixel-perfect rendering to
- // subsampled rendering - this can lead to blurry texts. That is why we
- // never do float divisions in this function.
// Vertical Align
- if (static_cast<int>(align & (Align::kVCenter | Align::kBottom))) {
- if (static_cast<int>(align & Align::kVCenter))
- pt->y -= h / 2;
+ if (align & VAlign::kVertical) {
+ if (align & VAlign::kVCenter)
+ pt->y -= h >> 1;
else
pt->y -= h;
}
- // Horizontal Align
- if ((align & Align::kHorizontal) != Align::kLeft) {
- if (static_cast<int>(align & Align::kHCenter))
- pt->x -= w / 2;
- else if (static_cast<int>(align & Align::kRight))
- pt->x -= w;
+ if (align & HAlign::kHorizontal) {
+ correct_for_align(static_cast<HAlign>(align), w, pt);
}
}
=== modified file 'src/graphic/align.h'
--- src/graphic/align.h 2017-02-17 21:52:41 +0000
+++ src/graphic/align.h 2017-02-21 15:47:40 +0000
@@ -25,42 +25,59 @@
namespace UI {
/**
- * This Enum is a binary mix of one-dimensional and two-dimensional alignments.
- *
- * bits 0,1 values 0,1,2,3 are horizontal
- * bits 2,3 values 0,4,8,12 are vertical
- *
- * mixed aligenments are results of a binary | operation.
- */
-
-// TODO(klaus.halfmann): as this is not a real enum all compiler warnings about
-// incomplete usage are useless.
-
-enum class Align {
- kLeft = 0,
- kHCenter = 1,
- kRight = 2,
- kHorizontal = 3,
-
- kTop = 0,
- kVCenter = 4,
- kBottom = 8,
- kVertical = 12,
-
- kTopLeft = 0,
- kCenterLeft = Align::kVCenter,
- kBottomLeft = Align::kBottom,
-
- kTopCenter = Align::kHCenter,
- kCenter = Align::kHCenter | Align::kVCenter,
- kBottomCenter = Align::kHCenter | Align::kBottom,
-
- kTopRight = Align::kRight,
- kCenterRight = Align::kRight | Align::kVCenter,
-
- kBottomRight = Align::kRight | Align::kBottom,
-};
-
+ * Horizontal alignment.
+ *
+ * bits 0,1 values 0,1,2,3
+ */
+enum HAlign {
+ kLeft = 0x00,
+ kHCenter = 0x01,
+ kRight = 0x02,
+ kHorizontal = 0x03 // Use as bitmask to extract HALign values
+};
+
+extern HAlign mirror_alignment(HAlign alignment);
+
+/** Vertical alignment.
+ *
+ * bits 2,3 values 0,4,8,12
+ */
+
+enum VAlign {
+ kTop = 0x00,
+ kVCenter = 0x04,
+ kBottom = 0x08,
+ kVertical = 0x0C // Use as bitmask to extract VALign values
+};
+
+/**
+ * This is a binary mix of HAlign and VAlign.
+ *
+ * mixed aligenments are results of a binary | operation,
+ * As C++ does not allow to do this by inheritance I must work around this.
+ */
+
+enum Align /* : public HAlign, VAlign */ {
+
+ kTopLeft = kLeft | kTop,
+ kCenterLeft = kLeft | VAlign::kVCenter,
+ kBottomLeft = kLeft | kBottom,
+
+ kTopCenter = kHCenter | kTop,
+ kCenter = kHCenter | kVCenter,
+ kBottomCenter = kHCenter | kBottom,
+
+ kTopRight = kRight | kTop,
+ kCenterRight = kRight | kVCenter,
+ kBottomRight = kRight | kBottom,
+
+};
+
+inline bool isHCenter(HAlign align) {
+ return 0 != (align & HAlign::kHCenter);
+}
+
+/*
inline Align operator&(Align a, Align b) {
return static_cast<Align>(static_cast<int>(a) & static_cast<int>(b));
}
@@ -68,8 +85,12 @@
inline Align operator|(Align a, Align b) {
return static_cast<Align>(static_cast<int>(a) | static_cast<int>(b));
}
+*/
+
Align mirror_alignment(Align alignment);
+
+void correct_for_align(HAlign, uint32_t w, Vector2f* pt);
void correct_for_align(Align, uint32_t w, uint32_t h, Vector2f* pt);
}
#endif // end of include guard: WL_GRAPHIC_ALIGN_H
=== modified file 'src/graphic/richtext.cc'
--- src/graphic/richtext.cc 2017-01-25 18:55:59 +0000
+++ src/graphic/richtext.cc 2017-02-21 15:47:40 +0000
@@ -280,8 +280,8 @@
int32_t alignref_right = rti.width;
if (text_y < rti.height + images_height) {
- if ((mirror_alignment(richtext->get_image_align()) & UI::Align::kHorizontal) ==
- UI::Align::kRight) {
+ if ((mirror_alignment(richtext->get_image_align()) & UI::HAlign::kHorizontal) ==
+ UI::HAlign::kRight) {
alignref_right -= images_width + h_space;
} else {
// Note: center image alignment with text is not properly supported
@@ -292,11 +292,11 @@
int32_t textleft;
- switch (mirror_alignment(richtext->get_text_align()) & UI::Align::kHorizontal) {
- case UI::Align::kRight:
+ switch (mirror_alignment(richtext->get_text_align()) & UI::HAlign::kHorizontal) {
+ case UI::HAlign::kRight:
textleft = alignref_right - int32_t(linewidth);
break;
- case UI::Align::kHCenter:
+ case UI::HAlign::kHCenter:
textleft = alignref_left + (alignref_right - alignref_left - int32_t(linewidth)) / 2;
break;
default:
@@ -372,10 +372,10 @@
// Fix up the alignment
int32_t imagealigndelta = 0;
- if ((text.richtext->get_image_align() & UI::Align::kHorizontal) == UI::Align::kHCenter) {
+ if ((text.richtext->get_image_align() & UI::HAlign::kHorizontal) == UI::HAlign::kHCenter) {
imagealigndelta = (int32_t(m->width) - int32_t(text.images_width)) / 2;
- } else if ((mirror_alignment(text.richtext->get_image_align()) & UI::Align::kHorizontal) ==
- UI::Align::kRight) {
+ } else if ((mirror_alignment(text.richtext->get_image_align()) & UI::HAlign::kHorizontal) ==
+ UI::HAlign::kRight) {
imagealigndelta = int32_t(m->width) - int32_t(text.images_width);
}
=== modified file 'src/graphic/text/rt_render.cc'
--- src/graphic/text/rt_render.cc 2017-01-25 18:55:59 +0000
+++ src/graphic/text/rt_render.cc 2017-02-21 15:47:40 +0000
@@ -71,8 +71,8 @@
int font_style;
uint8_t spacing;
- UI::Align halign;
- UI::Align valign;
+ UI::HAlign halign;
+ UI::VAlign valign;
string reference;
};
@@ -231,17 +231,17 @@
void set_floating(Floating f) {
floating_ = f;
}
- UI::Align halign() {
+ UI::HAlign halign() {
return halign_;
}
- void set_halign(UI::Align ghalign) {
- halign_ = ghalign;
+ void set_halign(UI::HAlign halign) {
+ halign_ = halign;
}
- UI::Align valign() {
+ UI::VAlign valign() {
return valign_;
}
- void set_valign(UI::Align gvalign) {
- valign_ = gvalign;
+ void set_valign(UI::VAlign valign) {
+ valign_ = valign;
}
void set_x(int32_t nx) {
x_ = nx;
@@ -258,8 +258,8 @@
private:
Floating floating_;
- UI::Align halign_;
- UI::Align valign_;
+ UI::HAlign halign_;
+ UI::VAlign valign_;
int32_t x_, y_;
};
@@ -353,8 +353,8 @@
}
} else {
// Take last elements style in this line and check horizontal alignment
- if (!rv->empty() && (*rv->rbegin())->halign() != UI::Align::kLeft) {
- if ((*rv->rbegin())->halign() == UI::Align::kCenter) {
+ if (!rv->empty() && (*rv->rbegin())->halign() != UI::HAlign::kLeft) {
+ if ((*rv->rbegin())->halign() == UI::HAlign::kHCenter) {
remaining_space /= 2; // Otherwise, we align right
}
for (RenderNode* node : *rv) {
@@ -400,10 +400,10 @@
// Go over again and adjust position for VALIGN
for (RenderNode* n : nodes_in_line) {
uint16_t space = line_height - n->height();
- if (!space || n->valign() == UI::Align::kBottom) {
+ if (!space || n->valign() == UI::VAlign::kBottom) {
continue;
}
- if (n->valign() == UI::Align::kCenter) {
+ if (n->valign() == UI::VAlign::kVCenter) {
space /= 2;
}
// Space can become negative, for example when we have mixed fontsets on the same line
@@ -982,22 +982,22 @@
if (a.has("align")) {
const std::string align = a["align"].get_string();
if (align == "right") {
- nodestyle_.halign = UI::Align::kRight;
+ nodestyle_.halign = UI::HAlign::kRight;
} else if (align == "center" || align == "middle") {
- nodestyle_.halign = UI::Align::kCenter;
+ nodestyle_.halign = UI::HAlign::kHCenter;
} else {
- nodestyle_.halign = UI::Align::kLeft;
+ nodestyle_.halign = UI::HAlign::kLeft;
}
}
nodestyle_.halign = mirror_alignment(nodestyle_.halign);
if (a.has("valign")) {
const string align = a["valign"].get_string();
if (align == "bottom") {
- nodestyle_.valign = UI::Align::kBottom;
+ nodestyle_.valign = UI::VAlign::kBottom;
} else if (align == "center" || align == "middle") {
- nodestyle_.valign = UI::Align::kCenter;
+ nodestyle_.valign = UI::VAlign::kVCenter;
} else {
- nodestyle_.valign = UI::Align::kTop;
+ nodestyle_.valign = UI::VAlign::kTop;
}
}
if (a.has("spacing"))
@@ -1214,9 +1214,9 @@
rn->x() + r.dim.x, rn->y() + r.dim.y, r.dim.w, r.dim.h, r.ref);
}
if (shrink_to_fit_) {
- if (rn->halign() == UI::Align::kCenter) {
+ if (rn->halign() == UI::HAlign::kHCenter) {
rn->set_x(rn->x() - extra_width / 2);
- } else if (rn->halign() == UI::Align::kRight) {
+ } else if (rn->halign() == UI::HAlign::kRight) {
rn->set_x(rn->x() - extra_width);
}
}
@@ -1265,11 +1265,11 @@
if (a.has("valign")) {
const string align = a["valign"].get_string();
if (align == "top")
- render_node_->set_valign(UI::Align::kTop);
+ render_node_->set_valign(UI::VAlign::kTop);
else if (align == "bottom")
- render_node_->set_valign(UI::Align::kBottom);
+ render_node_->set_valign(UI::VAlign::kBottom);
else if (align == "center" || align == "middle")
- render_node_->set_valign(UI::Align::kCenter);
+ render_node_->set_valign(UI::VAlign::kVCenter);
}
}
@@ -1377,8 +1377,8 @@
RGBColor(255, 255, 0),
IFont::DEFAULT,
0,
- UI::Align::kLeft,
- UI::Align::kTop,
+ UI::HAlign::kLeft,
+ UI::VAlign::kTop,
""};
RTTagHandler rtrn(
=== modified file 'src/graphic/text_layout.cc'
--- src/graphic/text_layout.cc 2017-02-18 14:03:02 +0000
+++ src/graphic/text_layout.cc 2017-02-21 15:47:40 +0000
@@ -69,11 +69,11 @@
std::string
as_uifont(const std::string& txt, int size, const RGBColor& clr, UI::FontSet::Face face) {
- return as_aligned(txt, UI::Align::kLeft, size, clr, face);
+ return as_aligned(txt, UI::HAlign::kLeft, size, clr, face);
}
std::string
-as_condensed(const std::string& text, UI::Align align, int ptsize, const RGBColor& clr) {
+as_condensed(const std::string& text, UI::HAlign align, int ptsize, const RGBColor& clr) {
return as_aligned(text, align, ptsize, clr, UI::FontSet::Face::kCondensed);
}
@@ -88,14 +88,14 @@
}
std::string as_aligned(const std::string& txt,
- UI::Align align,
+ UI::HAlign align,
int ptsize,
const RGBColor& clr,
UI::FontSet::Face face) {
std::string alignment = "left";
- if ((align & UI::Align::kHorizontal) == UI::Align::kRight) {
+ if (align == UI::HAlign::kRight) {
alignment = "right";
- } else if ((align & UI::Align::kHorizontal) == UI::Align::kHCenter) {
+ } else if (align == UI::HAlign::kHCenter) {
alignment = "center";
}
@@ -145,7 +145,7 @@
if (width > 0) { // Autofit
for (; result->width() > width && fontsize >= kMinimumFontSize; --fontsize) {
result = UI::g_fh1->render(
- as_condensed(richtext_escape(text), UI::Align::kLeft, fontsize, color));
+ as_condensed(richtext_escape(text), UI::HAlign::kLeft, fontsize, color));
}
}
return result;
=== modified file 'src/graphic/text_layout.h'
--- src/graphic/text_layout.h 2017-01-25 18:55:59 +0000
+++ src/graphic/text_layout.h 2017-02-21 15:47:40 +0000
@@ -73,7 +73,7 @@
// Same as as_aligned, but with the condensed font preselected.
std::string as_condensed(const std::string& text,
- UI::Align align = UI::Align::kLeft,
+ UI::HAlign align = UI::HAlign::kLeft,
int ptsize = UI_FONT_SIZE_SMALL,
const RGBColor& clr = UI_FONT_CLR_FG);
@@ -82,7 +82,7 @@
const RGBColor& clr = UI_FONT_CLR_FG);
std::string as_aligned(const std::string& txt,
- UI::Align align,
+ UI::HAlign align,
int ptsize = UI_FONT_SIZE_SMALL,
const RGBColor& clr = UI_FONT_CLR_FG,
UI::FontSet::Face face = UI::FontSet::Face::kSans);
=== modified file 'src/graphic/text_parser.cc'
--- src/graphic/text_parser.cc 2017-01-25 18:55:59 +0000
+++ src/graphic/text_parser.cc 2017-02-21 15:47:40 +0000
@@ -33,7 +33,7 @@
namespace UI {
-RichtextBlock::RichtextBlock() : image_align_(UI::Align::kLeft), text_align_(UI::Align::kLeft) {
+RichtextBlock::RichtextBlock() : image_align_(UI::HAlign::kLeft), text_align_(UI::HAlign::kLeft) {
}
RichtextBlock::RichtextBlock(const RichtextBlock& src) {
@@ -279,8 +279,9 @@
}
}
-Align TextParser::set_align(const std::string& align) {
- return align == "right" ? UI::Align::kRight : align == "center" ? UI::Align::kHCenter :
- UI::Align::kLeft;
+HAlign TextParser::set_align(const std::string& align) {
+ return align == "right" ? UI::HAlign::kRight
+ : align == "center" ? UI::HAlign::kHCenter
+ : UI::HAlign::kLeft;
}
}
=== modified file 'src/graphic/text_parser.h'
--- src/graphic/text_parser.h 2017-01-25 18:55:59 +0000
+++ src/graphic/text_parser.h 2017-02-21 15:47:40 +0000
@@ -133,17 +133,17 @@
return images_;
}
- void set_image_align(Align const image_align) {
+ void set_image_align(HAlign const image_align) {
image_align_ = image_align;
}
- Align get_image_align() const {
+ HAlign get_image_align() const {
return image_align_;
}
- void set_text_align(Align const text_align) {
+ void set_text_align(HAlign const text_align) {
text_align_ = text_align;
}
- Align get_text_align() const {
+ HAlign get_text_align() const {
return text_align_;
}
@@ -157,8 +157,8 @@
private:
std::vector<std::string> images_;
std::vector<TextBlock> text_blocks_;
- Align image_align_;
- Align text_align_;
+ HAlign image_align_;
+ HAlign text_align_;
};
struct TextParser {
@@ -177,7 +177,7 @@
const std::string& block_start,
const std::string& format_end,
const std::string& block_end);
- Align set_align(const std::string&);
+ HAlign set_align(const std::string&);
void split_words(const std::string& in, std::vector<std::string>* plist);
};
}
=== modified file 'src/graphic/wordwrap.cc'
--- src/graphic/wordwrap.cc 2017-01-25 18:55:59 +0000
+++ src/graphic/wordwrap.cc 2017-02-21 15:47:40 +0000
@@ -311,10 +311,11 @@
calc_wrapped_pos(caret, caretline, caretpos);
- if ((align & UI::Align::kVertical) != UI::Align::kTop) {
+ VAlign valign = static_cast<VAlign>(align & UI::VAlign::kVertical);
+ if (valign != UI::VAlign::kTop) {
uint32_t h = height();
- if ((align & UI::Align::kVertical) == UI::Align::kVCenter)
+ if (valign == UI::VAlign::kVCenter)
where.y -= (h + 1) / 2;
else
where.y -= h;
@@ -331,7 +332,7 @@
Vector2f point(where.x, where.y);
- if (static_cast<int>(alignment & UI::Align::kRight)) {
+ if (alignment & UI::HAlign::kRight) {
point.x += wrapwidth_ - LINE_MARGIN;
}
=== modified file 'src/graphic/wordwrap.h'
--- src/graphic/wordwrap.h 2017-01-25 18:55:59 +0000
+++ src/graphic/wordwrap.h 2017-02-21 15:47:40 +0000
@@ -51,7 +51,7 @@
void draw(RenderTarget& dst,
Vector2i where,
- Align align = UI::Align::kLeft,
+ Align align = UI::Align::kTopLeft,
uint32_t caret = std::numeric_limits<uint32_t>::max());
void calc_wrapped_pos(uint32_t caret, uint32_t& line, uint32_t& pos) const;
=== modified file 'src/logic/map_objects/map_object.cc'
--- src/logic/map_objects/map_object.cc 2017-01-25 18:55:59 +0000
+++ src/logic/map_objects/map_object.cc 2017-02-21 15:47:40 +0000
@@ -469,7 +469,7 @@
// We always render this so we can have a stable position for the statistics string.
const Image* rendered_census_info =
- UI::g_fh1->render(as_condensed(census, UI::Align::kCenter, font_size), 120);
+ UI::g_fh1->render(as_condensed(census, UI::HAlign::kHCenter, font_size), 120);
// Rounding guarantees that text aligns with pixels to avoid subsampling.
const Vector2f census_pos = round(field_on_dst - Vector2f(0, 48) * scale).cast<float>();
@@ -482,7 +482,7 @@
round(census_pos + Vector2f(0, rendered_census_info->height() / 2.f + 10 * scale))
.cast<float>();
dst->blit(statistics_pos,
- UI::g_fh1->render(as_condensed(statictics, UI::Align::kLeft, font_size)),
+ UI::g_fh1->render(as_condensed(statictics, UI::HAlign::kLeft, font_size)),
BlendMode::UseAlpha, UI::Align::kCenter);
}
}
=== modified file 'src/ui_basic/box.cc'
--- src/ui_basic/box.cc 2017-02-14 18:11:53 +0000
+++ src/ui_basic/box.cc 2017-02-21 15:47:40 +0000
@@ -252,7 +252,7 @@
* This can be used to make buttons fill a box completely.
*
*/
-void Box::add(Panel* const panel, UI::Align const align, bool fullsize, bool fillspace) {
+void Box::add(Panel* const panel, UI::HAlign const align, bool fullsize, bool fillspace) {
Item it;
it.type = Item::ItemPanel;
@@ -376,15 +376,15 @@
maxbreadth = get_inner_w();
}
switch (it.u.panel.align) {
- case UI::Align::kHCenter:
+ case UI::HAlign::kHCenter:
breadth = (maxbreadth - breadth) / 2;
break;
- case UI::Align::kRight:
+ case UI::HAlign::kRight:
breadth = maxbreadth - breadth;
break;
- case UI::Align::kLeft:
- default:
+ case UI::HAlign::kLeft:
+ case UI::HAlign::kHorizontal: // should not be used but makes the enum complete
breadth = 0;
}
=== modified file 'src/ui_basic/box.h'
--- src/ui_basic/box.h 2017-01-25 18:55:59 +0000
+++ src/ui_basic/box.h 2017-02-21 15:47:40 +0000
@@ -31,11 +31,12 @@
/**
* A layouting panel that holds a number of child panels.
+ *
* The Panels you add to the Box must be children of the Box.
* The Box automatically resizes itself and positions the added children.
*/
struct Box : public Panel {
- enum {
+ enum { // TODO(klaus.halfmann): what exactly is the sematic here? compare HALign::kHorizontal / VAlign:kVertical
Horizontal = 0,
Vertical = 1,
};
@@ -54,7 +55,7 @@
return items_.size();
}
- void add(Panel* panel, UI::Align align, bool fullsize = false, bool fillspace = false);
+ void add(Panel* panel, UI::HAlign align = kLeft, bool fullsize = false, bool fillspace = false);
void add_space(uint32_t space);
void add_inf_space();
bool is_snap_target() const override {
@@ -90,7 +91,7 @@
union {
struct {
Panel* panel;
- UI::Align align;
+ UI::HAlign align;
bool fullsize;
} panel;
int space;
=== modified file 'src/ui_basic/checkbox.cc'
--- src/ui_basic/checkbox.cc 2017-02-12 09:10:57 +0000
+++ src/ui_basic/checkbox.cc 2017-02-21 15:47:40 +0000
@@ -153,7 +153,7 @@
image_anchor.x = rendered_text_->width() + kPadding;
image_anchor.y = (get_h() - kStateboxSize) / 2;
}
- dst.blit(text_anchor, rendered_text_, BlendMode::UseAlpha, UI::Align::kLeft);
+ dst.blit(text_anchor, rendered_text_, BlendMode::UseAlpha, UI::Align::kTopLeft);
}
dst.blitrect(
=== modified file 'src/ui_basic/dropdown.cc'
--- src/ui_basic/dropdown.cc 2017-01-25 18:55:59 +0000
+++ src/ui_basic/dropdown.cc 2017-02-21 15:47:40 +0000
@@ -73,8 +73,8 @@
list_.set_visible(false);
list_.set_background(background);
display_button_.set_perm_pressed(true);
- button_box_.add(&display_button_, UI::Align::kLeft);
- button_box_.add(&push_button_, UI::Align::kLeft);
+ button_box_.add(&display_button_, UI::HAlign::kLeft);
+ button_box_.add(&push_button_, UI::HAlign::kLeft);
button_box_.set_size(w, get_h());
display_button_.sigclicked.connect(boost::bind(&BaseDropdown::toggle_list, this));
=== modified file 'src/ui_basic/editbox.cc'
--- src/ui_basic/editbox.cc 2017-02-18 14:03:02 +0000
+++ src/ui_basic/editbox.cc 2017-02-21 15:47:40 +0000
@@ -24,6 +24,7 @@
#include <SDL_keycode.h>
#include <boost/format.hpp>
+#include "graphic/align.h"
#include "graphic/font_handler1.h"
#include "graphic/graphic.h"
#include "graphic/rendertarget.h"
@@ -67,8 +68,9 @@
/// Current scrolling offset to the text anchor position, in pixels
int32_t scrolloffset;
- /// Alignment of the text. Vertical alignment is always centered.
- Align align;
+ /// Horizontal Alignment of the text. Vertical alignment is always centered.
+ /// Better: this is is the write direction (Left to Right =^= kLeft, Right to Left =^= kRight)
+ HAlign align; // so undefined in case kHCentered is used
};
EditBox::EditBox(Panel* const parent,
@@ -80,17 +82,16 @@
const Image* background,
int font_size)
: Panel(parent,
- x,
- y,
- w,
- h > 0 ? h :
+ x, y,
+ w, h > 0 ? h :
UI::g_fh1->render(as_editorfont(UI::g_fh1->fontset()->representative_character(),
font_size))
->height() +
2 * margin_y),
- m_(new EditBoxImpl),
- history_active_(false),
- history_position_(-1) {
+ m_(new EditBoxImpl),
+ history_active_(false),
+ history_position_(-1)
+{
set_thinks(false);
m_->background = background;
@@ -98,7 +99,7 @@
m_->fontsize = font_size;
// Set alignment to the UI language's principal writing direction
- m_->align = UI::g_fh1->fontset()->is_rtl() ? UI::Align::kCenterRight : UI::Align::kCenterLeft;
+ m_->align = UI::g_fh1->fontset()->is_rtl() ? UI::HAlign::kRight : UI::HAlign::kLeft;
m_->caret = 0;
m_->scrolloffset = 0;
// yes, use *signed* max as maximum length; just a small safe-guard.
@@ -352,8 +353,7 @@
return true;
}
-void EditBox::draw(RenderTarget& odst) {
- RenderTarget& dst = odst;
+void EditBox::draw(RenderTarget& dst) {
// Draw the background
dst.tile(Recti(0, 0, get_w(), get_h()), m_->background, Vector2i(get_x(), get_y()));
@@ -390,26 +390,27 @@
->height() :
entry_text_im->height();
- Vector2f point(kMarginX, get_h() / 2.f);
+ Vector2f point(kMarginX, get_h() / 2.0f);
- if (static_cast<int>(m_->align & UI::Align::kRight)) {
+ if (m_->align & UI::HAlign::kRight) {
point.x += max_width;
}
- UI::correct_for_align(m_->align, linewidth, lineheight, &point);
+ UI::correct_for_align(m_->align, linewidth, &point);
+ point.y -= lineheight >> 1;
// Crop to max_width while blitting
if (max_width < linewidth) {
// Fix positioning for BiDi languages.
if (UI::g_fh1->fontset()->is_rtl()) {
- point.x = 0.f;
+ point.x = 0.0f;
}
// We want this always on, e.g. for mixed language savegame filenames
if (i18n::has_rtl_character(m_->text.c_str(), 100)) { // Restrict check for efficiency
// TODO(GunChleoc): Arabic: Fix scrolloffset
dst.blitrect(point, entry_text_im, Recti(linewidth - max_width, 0, linewidth, lineheight));
} else {
- if (static_cast<int>(m_->align & UI::Align::kRight)) {
+ if (m_->align & UI::HAlign::kRight) {
// TODO(GunChleoc): Arabic: Fix scrolloffset
dst.blitrect(point, entry_text_im,
Recti(point.x + m_->scrolloffset + kMarginX, 0, max_width, lineheight));
@@ -448,11 +449,13 @@
int32_t caretpos;
- switch (m_->align & UI::Align::kHorizontal) {
- case UI::Align::kRight:
+ switch (m_->align) {
+ case kRight:
caretpos = get_w() - kMarginX + m_->scrolloffset - rightw;
break;
- default:
+ case kLeft:
+ case kHCenter:
+ case kHorizontal:
caretpos = kMarginX + m_->scrolloffset + leftw;
}
@@ -461,10 +464,10 @@
else if (caretpos > get_w() - kMarginX)
m_->scrolloffset -= caretpos - get_w() + kMarginX + get_w() / 5;
- if ((m_->align & UI::Align::kHorizontal) == UI::Align::kLeft) {
+ if (m_->align == HAlign::kLeft) {
if (m_->scrolloffset > 0)
m_->scrolloffset = 0;
- } else if ((m_->align & UI::Align::kHorizontal) == UI::Align::kRight) {
+ } else if (m_->align == HAlign::kRight) {
if (m_->scrolloffset < 0)
m_->scrolloffset = 0;
}
=== modified file 'src/ui_basic/editbox.h'
--- src/ui_basic/editbox.h 2017-02-12 09:10:57 +0000
+++ src/ui_basic/editbox.h 2017-02-21 15:47:40 +0000
@@ -25,7 +25,6 @@
#include <SDL_keyboard.h>
#include <boost/signals2.hpp>
-#include "graphic/align.h"
#include "graphic/graphic.h"
#include "ui_basic/button.h"
=== modified file 'src/ui_basic/fullscreen_window.cc'
--- src/ui_basic/fullscreen_window.cc 2017-01-25 18:55:59 +0000
+++ src/ui_basic/fullscreen_window.cc 2017-02-21 15:47:40 +0000
@@ -93,14 +93,14 @@
}
// Frame edges
- blit_image(dst, get_frame_image(FullscreenWindow::Frames::kEdgeLeftTile), UI::Align::kTopLeft,
- UI::Align::kVertical);
- blit_image(dst, get_frame_image(FullscreenWindow::Frames::kEdgeRightTile), UI::Align::kTopRight,
- UI::Align::kVertical);
- blit_image(dst, get_frame_image(FullscreenWindow::Frames::kEdgeTopTile), UI::Align::kTopLeft,
- UI::Align::kHorizontal);
+ blit_image(dst, get_frame_image(FullscreenWindow::Frames::kEdgeLeftTile),
+ UI::Align::kTopLeft, UI::VAlign::kVertical);
+ blit_image(dst, get_frame_image(FullscreenWindow::Frames::kEdgeRightTile),
+ UI::Align::kTopRight, UI::VAlign::kVertical);
+ blit_image(dst, get_frame_image(FullscreenWindow::Frames::kEdgeTopTile),
+ UI::Align::kTopLeft, UI::HAlign::kHorizontal);
blit_image(dst, get_frame_image(FullscreenWindow::Frames::kEdgeBottomTile),
- UI::Align::kBottomLeft, UI::Align::kHorizontal);
+ UI::Align::kBottomLeft, UI::HAlign::kHorizontal);
// Frame corners
blit_image(dst, get_frame_image(FullscreenWindow::Frames::kCornerTopLeft), UI::Align::kTopLeft);
@@ -112,27 +112,34 @@
dst, get_frame_image(FullscreenWindow::Frames::kCornerBottomRight), UI::Align::kBottomRight);
}
+/**
+ *
+ * tiling may be a bitwiswe combination of kHorizontal or kVertial.
+ */
+
void FullscreenWindow::blit_image(RenderTarget& dst,
const Image* image,
UI::Align align,
- UI::Align tiling) {
+ int tiling) {
if (image) {
int x = 0;
int y = 0;
- if (static_cast<int>(align & UI::Align::kRight)) {
+ // Check HAlign
+ if (align & UI::HAlign::kRight) {
x = get_w() - image->width();
- } else if (static_cast<int>(align & UI::Align::kHCenter)) {
+ } else if (align & UI::HAlign::kHCenter) {
x = (get_w() - image->width()) / 2;
}
- if (static_cast<int>(align & UI::Align::kBottom)) {
+ // Check VAlign
+ if (align & UI::VAlign::kBottom) {
y = get_h() - image->height();
- } else if (static_cast<int>(align & UI::Align::kVCenter)) {
+ } else if (align & UI::VAlign::kVCenter) {
y = (get_h() - image->height()) / 2;
}
- if (static_cast<int>(tiling & (UI::Align::kVertical | UI::Align::kHorizontal))) {
- const int w = (static_cast<int>(tiling & UI::Align::kVertical)) ? image->width() : get_w();
- const int h =
- (static_cast<int>(tiling & UI::Align::kHorizontal)) ? image->height() : get_h();
+
+ if (tiling & (UI::VAlign::kVertical | UI::HAlign::kHorizontal)) {
+ const int w = (tiling & UI::VAlign::kVertical) ? image->width() : get_w();
+ const int h = (tiling & UI::HAlign::kHorizontal) ? image->height() : get_h();
dst.tile(Recti(x, y, w, h), image, Vector2i(0, 0));
} else {
dst.blit(Vector2f(x, y), image);
=== modified file 'src/ui_basic/fullscreen_window.h'
--- src/ui_basic/fullscreen_window.h 2017-01-25 18:55:59 +0000
+++ src/ui_basic/fullscreen_window.h 2017-02-21 15:47:40 +0000
@@ -85,7 +85,7 @@
void blit_image(RenderTarget& dst,
const Image* image,
UI::Align align,
- UI::Align tiling = UI::Align::kLeft);
+ int tiling = 0);
const std::string background_image_;
/// These overlay images will be blitted in the order they were added and according to the given
=== modified file 'src/ui_basic/listselect.cc'
--- src/ui_basic/listselect.cc 2017-02-12 09:10:57 +0000
+++ src/ui_basic/listselect.cc 2017-02-21 15:47:40 +0000
@@ -400,13 +400,14 @@
er.pic);
}
- Align alignment =
- i18n::has_rtl_character(er.name.c_str(), 20) ? UI::Align::kRight : UI::Align::kLeft;
- if (static_cast<int>(alignment & UI::Align::kRight)) {
+ HAlign alignment =
+ i18n::has_rtl_character(er.name.c_str(), 20) ? HAlign::kRight : HAlign::kLeft;
+ if (alignment & UI::HAlign::kRight) {
point.x += maxw - picw;
}
- UI::correct_for_align(alignment, entry_text_im->width(), entry_text_im->height(), &point);
+ UI::correct_for_align(alignment, entry_text_im->width(), &point);
+ // TODO(klaus.halfmann) do we need? entry_text_im->height()
// Shift for image width
if (!UI::g_fh1->fontset()->is_rtl()) {
@@ -427,8 +428,8 @@
}
// Crop to column width while blitting
- if (static_cast<int>(alignment & UI::Align::kRight) &&
- (maxw + picw) < static_cast<uint32_t>(entry_text_im->width())) {
+ if ((alignment & UI::HAlign::kRight)
+ && (maxw + picw) < static_cast<uint32_t>(entry_text_im->width())) {
// Fix positioning for BiDi languages.
point.x = 0;
=== modified file 'src/ui_basic/messagebox.cc'
--- src/ui_basic/messagebox.cc 2017-01-25 18:55:59 +0000
+++ src/ui_basic/messagebox.cc 2017-02-21 15:47:40 +0000
@@ -30,7 +30,7 @@
const std::string& caption,
const std::string& text,
const MBoxType type,
- Align align)
+ HAlign align)
: Window(parent, "message_box", 0, 0, 20, 20, caption.c_str()), type_(type) {
// Calculate textarea dimensions depending on text size
const int outerwidth = parent ? parent->get_inner_w() : g_gr->get_xres();
=== modified file 'src/ui_basic/messagebox.h'
--- src/ui_basic/messagebox.h 2017-01-25 18:55:59 +0000
+++ src/ui_basic/messagebox.h 2017-02-21 15:47:40 +0000
@@ -32,8 +32,9 @@
namespace UI {
/**
- * Shows a standard messagebox. The message box can be used either as a modal
- * or as a non-modal dialog box.
+ * Shows a standard messagebox.
+ *
+ * The message box can be used either as a modal or as a non-modal dialog box.
*
* Using it as a modal dialog box is very straightforward:
* WLMessageBox mb(parent, "Title", "Text", MBoxType::kOK);
@@ -56,7 +57,7 @@
const std::string& caption,
const std::string& text,
MBoxType,
- Align = UI::Align::kCenter);
+ HAlign = kHCenter);
boost::signals2::signal<void()> ok;
boost::signals2::signal<void()> cancel;
=== modified file 'src/ui_basic/multilineeditbox.cc'
--- src/ui_basic/multilineeditbox.cc 2017-01-25 18:55:59 +0000
+++ src/ui_basic/multilineeditbox.cc 2017-02-21 15:47:40 +0000
@@ -450,7 +450,7 @@
d_->ww.set_draw_caret(has_focus());
- d_->ww.draw(dst, Vector2i(0, -int32_t(d_->scrollbar.get_scrollpos())), UI::Align::kLeft,
+ d_->ww.draw(dst, Vector2i(0, -int32_t(d_->scrollbar.get_scrollpos())), UI::Align::kTopLeft,
has_focus() ? d_->cursor_pos : std::numeric_limits<uint32_t>::max());
}
=== modified file 'src/ui_basic/multilinetextarea.cc'
--- src/ui_basic/multilinetextarea.cc 2017-02-18 14:03:02 +0000
+++ src/ui_basic/multilinetextarea.cc 2017-02-21 15:47:40 +0000
@@ -37,12 +37,13 @@
const uint32_t w,
const uint32_t h,
const std::string& text,
- const Align align,
+ const HAlign align,
const Image* button_background,
MultilineTextarea::ScrollMode scroll_mode)
: Panel(parent, x, y, w, h),
text_(text),
color_(UI_FONT_CLR_FG),
+ align_(align),
force_new_renderer_(false),
use_old_renderer_(false),
scrollbar_(this, get_w() - Scrollbar::kSize, 0, Scrollbar::kSize, h, button_background, false),
@@ -51,9 +52,6 @@
assert(scrollmode_ == MultilineTextarea::ScrollMode::kNoScrolling || Scrollbar::kSize <= w);
set_thinks(false);
- // do not allow vertical alignment as it does not make sense
- align_ = align & UI::Align::kHorizontal;
-
scrollbar_.moved.connect(boost::bind(&MultilineTextarea::scrollpos_changed, this, _1));
scrollbar_.set_singlestepsize(
@@ -163,15 +161,16 @@
if (blit_width > 0 && blit_height > 0) {
int anchor = 0;
- Align alignment = mirror_alignment(align_);
- switch (alignment & UI::Align::kHorizontal) {
- case UI::Align::kHCenter:
+ HAlign alignment = mirror_alignment(align_);
+ switch (alignment) {
+ case UI::HAlign::kHCenter:
anchor = (get_eff_w() - blit_width) / 2;
break;
- case UI::Align::kRight:
+ case UI::HAlign::kRight:
anchor = get_eff_w() - blit_width - RICHTEXT_MARGIN;
break;
- default:
+ case UI::HAlign::kLeft:
+ case UI::HAlign::kHorizontal:
anchor = RICHTEXT_MARGIN;
}
=== modified file 'src/ui_basic/multilinetextarea.h'
--- src/ui_basic/multilinetextarea.h 2017-01-25 18:55:59 +0000
+++ src/ui_basic/multilinetextarea.h 2017-02-21 15:47:40 +0000
@@ -52,7 +52,7 @@
const uint32_t w,
const uint32_t h,
const std::string& text = std::string(),
- const Align = UI::Align::kLeft,
+ const HAlign = HAlign::kLeft,
const Image* button_background = g_gr->images().get("images/ui_basic/but3.png"),
MultilineTextarea::ScrollMode scroll_mode = MultilineTextarea::ScrollMode::kScrollNormal);
@@ -95,7 +95,7 @@
std::string text_;
RGBColor color_;
- Align align_;
+ HAlign align_;
bool force_new_renderer_;
bool use_old_renderer_;
=== modified file 'src/ui_basic/slider.cc'
--- src/ui_basic/slider.cc 2017-02-18 14:03:02 +0000
+++ src/ui_basic/slider.cc 2017-02-21 15:47:40 +0000
@@ -510,10 +510,9 @@
w - (w / labels_in.size()) + cursor_size,
h -
UI::g_fh1->render(as_condensed(UI::g_fh1->fontset()->representative_character(),
- UI::Align::kLeft,
+ UI::HAlign::kLeft,
UI_FONT_SIZE_SMALL - 2))
- ->height() -
- 2,
+ ->height() - 2,
0,
labels_in.size() - 1,
value_,
@@ -540,8 +539,8 @@
for (uint32_t i = 0; i < labels.size(); i++) {
dst.blit(Vector2f(gap_1 + i * gap_n, get_h()),
UI::g_fh1->render(
- as_condensed(labels[i], UI::Align::kBottomCenter, UI_FONT_SIZE_SMALL - 2)),
- BlendMode::UseAlpha, UI::Align::kBottomCenter);
+ as_condensed(labels[i], UI::HAlign::kHCenter, UI_FONT_SIZE_SMALL - 2)),
+ BlendMode::UseAlpha, UI::Align::kCenter);
}
}
@@ -560,9 +559,8 @@
w - (w / labels.size()) + slider.cursor_size_,
h -
UI::g_fh1->render(as_condensed(UI::g_fh1->fontset()->representative_character(),
- UI::Align::kLeft, UI_FONT_SIZE_SMALL - 2))
- ->height() +
- 2);
+ UI::HAlign::kLeft, UI_FONT_SIZE_SMALL - 2))
+ ->height() + 2);
Panel::layout();
}
}
=== modified file 'src/ui_basic/spinbox.cc'
--- src/ui_basic/spinbox.cc 2017-01-25 18:55:59 +0000
+++ src/ui_basic/spinbox.cc 2017-02-21 15:47:40 +0000
@@ -110,9 +110,9 @@
box_ = new UI::Box(this, 0, 0, UI::Box::Horizontal, 0, 0, padding_);
sbi_->label =
- new UI::MultilineTextarea(box_, 0, 0, 0, 0, label_text, UI::Align::kLeft, button_background,
+ new UI::MultilineTextarea(box_, 0, 0, 0, 0, label_text, UI::HAlign::kLeft, button_background,
UI::MultilineTextarea::ScrollMode::kNoScrolling);
- box_->add(sbi_->label, UI::Align::kHCenter);
+ box_->add(sbi_->label, UI::HAlign::kHCenter);
sbi_->text = new UI::Textarea(box_, "", UI::Align::kCenter);
@@ -148,15 +148,15 @@
buttons_.push_back(sbi_->button_ten_minus);
buttons_.push_back(sbi_->button_ten_plus);
- box_->add(sbi_->button_ten_minus, UI::Align::kTop);
- box_->add(sbi_->button_minus, UI::Align::kTop);
- box_->add(sbi_->text, UI::Align::kTop);
- box_->add(sbi_->button_plus, UI::Align::kTop);
- box_->add(sbi_->button_ten_plus, UI::Align::kTop);
+ box_->add(sbi_->button_ten_minus, UI::HAlign::kLeft);
+ box_->add(sbi_->button_minus, UI::HAlign::kLeft);
+ box_->add(sbi_->text, UI::HAlign::kLeft);
+ box_->add(sbi_->button_plus, UI::HAlign::kLeft);
+ box_->add(sbi_->button_ten_plus, UI::HAlign::kLeft);
} else {
- box_->add(sbi_->button_minus, UI::Align::kHCenter);
- box_->add(sbi_->text, UI::Align::kHCenter);
- box_->add(sbi_->button_plus, UI::Align::kHCenter);
+ box_->add(sbi_->button_minus, UI::HAlign::kHCenter);
+ box_->add(sbi_->text, UI::HAlign::kHCenter);
+ box_->add(sbi_->button_plus, UI::HAlign::kHCenter);
}
sbi_->button_plus->sigclicked.connect(
=== modified file 'src/ui_basic/table.cc'
--- src/ui_basic/table.cc 2017-02-12 09:10:57 +0000
+++ src/ui_basic/table.cc 2017-02-21 15:47:40 +0000
@@ -97,7 +97,7 @@
void Table<void*>::add_column(uint32_t const width,
const std::string& title,
const std::string& tooltip_string,
- Align const alignment,
+ HAlign const alignment,
TableColumnType column_type,
bool const is_checkbox_column) {
// If there would be existing entries, they would not get the new column.
@@ -259,7 +259,7 @@
for (uint32_t i = 0, curx = 0; i < nr_columns; ++i) {
const Column& column = columns_[i];
int const curw = column.width;
- Align alignment = mirror_alignment(column.alignment);
+ HAlign alignment = mirror_alignment(column.alignment);
const Image* entry_picture = er.get_picture(i);
const std::string& entry_string = er.get_string(i);
@@ -289,7 +289,7 @@
}
}
- if (static_cast<int>(alignment & UI::Align::kRight)) {
+ if (alignment & UI::HAlign::kRight) { // TODO(klaus.halfmann): what about kCenter?
draw_x += curw - blit_width;
}
@@ -306,7 +306,7 @@
} else {
draw_x = point.x + (curw - picw) / 2.f;
}
- } else if (static_cast<int>(alignment & UI::Align::kRight)) {
+ } else if (alignment & UI::HAlign::kRight) {
draw_x += curw - picw;
}
dst.blit(Vector2f(draw_x, point.y + (lineheight - pich) / 2.f), entry_picture);
@@ -322,9 +322,9 @@
}
const Image* entry_text_im = UI::g_fh1->render(as_uifont(richtext_escape(entry_string)));
- if (static_cast<int>(alignment & UI::Align::kRight)) {
+ if (alignment & UI::HAlign::kRight) {
point.x += curw - 2 * picw;
- } else if (static_cast<int>(alignment & UI::Align::kHCenter)) {
+ } else if (alignment & UI::HAlign::kHCenter) {
point.x += (curw - picw) / 2.f;
}
@@ -333,13 +333,14 @@
if (i == nr_columns - 1 && scrollbar_->is_enabled()) {
text_width = text_width + scrollbar_->get_w();
}
- UI::correct_for_align(alignment, text_width, entry_text_im->height(), &point);
+ UI::correct_for_align(alignment, text_width, &point);
+ // TODO (klaus.halfmann): Check if we need entry_text_im->height()
// Crop to column width while blitting
if ((curw + picw) < text_width) {
// Fix positioning for BiDi languages.
if (UI::g_fh1->fontset()->is_rtl()) {
- point.x = static_cast<int>(alignment & UI::Align::kRight) ? curx : curx + picw;
+ point.x = (alignment & UI::HAlign::kRight) ? curx : curx + picw;
}
// We want this always on, e.g. for mixed language savegame filenames
if (i18n::has_rtl_character(
=== modified file 'src/ui_basic/table.h'
--- src/ui_basic/table.h 2017-02-12 09:10:57 +0000
+++ src/ui_basic/table.h 2017-02-21 15:47:40 +0000
@@ -67,7 +67,7 @@
void add_column(uint32_t width,
const std::string& title = std::string(),
const std::string& tooltip = std::string(),
- Align = UI::Align::kLeft,
+ HAlign = HAlign::kLeft,
TableColumnType column_type = TableColumnType::kFixed,
bool is_checkbox_column = false);
@@ -181,7 +181,7 @@
void add_column(uint32_t width,
const std::string& title = std::string(),
const std::string& tooltip = std::string(),
- Align = UI::Align::kLeft,
+ HAlign = HAlign::kLeft,
TableColumnType column_type = TableColumnType::kFixed,
bool is_checkbox_column = false);
@@ -282,7 +282,7 @@
struct Column {
Button* btn;
uint32_t width;
- Align alignment;
+ HAlign alignment;
bool is_checkbox_column;
CompareFn compare;
};
=== modified file 'src/ui_basic/tabpanel.cc'
--- src/ui_basic/tabpanel.cc 2017-02-12 09:10:57 +0000
+++ src/ui_basic/tabpanel.cc 2017-02-21 15:47:40 +0000
@@ -302,7 +302,7 @@
} else {
dst.blit(Vector2f(x + kTabPanelTextMargin,
(kTabPanelButtonHeight - tabs_[idx]->pic->height()) / 2),
- tabs_[idx]->pic, BlendMode::UseAlpha, UI::Align::kLeft);
+ tabs_[idx]->pic, BlendMode::UseAlpha, UI::Align::kTopLeft);
}
// Draw top part of border
=== modified file 'src/ui_basic/textarea.cc'
--- src/ui_basic/textarea.cc 2017-02-18 14:03:02 +0000
+++ src/ui_basic/textarea.cc 2017-02-21 15:47:40 +0000
@@ -126,12 +126,10 @@
void Textarea::draw(RenderTarget& dst) {
if (!text_.empty()) {
// Blit on pixel boundary (not float), so that the text is blitted pixel perfect.
- Vector2f anchor(static_cast<int>(align_ & UI::Align::kHCenter) ?
- get_w() / 2 :
- static_cast<int>(align_ & UI::Align::kRight) ? get_w() : 0,
- static_cast<int>(align_ & UI::Align::kVCenter) ?
- get_h() / 2 :
- static_cast<int>(align_ & UI::Align::kBottom) ? get_h() : 0);
+ Vector2f anchor((align_ & HAlign::kHCenter) ? get_w() / 2 :
+ (align_ & UI::HAlign::kRight) ? get_w() : 0,
+ (align_ & UI::VAlign::kVCenter) ? get_h() / 2 :
+ (align_ & UI::VAlign::kBottom) ? get_h() : 0);
dst.blit(anchor, rendered_text_, BlendMode::UseAlpha, align_);
}
}
@@ -145,14 +143,14 @@
int32_t w = get_w();
int32_t h = get_h();
- if (static_cast<int>(align_ & UI::Align::kHCenter))
+ if (align_ & UI::HAlign::kHCenter)
x += w >> 1;
- else if (static_cast<int>(align_ & UI::Align::kRight))
+ else if (align_ & UI::HAlign::kRight)
x += w;
- if (static_cast<int>(align_ & UI::Align::kVCenter))
+ if (align_ & UI::VAlign::kVCenter)
y += h >> 1;
- else if (static_cast<int>(align_ & UI::Align::kBottom))
+ else if (align_ & UI::VAlign::kBottom)
y += h;
set_pos(Vector2i(x, y));
@@ -170,14 +168,14 @@
int w, h;
get_desired_size(&w, &h);
- if (static_cast<int>(align_ & UI::Align::kHCenter))
+ if (align_ & UI::HAlign::kHCenter)
x -= w >> 1;
- else if (static_cast<int>(align_ & UI::Align::kRight))
+ else if (align_ & UI::HAlign::kRight)
x -= w;
- if (static_cast<int>(align_ & UI::Align::kVCenter))
+ if (align_ & UI::VAlign::kVCenter)
y -= h >> 1;
- else if (static_cast<int>(align_ & UI::Align::kBottom))
+ else if (align_ & UI::VAlign::kBottom)
y -= h;
set_pos(Vector2i(x, y));
=== modified file 'src/ui_basic/textarea.h'
--- src/ui_basic/textarea.h 2017-01-25 18:55:59 +0000
+++ src/ui_basic/textarea.h 2017-02-21 15:47:40 +0000
@@ -53,17 +53,17 @@
int32_t x,
int32_t y,
const std::string& text = std::string(),
- Align align = UI::Align::kLeft);
+ Align align = kTopLeft);
Textarea(
- Panel* parent, int32_t x, int32_t y, uint32_t w, uint32_t h, Align align = UI::Align::kLeft);
+ Panel* parent, int32_t x, int32_t y, uint32_t w, uint32_t h, Align align = kTopLeft);
Textarea(Panel* const parent,
int32_t x,
int32_t y,
uint32_t w,
uint32_t h,
const std::string& text,
- Align align = UI::Align::kLeft);
- Textarea(Panel* parent, const std::string& text = std::string(), Align align = UI::Align::kLeft);
+ Align align = kTopLeft);
+ Textarea(Panel* parent, const std::string& text = std::string(), Align align = kTopLeft);
/**
* If fixed_width > 0, the Textarea will not change its width.
=== modified file 'src/ui_fsmenu/campaign_select.cc'
--- src/ui_fsmenu/campaign_select.cc 2017-01-25 18:55:59 +0000
+++ src/ui_fsmenu/campaign_select.cc 2017-02-21 15:47:40 +0000
@@ -45,10 +45,10 @@
table_(this, tablex_, tabley_, tablew_, tableh_),
// Main Title
- title_(this, get_w() / 2, tabley_ / 3, _("Choose a campaign"), UI::Align::kHCenter),
+ title_(this, get_w() / 2, tabley_ / 3, _("Choose a campaign"), UI::Align::kTopCenter),
// Campaign description
- label_campname_(this, right_column_x_, tabley_, "", UI::Align::kLeft),
+ label_campname_(this, right_column_x_, tabley_, "", UI::Align::kTopLeft),
ta_campname_(this,
right_column_x_ + indent_,
get_y_from_preceding(label_campname_) + padding_,
@@ -59,7 +59,7 @@
right_column_x_,
get_y_from_preceding(ta_campname_) + 2 * padding_,
"",
- UI::Align::kLeft),
+ UI::Align::kTopLeft),
ta_tribename_(this,
right_column_x_ + indent_,
get_y_from_preceding(label_tribename_) + padding_,
@@ -70,7 +70,7 @@
right_column_x_,
get_y_from_preceding(ta_tribename_) + 2 * padding_,
"",
- UI::Align::kLeft),
+ UI::Align::kTopLeft),
ta_difficulty_(this,
right_column_x_ + indent_,
get_y_from_preceding(label_difficulty_) + padding_,
@@ -81,7 +81,7 @@
right_column_x_,
get_y_from_preceding(ta_difficulty_) + 2 * padding_,
_("Description:"),
- UI::Align::kLeft),
+ UI::Align::kTopLeft),
ta_description_(this,
right_column_x_ + indent_,
get_y_from_preceding(label_description_) + padding_,
@@ -103,10 +103,10 @@
boost::bind(&FullscreenMenuCampaignSelect::clicked_ok, boost::ref(*this)));
/** TRANSLATORS: Campaign difficulty table header */
- table_.add_column(45, _("Diff."), _("Difficulty"), UI::Align::kLeft);
- table_.add_column(100, _("Tribe"), _("Tribe Name"), UI::Align::kLeft);
+ table_.add_column(45, _("Diff."), _("Difficulty"), UI::HAlign::kLeft);
+ table_.add_column(100, _("Tribe"), _("Tribe Name"), UI::HAlign::kLeft);
table_.add_column(
- 0, _("Campaign Name"), _("Campaign Name"), UI::Align::kLeft, UI::TableColumnType::kFlexible);
+ 0, _("Campaign Name"), _("Campaign Name"), UI::HAlign::kLeft, UI::TableColumnType::kFlexible);
table_.set_column_compare(
0, boost::bind(&FullscreenMenuCampaignSelect::compare_difficulty, this, _1, _2));
table_.set_sort_column(0);
@@ -267,7 +267,8 @@
*/
/**
- * CampaignMapSelect UI
+ * CampaignMapSelect UI.
+ *
* Loads a list of all visible maps of selected campaign and let's the user
* choose one.
*/
@@ -280,17 +281,17 @@
get_w() / 2,
tabley_ / 3,
is_tutorial ? _("Choose a tutorial") : _("Choose a scenario"),
- UI::Align::kHCenter),
+ UI::Align::kTopCenter),
subtitle_(this,
get_w() / 6,
get_y_from_preceding(title_) + 6 * padding_,
get_w() * 2 / 3,
4 * label_height_,
"",
- UI::Align::kHCenter),
+ UI::HAlign::kHCenter),
// Map description
- label_mapname_(this, right_column_x_, tabley_, "", UI::Align::kLeft),
+ label_mapname_(this, right_column_x_, tabley_, "", UI::Align::kTopLeft),
ta_mapname_(this,
right_column_x_ + indent_,
get_y_from_preceding(label_mapname_) + padding_,
@@ -301,7 +302,7 @@
right_column_x_,
get_y_from_preceding(ta_mapname_) + 2 * padding_,
"",
- UI::Align::kLeft),
+ UI::Align::kTopLeft),
ta_author_(this,
right_column_x_ + indent_,
get_y_from_preceding(label_author_) + padding_,
@@ -309,7 +310,7 @@
2 * label_height_),
label_description_(
- this, right_column_x_, get_y_from_preceding(ta_author_) + padding_, "", UI::Align::kLeft),
+ this, right_column_x_, get_y_from_preceding(ta_author_) + padding_, "", UI::Align::kTopLeft),
ta_description_(this,
right_column_x_ + indent_,
get_y_from_preceding(label_description_) + padding_,
@@ -347,9 +348,9 @@
}
/** TRANSLATORS: Campaign scenario number table header */
- table_.add_column(35, _("#"), number_tooltip, UI::Align::kLeft);
+ table_.add_column(35, _("#"), number_tooltip, UI::HAlign::kLeft);
table_.add_column(
- 0, name_tooltip, name_tooltip, UI::Align::kLeft, UI::TableColumnType::kFlexible);
+ 0, name_tooltip, name_tooltip, UI::HAlign::kLeft, UI::TableColumnType::kFlexible);
table_.set_sort_column(0);
table_.focus();
=== modified file 'src/ui_fsmenu/helpwindow.cc'
--- src/ui_fsmenu/helpwindow.cc 2017-02-12 09:10:57 +0000
+++ src/ui_fsmenu/helpwindow.cc 2017-02-21 15:47:40 +0000
@@ -41,7 +41,7 @@
: Window(
parent, "help_window", 0, 0, width, height, (boost::format(_("Help: %s")) % caption).str()),
textarea_(new MultilineTextarea(
- this, 5, 5, width - 10, height - 30, std::string(), UI::Align::kLeft)) {
+ this, 5, 5, width - 10, height - 30, std::string(), UI::HAlign::kLeft)) {
int margin = 5;
// Calculate sizes
=== modified file 'src/ui_fsmenu/internet_lobby.cc'
--- src/ui_fsmenu/internet_lobby.cc 2017-01-25 18:55:59 +0000
+++ src/ui_fsmenu/internet_lobby.cc 2017-02-21 15:47:40 +0000
@@ -48,7 +48,7 @@
prev_clientlist_len_(1000),
// Text labels
- title(this, get_w() / 2, get_h() / 20, _("Metaserver Lobby"), UI::Align::kHCenter),
+ title(this, get_w() / 2, get_h() / 20, _("Metaserver Lobby"), UI::Align::kTopCenter),
clients_(this, get_w() * 4 / 125, get_h() * 15 / 100, _("Clients online:")),
opengames_(this, get_w() * 17 / 25, get_h() * 15 / 100, _("List of games:")),
servername_(this, get_w() * 17 / 25, get_h() * 63 / 100, _("Name of your server:")),
@@ -136,7 +136,7 @@
clientsonline_list_.add_column((lisw_ - 22) * 3 / 8, pgettext("player", "Name"));
clientsonline_list_.add_column((lisw_ - 22) * 2 / 8, _("Version"));
clientsonline_list_.add_column(
- 0, _("Game"), "", UI::Align::kLeft, UI::TableColumnType::kFlexible);
+ 0, _("Game"), "", UI::HAlign::kLeft, UI::TableColumnType::kFlexible);
clientsonline_list_.set_column_compare(
0, boost::bind(&FullscreenMenuInternetLobby::compare_clienttype, this, _1, _2));
clientsonline_list_.double_clicked.connect(
@@ -367,7 +367,7 @@
"There seems to be a network problem, either on your side or on the side\n"
"of the server.\n"));
UI::WLMessageBox mmb(this, _("Connection timed out"), warning,
- UI::WLMessageBox::MBoxType::kOk, UI::Align::kLeft);
+ UI::WLMessageBox::MBoxType::kOk, UI::HAlign::kLeft);
mmb.run<UI::Panel::Returncodes>();
return InternetGaming::ref().set_error();
}
@@ -394,7 +394,7 @@
std::string warningheader(_("Connection problem"));
std::string warning(_("Widelands was unable to connect to the host."));
UI::WLMessageBox mmb(
- this, warningheader, warning, UI::WLMessageBox::MBoxType::kOk, UI::Align::kLeft);
+ this, warningheader, warning, UI::WLMessageBox::MBoxType::kOk, UI::HAlign::kLeft);
mmb.run<UI::Panel::Returncodes>();
}
SDLNet_ResolveHost(&peer, ip.c_str(), WIDELANDS_PORT);
=== modified file 'src/ui_fsmenu/intro.cc'
--- src/ui_fsmenu/intro.cc 2017-02-12 09:10:57 +0000
+++ src/ui_fsmenu/intro.cc 2017-02-21 15:47:40 +0000
@@ -29,7 +29,7 @@
get_w() / 2,
get_h() * 19 / 20,
_("Press any key or click to continue…"),
- UI::Align::kHCenter) {
+ UI::Align::kTopCenter) {
message_.set_fontsize(fs_small() * 6 / 5);
message_.set_color(RGBColor(192, 192, 128));
add_overlay_image("images/loadscreens/splash.jpg", UI::Align::kCenter);
=== modified file 'src/ui_fsmenu/launch_mpg.cc'
--- src/ui_fsmenu/launch_mpg.cc 2017-01-25 18:55:59 +0000
+++ src/ui_fsmenu/launch_mpg.cc 2017-02-21 15:47:40 +0000
@@ -154,7 +154,7 @@
_("Show the help window")),
// Text labels
- title_(this, get_w() / 2, get_h() / 25, _("Multiplayer Game Setup"), UI::Align::kHCenter),
+ title_(this, get_w() / 2, get_h() / 25, _("Multiplayer Game Setup"), UI::Align::kTopCenter),
mapname_(this, right_column_x_, get_h() * 3 / 20, std::string()),
clients_(this,
// (get_w() * 57 / 80) is the width of the MultiPlayerSetupGroup
@@ -163,20 +163,20 @@
(get_w() * 57 / 80) / 3,
get_h() / 10,
_("Clients"),
- UI::Align::kHCenter),
+ UI::Align::kTopCenter),
players_(this,
get_w() / 50 + (get_w() * 57 / 80) * 6 / 15,
get_h() / 10,
(get_w() * 57 / 80) * 9 / 15,
get_h() / 10,
_("Players"),
- UI::Align::kHCenter),
- map_(this, right_column_x_, get_h() / 10, butw_, get_h() / 10, _("Map"), UI::Align::kHCenter),
+ UI::Align::kTopCenter),
+ map_(this, right_column_x_, get_h() / 10, butw_, get_h() / 10, _("Map"), UI::Align::kTopCenter),
wincondition_type_(this,
right_column_x_ + (butw_ / 2),
get_h() * 10 / 20 - 1.5 * label_height_,
_("Type of game"),
- UI::Align::kHCenter),
+ UI::Align::kTopCenter),
map_info_(
this, right_column_x_, get_h() * 2 / 10, butw_, get_h() * 23 / 80 - 2 * label_height_),
=== modified file 'src/ui_fsmenu/launch_spg.cc'
--- src/ui_fsmenu/launch_spg.cc 2017-01-25 18:55:59 +0000
+++ src/ui_fsmenu/launch_spg.cc 2017-02-21 15:47:40 +0000
@@ -84,39 +84,39 @@
_("Start game")),
// Text labels
- title_(this, get_w() / 2, get_h() / 10, _("Launch Game"), UI::Align::kHCenter),
+ title_(this, get_w() / 2, get_h() / 10, _("Launch Game"), UI::Align::kTopCenter),
mapname_(this,
get_w() * 7 / 10 + butw_ / 2,
get_h() * 53 / 200 - 15,
std::string(),
- UI::Align::kHCenter),
- name_(this, get_w() * 1 / 25, get_h() * 53 / 200 - 15, _("Player’s name"), UI::Align::kLeft),
+ UI::Align::kTopCenter),
+ name_(this, get_w() * 1 / 25, get_h() * 53 / 200 - 15, _("Player’s name"), UI::Align::kTopLeft),
type_(this,
// (Element x) + (PlayerDescriptionGroup x) + border
((get_w() * 16 / 25) * 35 / 125) + (get_w() / 25) + 2,
get_h() * 53 / 200 - 15,
_("Player’s type"),
- UI::Align::kLeft),
+ UI::Align::kTopLeft),
team_(this,
((get_w() * 16 / 25) * 35 / 125) + (get_w() / 25) + 2,
get_h() * 53 / 200,
_("Team"),
- UI::Align::kLeft),
+ UI::Align::kTopLeft),
tribe_(this,
((get_w() * 16 / 25) * 80 / 125) + (get_w() / 25) + 2,
get_h() * 53 / 200 - 15,
_("Player’s tribe"),
- UI::Align::kLeft),
+ UI::Align::kTopLeft),
init_(this,
((get_w() * 16 / 25) * 55 / 125) + (get_w() / 25) + 2,
get_h() * 53 / 200,
_("Start type"),
- UI::Align::kLeft),
+ UI::Align::kTopLeft),
wincondition_type_(this,
get_w() * 7 / 10 + (butw_ / 2),
get_h() * 7 / 20 + buth_,
_("Type of game"),
- UI::Align::kHCenter),
+ UI::Align::kCenter),
// Variables and objects used in the menu
settings_(settings),
=== modified file 'src/ui_fsmenu/loadgame.cc'
--- src/ui_fsmenu/loadgame.cc 2017-01-25 18:55:59 +0000
+++ src/ui_fsmenu/loadgame.cc 2017-02-21 15:47:40 +0000
@@ -99,10 +99,10 @@
get_w() / 2,
tabley_ / 3,
is_replay_ ? _("Choose a replay") : _("Choose a saved game"),
- UI::Align::kHCenter),
+ UI::Align::kTopCenter),
// Savegame description
- label_mapname_(this, right_column_x_, tabley_, "", UI::Align::kLeft),
+ label_mapname_(this, right_column_x_, tabley_, "", UI::Align::kTopLeft),
ta_mapname_(this,
right_column_x_ + indent_,
get_y_from_preceding(label_mapname_) + padding_,
@@ -113,7 +113,7 @@
right_column_x_,
get_y_from_preceding(ta_mapname_) + 2 * padding_,
"",
- UI::Align::kLeft),
+ UI::Align::kTopLeft),
ta_gametime_(this,
right_column_tab_,
label_gametime_.get_y(),
@@ -121,21 +121,21 @@
label_height_),
label_players_(
- this, right_column_x_, get_y_from_preceding(ta_gametime_), "", UI::Align::kLeft),
+ this, right_column_x_, get_y_from_preceding(ta_gametime_), "", UI::Align::kTopLeft),
ta_players_(this,
right_column_tab_,
label_players_.get_y(),
get_right_column_w(right_column_tab_),
label_height_),
- label_version_(this, right_column_x_, get_y_from_preceding(ta_players_), "", UI::Align::kLeft),
- ta_version_(this, right_column_tab_, label_version_.get_y(), "", UI::Align::kLeft),
+ label_version_(this, right_column_x_, get_y_from_preceding(ta_players_), "", UI::Align::kTopLeft),
+ ta_version_(this, right_column_tab_, label_version_.get_y(), "", UI::Align::kTopLeft),
label_win_condition_(this,
right_column_x_,
get_y_from_preceding(ta_version_) + 3 * padding_,
"",
- UI::Align::kLeft),
+ UI::Align::kTopLeft),
ta_win_condition_(this,
right_column_x_ + indent_,
get_y_from_preceding(label_win_condition_) + padding_,
@@ -194,7 +194,7 @@
ok_.sigclicked.connect(boost::bind(&FullscreenMenuLoadGame::clicked_ok, boost::ref(*this)));
delete_.sigclicked.connect(
boost::bind(&FullscreenMenuLoadGame::clicked_delete, boost::ref(*this)));
- table_.add_column(130, _("Save Date"), _("The date this game was saved"), UI::Align::kLeft);
+ table_.add_column(130, _("Save Date"), _("The date this game was saved"), UI::HAlign::kLeft);
if (is_replay_ || settings_->settings().multiplayer) {
std::vector<std::string> modes;
if (is_replay_) {
@@ -222,12 +222,12 @@
/** TRANSLATORS: Keep this to 5 letters maximum. */
/** TRANSLATORS: A tooltip will explain if you need to use an abbreviation. */
_("Mode"), (boost::format("%s %s") % mode_tooltip_1 % mode_tooltip_2).str(),
- UI::Align::kLeft);
+ UI::HAlign::kLeft);
}
table_.add_column(0, _("Description"),
_("The filename that the game was saved under followed by the map’s name, "
"or the map’s name followed by the last objective achieved."),
- UI::Align::kLeft, UI::TableColumnType::kFlexible);
+ UI::HAlign::kLeft, UI::TableColumnType::kFlexible);
table_.set_column_compare(
0, boost::bind(&FullscreenMenuLoadGame::compare_date_descending, this, _1, _2));
table_.selected.connect(boost::bind(&FullscreenMenuLoadGame::entry_selected, this));
=== modified file 'src/ui_fsmenu/main.cc'
--- src/ui_fsmenu/main.cc 2017-01-25 18:55:59 +0000
+++ src/ui_fsmenu/main.cc 2017-02-21 15:47:40 +0000
@@ -31,82 +31,58 @@
// Buttons
playtutorial(&vbox_,
"play_tutorial",
- 0,
- 0,
- butw_,
- buth_,
+ 0, 0, butw_, buth_,
g_gr->images().get(button_background_),
_("Play Tutorial")),
singleplayer(&vbox_,
"single_player",
- 0,
- 0,
- butw_,
- buth_,
+ 0, 0, butw_, buth_,
g_gr->images().get(button_background_),
_("Single Player")),
multiplayer(&vbox_,
"multi_player",
- 0,
- 0,
- butw_,
- buth_,
+ 0, 0, butw_, buth_,
g_gr->images().get(button_background_),
_("Multiplayer")),
replay(&vbox_,
"replay",
- 0,
- 0,
- butw_,
- buth_,
+ 0, 0, butw_, buth_,
g_gr->images().get(button_background_),
_("Watch Replay")),
editor(
&vbox_, "editor", 0, 0, butw_, buth_, g_gr->images().get(button_background_), _("Editor")),
options(&vbox_,
"options",
- 0,
- 0,
- butw_,
- buth_,
+ 0, 0, butw_, buth_,
g_gr->images().get(button_background_),
_("Options")),
about(&vbox_,
"about",
- 0,
- 0,
- butw_,
- buth_,
+ 0, 0, butw_, buth_,
g_gr->images().get(button_background_),
_("About Widelands")),
exit(&vbox_,
"exit",
- 0,
- 0,
- butw_,
- buth_,
+ 0, 0, butw_, buth_,
g_gr->images().get(button_background_),
_("Exit Widelands")),
// Textlabels
version(
this,
- 0,
- 0,
+ 0, 0,
/** TRANSLATORS: %1$s = version string, %2%s = "Debug" or "Release" */
(boost::format(_("Version %1$s (%2$s)")) % build_id().c_str() % build_type().c_str()).str(),
UI::Align::kBottomRight),
copyright(this,
- 0,
- 0,
+ 0, 0,
/** TRANSLATORS: Placeholders are the copyright years */
(boost::format(_("(C) %1%-%2% by the Widelands Development Team")) %
kWidelandsCopyrightStart % kWidelandsCopyrightEnd)
.str(),
UI::Align::kBottomLeft),
gpl(this,
- 0,
- 0,
+ 0, 0,
_("Licensed under the GNU General Public License V2.0"),
UI::Align::kBottomLeft) {
playtutorial.sigclicked.connect(
@@ -134,19 +110,19 @@
boost::bind(&FullscreenMenuMain::end_modal<FullscreenMenuBase::MenuTarget>, boost::ref(*this),
FullscreenMenuBase::MenuTarget::kExit));
- vbox_.add(&playtutorial, UI::Align::kHCenter, true);
- vbox_.add(&singleplayer, UI::Align::kHCenter, true);
- vbox_.add(&multiplayer, UI::Align::kHCenter, true);
- vbox_.add_inf_space();
- vbox_.add(&replay, UI::Align::kHCenter, true);
- vbox_.add_inf_space();
- vbox_.add(&editor, UI::Align::kHCenter, true);
- vbox_.add_inf_space();
- vbox_.add(&options, UI::Align::kHCenter, true);
- vbox_.add_inf_space();
- vbox_.add(&about, UI::Align::kHCenter, true);
- vbox_.add_inf_space();
- vbox_.add(&exit, UI::Align::kHCenter, true);
+ vbox_.add(&playtutorial, UI::HAlign::kHCenter, true);
+ vbox_.add(&singleplayer, UI::HAlign::kHCenter, true);
+ vbox_.add(&multiplayer, UI::HAlign::kHCenter, true);
+ vbox_.add_inf_space();
+ vbox_.add(&replay, UI::HAlign::kHCenter, true);
+ vbox_.add_inf_space();
+ vbox_.add(&editor, UI::HAlign::kHCenter, true);
+ vbox_.add_inf_space();
+ vbox_.add(&options, UI::HAlign::kHCenter, true);
+ vbox_.add_inf_space();
+ vbox_.add(&about, UI::HAlign::kHCenter, true);
+ vbox_.add_inf_space();
+ vbox_.add(&exit, UI::HAlign::kHCenter, true);
add_overlay_image("images/ui_fsmenu/main_title.png", UI::Align::kTopCenter);
=== modified file 'src/ui_fsmenu/mapselect.cc'
--- src/ui_fsmenu/mapselect.cc 2017-01-25 18:55:59 +0000
+++ src/ui_fsmenu/mapselect.cc 2017-02-21 15:47:40 +0000
@@ -46,7 +46,7 @@
checkbox_padding_(UI::g_fh1->fontset()->size_offset() > 0 ? 0 : 2 * padding_),
// Main title
- title_(this, 0, 0, _("Choose a map"), UI::Align::kHCenter),
+ title_(this, 0, 0, _("Choose a map"), UI::Align::kTopCenter),
checkboxes_(this, 0, 0, UI::Box::Vertical, 0, 0, 2 * padding_),
table_(this, tablex_, tabley_, tablew_, tableh_, false),
map_details_(this,
@@ -92,8 +92,8 @@
tags_checkboxes_.clear(); // Remove this again, it is a special tag checkbox
cb_show_all_maps_->set_state(true);
- hbox->add(cb_dont_localize_mapnames_, UI::Align::kLeft, true);
- checkboxes_.add(hbox, UI::Align::kLeft, true);
+ hbox->add(cb_dont_localize_mapnames_, UI::HAlign::kLeft, true);
+ checkboxes_.add(hbox, UI::HAlign::kLeft, true);
hbox = new UI::Box(&checkboxes_, 0, 0, UI::Box::Horizontal, checkbox_space_, get_w());
add_tag_checkbox(hbox, "official", localize_tag("official"));
@@ -101,18 +101,18 @@
add_tag_checkbox(hbox, "seafaring", localize_tag("seafaring"));
add_tag_checkbox(hbox, "artifacts", localize_tag("artifacts"));
add_tag_checkbox(hbox, "scenario", localize_tag("scenario"));
- checkboxes_.add(hbox, UI::Align::kLeft, true);
+ checkboxes_.add(hbox, UI::HAlign::kLeft, true);
hbox = new UI::Box(&checkboxes_, 0, 0, UI::Box::Horizontal, checkbox_space_, get_w());
add_tag_checkbox(hbox, "ffa", localize_tag("ffa"));
add_tag_checkbox(hbox, "1v1", localize_tag("1v1"));
- checkboxes_.add(hbox, UI::Align::kLeft, true);
+ checkboxes_.add(hbox, UI::HAlign::kLeft, true);
hbox = new UI::Box(&checkboxes_, 0, 0, UI::Box::Horizontal, checkbox_space_, get_w());
add_tag_checkbox(hbox, "2teams", localize_tag("2teams"));
add_tag_checkbox(hbox, "3teams", localize_tag("3teams"));
add_tag_checkbox(hbox, "4teams", localize_tag("4teams"));
- checkboxes_.add(hbox, UI::Align::kLeft, true);
+ checkboxes_.add(hbox, UI::HAlign::kLeft, true);
scenario_types_ = settings_->settings().multiplayer ? Map::MP_SCENARIO : Map::SP_SCENARIO;
@@ -305,7 +305,7 @@
UI::Checkbox* cb = new UI::Checkbox(box, Vector2i(0, 0), displ_name);
cb->changedto.connect(boost::bind(&FullscreenMenuMapSelect::tagbox_changed, this, id, _1));
- box->add(cb, UI::Align::kLeft, true);
+ box->add(cb, UI::HAlign::kLeft, true);
box->add_space(checkbox_space_);
tags_checkboxes_.push_back(cb);
=== modified file 'src/ui_fsmenu/multiplayer.cc'
--- src/ui_fsmenu/multiplayer.cc 2017-01-25 18:55:59 +0000
+++ src/ui_fsmenu/multiplayer.cc 2017-02-21 15:47:40 +0000
@@ -30,24 +30,18 @@
: FullscreenMenuMainMenu(),
// Title
- title(this, 0, 0, _("Choose game type"), UI::Align::kHCenter),
+ title(this, 0, 0, _("Choose game type"), UI::Align::kTopCenter),
// Buttons
metaserver(&vbox_,
"metaserver",
- 0,
- 0,
- butw_,
- buth_,
+ 0, 0, butw_, buth_,
g_gr->images().get(button_background_),
_("Internet game")),
showloginbox(nullptr),
lan(&vbox_,
"lan",
- 0,
- 0,
- butw_,
- buth_,
+ 0, 0, butw_, buth_,
g_gr->images().get(button_background_),
_("LAN / Direct IP")),
back(&vbox_, "back", 0, 0, butw_, buth_, g_gr->images().get(button_background_), _("Back")) {
@@ -64,10 +58,10 @@
title.set_fontsize(fs_big());
- vbox_.add(&metaserver, UI::Align::kHCenter, true);
- vbox_.add(&lan, UI::Align::kHCenter, true);
+ vbox_.add(&metaserver, UI::HAlign::kHCenter, true);
+ vbox_.add(&lan, UI::HAlign::kHCenter, true);
vbox_.add_inf_space();
- vbox_.add(&back, UI::Align::kHCenter, true);
+ vbox_.add(&back, UI::HAlign::kHCenter, true);
Section& s = g_options.pull_section("global");
auto_log_ = s.get_bool("auto_log", false);
=== modified file 'src/ui_fsmenu/netsetup_lan.cc'
--- src/ui_fsmenu/netsetup_lan.cc 2017-01-25 18:55:59 +0000
+++ src/ui_fsmenu/netsetup_lan.cc 2017-02-21 15:47:40 +0000
@@ -37,7 +37,7 @@
listw_(get_w() * 9 / 16),
// Text labels
- title(this, get_w() / 2, get_h() / 10, _("Begin Network Game"), UI::Align::kHCenter),
+ title(this, get_w() / 2, get_h() / 10, _("Begin Network Game"), UI::Align::kTopCenter),
opengames_(
this, get_w() * 3 / 50, get_h() * 27 / 100, _("List of games in your local network:")),
playername_(this, get_w() * 16 / 25, get_h() * 27 / 100, _("Your nickname:")),
=== modified file 'src/ui_fsmenu/options.cc'
--- src/ui_fsmenu/options.cc 2017-01-28 14:53:28 +0000
+++ src/ui_fsmenu/options.cc 2017-02-21 15:47:40 +0000
@@ -95,34 +95,26 @@
padding_(10),
// Title
- title_(this, 0, 0, _("Options"), UI::Align::kHCenter),
+ title_(this, 0, 0, _("Options"), UI::Align::kTopCenter),
// Buttons
button_box_(this, 0, 0, UI::Box::Horizontal),
cancel_(&button_box_,
"cancel",
- 0,
- 0,
- 0,
- 0,
+ 0, 0, 0, 0,
g_gr->images().get("images/ui_basic/but0.png"),
_("Cancel")),
apply_(&button_box_,
"apply",
- 0,
- 0,
- 0,
- 0,
+ 0, 0, 0, 0,
g_gr->images().get("images/ui_basic/but0.png"),
_("Apply")),
ok_(&button_box_, "ok", 0, 0, 0, 0, g_gr->images().get("images/ui_basic/but2.png"), _("OK")),
// Tabs
tabs_(this,
- 0,
- 0,
- 100, // 100 is arbitrary, will be resized in layout().
- 100,
+ 0, 0,
+ 100, 100, // 100 is arbitrary, will be resized in layout().
g_gr->images().get("images/ui_basic/but1.png"),
UI::TabPanel::Type::kBorder),
@@ -134,16 +126,12 @@
// Interface options
language_dropdown_(&box_interface_,
- 0,
- 0,
- 100, // 100 is arbitrary, will be resized in layout().
- 100, // 100 is arbitrary, will be resized in layout().
+ 0, 0,
+ 100, 100, // 100 is arbitrary, will be resized in layout().
_("Language")),
resolution_dropdown_(&box_interface_,
- 0,
- 0,
- 100, // 100 is arbitrary, will be resized in layout().
- 100, // 100 is arbitrary, will be resized in layout().
+ 0, 0,
+ 100, 100, // 100 is arbitrary, will be resized in layout().
_("In-game resolution")),
fullscreen_(&box_interface_, Vector2i(0, 0), _("Fullscreen"), "", 0),
@@ -157,10 +145,7 @@
dock_windows_to_edges_(&box_windows_, Vector2i(0, 0), _("Dock windows to edges"), "", 0),
sb_dis_panel_(&box_windows_,
- 0,
- 0,
- 0,
- 0,
+ 0, 0, 0, 0,
opt.panel_snap_distance,
0,
99,
@@ -168,10 +153,7 @@
UI::SpinBox::Units::kPixels),
sb_dis_border_(&box_windows_,
- 0,
- 0,
- 0,
- 0,
+ 0, 0, 0, 0,
opt.border_snap_distance,
0,
99,
@@ -185,10 +167,7 @@
// Saving options
sb_autosave_(&box_saving_,
- 0,
- 0,
- 0,
- 0,
+ 0, 0, 0, 0,
opt.autosave / 60,
0,
100,
@@ -198,10 +177,7 @@
UI::SpinBox::Type::kBig),
sb_rolling_autosave_(&box_saving_,
- 0,
- 0,
- 0,
- 0,
+ 0, 0, 0, 0,
opt.rolling_autosave,
1,
20,
@@ -236,11 +212,11 @@
title_.set_fontsize(UI_FONT_SIZE_BIG);
// Buttons
- button_box_.add(UI::g_fh1->fontset()->is_rtl() ? &ok_ : &cancel_, UI::Align::kHCenter);
- button_box_.add_inf_space();
- button_box_.add(&apply_, UI::Align::kHCenter);
- button_box_.add_inf_space();
- button_box_.add(UI::g_fh1->fontset()->is_rtl() ? &cancel_ : &ok_, UI::Align::kHCenter);
+ button_box_.add(UI::g_fh1->fontset()->is_rtl() ? &ok_ : &cancel_);
+ button_box_.add_inf_space();
+ button_box_.add(&apply_);
+ button_box_.add_inf_space();
+ button_box_.add(UI::g_fh1->fontset()->is_rtl() ? &cancel_ : &ok_);
// Tabs
tabs_.add("options_interface", _("Interface"), &box_interface_, "");
@@ -261,34 +237,34 @@
box_game_.set_size(tabs_.get_inner_w(), tabs_.get_inner_h());
// Interface
- box_interface_.add(&language_dropdown_, UI::Align::kLeft);
- box_interface_.add(&resolution_dropdown_, UI::Align::kLeft);
- box_interface_.add(&fullscreen_, UI::Align::kLeft);
- box_interface_.add(&inputgrab_, UI::Align::kLeft);
- box_interface_.add(&sb_maxfps_, UI::Align::kLeft);
+ box_interface_.add(&language_dropdown_);
+ box_interface_.add(&resolution_dropdown_);
+ box_interface_.add(&fullscreen_);
+ box_interface_.add(&inputgrab_);
+ box_interface_.add(&sb_maxfps_);
// Windows
- box_windows_.add(&snap_win_overlap_only_, UI::Align::kLeft);
- box_windows_.add(&dock_windows_to_edges_, UI::Align::kLeft);
- box_windows_.add(&sb_dis_panel_, UI::Align::kLeft);
- box_windows_.add(&sb_dis_border_, UI::Align::kLeft);
+ box_windows_.add(&snap_win_overlap_only_);
+ box_windows_.add(&dock_windows_to_edges_);
+ box_windows_.add(&sb_dis_panel_);
+ box_windows_.add(&sb_dis_border_);
// Sound
- box_sound_.add(&music_, UI::Align::kLeft);
- box_sound_.add(&fx_, UI::Align::kLeft);
- box_sound_.add(&message_sound_, UI::Align::kLeft);
+ box_sound_.add(&music_);
+ box_sound_.add(&fx_);
+ box_sound_.add(&message_sound_);
// Saving
- box_saving_.add(&sb_autosave_, UI::Align::kLeft);
- box_saving_.add(&sb_rolling_autosave_, UI::Align::kLeft);
- box_saving_.add(&zip_, UI::Align::kLeft);
- box_saving_.add(&write_syncstreams_, UI::Align::kLeft);
+ box_saving_.add(&sb_autosave_);
+ box_saving_.add(&sb_rolling_autosave_);
+ box_saving_.add(&zip_);
+ box_saving_.add(&write_syncstreams_);
// Game
- box_game_.add(&auto_roadbuild_mode_, UI::Align::kLeft);
- box_game_.add(&show_workarea_preview_, UI::Align::kLeft);
- box_game_.add(&transparent_chat_, UI::Align::kLeft);
- box_game_.add(&single_watchwin_, UI::Align::kLeft);
+ box_game_.add(&auto_roadbuild_mode_);
+ box_game_.add(&show_workarea_preview_);
+ box_game_.add(&transparent_chat_);
+ box_game_.add(&single_watchwin_);
// Bind actions
cancel_.sigclicked.connect(boost::bind(&FullscreenMenuOptions::clicked_back, this));
=== modified file 'src/ui_fsmenu/singleplayer.cc'
--- src/ui_fsmenu/singleplayer.cc 2017-01-25 18:55:59 +0000
+++ src/ui_fsmenu/singleplayer.cc 2017-02-21 15:47:40 +0000
@@ -27,31 +27,22 @@
: FullscreenMenuMainMenu(),
// Title
- title(this, 0, 0, _("Single Player"), UI::Align::kHCenter),
+ title(this, 0, 0, _("Single Player"), UI::Align::kTopCenter),
// Buttons
new_game(&vbox_,
"new_game",
- 0,
- 0,
- butw_,
- buth_,
+ 0, 0, butw_, buth_,
g_gr->images().get(button_background_),
_("New Game")),
campaign(&vbox_,
"campaigns",
- 0,
- 0,
- butw_,
- buth_,
+ 0, 0, butw_, buth_,
g_gr->images().get(button_background_),
_("Campaigns")),
load_game(&vbox_,
"load_game",
- 0,
- 0,
- butw_,
- buth_,
+ 0, 0, butw_, buth_,
g_gr->images().get(button_background_),
_("Load Game")),
back(&vbox_, "back", 0, 0, butw_, buth_, g_gr->images().get(button_background_), _("Back")) {
@@ -70,14 +61,14 @@
title.set_fontsize(fs_big());
- vbox_.add(&new_game, UI::Align::kHCenter, true);
- vbox_.add(&campaign, UI::Align::kHCenter, true);
- vbox_.add_inf_space();
- vbox_.add(&load_game, UI::Align::kHCenter, true);
- vbox_.add_inf_space();
- vbox_.add_inf_space();
- vbox_.add_inf_space();
- vbox_.add(&back, UI::Align::kHCenter, true);
+ vbox_.add(&new_game, UI::HAlign::kHCenter, true);
+ vbox_.add(&campaign, UI::HAlign::kHCenter, true);
+ vbox_.add_inf_space();
+ vbox_.add(&load_game, UI::HAlign::kHCenter, true);
+ vbox_.add_inf_space();
+ vbox_.add_inf_space();
+ vbox_.add_inf_space();
+ vbox_.add(&back, UI::HAlign::kHCenter, true);
layout();
}
=== modified file 'src/wlapplication.cc'
--- src/wlapplication.cc 2017-01-25 18:55:59 +0000
+++ src/wlapplication.cc 2017-02-21 15:47:40 +0000
@@ -987,7 +987,7 @@
log("\n%s\n%s\n", messagetitle.c_str(), message.c_str());
UI::WLMessageBox mmb(
- &mm, messagetitle, message, UI::WLMessageBox::MBoxType::kOk, UI::Align::kLeft);
+ &mm, messagetitle, message, UI::WLMessageBox::MBoxType::kOk, UI::HAlign::kLeft);
mmb.run<UI::Panel::Returncodes>();
message.clear();
=== modified file 'src/wui/actionconfirm.cc'
--- src/wui/actionconfirm.cc 2017-01-25 18:55:59 +0000
+++ src/wui/actionconfirm.cc 2017-02-21 15:47:40 +0000
@@ -133,7 +133,7 @@
UI::Box* button_box = new UI::Box(main_box, 0, 0, UI::Box::Horizontal);
UI::MultilineTextarea* textarea =
- new UI::MultilineTextarea(main_box, 0, 0, 200, 74, message, UI::Align::kCenter,
+ new UI::MultilineTextarea(main_box, 0, 0, 200, 74, message, UI::HAlign::kHCenter,
g_gr->images().get("images/ui_basic/but1.png"),
UI::MultilineTextarea::ScrollMode::kNoScrolling);
textarea->force_new_renderer();
@@ -149,13 +149,13 @@
cancelbtn->sigclicked.connect(boost::bind(&ActionConfirm::die, this));
button_box->add(
- UI::g_fh1->fontset()->is_rtl() ? okbtn : cancelbtn, UI::Align::kLeft, false, true);
+ UI::g_fh1->fontset()->is_rtl() ? okbtn : cancelbtn, UI::HAlign::kLeft, false, true);
button_box->add_space(2 * padding);
button_box->add(
- UI::g_fh1->fontset()->is_rtl() ? cancelbtn : okbtn, UI::Align::kLeft, false, true);
- main_box->add(textarea, UI::Align::kLeft);
+ UI::g_fh1->fontset()->is_rtl() ? cancelbtn : okbtn, UI::HAlign::kLeft, false, true);
+ main_box->add(textarea);
main_box->add_space(1.5 * padding);
- main_box->add(button_box, UI::Align::kLeft, true);
+ main_box->add(button_box, UI::HAlign::kLeft, true);
button_box->set_size(textarea->get_w(), okbtn->get_h());
main_box->set_size(textarea->get_w(), textarea->get_h() + button_box->get_h() + 1.5 * padding);
set_inner_size(main_box->get_w() + 2 * padding, main_box->get_h() + 2 * padding);
=== modified file 'src/wui/attack_box.cc'
--- src/wui/attack_box.cc 2017-01-25 18:55:59 +0000
+++ src/wui/attack_box.cc 2017-02-21 15:47:40 +0000
@@ -65,12 +65,14 @@
char const* hint) {
std::unique_ptr<UI::HorizontalSlider> result(new UI::HorizontalSlider(
&parent, 0, 0, width, height, min, max, initial, g_gr->images().get(picname), hint));
- parent.add(result.get(), UI::Align::kHCenter);
+ parent.add(result.get());
return result;
}
+
+// TODO(klaus.halfmann): Decide if this Align or HAlign, or even a cast.
UI::Textarea&
-AttackBox::add_text(UI::Box& parent, std::string str, UI::Align alignment, int fontsize) {
+AttackBox::add_text(UI::Box& parent, std::string str, UI::HAlign alignment, int fontsize) {
UI::Textarea& result = *new UI::Textarea(&parent, str.c_str());
result.set_fontsize(fontsize);
parent.add(&result, alignment);
@@ -85,7 +87,7 @@
g_gr->images().get("images/ui_basic/but2.png"),
text, tooltip_text));
button.get()->sigclicked.connect(boost::bind(fn, boost::ref(*this)));
- parent.add(button.get(), UI::Align::kHCenter);
+ parent.add(button.get());
return button;
}
@@ -129,7 +131,7 @@
uint32_t max_attackers = get_max_attackers();
UI::Box& linebox = *new UI::Box(this, 0, 0, UI::Box::Horizontal);
- add(&linebox, UI::Align::kHCenter);
+ add(&linebox);
add_text(linebox, _("Soldiers:"));
linebox.add_space(8);
@@ -138,13 +140,13 @@
// Spliter of soldiers
UI::Box& columnbox = *new UI::Box(&linebox, 0, 0, UI::Box::Vertical);
- linebox.add(&columnbox, UI::Align::kHCenter);
+ linebox.add(&columnbox);
const std::string attack_string =
(boost::format(_("%1% / %2%")) % (max_attackers > 0 ? 1 : 0) % max_attackers).str();
soldiers_text_.reset(
- &add_text(columnbox, attack_string, UI::Align::kHCenter, UI_FONT_SIZE_ULTRASMALL));
+ &add_text(columnbox, attack_string, UI::HAlign::kHCenter, UI_FONT_SIZE_ULTRASMALL));
soldiers_slider_ = add_slider(columnbox, 100, 10, 0, max_attackers, max_attackers > 0 ? 1 : 0,
"images/ui_basic/but2.png", _("Number of soldiers"));
=== modified file 'src/wui/attack_box.h'
--- src/wui/attack_box.h 2017-01-25 18:55:59 +0000
+++ src/wui/attack_box.h 2017-02-21 15:47:40 +0000
@@ -67,7 +67,7 @@
// TODO(GunChleoc): This should also return a unique_ptr
UI::Textarea& add_text(UI::Box& parent,
std::string str,
- UI::Align alignment = UI::Align::kTop,
+ UI::HAlign alignment = UI::HAlign::kLeft,
int fontsize = UI_FONT_SIZE_SMALL);
std::unique_ptr<UI::Button> add_button(UI::Box& parent,
const std::string& text,
=== modified file 'src/wui/building_statistics_menu.cc'
--- src/wui/building_statistics_menu.cc 2017-01-25 18:55:59 +0000
+++ src/wui/building_statistics_menu.cc 2017-02-21 15:47:40 +0000
@@ -68,7 +68,7 @@
tab_panel_(this, 0, 0, g_gr->images().get("images/ui_basic/but1.png")),
navigation_panel_(this, 0, 0, kWindowWidth, 4 * kButtonRowHeight),
building_name_(
- &navigation_panel_, get_inner_w() / 2, 0, 0, kButtonHeight, "", UI::Align::kCenter),
+ &navigation_panel_, get_inner_w() / 2, 0, 0, kButtonHeight, "", UI::Align::kTopCenter),
owned_label_(&navigation_panel_,
kMargin,
kButtonRowHeight,
@@ -238,7 +238,7 @@
}
for (int i = 0; i < kNoOfBuildingTabs; ++i) {
- tabs_[i]->add(rows[i], UI::Align::kLeft);
+ tabs_[i]->add(rows[i]);
}
set_label_font(&owned_label_);
@@ -253,10 +253,10 @@
unproductive_percent_.set_text(std::to_string(low_production_));
unproductive_percent_.set_max_length(4);
unproductive_label2_.set_size(unproductive_label2_.get_w(), kButtonRowHeight);
- unproductive_box_.add(&unproductive_label_, UI::Align::kLeft);
+ unproductive_box_.add(&unproductive_label_);
unproductive_box_.add_space(2);
- unproductive_box_.add(&unproductive_percent_, UI::Align::kLeft);
- unproductive_box_.add(&unproductive_label2_, UI::Align::kLeft);
+ unproductive_box_.add(&unproductive_percent_);
+ unproductive_box_.add(&unproductive_label2_);
unproductive_box_.set_size(
unproductive_label_.get_w() + unproductive_percent_.get_w() + unproductive_label2_.get_w(),
kButtonRowHeight);
@@ -324,10 +324,13 @@
productivity_labels_.clear();
}
-// Adds 3 buttons per building type:
-// - Building image, steps through all buildings of the type
-// - Buildings owned, steps through constructionsites
-// - Productivity, steps though buildings with low productivity and stopped buildings
+/**
+ * Adds 3 buttons per building type.
+ *
+ * - Building image, steps through all buildings of the type
+ * - Buildings owned, steps through constructionsites
+ * - Productivity, steps though buildings with low productivity and stopped buildings
+ */
bool BuildingStatisticsMenu::add_button(
DescriptionIndex id, const BuildingDescr& descr, int tab_index, UI::Box& row, int* column) {
@@ -337,21 +340,21 @@
kBuildGridCellHeight, g_gr->images().get("images/ui_basic/but1.png"),
descr.representative_image(&iplayer().get_player()->get_playercolor()), "",
UI::Button::Style::kFlat);
- button_box->add(building_buttons_[id], UI::Align::kLeft);
+ button_box->add(building_buttons_[id]);
owned_labels_[id] =
- new UI::Textarea(button_box, 0, 0, kBuildGridCellWidth, kLabelHeight, UI::Align::kCenter);
+ new UI::Textarea(button_box, 0, 0, kBuildGridCellWidth, kLabelHeight, UI::Align::kTopCenter);
owned_labels_[id]->set_fontsize(kLabelFontSize);
owned_labels_[id]->set_fixed_width(kBuildGridCellWidth);
- button_box->add(owned_labels_[id], UI::Align::kHCenter);
+ button_box->add(owned_labels_[id]);
productivity_labels_[id] =
- new UI::Textarea(button_box, 0, 0, kBuildGridCellWidth, kLabelHeight, UI::Align::kCenter);
+ new UI::Textarea(button_box, 0, 0, kBuildGridCellWidth, kLabelHeight, UI::Align::kTopCenter);
productivity_labels_[id]->set_fontsize(kLabelFontSize);
productivity_labels_[id]->set_fixed_width(kBuildGridCellWidth);
- button_box->add(productivity_labels_[id], UI::Align::kHCenter);
+ button_box->add(productivity_labels_[id]);
- row.add(button_box, UI::Align::kLeft);
+ row.add(button_box);
building_buttons_[id]->sigclicked.connect(
boost::bind(&BuildingStatisticsMenu::set_current_building_type, boost::ref(*this), id));
@@ -364,7 +367,7 @@
// Check if the row is full
++*column;
if (*column == kColumns) {
- tabs_[tab_index]->add(&row, UI::Align::kLeft);
+ tabs_[tab_index]->add(&row);
tabs_[tab_index]->add_space(6);
*column = 0;
return true;
=== modified file 'src/wui/buildingwindow.cc'
--- src/wui/buildingwindow.cc 2017-02-17 21:52:41 +0000
+++ src/wui/buildingwindow.cc 2017-02-21 15:47:40 +0000
@@ -66,10 +66,10 @@
UI::Box* vbox = new UI::Box(this, 0, 0, UI::Box::Vertical);
tabs_ = new UI::TabPanel(vbox, 0, 0, nullptr);
- vbox->add(tabs_, UI::Align::kLeft, true);
+ vbox->add(tabs_, UI::HAlign::kLeft, true);
capsbuttons_ = new UI::Box(vbox, 0, 0, UI::Box::Horizontal);
- vbox->add(capsbuttons_, UI::Align::kLeft, true);
+ vbox->add(capsbuttons_, UI::HAlign::kLeft, true);
// actually create buttons on the first call to think(),
// so that overriding create_capsbuttons() works
@@ -166,7 +166,7 @@
update_expedition_button(!pd->expedition_started());
expeditionbtn_->sigclicked.connect(
boost::bind(&BuildingWindow::act_start_or_cancel_expedition, boost::ref(*this)));
- capsbuttons->add(expeditionbtn_, UI::Align::kHCenter);
+ capsbuttons->add(expeditionbtn_);
expedition_canceled_subscriber_ =
Notifications::subscribe<Widelands::NoteExpeditionCanceled>(
@@ -192,14 +192,14 @@
_("Stop"));
stopbtn->sigclicked.connect(
boost::bind(&BuildingWindow::act_start_stop, boost::ref(*this)));
- capsbuttons->add(stopbtn, UI::Align::kHCenter);
+ capsbuttons->add(stopbtn);
// Add a fixed width separator rather than infinite space so the
// enhance/destroy/dismantle buttons are fixed in their position
// and not subject to the number of buttons on the right of the
// panel.
UI::Panel* spacer = new UI::Panel(capsbuttons, 0, 0, 17, 34);
- capsbuttons->add(spacer, UI::Align::kHCenter);
+ capsbuttons->add(spacer);
}
} // upcast to productionsite
@@ -220,7 +220,7 @@
// button id = building id
enhancebtn->sigclicked.connect([this, enhancement] { act_enhance(enhancement); });
- capsbuttons->add(enhancebtn, UI::Align::kHCenter);
+ capsbuttons->add(enhancebtn);
requires_destruction_separator = true;
}
}
@@ -231,7 +231,7 @@
g_gr->images().get(pic_bulldoze), _("Destroy"));
destroybtn->sigclicked.connect(
boost::bind(&BuildingWindow::act_bulldoze, boost::ref(*this)));
- capsbuttons->add(destroybtn, UI::Align::kHCenter);
+ capsbuttons->add(destroybtn);
requires_destruction_separator = true;
}
@@ -247,7 +247,7 @@
waremap_to_richtext(owner.tribe(), wares));
dismantlebtn->sigclicked.connect(
boost::bind(&BuildingWindow::act_dismantle, boost::ref(*this)));
- capsbuttons->add(dismantlebtn, UI::Align::kHCenter);
+ capsbuttons->add(dismantlebtn, UI::HAlign::kHCenter);
requires_destruction_separator = true;
}
}
@@ -256,7 +256,7 @@
// Need this as well as the infinite space from the can_see section
// to ensure there is a separation.
UI::Panel* spacer = new UI::Panel(capsbuttons, 0, 0, 17, 34);
- capsbuttons->add(spacer, UI::Align::kHCenter);
+ capsbuttons->add(spacer);
capsbuttons->add_inf_space();
}
}
@@ -275,7 +275,7 @@
toggle_workarea_->sigclicked.connect(
boost::bind(&BuildingWindow::toggle_workarea, boost::ref(*this)));
- capsbuttons->add(toggle_workarea_, UI::Align::kHCenter);
+ capsbuttons->add(toggle_workarea_);
configure_workarea_button();
set_fastclick_panel(toggle_workarea_);
}
@@ -285,14 +285,14 @@
capsbuttons, "debug", 0, 0, 34, 34, g_gr->images().get("images/ui_basic/but4.png"),
g_gr->images().get(pic_debug), _("Show Debug Window"));
debugbtn->sigclicked.connect(boost::bind(&BuildingWindow::act_debug, boost::ref(*this)));
- capsbuttons->add(debugbtn, UI::Align::kHCenter);
+ capsbuttons->add(debugbtn);
}
UI::Button* gotobtn = new UI::Button(
capsbuttons, "goto", 0, 0, 34, 34, g_gr->images().get("images/ui_basic/but4.png"),
g_gr->images().get("images/wui/menus/menu_goto.png"), _("Center view on this"));
gotobtn->sigclicked.connect(boost::bind(&BuildingWindow::clicked_goto, boost::ref(*this)));
- capsbuttons->add(gotobtn, UI::Align::kHCenter);
+ capsbuttons->add(gotobtn);
if (!requires_destruction_separator) {
// When there was no separation of destruction buttons put
@@ -313,7 +313,7 @@
helpbtn->sigclicked.connect(
boost::bind(&UI::UniqueWindow::Registry::toggle, boost::ref(registry)));
- capsbuttons->add(helpbtn, UI::Align::kHCenter);
+ capsbuttons->add(helpbtn);
}
}
@@ -459,7 +459,7 @@
Widelands::InputQueue* const iq,
bool show_only) {
// The *max* width should be larger than the default width
- box->add(new InputQueueDisplay(box, 0, 0, igbase(), b, iq, show_only), UI::Align::kLeft);
+ box->add(new InputQueueDisplay(box, 0, 0, igbase(), b, iq, show_only));
}
/**
=== modified file 'src/wui/constructionsitewindow.cc'
--- src/wui/constructionsitewindow.cc 2017-01-25 18:55:59 +0000
+++ src/wui/constructionsitewindow.cc 2017-02-21 15:47:40 +0000
@@ -52,14 +52,14 @@
progress_ = new UI::ProgressBar(&box, 0, 0, UI::ProgressBar::DefaultWidth,
UI::ProgressBar::DefaultHeight, UI::ProgressBar::Horizontal);
progress_->set_total(1 << 16);
- box.add(progress_, UI::Align::kHCenter);
+ box.add(progress_);
box.add_space(8);
// Add the wares queue
for (uint32_t i = 0; i < cs.get_nrwaresqueues(); ++i)
box.add(
- new InputQueueDisplay(&box, 0, 0, igbase(), cs, cs.get_waresqueue(i)), UI::Align::kLeft);
+ new InputQueueDisplay(&box, 0, 0, igbase(), cs, cs.get_waresqueue(i)), UI::HAlign::kLeft);
get_tabs()->add("wares", g_gr->images().get(pic_tab_wares), &box, _("Building materials"));
}
=== modified file 'src/wui/dismantlesitewindow.cc'
--- src/wui/dismantlesitewindow.cc 2017-01-25 18:55:59 +0000
+++ src/wui/dismantlesitewindow.cc 2017-02-21 15:47:40 +0000
@@ -50,7 +50,7 @@
progress_ = new UI::ProgressBar(&box, 0, 0, UI::ProgressBar::DefaultWidth,
UI::ProgressBar::DefaultHeight, UI::ProgressBar::Horizontal);
progress_->set_total(1 << 16);
- box.add(progress_, UI::Align::kHCenter);
+ box.add(progress_, UI::HAlign::kHCenter);
box.add_space(8);
=== modified file 'src/wui/economy_options_window.cc'
--- src/wui/economy_options_window.cc 2017-02-12 09:10:57 +0000
+++ src/wui/economy_options_window.cc 2017-02-21 15:47:40 +0000
@@ -132,17 +132,17 @@
owner_(owner),
can_act_(can_act),
display_(this, 0, 0, owner.tribe(), type_, can_act_, economy_number, owner) {
- add(&display_, UI::Align::kLeft, true);
+ add(&display_, UI::HAlign::kLeft, true);
UI::Box* buttons = new UI::Box(this, 0, 0, UI::Box::Horizontal);
- add(buttons, UI::Align::kLeft);
+ add(buttons);
UI::Button* b =
new UI::Button(buttons, "decrease_target", 0, 0, 34, 34,
g_gr->images().get("images/ui_basic/but4.png"), "-", _("Decrease target"));
b->set_enabled(can_act_);
b->sigclicked.connect(boost::bind(&EconomyOptionsPanel::change_target, this, -1));
- buttons->add(b, UI::Align::kHCenter);
+ buttons->add(b, UI::HAlign::kHCenter);
b->set_repeating(true);
buttons->add_space(8);
@@ -150,7 +150,7 @@
g_gr->images().get("images/ui_basic/but4.png"), "+", _("Increase target"));
b->set_enabled(can_act_);
b->sigclicked.connect(boost::bind(&EconomyOptionsPanel::change_target, this, 1));
- buttons->add(b, UI::Align::kHCenter);
+ buttons->add(b, UI::HAlign::kHCenter);
b->set_repeating(true);
buttons->add_space(8);
@@ -158,7 +158,7 @@
g_gr->images().get("images/ui_basic/but4.png"), "R", _("Reset to default"));
b->set_enabled(can_act_);
b->sigclicked.connect(boost::bind(&EconomyOptionsPanel::reset_target, this));
- buttons->add(b, UI::Align::kHCenter);
+ buttons->add(b, UI::HAlign::kHCenter);
}
void EconomyOptionsWindow::EconomyOptionsPanel::set_economy_number(size_t economy_number) {
=== modified file 'src/wui/encyclopedia_window.cc'
--- src/wui/encyclopedia_window.cc 2017-02-18 14:03:02 +0000
+++ src/wui/encyclopedia_window.cc 2017-02-21 15:47:40 +0000
@@ -94,12 +94,12 @@
tab_name, std::unique_ptr<UI::MultilineTextarea>(new UI::MultilineTextarea(
boxes_.at(tab_name).get(), 0, 0, contents_width, contents_height))));
- boxes_.at(tab_name)->add(lists_.at(tab_name).get(), UI::Align::kLeft);
+ boxes_.at(tab_name)->add(lists_.at(tab_name).get());
boxes_.at(tab_name)->add_space(kPadding);
- boxes_.at(tab_name)->add(contents_.at(tab_name).get(), UI::Align::kLeft);
+ boxes_.at(tab_name)->add(contents_.at(tab_name).get());
wrapper_boxes_.at(tab_name)->add_space(kPadding);
- wrapper_boxes_.at(tab_name)->add(boxes_.at(tab_name).get(), UI::Align::kLeft);
+ wrapper_boxes_.at(tab_name)->add(boxes_.at(tab_name).get());
if (tab_icon.empty()) {
tabs_.add("encyclopedia_" + tab_name, tab_title, wrapper_boxes_.at(tab_name).get());
=== modified file 'src/wui/fieldaction.cc'
--- src/wui/fieldaction.cc 2017-02-12 09:10:57 +0000
+++ src/wui/fieldaction.cc 2017-02-21 15:47:40 +0000
@@ -383,7 +383,7 @@
if (upcast(Widelands::Attackable, attackable, map_->get_immovable(node_))) {
if (player_ && player_->is_hostile(attackable->owner()) && attackable->can_attack()) {
attack_box_ = new AttackBox(&a_box, player_, &node_, 0, 0);
- a_box.add(attack_box_, UI::Align::kTop);
+ a_box.add(attack_box_);
set_fastclick_panel(&add_button(
&a_box, "attack", pic_attack, &FieldActionWindow::act_attack, _("Start attack")));
@@ -514,7 +514,7 @@
g_gr->images().get(picname), tooltip_text);
button.sigclicked.connect(boost::bind(fn, this));
button.set_repeating(repeating);
- box->add(&button, UI::Align::kTop);
+ box->add(&button);
return button;
}
=== modified file 'src/wui/game_debug_ui.cc'
--- src/wui/game_debug_ui.cc 2017-01-25 18:55:59 +0000
+++ src/wui/game_debug_ui.cc 2017-02-21 15:47:40 +0000
@@ -63,12 +63,9 @@
egbase_(egbase),
object_(&obj),
log_(this,
- 0,
- 0,
- 350,
- 200,
+ 0, 0, 350, 200,
"",
- UI::Align::kLeft,
+ UI::HAlign::kLeft,
g_gr->images().get("images/ui_basic/but1.png"),
UI::MultilineTextarea::ScrollMode::kScrollLog) {
obj.set_logsink(this);
=== modified file 'src/wui/game_message_menu.cc'
--- src/wui/game_message_menu.cc 2017-01-25 18:55:59 +0000
+++ src/wui/game_message_menu.cc 2017-02-21 15:47:40 +0000
@@ -55,7 +55,7 @@
kWindowWidth - 2 * kPadding,
get_inner_h() - kMessageBodyY - 2 * kPadding - kButtonSize,
"",
- UI::Align::kLeft,
+ UI::HAlign::kLeft,
g_gr->images().get("images/ui_basic/but1.png"),
UI::MultilineTextarea::ScrollMode::kScrollNormalForced),
mode(Inbox) {
@@ -66,13 +66,13 @@
list->selected.connect(boost::bind(&GameMessageMenu::selected, this, _1));
list->double_clicked.connect(boost::bind(&GameMessageMenu::double_clicked, this, _1));
list->add_column(kWindowWidth - 2 * kPadding - 60 - 60 - 75, _("Title"));
- list->add_column(60, pgettext("message", "Type"), "", UI::Align::kHCenter);
- list->add_column(60, _("Status"), "", UI::Align::kHCenter);
+ list->add_column(60, pgettext("message", "Type"), "", UI::HAlign::kHCenter);
+ list->add_column(60, _("Status"), "", UI::HAlign::kHCenter);
/** TRANSLATORS: We have very little space here. You can also translate this as "Time" or "Time
* Sent" */
/** TRANSLATORS: This is used in the game messages menu - please open an issue if you need more
* space. */
- list->add_column(75, pgettext("message", "Sent"), "", UI::Align::kRight);
+ list->add_column(75, pgettext("message", "Sent"), "", UI::HAlign::kRight);
list->focus();
// Buttons for message types
=== modified file 'src/wui/game_objectives_menu.cc'
--- src/wui/game_objectives_menu.cc 2017-01-25 18:55:59 +0000
+++ src/wui/game_objectives_menu.cc 2017-02-21 15:47:40 +0000
@@ -47,7 +47,7 @@
get_inner_w() - 10,
FULL_OBJECTIVE_TEXT,
"",
- UI::Align::kLeft,
+ UI::HAlign::kLeft,
g_gr->images().get("images/ui_basic/but1.png"),
UI::MultilineTextarea::ScrollMode::kScrollNormalForced) {
list.selected.connect(boost::bind(&GameObjectivesMenu::selected, this, _1));
=== modified file 'src/wui/game_options_menu.cc'
--- src/wui/game_options_menu.cc 2017-01-25 18:55:59 +0000
+++ src/wui/game_options_menu.cc 2017-02-21 15:47:40 +0000
@@ -97,10 +97,10 @@
g_gr->images().get("images/wui/menus/menu_exit_game.png"),
/** TRANSLATORS: Button tooltip */
_("Exit Game")) {
- box_.add(&sound_, UI::Align::kHCenter);
+ box_.add(&sound_);
box_.add_space(vgap);
- box_.add(&save_game_, UI::Align::kHCenter);
- box_.add(&exit_game_, UI::Align::kHCenter);
+ box_.add(&save_game_);
+ box_.add(&exit_game_);
box_.set_size(width, sound_.get_h() + 2 * save_game_.get_h() + vgap + 3 * vspacing);
set_inner_size(get_inner_w(), box_.get_h() + 2 * margin);
=== modified file 'src/wui/game_statistics_menu.cc'
--- src/wui/game_statistics_menu.cc 2017-02-12 09:10:57 +0000
+++ src/wui/game_statistics_menu.cc 2017-02-21 15:47:40 +0000
@@ -70,7 +70,7 @@
UI::Button* button =
new UI::Button(&box_, name, 0, 0, 34U, 34U, g_gr->images().get("images/ui_basic/but4.png"),
g_gr->images().get("images/" + image_basename + ".png"), tooltip_text);
- box_.add(button, UI::Align::kLeft);
+ box_.add(button);
if (window) {
if (!window->on_create) {
window->assign_toggle_button(button);
=== modified file 'src/wui/game_summary.cc'
--- src/wui/game_summary.cc 2017-02-12 09:10:57 +0000
+++ src/wui/game_summary.cc 2017-02-21 15:47:40 +0000
@@ -47,61 +47,61 @@
game_.game_controller()->set_desired_speed(0);
// Init boxes
UI::Box* vbox = new UI::Box(this, 0, 0, UI::Box::Vertical, 0, 0, PADDING);
- title_area_ = new UI::Textarea(vbox, "", UI::Align::kHCenter);
- vbox->add(title_area_, UI::Align::kHCenter);
+ title_area_ = new UI::Textarea(vbox, "", UI::Align::kTopCenter);
+ vbox->add(title_area_);
vbox->add_space(PADDING);
UI::Box* hbox1 = new UI::Box(this, 0, 0, UI::Box::Horizontal);
players_table_ = new UI::Table<uintptr_t const>(hbox1, 0, 0, 0, 0);
players_table_->fit_height(game_.player_manager()->get_players_end_status().size());
hbox1->add_space(PADDING);
- hbox1->add(players_table_, UI::Align::kTop);
+ hbox1->add(players_table_);
hbox1->add_space(PADDING);
UI::Box* info_box = new UI::Box(hbox1, 0, 0, UI::Box::Vertical, 0, 0);
info_area_label_ = new UI::Textarea(info_box, _("Player Info:"));
- info_box->add(info_area_label_, UI::Align::kLeft);
+ info_box->add(info_area_label_);
info_area_ = new UI::MultilineTextarea(
info_box, 0, 0, 130,
std::max(130, players_table_->get_h() - info_area_label_->get_h() - PADDING), "");
- info_box->add(info_area_, UI::Align::kLeft, true);
+ info_box->add(info_area_, UI::HAlign::kLeft, true);
info_box->add_space(PADDING);
- hbox1->add(info_box, UI::Align::kTop);
+ hbox1->add(info_box);
hbox1->add_space(PADDING);
- vbox->add(hbox1, UI::Align::kLeft);
+ vbox->add(hbox1);
UI::Box* bottom_box = new UI::Box(this, 0, 0, UI::Box::Horizontal);
bottom_box->add_space(PADDING);
gametime_label_ = new UI::Textarea(bottom_box, _("Elapsed time:"));
- bottom_box->add(gametime_label_, UI::Align::kHCenter);
+ bottom_box->add(gametime_label_);
bottom_box->add_space(PADDING);
gametime_value_ = new UI::Textarea(bottom_box, gametimestring(game_.get_gametime()));
- bottom_box->add(gametime_value_, UI::Align::kHCenter);
+ bottom_box->add(gametime_value_);
bottom_box->add_inf_space();
continue_button_ = new UI::Button(
bottom_box, "continue_button", 0, 0, 35, 35, g_gr->images().get("images/ui_basic/but4.png"),
g_gr->images().get("images/ui_basic/continue.png"), _("Continue playing"));
- bottom_box->add(continue_button_, UI::Align::kHCenter);
+ bottom_box->add(continue_button_);
bottom_box->add_space(PADDING);
stop_button_ = new UI::Button(
bottom_box, "stop_button", 0, 0, 35, 35, g_gr->images().get("images/ui_basic/but4.png"),
g_gr->images().get("images/wui/menus/menu_exit_game.png"), _("Exit Game"));
- bottom_box->add(stop_button_, UI::Align::kHCenter);
+ bottom_box->add(stop_button_);
bottom_box->add_space(PADDING);
- vbox->add(bottom_box, UI::Align::kLeft, true);
+ vbox->add(bottom_box, UI::HAlign::kLeft, true);
vbox->add_space(PADDING);
set_center_panel(vbox);
// Prepare table
players_table_->add_column(150, _("Player"));
- players_table_->add_column(80, _("Team"), "", UI::Align::kHCenter);
- players_table_->add_column(100, _("Status"), "", UI::Align::kHCenter);
- players_table_->add_column(0, _("Time"), "", UI::Align::kRight, UI::TableColumnType::kFlexible);
+ players_table_->add_column(80, _("Team") , "", UI::HAlign::kHCenter);
+ players_table_->add_column(100, _("Status"), "", UI::HAlign::kHCenter);
+ players_table_->add_column(0, _("Time") , "", UI::HAlign::kRight, UI::TableColumnType::kFlexible);
// Prepare Elements
title_area_->set_fontsize(UI_FONT_SIZE_BIG);
=== modified file 'src/wui/gamechatpanel.cc'
--- src/wui/gamechatpanel.cc 2017-01-25 18:55:59 +0000
+++ src/wui/gamechatpanel.cc 2017-02-21 15:47:40 +0000
@@ -41,7 +41,7 @@
w,
h - 25,
"",
- UI::Align::kLeft,
+ UI::HAlign::kLeft,
g_gr->images().get("images/ui_basic/but1.png"),
UI::MultilineTextarea::ScrollMode::kScrollLogForced),
editbox(this, 0, h - 20, w, 20, 2),
=== modified file 'src/wui/general_statistics_menu.cc'
--- src/wui/general_statistics_menu.cc 2017-01-25 18:55:59 +0000
+++ src/wui/general_statistics_menu.cc 2017-02-21 15:47:40 +0000
@@ -99,7 +99,7 @@
plot_.set_time(my_registry_->time);
// Setup Widgets
- box_.add(&plot_, UI::Align::kTop);
+ box_.add(&plot_);
UI::Box* hbox1 = new UI::Box(&box_, 0, 0, UI::Box::Horizontal, 0, 0, 1);
@@ -120,12 +120,12 @@
cbs_[p - 1] = &cb;
- hbox1->add(&cb, UI::Align::kLeft, false, true);
+ hbox1->add(&cb, UI::HAlign::kLeft, false, true);
}
else // player nr p does not exist
cbs_[p - 1] = nullptr;
- box_.add(hbox1, UI::Align::kTop, true);
+ box_.add(hbox1, UI::HAlign::kLeft, true);
UI::Box* hbox2 = new UI::Box(&box_, 0, 0, UI::Box::Horizontal, 0, 0, 1);
@@ -134,72 +134,72 @@
radiogroup_.add_button(hbox2, Vector2i(0, 0),
g_gr->images().get("images/wui/stats/genstats_landsize.png"), _("Land"),
&btn);
- hbox2->add(btn, UI::Align::kLeft, false, true);
+ hbox2->add(btn, UI::HAlign::kLeft, false, true);
radiogroup_.add_button(hbox2, Vector2i(0, 0),
g_gr->images().get("images/wui/stats/genstats_nrworkers.png"),
_("Workers"), &btn);
- hbox2->add(btn, UI::Align::kLeft, false, true);
+ hbox2->add(btn, UI::HAlign::kLeft, false, true);
radiogroup_.add_button(hbox2, Vector2i(0, 0),
g_gr->images().get("images/wui/stats/genstats_nrbuildings.png"),
_("Buildings"), &btn);
- hbox2->add(btn, UI::Align::kLeft, false, true);
+ hbox2->add(btn, UI::HAlign::kLeft, false, true);
radiogroup_.add_button(hbox2, Vector2i(0, 0),
g_gr->images().get("images/wui/stats/genstats_nrwares.png"), _("Wares"),
&btn);
- hbox2->add(btn, UI::Align::kLeft, false, true);
+ hbox2->add(btn, UI::HAlign::kLeft, false, true);
radiogroup_.add_button(hbox2, Vector2i(0, 0),
g_gr->images().get("images/wui/stats/genstats_productivity.png"),
_("Productivity"), &btn);
- hbox2->add(btn, UI::Align::kLeft, false, true);
+ hbox2->add(btn, UI::HAlign::kLeft, false, true);
radiogroup_.add_button(hbox2, Vector2i(0, 0),
g_gr->images().get("images/wui/stats/genstats_casualties.png"),
_("Casualties"), &btn);
- hbox2->add(btn, UI::Align::kLeft, false, true);
+ hbox2->add(btn, UI::HAlign::kLeft, false, true);
radiogroup_.add_button(hbox2, Vector2i(0, 0),
g_gr->images().get("images/wui/stats/genstats_kills.png"), _("Kills"),
&btn);
- hbox2->add(btn, UI::Align::kLeft, false, true);
+ hbox2->add(btn, UI::HAlign::kLeft, false, true);
radiogroup_.add_button(hbox2, Vector2i(0, 0),
g_gr->images().get("images/wui/stats/genstats_msites_lost.png"),
_("Military buildings lost"), &btn);
- hbox2->add(btn, UI::Align::kLeft, false, true);
+ hbox2->add(btn, UI::HAlign::kLeft, false, true);
radiogroup_.add_button(hbox2, Vector2i(0, 0),
g_gr->images().get("images/wui/stats/genstats_msites_defeated.png"),
_("Military buildings defeated"), &btn);
- hbox2->add(btn, UI::Align::kLeft, false, true);
+ hbox2->add(btn, UI::HAlign::kLeft, false, true);
radiogroup_.add_button(hbox2, Vector2i(0, 0),
g_gr->images().get("images/wui/stats/genstats_civil_blds_lost.png"),
_("Civilian buildings lost"), &btn);
- hbox2->add(btn, UI::Align::kLeft, false, true);
+ hbox2->add(btn, UI::HAlign::kLeft, false, true);
radiogroup_.add_button(hbox2, Vector2i(0, 0),
g_gr->images().get("images/wui/stats/genstats_militarystrength.png"),
_("Military"), &btn);
- hbox2->add(btn, UI::Align::kLeft, false, true);
+ hbox2->add(btn, UI::HAlign::kLeft, false, true);
if (hook) {
radiogroup_.add_button(
hbox2, Vector2i(0, 0), g_gr->images().get(cs_pic), cs_name.c_str(), &btn);
- hbox2->add(btn, UI::Align::kLeft, false, true);
+ hbox2->add(btn, UI::HAlign::kLeft, false, true);
}
radiogroup_.set_state(selected_information_);
radiogroup_.changedto.connect(boost::bind(&GeneralStatisticsMenu::radiogroup_changed, this, _1));
- box_.add(hbox2, UI::Align::kTop, true);
+ box_.add(hbox2, UI::HAlign::kLeft, true);
box_.add(new WuiPlotAreaSlider(
&box_, plot_, 0, 0, 100, 45, g_gr->images().get("images/ui_basic/but1.png")),
- UI::Align::kTop, true);
+ UI::HAlign::kLeft, true);
}
GeneralStatisticsMenu::~GeneralStatisticsMenu() {
=== modified file 'src/wui/helpwindow.cc'
--- src/wui/helpwindow.cc 2017-01-25 18:55:59 +0000
+++ src/wui/helpwindow.cc 2017-02-21 15:47:40 +0000
@@ -45,7 +45,7 @@
height,
(boost::format(_("Help: %s")) % building_description.descname()).str()),
textarea_(new MultilineTextarea(
- this, 5, 5, width - 10, height - 10, std::string(), UI::Align::kLeft)) {
+ this, 5, 5, width - 10, height - 10, std::string(), UI::HAlign::kLeft)) {
assert(tribe.has_building(tribe.building_index(building_description.name())) ||
building_description.type() == Widelands::MapObjectType::MILITARYSITE);
try {
=== modified file 'src/wui/interactive_base.cc'
--- src/wui/interactive_base.cc 2017-01-25 18:55:59 +0000
+++ src/wui/interactive_base.cc 2017-02-21 15:47:40 +0000
@@ -229,7 +229,7 @@
UI::Button* button = new UI::Button(
&toolbar_, name, 0, 0, 34U, 34U, g_gr->images().get("images/ui_basic/but2.png"),
g_gr->images().get("images/" + image_basename + ".png"), tooltip_text);
- toolbar_.add(button, UI::Align::kLeft);
+ toolbar_.add(button);
if (window) {
window->assign_toggle_button(button);
registries_.push_back(*window);
@@ -372,7 +372,7 @@
const Image* rendered_text = UI::g_fh1->render(as_condensed(
(fps_format % (1000.0 / frametime_) % (1000.0 / (avg_usframetime_ / 1000))).str()));
dst.blit(Vector2f((get_w() - rendered_text->width()) / 2, 5), rendered_text,
- BlendMode::UseAlpha, UI::Align::kLeft);
+ BlendMode::UseAlpha, UI::Align::kTopLeft);
}
}
=== modified file 'src/wui/login_box.cc'
--- src/wui/login_box.cc 2017-01-25 18:55:59 +0000
+++ src/wui/login_box.cc 2017-02-21 15:47:40 +0000
@@ -40,7 +40,7 @@
pwd_warning = new UI::MultilineTextarea(this, margin, 65, 505, 50,
_("WARNING: Password will be shown and saved readable!"),
- UI::Align::kLeft);
+ UI::HAlign::kLeft);
cb_register = new UI::Checkbox(this, Vector2i(margin, 110), _("Log in to a registered account"),
"", get_inner_w() - 2 * margin);
@@ -69,7 +69,9 @@
eb_nickname->focus();
}
-/// called, if "login" is pressed
+/**
+ * called, if "login" is pressed.
+ */
void LoginBox::clicked_ok() {
// Check if all needed input fields are valid
if (eb_nickname->text().empty()) {
=== modified file 'src/wui/mapdetails.cc'
--- src/wui/mapdetails.cc 2017-01-25 18:55:59 +0000
+++ src/wui/mapdetails.cc 2017-02-21 15:47:40 +0000
@@ -80,7 +80,7 @@
UI::Scrollbar::kSize,
0,
"",
- UI::Align::kLeft,
+ UI::HAlign::kLeft,
g_gr->images().get("images/ui_basic/but3.png"),
UI::MultilineTextarea::ScrollMode::kNoScrolling),
descr_(&main_box_, 0, 0, UI::Scrollbar::kSize, 0, ""),
@@ -89,9 +89,9 @@
name_label_.force_new_renderer();
descr_.force_new_renderer();
- main_box_.add(&name_label_, UI::Align::kLeft);
+ main_box_.add(&name_label_);
main_box_.add_space(padding_);
- main_box_.add(&descr_, UI::Align::kLeft);
+ main_box_.add(&descr_);
layout();
}
=== modified file 'src/wui/maptable.cc'
--- src/wui/maptable.cc 2017-01-25 18:55:59 +0000
+++ src/wui/maptable.cc 2017-02-21 15:47:40 +0000
@@ -32,10 +32,10 @@
parent, x, y, w, h, g_gr->images().get("images/ui_basic/but3.png"), descending) {
/** TRANSLATORS: Column title for number of players in map list */
- add_column(35, _("Pl."), _("Number of players"), UI::Align::kHCenter);
- add_column(0, _("Filename"), _("The name of the map or scenario"), UI::Align::kLeft,
+ add_column(35, _("Pl."), _("Number of players"), UI::HAlign::kHCenter);
+ add_column(0, _("Filename"), _("The name of the map or scenario"), UI::HAlign::kLeft,
UI::TableColumnType::kFlexible);
- add_column(115, _("Size"), _("The size of the map (Width x Height)"), UI::Align::kLeft);
+ add_column(115, _("Size"), _("The size of the map (Width x Height)"), UI::HAlign::kLeft);
set_sort_column(0);
}
=== modified file 'src/wui/multiplayersetupgroup.cc'
--- src/wui/multiplayersetupgroup.cc 2017-01-25 18:55:59 +0000
+++ src/wui/multiplayersetupgroup.cc 2017-02-21 15:47:40 +0000
@@ -56,18 +56,18 @@
save_(-2) {
set_size(w, h);
name = new UI::Textarea(this, 0, 0, w - h - UI::Scrollbar::kSize * 11 / 5, h);
- add(name, UI::Align::kHCenter);
+ add(name, UI::HAlign::kHCenter);
// Either Button if changeable OR text if not
if (id == settings->settings().usernum) { // Our Client
type = new UI::Button(
this, "client_type", 0, 0, h, h, g_gr->images().get("images/ui_basic/but1.png"), "");
type->sigclicked.connect(
boost::bind(&MultiPlayerClientGroup::toggle_type, boost::ref(*this)));
- add(type, UI::Align::kHCenter);
+ add(type);
} else { // just a shown client
type_icon = new UI::Icon(
this, 0, 0, h, h, g_gr->images().get("images/wui/fieldaction/menu_tab_watch.png"));
- add(type_icon, UI::Align::kHCenter);
+ add(type_icon, UI::HAlign::kHCenter);
}
}
@@ -164,27 +164,27 @@
g_gr->images().get("images/players/player_position_menu_pc.png"));
assert(player_image);
player = new UI::Icon(this, 0, 0, h, h, player_image);
- add(player, UI::Align::kHCenter);
+ add(player, UI::HAlign::kHCenter);
type = new UI::Button(
this, "player_type", 0, 0, h, h, g_gr->images().get("images/ui_basic/but1.png"), "");
type->sigclicked.connect(
boost::bind(&MultiPlayerPlayerGroup::toggle_type, boost::ref(*this)));
- add(type, UI::Align::kHCenter);
+ add(type, UI::HAlign::kHCenter);
tribe = new UI::Button(
this, "player_tribe", 0, 0, h, h, g_gr->images().get("images/ui_basic/but1.png"), "");
tribe->sigclicked.connect(
boost::bind(&MultiPlayerPlayerGroup::toggle_tribe, boost::ref(*this)));
- add(tribe, UI::Align::kHCenter);
+ add(tribe, UI::HAlign::kHCenter);
init = new UI::Button(this, "player_init", 0, 0, w - 4 * h, h,
g_gr->images().get("images/ui_basic/but1.png"), "");
init->sigclicked.connect(
boost::bind(&MultiPlayerPlayerGroup::toggle_init, boost::ref(*this)));
- add(init, UI::Align::kHCenter);
+ add(init, UI::HAlign::kHCenter);
team = new UI::Button(
this, "player_team", 0, 0, h, h, g_gr->images().get("images/ui_basic/but1.png"), "");
team->sigclicked.connect(
boost::bind(&MultiPlayerPlayerGroup::toggle_team, boost::ref(*this)));
- add(team, UI::Align::kHCenter);
+ add(team, UI::HAlign::kHCenter);
}
/// Toggle through the types
@@ -400,11 +400,11 @@
labels.back()->set_fontsize(small_font);
labels.push_back(new UI::Textarea(
- this, w * 6 / 15 + buth * 3, buth / 3, w * 9 / 15 - 4 * buth, buth, UI::Align::kHCenter));
+ this, w * 6 / 15 + buth * 3, buth / 3, w * 9 / 15 - 4 * buth, buth, UI::Align::kTopCenter));
labels.back()->set_text(_("Initialization"));
labels.back()->set_fontsize(small_font);
- labels.push_back(new UI::Textarea(this, w - buth, buth / 3, buth, buth, UI::Align::kRight));
+ labels.push_back(new UI::Textarea(this, w - buth, buth / 3, buth, buth, UI::Align::kTopRight));
labels.back()->set_text(_("Team"));
labels.back()->set_fontsize(small_font);
@@ -413,7 +413,7 @@
for (uint8_t i = 0; i < multi_player_player_groups.size(); ++i) {
multi_player_player_groups.at(i) = new MultiPlayerPlayerGroup(
&playerbox, i, 0, 0, playerbox.get_w(), buth, s, npsb.get(), tribepics_, tribenames_);
- playerbox.add(multi_player_player_groups.at(i), UI::Align::kHCenter);
+ playerbox.add(multi_player_player_groups.at(i), UI::HAlign::kHCenter);
}
refresh();
}
@@ -435,7 +435,7 @@
if (!multi_player_client_groups.at(i)) {
multi_player_client_groups.at(i) =
new MultiPlayerClientGroup(&clientbox, i, 0, 0, clientbox.get_w(), buth_, s);
- clientbox.add(&*multi_player_client_groups.at(i), UI::Align::kHCenter);
+ clientbox.add(&*multi_player_client_groups.at(i), UI::HAlign::kHCenter);
}
multi_player_client_groups.at(i)->refresh();
}
=== modified file 'src/wui/portdockwaresdisplay.cc'
--- src/wui/portdockwaresdisplay.cc 2017-02-12 09:10:57 +0000
+++ src/wui/portdockwaresdisplay.cc 2017-02-21 15:47:40 +0000
@@ -76,7 +76,7 @@
// Add the input queues.
for (InputQueue* wq : wh.get_portdock()->expedition_bootstrap()->queues()) {
- box.add(new InputQueueDisplay(&box, 0, 0, igb, wh, wq, true), UI::Align::kLeft);
+ box.add(new InputQueueDisplay(&box, 0, 0, igb, wh, wq, true));
}
return &box;
=== modified file 'src/wui/productionsitewindow.cc'
--- src/wui/productionsitewindow.cc 2017-01-25 18:55:59 +0000
+++ src/wui/productionsitewindow.cc 2017-02-21 15:47:40 +0000
@@ -56,7 +56,7 @@
for (uint32_t i = 0; i < inputqueues.size(); ++i) {
prod_box->add(
- new InputQueueDisplay(prod_box, 0, 0, igbase(), ps, inputqueues[i]), UI::Align::kLeft);
+ new InputQueueDisplay(prod_box, 0, 0, igbase(), ps, inputqueues[i]));
}
get_tabs()->add("wares", g_gr->images().get(pic_tab_wares), prod_box, _("Wares"));
@@ -88,12 +88,12 @@
_("Terminate the employment of the selected worker"));
evict_button->sigclicked.connect(
boost::bind(&ProductionSiteWindow::evict_worker, boost::ref(*this)));
- worker_caps_->add(evict_button, UI::Align::kHCenter);
+ worker_caps_->add(evict_button, UI::HAlign::kHCenter);
}
- worker_box->add(worker_table_, UI::Align::kLeft, true);
+ worker_box->add(worker_table_, UI::HAlign::kLeft, true);
worker_box->add_space(4);
- worker_box->add(worker_caps_, UI::Align::kLeft, true);
+ worker_box->add(worker_caps_, UI::HAlign::kLeft, true);
get_tabs()->add(
"workers", g_gr->images().get(pic_tab_workers), worker_box,
(ngettext("Worker", "Workers", productionsite().descr().nr_working_positions())));
=== modified file 'src/wui/shipwindow.cc'
--- src/wui/shipwindow.cc 2017-01-25 18:55:59 +0000
+++ src/wui/shipwindow.cc 2017-02-21 15:47:40 +0000
@@ -67,8 +67,7 @@
set_thinks(false);
die();
break;
- default:
- break;
+ // default: break;
}
}
});
@@ -81,92 +80,92 @@
display_ = new ItemWaresDisplay(vbox_.get(), *ship_.get_owner());
display_->set_capacity(ship_.descr().get_capacity());
- vbox_->add(display_, UI::Align::kHCenter, false);
+ vbox_->add(display_, UI::HAlign::kHCenter, false);
// Expedition buttons
if (ship_.state_is_expedition()) {
UI::Box* exp_top = new UI::Box(vbox_.get(), 0, 0, UI::Box::Horizontal);
- vbox_->add(exp_top, UI::Align::kHCenter, false);
+ vbox_->add(exp_top, UI::HAlign::kHCenter, false);
UI::Box* exp_mid = new UI::Box(vbox_.get(), 0, 0, UI::Box::Horizontal);
- vbox_->add(exp_mid, UI::Align::kHCenter, false);
+ vbox_->add(exp_mid, UI::HAlign::kHCenter, false);
UI::Box* exp_bot = new UI::Box(vbox_.get(), 0, 0, UI::Box::Horizontal);
- vbox_->add(exp_bot, UI::Align::kHCenter, false);
+ vbox_->add(exp_bot, UI::HAlign::kHCenter, false);
btn_scout_[WALK_NW - 1] =
make_button(exp_top, "scnw", _("Scout towards the north west"), pic_scout_nw,
boost::bind(&ShipWindow::act_scout_towards, this, WALK_NW));
- exp_top->add(btn_scout_[WALK_NW - 1], UI::Align::kLeft, false);
+ exp_top->add(btn_scout_[WALK_NW - 1], UI::HAlign::kLeft, false);
btn_explore_island_cw_ = make_button(
exp_top, "expcw", _("Explore the island’s coast clockwise"), pic_explore_cw,
boost::bind(&ShipWindow::act_explore_island, this, IslandExploreDirection::kClockwise));
- exp_top->add(btn_explore_island_cw_, UI::Align::kLeft, false);
+ exp_top->add(btn_explore_island_cw_, UI::HAlign::kLeft, false);
btn_scout_[WALK_NE - 1] =
make_button(exp_top, "scne", _("Scout towards the north east"), pic_scout_ne,
boost::bind(&ShipWindow::act_scout_towards, this, WALK_NE));
- exp_top->add(btn_scout_[WALK_NE - 1], UI::Align::kLeft, false);
+ exp_top->add(btn_scout_[WALK_NE - 1], UI::HAlign::kLeft, false);
btn_scout_[WALK_W - 1] =
make_button(exp_mid, "scw", _("Scout towards the west"), pic_scout_w,
boost::bind(&ShipWindow::act_scout_towards, this, WALK_W));
- exp_mid->add(btn_scout_[WALK_W - 1], UI::Align::kLeft, false);
+ exp_mid->add(btn_scout_[WALK_W - 1], UI::HAlign::kLeft, false);
btn_construct_port_ =
make_button(exp_mid, "buildport", _("Construct a port at the current location"),
pic_construct_port, boost::bind(&ShipWindow::act_construct_port, this));
- exp_mid->add(btn_construct_port_, UI::Align::kLeft, false);
+ exp_mid->add(btn_construct_port_, UI::HAlign::kLeft, false);
btn_scout_[WALK_E - 1] =
make_button(exp_mid, "sce", _("Scout towards the east"), pic_scout_e,
boost::bind(&ShipWindow::act_scout_towards, this, WALK_E));
- exp_mid->add(btn_scout_[WALK_E - 1], UI::Align::kLeft, false);
+ exp_mid->add(btn_scout_[WALK_E - 1], UI::HAlign::kLeft, false);
btn_scout_[WALK_SW - 1] =
make_button(exp_bot, "scsw", _("Scout towards the south west"), pic_scout_sw,
boost::bind(&ShipWindow::act_scout_towards, this, WALK_SW));
- exp_bot->add(btn_scout_[WALK_SW - 1], UI::Align::kLeft, false);
+ exp_bot->add(btn_scout_[WALK_SW - 1], UI::HAlign::kLeft, false);
btn_explore_island_ccw_ =
make_button(exp_bot, "expccw", _("Explore the island’s coast counter clockwise"),
pic_explore_ccw, boost::bind(&ShipWindow::act_explore_island, this,
IslandExploreDirection::kCounterClockwise));
- exp_bot->add(btn_explore_island_ccw_, UI::Align::kLeft, false);
+ exp_bot->add(btn_explore_island_ccw_, UI::HAlign::kLeft, false);
btn_scout_[WALK_SE - 1] =
make_button(exp_bot, "scse", _("Scout towards the south east"), pic_scout_se,
boost::bind(&ShipWindow::act_scout_towards, this, WALK_SE));
- exp_bot->add(btn_scout_[WALK_SE - 1], UI::Align::kLeft, false);
+ exp_bot->add(btn_scout_[WALK_SE - 1], UI::HAlign::kLeft, false);
}
// Bottom buttons
UI::Box* buttons = new UI::Box(vbox_.get(), 0, 0, UI::Box::Horizontal);
- vbox_->add(buttons, UI::Align::kLeft, false);
+ vbox_->add(buttons, UI::HAlign::kLeft, false);
btn_goto_ = make_button(
buttons, "goto", _("Go to ship"), pic_goto, boost::bind(&ShipWindow::act_goto, this));
- buttons->add(btn_goto_, UI::Align::kLeft, false);
+ buttons->add(btn_goto_, UI::HAlign::kLeft, false);
btn_destination_ = make_button(buttons, "destination", _("Go to destination"), pic_destination,
boost::bind(&ShipWindow::act_destination, this));
btn_destination_->set_enabled(false);
- buttons->add(btn_destination_, UI::Align::kLeft, false);
+ buttons->add(btn_destination_, UI::HAlign::kLeft, false);
btn_sink_ = make_button(
buttons, "sink", _("Sink the ship"), pic_sink, boost::bind(&ShipWindow::act_sink, this));
- buttons->add(btn_sink_, UI::Align::kLeft, false);
+ buttons->add(btn_sink_, UI::HAlign::kLeft, false);
if (ship_.state_is_expedition()) {
btn_cancel_expedition_ =
make_button(buttons, "cancel_expedition", _("Cancel the Expedition"),
pic_cancel_expedition, boost::bind(&ShipWindow::act_cancel_expedition, this));
- buttons->add(btn_cancel_expedition_, UI::Align::kLeft, false);
+ buttons->add(btn_cancel_expedition_, UI::HAlign::kLeft, false);
}
if (igbase_.get_display_flag(InteractiveBase::dfDebug)) {
btn_debug_ = make_button(buttons, "debug", _("Show Debug Window"), pic_debug,
boost::bind(&ShipWindow::act_debug, this));
btn_debug_->set_enabled(true);
- buttons->add(btn_debug_, UI::Align::kLeft, false);
+ buttons->add(btn_debug_, UI::HAlign::kLeft, false);
}
set_center_panel(vbox_.get());
set_thinks(true);
=== modified file 'src/wui/soldiercapacitycontrol.cc'
--- src/wui/soldiercapacitycontrol.cc 2017-01-25 18:55:59 +0000
+++ src/wui/soldiercapacitycontrol.cc 2017-02-21 15:47:40 +0000
@@ -79,16 +79,16 @@
g_gr->images().get("images/ui_basic/but4.png"),
g_gr->images().get("images/wui/buildings/menu_up_train.png"),
_("Increase capacity")),
- value_(this, "199", UI::Align::kCenter) {
+ value_(this, "199", UI::Align::kTopCenter) {
decrease_.sigclicked.connect(
boost::bind(&SoldierCapacityControl::click_decrease, boost::ref(*this)));
increase_.sigclicked.connect(
boost::bind(&SoldierCapacityControl::click_increase, boost::ref(*this)));
- add(new UI::Textarea(this, _("Capacity")), UI::Align::kHCenter);
- add(&decrease_, UI::Align::kHCenter);
- add(&value_, UI::Align::kHCenter);
- add(&increase_, UI::Align::kHCenter);
+ add(new UI::Textarea(this, _("Capacity")), UI::HAlign::kHCenter);
+ add(&decrease_, UI::HAlign::kHCenter);
+ add(&value_, UI::HAlign::kHCenter);
+ add(&increase_, UI::HAlign::kHCenter);
decrease_.set_repeating(true);
increase_.set_repeating(true);
=== modified file 'src/wui/soldierlist.cc'
--- src/wui/soldierlist.cc 2017-02-18 14:03:02 +0000
+++ src/wui/soldierlist.cc 2017-02-21 15:47:40 +0000
@@ -371,11 +371,11 @@
building_(building),
soldierpanel_(*this, igb.egbase(), building),
infotext_(this, _("Click soldier to send away")) {
- add(&soldierpanel_, UI::Align::kHCenter);
+ add(&soldierpanel_, UI::HAlign::kHCenter);
add_space(2);
- add(&infotext_, UI::Align::kHCenter);
+ add(&infotext_, UI::HAlign::kHCenter);
soldierpanel_.set_mouseover(boost::bind(&SoldierList::mouseover, this, _1));
soldierpanel_.set_click(boost::bind(&SoldierList::eject, this, _1));
@@ -406,7 +406,7 @@
_("Prefer Heroes"));
UI::Radiobutton* button = soldier_preference_.get_first_button();
while (button) {
- buttons->add(button, UI::Align::kLeft);
+ buttons->add(button);
button = button->next_button();
}
@@ -422,9 +422,9 @@
}
}
buttons->add_inf_space();
- buttons->add(create_soldier_capacity_control(*buttons, igb, building), UI::Align::kRight);
+ buttons->add(create_soldier_capacity_control(*buttons, igb, building), UI::HAlign::kRight);
- add(buttons, UI::Align::kHCenter, true);
+ add(buttons, UI::HAlign::kHCenter, true);
}
SoldierControl& SoldierList::soldiers() const {
=== modified file 'src/wui/suggested_teams_box.cc'
--- src/wui/suggested_teams_box.cc 2017-01-25 18:55:59 +0000
+++ src/wui/suggested_teams_box.cc 2017-02-21 15:47:40 +0000
@@ -51,7 +51,7 @@
set_size(max_x, max_y);
suggested_teams_box_label_ = new UI::Textarea(this, "", UI::Align::kCenterLeft);
- add(suggested_teams_box_label_, UI::Align::kLeft);
+ add(suggested_teams_box_label_);
}
SuggestedTeamsBox::~SuggestedTeamsBox() {
SuggestedTeamsBox::hide();
@@ -110,7 +110,7 @@
if (!is_first) {
lineup_box_->add_space(padding_);
vs_label = new UI::Textarea(lineup_box_, "x", UI::Align::kBottomCenter);
- lineup_box_->add(vs_label, UI::Align::kLeft);
+ lineup_box_->add(vs_label);
vs_label->set_visible(true);
vs_labels_.push_back(vs_label);
lineup_box_->add_space(padding_);
@@ -128,7 +128,7 @@
lineup_box_, 0, 0, player_image->width(), player_image->height(), player_image);
player_icon->set_visible(true);
player_icon->set_no_frame();
- lineup_box_->add(player_icon, UI::Align::kLeft);
+ lineup_box_->add(player_icon);
player_icons_.push_back(player_icon);
} // Players in team
} // Teams in lineup
=== modified file 'src/wui/ware_statistics_menu.cc'
--- src/wui/ware_statistics_menu.cc 2017-01-25 18:55:59 +0000
+++ src/wui/ware_statistics_menu.cc 2017-02-21 15:47:40 +0000
@@ -150,7 +150,7 @@
tabs->activate(0);
// Add tabbed environment to box
- box->add(tabs, UI::Align::kLeft, true);
+ box->add(tabs, UI::HAlign::kLeft, true);
// Register statistics data
for (Widelands::DescriptionIndex cur_ware = 0; cur_ware < nr_wares; ++cur_ware) {
@@ -180,12 +180,13 @@
box->add(
new StatisticWaresDisplay(
- box, 0, 0, parent.get_player()->tribe(),
- boost::bind(&WareStatisticsMenu::cb_changed_to, boost::ref(*this), _1, _2), color_map_),
- UI::Align::kLeft, true);
- box->add(new WuiPlotGenericAreaSlider(this, *plot_production_, this, 0, 0, kPlotWidth, 45,
- g_gr->images().get("images/ui_basic/but1.png")),
- UI::Align::kLeft, true);
+ box, 0, 0, parent.get_player()->tribe(),
+ boost::bind(&WareStatisticsMenu::cb_changed_to, boost::ref(*this), _1, _2), color_map_),
+ UI::HAlign::kLeft, true);
+ box->add(new WuiPlotGenericAreaSlider(
+ this, *plot_production_, this, 0, 0, kPlotWidth, 45,
+ g_gr->images().get("images/ui_basic/but1.png")),
+ UI::HAlign::kLeft, true);
}
/**
=== modified file 'src/wui/warehousewindow.cc'
--- src/wui/warehousewindow.cc 2017-01-25 18:55:59 +0000
+++ src/wui/warehousewindow.cc 2017-02-21 15:47:40 +0000
@@ -127,12 +127,12 @@
can_act_(gb_.can_act(wh_.owner().player_number())),
type_(type),
display_(this, width, wh_, type_, can_act_) {
- add(&display_, UI::Align::kLeft, true);
+ add(&display_, UI::HAlign::kLeft, true);
if (can_act_) {
UI::Box* buttons = new UI::Box(this, 0, 0, UI::Box::Horizontal);
UI::Button* b;
- add(buttons, UI::Align::kLeft);
+ add(buttons);
#define ADD_POLICY_BUTTON(policy, policyname, tooltip) \
b = new UI::Button( \
@@ -140,12 +140,12 @@
g_gr->images().get("images/wui/buildings/stock_policy_button_" #policy ".png"), tooltip), \
b->sigclicked.connect( \
boost::bind(&WarehouseWaresPanel::set_policy, this, Warehouse::StockPolicy::k##policyname)), \
- buttons->add(b, UI::Align::kHCenter);
+ buttons->add(b, UI::HAlign::kHCenter);
- ADD_POLICY_BUTTON(normal, Normal, _("Normal policy"))
- ADD_POLICY_BUTTON(prefer, Prefer, _("Preferably store selected wares here"))
+ ADD_POLICY_BUTTON(normal, Normal, _("Normal policy"))
+ ADD_POLICY_BUTTON(prefer, Prefer, _("Preferably store selected wares here"))
ADD_POLICY_BUTTON(dontstock, DontStock, _("Do not store selected wares here"))
- ADD_POLICY_BUTTON(remove, Remove, _("Remove selected wares from here"))
+ ADD_POLICY_BUTTON(remove, Remove, _("Remove selected wares from here"))
}
}
Follow ups
-
[Merge] lp:~widelands-dev/widelands/align-align into lp:widelands
From: noreply, 2017-02-24
-
Re: [Merge] lp:~widelands-dev/widelands/align-align into lp:widelands
From: GunChleoc, 2017-02-24
-
Re: [Merge] lp:~widelands-dev/widelands/align-align into lp:widelands
From: Klaus Halfmann, 2017-02-24
-
Re: [Merge] lp:~widelands-dev/widelands/align-align into lp:widelands
From: GunChleoc, 2017-02-24
-
[Merge] lp:~widelands-dev/widelands/align-align into lp:widelands
From: GunChleoc, 2017-02-24
-
Re: [Merge] lp:~widelands-dev/widelands/align-align into lp:widelands
From: Klaus Halfmann, 2017-02-24
-
Re: [Merge] lp:~widelands-dev/widelands/align-align into lp:widelands
From: Klaus Halfmann, 2017-02-24
-
Re: [Merge] lp:~widelands-dev/widelands/align-align into lp:widelands
From: Klaus Halfmann, 2017-02-24
-
Re: [Merge] lp:~widelands-dev/widelands/align-align into lp:widelands
From: GunChleoc, 2017-02-23
-
[Merge] lp:~widelands-dev/widelands/align-align into lp:widelands
From: bunnybot, 2017-02-23
-
Re: [Merge] lp:~widelands-dev/widelands/align-align into lp:widelands
From: Klaus Halfmann, 2017-02-23
-
Re: [Merge] lp:~widelands-dev/widelands/align-align into lp:widelands
From: Klaus Halfmann, 2017-02-22
-
[Merge] lp:~widelands-dev/widelands/align-align into lp:widelands
From: bunnybot, 2017-02-22
-
Re: [Merge] lp:~widelands-dev/widelands/align-align into lp:widelands
From: Klaus Halfmann, 2017-02-22
-
Re: [Merge] lp:~widelands-dev/widelands/align-align into lp:widelands
From: Klaus Halfmann, 2017-02-22
-
Re: [Merge] lp:~widelands-dev/widelands/align-align into lp:widelands
From: Klaus Halfmann, 2017-02-22
-
Re: [Merge] lp:~widelands-dev/widelands/align-align into lp:widelands
From: GunChleoc, 2017-02-22
-
[Merge] lp:~widelands-dev/widelands/align-align into lp:widelands
From: bunnybot, 2017-02-21
-
Re: [Merge] lp:~widelands-dev/widelands/align-align into lp:widelands
From: Klaus Halfmann, 2017-02-21
-
Re: [Merge] lp:~widelands-dev/widelands/align-align into lp:widelands
From: GunChleoc, 2017-02-21