Mercurial > hg > openttd
changeset 13659:2c473236b6fd draft
(svn r18183) -Codechange: make the NewGRF window RTL aware
author | rubidium <rubidium@openttd.org> |
---|---|
date | Thu, 19 Nov 2009 15:45:08 +0000 |
parents | d966e0ee1000 |
children | b9302d9e1874 |
files | src/newgrf_gui.cpp |
diffstat | 1 files changed, 10 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/newgrf_gui.cpp +++ b/src/newgrf_gui.cpp @@ -638,6 +638,12 @@ case SNGRFS_FILE_LIST: { uint y = r.top + WD_MATRIX_TOP; + bool rtl = _dynlang.text_dir == TD_RTL; + uint text_left = rtl ? r.left + WD_FRAMERECT_LEFT : r.left + 25; + uint text_right = rtl ? r.right - 25 : r.right - WD_FRAMERECT_RIGHT; + uint square_left = rtl ? r.right - 15 : r.left + 5; + uint warning_left = rtl ? r.right - 30 : r.left + 20; + int i = 0; for (const GRFConfig *c = this->list; c != NULL; c = c->next, i++) { if (this->vscroll.IsVisible(i)) { @@ -667,10 +673,10 @@ } } - DrawSprite(SPR_SQUARE, pal, r.left + 5, y - 1); - if (c->error != NULL) DrawSprite(SPR_WARNING_SIGN, 0, r.left + 20, y - 1); - byte txtoffset = c->error != NULL ? 35 : 25; - DrawString(r.left + txtoffset, r.right - WD_FRAMERECT_RIGHT, y, text, this->sel == c ? TC_WHITE : TC_BLACK); + DrawSprite(SPR_SQUARE, pal, square_left, y - 1); + if (c->error != NULL) DrawSprite(SPR_WARNING_SIGN, 0, warning_left, y - 1); + uint txtoffset = c->error == NULL ? 0 : 10; + DrawString(text_left + (rtl ? 0 : txtoffset), text_right - (rtl ? txtoffset : 0), y, text, this->sel == c ? TC_WHITE : TC_BLACK); y += this->resize.step_height; } }