widelands-dev team mailing list archive
-
widelands-dev team
-
Mailing list archive
-
Message #05913
[Merge] lp:~widelands-dev/widelands/bug-1542214 into lp:widelands
GunChleoc has proposed merging lp:~widelands-dev/widelands/bug-1542214 into lp:widelands.
Commit message:
Consistent ordering of OK/Cancel buttons - the OK button is always on the right for LTR languages, and on the left for RTL languages.
Requested reviews:
Widelands Developers (widelands-dev)
For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/bug-1542214/+merge/285260
Consistent ordering of OK/Cancel buttons - the OK button is always on the right for LTR languages, and on the left for RTL languages.
It would be nice to have a specialized Box object for button rows, but that's something I can look into for Build 20.
--
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/bug-1542214 into lp:widelands.
=== modified file 'src/editor/ui_menus/editor_main_menu_load_or_save_map.cc'
--- src/editor/ui_menus/editor_main_menu_load_or_save_map.cc 2016-01-29 08:37:22 +0000
+++ src/editor/ui_menus/editor_main_menu_load_or_save_map.cc 2016-02-06 11:02:27 +0000
@@ -25,6 +25,7 @@
#include "base/i18n.h"
#include "base/wexception.h"
#include "editor/editorinteractive.h"
+#include "graphic/font_handler1.h"
#include "graphic/graphic.h"
#include "io/filesystem/filesystem.h"
#include "io/filesystem/layered_filesystem.h"
@@ -50,7 +51,7 @@
this, right_column_x_, tabley_, get_inner_w() - right_column_x_ - padding_, tableh_),
ok_(this,
"ok",
- get_inner_w() / 2 - butw_ - padding_,
+ UI::g_fh1->fontset().is_rtl() ? get_inner_w() / 2 - butw_ - padding_ : get_inner_w() / 2 + padding_,
get_inner_h() - padding_ - buth_,
butw_,
buth_,
@@ -58,7 +59,9 @@
_("OK")),
cancel_(this,
"cancel",
- get_inner_w() / 2 + padding_,
+ UI::g_fh1->fontset().is_rtl() ?
+ get_inner_w() / 2 + padding_ :
+ get_inner_w() / 2 - butw_ - padding_,
get_inner_h() - padding_ - buth_,
butw_,
buth_,
=== modified file 'src/editor/ui_menus/editor_main_menu_map_options.cc'
--- src/editor/ui_menus/editor_main_menu_map_options.cc 2016-01-31 10:57:58 +0000
+++ src/editor/ui_menus/editor_main_menu_map_options.cc 2016-02-06 11:02:27 +0000
@@ -26,6 +26,7 @@
#include "base/i18n.h"
#include "editor/editorinteractive.h"
+#include "graphic/font_handler1.h"
#include "graphic/graphic.h"
#include "logic/map.h"
#include "ui_basic/editbox.h"
@@ -57,13 +58,15 @@
max_w_(get_inner_w() - 2 * padding_),
ok_(
this, "ok",
- padding_, get_inner_h() - padding_ - buth_,
+ UI::g_fh1->fontset().is_rtl() ? padding_ : butw_ + 2 * padding_,
+ get_inner_h() - padding_ - buth_,
butw_, buth_,
g_gr->images().get("images/ui_basic/but5.png"),
_("OK")),
cancel_(
this, "cancel",
- butw_ + 2 * padding_, get_inner_h() - padding_ - buth_,
+ UI::g_fh1->fontset().is_rtl() ? butw_ + 2 * padding_ : padding_,
+ get_inner_h() - padding_ - buth_,
butw_, buth_,
g_gr->images().get("images/ui_basic/but1.png"),
_("Cancel")),
=== modified file 'src/editor/ui_menus/editor_main_menu_new_map.cc'
--- src/editor/ui_menus/editor_main_menu_new_map.cc 2016-01-29 08:37:22 +0000
+++ src/editor/ui_menus/editor_main_menu_new_map.cc 2016-02-06 11:02:27 +0000
@@ -28,6 +28,7 @@
#include "base/i18n.h"
#include "base/macros.h"
#include "editor/editorinteractive.h"
+#include "graphic/font_handler1.h"
#include "graphic/graphic.h"
#include "graphic/image.h"
#include "graphic/texture.h"
@@ -92,8 +93,13 @@
cancel_button_.sigclicked.connect(boost::bind(&MainMenuNewMap::clicked_cancel, this));
ok_button_.sigclicked.connect(boost::bind(&MainMenuNewMap::clicked_create_map, this));
- button_box_.add(&cancel_button_, UI::Align::kLeft);
- button_box_.add(&ok_button_, UI::Align::kLeft);
+ if (UI::g_fh1->fontset().is_rtl()) {
+ button_box_.add(&ok_button_, UI::Align::kLeft);
+ button_box_.add(&cancel_button_, UI::Align::kLeft);
+ } else {
+ button_box_.add(&cancel_button_, UI::Align::kLeft);
+ button_box_.add(&ok_button_, UI::Align::kLeft);
+ }
box_.add(&button_box_, UI::Align::kLeft);
box_.set_size(box_width_,
=== modified file 'src/editor/ui_menus/editor_main_menu_random_map.cc'
--- src/editor/ui_menus/editor_main_menu_random_map.cc 2016-01-31 10:57:58 +0000
+++ src/editor/ui_menus/editor_main_menu_random_map.cc 2016-02-06 11:02:27 +0000
@@ -292,8 +292,13 @@
// ---------- "Generate Map" button ----------
cancel_button_.sigclicked.connect(boost::bind(&MainMenuNewRandomMap::clicked_cancel, this));
ok_button_.sigclicked.connect(boost::bind(&MainMenuNewRandomMap::clicked_create_map, this));
- button_box_.add(&cancel_button_, UI::Align::kLeft);
- button_box_.add(&ok_button_, UI::Align::kLeft);
+ if (UI::g_fh1->fontset().is_rtl()) {
+ button_box_.add(&ok_button_, UI::Align::kLeft);
+ button_box_.add(&cancel_button_, UI::Align::kLeft);
+ } else {
+ button_box_.add(&cancel_button_, UI::Align::kLeft);
+ button_box_.add(&ok_button_, UI::Align::kLeft);
+ }
box_.add(&button_box_, UI::Align::kLeft);
box_height += margin_ + button_box_.get_h();
box_height += 6 * margin_;
=== modified file 'src/editor/ui_menus/editor_main_menu_save_map_make_directory.cc'
--- src/editor/ui_menus/editor_main_menu_save_map_make_directory.cc 2016-01-31 10:57:58 +0000
+++ src/editor/ui_menus/editor_main_menu_save_map_make_directory.cc 2016-02-06 11:02:27 +0000
@@ -20,6 +20,7 @@
#include "editor/ui_menus/editor_main_menu_save_map_make_directory.h"
#include "base/i18n.h"
+#include "graphic/font_handler1.h"
#include "graphic/graphic.h"
MainMenuSaveMapMakeDirectory::MainMenuSaveMapMakeDirectory
@@ -35,13 +36,15 @@
edit_(&vbox_, 0, 0, get_inner_w() - 2 * padding_, g_gr->images().get("images/ui_basic/but1.png")),
ok_button_(
this, "ok",
- padding_, get_inner_h() - padding_ - buth_,
+ UI::g_fh1->fontset().is_rtl() ? padding_ : get_inner_w() - butw_ - padding_,
+ get_inner_h() - padding_ - buth_,
butw_, buth_,
g_gr->images().get("images/ui_basic/but5.png"),
_("OK")),
cancel_button_(
this, "cancel",
- get_inner_w() - butw_ - padding_, get_inner_h() - padding_ - buth_,
+ UI::g_fh1->fontset().is_rtl() ?get_inner_w() - butw_ - padding_ : padding_,
+ get_inner_h() - padding_ - buth_,
butw_, buth_,
g_gr->images().get("images/ui_basic/but1.png"),
_("Cancel")) {
=== modified file 'src/ui_fsmenu/options.cc'
--- src/ui_fsmenu/options.cc 2016-01-29 08:37:22 +0000
+++ src/ui_fsmenu/options.cc 2016-02-06 11:02:27 +0000
@@ -116,7 +116,7 @@
// Buttons
cancel_
(this, "cancel",
- get_w() * 1 / 4 - butw_ / 2,
+ UI::g_fh1->fontset().is_rtl() ? get_w() * 3 / 4 - butw_ / 2 : get_w() * 1 / 4 - butw_ / 2,
get_inner_h() - hmargin_,
butw_, buth_,
g_gr->images().get("images/ui_basic/but0.png"),
@@ -130,7 +130,7 @@
_("Apply"), std::string(), true, false),
ok_
(this, "ok",
- get_w() * 3 / 4 - butw_ / 2,
+ UI::g_fh1->fontset().is_rtl() ? get_w() * 1 / 4 - butw_ / 2 : get_w() * 3 / 4 - butw_ / 2,
get_inner_h() - hmargin_,
butw_, buth_,
g_gr->images().get("images/ui_basic/but2.png"),
=== modified file 'src/wui/actionconfirm.cc'
--- src/wui/actionconfirm.cc 2016-01-29 08:37:22 +0000
+++ src/wui/actionconfirm.cc 2016-02-06 11:02:27 +0000
@@ -23,6 +23,7 @@
#include "base/macros.h"
#include "economy/economy.h"
+#include "graphic/font_handler1.h"
#include "graphic/graphic.h"
#include "logic/map_objects/tribes/building.h"
#include "logic/map_objects/tribes/ship.h"
@@ -153,7 +154,7 @@
UI::Button * okbtn =
new UI::Button
(this, "ok",
- 6, 80, 80, 34,
+ UI::g_fh1->fontset().is_rtl() ? 6 : 114, 80, 80, 34,
g_gr->images().get("images/ui_basic/but4.png"),
g_gr->images().get("images/wui/menu_okay.png"));
okbtn->sigclicked.connect(boost::bind(&ActionConfirm::ok, this));
@@ -161,7 +162,7 @@
UI::Button * cancelbtn =
new UI::Button
(this, "abort",
- 114, 80, 80, 34,
+ UI::g_fh1->fontset().is_rtl() ? 114 : 6, 80, 80, 34,
g_gr->images().get("images/ui_basic/but4.png"),
g_gr->images().get("images/wui/menu_abort.png"));
cancelbtn->sigclicked.connect(boost::bind(&ActionConfirm::die, this));
=== modified file 'src/wui/login_box.cc'
--- src/wui/login_box.cc 2016-01-31 10:57:58 +0000
+++ src/wui/login_box.cc 2016-02-06 11:02:27 +0000
@@ -20,6 +20,7 @@
#include "wui/login_box.h"
#include "base/i18n.h"
+#include "graphic/font_handler1.h"
#include "profile/profile.h"
#include "ui_basic/button.h"
#include "ui_basic/messagebox.h"
@@ -54,14 +55,20 @@
UI::Button * loginbtn = new UI::Button
(this, "login",
- (get_inner_w() / 2 - 200) / 2, get_inner_h() - 20 - margin,
+ UI::g_fh1->fontset().is_rtl() ?
+ (get_inner_w() / 2 - 200) / 2 :
+ (get_inner_w() / 2 - 200) / 2 + get_inner_w() / 2,
+ get_inner_h() - 20 - margin,
200, 20,
g_gr->images().get("images/ui_basic/but5.png"),
_("Login"));
loginbtn->sigclicked.connect(boost::bind(&LoginBox::clicked_ok, boost::ref(*this)));
UI::Button * cancelbtn = new UI::Button
(this, "cancel",
- (get_inner_w() / 2 - 200) / 2 + get_inner_w() / 2, loginbtn->get_y(), 200, 20,
+ UI::g_fh1->fontset().is_rtl() ?
+ (get_inner_w() / 2 - 200) / 2 + get_inner_w() / 2 :
+ (get_inner_w() / 2 - 200) / 2,
+ loginbtn->get_y(), 200, 20,
g_gr->images().get("images/ui_basic/but1.png"),
_("Cancel"));
cancelbtn->sigclicked.connect(boost::bind(&LoginBox::clicked_back, boost::ref(*this)));
Follow ups