diff options
author | rubidium <rubidium@openttd.org> | 2009-11-17 18:45:57 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-11-17 18:45:57 +0000 |
commit | abe1c6f3c70d3e2a28c7c2821e22ef650f60cc24 (patch) | |
tree | b91318c8d230ea62d5a666ae4493ac7931f90639 /src/window.cpp | |
parent | 673ebe0518b11307f464e6f35937855f0aa799b0 (diff) | |
download | openttd-abe1c6f3c70d3e2a28c7c2821e22ef650f60cc24.tar.xz |
(svn r18150) -Codechange: make the horizontal scrollbar scroll in the opposite direction with RTL
Diffstat (limited to 'src/window.cpp')
-rw-r--r-- | src/window.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/window.cpp b/src/window.cpp index 5cfae5d49..bca74130b 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -1676,10 +1676,12 @@ static bool HandleScrollbarScrolling() int i; Scrollbar *sb; + bool rtl = false; if (w->flags4 & WF_HSCROLL) { sb = &w->hscroll; i = _cursor.pos.x - _cursorpos_drag_start.x; + rtl = _dynlang.text_dir == TD_RTL; } else if (w->flags4 & WF_SCROLL2) { sb = &w->vscroll2; i = _cursor.pos.y - _cursorpos_drag_start.y; @@ -1690,6 +1692,7 @@ static bool HandleScrollbarScrolling() /* Find the item we want to move to and make sure it's inside bounds. */ int pos = min(max(0, i + _scrollbar_start_pos) * sb->GetCount() / _scrollbar_size, max(0, sb->GetCount() - sb->GetCapacity())); + if (rtl) pos = sb->GetCount() - sb->GetCapacity() - pos; if (pos != sb->GetPosition()) { sb->SetPosition(pos); w->SetDirty(); |