From 45a7bce83d2df2e0942a97754a4f8f1749a2c828 Mon Sep 17 00:00:00 2001 From: rubidium Date: Wed, 18 Nov 2009 21:27:13 +0000 Subject: (svn r18174) -Codechange: make the sign list RTL aware --- src/signs_gui.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/signs_gui.cpp b/src/signs_gui.cpp index d87d03da4..cb54f3efb 100644 --- a/src/signs_gui.cpp +++ b/src/signs_gui.cpp @@ -119,14 +119,19 @@ struct SignListWindow : Window, SignList { return; } + bool rtl = _dynlang.text_dir == TD_RTL; + uint icon_left = 4 + (rtl ? r.right - this->text_offset : r.left); + uint text_left = r.left + (rtl ? WD_FRAMERECT_LEFT : this->text_offset); + uint text_right = r.right - (rtl ? this->text_offset : WD_FRAMERECT_RIGHT); + /* At least one sign available. */ for (uint16 i = this->vscroll.GetPosition(); this->vscroll.IsVisible(i) && i < this->vscroll.GetCount(); i++) { const Sign *si = this->signs[i]; - if (si->owner != OWNER_NONE) DrawCompanyIcon(si->owner, r.left + 4, y + 1); + if (si->owner != OWNER_NONE) DrawCompanyIcon(si->owner, icon_left, y + 1); SetDParam(0, si->index); - DrawString(r.left + this->text_offset, r.right - WD_FRAMETEXT_RIGHT, y, STR_SIGN_NAME, TC_YELLOW); + DrawString(text_left, text_right, y, STR_SIGN_NAME, TC_YELLOW); y += this->resize.step_height; } break; -- cgit v1.2.3-70-g09d2