From 68400db74938e5e6190a7b4ec0643de745d73461 Mon Sep 17 00:00:00 2001 From: rubidium Date: Thu, 19 Nov 2009 15:45:08 +0000 Subject: [PATCH] (svn r18183) -Codechange: make the NewGRF window RTL aware --- src/newgrf_gui.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/newgrf_gui.cpp b/src/newgrf_gui.cpp index 01c169428b..5ffe44452a 100644 --- a/src/newgrf_gui.cpp +++ b/src/newgrf_gui.cpp @@ -638,6 +638,12 @@ struct NewGRFWindow : public Window { 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 @@ struct NewGRFWindow : public Window { } } - 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; } }