summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2013-08-18 20:06:01 +0000
committerfrosch <frosch@openttd.org>2013-08-18 20:06:01 +0000
commit87ef3ab449d2607a6e268afbc959d6df91f2368b (patch)
tree0d5e69dc594f390354b85d7e447f14d2eb9a276a
parentf89375aa44959efe4a8a098a13ac7f66897faaa2 (diff)
downloadopenttd-87ef3ab449d2607a6e268afbc959d6df91f2368b.tar.xz
(svn r25732) -Fix: In BuildIndustryWindow in RTL mode, draw industry color icon at the right. (sbr)
-rw-r--r--src/industry_gui.cpp25
1 files changed, 19 insertions, 6 deletions
diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp
index be2336dce..49f71e909 100644
--- a/src/industry_gui.cpp
+++ b/src/industry_gui.cpp
@@ -379,24 +379,37 @@ public:
virtual void DrawWidget(const Rect &r, int widget) const
{
switch (widget) {
- case WID_DPI_MATRIX_WIDGET:
+ case WID_DPI_MATRIX_WIDGET: {
+ uint text_left, text_right, icon_left, icon_right;
+ if (_current_text_dir == TD_RTL) {
+ icon_right = r.right - WD_MATRIX_RIGHT;
+ icon_left = icon_right - 10;
+ text_right = icon_right - BuildIndustryWindow::MATRIX_TEXT_OFFSET;
+ text_left = r.left + WD_MATRIX_LEFT;
+ } else {
+ icon_left = r.left + WD_MATRIX_LEFT;
+ icon_right = icon_left + 10;
+ text_left = icon_left + BuildIndustryWindow::MATRIX_TEXT_OFFSET;
+ text_right = r.right - WD_MATRIX_RIGHT;
+ }
+
for (byte i = 0; i < this->vscroll->GetCapacity() && i + this->vscroll->GetPosition() < this->count; i++) {
- int x = r.left + WD_MATRIX_LEFT;
int y = r.top + WD_MATRIX_TOP + i * this->resize.step_height;
bool selected = this->selected_index == i + this->vscroll->GetPosition();
if (this->index[i + this->vscroll->GetPosition()] == INVALID_INDUSTRYTYPE) {
- DrawString(x + MATRIX_TEXT_OFFSET, r.right - WD_MATRIX_RIGHT, y, STR_FUND_INDUSTRY_MANY_RANDOM_INDUSTRIES, selected ? TC_WHITE : TC_ORANGE);
+ DrawString(text_left, text_right, y, STR_FUND_INDUSTRY_MANY_RANDOM_INDUSTRIES, selected ? TC_WHITE : TC_ORANGE);
continue;
}
const IndustrySpec *indsp = GetIndustrySpec(this->index[i + this->vscroll->GetPosition()]);
/* Draw the name of the industry in white is selected, otherwise, in orange */
- DrawString(x + MATRIX_TEXT_OFFSET, r.right - WD_MATRIX_RIGHT, y, indsp->name, selected ? TC_WHITE : TC_ORANGE);
- GfxFillRect(x, y + 1, x + 10, y + 7, selected ? PC_WHITE : PC_BLACK);
- GfxFillRect(x + 1, y + 2, x + 9, y + 6, indsp->map_colour);
+ DrawString(text_left, text_right, y, indsp->name, selected ? TC_WHITE : TC_ORANGE);
+ GfxFillRect(icon_left, y + 1, icon_right, y + 7, selected ? PC_WHITE : PC_BLACK);
+ GfxFillRect(icon_left + 1, y + 2, icon_right - 1, y + 6, indsp->map_colour);
}
break;
+ }
case WID_DPI_INFOPANEL: {
int y = r.top + WD_FRAMERECT_TOP;