From d96866511005997a7ba51a893091daadd0cedd64 Mon Sep 17 00:00:00 2001 From: aryanrawlani28 Date: Mon, 18 May 2020 23:46:20 +0530 Subject: [PATCH] GUI: Code cleanup and small issue fixes --- gui/gui-manager.cpp | 11 ++--------- gui/options.cpp | 9 ++------- gui/widget.cpp | 4 ++-- gui/widgets/scrollcontainer.cpp | 7 +++++-- 4 files changed, 11 insertions(+), 20 deletions(-) diff --git a/gui/gui-manager.cpp b/gui/gui-manager.cpp index 5cf03ce0ac0..b204172e5d8 100644 --- a/gui/gui-manager.cpp +++ b/gui/gui-manager.cpp @@ -586,11 +586,7 @@ void GuiManager::processEvent(const Common::Event &event, Dialog *const activeDi Common::Point mouse(event.mouse.x - activeDialog->_x, event.mouse.y - activeDialog->_y); if (g_gui.useRTL()) { - mouse.x = g_system->getOverlayWidth() - event.mouse.x - activeDialog->_x; - - if (g_gui.getOverlayOffset() != 0) { - mouse.x = g_gui.getOverlayOffset() + mouse.x; - } + mouse.x = g_system->getOverlayWidth() - event.mouse.x - activeDialog->_x + g_gui.getOverlayOffset(); } switch (event.type) { @@ -602,10 +598,7 @@ void GuiManager::processEvent(const Common::Event &event, Dialog *const activeDi break; case Common::EVENT_MOUSEMOVE: if (g_gui.useRTL()) { - _globalMousePosition.x = g_system->getOverlayWidth() - event.mouse.x; - if (g_gui.getOverlayOffset() != 0) { - _globalMousePosition.x = g_gui.getOverlayOffset() + _globalMousePosition.x; - } + _globalMousePosition.x = g_system->getOverlayWidth() - event.mouse.x + g_gui.getOverlayOffset(); } else { _globalMousePosition.x = event.mouse.x; } diff --git a/gui/options.cpp b/gui/options.cpp index e19e583a063..3ec648e4a47 100644 --- a/gui/options.cpp +++ b/gui/options.cpp @@ -1827,13 +1827,8 @@ void GlobalOptionsDialog::build() { addAccessibilityControls(tab, "GlobalOptions_Accessibility."); #endif // USE_TTS - // GUI TODO: Incomplete implementation, currently just switches to last tab. - if (g_gui.useRTL()) { - tab->setActiveTab(tab->getTabsSize() - 1); - } else { - // Activate the first tab - tab->setActiveTab(0); - } + // Activate the first tab + tab->setActiveTab(0); _tabWidget = tab; // Add OK & Cancel buttons diff --git a/gui/widget.cpp b/gui/widget.cpp index d1fea860081..55f2b436048 100644 --- a/gui/widget.cpp +++ b/gui/widget.cpp @@ -526,8 +526,8 @@ void DropdownButtonWidget::clearEntries() { _entries.clear(); } -void DropdownButtonWidget::drawWidget() { // These are okay, no need to flip again. - if (_entries.empty()) { // GUI TODO: However, down arrow should be to the right. Figure out a way to flip the widget internally? +void DropdownButtonWidget::drawWidget() { + if (_entries.empty()) { // Degrade to a regular button g_gui.theme()->drawButton(Common::Rect(_x, _y, _x + _w, _y + _h), _label, _state); } else { diff --git a/gui/widgets/scrollcontainer.cpp b/gui/widgets/scrollcontainer.cpp index bcd28570586..35f7f346d68 100644 --- a/gui/widgets/scrollcontainer.cpp +++ b/gui/widgets/scrollcontainer.cpp @@ -142,8 +142,11 @@ void ScrollContainerWidget::reflowLayout() { void ScrollContainerWidget::drawWidget() { // GUI TODO: Recheck what the below line does. - if (this->_name.contains("GameOptions") || this->_name.contains("GlobalOptions")) - _x = g_system->getOverlayWidth() - _w - _x; + if (g_gui.useRTL()) { + if (this->_name.contains("GameOptions") || this->_name.contains("GlobalOptions")) { + _x = g_system->getOverlayWidth() - _x - _w + g_gui.getOverlayOffset(); + } + } g_gui.theme()->drawWidgetBackground(Common::Rect(_x, _y, _x + _w, _y + getHeight()), _backgroundType); }