[Scummvm-git-logs] scummvm master -> e3db189f0b51f49c937e302f4b944d8495c62fc3

sev- sev at scummvm.org
Sun Jun 21 22:04:00 UTC 2020


This automated email contains information about 84 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
08f5efd23e GUI: RTL: Add rtl flag and helper function to widget
5db49a6d1e GUI: RTL: Test for strict RTL GUI
1bd2701597 GUI: RTL: Fix caret position
9593b3b3fe GUI: RTL: Fix tooltip rendering
8966d9dfd9 GUI: RTL: Correctly draw dialogs
abd24fb1cb GUI: RTL: Base support for Sliders
5be57e5394 JANITORIAL: Replace my todos with "GUI TODO:"
f8ee449227 GUI: RTL: Right align main list text
bf26fbcd25 GUI: RTL: Make tooltip messages rtl friendly
e4352391c2 GUI: RTL: Fix popup open location
e5fc39bb98 GUI: RTL: Support stacked dialogs and fix mouse events for them
0420dc4f6d GUI: Fix review issues, code cleanup
732e79b1cf GUI: RTL: Add disabled code for tab drawing
28c70dd196 GUI: RTL: Correctly draw for stacked dialogs
a7fe8ad7d8 GUI: Rename some variable and fix review issues
b8f51ce33a GUI: RTL: Base support for radiobuttons and checkboxes
f09d15d610 GUI: RTL: Perfect drawing of popups and right align text
5e39545653 GUI: RTL: Fix tooltips and scrollbars for overlay dialogs
d6c2d4b809 GUI: RTL: Align fixes for text in Load game dialog
d6a340d3b4 GUI: Cleanup hacky function for internal flip and fix review issues
37c5013ef4 GUI: RTL: Alignment fixes for all StaticTextWidgets
a587624cb3 GUI: RTL: Internal flipping for DropDownButton
dda3ce0929 GUI: RTL: Rework remap widget for supporting RTL
c7469a1145 GUI: RTL: Base support for tab widgets
d968665110 GUI: Code cleanup and small issue fixes
143b9fb13c GUI: RTL: Radiobuttons and Checkboxes RTL layout
f55654f1bc GUI: RTL: Popup RTL Layout and Correctly draw them
f3e4e3e009 GUI: Code & comment cleanup, fix review issues
5d8f6a2281 GUI: RTL: Rebuild theme packages for supporting RTL
ab4ac760fb GUI: RTL: Disable usage of RTL layout by default
7e27af8148 GUI: Code cleanup
50aa421bf3 GUI: RTL: Fix display issues with some widgets
4699880c99 GUI: RTL: Support internal flipping of Sliders
58704be218 GUI: RTL: Correctly draw tabs, consistent among screen sizes and different themes
07ab77d065 GUI: RTL: Get internal widget RTL flag from theme
60d462977b GUI: RTL: Update layout files for optional rtl flags
1715256c61 GUI: RTL: Add new draw steps for RTL-based widgets
4816207f78 GUI: RTL: Update theme packages to use new drawsteps for RTL
d9fc7c5cba GUI: Bump theme versions to support RTL features
531303e482 GUI: Rebuild themes for new theme versions
8871d1df5e GUI: Rebuild fallback theme for supporting RTL
cef4f20eec GUI: RTL: Support navigating in options dialog
aa802df7aa GUI: RTL: Fix lists being overdrawn when tooltip focused
c83e57fc69 GUI: JANITORIAL: Code cleanup, add comments
312862b541 GUI: RTL: Correctly draw backgrounds of Tabs
6fdffcbbec GUI: RTL: Add nortl flag to sliders in layout files
036927cd2e GUI: RTL: Fix consistency issues for draw steps for widgets in gfx files
988f6fa03f GUI: RTL: Rebuild themes for bugfixes and nortl flag for sliders
ef99424792 GUI: RTL: Fix mouse movements for slider when nortl
b8a9331138 GUI: RTL: Shift to a better way of positioning when dialogs are stacked
5d040e804f GUI: RTL: Correctly draw popups with text and fix mouse events
28e2a9e1c4 GUI: RTL: Fix uninitialized variable
5c334d56ad GUI: RTL: Fix tabs for smallres and when removed
d9f483d311 GUI: RTL: Fix loadgame icons not being displayed
c2708e350f GUI: RTL: Change alignment of editable to right in RTL
17193319b9 GUI: RTL: Fix alignment for DropDownButtonWidget
6ecc90edf6 GUI: RTL: Implement RTL for lists and numbers
076623d419 GUI: Remove useless code and comments
6268c9e8ef GUI: RTL: Fix padding for popup disabled in gfx file
92459c1773 GUI: RTL: Update Remastered theme for disabled dialog bugfix
7d4e110255 GUI: RTL: Update default theme for all RTL changes
48eb0d095c GUI: RTL: Remove hardcoded padding for RTL tabs layout
a832e7f423 GUI: RTL: Allow switching from one layout to other after selecting languages
12b26cec07 GUI: RTL: Revise numeric layout in predictive dialog and flip them again
5e0d5b8322 GUI: RTL: Disable RTL by default
0f40989633 GUI: Code cleanup, add comments about RTL
38e827d1e9 GUI: RTL: Correct behaviour of predictive dialogs for rtl layout
19aa7baba7 GUI: RTL: Wrapping a variable used for rtl
6211747fd3 GUI: RTL: Fix missing backgrounds for tabs in hebrew when navbars present
54279790b7 GUI: RTL: Enable RTL by default for Hebrew
e50463f11f GUI: JANITORIAL: Improve readability - remove nested ternary op
12a4af77bd GUI: Code cleanup
dde4200d35 GUI: RTL: Overload and simplify getWidgetData for getting rtl flag
9cd2ef1271 GUI: RTL: Cleanup tab drawing to make it simpler
5a093e4e95 GUI: RTL: Improve right align text drawing
0005944df3 GUI: RTL: Use proper alignment for achievements tab
1ae2de366b GUI: RTL: Improve tab drawing for rtl
e6e32aeb75 GUI: use start + end for horizontal align
4fc9c11bbe GUI: use start + end for static widgets
51d95f8978 GRAPHICS: move start + end to Graphics::TextAlign
2677b022d1 GUI: Update layout files to use 'end' instead of 'right'
cf208a711d GUI: Rebuild theme packages to use updated align 'end'
86c11597b8 GUI: Rebuild inbuilt theme to use new aligns 'start' and 'end'
e3db189f0b GUI: RTL: Fix small issues


Commit: 08f5efd23e7088ac7c3d4a4d32faf49dc6bdabe7
    https://github.com/scummvm/scummvm/commit/08f5efd23e7088ac7c3d4a4d32faf49dc6bdabe7
Author: aryanrawlani28 (aryanrawlani007 at gmail.com)
Date: 2020-06-22T00:03:02+02:00

Commit Message:
GUI: RTL: Add rtl flag and helper function to widget

Changed paths:
    gui/ThemeParser.cpp
    gui/ThemeParser.h
    gui/themes/scummmodern/scummmodern_layout.stx
    gui/themes/scummremastered/remastered_layout.stx
    gui/widget.cpp
    gui/widget.h


diff --git a/gui/ThemeParser.cpp b/gui/ThemeParser.cpp
index 9b9885bff5..96d10e9ee7 100644
--- a/gui/ThemeParser.cpp
+++ b/gui/ThemeParser.cpp
@@ -684,6 +684,7 @@ bool ThemeParser::parserCallback_widget(ParserNode *node) {
 		var = node->values["name"];
 		int width = -1;
 		int height = -1;
+		bool useRTL = true;
 
 		if (node->values.contains("width")) {
 			if (_theme->getEvaluator()->hasVar(node->values["width"]) == true)
@@ -708,6 +709,10 @@ bool ThemeParser::parserCallback_widget(ParserNode *node) {
 				return parserError("Invalid value for text alignment.");
 		}
 
+		if (node->values.contains("rtl")) {
+			useRTL = false;
+		}
+
 		_theme->getEvaluator()->addWidget(var, node->values["type"], width, height, alignH);
 	}
 
diff --git a/gui/ThemeParser.h b/gui/ThemeParser.h
index 661bccccf2..1b3004f1ac 100644
--- a/gui/ThemeParser.h
+++ b/gui/ThemeParser.h
@@ -177,6 +177,7 @@ protected:
 					XML_PROP(padding, false)
 					XML_PROP(resolution, false)
 					XML_PROP(textalign, false)
+					XML_PROP(rtl, false)
 				KEY_END()
 			KEY_END()
 
@@ -203,6 +204,7 @@ protected:
 						XML_PROP(height, false)
 						XML_PROP(type, false)
 						XML_PROP(textalign, false)
+						XML_PROP(rtl, false)
 					KEY_END()
 
 					XML_KEY(space)
diff --git a/gui/themes/scummmodern/scummmodern_layout.stx b/gui/themes/scummmodern/scummmodern_layout.stx
index 62285d472d..4be7bc2016 100644
--- a/gui/themes/scummmodern/scummmodern_layout.stx
+++ b/gui/themes/scummmodern/scummmodern_layout.stx
@@ -135,6 +135,7 @@
 			<widget name = 'Logo'
 					width = '287'
 					height = '80'
+					rtl = 'no'
 			/>
 			<layout type = 'horizontal'  spacing = '5' padding = '10, 0, 0, 0'>
 				<widget name = 'SearchPic'
diff --git a/gui/themes/scummremastered/remastered_layout.stx b/gui/themes/scummremastered/remastered_layout.stx
index 62285d472d..4be7bc2016 100644
--- a/gui/themes/scummremastered/remastered_layout.stx
+++ b/gui/themes/scummremastered/remastered_layout.stx
@@ -135,6 +135,7 @@
 			<widget name = 'Logo'
 					width = '287'
 					height = '80'
+					rtl = 'no'
 			/>
 			<layout type = 'horizontal'  spacing = '5' padding = '10, 0, 0, 0'>
 				<widget name = 'SearchPic'
diff --git a/gui/widget.cpp b/gui/widget.cpp
index d11316d075..c9436a4582 100644
--- a/gui/widget.cpp
+++ b/gui/widget.cpp
@@ -39,13 +39,13 @@ namespace GUI {
 
 Widget::Widget(GuiObject *boss, int x, int y, int w, int h, const char *tooltip)
 	: GuiObject(x, y, w, h), _type(0), _boss(boss), _tooltip(tooltip),
-	  _flags(0), _hasFocus(false), _state(ThemeEngine::kStateEnabled) {
+	  _flags(0), _hasFocus(false), _useRTL(false), _state(ThemeEngine::kStateEnabled) {
 	init();
 }
 
 Widget::Widget(GuiObject *boss, const Common::String &name, const char *tooltip)
 	: GuiObject(name), _type(0), _boss(boss), _tooltip(tooltip),
-	  _flags(0), _hasFocus(false), _state(ThemeEngine::kStateDisabled) {
+	  _flags(0), _hasFocus(false), _useRTL(false), _state(ThemeEngine::kStateDisabled) {
 	init();
 }
 
@@ -54,6 +54,10 @@ void Widget::init() {
 	_next = _boss->_firstWidget;
 	_boss->_firstWidget = this;
 	_needsRedraw = true;
+
+	if (TransMan.getCurrentLanguage() == "C") {		// TODO: Switch to native RTL languages after testing.
+		_useRTL = true;
+	}
 }
 
 Widget::~Widget() {
@@ -210,6 +214,10 @@ bool Widget::isVisible() const {
 	return !(_flags & WIDGET_INVISIBLE);
 }
 
+bool Widget::useRTL() const{
+	return _useRTL == true;
+}
+
 uint8 Widget::parseHotkey(const Common::String &label) {
 	if (!label.contains('~'))
 		return 0;
diff --git a/gui/widget.h b/gui/widget.h
index 61e02fd227..02c55faaf0 100644
--- a/gui/widget.h
+++ b/gui/widget.h
@@ -102,6 +102,7 @@ protected:
 	GuiObject	*_boss;
 	Widget		*_next;
 	bool		_hasFocus;
+	bool		_useRTL;
 	ThemeEngine::WidgetStateInfo _state;
 	Common::String _tooltip;
 
@@ -164,6 +165,8 @@ public:
 	void setVisible(bool e);
 	bool isVisible() const override;
 
+	bool useRTL() const;
+
 	uint8 parseHotkey(const Common::String &label);
 	Common::String cleanupHotkey(const Common::String &label);
 


Commit: 5db49a6d1e68370ff852cae061a4277b908dad99
    https://github.com/scummvm/scummvm/commit/5db49a6d1e68370ff852cae061a4277b908dad99
Author: aryanrawlani28 (aryanrawlani007 at gmail.com)
Date: 2020-06-22T00:03:02+02:00

Commit Message:
GUI: RTL: Test for strict RTL GUI

Changed paths:
    gui/gui-manager.cpp
    gui/gui-manager.h
    gui/widget.cpp


diff --git a/gui/gui-manager.cpp b/gui/gui-manager.cpp
index d088cec1b4..772829a6d3 100644
--- a/gui/gui-manager.cpp
+++ b/gui/gui-manager.cpp
@@ -69,12 +69,17 @@ GuiManager::GuiManager() : _redrawStatus(kRedrawDisabled), _stateIsSaved(false),
 
 	_launched = false;
 
+	_useRTL = false;
+
 	// Clear the cursor
 	memset(_cursor, 0xFF, sizeof(_cursor));
 
 #ifdef USE_TRANSLATION
 	// Enable translation
 	TransMan.setLanguage(ConfMan.get("gui_language").c_str());
+	if (TransMan.getCurrentLanguage() == "C") {		// TODO: Change after testing.
+		_useRTL = true;
+	}
 #endif // USE_TRANSLATION
 
 #ifdef USE_TTS
@@ -574,7 +579,10 @@ void GuiManager::processEvent(const Common::Event &event, Dialog *const activeDi
 		return;
 	int button;
 	uint32 time;
+
 	Common::Point mouse(event.mouse.x - activeDialog->_x, event.mouse.y - activeDialog->_y);
+	if (_useRTL)
+		mouse.x = _system->getOverlayWidth() - mouse.x;
 
 	switch (event.type) {
 	case Common::EVENT_KEYDOWN:
@@ -584,7 +592,12 @@ void GuiManager::processEvent(const Common::Event &event, Dialog *const activeDi
 		activeDialog->handleKeyUp(event.kbd);
 		break;
 	case Common::EVENT_MOUSEMOVE:
-		_globalMousePosition.x = event.mouse.x;
+		if (useRTL()) {
+			_globalMousePosition.x = _system->getOverlayWidth() - event.mouse.x;
+		}
+		else {
+			_globalMousePosition.x = event.mouse.x;
+		}
 		_globalMousePosition.y = event.mouse.y;
 		activeDialog->handleMouseMoved(mouse.x, mouse.y, 0);
 
diff --git a/gui/gui-manager.h b/gui/gui-manager.h
index 88470f0ead..7ce1a91c00 100644
--- a/gui/gui-manager.h
+++ b/gui/gui-manager.h
@@ -89,6 +89,8 @@ public:
 	int getWidth() const { return _width; }
 	int getHeight() const { return _height; }
 
+	bool useRTL() const { return _useRTL; }
+
 	const Graphics::Font &getFont(ThemeEngine::FontStyle style = ThemeEngine::kFontStyleBold) const { return *(_theme->getFont(style)); }
 	int getFontHeight(ThemeEngine::FontStyle style = ThemeEngine::kFontStyleBold) const { return _theme->getFontHeight(style); }
 	int getStringWidth(const Common::String &str, ThemeEngine::FontStyle style = ThemeEngine::kFontStyleBold) const { return _theme->getStringWidth(str, style); }
@@ -138,6 +140,8 @@ protected:
 
 	bool		_useStdCursor;
 
+	bool		_useRTL;
+
 	// position and time of last mouse click (used to detect double clicks)
 	struct MousePos {
 		MousePos() : x(-1), y(-1), count(0) { time = 0; }
diff --git a/gui/widget.cpp b/gui/widget.cpp
index c9436a4582..b57f9af395 100644
--- a/gui/widget.cpp
+++ b/gui/widget.cpp
@@ -115,6 +115,10 @@ void Widget::draw() {
 		_x = getAbsX();
 		_y = getAbsY();
 
+		if (g_gui.useRTL()) {
+			_x = _boss->_w - _x - _w;
+		}
+
 		Common::Rect oldClip = g_gui.theme()->swapClipRect(_boss->getClipRect());
 
 		// Draw border
@@ -215,7 +219,7 @@ bool Widget::isVisible() const {
 }
 
 bool Widget::useRTL() const{
-	return _useRTL == true;
+	return _useRTL;
 }
 
 uint8 Widget::parseHotkey(const Common::String &label) {


Commit: 1bd2701597b0c09dd71f52f5f093d24e14133677
    https://github.com/scummvm/scummvm/commit/1bd2701597b0c09dd71f52f5f093d24e14133677
Author: aryanrawlani28 (aryanrawlani007 at gmail.com)
Date: 2020-06-22T00:03:02+02:00

Commit Message:
GUI: RTL: Fix caret position

Changed paths:
    gui/widgets/editable.cpp


diff --git a/gui/widgets/editable.cpp b/gui/widgets/editable.cpp
index 048a0b0fcd..a452b444a8 100644
--- a/gui/widgets/editable.cpp
+++ b/gui/widgets/editable.cpp
@@ -298,6 +298,9 @@ void EditableWidget::drawCaret(bool erase) {
 	x += getAbsX();
 	y += getAbsY();
 
+	if (_useRTL)
+		x += (_boss->getWidth() - _x - _x - _w);
+
 	g_gui.theme()->drawCaret(Common::Rect(x, y, x + 1, y + editRect.height()), erase);
 
 	if (erase) {


Commit: 9593b3b3fe01aa9eebeb34308695655980a9ae16
    https://github.com/scummvm/scummvm/commit/9593b3b3fe01aa9eebeb34308695655980a9ae16
Author: aryanrawlani28 (aryanrawlani007 at gmail.com)
Date: 2020-06-22T00:03:02+02:00

Commit Message:
GUI: RTL: Fix tooltip rendering

Changed paths:
    gui/Tooltip.cpp


diff --git a/gui/Tooltip.cpp b/gui/Tooltip.cpp
index 01418cdbff..62ec9703e8 100644
--- a/gui/Tooltip.cpp
+++ b/gui/Tooltip.cpp
@@ -54,6 +54,10 @@ void Tooltip::setup(Dialog *parent, Widget *widget, int x, int y) {
 
 	_x = MIN<int16>(parent->_x + x + _xdelta, g_gui.getWidth() - _w - 3);
 	_y = MIN<int16>(parent->_y + y + _ydelta, g_gui.getHeight() - _h - 3);
+
+	if (g_gui.useRTL())
+		_x = g_system->getOverlayWidth() - _w - _x;
+
 #ifdef USE_TTS
 	if (ConfMan.hasKey("tts_enabled", "scummvm") &&
 			ConfMan.getBool("tts_enabled", "scummvm")) {
@@ -86,7 +90,7 @@ void Tooltip::drawDialog(DrawLayer layerToDraw) {
 			ThemeEngine::kFontColorNormal,
 			false
 		);
+		}
 	}
-}
 
 }


Commit: 8966d9dfd9363d60ff6af17838649b7217368439
    https://github.com/scummvm/scummvm/commit/8966d9dfd9363d60ff6af17838649b7217368439
Author: aryanrawlani28 (aryanrawlani007 at gmail.com)
Date: 2020-06-22T00:03:02+02:00

Commit Message:
GUI: RTL: Correctly draw dialogs

Changed paths:
    gui/ThemeLayout.cpp


diff --git a/gui/ThemeLayout.cpp b/gui/ThemeLayout.cpp
index edac50aa1a..4f08da5f31 100644
--- a/gui/ThemeLayout.cpp
+++ b/gui/ThemeLayout.cpp
@@ -217,7 +217,7 @@ void ThemeLayoutMain::reflowLayout(Widget *widgetChain) {
 	assert(_children.size() <= 1);
 
 	resetLayout();
-
+	
 	if (_overlays == "screen") {
 		_x = 0;
 		_y = 0;
@@ -242,6 +242,13 @@ void ThemeLayoutMain::reflowLayout(Widget *widgetChain) {
 		}
 	}
 
+	// Below: Not complete. Renders dialogs okay, but can I use this for tabs?
+	if (this->_name.contains("GameOptions") || this->_name.contains("GlobalOptions")) {
+		if (this->_name == "GameOptions" || this->_name == "GlobalOptions")
+			_x = g_system->getOverlayWidth() - _w - _x;
+		else
+			; //_x -= 100;		// TODO: Can this flow be used for Tabs?
+	}
 	if (_x >= 0) _x += _inset;
 	if (_y >= 0) _y += _inset;
 	if (_w >= 0) _w -= 2 * _inset;


Commit: abd24fb1cb21e4d7d00e30cd6989452f41289bb8
    https://github.com/scummvm/scummvm/commit/abd24fb1cb21e4d7d00e30cd6989452f41289bb8
Author: aryanrawlani28 (aryanrawlani007 at gmail.com)
Date: 2020-06-22T00:03:02+02:00

Commit Message:
GUI: RTL: Base support for Sliders

Changed paths:
    gui/widget.cpp


diff --git a/gui/widget.cpp b/gui/widget.cpp
index b57f9af395..60e8c73e3f 100644
--- a/gui/widget.cpp
+++ b/gui/widget.cpp
@@ -772,7 +772,14 @@ void SliderWidget::handleMouseWheel(int x, int y, int direction) {
 }
 
 void SliderWidget::drawWidget() {
-	g_gui.theme()->drawSlider(Common::Rect(_x, _y, _x + _w, _y + _h), valueToBarWidth(_value), _state);
+	if (_useRTL) {
+		// TODO: This currently draws the numbers okay (Rightmost is 0, left goes high value), but renders incorrectly.
+		//	     Most likely, I'll draw ::Rect(_x + _w, _y, _x, _y + _h...) but I'll leave it for now, will do it when I flip individual widgets.
+		g_gui.theme()->drawSlider(Common::Rect(_x, _y, _x + _w, _y + _h), valueToBarWidth(getMaxValue() - _value), _state);
+	}
+	else {
+		g_gui.theme()->drawSlider(Common::Rect(_x, _y, _x + _w, _y + _h), valueToBarWidth(_value), _state);
+	}
 }
 
 int SliderWidget::valueToBarWidth(int value) {


Commit: 5be57e5394399453e343c13a38d46b7328ae5641
    https://github.com/scummvm/scummvm/commit/5be57e5394399453e343c13a38d46b7328ae5641
Author: aryanrawlani28 (aryanrawlani007 at gmail.com)
Date: 2020-06-22T00:03:02+02:00

Commit Message:
JANITORIAL: Replace my todos with "GUI TODO:"

Changed paths:
    gui/ThemeLayout.cpp
    gui/gui-manager.cpp
    gui/widget.cpp


diff --git a/gui/ThemeLayout.cpp b/gui/ThemeLayout.cpp
index 4f08da5f31..06a6ce9897 100644
--- a/gui/ThemeLayout.cpp
+++ b/gui/ThemeLayout.cpp
@@ -247,7 +247,7 @@ void ThemeLayoutMain::reflowLayout(Widget *widgetChain) {
 		if (this->_name == "GameOptions" || this->_name == "GlobalOptions")
 			_x = g_system->getOverlayWidth() - _w - _x;
 		else
-			; //_x -= 100;		// TODO: Can this flow be used for Tabs?
+			; //_x -= 100;		// GUI TODO: Can this flow be used for Tabs?
 	}
 	if (_x >= 0) _x += _inset;
 	if (_y >= 0) _y += _inset;
diff --git a/gui/gui-manager.cpp b/gui/gui-manager.cpp
index 772829a6d3..ba68b3e045 100644
--- a/gui/gui-manager.cpp
+++ b/gui/gui-manager.cpp
@@ -77,7 +77,7 @@ GuiManager::GuiManager() : _redrawStatus(kRedrawDisabled), _stateIsSaved(false),
 #ifdef USE_TRANSLATION
 	// Enable translation
 	TransMan.setLanguage(ConfMan.get("gui_language").c_str());
-	if (TransMan.getCurrentLanguage() == "C") {		// TODO: Change after testing.
+	if (TransMan.getCurrentLanguage() == "C") {		// GUI TODO: Change after testing.
 		_useRTL = true;
 	}
 #endif // USE_TRANSLATION
diff --git a/gui/widget.cpp b/gui/widget.cpp
index 60e8c73e3f..c72a2cd3d5 100644
--- a/gui/widget.cpp
+++ b/gui/widget.cpp
@@ -55,8 +55,8 @@ void Widget::init() {
 	_boss->_firstWidget = this;
 	_needsRedraw = true;
 
-	if (TransMan.getCurrentLanguage() == "C") {		// TODO: Switch to native RTL languages after testing.
-		_useRTL = true;
+	if (TransMan.getCurrentLanguage() == "C") {		// GUI TODO: Switch to native RTL languages after testing, also
+		_useRTL = true;								//			 Widgets will get _useRTL true or not from the XML parser. Look into this after the main GUI flipping.
 	}
 }
 
@@ -773,7 +773,7 @@ void SliderWidget::handleMouseWheel(int x, int y, int direction) {
 
 void SliderWidget::drawWidget() {
 	if (_useRTL) {
-		// TODO: This currently draws the numbers okay (Rightmost is 0, left goes high value), but renders incorrectly.
+		// GUI TODO: This currently draws the numbers okay (Rightmost is 0, left goes high value), but renders incorrectly.
 		//	     Most likely, I'll draw ::Rect(_x + _w, _y, _x, _y + _h...) but I'll leave it for now, will do it when I flip individual widgets.
 		g_gui.theme()->drawSlider(Common::Rect(_x, _y, _x + _w, _y + _h), valueToBarWidth(getMaxValue() - _value), _state);
 	}


Commit: f8ee449227d346a55706aebbc675b402662e60cc
    https://github.com/scummvm/scummvm/commit/f8ee449227d346a55706aebbc675b402662e60cc
Author: aryanrawlani28 (aryanrawlani007 at gmail.com)
Date: 2020-06-22T00:03:02+02:00

Commit Message:
GUI: RTL: Right align main list text

Changed paths:
    gui/widgets/list.cpp


diff --git a/gui/widgets/list.cpp b/gui/widgets/list.cpp
index a807653a2f..3dca48e51f 100644
--- a/gui/widgets/list.cpp
+++ b/gui/widgets/list.cpp
@@ -552,13 +552,19 @@ void ListWidget::drawWidget() {
 			inverted = _inversion;
 
 		Common::Rect r(getEditRect());
-		int pad = _leftPadding;
+		int pad = g_gui.useRTL() ? _rightPadding : _leftPadding;
 
 		// If in numbering mode, we first print a number prefix
 		if (_numberingMode != kListNumberingOff) {
 			buffer = Common::String::format("%2d. ", (pos + _numberingMode));
-			g_gui.theme()->drawText(Common::Rect(_x + _hlLeftPadding, y, _x + r.left + _leftPadding, y + fontHeight - 2),
-			                        buffer, _state, Graphics::kTextAlignLeft, inverted, _leftPadding, true);
+			if (g_gui.useRTL()) {
+				g_gui.theme()->drawText(Common::Rect(_x + _hlLeftPadding, y, _x + r.left + _leftPadding, y + fontHeight - 2),
+										buffer, _state, Graphics::kTextAlignRight, inverted, _leftPadding, true);
+			}
+			else {
+				g_gui.theme()->drawText(Common::Rect(_x + _hlLeftPadding, y, _x + r.left + _leftPadding, y + fontHeight - 2),
+										buffer, _state, Graphics::kTextAlignLeft, inverted, _leftPadding, true);
+			}
 			pad = 0;
 		}
 
@@ -575,12 +581,24 @@ void ListWidget::drawWidget() {
 			buffer = _editString;
 			color = _editColor;
 			adjustOffset();
-			g_gui.theme()->drawText(Common::Rect(_x + r.left, y, _x + r.right, y + fontHeight - 2), buffer, _state,
-			                        Graphics::kTextAlignLeft, inverted, pad, true, ThemeEngine::kFontStyleBold, color);
+			if (g_gui.useRTL()) {
+				g_gui.theme()->drawText(Common::Rect(_x + r.left, y, _x + r.right, y + fontHeight - 2), buffer, _state,
+										Graphics::kTextAlignRight, inverted, pad, true, ThemeEngine::kFontStyleBold, color);
+			}
+			else {
+				g_gui.theme()->drawText(Common::Rect(_x + r.left, y, _x + r.right, y + fontHeight - 2), buffer, _state,
+					                    Graphics::kTextAlignLeft, inverted, pad, true, ThemeEngine::kFontStyleBold, color);
+			}
 		} else {
 			buffer = _list[pos];
-			g_gui.theme()->drawText(Common::Rect(_x + r.left, y, _x + r.right, y + fontHeight - 2), buffer, _state,
-			                        Graphics::kTextAlignLeft, inverted, pad, true, ThemeEngine::kFontStyleBold, color);
+			if (g_gui.useRTL()) {
+				g_gui.theme()->drawText(Common::Rect(_x + r.left, y, _x + r.right, y + fontHeight - 2), buffer, _state,
+										Graphics::kTextAlignRight, inverted, pad, true, ThemeEngine::kFontStyleBold, color);
+			}
+			else {
+				g_gui.theme()->drawText(Common::Rect(_x + r.left, y, _x + r.right, y + fontHeight - 2), buffer, _state,
+										Graphics::kTextAlignLeft, inverted, pad, true, ThemeEngine::kFontStyleBold, color);
+			}
 		}
 	}
 }


Commit: bf26fbcd25977ed359f225d5446600a8699ea4fa
    https://github.com/scummvm/scummvm/commit/bf26fbcd25977ed359f225d5446600a8699ea4fa
Author: aryanrawlani28 (aryanrawlani007 at gmail.com)
Date: 2020-06-22T00:03:02+02:00

Commit Message:
GUI: RTL: Make tooltip messages rtl friendly

Changed paths:
    gui/Tooltip.cpp


diff --git a/gui/Tooltip.cpp b/gui/Tooltip.cpp
index 62ec9703e8..0b3441e673 100644
--- a/gui/Tooltip.cpp
+++ b/gui/Tooltip.cpp
@@ -75,21 +75,39 @@ void Tooltip::drawDialog(DrawLayer layerToDraw) {
 
 	Dialog::drawDialog(layerToDraw);
 
-	int16 textX = _x + 3; // including 2px padding and 1px original code shift
+	int16 textX = g_gui.useRTL() ? _x - 3 : _x + 3; // including 2px padding and 1px original code shift
 	int16 textY = _y + 3;
-	for (Common::StringArray::const_iterator i = _wrappedLines.begin(); i != _wrappedLines.end(); ++i, ++num) {
-		g_gui.theme()->drawText(
-			Common::Rect(textX, textY + num * h, textX + _w, textY + (num + 1) * h),
-			*i,
-			ThemeEngine::kStateEnabled,
-			Graphics::kTextAlignLeft,
-			ThemeEngine::kTextInversionNone,
-			0,
-			false,
-			ThemeEngine::kFontStyleTooltip,
-			ThemeEngine::kFontColorNormal,
-			false
-		);
+
+	if (g_gui.useRTL()) {
+		for (Common::StringArray::const_iterator i = _wrappedLines.begin(); i != _wrappedLines.end(); ++i, ++num) {
+			g_gui.theme()->drawText(
+				Common::Rect(textX, textY + num * h, textX + _w, textY + (num + 1) * h),
+				*i,
+				ThemeEngine::kStateEnabled,
+				Graphics::kTextAlignRight,
+				ThemeEngine::kTextInversionNone,
+				0,
+				false,
+				ThemeEngine::kFontStyleTooltip,
+				ThemeEngine::kFontColorNormal,
+				false
+			);
+		}
+	}else{
+		for (Common::StringArray::const_iterator i = _wrappedLines.begin(); i != _wrappedLines.end(); ++i, ++num) {
+			g_gui.theme()->drawText(
+				Common::Rect(textX, textY + num * h, textX + _w, textY + (num + 1) * h),
+				*i,
+				ThemeEngine::kStateEnabled,
+				Graphics::kTextAlignLeft,
+				ThemeEngine::kTextInversionNone,
+				0,
+				false,
+				ThemeEngine::kFontStyleTooltip,
+				ThemeEngine::kFontColorNormal,
+				false
+			);
+			}
 		}
 	}
 


Commit: e4352391c26cccc8c4d3f978ce7ef9a6038772eb
    https://github.com/scummvm/scummvm/commit/e4352391c26cccc8c4d3f978ce7ef9a6038772eb
Author: aryanrawlani28 (aryanrawlani007 at gmail.com)
Date: 2020-06-22T00:03:02+02:00

Commit Message:
GUI: RTL: Fix popup open location

Changed paths:
    gui/widgets/popup.cpp


diff --git a/gui/widgets/popup.cpp b/gui/widgets/popup.cpp
index 1931cb28de..3d8d7abce2 100644
--- a/gui/widgets/popup.cpp
+++ b/gui/widgets/popup.cpp
@@ -116,6 +116,9 @@ void PopUpDialog::open() {
 	else if (_y + _h >= screenH)
 		_y = screenH - 1 - _h;
 
+	if (g_gui.useRTL())
+		_x = g_system->getOverlayWidth() - _x - _w;
+
 	// TODO - implement scrolling if we had to move the menu, or if there are too many entries
 
 	_lastRead = -1;
@@ -511,6 +514,10 @@ void PopUpWidget::drawWidget() {
 	Common::String sel;
 	if (_selectedItem >= 0)
 		sel = _entries[_selectedItem].name;
+
+	if (g_gui.useRTL())
+		_x = g_system->getOverlayWidth() - _x - _w;
+
 	g_gui.theme()->drawPopUpWidget(Common::Rect(_x, _y, _x + _w, _y + _h), sel, _leftPadding, _state);
 }
 


Commit: e5fc39bb981ca2207d46a87c964e8d11ead2eda4
    https://github.com/scummvm/scummvm/commit/e5fc39bb981ca2207d46a87c964e8d11ead2eda4
Author: aryanrawlani28 (aryanrawlani007 at gmail.com)
Date: 2020-06-22T00:03:02+02:00

Commit Message:
GUI: RTL: Support stacked dialogs and fix mouse events for them

GUI: RTL: Add helpers for overlay dialogs

Changed paths:
    gui/ThemeLayout.cpp
    gui/gui-manager.cpp
    gui/gui-manager.h
    gui/options.cpp


diff --git a/gui/ThemeLayout.cpp b/gui/ThemeLayout.cpp
index 06a6ce9897..887aecf057 100644
--- a/gui/ThemeLayout.cpp
+++ b/gui/ThemeLayout.cpp
@@ -217,7 +217,7 @@ void ThemeLayoutMain::reflowLayout(Widget *widgetChain) {
 	assert(_children.size() <= 1);
 
 	resetLayout();
-	
+
 	if (_overlays == "screen") {
 		_x = 0;
 		_y = 0;
@@ -242,13 +242,14 @@ void ThemeLayoutMain::reflowLayout(Widget *widgetChain) {
 		}
 	}
 
-	// Below: Not complete. Renders dialogs okay, but can I use this for tabs?
-	if (this->_name.contains("GameOptions") || this->_name.contains("GlobalOptions")) {
-		if (this->_name == "GameOptions" || this->_name == "GlobalOptions")
+	if (g_gui.useRTL()) {
+		if (this->_name == "GameOptions" || this->_name == "GlobalOptions") {
+			int oldX = _x;
 			_x = g_system->getOverlayWidth() - _w - _x;
-		else
-			; //_x -= 100;		// GUI TODO: Can this flow be used for Tabs?
+			g_gui.setOverlayParas(oldX, _x);
+		}
 	}
+
 	if (_x >= 0) _x += _inset;
 	if (_y >= 0) _y += _inset;
 	if (_w >= 0) _w -= 2 * _inset;
@@ -388,7 +389,7 @@ void ThemeLayoutStacked::reflowLayoutHorizontal(Widget *widgetChain) {
 			resize[rescount++] = i;
 			_children[i]->setWidth(0);
 		}
-
+		
 		_children[i]->offsetX(curX);
 
 		// Advance the horizontal offset by the width of the newest item, plus
diff --git a/gui/gui-manager.cpp b/gui/gui-manager.cpp
index ba68b3e045..f2543eabe1 100644
--- a/gui/gui-manager.cpp
+++ b/gui/gui-manager.cpp
@@ -70,6 +70,10 @@ GuiManager::GuiManager() : _redrawStatus(kRedrawDisabled), _stateIsSaved(false),
 	_launched = false;
 
 	_useRTL = false;
+	_isAnotherWindowOverlayed = false;
+
+	_focusedWindowLeftSpacing = 0;
+	_focusedWindowRightSpacing = 0;
 
 	// Clear the cursor
 	memset(_cursor, 0xFF, sizeof(_cursor));
@@ -581,8 +585,13 @@ void GuiManager::processEvent(const Common::Event &event, Dialog *const activeDi
 	uint32 time;
 
 	Common::Point mouse(event.mouse.x - activeDialog->_x, event.mouse.y - activeDialog->_y);
-	if (_useRTL)
-		mouse.x = _system->getOverlayWidth() - mouse.x;
+	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;
+		}
+	}
 
 	switch (event.type) {
 	case Common::EVENT_KEYDOWN:
@@ -592,10 +601,12 @@ void GuiManager::processEvent(const Common::Event &event, Dialog *const activeDi
 		activeDialog->handleKeyUp(event.kbd);
 		break;
 	case Common::EVENT_MOUSEMOVE:
-		if (useRTL()) {
-			_globalMousePosition.x = _system->getOverlayWidth() - event.mouse.x;
-		}
-		else {
+		if (g_gui.useRTL()) {
+			_globalMousePosition.x = g_system->getOverlayWidth() - event.mouse.x;
+			if (g_gui.getOverlayOffset() != 0) {
+				_globalMousePosition.x = g_gui.getOverlayOffset() + _globalMousePosition.x;
+			}
+		} else {
 			_globalMousePosition.x = event.mouse.x;
 		}
 		_globalMousePosition.y = event.mouse.y;
@@ -660,6 +671,15 @@ void GuiManager::setLastMousePos(int16 x, int16 y) {
 	_lastMousePosition.time = _system->getMillis(true);
 }
 
+void GuiManager::setOverlayParas(int l, int r) {
+	_focusedWindowLeftSpacing = l;
+	_focusedWindowRightSpacing = r;
+}
+
+void GuiManager::setWindowOverlayStatus(bool value) {
+	_isAnotherWindowOverlayed = value;
+}
+
 #ifdef USE_TTS
 void GuiManager::initTextToSpeech() {
 	Common::TextToSpeechManager *ttsMan = g_system->getTextToSpeechManager();
diff --git a/gui/gui-manager.h b/gui/gui-manager.h
index 7ce1a91c00..0252bedf1e 100644
--- a/gui/gui-manager.h
+++ b/gui/gui-manager.h
@@ -90,6 +90,10 @@ public:
 	int getHeight() const { return _height; }
 
 	bool useRTL() const { return _useRTL; }
+	void setOverlayParas(int l, int r);
+	int getOverlayOffset() { return _focusedWindowRightSpacing - _focusedWindowLeftSpacing; }
+	void setWindowOverlayStatus(bool value);
+	bool isWindowOverlayed() const { return _isAnotherWindowOverlayed; }
 
 	const Graphics::Font &getFont(ThemeEngine::FontStyle style = ThemeEngine::kFontStyleBold) const { return *(_theme->getFont(style)); }
 	int getFontHeight(ThemeEngine::FontStyle style = ThemeEngine::kFontStyleBold) const { return _theme->getFontHeight(style); }
@@ -141,6 +145,10 @@ protected:
 	bool		_useStdCursor;
 
 	bool		_useRTL;
+	bool		_isAnotherWindowOverlayed;
+
+	int			_focusedWindowLeftSpacing;
+	int			_focusedWindowRightSpacing;
 
 	// position and time of last mouse click (used to detect double clicks)
 	struct MousePos {
diff --git a/gui/options.cpp b/gui/options.cpp
index 24e392f4b5..a2c4cdf598 100644
--- a/gui/options.cpp
+++ b/gui/options.cpp
@@ -147,6 +147,8 @@ OptionsDialog::OptionsDialog(const Common::String &domain, const Common::String
 
 OptionsDialog::~OptionsDialog() {
 	delete _subToggleGroup;
+	g_gui.setWindowOverlayStatus(false);
+	g_gui.setOverlayParas(0, 0);			// GUI TODO: This does not seem necessary, but lets be safe for now.
 }
 
 void OptionsDialog::init() {
@@ -215,6 +217,8 @@ void OptionsDialog::init() {
 	_subSpeedSlider = nullptr;
 	_subSpeedLabel = nullptr;
 
+	g_gui.setWindowOverlayStatus(true);
+
 	// Retrieve game GUI options
 	_guioptions.clear();
 	if (ConfMan.hasKey("guioptions", _domain)) {
@@ -1826,8 +1830,14 @@ void GlobalOptionsDialog::build() {
 	addAccessibilityControls(tab, "GlobalOptions_Accessibility.");
 #endif // USE_TTS
 
-	// Activate the first tab
-	tab->setActiveTab(0);
+	// GUI TODO: Incomplete implementation, currently just switches to last tab.
+	if (g_gui.useRTL()) {
+		tab->setActiveTab(tab->getActiveTab());
+	}
+	else {
+		// Activate the first tab
+		tab->setActiveTab(0);
+	}
 	_tabWidget = tab;
 
 	// Add OK & Cancel buttons
@@ -2910,6 +2920,10 @@ void GlobalOptionsDialog::shiftWidget(Widget *widget, const char *widgetName, in
 	if (!g_gui.xmlEval()->getWidgetData(widgetName, x, y, w, h))
 		warning("%s's position is undefined", widgetName);
 
+	// GUI TODO: I'm not sure what's this being used for?
+	if (g_gui.useRTL())
+		x = g_system->getOverlayWidth() - x - w;
+
 	widget->setPos(x + xOffset, y + yOffset);
 }
 #endif // USE_LIBCURL


Commit: 0420dc4f6d599b61e43f660673ee33a87e3bf3bf
    https://github.com/scummvm/scummvm/commit/0420dc4f6d599b61e43f660673ee33a87e3bf3bf
Author: aryanrawlani28 (aryanrawlani007 at gmail.com)
Date: 2020-06-22T00:03:02+02:00

Commit Message:
GUI: Fix review issues, code cleanup

Changed paths:
    gui/Tooltip.cpp
    gui/widgets/editable.cpp
    gui/widgets/list.cpp


diff --git a/gui/Tooltip.cpp b/gui/Tooltip.cpp
index 0b3441e673..5282310bcb 100644
--- a/gui/Tooltip.cpp
+++ b/gui/Tooltip.cpp
@@ -78,36 +78,21 @@ void Tooltip::drawDialog(DrawLayer layerToDraw) {
 	int16 textX = g_gui.useRTL() ? _x - 3 : _x + 3; // including 2px padding and 1px original code shift
 	int16 textY = _y + 3;
 
-	if (g_gui.useRTL()) {
-		for (Common::StringArray::const_iterator i = _wrappedLines.begin(); i != _wrappedLines.end(); ++i, ++num) {
-			g_gui.theme()->drawText(
-				Common::Rect(textX, textY + num * h, textX + _w, textY + (num + 1) * h),
-				*i,
-				ThemeEngine::kStateEnabled,
-				Graphics::kTextAlignRight,
-				ThemeEngine::kTextInversionNone,
-				0,
-				false,
-				ThemeEngine::kFontStyleTooltip,
-				ThemeEngine::kFontColorNormal,
-				false
-			);
-		}
-	}else{
-		for (Common::StringArray::const_iterator i = _wrappedLines.begin(); i != _wrappedLines.end(); ++i, ++num) {
-			g_gui.theme()->drawText(
-				Common::Rect(textX, textY + num * h, textX + _w, textY + (num + 1) * h),
-				*i,
-				ThemeEngine::kStateEnabled,
-				Graphics::kTextAlignLeft,
-				ThemeEngine::kTextInversionNone,
-				0,
-				false,
-				ThemeEngine::kFontStyleTooltip,
-				ThemeEngine::kFontColorNormal,
-				false
-			);
-			}
+	Graphics::TextAlign textAlignment = g_gui.useRTL() ? Graphics::kTextAlignRight : Graphics::kTextAlignRight;
+
+	for (Common::StringArray::const_iterator i = _wrappedLines.begin(); i != _wrappedLines.end(); ++i, ++num) {
+		g_gui.theme()->drawText(
+			Common::Rect(textX, textY + num * h, textX + _w, textY + (num + 1) * h),
+			*i,
+			ThemeEngine::kStateEnabled,
+			textAlignment,
+			ThemeEngine::kTextInversionNone,
+			0,
+			false,
+			ThemeEngine::kFontStyleTooltip,
+			ThemeEngine::kFontColorNormal,
+			false
+		);
 		}
 	}
 
diff --git a/gui/widgets/editable.cpp b/gui/widgets/editable.cpp
index a452b444a8..33c50c757f 100644
--- a/gui/widgets/editable.cpp
+++ b/gui/widgets/editable.cpp
@@ -298,8 +298,8 @@ void EditableWidget::drawCaret(bool erase) {
 	x += getAbsX();
 	y += getAbsY();
 
-	if (_useRTL)
-		x += (_boss->getWidth() - _x - _x - _w);
+	if (g_gui.useRTL())
+		x += (g_system->getOverlayWidth() - _x - _x - _w);
 
 	g_gui.theme()->drawCaret(Common::Rect(x, y, x + 1, y + editRect.height()), erase);
 
diff --git a/gui/widgets/list.cpp b/gui/widgets/list.cpp
index 3dca48e51f..40a1b22de4 100644
--- a/gui/widgets/list.cpp
+++ b/gui/widgets/list.cpp
@@ -536,6 +536,7 @@ void ListWidget::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
 void ListWidget::drawWidget() {
 	int i, pos, len = _list.size();
 	Common::String buffer;
+	Graphics::TextAlign alignment = g_gui.useRTL() ? Graphics::kTextAlignRight : Graphics::kTextAlignLeft;
 
 	// Draw a thin frame around the list.
 	g_gui.theme()->drawWidgetBackground(Common::Rect(_x, _y, _x + _w, _y + _h),
@@ -557,14 +558,8 @@ void ListWidget::drawWidget() {
 		// If in numbering mode, we first print a number prefix
 		if (_numberingMode != kListNumberingOff) {
 			buffer = Common::String::format("%2d. ", (pos + _numberingMode));
-			if (g_gui.useRTL()) {
-				g_gui.theme()->drawText(Common::Rect(_x + _hlLeftPadding, y, _x + r.left + _leftPadding, y + fontHeight - 2),
-										buffer, _state, Graphics::kTextAlignRight, inverted, _leftPadding, true);
-			}
-			else {
-				g_gui.theme()->drawText(Common::Rect(_x + _hlLeftPadding, y, _x + r.left + _leftPadding, y + fontHeight - 2),
-										buffer, _state, Graphics::kTextAlignLeft, inverted, _leftPadding, true);
-			}
+			g_gui.theme()->drawText(Common::Rect(_x + _hlLeftPadding, y, _x + r.left + _leftPadding, y + fontHeight - 2),
+									buffer, _state, alignment, inverted, _leftPadding, true);
 			pad = 0;
 		}
 
@@ -581,24 +576,12 @@ void ListWidget::drawWidget() {
 			buffer = _editString;
 			color = _editColor;
 			adjustOffset();
-			if (g_gui.useRTL()) {
-				g_gui.theme()->drawText(Common::Rect(_x + r.left, y, _x + r.right, y + fontHeight - 2), buffer, _state,
-										Graphics::kTextAlignRight, inverted, pad, true, ThemeEngine::kFontStyleBold, color);
-			}
-			else {
-				g_gui.theme()->drawText(Common::Rect(_x + r.left, y, _x + r.right, y + fontHeight - 2), buffer, _state,
-					                    Graphics::kTextAlignLeft, inverted, pad, true, ThemeEngine::kFontStyleBold, color);
-			}
+			g_gui.theme()->drawText(Common::Rect(_x + r.left, y, _x + r.right, y + fontHeight - 2), buffer, _state,
+									alignment, inverted, pad, true, ThemeEngine::kFontStyleBold, color);
 		} else {
 			buffer = _list[pos];
-			if (g_gui.useRTL()) {
-				g_gui.theme()->drawText(Common::Rect(_x + r.left, y, _x + r.right, y + fontHeight - 2), buffer, _state,
-										Graphics::kTextAlignRight, inverted, pad, true, ThemeEngine::kFontStyleBold, color);
-			}
-			else {
-				g_gui.theme()->drawText(Common::Rect(_x + r.left, y, _x + r.right, y + fontHeight - 2), buffer, _state,
-										Graphics::kTextAlignLeft, inverted, pad, true, ThemeEngine::kFontStyleBold, color);
-			}
+			g_gui.theme()->drawText(Common::Rect(_x + r.left, y, _x + r.right, y + fontHeight - 2), buffer, _state,
+									alignment, inverted, pad, true, ThemeEngine::kFontStyleBold, color);
 		}
 	}
 }


Commit: 732e79b1cf670ec50187bd9e84dafbdc15f9e7fe
    https://github.com/scummvm/scummvm/commit/732e79b1cf670ec50187bd9e84dafbdc15f9e7fe
Author: aryanrawlani28 (aryanrawlani007 at gmail.com)
Date: 2020-06-22T00:03:02+02:00

Commit Message:
GUI: RTL: Add disabled code for tab drawing

Changed paths:
    gui/editgamedialog.cpp
    gui/widgets/tab.cpp
    gui/widgets/tab.h


diff --git a/gui/editgamedialog.cpp b/gui/editgamedialog.cpp
index b3ee5509b1..edcced08c5 100644
--- a/gui/editgamedialog.cpp
+++ b/gui/editgamedialog.cpp
@@ -342,8 +342,15 @@ EditGameDialog::EditGameDialog(const String &domain)
 		}
 	}
 
-	// Activate the first tab
-	tab->setActiveTab(0);
+	if (g_gui.useRTL() && false) {		// GUI TODO: Incomplete
+		// Activate the last tab - that is, the first tab for RTL users.
+		// tab->reverseTabs(); (Untested)
+		tab->setActiveTab(tab->getTabsSize()-1);
+	}
+	else {
+		// Activate the first tab
+		tab->setActiveTab(0);
+	}
 	_tabWidget = tab;
 
 	// Add OK & Cancel buttons
diff --git a/gui/widgets/tab.cpp b/gui/widgets/tab.cpp
index 5b90216f62..873d8c1a2a 100644
--- a/gui/widgets/tab.cpp
+++ b/gui/widgets/tab.cpp
@@ -69,10 +69,20 @@ void TabWidget::init() {
 
 	int x = _w - _butRP - _butW * 2 - 2;
 	int y = _butTP - _tabHeight;
-	_navLeft = new ButtonWidget(this, x, y, _butW, _butH, "<", nullptr, kCmdLeft);
-	_navRight = new ButtonWidget(this, x + _butW + 2, y, _butW, _butH, ">", nullptr, kCmdRight);
-	_navLeft->setEnabled(false);
-	_navRight->setEnabled(true);
+
+	if (g_gui.useRTL() && false) {			// GUI TODO: Incomplete
+		//x = g_system->getOverlayWidth() - x - _w;		// GUI TODO: This is wrong. How am I fixing the navbars?
+		_navLeft = new ButtonWidget(this, x + _butW + 2, y, _butW, _butH, ">", nullptr, kCmdLeft);	// OK!
+		_navRight = new ButtonWidget(this, x, y, _butW, _butH, "<", nullptr, kCmdRight);
+		_navLeft->setEnabled(true);
+		_navRight->setEnabled(false);
+	}
+	else {
+		_navLeft = new ButtonWidget(this, x, y, _butW, _butH, "<", nullptr, kCmdLeft);
+		_navRight = new ButtonWidget(this, x + _butW + 2, y, _butW, _butH, ">", nullptr, kCmdRight);
+		_navLeft->setEnabled(false);
+		_navRight->setEnabled(true);
+	}
 
 	_lastRead = -1;
 }
@@ -120,12 +130,22 @@ int TabWidget::addTab(const String &title, const String &dialogName) {
 		newWidth = _minTabWidth;
 	newTab._tabWidth = newWidth;
 
-	_tabs.push_back(newTab);
+	if (g_gui.useRTL() && false) {					// GUI TODO: Incomplete, unusable atm
+		_tabs.insert_at(0, newTab);
 
-	int numTabs = _tabs.size();
+		// Activate the first tab, because it's been added at that position.
+		//setActiveTab(0);				// GUI TODO: Is this the root of errors?
+		/*int numTabs = _tabs.size();
+		setActiveTab(numTabs - 1);*/
+	}
+	else {
+		_tabs.push_back(newTab);
+		int numTabs = _tabs.size();
+
+		// Activate the new tab
+		setActiveTab(numTabs - 1);
+	}
 
-	// Activate the new tab
-	setActiveTab(numTabs - 1);
 
 	return _activeTab;
 }
@@ -225,17 +245,33 @@ void TabWidget::handleMouseDown(int x, int y, int button, int clickCount) {
 	if (x < 0)
 		return;
 
+	if (this->_name.contains("GameOptions") || this->_name.contains("GlobalOptions"))
+		;//_x = g_system->getOverlayWidth() - _w - _x;
+
 	// Determine which tab was clicked
 	int tabID;
-	for (tabID = _firstVisibleTab; tabID <= _lastVisibleTab; ++tabID) {
-		x -= _tabs[tabID]._tabWidth;
-		if (x < 0)
-			break;
+	if (g_gui.useRTL() && false) {				// GUI TODO: Incomplete
+		for (tabID = _lastVisibleTab; tabID >= _firstVisibleTab; --tabID) {
+			x -= _tabs[tabID]._tabWidth;
+			if (x < 0)
+				break;
+		}
+
+		if (tabID <= _lastVisibleTab)
+			setActiveTab(tabID);
+	}
+	else {
+		for (tabID = _firstVisibleTab; tabID <= _lastVisibleTab; ++tabID) {
+			x -= _tabs[tabID]._tabWidth;
+			if (x < 0)
+				break;
+		}
+
+		// If a tab was clicked, switch to that pane
+		if (tabID <= _lastVisibleTab)
+			setActiveTab(tabID);
 	}
 
-	// If a tab was clicked, switch to that pane
-	if (tabID <= _lastVisibleTab)
-		setActiveTab(tabID);
 }
 
 void TabWidget::handleMouseMoved(int x, int y, int button) {
@@ -296,6 +332,25 @@ void TabWidget::setFirstVisible(int tabID, bool adjustIfRoom) {
 	g_gui.scheduleTopDialogRedraw(); // TODO: Necessary?
 }
 
+int TabWidget::getTabsSize() {
+	return _tabs.size();
+}
+
+void TabWidget::reverseTabs() {	// GUI TODO: Incomplete, will this be necessary for working on reversing the tabs?
+	TabList _tabDups;
+	const int tSize = _tabs.size();
+
+	for (uint i = 0; i < tSize; ++i) {
+		//_tabDups.insert_at(0, _tabs[i]);
+		_tabDups.push_back(_tabs.back());
+		_tabs.pop_back();
+	}
+
+	for (uint i = 0; i < _tabDups.size(); ++i) {
+		_tabs.push_back(_tabDups[i]);
+	}
+}
+
 void TabWidget::reflowLayout() {
 	Widget::reflowLayout();
 
@@ -367,16 +422,31 @@ void TabWidget::reflowLayout() {
 void TabWidget::drawWidget() {
 	Common::Array<Common::String> tabs;
 	Common::Array<int> widths;
-	for (int i = _firstVisibleTab; i <= _lastVisibleTab; ++i) {
-		tabs.push_back(_tabs[i].title);
-		widths.push_back(_tabs[i]._tabWidth);
+	if (g_gui.useRTL() && false) {		// GUI TODO: Incomplete										// Keeping this disabled means that tabs are reversed, but windows are not shown anymore.
+		for (int i = _firstVisibleTab; i <= _lastVisibleTab; ++i) {
+			tabs.insert_at(0, _tabs[i].title);
+			widths.insert_at(0, _tabs[i]._tabWidth);
+		}
+	}
+	else {
+		for (int i = _firstVisibleTab; i <= _lastVisibleTab; ++i) {
+			tabs.push_back(_tabs[i].title);
+			widths.push_back(_tabs[i]._tabWidth);
+		}
+	}
+
+	// GUI TODO: Is this necessary?
+	Common::Rect r1(_x + _bodyLP, _y + _bodyTP, _x + _w - _bodyRP, _y + _h - _bodyBP + _tabHeight);
+	if (g_gui.useRTL()) {
+		r1.translate(g_system->getOverlayWidth() - _x - _w, 0);
 	}
-	g_gui.theme()->drawDialogBackground(
-			Common::Rect(_x + _bodyLP, _y + _bodyTP, _x + _w - _bodyRP, _y + _h - _bodyBP + _tabHeight),
-			_bodyBackgroundType);
+	g_gui.theme()->drawDialogBackground(r1, _bodyBackgroundType);
 
-	g_gui.theme()->drawTab(Common::Rect(_x, _y, _x + _w, _y + _h), _tabHeight, widths, tabs,
-	                       _activeTab - _firstVisibleTab);
+	Common::Rect r2(_x, _y, _x + _w, _y + _h);
+	if (g_gui.useRTL()) {
+		r2.translate(g_system->getOverlayWidth() - _x - _w, 0);
+	}
+	g_gui.theme()->drawTab(r2, _tabHeight, widths, tabs, _activeTab - _firstVisibleTab);
 }
 
 void TabWidget::draw() {
diff --git a/gui/widgets/tab.h b/gui/widgets/tab.h
index d7f75bd460..564b8c4d91 100644
--- a/gui/widgets/tab.h
+++ b/gui/widgets/tab.h
@@ -111,6 +111,9 @@ public:
 	virtual int getFirstVisible() const;
 	virtual void setFirstVisible(int tabID, bool adjustIfRoom = false);
 
+	int getTabsSize();
+	void reverseTabs();
+
 	bool containsWidget(Widget *) const override;
 
 	void reflowLayout() override;


Commit: 28c70dd196541681192003356182ebe73af713e5
    https://github.com/scummvm/scummvm/commit/28c70dd196541681192003356182ebe73af713e5
Author: aryanrawlani28 (aryanrawlani007 at gmail.com)
Date: 2020-06-22T00:03:02+02:00

Commit Message:
GUI: RTL: Correctly draw for stacked dialogs

Changed paths:
    gui/widget.cpp
    gui/widgets/popup.cpp
    gui/widgets/scrollcontainer.cpp


diff --git a/gui/widget.cpp b/gui/widget.cpp
index c72a2cd3d5..132e30a2ee 100644
--- a/gui/widget.cpp
+++ b/gui/widget.cpp
@@ -116,7 +116,14 @@ void Widget::draw() {
 		_y = getAbsY();
 
 		if (g_gui.useRTL()) {
-			_x = _boss->_w - _x - _w;
+			_x = g_system->getOverlayWidth() - _x - _w;
+
+			// if (g_gui.isWindowOverlayed()) {
+			// Can i use something better below?
+			
+			if (this->_name.contains("GameOptions") || this->_name.contains("GlobalOptions")){
+				_x = _x + g_gui.getOverlayOffset();
+			}
 		}
 
 		Common::Rect oldClip = g_gui.theme()->swapClipRect(_boss->getClipRect());
@@ -512,13 +519,13 @@ void DropdownButtonWidget::clearEntries() {
 	_entries.clear();
 }
 
-void DropdownButtonWidget::drawWidget() {
-	if (_entries.empty()) {
+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?
 		// Degrade to a regular button
 		g_gui.theme()->drawButton(Common::Rect(_x, _y, _x + _w, _y + _h), _label, _state);
 	} else {
 		g_gui.theme()->drawDropDownButton(Common::Rect(_x, _y, _x + _w, _y + _h), _dropdownWidth, _label,
-		                                  _state, _inButton, _inDropdown);
+										  _state, _inButton, _inDropdown);
 	}
 }
 
@@ -599,7 +606,7 @@ void PicButtonWidget::drawWidget() {
 
 		const int x = _x + (_w - gfx->w) / 2;
 		const int y = _y + (_h - gfx->h) / 2;
-
+		
 		g_gui.theme()->drawSurface(Common::Point(x, y), *gfx, _transparency);
 	}
 }
@@ -772,13 +779,15 @@ void SliderWidget::handleMouseWheel(int x, int y, int direction) {
 }
 
 void SliderWidget::drawWidget() {
-	if (_useRTL) {
+	Common::Rect r1(_x, _y, _x + _w, _y + _h);
+
+	if (g_gui.useRTL() && _useRTL) {
 		// GUI TODO: This currently draws the numbers okay (Rightmost is 0, left goes high value), but renders incorrectly.
 		//	     Most likely, I'll draw ::Rect(_x + _w, _y, _x, _y + _h...) but I'll leave it for now, will do it when I flip individual widgets.
-		g_gui.theme()->drawSlider(Common::Rect(_x, _y, _x + _w, _y + _h), valueToBarWidth(getMaxValue() - _value), _state);
+		g_gui.theme()->drawSlider(r1, valueToBarWidth(getMaxValue() - _value), _state);
 	}
 	else {
-		g_gui.theme()->drawSlider(Common::Rect(_x, _y, _x + _w, _y + _h), valueToBarWidth(_value), _state);
+		g_gui.theme()->drawSlider(r1, valueToBarWidth(_value), _state);
 	}
 }
 
@@ -852,7 +861,7 @@ void GraphicsWidget::drawWidget() {
 
 		const int x = _x + (_w - _gfx.w) / 2;
 		const int y = _y + (_h - _gfx.h) / 2;
-
+		
 		g_gui.theme()->drawSurface(Common::Point(x, y), _gfx, _transparency);
 	}
 }
diff --git a/gui/widgets/popup.cpp b/gui/widgets/popup.cpp
index 3d8d7abce2..d3324f7b65 100644
--- a/gui/widgets/popup.cpp
+++ b/gui/widgets/popup.cpp
@@ -518,6 +518,10 @@ void PopUpWidget::drawWidget() {
 	if (g_gui.useRTL())
 		_x = g_system->getOverlayWidth() - _x - _w;
 
+	// GUI TODO: Recheck what the below line does.
+	if (this->_name.contains("GameOptions") || this->_name.contains("Options"))
+		_x = g_system->getOverlayWidth() - _w - _x;
+
 	g_gui.theme()->drawPopUpWidget(Common::Rect(_x, _y, _x + _w, _y + _h), sel, _leftPadding, _state);
 }
 
diff --git a/gui/widgets/scrollcontainer.cpp b/gui/widgets/scrollcontainer.cpp
index ac79f844f9..bcd2857058 100644
--- a/gui/widgets/scrollcontainer.cpp
+++ b/gui/widgets/scrollcontainer.cpp
@@ -141,6 +141,10 @@ 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;
+
 	g_gui.theme()->drawWidgetBackground(Common::Rect(_x, _y, _x + _w, _y + getHeight()), _backgroundType);
 }
 


Commit: a7fe8ad7d89c83dbb8176c6436f2e63a283abbe0
    https://github.com/scummvm/scummvm/commit/a7fe8ad7d89c83dbb8176c6436f2e63a283abbe0
Author: aryanrawlani28 (aryanrawlani007 at gmail.com)
Date: 2020-06-22T00:03:02+02:00

Commit Message:
GUI: Rename some variable and fix review issues

Changed paths:
    gui/ThemeLayout.cpp
    gui/gui-manager.cpp
    gui/gui-manager.h
    gui/options.cpp
    gui/widget.cpp


diff --git a/gui/ThemeLayout.cpp b/gui/ThemeLayout.cpp
index 887aecf057..7616212255 100644
--- a/gui/ThemeLayout.cpp
+++ b/gui/ThemeLayout.cpp
@@ -246,7 +246,7 @@ void ThemeLayoutMain::reflowLayout(Widget *widgetChain) {
 		if (this->_name == "GameOptions" || this->_name == "GlobalOptions") {
 			int oldX = _x;
 			_x = g_system->getOverlayWidth() - _w - _x;
-			g_gui.setOverlayParas(oldX, _x);
+			g_gui.setDialogPaddings(oldX, _x);
 		}
 	}
 
@@ -389,7 +389,7 @@ void ThemeLayoutStacked::reflowLayoutHorizontal(Widget *widgetChain) {
 			resize[rescount++] = i;
 			_children[i]->setWidth(0);
 		}
-		
+
 		_children[i]->offsetX(curX);
 
 		// Advance the horizontal offset by the width of the newest item, plus
diff --git a/gui/gui-manager.cpp b/gui/gui-manager.cpp
index f2543eabe1..5cf03ce0ac 100644
--- a/gui/gui-manager.cpp
+++ b/gui/gui-manager.cpp
@@ -70,10 +70,10 @@ GuiManager::GuiManager() : _redrawStatus(kRedrawDisabled), _stateIsSaved(false),
 	_launched = false;
 
 	_useRTL = false;
-	_isAnotherWindowOverlayed = false;
+	_isAnotherDialogOverlayed = false;
 
-	_focusedWindowLeftSpacing = 0;
-	_focusedWindowRightSpacing = 0;
+	_topDialogLeftPadding = 0;
+	_topDialogRightPadding = 0;
 
 	// Clear the cursor
 	memset(_cursor, 0xFF, sizeof(_cursor));
@@ -671,13 +671,9 @@ void GuiManager::setLastMousePos(int16 x, int16 y) {
 	_lastMousePosition.time = _system->getMillis(true);
 }
 
-void GuiManager::setOverlayParas(int l, int r) {
-	_focusedWindowLeftSpacing = l;
-	_focusedWindowRightSpacing = r;
-}
-
-void GuiManager::setWindowOverlayStatus(bool value) {
-	_isAnotherWindowOverlayed = value;
+void GuiManager::setDialogPaddings(int l, int r) {
+	_topDialogLeftPadding = l;
+	_topDialogRightPadding = r;
 }
 
 #ifdef USE_TTS
diff --git a/gui/gui-manager.h b/gui/gui-manager.h
index 0252bedf1e..83a4f8bbb6 100644
--- a/gui/gui-manager.h
+++ b/gui/gui-manager.h
@@ -90,10 +90,8 @@ public:
 	int getHeight() const { return _height; }
 
 	bool useRTL() const { return _useRTL; }
-	void setOverlayParas(int l, int r);
-	int getOverlayOffset() { return _focusedWindowRightSpacing - _focusedWindowLeftSpacing; }
-	void setWindowOverlayStatus(bool value);
-	bool isWindowOverlayed() const { return _isAnotherWindowOverlayed; }
+	void setDialogPaddings(int l, int r);
+	int getOverlayOffset() { return _topDialogRightPadding - _topDialogLeftPadding; }
 
 	const Graphics::Font &getFont(ThemeEngine::FontStyle style = ThemeEngine::kFontStyleBold) const { return *(_theme->getFont(style)); }
 	int getFontHeight(ThemeEngine::FontStyle style = ThemeEngine::kFontStyleBold) const { return _theme->getFontHeight(style); }
@@ -145,10 +143,10 @@ protected:
 	bool		_useStdCursor;
 
 	bool		_useRTL;
-	bool		_isAnotherWindowOverlayed;
+	bool		_isAnotherDialogOverlayed;
 
-	int			_focusedWindowLeftSpacing;
-	int			_focusedWindowRightSpacing;
+	int			_topDialogLeftPadding;
+	int			_topDialogRightPadding;
 
 	// position and time of last mouse click (used to detect double clicks)
 	struct MousePos {
diff --git a/gui/options.cpp b/gui/options.cpp
index a2c4cdf598..e19e583a06 100644
--- a/gui/options.cpp
+++ b/gui/options.cpp
@@ -147,8 +147,7 @@ OptionsDialog::OptionsDialog(const Common::String &domain, const Common::String
 
 OptionsDialog::~OptionsDialog() {
 	delete _subToggleGroup;
-	g_gui.setWindowOverlayStatus(false);
-	g_gui.setOverlayParas(0, 0);			// GUI TODO: This does not seem necessary, but lets be safe for now.
+	g_gui.setDialogPaddings(0, 0);
 }
 
 void OptionsDialog::init() {
@@ -217,8 +216,6 @@ void OptionsDialog::init() {
 	_subSpeedSlider = nullptr;
 	_subSpeedLabel = nullptr;
 
-	g_gui.setWindowOverlayStatus(true);
-
 	// Retrieve game GUI options
 	_guioptions.clear();
 	if (ConfMan.hasKey("guioptions", _domain)) {
@@ -1832,9 +1829,8 @@ void GlobalOptionsDialog::build() {
 
 	// GUI TODO: Incomplete implementation, currently just switches to last tab.
 	if (g_gui.useRTL()) {
-		tab->setActiveTab(tab->getActiveTab());
-	}
-	else {
+		tab->setActiveTab(tab->getTabsSize() - 1);
+	} else {
 		// Activate the first tab
 		tab->setActiveTab(0);
 	}
diff --git a/gui/widget.cpp b/gui/widget.cpp
index 132e30a2ee..f34b8fb034 100644
--- a/gui/widget.cpp
+++ b/gui/widget.cpp
@@ -606,7 +606,7 @@ void PicButtonWidget::drawWidget() {
 
 		const int x = _x + (_w - gfx->w) / 2;
 		const int y = _y + (_h - gfx->h) / 2;
-		
+	
 		g_gui.theme()->drawSurface(Common::Point(x, y), *gfx, _transparency);
 	}
 }


Commit: b8f51ce33a7cd9f50ec5062019677bf74162917e
    https://github.com/scummvm/scummvm/commit/b8f51ce33a7cd9f50ec5062019677bf74162917e
Author: aryanrawlani28 (aryanrawlani007 at gmail.com)
Date: 2020-06-22T00:03:02+02:00

Commit Message:
GUI: RTL: Base support for radiobuttons and checkboxes

Changed paths:
    gui/ThemeEngine.cpp
    gui/ThemeEngine.h
    gui/widget.cpp


diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp
index 4190cc14c1..885358da55 100644
--- a/gui/ThemeEngine.cpp
+++ b/gui/ThemeEngine.cpp
@@ -988,7 +988,7 @@ void ThemeEngine::drawLineSeparator(const Common::Rect &r) {
 	drawDD(kDDSeparator, r);
 }
 
-void ThemeEngine::drawCheckbox(const Common::Rect &r, const Common::String &str, bool checked, WidgetStateInfo state) {
+void ThemeEngine::drawCheckbox(const Common::Rect &r, const Common::String &str, bool checked, WidgetStateInfo state, bool drawText) {
 	if (!ready())
 		return;
 
@@ -1011,13 +1011,13 @@ void ThemeEngine::drawCheckbox(const Common::Rect &r, const Common::String &str,
 	r2.left = r2.right + checkBoxSize;
 	r2.right = r.right;
 
-	if (r2.right > r2.left) {
+	if (r2.right > r2.left && drawText) {
 		drawDDText(getTextData(dd), getTextColor(dd), r2, str, true, false, _widgets[kDDCheckboxDefault]->_textAlignH,
 		           _widgets[dd]->_textAlignV);
 	}
 }
 
-void ThemeEngine::drawRadiobutton(const Common::Rect &r, const Common::String &str, bool checked, WidgetStateInfo state) {
+void ThemeEngine::drawRadiobutton(const Common::Rect &r, const Common::String &str, bool checked, WidgetStateInfo state, bool drawText) {
 	if (!ready())
 		return;
 
@@ -1030,18 +1030,20 @@ void ThemeEngine::drawRadiobutton(const Common::Rect &r, const Common::String &s
 	if (state == kStateDisabled)
 		dd = kDDRadiobuttonDisabled;
 
-	const int checkBoxSize = MIN((int)r.height(), getFontHeight());
+	const int radioButtonSize = MIN((int)r.height(), getFontHeight());
 
-	r2.bottom = r2.top + checkBoxSize;
-	r2.right = r2.left + checkBoxSize;
+	r2.bottom = r2.top + radioButtonSize;
+	r2.right = r2.left + radioButtonSize;
 
 	drawDD(dd, r2);
 
-	r2.left = r2.right + checkBoxSize;
+	r2.left = r2.right + radioButtonSize;
 	r2.right = MAX(r2.left, r.right);
 
-	drawDDText(getTextData(dd), getTextColor(dd), r2, str, true, false, _widgets[kDDRadiobuttonDefault]->_textAlignH,
-	           _widgets[dd]->_textAlignV);
+	if (drawText) {
+		drawDDText(getTextData(dd), getTextColor(dd), r2, str, true, false, _widgets[kDDRadiobuttonDefault]->_textAlignH,
+				   _widgets[dd]->_textAlignV);
+	}
 }
 
 void ThemeEngine::drawSlider(const Common::Rect &r, int width, WidgetStateInfo state) {
diff --git a/gui/ThemeEngine.h b/gui/ThemeEngine.h
index 14c3bc56eb..f7d695001b 100644
--- a/gui/ThemeEngine.h
+++ b/gui/ThemeEngine.h
@@ -416,10 +416,10 @@ public:
 	void drawSlider(const Common::Rect &r, int width, WidgetStateInfo state = kStateEnabled);
 
 	void drawCheckbox(const Common::Rect &r, const Common::String &str, bool checked,
-	                  WidgetStateInfo state = kStateEnabled);
+	                  WidgetStateInfo state = kStateEnabled, bool drawText = true);
 
 	void drawRadiobutton(const Common::Rect &r, const Common::String &str, bool checked,
-	                     WidgetStateInfo state = kStateEnabled);
+	                     WidgetStateInfo state = kStateEnabled, bool drawText = true);
 
 	void drawTab(const Common::Rect &r, int tabHeight, const Common::Array<int> &tabWidths,
 	             const Common::Array<Common::String> &tabs, int active);
diff --git a/gui/widget.cpp b/gui/widget.cpp
index f34b8fb034..d6ace64deb 100644
--- a/gui/widget.cpp
+++ b/gui/widget.cpp
@@ -642,7 +642,22 @@ void CheckboxWidget::setState(bool state) {
 }
 
 void CheckboxWidget::drawWidget() {
-	g_gui.theme()->drawCheckbox(Common::Rect(_x, _y, _x + _w, _y + _h), _label, _state, Widget::_state);
+	Common::Rect r1(_x, _y, _x + _w, _y + _h);
+
+	if (g_gui.useRTL() && _useRTL) {
+		Common::Rect r2 = r1;
+		const int checkBoxSize = (int)r1.height() < g_gui.getFontHeight() ? (int)r1.height() : g_gui.getFontHeight();
+
+		r1.translate(-checkBoxSize * 2, 0);
+		g_gui.theme()->drawText(r1, _label, Widget::_state, Graphics::kTextAlignRight);
+
+		r2.left = r1.right + checkBoxSize;
+		r2.right = r2.left + checkBoxSize;
+
+		g_gui.theme()->drawCheckbox(r2, _label, _state, Widget::_state, false);
+	} else {
+		g_gui.theme()->drawCheckbox(r1, _label, _state, Widget::_state);
+	}
 }
 
 #pragma mark -
@@ -711,7 +726,22 @@ void RadiobuttonWidget::setState(bool state, bool setGroup) {
 }
 
 void RadiobuttonWidget::drawWidget() {
-	g_gui.theme()->drawRadiobutton(Common::Rect(_x, _y, _x + _w, _y + _h), _label, _state, Widget::_state);
+	Common::Rect r1(_x, _y, _x + _w, _y + _h);
+
+	if (g_gui.useRTL() && _useRTL) {
+		Common::Rect r2 = r1;
+		const int radiobuttonSize = (int)r1.height() < g_gui.getFontHeight() ? (int)r1.height() : g_gui.getFontHeight();
+
+		r1.translate(-radiobuttonSize * 2, 0);
+		g_gui.theme()->drawText(r1, _label, Widget::_state, Graphics::kTextAlignRight);
+
+		r2.left = r1.right + radiobuttonSize;
+		r2.right = r2.left + radiobuttonSize;
+
+		g_gui.theme()->drawRadiobutton(r2, _label, _state, Widget::_state, false);
+	} else {
+		g_gui.theme()->drawRadiobutton(r1, _label, _state, Widget::_state);
+	}
 }
 
 #pragma mark -


Commit: f09d15d610a52aa8df677e6a77d655c2b68c2c12
    https://github.com/scummvm/scummvm/commit/f09d15d610a52aa8df677e6a77d655c2b68c2c12
Author: aryanrawlani28 (aryanrawlani007 at gmail.com)
Date: 2020-06-22T00:03:02+02:00

Commit Message:
GUI: RTL: Perfect drawing of popups and right align text

Changed paths:
    gui/widgets/popup.cpp


diff --git a/gui/widgets/popup.cpp b/gui/widgets/popup.cpp
index d3324f7b65..018d57e328 100644
--- a/gui/widgets/popup.cpp
+++ b/gui/widgets/popup.cpp
@@ -132,6 +132,9 @@ void PopUpDialog::reflowLayout() {
 void PopUpDialog::drawDialog(DrawLayer layerToDraw) {
 	Dialog::drawDialog(layerToDraw);
 
+	if (g_gui.useRTL())
+		_x = _x + g_gui.getOverlayOffset();
+
 	// Draw the menu border
 	g_gui.theme()->drawWidgetBackground(Common::Rect(_x, _y, _x + _w, _y + _h), ThemeEngine::kWidgetBackgroundPlain);
 
@@ -297,7 +300,7 @@ void PopUpDialog::clearEntries() {
 
 int PopUpDialog::findItem(int x, int y) const {
 	if (x >= 0 && x < _w && y >= 0 && y < _h) {
-		if (_twoColumns) {
+		if (_twoColumns) {							// GUI TODO: Problems with collisions in 2 coloums.
 			uint entry = (y - 2) / _lineHeight;
 			if (x > _w / 2) {
 				entry += _entriesPerColumn;
@@ -391,14 +394,24 @@ void PopUpDialog::drawMenuEntry(int entry, bool hilite) {
 
 	Common::String &name(_entries[entry]);
 
+	Common::Rect r1(x, y, x + w, y + _lineHeight);
+	Common::Rect r2(x + 1, y + 2, x + w, y + 2 + _lineHeight);
+	Graphics::TextAlign alignment = Graphics::TextAlign::kTextAlignLeft;
+
+	if (g_gui.useRTL()) {
+		r2.translate(-g_gui.getOverlayOffset(), 0);
+		alignment = Graphics::kTextAlignRight;
+		_leftPadding = 0;
+	}
+
 	if (name.size() == 0) {
 		// Draw a separator
-		g_gui.theme()->drawLineSeparator(Common::Rect(x, y, x + w, y + _lineHeight));
+		g_gui.theme()->drawLineSeparator(r1);
 	} else {
 		g_gui.theme()->drawText(
-			Common::Rect(x + 1, y + 2, x + w, y + 2 + _lineHeight),
+			r2,
 			name, hilite ? ThemeEngine::kStateHighlight : ThemeEngine::kStateEnabled,
-			Graphics::kTextAlignLeft, ThemeEngine::kTextInversionNone, _leftPadding
+			alignment, ThemeEngine::kTextInversionNone, _leftPadding
 		);
 	}
 }
@@ -518,10 +531,6 @@ void PopUpWidget::drawWidget() {
 	if (g_gui.useRTL())
 		_x = g_system->getOverlayWidth() - _x - _w;
 
-	// GUI TODO: Recheck what the below line does.
-	if (this->_name.contains("GameOptions") || this->_name.contains("Options"))
-		_x = g_system->getOverlayWidth() - _w - _x;
-
 	g_gui.theme()->drawPopUpWidget(Common::Rect(_x, _y, _x + _w, _y + _h), sel, _leftPadding, _state);
 }
 


Commit: 5e39545653701942fdbea58c4d2b8cde351499b4
    https://github.com/scummvm/scummvm/commit/5e39545653701942fdbea58c4d2b8cde351499b4
Author: aryanrawlani28 (aryanrawlani007 at gmail.com)
Date: 2020-06-22T00:03:02+02:00

Commit Message:
GUI: RTL: Fix tooltips and scrollbars for overlay dialogs

Changed paths:
    gui/Tooltip.cpp
    gui/widgets/scrollbar.cpp


diff --git a/gui/Tooltip.cpp b/gui/Tooltip.cpp
index 5282310bcb..c348ca816f 100644
--- a/gui/Tooltip.cpp
+++ b/gui/Tooltip.cpp
@@ -56,7 +56,7 @@ void Tooltip::setup(Dialog *parent, Widget *widget, int x, int y) {
 	_y = MIN<int16>(parent->_y + y + _ydelta, g_gui.getHeight() - _h - 3);
 
 	if (g_gui.useRTL())
-		_x = g_system->getOverlayWidth() - _w - _x;
+		_x = g_system->getOverlayWidth() - _w - _x + g_gui.getOverlayOffset();
 
 #ifdef USE_TTS
 	if (ConfMan.hasKey("tts_enabled", "scummvm") &&
diff --git a/gui/widgets/scrollbar.cpp b/gui/widgets/scrollbar.cpp
index c45b4e0ec5..0f2c65dc2c 100644
--- a/gui/widgets/scrollbar.cpp
+++ b/gui/widgets/scrollbar.cpp
@@ -193,6 +193,9 @@ void ScrollBarWidget::drawWidget() {
 	if (_draggingPart != kNoPart)
 		_part = _draggingPart;
 
+	if (g_gui.useRTL() && _useRTL)
+		_x = _x + g_gui.getOverlayOffset();
+
 	ThemeEngine::ScrollbarState state = ThemeEngine::kScrollbarStateNo;
 	if (_numEntries <= _entriesPerPage) {
 		state = ThemeEngine::kScrollbarStateSinglePage;


Commit: d6c2d4b809ec176eeee0cfce069ef4e9ac3bcd09
    https://github.com/scummvm/scummvm/commit/d6c2d4b809ec176eeee0cfce069ef4e9ac3bcd09
Author: aryanrawlani28 (aryanrawlani007 at gmail.com)
Date: 2020-06-22T00:03:02+02:00

Commit Message:
GUI: RTL: Align fixes for text in Load game dialog

Changed paths:
    gui/saveload-dialog.cpp
    gui/saveload-dialog.h


diff --git a/gui/saveload-dialog.cpp b/gui/saveload-dialog.cpp
index d63d2479a6..c0474f958e 100644
--- a/gui/saveload-dialog.cpp
+++ b/gui/saveload-dialog.cpp
@@ -376,7 +376,9 @@ SaveLoadChooserSimple::SaveLoadChooserSimple(const String &title, const String &
 	_container(nullptr) {
 	_backgroundType = ThemeEngine::kDialogBackgroundSpecial;
 
-	new StaticTextWidget(this, "SaveLoadChooser.Title", title);
+	_pageTitle = new StaticTextWidget(this, "SaveLoadChooser.Title", title);
+	if(g_gui.useRTL())
+		_pageTitle->setAlign(Graphics::kTextAlignRight);
 
 	// Add choice list
 	_list = new ListWidget(this, "SaveLoadChooser.List");
@@ -757,7 +759,9 @@ SaveLoadChooserGrid::SaveLoadChooserGrid(const Common::String &title, bool saveM
 	_curPage(0), _newSaveContainer(nullptr), _nextFreeSaveSlot(0), _buttons() {
 	_backgroundType = ThemeEngine::kDialogBackgroundSpecial;
 
-	new StaticTextWidget(this, "SaveLoadChooser.Title", title);
+	_pageTitle = new StaticTextWidget(this, "SaveLoadChooser.Title", title);
+	if(g_gui.useRTL())
+		_pageTitle->setAlign(Graphics::kTextAlignRight);
 
 	// The list widget needs to be bound so it takes space in the layout
 	ContainerWidget *list = new ContainerWidget(this, "SaveLoadChooser.List");
@@ -773,10 +777,17 @@ SaveLoadChooserGrid::SaveLoadChooserGrid(const Common::String &title, bool saveM
 
 	// Page display
 	_pageDisplay = new StaticTextWidget(this, "SaveLoadChooser.PageDisplay", Common::String());
-	_pageDisplay->setAlign(Graphics::kTextAlignRight);
+	if (g_gui.useRTL()) {
+		_pageDisplay->setAlign(Graphics::kTextAlignLeft);
+	} else {
+		_pageDisplay->setAlign(Graphics::kTextAlignRight);
+	}
 }
 
 SaveLoadChooserGrid::~SaveLoadChooserGrid() {
+	removeWidget(_pageTitle);
+	delete _pageTitle;
+
 	removeWidget(_pageDisplay);
 	delete _pageDisplay;
 }
@@ -944,6 +955,8 @@ void SaveLoadChooserGrid::reflowLayout() {
 	_lines = MAX<uint>(1, availableHeight / slotAreaHeight);
 	_entriesPerPage = _columns * _lines;
 
+	Graphics::TextAlign alignment = Graphics::kTextAlignLeft;
+
 	// In save mode the first button is always "New Save", thus we need to
 	// adjust the entries per page here.
 	if (_saveMode) {
@@ -991,10 +1004,15 @@ void SaveLoadChooserGrid::reflowLayout() {
 				buttonCmd += 1;
 			}
 
+			if (g_gui.useRTL()) {
+				alignment = Graphics::kTextAlignRight;
+				// GUI TODO: 1st and 3rd row pictures not being displayed.
+			}
+
 			PicButtonWidget *button = new PicButtonWidget(container, dstX, dstY, buttonWidth, buttonHeight, nullptr, buttonCmd);
 			dstY += buttonHeight;
 
-			StaticTextWidget *description = new StaticTextWidget(container, dstX, dstY, buttonWidth, kLineHeight, Common::String(), Graphics::kTextAlignLeft);
+			StaticTextWidget *description = new StaticTextWidget(container, dstX, dstY, buttonWidth, kLineHeight, Common::String(), alignment);
 
 			_buttons.push_back(SlotButton(container, button, description));
 		}
diff --git a/gui/saveload-dialog.h b/gui/saveload-dialog.h
index f9a437de60..ce8b84d987 100644
--- a/gui/saveload-dialog.h
+++ b/gui/saveload-dialog.h
@@ -161,6 +161,7 @@ private:
 	StaticTextWidget	*_date;
 	StaticTextWidget	*_time;
 	StaticTextWidget	*_playtime;
+	StaticTextWidget	*_pageTitle;
 
 	String					_resultString;
 
@@ -218,6 +219,7 @@ private:
 	ButtonWidget *_nextButton;
 	ButtonWidget *_prevButton;
 
+	StaticTextWidget *_pageTitle;
 	StaticTextWidget *_pageDisplay;
 
 	ContainerWidget *_newSaveContainer;


Commit: d6a340d3b4862444c2606deede1c06ff5f30c821
    https://github.com/scummvm/scummvm/commit/d6a340d3b4862444c2606deede1c06ff5f30c821
Author: aryanrawlani28 (aryanrawlani007 at gmail.com)
Date: 2020-06-22T00:03:02+02:00

Commit Message:
GUI: Cleanup hacky function for internal flip and fix review issues

Changed paths:
    gui/ThemeEngine.cpp
    gui/ThemeEngine.h
    gui/saveload-dialog.cpp
    gui/widget.cpp
    gui/widgets/tab.cpp


diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp
index 885358da55..506b103466 100644
--- a/gui/ThemeEngine.cpp
+++ b/gui/ThemeEngine.cpp
@@ -988,7 +988,7 @@ void ThemeEngine::drawLineSeparator(const Common::Rect &r) {
 	drawDD(kDDSeparator, r);
 }
 
-void ThemeEngine::drawCheckbox(const Common::Rect &r, const Common::String &str, bool checked, WidgetStateInfo state, bool drawText) {
+void ThemeEngine::drawCheckbox(const Common::Rect &r, const Common::String &str, bool checked, WidgetStateInfo state) {
 	if (!ready())
 		return;
 
@@ -1011,13 +1011,13 @@ void ThemeEngine::drawCheckbox(const Common::Rect &r, const Common::String &str,
 	r2.left = r2.right + checkBoxSize;
 	r2.right = r.right;
 
-	if (r2.right > r2.left && drawText) {
+	if (r2.right > r2.left) {
 		drawDDText(getTextData(dd), getTextColor(dd), r2, str, true, false, _widgets[kDDCheckboxDefault]->_textAlignH,
 		           _widgets[dd]->_textAlignV);
 	}
 }
 
-void ThemeEngine::drawRadiobutton(const Common::Rect &r, const Common::String &str, bool checked, WidgetStateInfo state, bool drawText) {
+void ThemeEngine::drawRadiobutton(const Common::Rect &r, const Common::String &str, bool checked, WidgetStateInfo state) {
 	if (!ready())
 		return;
 
@@ -1040,10 +1040,8 @@ void ThemeEngine::drawRadiobutton(const Common::Rect &r, const Common::String &s
 	r2.left = r2.right + radioButtonSize;
 	r2.right = MAX(r2.left, r.right);
 
-	if (drawText) {
-		drawDDText(getTextData(dd), getTextColor(dd), r2, str, true, false, _widgets[kDDRadiobuttonDefault]->_textAlignH,
-				   _widgets[dd]->_textAlignV);
-	}
+	drawDDText(getTextData(dd), getTextColor(dd), r2, str, true, false, _widgets[kDDRadiobuttonDefault]->_textAlignH,
+				_widgets[dd]->_textAlignV);
 }
 
 void ThemeEngine::drawSlider(const Common::Rect &r, int width, WidgetStateInfo state) {
diff --git a/gui/ThemeEngine.h b/gui/ThemeEngine.h
index f7d695001b..14c3bc56eb 100644
--- a/gui/ThemeEngine.h
+++ b/gui/ThemeEngine.h
@@ -416,10 +416,10 @@ public:
 	void drawSlider(const Common::Rect &r, int width, WidgetStateInfo state = kStateEnabled);
 
 	void drawCheckbox(const Common::Rect &r, const Common::String &str, bool checked,
-	                  WidgetStateInfo state = kStateEnabled, bool drawText = true);
+	                  WidgetStateInfo state = kStateEnabled);
 
 	void drawRadiobutton(const Common::Rect &r, const Common::String &str, bool checked,
-	                     WidgetStateInfo state = kStateEnabled, bool drawText = true);
+	                     WidgetStateInfo state = kStateEnabled);
 
 	void drawTab(const Common::Rect &r, int tabHeight, const Common::Array<int> &tabWidths,
 	             const Common::Array<Common::String> &tabs, int active);
diff --git a/gui/saveload-dialog.cpp b/gui/saveload-dialog.cpp
index c0474f958e..f006b9f32e 100644
--- a/gui/saveload-dialog.cpp
+++ b/gui/saveload-dialog.cpp
@@ -377,7 +377,7 @@ SaveLoadChooserSimple::SaveLoadChooserSimple(const String &title, const String &
 	_backgroundType = ThemeEngine::kDialogBackgroundSpecial;
 
 	_pageTitle = new StaticTextWidget(this, "SaveLoadChooser.Title", title);
-	if(g_gui.useRTL())
+	if (g_gui.useRTL())
 		_pageTitle->setAlign(Graphics::kTextAlignRight);
 
 	// Add choice list
@@ -760,7 +760,7 @@ SaveLoadChooserGrid::SaveLoadChooserGrid(const Common::String &title, bool saveM
 	_backgroundType = ThemeEngine::kDialogBackgroundSpecial;
 
 	_pageTitle = new StaticTextWidget(this, "SaveLoadChooser.Title", title);
-	if(g_gui.useRTL())
+	if (g_gui.useRTL())
 		_pageTitle->setAlign(Graphics::kTextAlignRight);
 
 	// The list widget needs to be bound so it takes space in the layout
diff --git a/gui/widget.cpp b/gui/widget.cpp
index d6ace64deb..f34b8fb034 100644
--- a/gui/widget.cpp
+++ b/gui/widget.cpp
@@ -642,22 +642,7 @@ void CheckboxWidget::setState(bool state) {
 }
 
 void CheckboxWidget::drawWidget() {
-	Common::Rect r1(_x, _y, _x + _w, _y + _h);
-
-	if (g_gui.useRTL() && _useRTL) {
-		Common::Rect r2 = r1;
-		const int checkBoxSize = (int)r1.height() < g_gui.getFontHeight() ? (int)r1.height() : g_gui.getFontHeight();
-
-		r1.translate(-checkBoxSize * 2, 0);
-		g_gui.theme()->drawText(r1, _label, Widget::_state, Graphics::kTextAlignRight);
-
-		r2.left = r1.right + checkBoxSize;
-		r2.right = r2.left + checkBoxSize;
-
-		g_gui.theme()->drawCheckbox(r2, _label, _state, Widget::_state, false);
-	} else {
-		g_gui.theme()->drawCheckbox(r1, _label, _state, Widget::_state);
-	}
+	g_gui.theme()->drawCheckbox(Common::Rect(_x, _y, _x + _w, _y + _h), _label, _state, Widget::_state);
 }
 
 #pragma mark -
@@ -726,22 +711,7 @@ void RadiobuttonWidget::setState(bool state, bool setGroup) {
 }
 
 void RadiobuttonWidget::drawWidget() {
-	Common::Rect r1(_x, _y, _x + _w, _y + _h);
-
-	if (g_gui.useRTL() && _useRTL) {
-		Common::Rect r2 = r1;
-		const int radiobuttonSize = (int)r1.height() < g_gui.getFontHeight() ? (int)r1.height() : g_gui.getFontHeight();
-
-		r1.translate(-radiobuttonSize * 2, 0);
-		g_gui.theme()->drawText(r1, _label, Widget::_state, Graphics::kTextAlignRight);
-
-		r2.left = r1.right + radiobuttonSize;
-		r2.right = r2.left + radiobuttonSize;
-
-		g_gui.theme()->drawRadiobutton(r2, _label, _state, Widget::_state, false);
-	} else {
-		g_gui.theme()->drawRadiobutton(r1, _label, _state, Widget::_state);
-	}
+	g_gui.theme()->drawRadiobutton(Common::Rect(_x, _y, _x + _w, _y + _h), _label, _state, Widget::_state);
 }
 
 #pragma mark -
diff --git a/gui/widgets/tab.cpp b/gui/widgets/tab.cpp
index 873d8c1a2a..982cf76a21 100644
--- a/gui/widgets/tab.cpp
+++ b/gui/widgets/tab.cpp
@@ -435,11 +435,8 @@ void TabWidget::drawWidget() {
 		}
 	}
 
-	// GUI TODO: Is this necessary?
 	Common::Rect r1(_x + _bodyLP, _y + _bodyTP, _x + _w - _bodyRP, _y + _h - _bodyBP + _tabHeight);
-	if (g_gui.useRTL()) {
-		r1.translate(g_system->getOverlayWidth() - _x - _w, 0);
-	}
+
 	g_gui.theme()->drawDialogBackground(r1, _bodyBackgroundType);
 
 	Common::Rect r2(_x, _y, _x + _w, _y + _h);


Commit: 37c5013ef4951678054eb4ce5acf5844b082649b
    https://github.com/scummvm/scummvm/commit/37c5013ef4951678054eb4ce5acf5844b082649b
Author: aryanrawlani28 (aryanrawlani007 at gmail.com)
Date: 2020-06-22T00:03:02+02:00

Commit Message:
GUI: RTL: Alignment fixes for all StaticTextWidgets

Changed paths:
    gui/widget.cpp


diff --git a/gui/widget.cpp b/gui/widget.cpp
index f34b8fb034..b42ba3c4ab 100644
--- a/gui/widget.cpp
+++ b/gui/widget.cpp
@@ -305,6 +305,14 @@ StaticTextWidget::StaticTextWidget(GuiObject *boss, const Common::String &name,
 	_label = text;
 
 	_align = g_gui.xmlEval()->getWidgetTextHAlign(name);
+	if (g_gui.useRTL()) {
+		if (_align == Graphics::kTextAlignLeft) {
+			_align = Graphics::kTextAlignRight;
+		} else if (_align == Graphics::kTextAlignRight) {
+			_align = Graphics::kTextAlignLeft;
+		}
+	}
+
 	_font = font;
 }
 


Commit: a587624cb35935af14e45bfebd6865a96cade089
    https://github.com/scummvm/scummvm/commit/a587624cb35935af14e45bfebd6865a96cade089
Author: aryanrawlani28 (aryanrawlani007 at gmail.com)
Date: 2020-06-22T00:03:02+02:00

Commit Message:
GUI: RTL: Internal flipping for DropDownButton

Changed paths:
    gui/ThemeEngine.cpp
    gui/ThemeEngine.h
    gui/themes/scummremastered/remastered_gfx.stx
    gui/widget.cpp


diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp
index 506b103466..dffb041407 100644
--- a/gui/ThemeEngine.cpp
+++ b/gui/ThemeEngine.cpp
@@ -137,6 +137,12 @@ static const DrawDataInfo kDrawDataDefaults[] = {
 	{kDDDropDownButtonPressedLeft,  "dropdown_button_pressed_left",  kDrawLayerForeground, kDDDropDownButtonIdle},
 	{kDDDropDownButtonPressedRight, "dropdown_button_pressed_right", kDrawLayerForeground, kDDDropDownButtonIdle},
 
+	{kDDDropDownButtonIdleRTL,			"dropdown_button_idle_rtl",				kDrawLayerBackground, kDDNone},
+	{kDDDropDownButtonHoverLeftRTL,		"dropdown_button_hover_left_rtl",		kDrawLayerForeground, kDDDropDownButtonIdleRTL},
+	{kDDDropDownButtonHoverRightRTL,	"dropdown_button_hover_right_rtl",		kDrawLayerForeground, kDDDropDownButtonIdleRTL},
+	{kDDDropDownButtonPressedLeftRTL,	"dropdown_button_pressed_left_rtl",		kDrawLayerForeground, kDDDropDownButtonIdleRTL},
+	{kDDDropDownButtonPressedRightRTL,	"dropdown_button_pressed_right_rtl",	kDrawLayerForeground, kDDDropDownButtonIdleRTL},
+
 	{kDDSliderFull,                 "slider_full",      kDrawLayerForeground,  kDDNone},
 	{kDDSliderHover,                "slider_hover",     kDrawLayerForeground,  kDDNone},
 	{kDDSliderDisabled,             "slider_disabled",  kDrawLayerForeground,  kDDNone},
@@ -953,23 +959,24 @@ void ThemeEngine::drawButton(const Common::Rect &r, const Common::String &str, W
 }
 
 void ThemeEngine::drawDropDownButton(const Common::Rect &r, uint32 dropdownWidth, const Common::String &str,
-                                     ThemeEngine::WidgetStateInfo buttonState, bool inButton, bool inDropdown) {
+                                     ThemeEngine::WidgetStateInfo buttonState, bool inButton, bool inDropdown, bool rtl) {
 	if (!ready())
 		return;
 
 	DrawData dd;
+
 	if (buttonState == kStateHighlight && inButton)
-		dd = kDDDropDownButtonHoverLeft;
+		dd = rtl ? kDDDropDownButtonHoverLeftRTL : kDDDropDownButtonHoverLeft;
 	else if (buttonState == kStateHighlight && inDropdown)
-		dd = kDDDropDownButtonHoverRight;
+		dd = rtl ? kDDDropDownButtonHoverRightRTL : kDDDropDownButtonHoverRight;
 	else if (buttonState == kStateDisabled)
 		dd = kDDDropDownButtonDisabled;
 	else if (buttonState == kStatePressed && inButton)
-		dd = kDDDropDownButtonPressedLeft;
+		dd = rtl ? kDDDropDownButtonPressedLeftRTL : kDDDropDownButtonPressedLeft;
 	else if (buttonState == kStatePressed && inDropdown)
-		dd = kDDDropDownButtonPressedRight;
+		dd = rtl ? kDDDropDownButtonPressedRightRTL : kDDDropDownButtonPressedRight;
 	else
-		dd = kDDDropDownButtonIdle;
+		dd = rtl ? kDDDropDownButtonIdleRTL : kDDDropDownButtonIdle;
 
 	drawDD(dd, r);
 
diff --git a/gui/ThemeEngine.h b/gui/ThemeEngine.h
index 14c3bc56eb..46cdbfdcdc 100644
--- a/gui/ThemeEngine.h
+++ b/gui/ThemeEngine.h
@@ -87,6 +87,12 @@ enum DrawData {
 	kDDDropDownButtonPressedLeft,
 	kDDDropDownButtonPressedRight,
 
+	kDDDropDownButtonIdleRTL,
+	kDDDropDownButtonHoverLeftRTL,
+	kDDDropDownButtonHoverRightRTL,
+	kDDDropDownButtonPressedLeftRTL,
+	kDDDropDownButtonPressedRightRTL,
+
 	kDDSliderFull,
 	kDDSliderHover,
 	kDDSliderDisabled,
@@ -409,7 +415,7 @@ public:
 	                uint16 hints = 0);
 
 	void drawDropDownButton(const Common::Rect &r, uint32 dropdownWidth, const Common::String &str,
-	                        WidgetStateInfo buttonState, bool inButton, bool inDropdown);
+	                        WidgetStateInfo buttonState, bool inButton, bool inDropdown, bool rtl = false);
 
 	void drawSurface(const Common::Point &p, const Graphics::Surface &surface, bool themeTrans = false);
 
diff --git a/gui/themes/scummremastered/remastered_gfx.stx b/gui/themes/scummremastered/remastered_gfx.stx
index 5f7cbd572c..2aa9a28c48 100644
--- a/gui/themes/scummremastered/remastered_gfx.stx
+++ b/gui/themes/scummremastered/remastered_gfx.stx
@@ -880,6 +880,30 @@
 					orientation = 'bottom'
 		/>
 	</drawdata>
+	<drawdata id = 'dropdown_button_idle_rtl' cache = 'false' resolution = 'y>399'>
+		<text	font = 'text_button'
+				text_color = 'color_button'
+				vertical_align = 'center'
+				horizontal_align = 'center'
+		/>
+		<drawstep	func = 'roundedsq'
+					radius = '5'
+					fill = 'foreground'
+					shadow = '2'
+					fg_color = 'button_idle'
+					clip = '0,0,0,0'
+		/>
+		<drawstep	func = 'triangle'
+					fg_color = 'white'
+					fill = 'foreground'
+					width = '8'
+					height = '6'
+					xpos = 'left'
+					ypos = 'center'
+					padding = '2,0,2,0'
+					orientation = 'bottom'
+		/>
+	</drawdata>
 	<drawdata id = 'dropdown_button_idle' cache = 'false' resolution = 'y<400'>
 		<text	font = 'text_button'
 				text_color = 'color_button'
@@ -927,6 +951,29 @@
 					orientation = 'bottom'
 		/>
 	</drawdata>
+	<drawdata id = 'dropdown_button_hover_left_rtl' cache = 'false' resolution = 'y>399'>
+		<text	font = 'text_button'
+				text_color = 'color_button'
+				vertical_align = 'center'
+				horizontal_align = 'center'
+		/>
+		<drawstep	func = 'roundedsq'
+					radius = '5'
+					fill = 'foreground'
+					fg_color = 'button_hover'
+					clip = '13,0,0,0'
+		/>
+		<drawstep	func = 'triangle'
+					fg_color = 'white'
+					fill = 'foreground'
+					width = '8'
+					height = '6'
+					xpos = 'left'
+					ypos = 'center'
+					padding = '2,0,2,0'
+					orientation = 'bottom'
+		/>
+	</drawdata>
 	<drawdata id = 'dropdown_button_hover_left' cache = 'false' resolution = 'y<400'>
 		<text	font = 'text_button'
 				text_color = 'color_button'
@@ -974,6 +1021,29 @@
 					orientation = 'bottom'
 		/>
 	</drawdata>
+	<drawdata id = 'dropdown_button_hover_right_rtl' cache = 'false' resolution = 'y>399'>
+		<text	font = 'text_button'
+				text_color = 'color_button'
+				vertical_align = 'center'
+				horizontal_align = 'center'
+		/>
+		<drawstep	func = 'roundedsq'
+					radius = '5'
+					fill = 'foreground'
+					fg_color = 'button_hover'
+					clip = '0,0,13,0'
+		/>
+		<drawstep	func = 'triangle'
+					fg_color = 'white'
+					fill = 'foreground'
+					width = '8'
+					height = '6'
+					xpos = 'left'
+					ypos = 'center'
+					padding = '2,0,2,0'
+					orientation = 'bottom'
+		/>
+	</drawdata>
 	<drawdata id = 'dropdown_button_hover_right' cache = 'false' resolution = 'y<400'>
 		<text	font = 'text_button'
 				text_color = 'color_button'
@@ -1066,6 +1136,29 @@
 					orientation = 'bottom'
 		/>
 	</drawdata>
+	<drawdata id = 'dropdown_button_pressed_left_rtl' cache = 'false' resolution = 'y>399'>
+		<text	font = 'text_button'
+				text_color = 'color_button'
+				vertical_align = 'center'
+				horizontal_align = 'center'
+		/>
+		<drawstep	func = 'roundedsq'
+					radius = '5'
+					fill = 'foreground'
+					fg_color = 'button_pressed'
+					clip = '0,0,-13,0'
+		/>
+		<drawstep	func = 'triangle'
+					fg_color = 'white'
+					fill = 'foreground'
+					width = '8'
+					height = '6'
+					xpos = 'left'
+					ypos = 'center'
+					padding = '2,0,2,0'
+					orientation = 'bottom'
+		/>
+	</drawdata>
 	<drawdata id = 'dropdown_button_pressed_left' cache = 'false' resolution = 'y<400'>
 		<text	font = 'text_button'
 				text_color = 'color_button'
@@ -1113,6 +1206,29 @@
 					orientation = 'bottom'
 		/>
 	</drawdata>
+	<drawdata id = 'dropdown_button_pressed_right_rtl' cache = 'false' resolution = 'y>399'>
+		<text	font = 'text_button'
+				text_color = 'color_button'
+				vertical_align = 'center'
+				horizontal_align = 'center'
+		/>
+		<drawstep	func = 'roundedsq'
+					radius = '5'
+					fill = 'foreground'
+					fg_color = 'button_pressed'
+					clip = '0,0,13,0'
+		/>
+		<drawstep	func = 'triangle'
+					fg_color = 'white'
+					fill = 'foreground'
+					width = '8'
+					height = '6'
+					xpos = 'left'
+					ypos = 'center'
+					padding = '2,0,2,0'
+					orientation = 'bottom'
+		/>
+	</drawdata>
 	<drawdata id = 'dropdown_button_pressed_right' cache = 'false' resolution = 'y<400'>
 		<text	font = 'text_button'
 				text_color = 'color_button'
diff --git a/gui/widget.cpp b/gui/widget.cpp
index b42ba3c4ab..d1fea86008 100644
--- a/gui/widget.cpp
+++ b/gui/widget.cpp
@@ -118,8 +118,7 @@ void Widget::draw() {
 		if (g_gui.useRTL()) {
 			_x = g_system->getOverlayWidth() - _x - _w;
 
-			// if (g_gui.isWindowOverlayed()) {
-			// Can i use something better below?
+			// Can i use something better below instead of hardcoding the values?
 			
 			if (this->_name.contains("GameOptions") || this->_name.contains("GlobalOptions")){
 				_x = _x + g_gui.getOverlayOffset();
@@ -533,7 +532,7 @@ void DropdownButtonWidget::drawWidget() {			// These are okay, no need to flip a
 		g_gui.theme()->drawButton(Common::Rect(_x, _y, _x + _w, _y + _h), _label, _state);
 	} else {
 		g_gui.theme()->drawDropDownButton(Common::Rect(_x, _y, _x + _w, _y + _h), _dropdownWidth, _label,
-										  _state, _inButton, _inDropdown);
+										  _state, _inButton, _inDropdown, (g_gui.useRTL() && _useRTL));
 	}
 }
 


Commit: dda3ce09293836d31d1565d9fd32d94d24fb9da0
    https://github.com/scummvm/scummvm/commit/dda3ce09293836d31d1565d9fd32d94d24fb9da0
Author: aryanrawlani28 (aryanrawlani007 at gmail.com)
Date: 2020-06-22T00:03:02+02:00

Commit Message:
GUI: RTL: Rework remap widget for supporting RTL

Changed paths:
    backends/keymapper/remap-widget.cpp


diff --git a/backends/keymapper/remap-widget.cpp b/backends/keymapper/remap-widget.cpp
index f86cf44eef..6017cefdd4 100644
--- a/backends/keymapper/remap-widget.cpp
+++ b/backends/keymapper/remap-widget.cpp
@@ -108,6 +108,7 @@ void RemapWidget::reflowActionWidgets() {
 	int labelWidth = getWidth() - (spacing + keyButtonWidth + spacing);
 	labelWidth = MAX(0, labelWidth);
 
+	int xOffset = g_gui.getOverlayOffset();
 	uint textYOff = (buttonHeight - kLineHeight) / 2;
 
 	uint y = spacing;
@@ -130,6 +131,9 @@ void RemapWidget::reflowActionWidgets() {
 				int descriptionWidth = getWidth() - x - spacing - resetButtonWidth - spacing;
 				descriptionWidth = MAX(0, descriptionWidth);
 
+				if (g_gui.useRTL()) {
+					x = x - xOffset;
+				}
 				keymapTitle.descriptionText->resize(x, y + textYOff, descriptionWidth, kLineHeight);
 				keymapTitle.resetButton->resize(x + descriptionWidth, y, resetButtonWidth, buttonHeight);
 			}
@@ -139,9 +143,15 @@ void RemapWidget::reflowActionWidgets() {
 
 		x = spacing;
 
+		if (g_gui.useRTL()) {
+			x = x - xOffset;
+		}
 		row.keyButton->resize(x, y, keyButtonWidth, buttonHeight);
 
 		x += keyButtonWidth + spacing;
+		if (g_gui.useRTL()) {
+			x = x + spacing;		// GUI TODO: Some last characters keep getting cut off, but this may be a local testing language issue (i.e for English)
+		}
 		row.actionText->resize(x, y + textYOff, labelWidth, kLineHeight);
 
 		y += buttonHeight + spacing;
@@ -270,11 +280,13 @@ void RemapWidget::loadKeymap() {
 }
 
 void RemapWidget::refreshKeymap() {
+	Graphics::TextAlign alignment = g_gui.useRTL() ? Graphics::kTextAlignRight : Graphics::kTextAlignLeft;
+
 	for (uint i = 0; i < _actions.size(); i++) {
 		ActionRow &row = _actions[i];
 
 		if (!row.actionText) {
-			row.actionText = new GUI::StaticTextWidget(widgetsBoss(), 0, 0, 0, 0, "", Graphics::kTextAlignLeft, nullptr, GUI::ThemeEngine::kFontStyleNormal);
+			row.actionText = new GUI::StaticTextWidget(widgetsBoss(), 0, 0, 0, 0, "", alignment, nullptr, GUI::ThemeEngine::kFontStyleNormal);
 			row.actionText->setLabel(row.action->description);
 
 			row.keyButton = new GUI::DropdownButtonWidget(widgetsBoss(), 0, 0, 0, 0, "", nullptr, kRemapCmd + i);
@@ -303,7 +315,7 @@ void RemapWidget::refreshKeymap() {
 
 		KeymapTitleRow &keymapTitle = _keymapSeparators[row.keymap];
 		if (!keymapTitle.descriptionText) {
-			keymapTitle.descriptionText = new GUI::StaticTextWidget(widgetsBoss(), 0, 0, 0, 0, row.keymap->getDescription(), Graphics::kTextAlignLeft);
+			keymapTitle.descriptionText = new GUI::StaticTextWidget(widgetsBoss(), 0, 0, 0, 0, row.keymap->getDescription(), alignment);
 			keymapTitle.resetButton = new GUI::ButtonWidget(widgetsBoss(), 0, 0, 0, 0, "", nullptr, kResetKeymapCmd + i);
 
 			// I18N: Button to reset keymap mappings to defaults


Commit: c7469a114512ccfd6fdc5f9f9a50c18fa4f715e5
    https://github.com/scummvm/scummvm/commit/c7469a114512ccfd6fdc5f9f9a50c18fa4f715e5
Author: aryanrawlani28 (aryanrawlani007 at gmail.com)
Date: 2020-06-22T00:03:02+02:00

Commit Message:
GUI: RTL: Base support for tab widgets

Changed paths:
    gui/widgets/tab.cpp


diff --git a/gui/widgets/tab.cpp b/gui/widgets/tab.cpp
index 982cf76a21..6638966732 100644
--- a/gui/widgets/tab.cpp
+++ b/gui/widgets/tab.cpp
@@ -70,14 +70,12 @@ void TabWidget::init() {
 	int x = _w - _butRP - _butW * 2 - 2;
 	int y = _butTP - _tabHeight;
 
-	if (g_gui.useRTL() && false) {			// GUI TODO: Incomplete
-		//x = g_system->getOverlayWidth() - x - _w;		// GUI TODO: This is wrong. How am I fixing the navbars?
-		_navLeft = new ButtonWidget(this, x + _butW + 2, y, _butW, _butH, ">", nullptr, kCmdLeft);	// OK!
-		_navRight = new ButtonWidget(this, x, y, _butW, _butH, "<", nullptr, kCmdRight);
+	if (g_gui.useRTL()) {							// GUI TODO: Incomplete and possibly incorrect too. Unusable atm.
+		_navLeft = new ButtonWidget(this, x, y, _butW, _butH, ">", nullptr, kCmdLeft);
+		_navRight = new ButtonWidget(this, x + _butW + 2, y, _butW, _butH, "<", nullptr, kCmdRight);
 		_navLeft->setEnabled(true);
 		_navRight->setEnabled(false);
-	}
-	else {
+	} else {
 		_navLeft = new ButtonWidget(this, x, y, _butW, _butH, "<", nullptr, kCmdLeft);
 		_navRight = new ButtonWidget(this, x + _butW + 2, y, _butW, _butH, ">", nullptr, kCmdRight);
 		_navLeft->setEnabled(false);
@@ -130,22 +128,11 @@ int TabWidget::addTab(const String &title, const String &dialogName) {
 		newWidth = _minTabWidth;
 	newTab._tabWidth = newWidth;
 
-	if (g_gui.useRTL() && false) {					// GUI TODO: Incomplete, unusable atm
-		_tabs.insert_at(0, newTab);
-
-		// Activate the first tab, because it's been added at that position.
-		//setActiveTab(0);				// GUI TODO: Is this the root of errors?
-		/*int numTabs = _tabs.size();
-		setActiveTab(numTabs - 1);*/
-	}
-	else {
-		_tabs.push_back(newTab);
-		int numTabs = _tabs.size();
-
-		// Activate the new tab
-		setActiveTab(numTabs - 1);
-	}
+	_tabs.push_back(newTab);
+	int numTabs = _tabs.size();
 
+	// Activate the new tab
+	setActiveTab(numTabs - 1);
 
 	return _activeTab;
 }
@@ -245,33 +232,17 @@ void TabWidget::handleMouseDown(int x, int y, int button, int clickCount) {
 	if (x < 0)
 		return;
 
-	if (this->_name.contains("GameOptions") || this->_name.contains("GlobalOptions"))
-		;//_x = g_system->getOverlayWidth() - _w - _x;
-
 	// Determine which tab was clicked
 	int tabID;
-	if (g_gui.useRTL() && false) {				// GUI TODO: Incomplete
-		for (tabID = _lastVisibleTab; tabID >= _firstVisibleTab; --tabID) {
-			x -= _tabs[tabID]._tabWidth;
-			if (x < 0)
-				break;
-		}
-
-		if (tabID <= _lastVisibleTab)
-			setActiveTab(tabID);
-	}
-	else {
-		for (tabID = _firstVisibleTab; tabID <= _lastVisibleTab; ++tabID) {
-			x -= _tabs[tabID]._tabWidth;
-			if (x < 0)
-				break;
-		}
-
-		// If a tab was clicked, switch to that pane
-		if (tabID <= _lastVisibleTab)
-			setActiveTab(tabID);
+	for (tabID = _firstVisibleTab; tabID <= _lastVisibleTab; ++tabID) {
+		x -= _tabs[tabID]._tabWidth;
+		if (x < 0)
+			break;
 	}
 
+	// If a tab was clicked, switch to that pane
+	if (tabID <= _lastVisibleTab)
+		setActiveTab(tabID);
 }
 
 void TabWidget::handleMouseMoved(int x, int y, int button) {
@@ -415,6 +386,9 @@ void TabWidget::reflowLayout() {
 
 	int x = _w - _butRP - _butW * 2 - 2;
 	int y = _butTP - _tabHeight;
+	if (g_gui.useRTL()) {
+		x = x - g_gui.getOverlayOffset();
+	}
 	_navLeft->resize(x, y, _butW, _butH);
 	_navRight->resize(x + _butW + 2, y, _butW, _butH);
 }
@@ -422,13 +396,12 @@ void TabWidget::reflowLayout() {
 void TabWidget::drawWidget() {
 	Common::Array<Common::String> tabs;
 	Common::Array<int> widths;
-	if (g_gui.useRTL() && false) {		// GUI TODO: Incomplete										// Keeping this disabled means that tabs are reversed, but windows are not shown anymore.
+	if (g_gui.useRTL()) {		// GUI TODO: Incomplete										// Keeping this disabled means that tabs are reversed, but windows are not shown anymore.
 		for (int i = _firstVisibleTab; i <= _lastVisibleTab; ++i) {
 			tabs.insert_at(0, _tabs[i].title);
 			widths.insert_at(0, _tabs[i]._tabWidth);
 		}
-	}
-	else {
+	} else {
 		for (int i = _firstVisibleTab; i <= _lastVisibleTab; ++i) {
 			tabs.push_back(_tabs[i].title);
 			widths.push_back(_tabs[i]._tabWidth);
@@ -439,11 +412,19 @@ void TabWidget::drawWidget() {
 
 	g_gui.theme()->drawDialogBackground(r1, _bodyBackgroundType);
 
+	int drawTab = _activeTab - _firstVisibleTab;
 	Common::Rect r2(_x, _y, _x + _w, _y + _h);
+
 	if (g_gui.useRTL()) {
-		r2.translate(g_system->getOverlayWidth() - _x - _w, 0);
+		r2.translate(g_system->getOverlayWidth() - _x - _w + 6, 0);
+		if (_navButtonsVisible) {
+			r2.translate(_butW - 2, 0);
+		}
+
+		drawTab = _lastVisibleTab - drawTab;
 	}
-	g_gui.theme()->drawTab(r2, _tabHeight, widths, tabs, _activeTab - _firstVisibleTab);
+
+	g_gui.theme()->drawTab(r2, _tabHeight, widths, tabs, drawTab);
 }
 
 void TabWidget::draw() {


Commit: d96866511005997a7ba51a893091daadd0cedd64
    https://github.com/scummvm/scummvm/commit/d96866511005997a7ba51a893091daadd0cedd64
Author: aryanrawlani28 (aryanrawlani007 at gmail.com)
Date: 2020-06-22T00:03:02+02:00

Commit Message:
GUI: Code cleanup and small issue fixes

Changed paths:
    gui/gui-manager.cpp
    gui/options.cpp
    gui/widget.cpp
    gui/widgets/scrollcontainer.cpp


diff --git a/gui/gui-manager.cpp b/gui/gui-manager.cpp
index 5cf03ce0ac..b204172e5d 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 e19e583a06..3ec648e4a4 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 d1fea86008..55f2b43604 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 bcd2857058..35f7f346d6 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);
 }


Commit: 143b9fb13ce00cbcc329476e7e0137fcff83c28c
    https://github.com/scummvm/scummvm/commit/143b9fb13ce00cbcc329476e7e0137fcff83c28c
Author: aryanrawlani28 (aryanrawlani007 at gmail.com)
Date: 2020-06-22T00:03:02+02:00

Commit Message:
GUI: RTL: Radiobuttons and Checkboxes RTL layout

Changed paths:
    gui/ThemeEngine.cpp
    gui/ThemeEngine.h
    gui/themes/scummremastered/remastered_gfx.stx
    gui/widget.cpp


diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp
index dffb041407..b5ba735605 100644
--- a/gui/ThemeEngine.cpp
+++ b/gui/ThemeEngine.cpp
@@ -152,10 +152,19 @@ static const DrawDataInfo kDrawDataDefaults[] = {
 	{kDDCheckboxSelected,           "checkbox_selected",          kDrawLayerForeground,  kDDCheckboxDefault},
 	{kDDCheckboxDisabledSelected,   "checkbox_disabled_selected", kDrawLayerForeground,  kDDCheckboxDisabled},
 
+	{kDDCheckboxDefaultRTL,            "checkbox_default_rtl",           kDrawLayerBackground,   kDDNone},
+	{kDDCheckboxDisabledRTL,           "checkbox_disabled_rtl",          kDrawLayerBackground,   kDDNone},
+	{kDDCheckboxSelectedRTL,           "checkbox_selected_rtl",          kDrawLayerForeground,  kDDCheckboxDefaultRTL},
+	{kDDCheckboxDisabledSelectedRTL,   "checkbox_disabled_selected_rtl", kDrawLayerForeground,  kDDCheckboxDisabledRTL},
+
 	{kDDRadiobuttonDefault,         "radiobutton_default",      kDrawLayerBackground,   kDDNone},
 	{kDDRadiobuttonDisabled,        "radiobutton_disabled",     kDrawLayerBackground,   kDDNone},
 	{kDDRadiobuttonSelected,        "radiobutton_selected",     kDrawLayerForeground,  kDDRadiobuttonDefault},
 
+	{kDDRadiobuttonDefaultRTL,		"radiobutton_default_rtl",	kDrawLayerBackground,	kDDNone},
+	{kDDRadiobuttonDisabledRTL,		"radiobutton_disabled_rtl",	kDrawLayerBackground,	kDDNone},
+	{kDDRadiobuttonSelectedRTL,		"radiobutton_selected_rtl",	kDrawLayerForeground,	kDDRadiobuttonDefaultRTL},
+
 	{kDDTabActive,                  "tab_active",               kDrawLayerForeground,  kDDTabInactive},
 	{kDDTabInactive,                "tab_inactive",             kDrawLayerBackground,   kDDNone},
 	{kDDTabBackground,              "tab_background",           kDrawLayerBackground,   kDDNone},
@@ -995,59 +1004,79 @@ void ThemeEngine::drawLineSeparator(const Common::Rect &r) {
 	drawDD(kDDSeparator, r);
 }
 
-void ThemeEngine::drawCheckbox(const Common::Rect &r, const Common::String &str, bool checked, WidgetStateInfo state) {
+void ThemeEngine::drawCheckbox(const Common::Rect &r, const Common::String &str, bool checked, WidgetStateInfo state, bool rtl) {
 	if (!ready())
 		return;
 
 	Common::Rect r2 = r;
-	DrawData dd = kDDCheckboxDefault;
+	DrawData dd = rtl ? kDDCheckboxDefaultRTL : kDDCheckboxDefault;
 
 	if (checked)
-		dd = kDDCheckboxSelected;
+		dd = rtl ? kDDCheckboxSelectedRTL : kDDCheckboxSelected;
 
 	if (state == kStateDisabled)
-		dd = checked ? kDDCheckboxDisabledSelected : kDDCheckboxDisabled;
+		dd = checked ? rtl ? kDDCheckboxDisabledSelectedRTL : kDDCheckboxDisabledSelected : rtl ? kDDCheckboxDisabledRTL : kDDCheckboxDisabled;
 
 	const int checkBoxSize = MIN((int)r.height(), getFontHeight());
-
 	r2.bottom = r2.top + checkBoxSize;
-	r2.right = r2.left + checkBoxSize;
+
+	if (rtl) {
+		r2.left = r.right - checkBoxSize;
+		r2.right = r.right;
+	} else {
+		r2.right = r2.left + checkBoxSize;
+	}
 
 	drawDD(dd, r2);
 
-	r2.left = r2.right + checkBoxSize;
-	r2.right = r.right;
+	if (rtl) {
+		r2.left = r.left;
+		r2.right = r.right - (checkBoxSize * 2);
+	} else {
+		r2.left = r2.right + checkBoxSize;
+		r2.right = r.right;
+	}
 
 	if (r2.right > r2.left) {
-		drawDDText(getTextData(dd), getTextColor(dd), r2, str, true, false, _widgets[kDDCheckboxDefault]->_textAlignH,
+		drawDDText(getTextData(dd), getTextColor(dd), r2, str, true, false, _widgets[dd]->_textAlignH,
 		           _widgets[dd]->_textAlignV);
 	}
 }
 
-void ThemeEngine::drawRadiobutton(const Common::Rect &r, const Common::String &str, bool checked, WidgetStateInfo state) {
+void ThemeEngine::drawRadiobutton(const Common::Rect &r, const Common::String &str, bool checked, WidgetStateInfo state, bool rtl) {
 	if (!ready())
 		return;
 
 	Common::Rect r2 = r;
-	DrawData dd = kDDRadiobuttonDefault;
+	DrawData dd = rtl ? kDDRadiobuttonDefaultRTL : kDDRadiobuttonDefault;
 
 	if (checked)
-		dd = kDDRadiobuttonSelected;
+		dd = rtl ? kDDRadiobuttonSelectedRTL : kDDRadiobuttonSelected;
 
 	if (state == kStateDisabled)
-		dd = kDDRadiobuttonDisabled;
+		dd = rtl ? kDDRadiobuttonDisabledRTL : kDDRadiobuttonDisabled;
 
 	const int radioButtonSize = MIN((int)r.height(), getFontHeight());
-
 	r2.bottom = r2.top + radioButtonSize;
-	r2.right = r2.left + radioButtonSize;
+
+	if (rtl) {
+		r2.left = r.right - radioButtonSize;
+		r2.right = r.right;
+	} else {
+		r2.right = r2.left + radioButtonSize;
+	}
 
 	drawDD(dd, r2);
 
-	r2.left = r2.right + radioButtonSize;
-	r2.right = MAX(r2.left, r.right);
+	if (rtl) {
+		r2.left = r.left;
+		r2.right = r.right - (radioButtonSize * 2);
+	} else {
+		r2.left = r2.right + radioButtonSize;
+		r2.right = MAX(r2.left, r.right);
+	}
 
-	drawDDText(getTextData(dd), getTextColor(dd), r2, str, true, false, _widgets[kDDRadiobuttonDefault]->_textAlignH,
+	drawDDText(getTextData(dd), getTextColor(dd), r2, str, true, false, _widgets[dd]->_textAlignH,
 				_widgets[dd]->_textAlignV);
 }
 
diff --git a/gui/ThemeEngine.h b/gui/ThemeEngine.h
index 46cdbfdcdc..965af5d04f 100644
--- a/gui/ThemeEngine.h
+++ b/gui/ThemeEngine.h
@@ -102,10 +102,19 @@ enum DrawData {
 	kDDCheckboxSelected,
 	kDDCheckboxDisabledSelected,
 
+	kDDCheckboxDefaultRTL,
+	kDDCheckboxDisabledRTL,
+	kDDCheckboxSelectedRTL,
+	kDDCheckboxDisabledSelectedRTL,
+
 	kDDRadiobuttonDefault,
 	kDDRadiobuttonDisabled,
 	kDDRadiobuttonSelected,
 
+	kDDRadiobuttonDefaultRTL,
+	kDDRadiobuttonDisabledRTL,
+	kDDRadiobuttonSelectedRTL,
+
 	kDDTabActive,
 	kDDTabInactive,
 	kDDTabBackground,
@@ -422,10 +431,10 @@ public:
 	void drawSlider(const Common::Rect &r, int width, WidgetStateInfo state = kStateEnabled);
 
 	void drawCheckbox(const Common::Rect &r, const Common::String &str, bool checked,
-	                  WidgetStateInfo state = kStateEnabled);
+	                  WidgetStateInfo state = kStateEnabled, bool rtl = false);
 
 	void drawRadiobutton(const Common::Rect &r, const Common::String &str, bool checked,
-	                     WidgetStateInfo state = kStateEnabled);
+	                     WidgetStateInfo state = kStateEnabled, bool rtl = false);
 
 	void drawTab(const Common::Rect &r, int tabHeight, const Common::Array<int> &tabWidths,
 	             const Common::Array<Common::String> &tabs, int active);
diff --git a/gui/themes/scummremastered/remastered_gfx.stx b/gui/themes/scummremastered/remastered_gfx.stx
index 2aa9a28c48..6c0d7077a6 100644
--- a/gui/themes/scummremastered/remastered_gfx.stx
+++ b/gui/themes/scummremastered/remastered_gfx.stx
@@ -1264,6 +1264,16 @@
 					file = 'checkbox_disabled.bmp'
 		/>
 	</drawdata>
+	<drawdata id = 'checkbox_disabled_selected_rtl' cache = 'false'>
+		<drawstep	func = 'bitmap'
+					file = 'checkbox_disabled.bmp'
+		/>
+		<text	font = 'text_default'
+				text_color = 'color_normal_disabled'
+				vertical_align = 'top'
+				horizontal_align = 'right'
+		/>
+	</drawdata>
 
 	<!-- Disabled checkbox -->
 	<drawdata id = 'checkbox_disabled' cache = 'false'>
@@ -1276,6 +1286,16 @@
 					file = 'checkbox_empty.bmp'
 		/>
 	</drawdata>
+	<drawdata id = 'checkbox_disabled_rtl' cache = 'false'>
+		<drawstep	func = 'bitmap'
+					file = 'checkbox_empty.bmp'
+		/>
+		<text	font = 'text_default'
+				text_color = 'color_normal_disabled'
+				vertical_align = 'top'
+				horizontal_align = 'right'
+		/>
+	</drawdata>
 
 	<!-- Selected checkbox -->
 	<drawdata id = 'checkbox_selected' cache = 'false'>
@@ -1288,6 +1308,16 @@
 					file = 'checkbox.bmp'
 		/>
 	</drawdata>
+	<drawdata id = 'checkbox_selected_rtl' cache = 'false'>
+		<drawstep	func = 'bitmap'
+					file = 'checkbox.bmp'
+		/>
+		<text	font = 'text_default'
+				text_color = 'color_normal'
+				vertical_align = 'top'
+				horizontal_align = 'right'
+		/>
+	</drawdata>
 
 	<!-- Idle checkbox -->
 	<drawdata id = 'checkbox_default' cache = 'false'>
@@ -1300,6 +1330,16 @@
 					file = 'checkbox_empty.bmp'
 		/>
 	</drawdata>
+	<drawdata id = 'checkbox_default_rtl' cache = 'false'>
+		<drawstep	func = 'bitmap'
+					file = 'checkbox_empty.bmp'
+		/>
+		<text	font = 'text_default'
+				text_color = 'color_normal'
+				vertical_align = 'top'
+				horizontal_align = 'right'
+		/>
+	</drawdata>
 
 	<!-- Idle radiobutton -->
 	<drawdata id = 'radiobutton_default' cache = 'false'>
@@ -1312,6 +1352,16 @@
 					file = 'radiobutton_empty.bmp'
 		/>
 	</drawdata>
+	<drawdata id = 'radiobutton_default_rtl' cache = 'false'>
+		<drawstep	func = 'bitmap'
+					file = 'radiobutton_empty.bmp'
+		/>
+		<text	font = 'text_default'
+				text_color = 'color_normal'
+				vertical_align = 'center'
+				horizontal_align = 'right'
+		/>
+	</drawdata>
 
 	<!-- Selected radiobutton -->
 	<drawdata id = 'radiobutton_selected' cache = 'false'>
@@ -1324,6 +1374,16 @@
 					file = 'radiobutton.bmp'
 		/>
 	</drawdata>
+	<drawdata id = 'radiobutton_selected_rtl' cache = 'false'>
+		<drawstep	func = 'bitmap'
+					file = 'radiobutton.bmp'
+		/>
+		<text	font = 'text_default'
+				text_color = 'color_normal'
+				vertical_align = 'center'
+				horizontal_align = 'right'
+		/>
+	</drawdata>
 
 	<!-- Disabled radiobutton -->
 	<drawdata id = 'radiobutton_disabled' cache = 'false'>
@@ -1336,6 +1396,16 @@
 					file = 'radiobutton_empty.bmp'
 		/>
 	</drawdata>
+	<drawdata id = 'radiobutton_disabled_rtl' cache = 'false'>
+		<drawstep	func = 'bitmap'
+					file = 'radiobutton_empty.bmp'
+		/>
+		<text	font = 'text_default'
+				text_color = 'color_normal_disabled'
+				vertical_align = 'center'
+				horizontal_align = 'right'
+		/>
+	</drawdata>
 
 	<!-- Background of the list widget (the games list and the list in the choosers) -->
 	<!-- TODO: Have separate options for the games list (with gradient background) and the list in the choosers (without gradient) -->
diff --git a/gui/widget.cpp b/gui/widget.cpp
index 55f2b43604..63816e153e 100644
--- a/gui/widget.cpp
+++ b/gui/widget.cpp
@@ -649,7 +649,7 @@ void CheckboxWidget::setState(bool state) {
 }
 
 void CheckboxWidget::drawWidget() {
-	g_gui.theme()->drawCheckbox(Common::Rect(_x, _y, _x + _w, _y + _h), _label, _state, Widget::_state);
+	g_gui.theme()->drawCheckbox(Common::Rect(_x, _y, _x + _w, _y + _h), _label, _state, Widget::_state, (g_gui.useRTL() && _useRTL));
 }
 
 #pragma mark -
@@ -718,7 +718,7 @@ void RadiobuttonWidget::setState(bool state, bool setGroup) {
 }
 
 void RadiobuttonWidget::drawWidget() {
-	g_gui.theme()->drawRadiobutton(Common::Rect(_x, _y, _x + _w, _y + _h), _label, _state, Widget::_state);
+	g_gui.theme()->drawRadiobutton(Common::Rect(_x, _y, _x + _w, _y + _h), _label, _state, Widget::_state, (g_gui.useRTL() && _useRTL));
 }
 
 #pragma mark -


Commit: f55654f1bc7d914d86a2c2b55f503009b35577de
    https://github.com/scummvm/scummvm/commit/f55654f1bc7d914d86a2c2b55f503009b35577de
Author: aryanrawlani28 (aryanrawlani007 at gmail.com)
Date: 2020-06-22T00:03:02+02:00

Commit Message:
GUI: RTL: Popup RTL Layout and Correctly draw them

GUI: RTL: Correctly draw popups

Changed paths:
    gui/ThemeEngine.cpp
    gui/ThemeEngine.h
    gui/themes/scummremastered/remastered_gfx.stx
    gui/widgets/popup.cpp


diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp
index b5ba735605..a00e52a616 100644
--- a/gui/ThemeEngine.cpp
+++ b/gui/ThemeEngine.cpp
@@ -181,6 +181,10 @@ static const DrawDataInfo kDrawDataDefaults[] = {
 	{kDDPopUpHover,                 "popup_hover",      kDrawLayerForeground,  kDDPopUpIdle},
 	{kDDPopUpDisabled,              "popup_disabled",   kDrawLayerBackground,   kDDNone},
 
+	{kDDPopUpIdleRTL,				"popup_idle_rtl",		kDrawLayerBackground,   kDDNone},
+	{kDDPopUpHoverRTL,              "popup_hover_rtl",		kDrawLayerForeground,	kDDPopUpIdleRTL},
+	{kDDPopUpDisabledRTL,           "popup_disabled_rtl",   kDrawLayerBackground,   kDDNone},
+
 	{kDDCaret,                      "caret",        kDrawLayerForeground,  kDDNone},
 	{kDDSeparator,                  "separator",    kDrawLayerBackground,   kDDNone},
 };
@@ -1168,18 +1172,18 @@ void ThemeEngine::drawCaret(const Common::Rect &r, bool erase) {
 		drawDD(kDDCaret, r);
 }
 
-void ThemeEngine::drawPopUpWidget(const Common::Rect &r, const Common::String &sel, int deltax, WidgetStateInfo state) {
+void ThemeEngine::drawPopUpWidget(const Common::Rect &r, const Common::String &sel, int deltax, WidgetStateInfo state, bool rtl) {
 	if (!ready())
 		return;
 
-	DrawData dd = kDDPopUpIdle;
+	DrawData dd = rtl ? kDDPopUpIdleRTL : kDDPopUpIdle;
 
 	if (state == kStateEnabled)
-		dd = kDDPopUpIdle;
+		dd = rtl ? kDDPopUpIdleRTL : kDDPopUpIdle;
 	else if (state == kStateHighlight)
-		dd = kDDPopUpHover;
+		dd = rtl ? kDDPopUpHoverRTL : kDDPopUpHover;
 	else if (state == kStateDisabled)
-		dd = kDDPopUpDisabled;
+		dd = rtl ? kDDPopUpDisabledRTL : kDDPopUpDisabled;
 
 	drawDD(dd, r);
 
diff --git a/gui/ThemeEngine.h b/gui/ThemeEngine.h
index 965af5d04f..4cbc2b38f6 100644
--- a/gui/ThemeEngine.h
+++ b/gui/ThemeEngine.h
@@ -129,6 +129,10 @@ enum DrawData {
 	kDDPopUpHover,
 	kDDPopUpDisabled,
 
+	kDDPopUpIdleRTL,
+	kDDPopUpHoverRTL,
+	kDDPopUpDisabledRTL,
+
 	kDDCaret,
 	kDDSeparator,
 	kDrawDataMAX,
@@ -442,7 +446,7 @@ public:
 	void drawScrollbar(const Common::Rect &r, int sliderY, int sliderHeight, ScrollbarState scrollState);
 
 	void drawPopUpWidget(const Common::Rect &r, const Common::String &sel, int deltax,
-	                     WidgetStateInfo state = kStateEnabled);
+	                     WidgetStateInfo state = kStateEnabled, bool rtl = false);
 
 	void drawCaret(const Common::Rect &r, bool erase);
 
diff --git a/gui/themes/scummremastered/remastered_gfx.stx b/gui/themes/scummremastered/remastered_gfx.stx
index 6c0d7077a6..800ebea8ee 100644
--- a/gui/themes/scummremastered/remastered_gfx.stx
+++ b/gui/themes/scummremastered/remastered_gfx.stx
@@ -524,6 +524,44 @@
 				horizontal_align = 'left'
 		/>
 	</drawdata>
+	<drawdata id = 'popup_idle_rtl' cache = 'false' resolution = 'y>399'>
+		<drawstep	func = 'roundedsq'
+					radius = '5'
+					stroke = '1'
+					fg_color = 'lightgray2'
+					fill = 'background'
+					bg_color = 'dialog_background'
+					shadow = '1'
+		/>
+
+		<drawstep	func = 'triangle'
+					bg_color = 'shadowcolor'
+					fill = 'background'
+					width = '10'
+					height = '5'
+					xpos = 'left'
+					ypos = '10'
+					padding = '2, 0, 6, 0'
+					orientation = 'bottom'
+		/>
+
+		<drawstep	func = 'triangle'
+					bg_color = 'shadowcolor'
+					fill = 'background'
+					width = '10'
+					height = '5'
+					xpos = 'left'
+					ypos = '4'
+					padding = '2, 0, 6, 0'
+					orientation = 'top'
+		/>
+
+		<text	font = 'text_default'
+				text_color = 'color_normal'
+				vertical_align = 'center'
+				horizontal_align = 'right'
+		/>
+	</drawdata>
 
 	<drawdata id = 'popup_idle' cache = 'false' resolution ='y<400'>
 		<drawstep	func = 'roundedsq'
@@ -603,6 +641,44 @@
 				horizontal_align = 'left'
 		/>
 	</drawdata>
+	<drawdata id = 'popup_disabled_rtl' cache = 'false' resolution = 'y>399'>
+		<drawstep	func = 'roundedsq'
+					stroke = '1'
+					fg_color = 'lightgray'
+					radius = '5'
+					fill = 'gradient'
+					gradient_start = 'dialog_background'
+					gradient_end = 'dialog_background'
+					shadow = '0'
+		/>
+		<drawstep	func = 'triangle'
+					bg_color = 'shadowcolor'
+					fill = 'background'
+					width = '10'
+					height = '5'
+					xpos = 'left'
+					ypos = '10'
+					padding = '2, 0, 6, 0'
+					orientation = 'bottom'
+		/>
+
+		<drawstep	func = 'triangle'
+					bg_color = 'shadowcolor'
+					fill = 'background'
+					width = '10'
+					height = '5'
+					xpos = 'left'
+					ypos = '4'
+					padding = '2, 0, 6, 0'
+					orientation = 'top'
+		/>
+
+		<text	font = 'text_default'
+				text_color = 'color_normal_disabled'
+				vertical_align = 'center'
+				horizontal_align = 'right'
+		/>
+	</drawdata>
 
 	<drawdata id = 'popup_disabled' cache = 'false' resolution = 'y<400'>
 		<drawstep	func = 'roundedsq'
@@ -682,6 +758,44 @@
 				horizontal_align = 'left'
 		/>
 	</drawdata>
+	<drawdata id = 'popup_hover_rtl' cache = 'false' resolution = 'y>399'>
+		<drawstep	func = 'roundedsq'
+					stroke = '1'
+					fg_color = 'lightgray'
+					radius = '5'
+					fill = 'gradient'
+					gradient_start = 'dialog_background'
+					gradient_end = 'dialog_background'
+					shadow = '0'
+		/>
+		<drawstep	func = 'triangle'
+					bg_color = 'shadowcolor'
+					fill = 'background'
+					width = '10'
+					height = '5'
+					xpos = 'left'
+					ypos = '10'
+					padding = '2, 0, 6, 0'
+					orientation = 'bottom'
+		/>
+
+		<drawstep	func = 'triangle'
+					bg_color = 'shadowcolor'
+					fill = 'background'
+					width = '10'
+					height = '5'
+					xpos = 'left'
+					ypos = '4'
+					padding = '2, 0, 6, 0'
+					orientation = 'top'
+		/>
+
+		<text	font = 'text_default'
+				text_color = 'color_normal_hover'
+				vertical_align = 'center'
+				horizontal_align = 'right'
+		/>
+	</drawdata>
 
 	<drawdata id = 'popup_hover' cache = 'false' resolution = 'y<400'>
 		<drawstep	func = 'roundedsq'
diff --git a/gui/widgets/popup.cpp b/gui/widgets/popup.cpp
index 018d57e328..bebbf171bd 100644
--- a/gui/widgets/popup.cpp
+++ b/gui/widgets/popup.cpp
@@ -528,10 +528,7 @@ void PopUpWidget::drawWidget() {
 	if (_selectedItem >= 0)
 		sel = _entries[_selectedItem].name;
 
-	if (g_gui.useRTL())
-		_x = g_system->getOverlayWidth() - _x - _w;
-
-	g_gui.theme()->drawPopUpWidget(Common::Rect(_x, _y, _x + _w, _y + _h), sel, _leftPadding, _state);
+	g_gui.theme()->drawPopUpWidget(Common::Rect(_x, _y, _x + _w, _y + _h), sel, _leftPadding, _state, (g_gui.useRTL() && _useRTL));
 }
 
 } // End of namespace GUI


Commit: f3e4e3e0091205f7cf29c6972c5ed14d3d5c83a7
    https://github.com/scummvm/scummvm/commit/f3e4e3e0091205f7cf29c6972c5ed14d3d5c83a7
Author: aryanrawlani28 (aryanrawlani007 at gmail.com)
Date: 2020-06-22T00:03:02+02:00

Commit Message:
GUI: Code & comment cleanup, fix review issues

Changed paths:
    gui/editgamedialog.cpp
    gui/options.cpp
    gui/widget.cpp
    gui/widgets/popup.cpp
    gui/widgets/tab.cpp
    gui/widgets/tab.h


diff --git a/gui/editgamedialog.cpp b/gui/editgamedialog.cpp
index edcced08c5..75133011f1 100644
--- a/gui/editgamedialog.cpp
+++ b/gui/editgamedialog.cpp
@@ -342,15 +342,9 @@ EditGameDialog::EditGameDialog(const String &domain)
 		}
 	}
 
-	if (g_gui.useRTL() && false) {		// GUI TODO: Incomplete
-		// Activate the last tab - that is, the first tab for RTL users.
-		// tab->reverseTabs(); (Untested)
-		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/options.cpp b/gui/options.cpp
index 3ec648e4a4..d3ff5ae0cd 100644
--- a/gui/options.cpp
+++ b/gui/options.cpp
@@ -2911,7 +2911,7 @@ void GlobalOptionsDialog::shiftWidget(Widget *widget, const char *widgetName, in
 	if (!g_gui.xmlEval()->getWidgetData(widgetName, x, y, w, h))
 		warning("%s's position is undefined", widgetName);
 
-	// GUI TODO: I'm not sure what's this being used for?
+	// GUI TODO: I'm not sure what's this being used for. Will this be useful when using navbars?
 	if (g_gui.useRTL())
 		x = g_system->getOverlayWidth() - x - w;
 
diff --git a/gui/widget.cpp b/gui/widget.cpp
index 63816e153e..086c048d2c 100644
--- a/gui/widget.cpp
+++ b/gui/widget.cpp
@@ -56,7 +56,7 @@ void Widget::init() {
 	_needsRedraw = true;
 
 	if (TransMan.getCurrentLanguage() == "C") {		// GUI TODO: Switch to native RTL languages after testing, also
-		_useRTL = true;								//			 Widgets will get _useRTL true or not from the XML parser. Look into this after the main GUI flipping.
+		_useRTL = true;								//			 Widgets will get _useRTL true or not from the XML parser.
 	}
 }
 
@@ -304,7 +304,7 @@ StaticTextWidget::StaticTextWidget(GuiObject *boss, const Common::String &name,
 	_label = text;
 
 	_align = g_gui.xmlEval()->getWidgetTextHAlign(name);
-	if (g_gui.useRTL()) {
+	if (g_gui.useRTL() && _useRTL) {
 		if (_align == Graphics::kTextAlignLeft) {
 			_align = Graphics::kTextAlignRight;
 		} else if (_align == Graphics::kTextAlignRight) {
@@ -789,8 +789,7 @@ void SliderWidget::drawWidget() {
 	Common::Rect r1(_x, _y, _x + _w, _y + _h);
 
 	if (g_gui.useRTL() && _useRTL) {
-		// GUI TODO: This currently draws the numbers okay (Rightmost is 0, left goes high value), but renders incorrectly.
-		//	     Most likely, I'll draw ::Rect(_x + _w, _y, _x, _y + _h...) but I'll leave it for now, will do it when I flip individual widgets.
+		// GUI TODO: This currently draws the numbers okay (Rightmost is 0, left goes high value), but renders incorrectly (colors should be inverted).
 		g_gui.theme()->drawSlider(r1, valueToBarWidth(getMaxValue() - _value), _state);
 	}
 	else {
diff --git a/gui/widgets/popup.cpp b/gui/widgets/popup.cpp
index bebbf171bd..c2a777ce9c 100644
--- a/gui/widgets/popup.cpp
+++ b/gui/widgets/popup.cpp
@@ -300,8 +300,8 @@ void PopUpDialog::clearEntries() {
 
 int PopUpDialog::findItem(int x, int y) const {
 	if (x >= 0 && x < _w && y >= 0 && y < _h) {
-		if (_twoColumns) {							// GUI TODO: Problems with collisions in 2 coloums.
-			uint entry = (y - 2) / _lineHeight;
+		if (_twoColumns) {							// GUI TODO: Problems with collisions in 2 coloumns.
+			uint entry = (y - 2) / _lineHeight;		//			 GUI Language in Options uses this. Basically, left coloumn highlights right and vice versa.
 			if (x > _w / 2) {
 				entry += _entriesPerColumn;
 
diff --git a/gui/widgets/tab.cpp b/gui/widgets/tab.cpp
index 6638966732..f5ba7e251a 100644
--- a/gui/widgets/tab.cpp
+++ b/gui/widgets/tab.cpp
@@ -303,25 +303,6 @@ void TabWidget::setFirstVisible(int tabID, bool adjustIfRoom) {
 	g_gui.scheduleTopDialogRedraw(); // TODO: Necessary?
 }
 
-int TabWidget::getTabsSize() {
-	return _tabs.size();
-}
-
-void TabWidget::reverseTabs() {	// GUI TODO: Incomplete, will this be necessary for working on reversing the tabs?
-	TabList _tabDups;
-	const int tSize = _tabs.size();
-
-	for (uint i = 0; i < tSize; ++i) {
-		//_tabDups.insert_at(0, _tabs[i]);
-		_tabDups.push_back(_tabs.back());
-		_tabs.pop_back();
-	}
-
-	for (uint i = 0; i < _tabDups.size(); ++i) {
-		_tabs.push_back(_tabDups[i]);
-	}
-}
-
 void TabWidget::reflowLayout() {
 	Widget::reflowLayout();
 
@@ -396,7 +377,7 @@ void TabWidget::reflowLayout() {
 void TabWidget::drawWidget() {
 	Common::Array<Common::String> tabs;
 	Common::Array<int> widths;
-	if (g_gui.useRTL()) {		// GUI TODO: Incomplete										// Keeping this disabled means that tabs are reversed, but windows are not shown anymore.
+	if (g_gui.useRTL()) {
 		for (int i = _firstVisibleTab; i <= _lastVisibleTab; ++i) {
 			tabs.insert_at(0, _tabs[i].title);
 			widths.insert_at(0, _tabs[i]._tabWidth);
diff --git a/gui/widgets/tab.h b/gui/widgets/tab.h
index 564b8c4d91..d7f75bd460 100644
--- a/gui/widgets/tab.h
+++ b/gui/widgets/tab.h
@@ -111,9 +111,6 @@ public:
 	virtual int getFirstVisible() const;
 	virtual void setFirstVisible(int tabID, bool adjustIfRoom = false);
 
-	int getTabsSize();
-	void reverseTabs();
-
 	bool containsWidget(Widget *) const override;
 
 	void reflowLayout() override;


Commit: 5d8f6a228191c56649b9747f3635196ff2672d8f
    https://github.com/scummvm/scummvm/commit/5d8f6a228191c56649b9747f3635196ff2672d8f
Author: aryanrawlani28 (aryanrawlani007 at gmail.com)
Date: 2020-06-22T00:03:02+02:00

Commit Message:
GUI: RTL: Rebuild theme packages for supporting RTL

Changed paths:
    gui/themes/scummclassic.zip
    gui/themes/scummmodern.zip
    gui/themes/scummremastered.zip


diff --git a/gui/themes/scummclassic.zip b/gui/themes/scummclassic.zip
index 3a3b09ba6d..e70c4c3818 100644
Binary files a/gui/themes/scummclassic.zip and b/gui/themes/scummclassic.zip differ
diff --git a/gui/themes/scummmodern.zip b/gui/themes/scummmodern.zip
index 11356602da..51150a3c29 100644
Binary files a/gui/themes/scummmodern.zip and b/gui/themes/scummmodern.zip differ
diff --git a/gui/themes/scummremastered.zip b/gui/themes/scummremastered.zip
index 26c3b73d45..e911233703 100644
Binary files a/gui/themes/scummremastered.zip and b/gui/themes/scummremastered.zip differ


Commit: ab4ac760fb20d05c2961726d4d6d1b26d2035d2d
    https://github.com/scummvm/scummvm/commit/ab4ac760fb20d05c2961726d4d6d1b26d2035d2d
Author: aryanrawlani28 (aryanrawlani007 at gmail.com)
Date: 2020-06-22T00:03:02+02:00

Commit Message:
GUI: RTL: Disable usage of RTL layout by default

Changed paths:
    gui/gui-manager.cpp
    gui/widget.cpp


diff --git a/gui/gui-manager.cpp b/gui/gui-manager.cpp
index b204172e5d..c9b3c73981 100644
--- a/gui/gui-manager.cpp
+++ b/gui/gui-manager.cpp
@@ -81,7 +81,7 @@ GuiManager::GuiManager() : _redrawStatus(kRedrawDisabled), _stateIsSaved(false),
 #ifdef USE_TRANSLATION
 	// Enable translation
 	TransMan.setLanguage(ConfMan.get("gui_language").c_str());
-	if (TransMan.getCurrentLanguage() == "C") {		// GUI TODO: Change after testing.
+	if (TransMan.getCurrentLanguage() == "C" && false) {		// GUI TODO: Change this to enable RTL
 		_useRTL = true;
 	}
 #endif // USE_TRANSLATION
diff --git a/gui/widget.cpp b/gui/widget.cpp
index 086c048d2c..a02c846ec9 100644
--- a/gui/widget.cpp
+++ b/gui/widget.cpp
@@ -55,8 +55,8 @@ void Widget::init() {
 	_boss->_firstWidget = this;
 	_needsRedraw = true;
 
-	if (TransMan.getCurrentLanguage() == "C") {		// GUI TODO: Switch to native RTL languages after testing, also
-		_useRTL = true;								//			 Widgets will get _useRTL true or not from the XML parser.
+	if (TransMan.getCurrentLanguage() == "C" && false) {		// GUI TODO: Change this and GuiManager::GuiManager() to use RTL.
+		_useRTL = true;											// GUI TODO: Widgets will get _useRTL true or not from the XML parser.
 	}
 }
 


Commit: 7e27af8148f8d974aa706193548b2030ea73a382
    https://github.com/scummvm/scummvm/commit/7e27af8148f8d974aa706193548b2030ea73a382
Author: aryanrawlani28 (aryanrawlani007 at gmail.com)
Date: 2020-06-22T00:03:02+02:00

Commit Message:
GUI: Code cleanup

Changed paths:
    gui/editgamedialog.cpp
    gui/widget.cpp
    gui/widgets/popup.cpp
    gui/widgets/scrollcontainer.cpp
    gui/widgets/tab.cpp


diff --git a/gui/editgamedialog.cpp b/gui/editgamedialog.cpp
index 75133011f1..b3ee5509b1 100644
--- a/gui/editgamedialog.cpp
+++ b/gui/editgamedialog.cpp
@@ -344,7 +344,6 @@ EditGameDialog::EditGameDialog(const String &domain)
 
 	// Activate the first tab
 	tab->setActiveTab(0);
-
 	_tabWidget = tab;
 
 	// Add OK & Cancel buttons
diff --git a/gui/widget.cpp b/gui/widget.cpp
index a02c846ec9..01183f9950 100644
--- a/gui/widget.cpp
+++ b/gui/widget.cpp
@@ -527,7 +527,7 @@ void DropdownButtonWidget::clearEntries() {
 }
 
 void DropdownButtonWidget::drawWidget() {
-	if (_entries.empty()) {							
+	if (_entries.empty()) {
 		// Degrade to a regular button
 		g_gui.theme()->drawButton(Common::Rect(_x, _y, _x + _w, _y + _h), _label, _state);
 	} else {
@@ -613,7 +613,7 @@ void PicButtonWidget::drawWidget() {
 
 		const int x = _x + (_w - gfx->w) / 2;
 		const int y = _y + (_h - gfx->h) / 2;
-	
+
 		g_gui.theme()->drawSurface(Common::Point(x, y), *gfx, _transparency);
 	}
 }
@@ -791,8 +791,7 @@ void SliderWidget::drawWidget() {
 	if (g_gui.useRTL() && _useRTL) {
 		// GUI TODO: This currently draws the numbers okay (Rightmost is 0, left goes high value), but renders incorrectly (colors should be inverted).
 		g_gui.theme()->drawSlider(r1, valueToBarWidth(getMaxValue() - _value), _state);
-	}
-	else {
+	} else {
 		g_gui.theme()->drawSlider(r1, valueToBarWidth(_value), _state);
 	}
 }
@@ -867,7 +866,7 @@ void GraphicsWidget::drawWidget() {
 
 		const int x = _x + (_w - _gfx.w) / 2;
 		const int y = _y + (_h - _gfx.h) / 2;
-		
+
 		g_gui.theme()->drawSurface(Common::Point(x, y), _gfx, _transparency);
 	}
 }
diff --git a/gui/widgets/popup.cpp b/gui/widgets/popup.cpp
index c2a777ce9c..04b19f10ef 100644
--- a/gui/widgets/popup.cpp
+++ b/gui/widgets/popup.cpp
@@ -396,7 +396,7 @@ void PopUpDialog::drawMenuEntry(int entry, bool hilite) {
 
 	Common::Rect r1(x, y, x + w, y + _lineHeight);
 	Common::Rect r2(x + 1, y + 2, x + w, y + 2 + _lineHeight);
-	Graphics::TextAlign alignment = Graphics::TextAlign::kTextAlignLeft;
+	Graphics::TextAlign alignment = Graphics::kTextAlignLeft;
 
 	if (g_gui.useRTL()) {
 		r2.translate(-g_gui.getOverlayOffset(), 0);
diff --git a/gui/widgets/scrollcontainer.cpp b/gui/widgets/scrollcontainer.cpp
index 35f7f346d6..ac79f844f9 100644
--- a/gui/widgets/scrollcontainer.cpp
+++ b/gui/widgets/scrollcontainer.cpp
@@ -141,13 +141,6 @@ void ScrollContainerWidget::reflowLayout() {
 }
 
 void ScrollContainerWidget::drawWidget() {
-	// GUI TODO: Recheck what the below line does.
-	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);
 }
 
diff --git a/gui/widgets/tab.cpp b/gui/widgets/tab.cpp
index f5ba7e251a..9db934ef91 100644
--- a/gui/widgets/tab.cpp
+++ b/gui/widgets/tab.cpp
@@ -70,14 +70,17 @@ void TabWidget::init() {
 	int x = _w - _butRP - _butW * 2 - 2;
 	int y = _butTP - _tabHeight;
 
+	String leftArrow = "<";
+	String rightArrow = ">";
+
 	if (g_gui.useRTL()) {							// GUI TODO: Incomplete and possibly incorrect too. Unusable atm.
-		_navLeft = new ButtonWidget(this, x, y, _butW, _butH, ">", nullptr, kCmdLeft);
-		_navRight = new ButtonWidget(this, x + _butW + 2, y, _butW, _butH, "<", nullptr, kCmdRight);
+		_navLeft = new ButtonWidget(this, x, y, _butW, _butH, rightArrow, nullptr, kCmdLeft);
+		_navRight = new ButtonWidget(this, x + _butW + 2, y, _butW, _butH, leftArrow, nullptr, kCmdRight);
 		_navLeft->setEnabled(true);
 		_navRight->setEnabled(false);
 	} else {
-		_navLeft = new ButtonWidget(this, x, y, _butW, _butH, "<", nullptr, kCmdLeft);
-		_navRight = new ButtonWidget(this, x + _butW + 2, y, _butW, _butH, ">", nullptr, kCmdRight);
+		_navLeft = new ButtonWidget(this, x, y, _butW, _butH, leftArrow, nullptr, kCmdLeft);
+		_navRight = new ButtonWidget(this, x + _butW + 2, y, _butW, _butH, rightArrow, nullptr, kCmdRight);
 		_navLeft->setEnabled(false);
 		_navRight->setEnabled(true);
 	}
@@ -129,6 +132,7 @@ int TabWidget::addTab(const String &title, const String &dialogName) {
 	newTab._tabWidth = newWidth;
 
 	_tabs.push_back(newTab);
+
 	int numTabs = _tabs.size();
 
 	// Activate the new tab


Commit: 50aa421bf3e696cd8d0deedd31fe1449d1fb7464
    https://github.com/scummvm/scummvm/commit/50aa421bf3e696cd8d0deedd31fe1449d1fb7464
Author: aryanrawlani28 (aryanrawlani007 at gmail.com)
Date: 2020-06-22T00:03:02+02:00

Commit Message:
GUI: RTL: Fix display issues with some widgets

- Fix missing DD for disabled dropdownbutton
- Fix scrollbar drawing issue
- Fix eating last chars in popup
- Fix tooltip alignment

Changed paths:
    gui/ThemeEngine.cpp
    gui/ThemeEngine.h
    gui/Tooltip.cpp
    gui/options.cpp
    gui/widgets/popup.cpp


diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp
index a00e52a616..b668ec942e 100644
--- a/gui/ThemeEngine.cpp
+++ b/gui/ThemeEngine.cpp
@@ -140,6 +140,7 @@ static const DrawDataInfo kDrawDataDefaults[] = {
 	{kDDDropDownButtonIdleRTL,			"dropdown_button_idle_rtl",				kDrawLayerBackground, kDDNone},
 	{kDDDropDownButtonHoverLeftRTL,		"dropdown_button_hover_left_rtl",		kDrawLayerForeground, kDDDropDownButtonIdleRTL},
 	{kDDDropDownButtonHoverRightRTL,	"dropdown_button_hover_right_rtl",		kDrawLayerForeground, kDDDropDownButtonIdleRTL},
+	{kDDDropDownButtonDisabledRTL,		"dropdown_button_disabled_rtl",			kDrawLayerForeground, kDDNone},
 	{kDDDropDownButtonPressedLeftRTL,	"dropdown_button_pressed_left_rtl",		kDrawLayerForeground, kDDDropDownButtonIdleRTL},
 	{kDDDropDownButtonPressedRightRTL,	"dropdown_button_pressed_right_rtl",	kDrawLayerForeground, kDDDropDownButtonIdleRTL},
 
@@ -983,7 +984,7 @@ void ThemeEngine::drawDropDownButton(const Common::Rect &r, uint32 dropdownWidth
 	else if (buttonState == kStateHighlight && inDropdown)
 		dd = rtl ? kDDDropDownButtonHoverRightRTL : kDDDropDownButtonHoverRight;
 	else if (buttonState == kStateDisabled)
-		dd = kDDDropDownButtonDisabled;
+		dd = rtl ? kDDDropDownButtonDisabledRTL : kDDDropDownButtonDisabled;
 	else if (buttonState == kStatePressed && inButton)
 		dd = rtl ? kDDDropDownButtonPressedLeftRTL : kDDDropDownButtonPressedLeft;
 	else if (buttonState == kStatePressed && inDropdown)
diff --git a/gui/ThemeEngine.h b/gui/ThemeEngine.h
index 4cbc2b38f6..ad5344937a 100644
--- a/gui/ThemeEngine.h
+++ b/gui/ThemeEngine.h
@@ -90,6 +90,7 @@ enum DrawData {
 	kDDDropDownButtonIdleRTL,
 	kDDDropDownButtonHoverLeftRTL,
 	kDDDropDownButtonHoverRightRTL,
+	kDDDropDownButtonDisabledRTL,
 	kDDDropDownButtonPressedLeftRTL,
 	kDDDropDownButtonPressedRightRTL,
 
diff --git a/gui/Tooltip.cpp b/gui/Tooltip.cpp
index c348ca816f..5e40e59eb8 100644
--- a/gui/Tooltip.cpp
+++ b/gui/Tooltip.cpp
@@ -78,7 +78,7 @@ void Tooltip::drawDialog(DrawLayer layerToDraw) {
 	int16 textX = g_gui.useRTL() ? _x - 3 : _x + 3; // including 2px padding and 1px original code shift
 	int16 textY = _y + 3;
 
-	Graphics::TextAlign textAlignment = g_gui.useRTL() ? Graphics::kTextAlignRight : Graphics::kTextAlignRight;
+	Graphics::TextAlign textAlignment = g_gui.useRTL() ? Graphics::kTextAlignRight : Graphics::kTextAlignLeft;
 
 	for (Common::StringArray::const_iterator i = _wrappedLines.begin(); i != _wrappedLines.end(); ++i, ++num) {
 		g_gui.theme()->drawText(
diff --git a/gui/options.cpp b/gui/options.cpp
index d3ff5ae0cd..80ff122524 100644
--- a/gui/options.cpp
+++ b/gui/options.cpp
@@ -147,7 +147,10 @@ OptionsDialog::OptionsDialog(const Common::String &domain, const Common::String
 
 OptionsDialog::~OptionsDialog() {
 	delete _subToggleGroup;
-	g_gui.setDialogPaddings(0, 0);
+	if (g_gui.useRTL()) {
+		g_gui.setDialogPaddings(0, 0);
+		g_gui.scheduleTopDialogRedraw();
+	}
 }
 
 void OptionsDialog::init() {
diff --git a/gui/widgets/popup.cpp b/gui/widgets/popup.cpp
index 04b19f10ef..8dfa4d6ab3 100644
--- a/gui/widgets/popup.cpp
+++ b/gui/widgets/popup.cpp
@@ -528,6 +528,9 @@ void PopUpWidget::drawWidget() {
 	if (_selectedItem >= 0)
 		sel = _entries[_selectedItem].name;
 
+	if (g_gui.useRTL() && _useRTL)
+		_leftPadding = 0;
+
 	g_gui.theme()->drawPopUpWidget(Common::Rect(_x, _y, _x + _w, _y + _h), sel, _leftPadding, _state, (g_gui.useRTL() && _useRTL));
 }
 


Commit: 4699880c99dc14cb39a553b36953877bc4b312a3
    https://github.com/scummvm/scummvm/commit/4699880c99dc14cb39a553b36953877bc4b312a3
Author: aryanrawlani28 (aryanrawlani007 at gmail.com)
Date: 2020-06-22T00:03:02+02:00

Commit Message:
GUI: RTL: Support internal flipping of Sliders

Changed paths:
    gui/ThemeEngine.cpp
    gui/ThemeEngine.h
    gui/widget.cpp


diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp
index b668ec942e..818adb7de7 100644
--- a/gui/ThemeEngine.cpp
+++ b/gui/ThemeEngine.cpp
@@ -1085,7 +1085,7 @@ void ThemeEngine::drawRadiobutton(const Common::Rect &r, const Common::String &s
 				_widgets[dd]->_textAlignV);
 }
 
-void ThemeEngine::drawSlider(const Common::Rect &r, int width, WidgetStateInfo state) {
+void ThemeEngine::drawSlider(const Common::Rect &r, int width, WidgetStateInfo state, bool rtl) {
 	if (!ready())
 		return;
 
@@ -1100,6 +1100,11 @@ void ThemeEngine::drawSlider(const Common::Rect &r, int width, WidgetStateInfo s
 	r2.setWidth(MIN((int16)width, r.width()));
 	//	r2.top++; r2.bottom--; r2.left++; r2.right--;
 
+	if (rtl) {
+		r2.left = r.right - r2.width();
+		r2.right = r.right;
+	}
+
 	drawWidgetBackground(r, kWidgetBackgroundSlider);
 
 	drawDD(dd, r2);
diff --git a/gui/ThemeEngine.h b/gui/ThemeEngine.h
index ad5344937a..48f9452054 100644
--- a/gui/ThemeEngine.h
+++ b/gui/ThemeEngine.h
@@ -433,7 +433,7 @@ public:
 
 	void drawSurface(const Common::Point &p, const Graphics::Surface &surface, bool themeTrans = false);
 
-	void drawSlider(const Common::Rect &r, int width, WidgetStateInfo state = kStateEnabled);
+	void drawSlider(const Common::Rect &r, int width, WidgetStateInfo state = kStateEnabled, bool rtl = false);
 
 	void drawCheckbox(const Common::Rect &r, const Common::String &str, bool checked,
 	                  WidgetStateInfo state = kStateEnabled, bool rtl = false);
diff --git a/gui/widget.cpp b/gui/widget.cpp
index 01183f9950..7e601218c4 100644
--- a/gui/widget.cpp
+++ b/gui/widget.cpp
@@ -787,13 +787,7 @@ void SliderWidget::handleMouseWheel(int x, int y, int direction) {
 
 void SliderWidget::drawWidget() {
 	Common::Rect r1(_x, _y, _x + _w, _y + _h);
-
-	if (g_gui.useRTL() && _useRTL) {
-		// GUI TODO: This currently draws the numbers okay (Rightmost is 0, left goes high value), but renders incorrectly (colors should be inverted).
-		g_gui.theme()->drawSlider(r1, valueToBarWidth(getMaxValue() - _value), _state);
-	} else {
-		g_gui.theme()->drawSlider(r1, valueToBarWidth(_value), _state);
-	}
+	g_gui.theme()->drawSlider(r1, valueToBarWidth(_value), _state, (g_gui.useRTL() && _useRTL));
 }
 
 int SliderWidget::valueToBarWidth(int value) {


Commit: 58704be218ac8d1e0de0ef49dafa7bfa6826f556
    https://github.com/scummvm/scummvm/commit/58704be218ac8d1e0de0ef49dafa7bfa6826f556
Author: aryanrawlani28 (aryanrawlani007 at gmail.com)
Date: 2020-06-22T00:03:02+02:00

Commit Message:
GUI: RTL: Correctly draw tabs, consistent among screen sizes and different themes

GUI: RTL: Correctly draw theme-browser

Changed paths:
    gui/ThemeLayout.cpp
    gui/widget.cpp
    gui/widgets/tab.cpp
    gui/widgets/tab.h


diff --git a/gui/ThemeLayout.cpp b/gui/ThemeLayout.cpp
index 7616212255..e703fd1d15 100644
--- a/gui/ThemeLayout.cpp
+++ b/gui/ThemeLayout.cpp
@@ -243,7 +243,7 @@ void ThemeLayoutMain::reflowLayout(Widget *widgetChain) {
 	}
 
 	if (g_gui.useRTL()) {
-		if (this->_name == "GameOptions" || this->_name == "GlobalOptions") {
+		if (this->_name == "GameOptions" || this->_name == "GlobalOptions" || this->_name == "Browser") {
 			int oldX = _x;
 			_x = g_system->getOverlayWidth() - _w - _x;
 			g_gui.setDialogPaddings(oldX, _x);
diff --git a/gui/widget.cpp b/gui/widget.cpp
index 7e601218c4..d393f40b4c 100644
--- a/gui/widget.cpp
+++ b/gui/widget.cpp
@@ -118,9 +118,7 @@ void Widget::draw() {
 		if (g_gui.useRTL()) {
 			_x = g_system->getOverlayWidth() - _x - _w;
 
-			// Can i use something better below instead of hardcoding the values?
-			
-			if (this->_name.contains("GameOptions") || this->_name.contains("GlobalOptions")){
+			if (this->_name.contains("GameOptions") || this->_name.contains("GlobalOptions") || this->_name.contains("Browser")){
 				_x = _x + g_gui.getOverlayOffset();
 			}
 		}
diff --git a/gui/widgets/tab.cpp b/gui/widgets/tab.cpp
index 9db934ef91..0decbc3e03 100644
--- a/gui/widgets/tab.cpp
+++ b/gui/widgets/tab.cpp
@@ -86,6 +86,7 @@ void TabWidget::init() {
 	}
 
 	_lastRead = -1;
+	_widthTillLastTab = 0;
 }
 
 TabWidget::~TabWidget() {
@@ -130,6 +131,7 @@ int TabWidget::addTab(const String &title, const String &dialogName) {
 	if (newWidth < _minTabWidth)
 		newWidth = _minTabWidth;
 	newTab._tabWidth = newWidth;
+	_widthTillLastTab += newWidth;
 
 	_tabs.push_back(newTab);
 
@@ -401,9 +403,14 @@ void TabWidget::drawWidget() {
 	Common::Rect r2(_x, _y, _x + _w, _y + _h);
 
 	if (g_gui.useRTL()) {
-		r2.translate(g_system->getOverlayWidth() - _x - _w + 6, 0);
+		int pad = this->getWidth() - (_x + _widthTillLastTab) + g_gui.getOverlayOffset();
+		if (pad < 0) {
+			pad = 6;
+		}
+
+		r2.translate(g_system->getOverlayWidth() - _x - _w + pad, 0);
 		if (_navButtonsVisible) {
-			r2.translate(_butW - 2, 0);
+			r2.translate(_butW - 6, 0);
 		}
 
 		drawTab = _lastVisibleTab - drawTab;
diff --git a/gui/widgets/tab.h b/gui/widgets/tab.h
index d7f75bd460..b5e8806a46 100644
--- a/gui/widgets/tab.h
+++ b/gui/widgets/tab.h
@@ -51,6 +51,7 @@ protected:
 	TabList _tabs;
 	int _tabHeight;
 	int _minTabWidth;
+	int _widthTillLastTab;
 
 	int _bodyRP, _bodyTP, _bodyLP, _bodyBP;
 	ThemeEngine::DialogBackground _bodyBackgroundType;


Commit: 07ab77d0654d2c9fa4b8147d9da49cc257c1c78c
    https://github.com/scummvm/scummvm/commit/07ab77d0654d2c9fa4b8147d9da49cc257c1c78c
Author: aryanrawlani28 (aryanrawlani007 at gmail.com)
Date: 2020-06-22T00:03:02+02:00

Commit Message:
GUI: RTL: Get internal widget RTL flag from theme

Changed paths:
    engines/scumm/dialogs.cpp
    gui/ThemeEval.cpp
    gui/ThemeEval.h
    gui/ThemeLayout.cpp
    gui/ThemeLayout.h
    gui/ThemeParser.cpp
    gui/object.cpp
    gui/object.h
    gui/options.cpp
    gui/saveload-dialog.cpp
    gui/widget.cpp
    gui/widget.h


diff --git a/engines/scumm/dialogs.cpp b/engines/scumm/dialogs.cpp
index 14bf29e1f2..20f63ce7b9 100644
--- a/engines/scumm/dialogs.cpp
+++ b/engines/scumm/dialogs.cpp
@@ -309,7 +309,7 @@ void HelpDialog::reflowLayout() {
 
 	assert(lineHeight);
 
-	g_gui.xmlEval()->getWidgetData("ScummHelp.HelpText", x, y, w, h);
+	g_gui.xmlEval()->getWidgetData("ScummHelp.HelpText", x, y, w, h, _useRTL);
 
 	// Make sure than we don't have more lines than what we can fit
 	// on the space that the layout reserves for text
diff --git a/gui/ThemeEval.cpp b/gui/ThemeEval.cpp
index 338e8d315e..ceecb14303 100644
--- a/gui/ThemeEval.cpp
+++ b/gui/ThemeEval.cpp
@@ -50,7 +50,7 @@ void ThemeEval::reset() {
 	_layouts.clear();
 }
 
-bool ThemeEval::getWidgetData(const Common::String &widget, int16 &x, int16 &y, int16 &w, int16 &h) {
+bool ThemeEval::getWidgetData(const Common::String &widget, int16 &x, int16 &y, int16 &w, int16 &h, bool &useRTL) {
 	Common::StringTokenizer tokenizer(widget, ".");
 
 	if (widget.hasPrefix("Dialog."))
@@ -62,7 +62,7 @@ bool ThemeEval::getWidgetData(const Common::String &widget, int16 &x, int16 &y,
 	if (!_layouts.contains(dialogName))
 		return false;
 
-	return _layouts[dialogName]->getWidgetData(widgetName, x, y, w, h);
+	return _layouts[dialogName]->getWidgetData(widgetName, x, y, w, h, useRTL);
 }
 
 Graphics::TextAlign ThemeEval::getWidgetTextHAlign(const Common::String &widget) {
@@ -80,7 +80,7 @@ Graphics::TextAlign ThemeEval::getWidgetTextHAlign(const Common::String &widget)
 	return _layouts[dialogName]->getWidgetTextHAlign(widgetName);
 }
 
-ThemeEval &ThemeEval::addWidget(const Common::String &name, const Common::String &type, int w, int h, Graphics::TextAlign align) {
+ThemeEval &ThemeEval::addWidget(const Common::String &name, const Common::String &type, int w, int h, Graphics::TextAlign align, bool useRTL) {
 	int typeW = -1;
 	int typeH = -1;
 	Graphics::TextAlign typeAlign = Graphics::kTextAlignInvalid;
@@ -102,7 +102,8 @@ ThemeEval &ThemeEval::addWidget(const Common::String &name, const Common::String
 		widget = new ThemeLayoutWidget(_curLayout.top(), name,
 									typeW == -1 ? w : typeW,
 									typeH == -1 ? h : typeH,
-									typeAlign == Graphics::kTextAlignInvalid ? align : typeAlign);
+									typeAlign == Graphics::kTextAlignInvalid ? align : typeAlign,
+									useRTL);
 
 	_curLayout.top()->addChild(widget);
 
diff --git a/gui/ThemeEval.h b/gui/ThemeEval.h
index 053539ef48..757b6c32d8 100644
--- a/gui/ThemeEval.h
+++ b/gui/ThemeEval.h
@@ -76,7 +76,7 @@ public:
 
 	ThemeEval &addDialog(const Common::String &name, const Common::String &overlays, int16 maxWidth = -1, int16 maxHeight = -1, int inset = 0);
 	ThemeEval &addLayout(ThemeLayout::LayoutType type, int spacing = -1, ThemeLayout::ItemAlign itemAlign = ThemeLayout::kItemAlignStart);
-	ThemeEval &addWidget(const Common::String &name, const Common::String &type, int w = -1, int h = -1, Graphics::TextAlign align = Graphics::kTextAlignLeft);
+	ThemeEval &addWidget(const Common::String &name, const Common::String &type, int w = -1, int h = -1, Graphics::TextAlign align = Graphics::kTextAlignLeft, bool useRTL = false);
 	ThemeEval &addImportedLayout(const Common::String &name);
 	ThemeEval &addSpace(int size = -1);
 
@@ -88,7 +88,7 @@ public:
 	bool hasDialog(const Common::String &name);
 
 	void reflowDialogLayout(const Common::String &name, Widget *widgetChain);
-	bool getWidgetData(const Common::String &widget, int16 &x, int16 &y, int16 &w, int16 &h);
+	bool getWidgetData(const Common::String &widget, int16 &x, int16 &y, int16 &w, int16 &h, bool &useRTL);
 
 	Graphics::TextAlign getWidgetTextHAlign(const Common::String &widget);
 
diff --git a/gui/ThemeLayout.cpp b/gui/ThemeLayout.cpp
index e703fd1d15..91de80872b 100644
--- a/gui/ThemeLayout.cpp
+++ b/gui/ThemeLayout.cpp
@@ -71,16 +71,18 @@ void ThemeLayout::resetLayout() {
 		_children[i]->resetLayout();
 }
 
-bool ThemeLayout::getWidgetData(const Common::String &name, int16 &x, int16 &y, int16 &w, int16 &h) {
+bool ThemeLayout::getWidgetData(const Common::String &name, int16 &x, int16 &y, int16 &w, int16 &h, bool &useRTL) {
 	if (name.empty()) {
 		assert(getLayoutType() == kLayoutMain);
 		x = _x; y = _y;
 		w = _w; h = _h;
+		useRTL = _useRTL;
+
 		return true;
 	}
 
 	for (uint i = 0; i < _children.size(); ++i) {
-		if (_children[i]->getWidgetData(name, x, y, w, h))
+		if (_children[i]->getWidgetData(name, x, y, w, h, useRTL))
 			return true;
 	}
 
@@ -158,10 +160,12 @@ void ThemeLayout::debugDraw(Graphics::Surface *screen, const Graphics::Font *fon
 #endif
 
 
-bool ThemeLayoutWidget::getWidgetData(const Common::String &name, int16 &x, int16 &y, int16 &w, int16 &h) {
+bool ThemeLayoutWidget::getWidgetData(const Common::String &name, int16 &x, int16 &y, int16 &w, int16 &h, bool &useRTL) {
 	if (name == _name) {
 		x = _x; y = _y;
 		w = _w; h = _h;
+		useRTL = _useRTL;
+
 		return true;
 	}
 
@@ -229,7 +233,7 @@ void ThemeLayoutMain::reflowLayout(Widget *widgetChain) {
 		_w = _defaultW > 0 ? MIN(_defaultW, g_system->getOverlayWidth()) : -1;
 		_h = _defaultH > 0 ? MIN(_defaultH, g_system->getOverlayHeight()) : -1;
 	} else {
-		if (!g_gui.xmlEval()->getWidgetData(_overlays, _x, _y, _w, _h)) {
+		if (!g_gui.xmlEval()->getWidgetData(_overlays, _x, _y, _w, _h, _useRTL)) {
 			warning("Unable to retrieve overlayed dialog position %s", _overlays.c_str());
 		}
 
diff --git a/gui/ThemeLayout.h b/gui/ThemeLayout.h
index 482413c1ed..25ec9eb997 100644
--- a/gui/ThemeLayout.h
+++ b/gui/ThemeLayout.h
@@ -114,7 +114,7 @@ protected:
 	virtual ThemeLayout *makeClone(ThemeLayout *newParent) = 0;
 
 public:
-	virtual bool getWidgetData(const Common::String &name, int16 &x, int16 &y, int16 &w, int16 &h);
+	virtual bool getWidgetData(const Common::String &name, int16 &x, int16 &y, int16 &w, int16 &h, bool &useRTL);
 
 	virtual Graphics::TextAlign getWidgetTextHAlign(const Common::String &name);
 
@@ -131,6 +131,7 @@ public:
 protected:
 	ThemeLayout *_parent;
 	int16 _x, _y, _w, _h;
+	bool _useRTL;
 	Common::Rect _padding;
 	Common::Array<ThemeLayout *> _children;
 	int16 _defaultW, _defaultH;
@@ -219,14 +220,15 @@ protected:
 
 class ThemeLayoutWidget : public ThemeLayout {
 public:
-	ThemeLayoutWidget(ThemeLayout *p, const Common::String &name, int16 w, int16 h, Graphics::TextAlign align) : ThemeLayout(p), _name(name) {
+	ThemeLayoutWidget(ThemeLayout *p, const Common::String &name, int16 w, int16 h, Graphics::TextAlign align, bool &useRTL) : ThemeLayout(p), _name(name) {
 		_w = _defaultW = w;
 		_h = _defaultH = h;
+		_useRTL = useRTL;
 
 		setTextHAlign(align);
 	}
 
-	bool getWidgetData(const Common::String &name, int16 &x, int16 &y, int16 &w, int16 &h) override;
+	bool getWidgetData(const Common::String &name, int16 &x, int16 &y, int16 &w, int16 &h, bool &useRTL) override;
 	Graphics::TextAlign getWidgetTextHAlign(const Common::String &name) override;
 
 	void reflowLayout(Widget *widgetChain) override;
@@ -253,7 +255,7 @@ class ThemeLayoutTabWidget : public ThemeLayoutWidget {
 
 public:
 	ThemeLayoutTabWidget(ThemeLayout *p, const Common::String &name, int16 w, int16 h, Graphics::TextAlign align, int tabHeight):
-		ThemeLayoutWidget(p, name, w, h, align) {
+		ThemeLayoutWidget(p, name, w, h, align, _useRTL) {
 		_tabHeight = tabHeight;
 	}
 
@@ -263,8 +265,8 @@ public:
 		}
 	}
 
-	bool getWidgetData(const Common::String &name, int16 &x, int16 &y, int16 &w, int16 &h) override {
-		if (ThemeLayoutWidget::getWidgetData(name, x, y, w, h)) {
+	bool getWidgetData(const Common::String &name, int16 &x, int16 &y, int16 &w, int16 &h, bool &useRTL) override {
+		if (ThemeLayoutWidget::getWidgetData(name, x, y, w, h, _useRTL)) {
 			h -= _tabHeight;
 			return true;
 		}
@@ -294,7 +296,7 @@ public:
 		}
 	}
 
-	bool getWidgetData(const Common::String &name, int16 &x, int16 &y, int16 &w, int16 &h) override { return false; }
+	bool getWidgetData(const Common::String &name, int16 &x, int16 &y, int16 &w, int16 &h, bool &useRTL) override { return false; }
 	void reflowLayout(Widget *widgetChain) override {}
 #ifdef LAYOUT_DEBUG_DIALOG
 	const char *getName() const { return "SPACE"; }
diff --git a/gui/ThemeParser.cpp b/gui/ThemeParser.cpp
index 96d10e9ee7..8e576feff6 100644
--- a/gui/ThemeParser.cpp
+++ b/gui/ThemeParser.cpp
@@ -713,7 +713,7 @@ bool ThemeParser::parserCallback_widget(ParserNode *node) {
 			useRTL = false;
 		}
 
-		_theme->getEvaluator()->addWidget(var, node->values["type"], width, height, alignH);
+		_theme->getEvaluator()->addWidget(var, node->values["type"], width, height, alignH, useRTL);
 	}
 
 	return true;
diff --git a/gui/object.cpp b/gui/object.cpp
index cc1ac4757d..a7e0f6ce1e 100644
--- a/gui/object.cpp
+++ b/gui/object.cpp
@@ -41,12 +41,13 @@ GuiObject::~GuiObject() {
 void GuiObject::reflowLayout() {
 	if (!_name.empty()) {
 		int16 w, h;
-
-		if (!g_gui.xmlEval()->getWidgetData(_name, _x, _y, w, h) || w == -1 || h == -1) {
+		bool useRTL = true;
+		if (!g_gui.xmlEval()->getWidgetData(_name, _x, _y, w, h, useRTL) || w == -1 || h == -1) {
 			error("Unable to load widget position for '%s'. Please check your theme files", _name.c_str());
 		}
 		_w = w;
 		_h = h;
+		_useRTL = useRTL;
 	}
 }
 
diff --git a/gui/object.h b/gui/object.h
index 220e72e3f1..6c09e3f00a 100644
--- a/gui/object.h
+++ b/gui/object.h
@@ -65,6 +65,7 @@ protected:
 
 	int16		_x, _y;
 	uint16		_w, _h;
+	bool		_useRTL;
 	const Common::String _name;
 
 	Widget		*_firstWidget;
diff --git a/gui/options.cpp b/gui/options.cpp
index 80ff122524..65086eb224 100644
--- a/gui/options.cpp
+++ b/gui/options.cpp
@@ -2785,10 +2785,10 @@ void GlobalOptionsDialog::setupCloudTab() {
 	int16 shiftUp = 0;
 	if (!showingCurrentStorage || enabled) {
 		// "storage is disabled" hint is not shown, shift everything up
-		if (!g_gui.xmlEval()->getWidgetData("GlobalOptions_Cloud_Container.StorageDisabledHint", x, y, w, h))
+		if (!g_gui.xmlEval()->getWidgetData("GlobalOptions_Cloud_Container.StorageDisabledHint", x, y, w, h, _useRTL))
 			warning("GlobalOptions_Cloud_Container.StorageUsernameDesc's position is undefined");
 		shiftUp = y;
-		if (!g_gui.xmlEval()->getWidgetData("GlobalOptions_Cloud_Container.StorageUsernameDesc", x, y, w, h))
+		if (!g_gui.xmlEval()->getWidgetData("GlobalOptions_Cloud_Container.StorageUsernameDesc", x, y, w, h, _useRTL))
 			warning("GlobalOptions_Cloud_Container.StorageWizardNotConnectedHint's position is undefined");
 		shiftUp = y - shiftUp;
 	}
@@ -2838,10 +2838,10 @@ void GlobalOptionsDialog::setupCloudTab() {
 
 	int16 disconnectWidgetsAdditionalShift = 0;
 	if (!showDownloadButton) {
-		if (!g_gui.xmlEval()->getWidgetData("GlobalOptions_Cloud_Container.StorageDownloadHint", x, y, w, h))
+		if (!g_gui.xmlEval()->getWidgetData("GlobalOptions_Cloud_Container.StorageDownloadHint", x, y, w, h, _useRTL))
 			warning("GlobalOptions_Cloud_Container.StorageDownloadHint's position is undefined");
 		disconnectWidgetsAdditionalShift = y;
-		if (!g_gui.xmlEval()->getWidgetData("GlobalOptions_Cloud_Container.StorageDisconnectHint", x, y, w, h))
+		if (!g_gui.xmlEval()->getWidgetData("GlobalOptions_Cloud_Container.StorageDisconnectHint", x, y, w, h, _useRTL))
 			warning("GlobalOptions_Cloud_Container.DownloadButton's position is undefined");
 		disconnectWidgetsAdditionalShift = y - disconnectWidgetsAdditionalShift;
 	}
@@ -2888,10 +2888,10 @@ void GlobalOptionsDialog::setupCloudTab() {
 	}
 
 	if (!shownConnectedInfo) {
-		if (!g_gui.xmlEval()->getWidgetData("GlobalOptions_Cloud_Container.StorageDisabledHint", x, y, w, h))
+		if (!g_gui.xmlEval()->getWidgetData("GlobalOptions_Cloud_Container.StorageDisabledHint", x, y, w, h, _useRTL))
 			warning("GlobalOptions_Cloud_Container.StorageUsernameDesc's position is undefined");
 		shiftUp = y;
-		if (!g_gui.xmlEval()->getWidgetData("GlobalOptions_Cloud_Container.StorageWizardNotConnectedHint", x, y, w, h))
+		if (!g_gui.xmlEval()->getWidgetData("GlobalOptions_Cloud_Container.StorageWizardNotConnectedHint", x, y, w, h, _useRTL))
 			warning("GlobalOptions_Cloud_Container.StorageWizardNotConnectedHint's position is undefined");
 		shiftUp = y - shiftUp;
 
@@ -2911,7 +2911,7 @@ void GlobalOptionsDialog::shiftWidget(Widget *widget, const char *widgetName, in
 
 	int16 x, y;
 	int16 w, h;
-	if (!g_gui.xmlEval()->getWidgetData(widgetName, x, y, w, h))
+	if (!g_gui.xmlEval()->getWidgetData(widgetName, x, y, w, h, _useRTL))
 		warning("%s's position is undefined", widgetName);
 
 	// GUI TODO: I'm not sure what's this being used for. Will this be useful when using navbars?
diff --git a/gui/saveload-dialog.cpp b/gui/saveload-dialog.cpp
index f006b9f32e..853a285aee 100644
--- a/gui/saveload-dialog.cpp
+++ b/gui/saveload-dialog.cpp
@@ -493,7 +493,7 @@ void SaveLoadChooserSimple::reflowLayout() {
 		int16 x, y;
 		int16 w, h;
 
-		if (!g_gui.xmlEval()->getWidgetData("SaveLoadChooser.Thumbnail", x, y, w, h))
+		if (!g_gui.xmlEval()->getWidgetData("SaveLoadChooser.Thumbnail", x, y, w, h, _useRTL))
 			error("Error when loading position data for Save/Load Thumbnails");
 
 		// Even if there is no thumbnail support, getWidgetData() will provide default thumbnail values
@@ -934,7 +934,7 @@ void SaveLoadChooserGrid::reflowLayout() {
 
 	int16 x, y;
 	int16 w;
-	if (!g_gui.xmlEval()->getWidgetData("SaveLoadChooser.List", x, y, w, availableHeight))
+	if (!g_gui.xmlEval()->getWidgetData("SaveLoadChooser.List", x, y, w, availableHeight, _useRTL))
 		error("Could not load widget position for 'SaveLoadChooser.List'");
 
 	const int16 buttonWidth = kThumbnailWidth + 6;
diff --git a/gui/widget.cpp b/gui/widget.cpp
index d393f40b4c..aff87098df 100644
--- a/gui/widget.cpp
+++ b/gui/widget.cpp
@@ -39,13 +39,13 @@ namespace GUI {
 
 Widget::Widget(GuiObject *boss, int x, int y, int w, int h, const char *tooltip)
 	: GuiObject(x, y, w, h), _type(0), _boss(boss), _tooltip(tooltip),
-	  _flags(0), _hasFocus(false), _useRTL(false), _state(ThemeEngine::kStateEnabled) {
+	  _flags(0), _hasFocus(false), _state(ThemeEngine::kStateEnabled) {
 	init();
 }
 
 Widget::Widget(GuiObject *boss, const Common::String &name, const char *tooltip)
 	: GuiObject(name), _type(0), _boss(boss), _tooltip(tooltip),
-	  _flags(0), _hasFocus(false), _useRTL(false), _state(ThemeEngine::kStateDisabled) {
+	  _flags(0), _hasFocus(false), _state(ThemeEngine::kStateDisabled) {
 	init();
 }
 
@@ -54,10 +54,6 @@ void Widget::init() {
 	_next = _boss->_firstWidget;
 	_boss->_firstWidget = this;
 	_needsRedraw = true;
-
-	if (TransMan.getCurrentLanguage() == "C" && false) {		// GUI TODO: Change this and GuiManager::GuiManager() to use RTL.
-		_useRTL = true;											// GUI TODO: Widgets will get _useRTL true or not from the XML parser.
-	}
 }
 
 Widget::~Widget() {
diff --git a/gui/widget.h b/gui/widget.h
index 02c55faaf0..7a81017f7d 100644
--- a/gui/widget.h
+++ b/gui/widget.h
@@ -102,7 +102,6 @@ protected:
 	GuiObject	*_boss;
 	Widget		*_next;
 	bool		_hasFocus;
-	bool		_useRTL;
 	ThemeEngine::WidgetStateInfo _state;
 	Common::String _tooltip;
 


Commit: 60d462977b0b0ec70f2fdbdfa162a93901c1a04a
    https://github.com/scummvm/scummvm/commit/60d462977b0b0ec70f2fdbdfa162a93901c1a04a
Author: aryanrawlani28 (aryanrawlani007 at gmail.com)
Date: 2020-06-22T00:03:02+02:00

Commit Message:
GUI: RTL: Update layout files for optional rtl flags

Changed paths:
    gui/themes/scummmodern/scummmodern_layout.stx
    gui/themes/scummremastered/remastered_layout.stx


diff --git a/gui/themes/scummmodern/scummmodern_layout.stx b/gui/themes/scummmodern/scummmodern_layout.stx
index 4be7bc2016..27218aae6e 100644
--- a/gui/themes/scummmodern/scummmodern_layout.stx
+++ b/gui/themes/scummmodern/scummmodern_layout.stx
@@ -141,6 +141,7 @@
 				<widget name = 'SearchPic'
 						width = '16'
 						height = '17'
+						rtl = 'no'
 				/>
 				<widget name = 'Search'
 						width = '150'
diff --git a/gui/themes/scummremastered/remastered_layout.stx b/gui/themes/scummremastered/remastered_layout.stx
index 4be7bc2016..27218aae6e 100644
--- a/gui/themes/scummremastered/remastered_layout.stx
+++ b/gui/themes/scummremastered/remastered_layout.stx
@@ -141,6 +141,7 @@
 				<widget name = 'SearchPic'
 						width = '16'
 						height = '17'
+						rtl = 'no'
 				/>
 				<widget name = 'Search'
 						width = '150'


Commit: 1715256c613aa758b9bb5bda92d02649f760428e
    https://github.com/scummvm/scummvm/commit/1715256c613aa758b9bb5bda92d02649f760428e
Author: aryanrawlani28 (aryanrawlani007 at gmail.com)
Date: 2020-06-22T00:03:02+02:00

Commit Message:
GUI: RTL: Add new draw steps for RTL-based widgets

Changed paths:
    gui/themes/scummclassic/classic_gfx.stx
    gui/themes/scummmodern/scummmodern_gfx.stx
    gui/themes/scummremastered/remastered_gfx.stx


diff --git a/gui/themes/scummclassic/classic_gfx.stx b/gui/themes/scummclassic/classic_gfx.stx
index 8ccf72e94e..f42c25aa14 100644
--- a/gui/themes/scummclassic/classic_gfx.stx
+++ b/gui/themes/scummclassic/classic_gfx.stx
@@ -349,6 +349,40 @@
 				horizontal_align = 'left'
 		/>
 	</drawdata>
+	<drawdata id = 'popup_idle_rtl' cache = 'false' resolution = 'y>399'>
+		<drawstep	func = 'bevelsq'
+					bevel = '2'
+					fill = 'none'
+		/>
+
+		<drawstep	func = 'triangle'
+					fg_color = 'green'
+					fill = 'foreground'
+					width = '10'
+					height = '5'
+					xpos = 'left'
+					ypos = '10'
+					padding = '2, 0, 7, 0'
+					orientation = 'bottom'
+		/>
+
+		<drawstep	func = 'triangle'
+					fg_color = 'green'
+					fill = 'foreground'
+					width = '10'
+					height = '5'
+					xpos = 'left'
+					ypos = '4'
+					padding = '2, 0, 7, 0'
+					orientation = 'top'
+		/>
+
+		<text	font = 'text_default'
+				text_color = 'color_normal'
+				vertical_align = 'center'
+				horizontal_align = 'right'
+		/>
+	</drawdata>
 
 	<drawdata id = 'popup_idle' cache = 'false' resolution = 'y<400'>
 		<drawstep	func = 'bevelsq'
@@ -384,6 +418,40 @@
 				horizontal_align = 'left'
 		/>
 	</drawdata>
+	<drawdata id = 'popup_idle_rtl' cache = 'false' resolution = 'y<400'>
+		<drawstep	func = 'bevelsq'
+					bevel = '2'
+					fill = 'none'
+		/>
+
+		<drawstep	func = 'triangle'
+					fg_color = 'green'
+					fill = 'foreground'
+					width = '7'
+					height = '4'
+					xpos = 'left'
+					ypos = '9'
+					padding = '2, 0, 3, 0'
+					orientation = 'bottom'
+		/>
+
+		<drawstep	func = 'triangle'
+					fg_color = 'green'
+					fill = 'foreground'
+					width = '7'
+					height = '4'
+					xpos = 'left'
+					ypos = '4'
+					padding = '2, 0, 3, 0'
+					orientation = 'top'
+		/>
+
+		<text	font = 'text_default'
+				text_color = 'color_normal'
+				vertical_align = 'center'
+				horizontal_align = 'right'
+		/>
+	</drawdata>
 
 	<drawdata id = 'popup_disabled' cache = 'false' resolution = 'y>399'>
 		<drawstep	func = 'bevelsq'
@@ -417,6 +485,38 @@
 				horizontal_align = 'left'
 		/>
 	</drawdata>
+	<drawdata id = 'popup_disabled_rtl' cache = 'false' resolution = 'y>399'>
+		<drawstep	func = 'bevelsq'
+					bevel = '2'
+					fill = 'none'
+		/>
+		<drawstep	func = 'triangle'
+					fg_color = 'green'
+					fill = 'foreground'
+					width = '10'
+					height = '5'
+					xpos = 'left'
+					ypos = '10'
+					padding = '2, 0, 7, 0'
+					orientation = 'bottom'
+		/>
+
+		<drawstep	func = 'triangle'
+					fg_color = 'green'
+					fill = 'foreground'
+					width = '10'
+					height = '5'
+					xpos = 'left'
+					ypos = '4'
+					padding = '2, 0, 7, 0'
+					orientation = 'top'
+		/>
+		<text	font = 'text_default'
+				text_color = 'color_normal_disabled'
+				vertical_align = 'center'
+				horizontal_align = 'right'
+		/>
+	</drawdata>
 
 	<drawdata id = 'popup_disabled' cache = 'false' resolution = 'y<400'>
 		<drawstep	func = 'bevelsq'
@@ -452,6 +552,40 @@
 				horizontal_align = 'left'
 		/>
 	</drawdata>
+	<drawdata id = 'popup_disabled_rtl' cache = 'false' resolution = 'y<400'>
+		<drawstep	func = 'bevelsq'
+					bevel = '2'
+					fill = 'none'
+		/>
+
+		<drawstep	func = 'triangle'
+					fg_color = 'green'
+					fill = 'foreground'
+					width = '7'
+					height = '4'
+					xpos = 'left'
+					ypos = '9'
+					padding = '0, 0, 3, 0'
+					orientation = 'bottom'
+		/>
+
+		<drawstep	func = 'triangle'
+					fg_color = 'green'
+					fill = 'foreground'
+					width = '7'
+					height = '4'
+					xpos = 'left'
+					ypos = '4'
+					padding = '0, 0, 3, 0'
+					orientation = 'top'
+		/>
+
+		<text	font = 'text_default'
+				text_color = 'color_normal'
+				vertical_align = 'center'
+				horizontal_align = 'right'
+		/>
+	</drawdata>
 
 	<drawdata id = 'popup_hover' cache = 'false' resolution = 'y>399'>
 		<drawstep	func = 'bevelsq'
@@ -485,6 +619,38 @@
 				horizontal_align = 'left'
 		/>
 	</drawdata>
+	<drawdata id = 'popup_hover_rtl' cache = 'false' resolution = 'y>399'>
+		<drawstep	func = 'bevelsq'
+					bevel = '2'
+					fill = 'none'
+		/>
+		<drawstep	func = 'triangle'
+					fg_color = 'green'
+					fill = 'foreground'
+					width = '10'
+					height = '5'
+					xpos = 'left'
+					ypos = '10'
+					padding = '2, 0, 7, 0'
+					orientation = 'bottom'
+		/>
+
+		<drawstep	func = 'triangle'
+					fg_color = 'green'
+					fill = 'foreground'
+					width = '10'
+					height = '5'
+					xpos = 'left'
+					ypos = '4'
+					padding = '2, 0, 7, 0'
+					orientation = 'top'
+		/>
+		<text	font = 'text_default'
+				text_color = 'color_normal_hover'
+				vertical_align = 'center'
+				horizontal_align = 'right'
+		/>
+	</drawdata>
 
 	<drawdata id = 'popup_hover' cache = 'false' resolution = 'y<400'>
 		<drawstep	func = 'bevelsq'
@@ -520,6 +686,40 @@
 				horizontal_align = 'left'
 		/>
 	</drawdata>
+	<drawdata id = 'popup_hover_rtl' cache = 'false' resolution = 'y<400'>
+		<drawstep	func = 'bevelsq'
+					bevel = '2'
+					fill = 'none'
+		/>
+
+		<drawstep	func = 'triangle'
+					fg_color = 'green'
+					fill = 'foreground'
+					width = '7'
+					height = '4'
+					xpos = 'left'
+					ypos = '9'
+					padding = '2, 0, 3, 0'
+					orientation = 'bottom'
+		/>
+
+		<drawstep	func = 'triangle'
+					fg_color = 'green'
+					fill = 'foreground'
+					width = '7'
+					height = '4'
+					xpos = 'left'
+					ypos = '4'
+					padding = '2, 0, 3, 0'
+					orientation = 'top'
+		/>
+
+		<text	font = 'text_default'
+				text_color = 'color_normal'
+				vertical_align = 'center'
+				horizontal_align = 'right'
+		/>
+	</drawdata>
 
 	<drawdata id = 'widget_textedit' cache = 'false'>
 		<drawstep	func = 'bevelsq'
@@ -627,6 +827,37 @@
 					padding = '0,0,17,1'
 		/>
 	</drawdata>
+	<drawdata id = 'dropdown_button_idle_rtl' cache = 'false' resolution = 'y>399'>
+		<text	font = 'text_button'
+				text_color = 'color_button'
+				vertical_align = 'center'
+				horizontal_align = 'center'
+		/>
+		<drawstep	func = 'bevelsq'
+					bevel = '2'
+					fill = 'none'
+		/>
+		<drawstep	func = 'triangle'
+					fg_color = 'green'
+					fill = 'foreground'
+					width = '8'
+					height = '6'
+					xpos = 'left'
+					ypos = 'center'
+					padding = '2,0,4,0'
+					orientation = 'bottom'
+		/>
+		<drawstep	func = 'line'
+					fg_color = 'lightgrey'
+					stroke = '2'
+					fill = 'foreground'
+					width = '0'
+					height = 'auto'
+					xpos = 'left'
+					ypos = 'center'
+					padding = '17,0,0,1'
+		/>
+	</drawdata>
 	<drawdata id = 'dropdown_button_idle' cache = 'false' resolution = 'y<400'>
 		<text	font = 'text_button'
 				text_color = 'color_button'
@@ -648,6 +879,27 @@
 					orientation = 'bottom'
 		/>
 	</drawdata>
+	<drawdata id = 'dropdown_button_idle_rtl' cache = 'false' resolution = 'y<400'>
+		<text	font = 'text_button'
+				text_color = 'color_button'
+				vertical_align = 'center'
+				horizontal_align = 'center'
+		/>
+		<drawstep	func = 'bevelsq'
+					bevel = '2'
+					fill = 'none'
+		/>
+		<drawstep	func = 'triangle'
+					fg_color = 'green'
+					fill = 'foreground'
+					width = '6'
+					height = '6'
+					xpos = 'left'
+					ypos = 'center'
+					padding = '2,0,0,0'
+					orientation = 'bottom'
+		/>
+	</drawdata>
 
 	<drawdata id = 'dropdown_button_hover_left' cache = 'false' resolution = 'y>399'>
 		<text	font = 'text_button'
@@ -680,6 +932,37 @@
 					padding = '0,0,17,1'
 		/>
 	</drawdata>
+	<drawdata id = 'dropdown_button_hover_left_rtl' cache = 'false' resolution = 'y>399'>
+		<text	font = 'text_button'
+				text_color = 'color_button_hover'
+				vertical_align = 'center'
+				horizontal_align = 'center'
+		/>
+		<drawstep	func = 'bevelsq'
+					bevel = '2'
+					fill = 'none'
+		/>
+		<drawstep	func = 'triangle'
+					fg_color = 'green'
+					fill = 'foreground'
+					width = '8'
+					height = '6'
+					xpos = 'left'
+					ypos = 'center'
+					padding = '2,0,4,0'
+					orientation = 'bottom'
+		/>
+		<drawstep	func = 'line'
+					fg_color = 'lightgrey'
+					stroke = '2'
+					fill = 'foreground'
+					width = '0'
+					height = 'auto'
+					xpos = 'left'
+					ypos = 'center'
+					padding = '17,0,0,1'
+		/>
+	</drawdata>
 	<drawdata id = 'dropdown_button_hover_left' cache = 'false' resolution = 'y<400'>
 		<text	font = 'text_button'
 				text_color = 'color_button_hover'
@@ -701,6 +984,27 @@
 					orientation = 'bottom'
 		/>
 	</drawdata>
+	<drawdata id = 'dropdown_button_hover_left_rtl' cache = 'false' resolution = 'y<400'>
+		<text	font = 'text_button'
+				text_color = 'color_button_hover'
+				vertical_align = 'center'
+				horizontal_align = 'center'
+		/>
+		<drawstep	func = 'bevelsq'
+					bevel = '2'
+					fill = 'none'
+		/>
+		<drawstep	func = 'triangle'
+					fg_color = 'green'
+					fill = 'foreground'
+					width = '6'
+					height = '6'
+					xpos = 'left'
+					ypos = 'center'
+					padding = '2,0,0,0'
+					orientation = 'bottom'
+		/>
+	</drawdata>
 
 	<drawdata id = 'dropdown_button_hover_right' cache = 'false' resolution = 'y>399'>
 		<text	font = 'text_button'
@@ -733,6 +1037,37 @@
 					padding = '0,0,17,1'
 		/>
 	</drawdata>
+	<drawdata id = 'dropdown_button_hover_right_rtl' cache = 'false' resolution = 'y>399'>
+		<text	font = 'text_button'
+				text_color = 'color_button'
+				vertical_align = 'center'
+				horizontal_align = 'center'
+		/>
+		<drawstep	func = 'bevelsq'
+					bevel = '2'
+					fill = 'none'
+		/>
+		<drawstep	func = 'triangle'
+					fg_color = 'green2'
+					fill = 'foreground'
+					width = '8'
+					height = '6'
+					xpos = 'left'
+					ypos = 'center'
+					padding = '2,0,4,0'
+					orientation = 'bottom'
+		/>
+		<drawstep	func = 'line'
+					fg_color = 'lightgrey'
+					stroke = '2'
+					fill = 'foreground'
+					width = '0'
+					height = 'auto'
+					xpos = 'left'
+					ypos = 'center'
+					padding = '17,0,0,1'
+		/>
+	</drawdata>
 	<drawdata id = 'dropdown_button_hover_right' cache = 'false' resolution = 'y<400'>
 		<text	font = 'text_button'
 				text_color = 'color_button'
@@ -754,6 +1089,27 @@
 					orientation = 'bottom'
 		/>
 	</drawdata>
+	<drawdata id = 'dropdown_button_hover_right_rtl' cache = 'false' resolution = 'y<400'>
+		<text	font = 'text_button'
+				text_color = 'color_button'
+				vertical_align = 'center'
+				horizontal_align = 'center'
+		/>
+		<drawstep	func = 'bevelsq'
+					bevel = '2'
+					fill = 'none'
+		/>
+		<drawstep	func = 'triangle'
+					fg_color = 'green2'
+					fill = 'foreground'
+					width = '6'
+					height = '6'
+					xpos = 'left'
+					ypos = 'center'
+					padding = '2,0,0,0'
+					orientation = 'bottom'
+		/>
+	</drawdata>
 
 	<drawdata id = 'dropdown_button_disabled' cache = 'false' resolution = 'y>399'>
 		<text	font = 'text_button'
@@ -786,6 +1142,37 @@
 					padding = '0,0,17,1'
 		/>
 	</drawdata>
+	<drawdata id = 'dropdown_button_disabled_rtl' cache = 'false' resolution = 'y>399'>
+		<text	font = 'text_button'
+				text_color = 'color_button_disabled'
+				vertical_align = 'center'
+				horizontal_align = 'center'
+		/>
+		<drawstep	func = 'bevelsq'
+					bevel = '2'
+					fill = 'none'
+		/>
+		<drawstep	func = 'triangle'
+					fg_color = 'lightgrey'
+					fill = 'foreground'
+					width = '8'
+					height = '6'
+					xpos = 'left'
+					ypos = 'center'
+					padding = '2,0,4,0'
+					orientation = 'bottom'
+		/>
+		<drawstep	func = 'line'
+					fg_color = 'lightgrey'
+					stroke = '2'
+					fill = 'foreground'
+					width = '0'
+					height = 'auto'
+					xpos = 'left'
+					ypos = 'center'
+					padding = '17,0,0,1'
+		/>
+	</drawdata>
 	<drawdata id = 'dropdown_button_disabled' cache = 'false' resolution = 'y<400'>
 		<text	font = 'text_button'
 				text_color = 'color_button_disabled'
@@ -807,6 +1194,27 @@
 					orientation = 'bottom'
 		/>
 	</drawdata>
+	<drawdata id = 'dropdown_button_disabled_rtl' cache = 'false' resolution = 'y<400'>
+		<text	font = 'text_button'
+				text_color = 'color_button_disabled'
+				vertical_align = 'center'
+				horizontal_align = 'center'
+		/>
+		<drawstep	func = 'bevelsq'
+					bevel = '2'
+					fill = 'none'
+		/>
+		<drawstep	func = 'triangle'
+					fg_color = 'lightgrey'
+					fill = 'foreground'
+					width = '6'
+					height = '6'
+					xpos = 'left'
+					ypos = 'center'
+					padding = '2,0,0,0'
+					orientation = 'bottom'
+		/>
+	</drawdata>
 
 	<drawdata id = 'dropdown_button_pressed_left' cache = 'false' resolution = 'y>399'>
 		<text	font = 'text_button'
@@ -830,6 +1238,28 @@
 					orientation = 'bottom'
 		/>
 	</drawdata>
+	<drawdata id = 'dropdown_button_pressed_left_rtl' cache = 'false' resolution = 'y>399'>
+		<text	font = 'text_button'
+				text_color = 'color_alternative_inverted'
+				vertical_align = 'center'
+				horizontal_align = 'center'
+		/>
+		<drawstep	func = 'square'
+					fill = 'foreground'
+					fg_color = 'green'
+					clip = '18,0,0,0'
+		/>
+		<drawstep	func = 'triangle'
+					fg_color = 'green'
+					fill = 'foreground'
+					width = '8'
+					height = '6'
+					xpos = 'left'
+					ypos = 'center'
+					padding = '2,0,4,0'
+					orientation = 'bottom'
+		/>
+	</drawdata>
 	<drawdata id = 'dropdown_button_pressed_left' cache = 'false' resolution = 'y<400'>
 		<text	font = 'text_button'
 				text_color = 'color_alternative_inverted'
@@ -852,6 +1282,28 @@
 					orientation = 'bottom'
 		/>
 	</drawdata>
+	<drawdata id = 'dropdown_button_pressed_left_rtl' cache = 'false' resolution = 'y<400'>
+		<text	font = 'text_button'
+				text_color = 'color_alternative_inverted'
+				vertical_align = 'center'
+				horizontal_align = 'center'
+		/>
+		<drawstep	func = 'square'
+					fill = 'foreground'
+					fg_color = 'green'
+					clip = '7,0,0,0'
+		/>
+		<drawstep	func = 'triangle'
+					fg_color = 'green'
+					fill = 'foreground'
+					width = '6'
+					height = '6'
+					xpos = 'left'
+					ypos = 'center'
+					padding = '2,0,0,0'
+					orientation = 'bottom'
+		/>
+	</drawdata>
 
 	<drawdata id = 'dropdown_button_pressed_right' cache = 'false' resolution = 'y>399'>
 		<text	font = 'text_button'
@@ -875,6 +1327,28 @@
 					orientation = 'bottom'
 		/>
 	</drawdata>
+	<drawdata id = 'dropdown_button_pressed_right_rtl' cache = 'false' resolution = 'y>399'>
+		<text	font = 'text_button'
+				text_color = 'color_button'
+				vertical_align = 'center'
+				horizontal_align = 'center'
+		/>
+		<drawstep	func = 'square'
+					fill = 'foreground'
+					fg_color = 'green'
+					clip = '0,0,16,0'
+		/>
+		<drawstep	func = 'triangle'
+					fg_color = 'white'
+					fill = 'foreground'
+					width = '8'
+					height = '6'
+					xpos = 'left'
+					ypos = 'center'
+					padding = '2,0,4,0'
+					orientation = 'bottom'
+		/>
+	</drawdata>
 	<drawdata id = 'dropdown_button_pressed_right' cache = 'false' resolution = 'y<400'>
 		<text	font = 'text_button'
 				text_color = 'color_button'
@@ -897,6 +1371,28 @@
 					orientation = 'bottom'
 		/>
 	</drawdata>
+	<drawdata id = 'dropdown_button_pressed_right_rtl' cache = 'false' resolution = 'y<400'>
+		<text	font = 'text_button'
+				text_color = 'color_button'
+				vertical_align = 'center'
+				horizontal_align = 'center'
+		/>
+		<drawstep	func = 'square'
+					fill = 'foreground'
+					fg_color = 'green'
+					clip = '0,0,7,0'
+		/>
+		<drawstep	func = 'triangle'
+					fg_color = 'white'
+					fill = 'foreground'
+					width = '6'
+					height = '6'
+					xpos = 'left'
+					ypos = 'center'
+					padding = '2,0,0,0'
+					orientation = 'bottom'
+		/>
+	</drawdata>
 
 	<drawdata id = 'checkbox_disabled_selected' cache = 'false'>
 		<text	font = 'text_default'
@@ -914,6 +1410,22 @@
 					fg_color = 'lightgrey'
 		/>
 	</drawdata>
+	<drawdata id = 'checkbox_disabled_selected_rtl' cache = 'false'>
+		<drawstep	func = 'bevelsq'
+					bevel = '2'
+					fill = 'none'
+		/>
+		<drawstep	func = 'cross'
+					fill = 'foreground'
+					stroke = '2'
+					fg_color = 'lightgrey'
+		/>
+		<text	font = 'text_default'
+				text_color = 'color_normal_disabled'
+				vertical_align = 'top'
+				horizontal_align = 'right'
+		/>
+	</drawdata>
 
 	<drawdata id = 'checkbox_disabled' cache = 'false'>
 		<text	font = 'text_default'
@@ -926,6 +1438,17 @@
 					fill = 'none'
 		/>
 	</drawdata>
+	<drawdata id = 'checkbox_disabled_rtl' cache = 'false'>
+		<drawstep	func = 'bevelsq'
+					bevel = '2'
+					fill = 'none'
+		/>
+		<text	font = 'text_default'
+				text_color = 'color_normal_disabled'
+				vertical_align = 'top'
+				horizontal_align = 'right'
+		/>
+	</drawdata>
 
 	<drawdata id = 'checkbox_selected' cache = 'false'>
 		<text	font = 'text_default'
@@ -943,6 +1466,22 @@
 					fg_color = 'green'
 		/>
 	</drawdata>
+	<drawdata id = 'checkbox_selected_rtl' cache = 'false'>
+		<drawstep	func = 'bevelsq'
+					bevel = '2'
+					fill = 'none'
+		/>
+		<drawstep	func = 'cross'
+					fill = 'foreground'
+					stroke = '2'
+					fg_color = 'green'
+		/>
+		<text	font = 'text_default'
+				text_color = 'color_normal'
+				vertical_align = 'top'
+				horizontal_align = 'right'
+		/>
+	</drawdata>
 
 	<drawdata id = 'checkbox_default' cache = 'false'>
 		<text	font = 'text_default'
@@ -955,6 +1494,17 @@
 					fill = 'none'
 		/>
 	</drawdata>
+	<drawdata id = 'checkbox_default_rtl' cache = 'false'>
+		<drawstep	func = 'bevelsq'
+					bevel = '2'
+					fill = 'none'
+		/>
+		<text	font = 'text_default'
+				text_color = 'color_normal'
+				vertical_align = 'top'
+				horizontal_align = 'right'
+		/>
+	</drawdata>
 
 	<!-- Idle radiobutton -->
 	<drawdata id = 'radiobutton_default' cache = 'false'>
@@ -973,6 +1523,22 @@
 					ypos = '0'
 		/>
 	</drawdata>
+	<drawdata id = 'radiobutton_default_rtl' cache = 'false'>
+		<drawstep	func = 'circle'
+					width = '7'
+					height = '7'
+					radius = '7'
+					fill = 'background'
+					bg_color = 'darkgrey'
+					xpos = '0'
+					ypos = '0'
+		/>
+		<text	font = 'text_default'
+				text_color = 'color_normal'
+				vertical_align = 'center'
+				horizontal_align = 'right'
+		/>
+	</drawdata>
 
 	<!-- Selected radiobutton -->
 	<drawdata id = 'radiobutton_selected' cache = 'false'>
@@ -1000,6 +1566,31 @@
 					ypos = '2'
 		/>
 	</drawdata>
+	<drawdata id = 'radiobutton_selected_rtl' cache = 'false'>
+		<drawstep	func = 'circle'
+					width = '7'
+					height = '7'
+					radius = '7'
+					fg_color = 'darkgrey'
+					fill = 'none'
+					xpos = '0'
+					ypos = '0'
+		/>
+		<drawstep	func = 'circle'
+					width = '7'
+					height = '7'
+					radius = '5'
+					fg_color = 'green'
+					fill = 'foreground'
+					xpos = '2'
+					ypos = '2'
+		/>
+		<text	font = 'text_default'
+				text_color = 'color_normal'
+				vertical_align = 'center'
+				horizontal_align = 'right'
+		/>
+	</drawdata>
 
 	<!-- Disabled radiobutton -->
 	<drawdata id = 'radiobutton_disabled' cache = 'false'>
@@ -1018,6 +1609,22 @@
 					ypos = '0'
 		/>
 	</drawdata>
+	<drawdata id = 'radiobutton_disabled_rtl' cache = 'false'>
+		<drawstep	func = 'circle'
+					width = '7'
+					height = '7'
+					radius = '7'
+					bg_color = 'lightgrey'
+					fill = 'background'
+					xpos = '0'
+					ypos = '0'
+		/>
+		<text	font = 'text_default'
+				text_color = 'color_normal_disabled'
+				vertical_align = 'center'
+				horizontal_align = 'right'
+		/>
+	</drawdata>
 
 	<drawdata id = 'widget_default' cache = 'false'>
 		<drawstep	func = 'bevelsq'
diff --git a/gui/themes/scummmodern/scummmodern_gfx.stx b/gui/themes/scummmodern/scummmodern_gfx.stx
index 0e8758c73b..2d7a8f6e04 100644
--- a/gui/themes/scummmodern/scummmodern_gfx.stx
+++ b/gui/themes/scummmodern/scummmodern_gfx.stx
@@ -526,6 +526,44 @@
 				horizontal_align = 'left'
 		/>
 	</drawdata>
+	<drawdata id = 'popup_idle_rtl' cache = 'false' resolution = 'y>399'>
+		<drawstep	func = 'roundedsq'
+					radius = '5'
+					stroke = '1'
+					fg_color = 'lightgray2'
+					fill = 'background'
+					bg_color = 'xtrabrightred'
+					shadow = '1'
+		/>
+
+		<drawstep	func = 'triangle'
+					bg_color = 'shadowcolor'
+					fill = 'background'
+					width = '10'
+					height = '5'
+					xpos = 'left'
+					ypos = '10'
+					padding = '2, 0, 6, 0'
+					orientation = 'bottom'
+		/>
+
+		<drawstep	func = 'triangle'
+					bg_color = 'shadowcolor'
+					fill = 'background'
+					width = '10'
+					height = '5'
+					xpos = 'left'
+					ypos = '4'
+					padding = '2, 0, 6, 0'
+					orientation = 'top'
+		/>
+
+		<text	font = 'text_default'
+				text_color = 'color_normal'
+				vertical_align = 'center'
+				horizontal_align = 'right'
+		/>
+	</drawdata>
 
 	<drawdata id = 'popup_idle' cache = 'false' resolution ='y<400'>
 		<drawstep	func = 'roundedsq'
@@ -565,6 +603,44 @@
 				horizontal_align = 'left'
 		/>
 	</drawdata>
+	<drawdata id = 'popup_idle_rtl' cache = 'false' resolution ='y<400'>
+		<drawstep	func = 'roundedsq'
+					radius = '5'
+					stroke = '1'
+					fg_color = 'lightgray2'
+					fill = 'background'
+					bg_color = 'xtrabrightred'
+					shadow = '1'
+		/>
+
+		<drawstep	func = 'triangle'
+					bg_color = 'shadowcolor'
+					fill = 'background'
+					width = '7'
+					height = '4'
+					xpos = 'left'
+					ypos = '9'
+					padding = '2, 0, 3, 0'
+					orientation = 'bottom'
+		/>
+
+		<drawstep	func = 'triangle'
+					bg_color = 'shadowcolor'
+					fill = 'background'
+					width = '7'
+					height = '4'
+					xpos = 'left'
+					ypos = '4'
+					padding = '0, 0, 3, 0'
+					orientation = 'top'
+		/>
+
+		<text	font = 'text_default'
+				text_color = 'color_normal'
+				vertical_align = 'center'
+				horizontal_align = 'right'
+		/>
+	</drawdata>
 
 	<!-- Disabled popup -->
 	<drawdata id = 'popup_disabled' cache = 'false' resolution = 'y>399'>
@@ -605,6 +681,44 @@
 				horizontal_align = 'left'
 		/>
 	</drawdata>
+	<drawdata id = 'popup_disabled_rtl' cache = 'false' resolution = 'y>399'>
+		<drawstep	func = 'roundedsq'
+					stroke = '1'
+					fg_color = 'lightgray'
+					radius = '5'
+					fill = 'gradient'
+					gradient_start = 'blandyellow'
+					gradient_end = 'xtrabrightred'
+					shadow = '0'
+		/>
+		<drawstep	func = 'triangle'
+					bg_color = 'shadowcolor'
+					fill = 'background'
+					width = '10'
+					height = '5'
+					xpos = 'left'
+					ypos = '10'
+					padding = '2, 0, 6, 0'
+					orientation = 'bottom'
+		/>
+
+		<drawstep	func = 'triangle'
+					bg_color = 'shadowcolor'
+					fill = 'background'
+					width = '10'
+					height = '5'
+					xpos = 'left'
+					ypos = '4'
+					padding = '2, 0, 6, 0'
+					orientation = 'top'
+		/>
+
+		<text	font = 'text_default'
+				text_color = 'color_normal_hover'
+				vertical_align = 'center'
+				horizontal_align = 'right'
+		/>
+	</drawdata>
 
 	<drawdata id = 'popup_disabled' cache = 'false' resolution = 'y<400'>
 		<drawstep	func = 'roundedsq'
@@ -644,6 +758,44 @@
 				horizontal_align = 'left'
 		/>
 	</drawdata>
+	<drawdata id = 'popup_disabled_rtl' cache = 'false' resolution = 'y<400'>
+		<drawstep	func = 'roundedsq'
+					radius = '5'
+					stroke = '1'
+					fg_color = 'lightgray2'
+					fill = 'background'
+					bg_color = 'xtrabrightred'
+					shadow = '2'
+		/>
+
+		<drawstep	func = 'triangle'
+					bg_color = 'shadowcolor'
+					fill = 'background'
+					width = '7'
+					height = '4'
+					xpos = 'left'
+					ypos = '9'
+					padding = '2, 0, 3, 0'
+					orientation = 'bottom'
+		/>
+
+		<drawstep	func = 'triangle'
+					bg_color = 'shadowcolor'
+					fill = 'background'
+					width = '7'
+					height = '4'
+					xpos = 'left'
+					ypos = '4'
+					padding = '2, 0, 3, 0'
+					orientation = 'top'
+		/>
+
+		<text	font = 'text_default'
+				text_color = 'color_normal'
+				vertical_align = 'center'
+				horizontal_align = 'right'
+		/>
+	</drawdata>
 
 	<!-- Hovered popup -->
 	<drawdata id = 'popup_hover' cache = 'false' resolution = 'y>399'>
@@ -684,6 +836,44 @@
 				horizontal_align = 'left'
 		/>
 	</drawdata>
+	<drawdata id = 'popup_hover_rtl' cache = 'false' resolution = 'y>399'>
+		<drawstep	func = 'roundedsq'
+					stroke = '1'
+					fg_color = 'lightgray'
+					radius = '5'
+					fill = 'gradient'
+					gradient_start = 'blandyellow'
+					gradient_end = 'xtrabrightred'
+					shadow = '0'
+		/>
+		<drawstep	func = 'triangle'
+					bg_color = 'shadowcolor'
+					fill = 'background'
+					width = '10'
+					height = '5'
+					xpos = 'left'
+					ypos = '10'
+					padding = '2, 0, 6, 0'
+					orientation = 'bottom'
+		/>
+
+		<drawstep	func = 'triangle'
+					bg_color = 'shadowcolor'
+					fill = 'background'
+					width = '10'
+					height = '5'
+					xpos = 'left'
+					ypos = '4'
+					padding = '2, 0, 6, 0'
+					orientation = 'top'
+		/>
+
+		<text	font = 'text_default'
+				text_color = 'color_normal_hover'
+				vertical_align = 'center'
+				horizontal_align = 'right'
+		/>
+	</drawdata>
 
 	<drawdata id = 'popup_hover' cache = 'false' resolution = 'y<400'>
 		<drawstep	func = 'roundedsq'
@@ -723,6 +913,44 @@
 				horizontal_align = 'left'
 		/>
 	</drawdata>
+	<drawdata id = 'popup_hover_rtl' cache = 'false' resolution = 'y<400'>
+		<drawstep	func = 'roundedsq'
+					radius = '5'
+					stroke = '1'
+					fg_color = 'lightgray2'
+					fill = 'background'
+					bg_color = 'xtrabrightred'
+					shadow = '1'
+		/>
+
+		<drawstep	func = 'triangle'
+					bg_color = 'shadowcolor'
+					fill = 'background'
+					width = '7'
+					height = '4'
+					xpos = 'left'
+					ypos = '9'
+					padding = '2, 0, 3, 0'
+					orientation = 'bottom'
+		/>
+
+		<drawstep	func = 'triangle'
+					bg_color = 'shadowcolor'
+					fill = 'background'
+					width = '7'
+					height = '4'
+					xpos = 'left'
+					ypos = '4'
+					padding = '2, 0, 3, 0'
+					orientation = 'top'
+		/>
+
+		<text	font = 'text_default'
+				text_color = 'color_normal'
+				vertical_align = 'center'
+				horizontal_align = 'right'
+		/>
+	</drawdata>
 
 	<!-- Background of the textedit widget -->
 	<drawdata id = 'widget_textedit' cache = 'false'>
@@ -889,7 +1117,7 @@
 					orientation = 'bottom'
 		/>
 	</drawdata>
-	<drawdata id = 'dropdown_button_idle' cache = 'false' resolution = 'y<400'>
+	<drawdata id = 'dropdown_button_idle_rtl' cache = 'false' resolution = 'y>399'>
 		<text	font = 'text_button'
 				text_color = 'color_button'
 				vertical_align = 'center'
@@ -909,16 +1137,15 @@
 		<drawstep	func = 'triangle'
 					fg_color = 'white'
 					fill = 'foreground'
-					width = '6'
+					width = '8'
 					height = '6'
-					xpos = 'right'
+					xpos = 'left'
 					ypos = 'center'
-					padding = '0,0,0,0'
+					padding = '2,0,2,0'
 					orientation = 'bottom'
 		/>
 	</drawdata>
-
-	<drawdata id = 'dropdown_button_hover_left' cache = 'false' resolution = 'y>399'>
+	<drawdata id = 'dropdown_button_idle' cache = 'false' resolution = 'y<400'>
 		<text	font = 'text_button'
 				text_color = 'color_button'
 				vertical_align = 'center'
@@ -930,24 +1157,23 @@
 					fill = 'gradient'
 					shadow = '0'
 					fg_color = 'darkredborder'
-					gradient_start = 'brightpink'
-					gradient_end = 'darkpink'
+					gradient_start = 'brightred'
+					gradient_end = 'darkred'
 					bevel = '1'
 					bevel_color = 'brightredborder'
-					clip = '0,0,-13,0'
 		/>
 		<drawstep	func = 'triangle'
 					fg_color = 'white'
 					fill = 'foreground'
-					width = '8'
+					width = '6'
 					height = '6'
 					xpos = 'right'
 					ypos = 'center'
-					padding = '0,0,2,0'
+					padding = '0,0,0,0'
 					orientation = 'bottom'
 		/>
 	</drawdata>
-	<drawdata id = 'dropdown_button_hover_left' cache = 'false' resolution = 'y<400'>
+	<drawdata id = 'dropdown_button_idle_rtl' cache = 'false' resolution = 'y<400'>
 		<text	font = 'text_button'
 				text_color = 'color_button'
 				vertical_align = 'center'
@@ -959,25 +1185,24 @@
 					fill = 'gradient'
 					shadow = '0'
 					fg_color = 'darkredborder'
-					gradient_start = 'brightpink'
-					gradient_end = 'darkpink'
+					gradient_start = 'brightred'
+					gradient_end = 'darkred'
 					bevel = '1'
 					bevel_color = 'brightredborder'
-					clip = '0,0,-7,0'
 		/>
 		<drawstep	func = 'triangle'
 					fg_color = 'white'
 					fill = 'foreground'
 					width = '6'
 					height = '6'
-					xpos = 'right'
+					xpos = 'left'
 					ypos = 'center'
-					padding = '0,0,0,0'
+					padding = '2,0,0,0'
 					orientation = 'bottom'
 		/>
 	</drawdata>
 
-	<drawdata id = 'dropdown_button_hover_right' cache = 'false' resolution = 'y>399'>
+	<drawdata id = 'dropdown_button_hover_left' cache = 'false' resolution = 'y>399'>
 		<text	font = 'text_button'
 				text_color = 'color_button'
 				vertical_align = 'center'
@@ -993,7 +1218,7 @@
 					gradient_end = 'darkpink'
 					bevel = '1'
 					bevel_color = 'brightredborder'
-					clip = '-13,0,0,0'
+					clip = '0,0,-13,0'
 		/>
 		<drawstep	func = 'triangle'
 					fg_color = 'white'
@@ -1006,7 +1231,7 @@
 					orientation = 'bottom'
 		/>
 	</drawdata>
-	<drawdata id = 'dropdown_button_hover_right' cache = 'false' resolution = 'y<400'>
+	<drawdata id = 'dropdown_button_hover_left_rtl' cache = 'false' resolution = 'y>399'>
 		<text	font = 'text_button'
 				text_color = 'color_button'
 				vertical_align = 'center'
@@ -1022,23 +1247,22 @@
 					gradient_end = 'darkpink'
 					bevel = '1'
 					bevel_color = 'brightredborder'
-					clip = '-7,0,0,0'
+					clip = '13,0,0,0'
 		/>
 		<drawstep	func = 'triangle'
 					fg_color = 'white'
 					fill = 'foreground'
-					width = '6'
+					width = '8'
 					height = '6'
-					xpos = 'right'
+					xpos = 'left'
 					ypos = 'center'
-					padding = '0,0,0,0'
+					padding = '2,0,2,0'
 					orientation = 'bottom'
 		/>
 	</drawdata>
-
-	<drawdata id = 'dropdown_button_disabled' cache = 'false' resolution = 'y>399'>
+	<drawdata id = 'dropdown_button_hover_left' cache = 'false' resolution = 'y<400'>
 		<text	font = 'text_button'
-				text_color = 'color_button_disabled'
+				text_color = 'color_button'
 				vertical_align = 'center'
 				horizontal_align = 'center'
 		/>
@@ -1047,26 +1271,27 @@
 					stroke = '1'
 					fill = 'gradient'
 					shadow = '0'
-					fg_color = 'shadowcolor'
-					gradient_start = 'darkenedbrightred'
-					gradient_end = 'darkeneddarkred'
+					fg_color = 'darkredborder'
+					gradient_start = 'brightpink'
+					gradient_end = 'darkpink'
 					bevel = '1'
-					bevel_color = 'darkgray'
+					bevel_color = 'brightredborder'
+					clip = '0,0,-7,0'
 		/>
 		<drawstep	func = 'triangle'
-					fg_color = 'darkgray2'
+					fg_color = 'white'
 					fill = 'foreground'
-					width = '8'
+					width = '6'
 					height = '6'
 					xpos = 'right'
 					ypos = 'center'
-					padding = '0,0,2,0'
+					padding = '0,0,0,0'
 					orientation = 'bottom'
 		/>
 	</drawdata>
-	<drawdata id = 'dropdown_button_disabled' cache = 'false' resolution = 'y<400'>
+	<drawdata id = 'dropdown_button_hover_left_rtl' cache = 'false' resolution = 'y<400'>
 		<text	font = 'text_button'
-				text_color = 'color_button_disabled'
+				text_color = 'color_button'
 				vertical_align = 'center'
 				horizontal_align = 'center'
 		/>
@@ -1075,11 +1300,214 @@
 					stroke = '1'
 					fill = 'gradient'
 					shadow = '0'
-					fg_color = 'shadowcolor'
-					gradient_start = 'darkenedbrightred'
-					gradient_end = 'darkeneddarkred'
-					bevel = '1'
-					bevel_color = 'darkgray'
+					fg_color = 'darkredborder'
+					gradient_start = 'brightpink'
+					gradient_end = 'darkpink'
+					bevel = '1'
+					bevel_color = 'brightredborder'
+					clip = '7,0,0,0'
+		/>
+		<drawstep	func = 'triangle'
+					fg_color = 'white'
+					fill = 'foreground'
+					width = '6'
+					height = '6'
+					xpos = 'left'
+					ypos = 'center'
+					padding = '2,0,0,0'
+					orientation = 'bottom'
+		/>
+	</drawdata>
+
+	<drawdata id = 'dropdown_button_hover_right' cache = 'false' resolution = 'y>399'>
+		<text	font = 'text_button'
+				text_color = 'color_button'
+				vertical_align = 'center'
+				horizontal_align = 'center'
+		/>
+		<drawstep	func = 'roundedsq'
+					radius = '5'
+					stroke = '1'
+					fill = 'gradient'
+					shadow = '0'
+					fg_color = 'darkredborder'
+					gradient_start = 'brightpink'
+					gradient_end = 'darkpink'
+					bevel = '1'
+					bevel_color = 'brightredborder'
+					clip = '-13,0,0,0'
+		/>
+		<drawstep	func = 'triangle'
+					fg_color = 'white'
+					fill = 'foreground'
+					width = '8'
+					height = '6'
+					xpos = 'right'
+					ypos = 'center'
+					padding = '0,0,2,0'
+					orientation = 'bottom'
+		/>
+	</drawdata>
+	<drawdata id = 'dropdown_button_hover_right_rtl' cache = 'false' resolution = 'y>399'>
+		<text	font = 'text_button'
+				text_color = 'color_button'
+				vertical_align = 'center'
+				horizontal_align = 'center'
+		/>
+		<drawstep	func = 'roundedsq'
+					radius = '5'
+					stroke = '1'
+					fill = 'gradient'
+					shadow = '0'
+					fg_color = 'darkredborder'
+					gradient_start = 'brightpink'
+					gradient_end = 'darkpink'
+					bevel = '1'
+					bevel_color = 'brightredborder'
+					clip = '0,0,13,0'
+		/>
+		<drawstep	func = 'triangle'
+					fg_color = 'white'
+					fill = 'foreground'
+					width = '8'
+					height = '6'
+					xpos = 'left'
+					ypos = 'center'
+					padding = '2,0,2,0'
+					orientation = 'bottom'
+		/>
+	</drawdata>
+	<drawdata id = 'dropdown_button_hover_right' cache = 'false' resolution = 'y<400'>
+		<text	font = 'text_button'
+				text_color = 'color_button'
+				vertical_align = 'center'
+				horizontal_align = 'center'
+		/>
+		<drawstep	func = 'roundedsq'
+					radius = '5'
+					stroke = '1'
+					fill = 'gradient'
+					shadow = '0'
+					fg_color = 'darkredborder'
+					gradient_start = 'brightpink'
+					gradient_end = 'darkpink'
+					bevel = '1'
+					bevel_color = 'brightredborder'
+					clip = '-7,0,0,0'
+		/>
+		<drawstep	func = 'triangle'
+					fg_color = 'white'
+					fill = 'foreground'
+					width = '6'
+					height = '6'
+					xpos = 'right'
+					ypos = 'center'
+					padding = '0,0,0,0'
+					orientation = 'bottom'
+		/>
+	</drawdata>
+	<drawdata id = 'dropdown_button_hover_right_rtl' cache = 'false' resolution = 'y<400'>
+		<text	font = 'text_button'
+				text_color = 'color_button'
+				vertical_align = 'center'
+				horizontal_align = 'center'
+		/>
+		<drawstep	func = 'roundedsq'
+					radius = '5'
+					stroke = '1'
+					fill = 'gradient'
+					shadow = '0'
+					fg_color = 'darkredborder'
+					gradient_start = 'brightpink'
+					gradient_end = 'darkpink'
+					bevel = '1'
+					bevel_color = 'brightredborder'
+					clip = '0,0,7,0'
+		/>
+		<drawstep	func = 'triangle'
+					fg_color = 'white'
+					fill = 'foreground'
+					width = '6'
+					height = '6'
+					xpos = 'left'
+					ypos = 'center'
+					padding = '0,0,0,0'
+					orientation = 'bottom'
+		/>
+	</drawdata>
+
+	<drawdata id = 'dropdown_button_disabled' cache = 'false' resolution = 'y>399'>
+		<text	font = 'text_button'
+				text_color = 'color_button_disabled'
+				vertical_align = 'center'
+				horizontal_align = 'center'
+		/>
+		<drawstep	func = 'roundedsq'
+					radius = '5'
+					stroke = '1'
+					fill = 'gradient'
+					shadow = '0'
+					fg_color = 'shadowcolor'
+					gradient_start = 'darkenedbrightred'
+					gradient_end = 'darkeneddarkred'
+					bevel = '1'
+					bevel_color = 'darkgray'
+		/>
+		<drawstep	func = 'triangle'
+					fg_color = 'darkgray2'
+					fill = 'foreground'
+					width = '8'
+					height = '6'
+					xpos = 'right'
+					ypos = 'center'
+					padding = '0,0,2,0'
+					orientation = 'bottom'
+		/>
+	</drawdata>
+	<drawdata id = 'dropdown_button_disabled_rtl' cache = 'false' resolution = 'y>399'>
+		<text	font = 'text_button'
+				text_color = 'color_button_disabled'
+				vertical_align = 'center'
+				horizontal_align = 'center'
+		/>
+		<drawstep	func = 'roundedsq'
+					radius = '5'
+					stroke = '1'
+					fill = 'gradient'
+					shadow = '0'
+					fg_color = 'shadowcolor'
+					gradient_start = 'darkenedbrightred'
+					gradient_end = 'darkeneddarkred'
+					bevel = '1'
+					bevel_color = 'darkgray'
+		/>
+		<drawstep	func = 'triangle'
+					fg_color = 'darkgray2'
+					fill = 'foreground'
+					width = '8'
+					height = '6'
+					xpos = 'left'
+					ypos = 'center'
+					padding = '2,0,2,0'
+					orientation = 'bottom'
+		/>
+	</drawdata>
+	<drawdata id = 'dropdown_button_disabled' cache = 'false' resolution = 'y<400'>
+		<text	font = 'text_button'
+				text_color = 'color_button_disabled'
+				vertical_align = 'center'
+				horizontal_align = 'center'
+		/>
+		<drawstep	func = 'roundedsq'
+					radius = '5'
+					stroke = '1'
+					fill = 'gradient'
+					shadow = '0'
+					fg_color = 'shadowcolor'
+					gradient_start = 'darkenedbrightred'
+					gradient_end = 'darkeneddarkred'
+					bevel = '1'
+					bevel_color = 'darkgray'
 		/>
 		<drawstep	func = 'triangle'
 					fg_color = 'darkgray2'
@@ -1092,6 +1520,34 @@
 					orientation = 'bottom'
 		/>
 	</drawdata>
+	<drawdata id = 'dropdown_button_disabled_rtl' cache = 'false' resolution = 'y<400'>
+		<text	font = 'text_button'
+				text_color = 'color_button_disabled'
+				vertical_align = 'center'
+				horizontal_align = 'center'
+		/>
+		<drawstep	func = 'roundedsq'
+					radius = '5'
+					stroke = '1'
+					fill = 'gradient'
+					shadow = '0'
+					fg_color = 'shadowcolor'
+					gradient_start = 'darkenedbrightred'
+					gradient_end = 'darkeneddarkred'
+					bevel = '1'
+					bevel_color = 'darkgray'
+		/>
+		<drawstep	func = 'triangle'
+					fg_color = 'darkgray2'
+					fill = 'foreground'
+					width = '6'
+					height = '6'
+					xpos = 'left'
+					ypos = 'center'
+					padding = '2,0,0,0'
+					orientation = 'bottom'
+		/>
+	</drawdata>
 
 	<drawdata id = 'dropdown_button_pressed_left' cache = 'false' resolution = 'y>399'>
 		<text	font = 'text_button'
@@ -1123,6 +1579,36 @@
 					orientation = 'bottom'
 		/>
 	</drawdata>
+	<drawdata id = 'dropdown_button_pressed_left_rtl' cache = 'false' resolution = 'y>399'>
+		<text	font = 'text_button'
+				text_color = 'color_button'
+				vertical_align = 'center'
+				horizontal_align = 'center'
+		/>
+		<drawstep	func = 'roundedsq'
+					radius = '5'
+					stroke = '1'
+					fill = 'foreground'
+					shadow = '0'
+					factor = '0'
+					fg_color = '120, 40, 16'
+					gradient_start = '255, 0, 0'
+					gradient_end = '255, 0, 0'
+					bevel = '1'
+					bevel_color = 'black'
+					clip = '13,0,0,0'
+		/>
+		<drawstep	func = 'triangle'
+					fg_color = 'white'
+					fill = 'foreground'
+					width = '8'
+					height = '6'
+					xpos = 'left'
+					ypos = 'center'
+					padding = '2,0,2,0'
+					orientation = 'bottom'
+		/>
+	</drawdata>
 	<drawdata id = 'dropdown_button_pressed_left' cache = 'false' resolution = 'y<400'>
 		<text	font = 'text_button'
 				text_color = 'color_button'
@@ -1153,6 +1639,36 @@
 					orientation = 'bottom'
 		/>
 	</drawdata>
+	<drawdata id = 'dropdown_button_pressed_left_rtl' cache = 'false' resolution = 'y<400'>
+		<text	font = 'text_button'
+				text_color = 'color_button'
+				vertical_align = 'center'
+				horizontal_align = 'center'
+		/>
+		<drawstep	func = 'roundedsq'
+					radius = '5'
+					stroke = '1'
+					fill = 'foreground'
+					shadow = '0'
+					factor = '0'
+					fg_color = '120, 40, 16'
+					gradient_start = '255, 0, 0'
+					gradient_end = '255, 0, 0'
+					bevel = '1'
+					bevel_color = 'black'
+					clip = '7,0,0,0'
+		/>
+		<drawstep	func = 'triangle'
+					fg_color = 'white'
+					fill = 'foreground'
+					width = '6'
+					height = '6'
+					xpos = 'left'
+					ypos = 'center'
+					padding = '0,0,0,0'
+					orientation = 'bottom'
+		/>
+	</drawdata>
 
 	<drawdata id = 'dropdown_button_pressed_right' cache = 'false' resolution = 'y>399'>
 		<text	font = 'text_button'
@@ -1184,6 +1700,36 @@
 					orientation = 'bottom'
 		/>
 	</drawdata>
+	<drawdata id = 'dropdown_button_pressed_right_rtl' cache = 'false' resolution = 'y>399'>
+		<text	font = 'text_button'
+				text_color = 'color_button'
+				vertical_align = 'center'
+				horizontal_align = 'center'
+		/>
+		<drawstep	func = 'roundedsq'
+					radius = '5'
+					stroke = '1'
+					fill = 'foreground'
+					shadow = '0'
+					factor = '0'
+					fg_color = '120, 40, 16'
+					gradient_start = '255, 0, 0'
+					gradient_end = '255, 0, 0'
+					bevel = '1'
+					bevel_color = 'black'
+					clip = '0,0,13,0'
+		/>
+		<drawstep	func = 'triangle'
+					fg_color = 'white'
+					fill = 'foreground'
+					width = '8'
+					height = '6'
+					xpos = 'left'
+					ypos = 'center'
+					padding = '2,0,2,0'
+					orientation = 'bottom'
+		/>
+	</drawdata>
 	<drawdata id = 'dropdown_button_pressed_right' cache = 'false' resolution = 'y<400'>
 		<text	font = 'text_button'
 				text_color = 'color_button'
@@ -1210,7 +1756,37 @@
 					height = '6'
 					xpos = 'right'
 					ypos = 'center'
-					padding = '0,0,0,0'
+					padding = '2,0,0,0'
+					orientation = 'bottom'
+		/>
+	</drawdata>
+	<drawdata id = 'dropdown_button_pressed_right_rtl' cache = 'false' resolution = 'y<400'>
+		<text	font = 'text_button'
+				text_color = 'color_button'
+				vertical_align = 'center'
+				horizontal_align = 'center'
+		/>
+		<drawstep	func = 'roundedsq'
+					radius = '5'
+					stroke = '1'
+					fill = 'foreground'
+					shadow = '0'
+					factor = '0'
+					fg_color = '120, 40, 16'
+					gradient_start = '255, 0, 0'
+					gradient_end = '255, 0, 0'
+					bevel = '1'
+					bevel_color = 'black'
+					clip = '0,0,7,0'
+		/>
+		<drawstep	func = 'triangle'
+					fg_color = 'white'
+					fill = 'foreground'
+					width = '6'
+					height = '6'
+					xpos = 'left'
+					ypos = 'center'
+					padding = '2,0,0,0'
 					orientation = 'bottom'
 		/>
 	</drawdata>
@@ -1226,6 +1802,16 @@
 					file = 'checkbox_disabled.bmp'
 		/>
 	</drawdata>
+	<drawdata id = 'checkbox_disabled_selected_rtl' cache = 'false'>
+		<drawstep	func = 'bitmap'
+					file = 'checkbox_disabled.bmp'
+		/>
+		<text	font = 'text_default'
+				text_color = 'color_normal_disabled'
+				vertical_align = 'top'
+				horizontal_align = 'right'
+		/>
+	</drawdata>
 
 	<!-- Disabled checkbox -->
 	<drawdata id = 'checkbox_disabled' cache = 'false'>
@@ -1238,6 +1824,16 @@
 					file = 'checkbox_empty.bmp'
 		/>
 	</drawdata>
+	<drawdata id = 'checkbox_disabled_rtl' cache = 'false'>
+		<drawstep	func = 'bitmap'
+					file = 'checkbox_empty.bmp'
+		/>
+		<text	font = 'text_default'
+				text_color = 'color_normal_disabled'
+				vertical_align = 'top'
+				horizontal_align = 'right'
+		/>
+	</drawdata>
 
 	<!-- Selected checkbox -->
 	<drawdata id = 'checkbox_selected' cache = 'false'>
@@ -1250,6 +1846,16 @@
 					file = 'checkbox.bmp'
 		/>
 	</drawdata>
+	<drawdata id = 'checkbox_selected_rtl' cache = 'false'>
+		<drawstep	func = 'bitmap'
+					file = 'checkbox.bmp'
+		/>
+		<text	font = 'text_default'
+				text_color = 'color_normal'
+				vertical_align = 'top'
+				horizontal_align = 'right'
+		/>
+	</drawdata>
 
 	<!-- Idle checkbox -->
 	<drawdata id = 'checkbox_default' cache = 'false'>
@@ -1262,6 +1868,16 @@
 					file = 'checkbox_empty.bmp'
 		/>
 	</drawdata>
+	<drawdata id = 'checkbox_default_rtl' cache = 'false'>
+		<drawstep	func = 'bitmap'
+					file = 'checkbox_empty.bmp'
+		/>
+		<text	font = 'text_default'
+				text_color = 'color_normal'
+				vertical_align = 'top'
+				horizontal_align = 'right'
+		/>
+	</drawdata>
 
 	<!-- Idle radiobutton -->
 	<drawdata id = 'radiobutton_default' cache = 'false'>
@@ -1274,6 +1890,16 @@
 					file = 'radiobutton_empty.bmp'
 		/>
 	</drawdata>
+	<drawdata id = 'radiobutton_default_rtl' cache = 'false'>
+		<drawstep	func = 'bitmap'
+					file = 'radiobutton_empty.bmp'
+		/>
+		<text	font = 'text_default'
+				text_color = 'color_normal'
+				vertical_align = 'center'
+				horizontal_align = 'right'
+		/>
+	</drawdata>
 
 	<!-- Selected radiobutton -->
 	<drawdata id = 'radiobutton_selected' cache = 'false'>
@@ -1286,6 +1912,16 @@
 					file = 'radiobutton.bmp'
 		/>
 	</drawdata>
+	<drawdata id = 'radiobutton_selected_rtl' cache = 'false'>
+		<drawstep	func = 'bitmap'
+					file = 'radiobutton.bmp'
+		/>
+		<text	font = 'text_default'
+				text_color = 'color_normal'
+				vertical_align = 'center'
+				horizontal_align = 'right'
+		/>
+	</drawdata>
 
 	<!-- Disabled radiobutton -->
 	<drawdata id = 'radiobutton_disabled' cache = 'false'>
@@ -1298,6 +1934,16 @@
 					file = 'radiobutton_empty.bmp'
 		/>
 	</drawdata>
+	<drawdata id = 'radiobutton_disabled_rtl' cache = 'false'>
+		<drawstep	func = 'bitmap'
+					file = 'radiobutton_empty.bmp'
+		/>
+		<text	font = 'text_default'
+				text_color = 'color_normal_disabled'
+				vertical_align = 'center'
+				horizontal_align = 'right'
+		/>
+	</drawdata>
 
 	<!-- Background of the list widget (the games list and the list in the choosers) -->
 	<!-- TODO: Have separate options for the games list (with gradient background) and the list in the choosers (without gradient) -->
diff --git a/gui/themes/scummremastered/remastered_gfx.stx b/gui/themes/scummremastered/remastered_gfx.stx
index 800ebea8ee..b81450967b 100644
--- a/gui/themes/scummremastered/remastered_gfx.stx
+++ b/gui/themes/scummremastered/remastered_gfx.stx
@@ -601,6 +601,44 @@
 				horizontal_align = 'left'
 		/>
 	</drawdata>
+	<drawdata id = 'popup_idle_rtl' cache = 'false' resolution = 'y<400'>
+		<drawstep	func = 'roundedsq'
+					radius = '5'
+					stroke = '1'
+					fg_color = 'lightgray2'
+					fill = 'background'
+					bg_color = 'dialog_background'
+					shadow = '1'
+		/>
+
+		<drawstep	func = 'triangle'
+					bg_color = 'shadowcolor'
+					fill = 'background'
+					width = '7'
+					height = '4'
+					xpos = 'left'
+					ypos = '9'
+					padding = '2, 0, 3, 0'
+					orientation = 'bottom'
+		/>
+
+		<drawstep	func = 'triangle'
+					bg_color = 'shadowcolor'
+					fill = 'background'
+					width = '7'
+					height = '4'
+					xpos = 'left'
+					ypos = '4'
+					padding = '2, 0, 3, 0'
+					orientation = 'top'
+		/>
+
+		<text	font = 'text_default'
+				text_color = 'color_normal'
+				vertical_align = 'center'
+				horizontal_align = 'left'
+		/>
+	</drawdata>
 
 	<!-- Disabled popup -->
 	<drawdata id = 'popup_disabled' cache = 'false' resolution = 'y>399'>
@@ -718,6 +756,44 @@
 				horizontal_align = 'left'
 		/>
 	</drawdata>
+	<drawdata id = 'popup_disabled_rtl' cache = 'false' resolution = 'y<400'>
+		<drawstep	func = 'roundedsq'
+					radius = '5'
+					stroke = '1'
+					fg_color = 'lightgray2'
+					fill = 'background'
+					bg_color = 'dialog_background'
+					shadow = '2'
+		/>
+
+		<drawstep	func = 'triangle'
+					bg_color = 'shadowcolor'
+					fill = 'background'
+					width = '7'
+					height = '4'
+					xpos = 'left'
+					ypos = '9'
+					padding = '0, 0, 3, 0'
+					orientation = 'bottom'
+		/>
+
+		<drawstep	func = 'triangle'
+					bg_color = 'shadowcolor'
+					fill = 'background'
+					width = '7'
+					height = '4'
+					xpos = 'left'
+					ypos = '4'
+					padding = '2, 0, 3, 0'
+					orientation = 'top'
+		/>
+
+		<text	font = 'text_default'
+				text_color = 'color_normal'
+				vertical_align = 'center'
+				horizontal_align = 'right'
+		/>
+	</drawdata>
 
 	<!-- Hovered popup -->
 	<drawdata id = 'popup_hover' cache = 'false' resolution = 'y>399'>
@@ -835,6 +911,44 @@
 				horizontal_align = 'left'
 		/>
 	</drawdata>
+	<drawdata id = 'popup_hover_rtl' cache = 'false' resolution = 'y<400'>
+		<drawstep	func = 'roundedsq'
+					radius = '5'
+					stroke = '1'
+					fg_color = 'lightgray2'
+					fill = 'background'
+					bg_color = 'dialog_background'
+					shadow = '1'
+		/>
+
+		<drawstep	func = 'triangle'
+					bg_color = 'shadowcolor'
+					fill = 'background'
+					width = '7'
+					height = '4'
+					xpos = 'left'
+					ypos = '9'
+					padding = '2, 0, 3, 0'
+					orientation = 'bottom'
+		/>
+
+		<drawstep	func = 'triangle'
+					bg_color = 'shadowcolor'
+					fill = 'background'
+					width = '7'
+					height = '4'
+					xpos = 'left'
+					ypos = '4'
+					padding = '2, 0, 3, 0'
+					orientation = 'top'
+		/>
+
+		<text	font = 'text_default'
+				text_color = 'color_normal'
+				vertical_align = 'center'
+				horizontal_align = 'right'
+		/>
+	</drawdata>
 
 	<!-- Background of the textedit widget -->
 	<drawdata id = 'widget_textedit' cache = 'false'>
@@ -1005,7 +1119,6 @@
 					fill = 'foreground'
 					shadow = '2'
 					fg_color = 'button_idle'
-					clip = '0,0,0,0'
 		/>
 		<drawstep	func = 'triangle'
 					fg_color = 'white'
@@ -1041,6 +1154,29 @@
 					orientation = 'bottom'
 		/>
 	</drawdata>
+	<drawdata id = 'dropdown_button_idle_rtl' cache = 'false' resolution = 'y<400'>
+		<text	font = 'text_button'
+				text_color = 'color_button'
+				vertical_align = 'center'
+				horizontal_align = 'center'
+		/>
+		<drawstep	func = 'roundedsq'
+					radius = '5'
+					fill = 'foreground'
+					shadow = '2'
+					fg_color = 'button_idle'
+		/>
+		<drawstep	func = 'triangle'
+					fg_color = 'white'
+					fill = 'foreground'
+					width = '6'
+					height = '6'
+					xpos = 'left'
+					ypos = 'center'
+					padding = '2,0,2,0'
+					orientation = 'bottom'
+		/>
+	</drawdata>
 
 	<drawdata id = 'dropdown_button_hover_left' cache = 'false' resolution = 'y>399'>
 		<text	font = 'text_button'
@@ -1111,6 +1247,29 @@
 					orientation = 'bottom'
 		/>
 	</drawdata>
+	<drawdata id = 'dropdown_button_hover_left_rtl' cache = 'false' resolution = 'y<400'>
+		<text	font = 'text_button'
+				text_color = 'color_button'
+				vertical_align = 'center'
+				horizontal_align = 'center'
+		/>
+		<drawstep	func = 'roundedsq'
+					radius = '5'
+					fill = 'foreground'
+					fg_color = 'button_hover'
+					clip = '7,0,0,0'
+		/>
+		<drawstep	func = 'triangle'
+					fg_color = 'white'
+					fill = 'foreground'
+					width = '6'
+					height = '6'
+					xpos = 'left'
+					ypos = 'center'
+					padding = '2,0,2,0'
+					orientation = 'bottom'
+		/>
+	</drawdata>
 
 	<drawdata id = 'dropdown_button_hover_right' cache = 'false' resolution = 'y>399'>
 		<text	font = 'text_button'
@@ -1181,6 +1340,29 @@
 					orientation = 'bottom'
 		/>
 	</drawdata>
+	<drawdata id = 'dropdown_button_hover_right_rtl' cache = 'false' resolution = 'y<400'>
+		<text	font = 'text_button'
+				text_color = 'color_button'
+				vertical_align = 'center'
+				horizontal_align = 'center'
+		/>
+		<drawstep	func = 'roundedsq'
+					radius = '5'
+					fill = 'foreground'
+					fg_color = 'button_hover'
+					clip = '0,0,7,0'
+		/>
+		<drawstep	func = 'triangle'
+					fg_color = 'white'
+					fill = 'foreground'
+					width = '6'
+					height = '6'
+					xpos = 'left'
+					ypos = 'center'
+					padding = '0,0,0,0'
+					orientation = 'bottom'
+		/>
+	</drawdata>
 
 	<drawdata id = 'dropdown_button_disabled' cache = 'false' resolution = 'y>399'>
 		<text	font = 'text_button'
@@ -1204,6 +1386,28 @@
 					orientation = 'bottom'
 		/>
 	</drawdata>
+	<drawdata id = 'dropdown_button_disabled_rtl' cache = 'false' resolution = 'y>399'>
+		<text	font = 'text_button'
+				text_color = 'color_button_disabled'
+				vertical_align = 'center'
+				horizontal_align = 'center'
+		/>
+		<drawstep	func = 'roundedsq'
+					radius = '5'
+					fill = 'foreground'
+					fg_color = 'button_disabled'
+		/>
+		<drawstep	func = 'triangle'
+					fg_color = 'darkgray2'
+					fill = 'foreground'
+					width = '8'
+					height = '6'
+					xpos = 'left'
+					ypos = 'center'
+					padding = '2,0,2,0'
+					orientation = 'bottom'
+		/>
+	</drawdata>
 	<drawdata id = 'dropdown_button_disabled' cache = 'false' resolution = 'y<400'>
 		<text	font = 'text_button'
 				text_color = 'color_button_disabled'
@@ -1226,6 +1430,28 @@
 					orientation = 'bottom'
 		/>
 	</drawdata>
+	<drawdata id = 'dropdown_button_disabled_rtl' cache = 'false' resolution = 'y<400'>
+		<text	font = 'text_button'
+				text_color = 'color_button_disabled'
+				vertical_align = 'center'
+				horizontal_align = 'center'
+		/>
+		<drawstep	func = 'roundedsq'
+					radius = '5'
+					fill = 'foreground'
+					fg_color = 'button_disabled'
+		/>
+		<drawstep	func = 'triangle'
+					fg_color = 'darkgray2'
+					fill = 'foreground'
+					width = '6'
+					height = '6'
+					xpos = 'left'
+					ypos = 'center'
+					padding = '2,0,0,0'
+					orientation = 'bottom'
+		/>
+	</drawdata>
 
 	<drawdata id = 'dropdown_button_pressed_left' cache = 'false' resolution = 'y>399'>
 		<text	font = 'text_button'
@@ -1296,6 +1522,29 @@
 					orientation = 'bottom'
 		/>
 	</drawdata>
+	<drawdata id = 'dropdown_button_pressed_left_rtl' cache = 'false' resolution = 'y<400'>
+		<text	font = 'text_button'
+				text_color = 'color_button'
+				vertical_align = 'center'
+				horizontal_align = 'center'
+		/>
+		<drawstep	func = 'roundedsq'
+					radius = '5'
+					fill = 'foreground'
+					fg_color = 'button_pressed'
+					clip = '0,0,-7,0'
+		/>
+		<drawstep	func = 'triangle'
+					fg_color = 'white'
+					fill = 'foreground'
+					width = '6'
+					height = '6'
+					xpos = 'left'
+					ypos = 'center'
+					padding = '2,0,0,0'
+					orientation = 'bottom'
+		/>
+	</drawdata>
 
 	<drawdata id = 'dropdown_button_pressed_right' cache = 'false' resolution = 'y>399'>
 		<text	font = 'text_button'
@@ -1366,6 +1615,29 @@
 					orientation = 'bottom'
 		/>
 	</drawdata>
+	<drawdata id = 'dropdown_button_pressed_right_rtl' cache = 'false' resolution = 'y<400'>
+		<text	font = 'text_button'
+				text_color = 'color_button'
+				vertical_align = 'center'
+				horizontal_align = 'center'
+		/>
+		<drawstep	func = 'roundedsq'
+					radius = '5'
+					fill = 'foreground'
+					fg_color = 'button_pressed'
+					clip = '0,0,7,0'
+		/>
+		<drawstep	func = 'triangle'
+					fg_color = 'white'
+					fill = 'foreground'
+					width = '6'
+					height = '6'
+					xpos = 'left'
+					ypos = 'center'
+					padding = '2,0,0,0'
+					orientation = 'bottom'
+		/>
+	</drawdata>
 
 	<!-- Disabled selected checkbox -->
 	<drawdata id = 'checkbox_disabled_selected' cache = 'false'>


Commit: 4816207f780838197fa8e04eb69f134ef7f109ed
    https://github.com/scummvm/scummvm/commit/4816207f780838197fa8e04eb69f134ef7f109ed
Author: aryanrawlani28 (aryanrawlani007 at gmail.com)
Date: 2020-06-22T00:03:02+02:00

Commit Message:
GUI: RTL: Update theme packages to use new drawsteps for RTL

Changed paths:
    gui/themes/scummclassic.zip
    gui/themes/scummmodern.zip
    gui/themes/scummremastered.zip


diff --git a/gui/themes/scummclassic.zip b/gui/themes/scummclassic.zip
index e70c4c3818..2357240bfe 100644
Binary files a/gui/themes/scummclassic.zip and b/gui/themes/scummclassic.zip differ
diff --git a/gui/themes/scummmodern.zip b/gui/themes/scummmodern.zip
index 51150a3c29..176b92979f 100644
Binary files a/gui/themes/scummmodern.zip and b/gui/themes/scummmodern.zip differ
diff --git a/gui/themes/scummremastered.zip b/gui/themes/scummremastered.zip
index e911233703..4c9a6cc2b5 100644
Binary files a/gui/themes/scummremastered.zip and b/gui/themes/scummremastered.zip differ


Commit: d9fc7c5cba12558061ad13905943939d3b7b676f
    https://github.com/scummvm/scummvm/commit/d9fc7c5cba12558061ad13905943939d3b7b676f
Author: aryanrawlani28 (aryanrawlani007 at gmail.com)
Date: 2020-06-22T00:03:02+02:00

Commit Message:
GUI: Bump theme versions to support RTL features

Changed paths:
    gui/ThemeEngine.h
    gui/themes/scummclassic/THEMERC
    gui/themes/scummmodern/THEMERC
    gui/themes/scummremastered/THEMERC


diff --git a/gui/ThemeEngine.h b/gui/ThemeEngine.h
index 48f9452054..070faa9581 100644
--- a/gui/ThemeEngine.h
+++ b/gui/ThemeEngine.h
@@ -37,7 +37,7 @@
 #include "graphics/pixelformat.h"
 
 
-#define SCUMMVM_THEME_VERSION_STR "SCUMMVM_STX0.8.37"
+#define SCUMMVM_THEME_VERSION_STR "SCUMMVM_STX0.8.38"
 
 class OSystem;
 
diff --git a/gui/themes/scummclassic/THEMERC b/gui/themes/scummclassic/THEMERC
index 0eb6fb5678..fa619609c8 100644
--- a/gui/themes/scummclassic/THEMERC
+++ b/gui/themes/scummclassic/THEMERC
@@ -1 +1 @@
-[SCUMMVM_STX0.8.37:ScummVM Classic Theme:No Author]
+[SCUMMVM_STX0.8.38:ScummVM Classic Theme:No Author]
diff --git a/gui/themes/scummmodern/THEMERC b/gui/themes/scummmodern/THEMERC
index d25408a3ef..e40b7491e0 100644
--- a/gui/themes/scummmodern/THEMERC
+++ b/gui/themes/scummmodern/THEMERC
@@ -1 +1 @@
-[SCUMMVM_STX0.8.37:ScummVM Modern Theme:No Author]
+[SCUMMVM_STX0.8.38:ScummVM Modern Theme:No Author]
diff --git a/gui/themes/scummremastered/THEMERC b/gui/themes/scummremastered/THEMERC
index bc08302ed3..efe31b8cb6 100644
--- a/gui/themes/scummremastered/THEMERC
+++ b/gui/themes/scummremastered/THEMERC
@@ -1 +1 @@
-[SCUMMVM_STX0.8.37:ScummVM Modern Theme Remastered:No Author]
+[SCUMMVM_STX0.8.38:ScummVM Modern Theme Remastered:No Author]


Commit: 531303e482de0a35dd2c38e24e4b1ed25a321b1e
    https://github.com/scummvm/scummvm/commit/531303e482de0a35dd2c38e24e4b1ed25a321b1e
Author: aryanrawlani28 (aryanrawlani007 at gmail.com)
Date: 2020-06-22T00:03:02+02:00

Commit Message:
GUI: Rebuild themes for new theme versions

Changed paths:
    gui/themes/scummclassic.zip
    gui/themes/scummmodern.zip
    gui/themes/scummremastered.zip


diff --git a/gui/themes/scummclassic.zip b/gui/themes/scummclassic.zip
index 2357240bfe..80a99f20e0 100644
Binary files a/gui/themes/scummclassic.zip and b/gui/themes/scummclassic.zip differ
diff --git a/gui/themes/scummmodern.zip b/gui/themes/scummmodern.zip
index 176b92979f..49fad3901e 100644
Binary files a/gui/themes/scummmodern.zip and b/gui/themes/scummmodern.zip differ
diff --git a/gui/themes/scummremastered.zip b/gui/themes/scummremastered.zip
index 4c9a6cc2b5..a1df8d9310 100644
Binary files a/gui/themes/scummremastered.zip and b/gui/themes/scummremastered.zip differ


Commit: 8871d1df5e3ebdd629b8b49ffc0e65e8bcabef11
    https://github.com/scummvm/scummvm/commit/8871d1df5e3ebdd629b8b49ffc0e65e8bcabef11
Author: aryanrawlani28 (aryanrawlani007 at gmail.com)
Date: 2020-06-22T00:03:02+02:00

Commit Message:
GUI: Rebuild fallback theme for supporting RTL

Changed paths:
    gui/themes/default.inc


diff --git a/gui/themes/default.inc b/gui/themes/default.inc
index a51c5d79a2..a95e5e4132 100644
--- a/gui/themes/default.inc
+++ b/gui/themes/default.inc
@@ -290,6 +290,37 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "horizontal_align='left' "
 "/>"
 "</drawdata>"
+"<drawdata id='popup_idle_rtl' cache='false' resolution='y>399'>"
+"<drawstep func='bevelsq' "
+"bevel='2' "
+"fill='none' "
+"/>"
+"<drawstep func='triangle' "
+"fg_color='green' "
+"fill='foreground' "
+"width='10' "
+"height='5' "
+"xpos='left' "
+"ypos='10' "
+"padding='2,0,7,0' "
+"orientation='bottom' "
+"/>"
+"<drawstep func='triangle' "
+"fg_color='green' "
+"fill='foreground' "
+"width='10' "
+"height='5' "
+"xpos='left' "
+"ypos='4' "
+"padding='2,0,7,0' "
+"orientation='top' "
+"/>"
+"<text font='text_default' "
+"text_color='color_normal' "
+"vertical_align='center' "
+"horizontal_align='right' "
+"/>"
+"</drawdata>"
 "<drawdata id='popup_idle' cache='false' resolution='y<400'>"
 "<drawstep func='bevelsq' "
 "bevel='2' "
@@ -321,6 +352,37 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "horizontal_align='left' "
 "/>"
 "</drawdata>"
+"<drawdata id='popup_idle_rtl' cache='false' resolution='y<400'>"
+"<drawstep func='bevelsq' "
+"bevel='2' "
+"fill='none' "
+"/>"
+"<drawstep func='triangle' "
+"fg_color='green' "
+"fill='foreground' "
+"width='7' "
+"height='4' "
+"xpos='left' "
+"ypos='9' "
+"padding='2,0,3,0' "
+"orientation='bottom' "
+"/>"
+"<drawstep func='triangle' "
+"fg_color='green' "
+"fill='foreground' "
+"width='7' "
+"height='4' "
+"xpos='left' "
+"ypos='4' "
+"padding='2,0,3,0' "
+"orientation='top' "
+"/>"
+"<text font='text_default' "
+"text_color='color_normal' "
+"vertical_align='center' "
+"horizontal_align='right' "
+"/>"
+"</drawdata>"
 "<drawdata id='popup_disabled' cache='false' resolution='y>399'>"
 "<drawstep func='bevelsq' "
 "bevel='2' "
@@ -352,6 +414,37 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "horizontal_align='left' "
 "/>"
 "</drawdata>"
+"<drawdata id='popup_disabled_rtl' cache='false' resolution='y>399'>"
+"<drawstep func='bevelsq' "
+"bevel='2' "
+"fill='none' "
+"/>"
+"<drawstep func='triangle' "
+"fg_color='green' "
+"fill='foreground' "
+"width='10' "
+"height='5' "
+"xpos='left' "
+"ypos='10' "
+"padding='2,0,7,0' "
+"orientation='bottom' "
+"/>"
+"<drawstep func='triangle' "
+"fg_color='green' "
+"fill='foreground' "
+"width='10' "
+"height='5' "
+"xpos='left' "
+"ypos='4' "
+"padding='2,0,7,0' "
+"orientation='top' "
+"/>"
+"<text font='text_default' "
+"text_color='color_normal_disabled' "
+"vertical_align='center' "
+"horizontal_align='right' "
+"/>"
+"</drawdata>"
 "<drawdata id='popup_disabled' cache='false' resolution='y<400'>"
 "<drawstep func='bevelsq' "
 "bevel='2' "
@@ -383,6 +476,37 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "horizontal_align='left' "
 "/>"
 "</drawdata>"
+"<drawdata id='popup_disabled_rtl' cache='false' resolution='y<400'>"
+"<drawstep func='bevelsq' "
+"bevel='2' "
+"fill='none' "
+"/>"
+"<drawstep func='triangle' "
+"fg_color='green' "
+"fill='foreground' "
+"width='7' "
+"height='4' "
+"xpos='left' "
+"ypos='9' "
+"padding='0,0,3,0' "
+"orientation='bottom' "
+"/>"
+"<drawstep func='triangle' "
+"fg_color='green' "
+"fill='foreground' "
+"width='7' "
+"height='4' "
+"xpos='left' "
+"ypos='4' "
+"padding='0,0,3,0' "
+"orientation='top' "
+"/>"
+"<text font='text_default' "
+"text_color='color_normal' "
+"vertical_align='center' "
+"horizontal_align='right' "
+"/>"
+"</drawdata>"
 "<drawdata id='popup_hover' cache='false' resolution='y>399'>"
 "<drawstep func='bevelsq' "
 "bevel='2' "
@@ -414,6 +538,37 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "horizontal_align='left' "
 "/>"
 "</drawdata>"
+"<drawdata id='popup_hover_rtl' cache='false' resolution='y>399'>"
+"<drawstep func='bevelsq' "
+"bevel='2' "
+"fill='none' "
+"/>"
+"<drawstep func='triangle' "
+"fg_color='green' "
+"fill='foreground' "
+"width='10' "
+"height='5' "
+"xpos='left' "
+"ypos='10' "
+"padding='2,0,7,0' "
+"orientation='bottom' "
+"/>"
+"<drawstep func='triangle' "
+"fg_color='green' "
+"fill='foreground' "
+"width='10' "
+"height='5' "
+"xpos='left' "
+"ypos='4' "
+"padding='2,0,7,0' "
+"orientation='top' "
+"/>"
+"<text font='text_default' "
+"text_color='color_normal_hover' "
+"vertical_align='center' "
+"horizontal_align='right' "
+"/>"
+"</drawdata>"
 "<drawdata id='popup_hover' cache='false' resolution='y<400'>"
 "<drawstep func='bevelsq' "
 "bevel='2' "
@@ -445,6 +600,37 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "horizontal_align='left' "
 "/>"
 "</drawdata>"
+"<drawdata id='popup_hover_rtl' cache='false' resolution='y<400'>"
+"<drawstep func='bevelsq' "
+"bevel='2' "
+"fill='none' "
+"/>"
+"<drawstep func='triangle' "
+"fg_color='green' "
+"fill='foreground' "
+"width='7' "
+"height='4' "
+"xpos='left' "
+"ypos='9' "
+"padding='2,0,3,0' "
+"orientation='bottom' "
+"/>"
+"<drawstep func='triangle' "
+"fg_color='green' "
+"fill='foreground' "
+"width='7' "
+"height='4' "
+"xpos='left' "
+"ypos='4' "
+"padding='2,0,3,0' "
+"orientation='top' "
+"/>"
+"<text font='text_default' "
+"text_color='color_normal' "
+"vertical_align='center' "
+"horizontal_align='right' "
+"/>"
+"</drawdata>"
 "<drawdata id='widget_textedit' cache='false'>"
 "<drawstep func='bevelsq' "
 "bevel='2' "
@@ -542,6 +728,37 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "padding='0,0,17,1' "
 "/>"
 "</drawdata>"
+"<drawdata id='dropdown_button_idle_rtl' cache='false' resolution='y>399'>"
+"<text font='text_button' "
+"text_color='color_button' "
+"vertical_align='center' "
+"horizontal_align='center' "
+"/>"
+"<drawstep func='bevelsq' "
+"bevel='2' "
+"fill='none' "
+"/>"
+"<drawstep func='triangle' "
+"fg_color='green' "
+"fill='foreground' "
+"width='8' "
+"height='6' "
+"xpos='left' "
+"ypos='center' "
+"padding='2,0,4,0' "
+"orientation='bottom' "
+"/>"
+"<drawstep func='line' "
+"fg_color='lightgrey' "
+"stroke='2' "
+"fill='foreground' "
+"width='0' "
+"height='auto' "
+"xpos='left' "
+"ypos='center' "
+"padding='17,0,0,1' "
+"/>"
+"</drawdata>"
 "<drawdata id='dropdown_button_idle' cache='false' resolution='y<400'>"
 "<text font='text_button' "
 "text_color='color_button' "
@@ -563,6 +780,27 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "orientation='bottom' "
 "/>"
 "</drawdata>"
+"<drawdata id='dropdown_button_idle_rtl' cache='false' resolution='y<400'>"
+"<text font='text_button' "
+"text_color='color_button' "
+"vertical_align='center' "
+"horizontal_align='center' "
+"/>"
+"<drawstep func='bevelsq' "
+"bevel='2' "
+"fill='none' "
+"/>"
+"<drawstep func='triangle' "
+"fg_color='green' "
+"fill='foreground' "
+"width='6' "
+"height='6' "
+"xpos='left' "
+"ypos='center' "
+"padding='2,0,0,0' "
+"orientation='bottom' "
+"/>"
+"</drawdata>"
 "<drawdata id='dropdown_button_hover_left' cache='false' resolution='y>399'>"
 "<text font='text_button' "
 "text_color='color_button_hover' "
@@ -594,6 +832,37 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "padding='0,0,17,1' "
 "/>"
 "</drawdata>"
+"<drawdata id='dropdown_button_hover_left_rtl' cache='false' resolution='y>399'>"
+"<text font='text_button' "
+"text_color='color_button_hover' "
+"vertical_align='center' "
+"horizontal_align='center' "
+"/>"
+"<drawstep func='bevelsq' "
+"bevel='2' "
+"fill='none' "
+"/>"
+"<drawstep func='triangle' "
+"fg_color='green' "
+"fill='foreground' "
+"width='8' "
+"height='6' "
+"xpos='left' "
+"ypos='center' "
+"padding='2,0,4,0' "
+"orientation='bottom' "
+"/>"
+"<drawstep func='line' "
+"fg_color='lightgrey' "
+"stroke='2' "
+"fill='foreground' "
+"width='0' "
+"height='auto' "
+"xpos='left' "
+"ypos='center' "
+"padding='17,0,0,1' "
+"/>"
+"</drawdata>"
 "<drawdata id='dropdown_button_hover_left' cache='false' resolution='y<400'>"
 "<text font='text_button' "
 "text_color='color_button_hover' "
@@ -615,6 +884,27 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "orientation='bottom' "
 "/>"
 "</drawdata>"
+"<drawdata id='dropdown_button_hover_left_rtl' cache='false' resolution='y<400'>"
+"<text font='text_button' "
+"text_color='color_button_hover' "
+"vertical_align='center' "
+"horizontal_align='center' "
+"/>"
+"<drawstep func='bevelsq' "
+"bevel='2' "
+"fill='none' "
+"/>"
+"<drawstep func='triangle' "
+"fg_color='green' "
+"fill='foreground' "
+"width='6' "
+"height='6' "
+"xpos='left' "
+"ypos='center' "
+"padding='2,0,0,0' "
+"orientation='bottom' "
+"/>"
+"</drawdata>"
 "<drawdata id='dropdown_button_hover_right' cache='false' resolution='y>399'>"
 "<text font='text_button' "
 "text_color='color_button' "
@@ -646,6 +936,37 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "padding='0,0,17,1' "
 "/>"
 "</drawdata>"
+"<drawdata id='dropdown_button_hover_right_rtl' cache='false' resolution='y>399'>"
+"<text font='text_button' "
+"text_color='color_button' "
+"vertical_align='center' "
+"horizontal_align='center' "
+"/>"
+"<drawstep func='bevelsq' "
+"bevel='2' "
+"fill='none' "
+"/>"
+"<drawstep func='triangle' "
+"fg_color='green2' "
+"fill='foreground' "
+"width='8' "
+"height='6' "
+"xpos='left' "
+"ypos='center' "
+"padding='2,0,4,0' "
+"orientation='bottom' "
+"/>"
+"<drawstep func='line' "
+"fg_color='lightgrey' "
+"stroke='2' "
+"fill='foreground' "
+"width='0' "
+"height='auto' "
+"xpos='left' "
+"ypos='center' "
+"padding='17,0,0,1' "
+"/>"
+"</drawdata>"
 "<drawdata id='dropdown_button_hover_right' cache='false' resolution='y<400'>"
 "<text font='text_button' "
 "text_color='color_button' "
@@ -667,6 +988,27 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "orientation='bottom' "
 "/>"
 "</drawdata>"
+"<drawdata id='dropdown_button_hover_right_rtl' cache='false' resolution='y<400'>"
+"<text font='text_button' "
+"text_color='color_button' "
+"vertical_align='center' "
+"horizontal_align='center' "
+"/>"
+"<drawstep func='bevelsq' "
+"bevel='2' "
+"fill='none' "
+"/>"
+"<drawstep func='triangle' "
+"fg_color='green2' "
+"fill='foreground' "
+"width='6' "
+"height='6' "
+"xpos='left' "
+"ypos='center' "
+"padding='2,0,0,0' "
+"orientation='bottom' "
+"/>"
+"</drawdata>"
 "<drawdata id='dropdown_button_disabled' cache='false' resolution='y>399'>"
 "<text font='text_button' "
 "text_color='color_button_disabled' "
@@ -698,6 +1040,37 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "padding='0,0,17,1' "
 "/>"
 "</drawdata>"
+"<drawdata id='dropdown_button_disabled_rtl' cache='false' resolution='y>399'>"
+"<text font='text_button' "
+"text_color='color_button_disabled' "
+"vertical_align='center' "
+"horizontal_align='center' "
+"/>"
+"<drawstep func='bevelsq' "
+"bevel='2' "
+"fill='none' "
+"/>"
+"<drawstep func='triangle' "
+"fg_color='lightgrey' "
+"fill='foreground' "
+"width='8' "
+"height='6' "
+"xpos='left' "
+"ypos='center' "
+"padding='2,0,4,0' "
+"orientation='bottom' "
+"/>"
+"<drawstep func='line' "
+"fg_color='lightgrey' "
+"stroke='2' "
+"fill='foreground' "
+"width='0' "
+"height='auto' "
+"xpos='left' "
+"ypos='center' "
+"padding='17,0,0,1' "
+"/>"
+"</drawdata>"
 "<drawdata id='dropdown_button_disabled' cache='false' resolution='y<400'>"
 "<text font='text_button' "
 "text_color='color_button_disabled' "
@@ -719,6 +1092,27 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "orientation='bottom' "
 "/>"
 "</drawdata>"
+"<drawdata id='dropdown_button_disabled_rtl' cache='false' resolution='y<400'>"
+"<text font='text_button' "
+"text_color='color_button_disabled' "
+"vertical_align='center' "
+"horizontal_align='center' "
+"/>"
+"<drawstep func='bevelsq' "
+"bevel='2' "
+"fill='none' "
+"/>"
+"<drawstep func='triangle' "
+"fg_color='lightgrey' "
+"fill='foreground' "
+"width='6' "
+"height='6' "
+"xpos='left' "
+"ypos='center' "
+"padding='2,0,0,0' "
+"orientation='bottom' "
+"/>"
+"</drawdata>"
 "<drawdata id='dropdown_button_pressed_left' cache='false' resolution='y>399'>"
 "<text font='text_button' "
 "text_color='color_alternative_inverted' "
@@ -741,6 +1135,28 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "orientation='bottom' "
 "/>"
 "</drawdata>"
+"<drawdata id='dropdown_button_pressed_left_rtl' cache='false' resolution='y>399'>"
+"<text font='text_button' "
+"text_color='color_alternative_inverted' "
+"vertical_align='center' "
+"horizontal_align='center' "
+"/>"
+"<drawstep func='square' "
+"fill='foreground' "
+"fg_color='green' "
+"clip='18,0,0,0' "
+"/>"
+"<drawstep func='triangle' "
+"fg_color='green' "
+"fill='foreground' "
+"width='8' "
+"height='6' "
+"xpos='left' "
+"ypos='center' "
+"padding='2,0,4,0' "
+"orientation='bottom' "
+"/>"
+"</drawdata>"
 "<drawdata id='dropdown_button_pressed_left' cache='false' resolution='y<400'>"
 "<text font='text_button' "
 "text_color='color_alternative_inverted' "
@@ -763,6 +1179,28 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "orientation='bottom' "
 "/>"
 "</drawdata>"
+"<drawdata id='dropdown_button_pressed_left_rtl' cache='false' resolution='y<400'>"
+"<text font='text_button' "
+"text_color='color_alternative_inverted' "
+"vertical_align='center' "
+"horizontal_align='center' "
+"/>"
+"<drawstep func='square' "
+"fill='foreground' "
+"fg_color='green' "
+"clip='7,0,0,0' "
+"/>"
+"<drawstep func='triangle' "
+"fg_color='green' "
+"fill='foreground' "
+"width='6' "
+"height='6' "
+"xpos='left' "
+"ypos='center' "
+"padding='2,0,0,0' "
+"orientation='bottom' "
+"/>"
+"</drawdata>"
 "<drawdata id='dropdown_button_pressed_right' cache='false' resolution='y>399'>"
 "<text font='text_button' "
 "text_color='color_button' "
@@ -785,6 +1223,28 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "orientation='bottom' "
 "/>"
 "</drawdata>"
+"<drawdata id='dropdown_button_pressed_right_rtl' cache='false' resolution='y>399'>"
+"<text font='text_button' "
+"text_color='color_button' "
+"vertical_align='center' "
+"horizontal_align='center' "
+"/>"
+"<drawstep func='square' "
+"fill='foreground' "
+"fg_color='green' "
+"clip='0,0,16,0' "
+"/>"
+"<drawstep func='triangle' "
+"fg_color='white' "
+"fill='foreground' "
+"width='8' "
+"height='6' "
+"xpos='left' "
+"ypos='center' "
+"padding='2,0,4,0' "
+"orientation='bottom' "
+"/>"
+"</drawdata>"
 "<drawdata id='dropdown_button_pressed_right' cache='false' resolution='y<400'>"
 "<text font='text_button' "
 "text_color='color_button' "
@@ -807,6 +1267,28 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "orientation='bottom' "
 "/>"
 "</drawdata>"
+"<drawdata id='dropdown_button_pressed_right_rtl' cache='false' resolution='y<400'>"
+"<text font='text_button' "
+"text_color='color_button' "
+"vertical_align='center' "
+"horizontal_align='center' "
+"/>"
+"<drawstep func='square' "
+"fill='foreground' "
+"fg_color='green' "
+"clip='0,0,7,0' "
+"/>"
+"<drawstep func='triangle' "
+"fg_color='white' "
+"fill='foreground' "
+"width='6' "
+"height='6' "
+"xpos='left' "
+"ypos='center' "
+"padding='2,0,0,0' "
+"orientation='bottom' "
+"/>"
+"</drawdata>"
 "<drawdata id='checkbox_disabled_selected' cache='false'>"
 "<text font='text_default' "
 "text_color='color_normal_disabled' "
@@ -823,6 +1305,22 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "fg_color='lightgrey' "
 "/>"
 "</drawdata>"
+"<drawdata id='checkbox_disabled_selected_rtl' cache='false'>"
+"<drawstep func='bevelsq' "
+"bevel='2' "
+"fill='none' "
+"/>"
+"<drawstep func='cross' "
+"fill='foreground' "
+"stroke='2' "
+"fg_color='lightgrey' "
+"/>"
+"<text font='text_default' "
+"text_color='color_normal_disabled' "
+"vertical_align='top' "
+"horizontal_align='right' "
+"/>"
+"</drawdata>"
 "<drawdata id='checkbox_disabled' cache='false'>"
 "<text font='text_default' "
 "text_color='color_normal_disabled' "
@@ -834,6 +1332,17 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "fill='none' "
 "/>"
 "</drawdata>"
+"<drawdata id='checkbox_disabled_rtl' cache='false'>"
+"<drawstep func='bevelsq' "
+"bevel='2' "
+"fill='none' "
+"/>"
+"<text font='text_default' "
+"text_color='color_normal_disabled' "
+"vertical_align='top' "
+"horizontal_align='right' "
+"/>"
+"</drawdata>"
 "<drawdata id='checkbox_selected' cache='false'>"
 "<text font='text_default' "
 "text_color='color_normal' "
@@ -850,6 +1359,22 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "fg_color='green' "
 "/>"
 "</drawdata>"
+"<drawdata id='checkbox_selected_rtl' cache='false'>"
+"<drawstep func='bevelsq' "
+"bevel='2' "
+"fill='none' "
+"/>"
+"<drawstep func='cross' "
+"fill='foreground' "
+"stroke='2' "
+"fg_color='green' "
+"/>"
+"<text font='text_default' "
+"text_color='color_normal' "
+"vertical_align='top' "
+"horizontal_align='right' "
+"/>"
+"</drawdata>"
 "<drawdata id='checkbox_default' cache='false'>"
 "<text font='text_default' "
 "text_color='color_normal' "
@@ -861,6 +1386,17 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "fill='none' "
 "/>"
 "</drawdata>"
+"<drawdata id='checkbox_default_rtl' cache='false'>"
+"<drawstep func='bevelsq' "
+"bevel='2' "
+"fill='none' "
+"/>"
+"<text font='text_default' "
+"text_color='color_normal' "
+"vertical_align='top' "
+"horizontal_align='right' "
+"/>"
+"</drawdata>"
 "<drawdata id='radiobutton_default' cache='false'>"
 "<text font='text_default' "
 "text_color='color_normal' "
@@ -877,6 +1413,22 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "ypos='0' "
 "/>"
 "</drawdata>"
+"<drawdata id='radiobutton_default_rtl' cache='false'>"
+"<drawstep func='circle' "
+"width='7' "
+"height='7' "
+"radius='7' "
+"fill='background' "
+"bg_color='darkgrey' "
+"xpos='0' "
+"ypos='0' "
+"/>"
+"<text font='text_default' "
+"text_color='color_normal' "
+"vertical_align='center' "
+"horizontal_align='right' "
+"/>"
+"</drawdata>"
 "<drawdata id='radiobutton_selected' cache='false'>"
 "<text font='text_default' "
 "text_color='color_normal' "
@@ -902,6 +1454,31 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "ypos='2' "
 "/>"
 "</drawdata>"
+"<drawdata id='radiobutton_selected_rtl' cache='false'>"
+"<drawstep func='circle' "
+"width='7' "
+"height='7' "
+"radius='7' "
+"fg_color='darkgrey' "
+"fill='none' "
+"xpos='0' "
+"ypos='0' "
+"/>"
+"<drawstep func='circle' "
+"width='7' "
+"height='7' "
+"radius='5' "
+"fg_color='green' "
+"fill='foreground' "
+"xpos='2' "
+"ypos='2' "
+"/>"
+"<text font='text_default' "
+"text_color='color_normal' "
+"vertical_align='center' "
+"horizontal_align='right' "
+"/>"
+"</drawdata>"
 "<drawdata id='radiobutton_disabled' cache='false'>"
 "<text font='text_default' "
 "text_color='color_normal_disabled' "
@@ -918,6 +1495,22 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "ypos='0' "
 "/>"
 "</drawdata>"
+"<drawdata id='radiobutton_disabled_rtl' cache='false'>"
+"<drawstep func='circle' "
+"width='7' "
+"height='7' "
+"radius='7' "
+"bg_color='lightgrey' "
+"fill='background' "
+"xpos='0' "
+"ypos='0' "
+"/>"
+"<text font='text_default' "
+"text_color='color_normal_disabled' "
+"vertical_align='center' "
+"horizontal_align='right' "
+"/>"
+"</drawdata>"
 "<drawdata id='widget_default' cache='false'>"
 "<drawstep func='bevelsq' "
 "bevel='2' "


Commit: cef4f20eec48d8ec80f29b4d70f16531ff03af10
    https://github.com/scummvm/scummvm/commit/cef4f20eec48d8ec80f29b4d70f16531ff03af10
Author: aryanrawlani28 (aryanrawlani007 at gmail.com)
Date: 2020-06-22T00:03:02+02:00

Commit Message:
GUI: RTL: Support navigating in options dialog

GUI: RTL: Perfect drawing of tabs

Changed paths:
    gui/widgets/tab.cpp
    gui/widgets/tab.h


diff --git a/gui/widgets/tab.cpp b/gui/widgets/tab.cpp
index 0decbc3e03..fa00505d10 100644
--- a/gui/widgets/tab.cpp
+++ b/gui/widgets/tab.cpp
@@ -70,23 +70,19 @@ void TabWidget::init() {
 	int x = _w - _butRP - _butW * 2 - 2;
 	int y = _butTP - _tabHeight;
 
-	String leftArrow = "<";
-	String rightArrow = ">";
-
-	if (g_gui.useRTL()) {							// GUI TODO: Incomplete and possibly incorrect too. Unusable atm.
-		_navLeft = new ButtonWidget(this, x, y, _butW, _butH, rightArrow, nullptr, kCmdLeft);
-		_navRight = new ButtonWidget(this, x + _butW + 2, y, _butW, _butH, leftArrow, nullptr, kCmdRight);
-		_navLeft->setEnabled(true);
-		_navRight->setEnabled(false);
-	} else {
-		_navLeft = new ButtonWidget(this, x, y, _butW, _butH, leftArrow, nullptr, kCmdLeft);
-		_navRight = new ButtonWidget(this, x + _butW + 2, y, _butW, _butH, rightArrow, nullptr, kCmdRight);
-		_navLeft->setEnabled(false);
-		_navRight->setEnabled(true);
-	}
+	String leftArrow = g_gui.useRTL() ? ">" : "<";
+	String rightArrow = g_gui.useRTL() ? "<" : ">";
+
+	_navLeft = new ButtonWidget(this, x, y, _butW, _butH, leftArrow, nullptr, kCmdLeft);
+	_navRight = new ButtonWidget(this, x + _butW + 2, y, _butW, _butH, rightArrow, nullptr, kCmdRight);
+
+	_navLeft->setEnabled(false);
+	_navRight->setEnabled(true);
 
 	_lastRead = -1;
 	_widthTillLastTab = 0;
+	_rtlTabOffset = 0;
+	_rtlSpaceOffset = 0;
 }
 
 TabWidget::~TabWidget() {
@@ -208,6 +204,9 @@ void TabWidget::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
 
 		if (_firstVisibleTab > 0) {
 			setFirstVisible(_firstVisibleTab - 1);
+			if (g_gui.useRTL()){
+				_rtlTabOffset++;
+			}
 		}
 		if (_firstVisibleTab == 0) {
 			_navLeft->setEnabled(false);
@@ -221,6 +220,9 @@ void TabWidget::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
 
 		if (_lastVisibleTab + 1 < (int)_tabs.size()) {
 			setFirstVisible(_firstVisibleTab + 1, false);
+			if (g_gui.useRTL()) {
+				_rtlTabOffset--;
+			}
 		}
 		if (_lastVisibleTab + 1 == (int)_tabs.size()) {
 			_navRight->setEnabled(false);
@@ -373,9 +375,6 @@ void TabWidget::reflowLayout() {
 
 	int x = _w - _butRP - _butW * 2 - 2;
 	int y = _butTP - _tabHeight;
-	if (g_gui.useRTL()) {
-		x = x - g_gui.getOverlayOffset();
-	}
 	_navLeft->resize(x, y, _butW, _butH);
 	_navRight->resize(x + _butW + 2, y, _butW, _butH);
 }
@@ -408,12 +407,12 @@ void TabWidget::drawWidget() {
 			pad = 6;
 		}
 
-		r2.translate(g_system->getOverlayWidth() - _x - _w + pad, 0);
+		r2.translate(g_system->getOverlayWidth() - _x - _w + pad + _rtlSpaceOffset, 0);
 		if (_navButtonsVisible) {
 			r2.translate(_butW - 6, 0);
 		}
 
-		drawTab = _lastVisibleTab - drawTab;
+		drawTab = _lastVisibleTab - drawTab + _rtlTabOffset;
 	}
 
 	g_gui.theme()->drawTab(r2, _tabHeight, widths, tabs, drawTab);
@@ -423,8 +422,14 @@ void TabWidget::draw() {
 	Widget::draw();
 
 	if (_navButtonsVisible) {
+		int oldX = _x;
+		if (g_gui.useRTL()) {
+			_x = _x - g_gui.getOverlayOffset();
+		}
+
 		_navLeft->draw();
 		_navRight->draw();
+		_x = oldX;
 	}
 }
 
@@ -487,6 +492,10 @@ void TabWidget::computeLastVisibleTab(bool adjustFirstIfRoom) {
 			_firstVisibleTab--;
 		}
 	}
+
+	if (g_gui.useRTL() && _navButtonsVisible) {
+		_rtlSpaceOffset = availableWidth;
+	}
 }
 
 } // End of namespace GUI
diff --git a/gui/widgets/tab.h b/gui/widgets/tab.h
index b5e8806a46..34b5a0e1a5 100644
--- a/gui/widgets/tab.h
+++ b/gui/widgets/tab.h
@@ -52,6 +52,8 @@ protected:
 	int _tabHeight;
 	int _minTabWidth;
 	int _widthTillLastTab;
+	int _rtlTabOffset;
+	int _rtlSpaceOffset;
 
 	int _bodyRP, _bodyTP, _bodyLP, _bodyBP;
 	ThemeEngine::DialogBackground _bodyBackgroundType;


Commit: aa802df7aa3335dfd93d4d64fc124ce3cc37e43c
    https://github.com/scummvm/scummvm/commit/aa802df7aa3335dfd93d4d64fc124ce3cc37e43c
Author: aryanrawlani28 (aryanrawlani007 at gmail.com)
Date: 2020-06-22T00:03:02+02:00

Commit Message:
GUI: RTL: Fix lists being overdrawn when tooltip focused

Changed paths:
    gui/widgets/list.cpp


diff --git a/gui/widgets/list.cpp b/gui/widgets/list.cpp
index 40a1b22de4..d925da7b05 100644
--- a/gui/widgets/list.cpp
+++ b/gui/widgets/list.cpp
@@ -572,15 +572,21 @@ void ListWidget::drawWidget() {
 				color = _listColors[_listIndex[pos]];
 		}
 
+		Common::Rect r1(_x + r.left, y, _x + r.right, y + fontHeight - 2);
+
+		if (g_gui.useRTL() && _numberingMode == kListNumberingOff && _scrollBar->isVisible()) {
+			r1.translate(_scrollBarWidth, 0);
+		}
+
 		if (_selectedItem == pos && _editMode) {
 			buffer = _editString;
 			color = _editColor;
 			adjustOffset();
-			g_gui.theme()->drawText(Common::Rect(_x + r.left, y, _x + r.right, y + fontHeight - 2), buffer, _state,
+			g_gui.theme()->drawText(r1, buffer, _state,
 									alignment, inverted, pad, true, ThemeEngine::kFontStyleBold, color);
 		} else {
 			buffer = _list[pos];
-			g_gui.theme()->drawText(Common::Rect(_x + r.left, y, _x + r.right, y + fontHeight - 2), buffer, _state,
+			g_gui.theme()->drawText(r1, buffer, _state,
 									alignment, inverted, pad, true, ThemeEngine::kFontStyleBold, color);
 		}
 	}


Commit: c83e57fc692ec31af671a952d72b4996d03b3149
    https://github.com/scummvm/scummvm/commit/c83e57fc692ec31af671a952d72b4996d03b3149
Author: aryanrawlani28 (aryanrawlani007 at gmail.com)
Date: 2020-06-22T00:03:02+02:00

Commit Message:
GUI: JANITORIAL: Code cleanup, add comments

Changed paths:
    gui/widgets/tab.cpp


diff --git a/gui/widgets/tab.cpp b/gui/widgets/tab.cpp
index fa00505d10..031f92c1f9 100644
--- a/gui/widgets/tab.cpp
+++ b/gui/widgets/tab.cpp
@@ -204,7 +204,7 @@ void TabWidget::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
 
 		if (_firstVisibleTab > 0) {
 			setFirstVisible(_firstVisibleTab - 1);
-			if (g_gui.useRTL()){
+			if (g_gui.useRTL()) {
 				_rtlTabOffset++;
 			}
 		}
@@ -424,12 +424,14 @@ void TabWidget::draw() {
 	if (_navButtonsVisible) {
 		int oldX = _x;
 		if (g_gui.useRTL()) {
+			/** By default, in RTL - everything is flipped and offset by the top stacked dialog's left and right paddings.
+				The navbars are relative to the main dialog, so temporarily subtract the additional offset used */
 			_x = _x - g_gui.getOverlayOffset();
 		}
 
 		_navLeft->draw();
 		_navRight->draw();
-		_x = oldX;
+		_x = oldX;		// Restore the orignal value, so other widgets behave normally
 	}
 }
 


Commit: 312862b54143830bf549eb0f121f4fb8a06a0984
    https://github.com/scummvm/scummvm/commit/312862b54143830bf549eb0f121f4fb8a06a0984
Author: aryanrawlani28 (aryanrawlani007 at gmail.com)
Date: 2020-06-22T00:03:02+02:00

Commit Message:
GUI: RTL: Correctly draw backgrounds of Tabs

Changed paths:
    gui/ThemeEngine.cpp
    gui/ThemeEngine.h
    gui/widgets/tab.cpp
    gui/widgets/tab.h


diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp
index 818adb7de7..3765f00fe8 100644
--- a/gui/ThemeEngine.cpp
+++ b/gui/ThemeEngine.cpp
@@ -1245,13 +1245,19 @@ void ThemeEngine::drawWidgetBackground(const Common::Rect &r, WidgetBackground b
 }
 
 void ThemeEngine::drawTab(const Common::Rect &r, int tabHeight, const Common::Array<int> &tabWidths,
-                          const Common::Array<Common::String> &tabs, int active) {
+                          const Common::Array<Common::String> &tabs, int active, bool rtl, int rtlBackgroundOffset) {
 	if (!ready())
 		return;
 
 	assert(tabs.size() == tabWidths.size());
 
-	drawDD(kDDTabBackground, Common::Rect(r.left, r.top, r.right, r.top + tabHeight));
+	if (rtl) {
+		Common::Rect r2 = r;
+		r2.translate(-rtlBackgroundOffset, 0);
+		drawDD(kDDTabBackground, Common::Rect(r2.left, r2.top, r2.right, r2.top + tabHeight));
+	} else {
+		drawDD(kDDTabBackground, Common::Rect(r.left, r.top, r.right, r.top + tabHeight));
+	}
 
 	int width = 0;
 	int activePos = -1;
diff --git a/gui/ThemeEngine.h b/gui/ThemeEngine.h
index 070faa9581..952b9a8d8f 100644
--- a/gui/ThemeEngine.h
+++ b/gui/ThemeEngine.h
@@ -442,7 +442,7 @@ public:
 	                     WidgetStateInfo state = kStateEnabled, bool rtl = false);
 
 	void drawTab(const Common::Rect &r, int tabHeight, const Common::Array<int> &tabWidths,
-	             const Common::Array<Common::String> &tabs, int active);
+	             const Common::Array<Common::String> &tabs, int active, bool rtl = false, int rtlBackgroundOffset = 0);
 
 	void drawScrollbar(const Common::Rect &r, int sliderY, int sliderHeight, ScrollbarState scrollState);
 
diff --git a/gui/widgets/tab.cpp b/gui/widgets/tab.cpp
index 031f92c1f9..d5ca1f880f 100644
--- a/gui/widgets/tab.cpp
+++ b/gui/widgets/tab.cpp
@@ -83,6 +83,7 @@ void TabWidget::init() {
 	_widthTillLastTab = 0;
 	_rtlTabOffset = 0;
 	_rtlSpaceOffset = 0;
+	_rtlBackgroundOffset = 0;
 }
 
 TabWidget::~TabWidget() {
@@ -411,11 +412,12 @@ void TabWidget::drawWidget() {
 		if (_navButtonsVisible) {
 			r2.translate(_butW - 6, 0);
 		}
+		_rtlBackgroundOffset = ABS(this->getWidth() - _widthTillLastTab);
 
 		drawTab = _lastVisibleTab - drawTab + _rtlTabOffset;
 	}
 
-	g_gui.theme()->drawTab(r2, _tabHeight, widths, tabs, drawTab);
+	g_gui.theme()->drawTab(r2, _tabHeight, widths, tabs, drawTab, (g_gui.useRTL() && _useRTL), _rtlBackgroundOffset);
 }
 
 void TabWidget::draw() {
diff --git a/gui/widgets/tab.h b/gui/widgets/tab.h
index 34b5a0e1a5..abe4b2d320 100644
--- a/gui/widgets/tab.h
+++ b/gui/widgets/tab.h
@@ -54,6 +54,7 @@ protected:
 	int _widthTillLastTab;
 	int _rtlTabOffset;
 	int _rtlSpaceOffset;
+	int _rtlBackgroundOffset;
 
 	int _bodyRP, _bodyTP, _bodyLP, _bodyBP;
 	ThemeEngine::DialogBackground _bodyBackgroundType;


Commit: 6fdffcbbec143bedeebec22f9c62dcaf0cf173df
    https://github.com/scummvm/scummvm/commit/6fdffcbbec143bedeebec22f9c62dcaf0cf173df
Author: aryanrawlani28 (aryanrawlani007 at gmail.com)
Date: 2020-06-22T00:03:02+02:00

Commit Message:
GUI: RTL: Add nortl flag to sliders in layout files

Changed paths:
    gui/themes/scummclassic/classic_layout.stx
    gui/themes/scummclassic/classic_layout_lowres.stx
    gui/themes/scummmodern/scummmodern_layout.stx
    gui/themes/scummmodern/scummmodern_layout_lowres.stx
    gui/themes/scummremastered/remastered_layout.stx
    gui/themes/scummremastered/remastered_layout_lowres.stx


diff --git a/gui/themes/scummclassic/classic_layout.stx b/gui/themes/scummclassic/classic_layout.stx
index 6ec39a7023..3ca84afa9e 100644
--- a/gui/themes/scummclassic/classic_layout.stx
+++ b/gui/themes/scummclassic/classic_layout.stx
@@ -266,6 +266,7 @@
 				/>
 				<widget name = 'grKbdMouseSpeedSlider'
 						type = 'Slider'
+						rtl = 'no'
 				/>
 				<widget name = 'grKbdMouseSpeedLabel'
 						type = 'SmallLabel'
@@ -277,6 +278,7 @@
 				/>
 				<widget name = 'grJoystickDeadzoneSlider'
 						type = 'Slider'
+						rtl = 'no'
 				/>
 				<widget name = 'grJoystickDeadzoneLabel'
 						type = 'SmallLabel'
@@ -385,6 +387,7 @@
 				/>
 				<widget name = 'subSubtitleSpeedSlider'
 						type = 'Slider'
+						rtl = 'no'
 				/>
 				<widget name = 'subSubtitleSpeedLabel'
 						type = 'SmallLabel'
@@ -402,6 +405,7 @@
 					/>
 					<widget name = 'vcMusicSlider'
 							type = 'Slider'
+							rtl = 'no'
 					/>
 					<widget name = 'vcMusicLabel'
 							type = 'SmallLabel'
@@ -413,6 +417,7 @@
 					/>
 					<widget name = 'vcSfxSlider'
 							type = 'Slider'
+							rtl = 'no'
 					/>
 					<widget name = 'vcSfxLabel'
 							type = 'SmallLabel'
@@ -424,6 +429,7 @@
 					/>
 					<widget name = 'vcSpeechSlider'
 							type = 'Slider'
+							rtl = 'no'
 					/>
 					<widget name = 'vcSpeechLabel'
 							type = 'SmallLabel'
@@ -469,6 +475,7 @@
 				/>
 				<widget name = 'mcMidiGainSlider'
 						type = 'Slider'
+						rtl = 'no'
 				/>
 				<widget name = 'mcMidiGainLabel'
 						width = '32'
@@ -1252,6 +1259,7 @@
 						/>
 						<widget name = 'vcMusicSlider'
 								type = 'Slider'
+								rtl = 'no'
 						/>
 						<widget name = 'vcMusicLabel'
 								type = 'SmallLabel'
@@ -1263,6 +1271,7 @@
 						/>
 						<widget name = 'vcSfxSlider'
 								type = 'Slider'
+								rtl = 'no'
 						/>
 						<widget name = 'vcSfxLabel'
 								type = 'SmallLabel'
@@ -1274,6 +1283,7 @@
 						/>
 						<widget name = 'vcSpeechSlider'
 								type = 'Slider'
+								rtl = 'no'
 						/>
 						<widget name = 'vcSpeechLabel'
 								type = 'SmallLabel'
@@ -1311,6 +1321,7 @@
 				/>
 				<widget name = 'subSubtitleSpeedSlider'
 						type = 'Slider'
+						rtl = 'no'
 				/>
 				<widget name = 'subSubtitleSpeedLabel'
 						type = 'SmallLabel'
@@ -1360,6 +1371,7 @@
 				/>
 				<widget name = 'VoiceCountSlider'
 					type = 'Slider'
+					rtl = 'no'
 				/>
 				<widget name = 'VoiceCountLabel'
 					width = '32'
@@ -1372,6 +1384,7 @@
 				/>
 				<widget name = 'LevelSlider'
 					type = 'Slider'
+					rtl = 'no'
 				/>
 				<widget name = 'LevelLabel'
 					width = '32'
@@ -1384,6 +1397,7 @@
 				/>
 				<widget name = 'SpeedSlider'
 					type = 'Slider'
+					rtl = 'no'
 				/>
 				<widget name = 'SpeedLabel'
 					width = '32'
@@ -1396,6 +1410,7 @@
 				/>
 				<widget name = 'DepthSlider'
 					type = 'Slider'
+					rtl = 'no'
 				/>
 				<widget name = 'DepthLabel'
 					width = '32'
@@ -1424,6 +1439,7 @@
 				/>
 				<widget name = 'RoomSizeSlider'
 					type = 'Slider'
+					rtl = 'no'
 				/>
 				<widget name = 'RoomSizeLabel'
 					width = '32'
@@ -1436,6 +1452,7 @@
 				/>
 				<widget name = 'DampingSlider'
 					type = 'Slider'
+					rtl = 'no'
 				/>
 				<widget name = 'DampingLabel'
 					width = '32'
@@ -1448,6 +1465,7 @@
 				/>
 				<widget name = 'WidthSlider'
 					type = 'Slider'
+					rtl = 'no'
 				/>
 				<widget name = 'WidthLabel'
 					width = '32'
@@ -1460,6 +1478,7 @@
 				/>
 				<widget name = 'LevelSlider'
 					type = 'Slider'
+					rtl = 'no'
 				/>
 				<widget name = 'LevelLabel'
 					width = '32'
diff --git a/gui/themes/scummclassic/classic_layout_lowres.stx b/gui/themes/scummclassic/classic_layout_lowres.stx
index 1a17d8b251..28110a3b54 100644
--- a/gui/themes/scummclassic/classic_layout_lowres.stx
+++ b/gui/themes/scummclassic/classic_layout_lowres.stx
@@ -263,6 +263,7 @@
 				/>
 				<widget name = 'grKbdMouseSpeedSlider'
 						type = 'Slider'
+						rtl = 'no'
 				/>
 				<widget name = 'grKbdMouseSpeedLabel'
 						type = 'SmallLabel'
@@ -274,6 +275,7 @@
 				/>
 				<widget name = 'grJoystickDeadzoneSlider'
 						type = 'Slider'
+						rtl = 'no'
 				/>
 				<widget name = 'grJoystickDeadzoneLabel'
 						type = 'SmallLabel'
@@ -382,6 +384,7 @@
 				/>
 				<widget name = 'subSubtitleSpeedSlider'
 						type = 'Slider'
+						rtl = 'no'
 				/>
 				<widget name = 'subSubtitleSpeedLabel'
 						type = 'SmallLabel'
@@ -398,6 +401,7 @@
 				/>
 				<widget name = 'vcMusicSlider'
 						type = 'Slider'
+						rtl = 'no'
 				/>
 				<widget name = 'vcMusicLabel'
 						type = 'SmallLabel'
@@ -409,6 +413,7 @@
 				/>
 				<widget name = 'vcSfxSlider'
 						type = 'Slider'
+						rtl = 'no'
 				/>
 				<widget name = 'vcSfxLabel'
 						type = 'SmallLabel'
@@ -420,6 +425,7 @@
 				/>
 				<widget name = 'vcSpeechSlider'
 						type = 'Slider'
+						rtl = 'no'
 				/>
 				<widget name = 'vcSpeechLabel'
 						type = 'SmallLabel'
@@ -465,6 +471,7 @@
 				/>
 				<widget name = 'mcMidiGainSlider'
 						type = 'Slider'
+						rtl = 'no'
 				/>
 				<widget name = 'mcMidiGainLabel'
 						width = '32'
@@ -1261,6 +1268,7 @@
 				/>
 				<widget name = 'vcMusicSlider'
 						type = 'Slider'
+						rtl = 'no'
 				/>
 				<widget name = 'vcMusicLabel'
 						type = 'SmallLabel'
@@ -1272,6 +1280,7 @@
 				/>
 				<widget name = 'vcSfxSlider'
 						type = 'Slider'
+						rtl = 'no'
 				/>
 				<widget name = 'vcSfxLabel'
 						type = 'SmallLabel'
@@ -1283,6 +1292,7 @@
 				/>
 				<widget name = 'vcSpeechSlider'
 						type = 'Slider'
+						rtl = 'no'
 				/>
 				<widget name = 'vcSpeechLabel'
 						type = 'SmallLabel'
@@ -1320,6 +1330,7 @@
 				/>
 				<widget name = 'subSubtitleSpeedSlider'
 						type = 'Slider'
+						rtl = 'no'
 				/>
 				<widget name = 'subSubtitleSpeedLabel'
 						type = 'SmallLabel'
@@ -1369,6 +1380,7 @@
 				/>
 				<widget name = 'VoiceCountSlider'
 					type = 'Slider'
+					rtl = 'no'
 				/>
 				<widget name = 'VoiceCountLabel'
 					width = '32'
@@ -1381,6 +1393,7 @@
 				/>
 				<widget name = 'LevelSlider'
 					type = 'Slider'
+					rtl = 'no'
 				/>
 				<widget name = 'LevelLabel'
 					width = '32'
@@ -1393,6 +1406,7 @@
 				/>
 				<widget name = 'SpeedSlider'
 					type = 'Slider'
+					rtl = 'no'
 				/>
 				<widget name = 'SpeedLabel'
 					width = '32'
@@ -1405,6 +1419,7 @@
 				/>
 				<widget name = 'DepthSlider'
 					type = 'Slider'
+					rtl = 'no'
 				/>
 				<widget name = 'DepthLabel'
 					width = '32'
@@ -1433,6 +1448,7 @@
 				/>
 				<widget name = 'RoomSizeSlider'
 					type = 'Slider'
+					rtl = 'no'
 				/>
 				<widget name = 'RoomSizeLabel'
 					width = '32'
@@ -1445,6 +1461,7 @@
 				/>
 				<widget name = 'DampingSlider'
 					type = 'Slider'
+					rtl = 'no'
 				/>
 				<widget name = 'DampingLabel'
 					width = '32'
@@ -1457,6 +1474,7 @@
 				/>
 				<widget name = 'WidthSlider'
 					type = 'Slider'
+					rtl = 'no'
 				/>
 				<widget name = 'WidthLabel'
 					width = '32'
@@ -1469,6 +1487,7 @@
 				/>
 				<widget name = 'LevelSlider'
 					type = 'Slider'
+					rtl = 'no'
 				/>
 				<widget name = 'LevelLabel'
 					width = '32'
diff --git a/gui/themes/scummmodern/scummmodern_layout.stx b/gui/themes/scummmodern/scummmodern_layout.stx
index 27218aae6e..31be09b3da 100644
--- a/gui/themes/scummmodern/scummmodern_layout.stx
+++ b/gui/themes/scummmodern/scummmodern_layout.stx
@@ -282,6 +282,7 @@
 				/>
 				<widget name = 'grKbdMouseSpeedSlider'
 						type = 'Slider'
+						rtl = 'no'
 				/>
 				<widget name = 'grKbdMouseSpeedLabel'
 						type = 'SmallLabel'
@@ -293,6 +294,7 @@
 				/>
 				<widget name = 'grJoystickDeadzoneSlider'
 						type = 'Slider'
+						rtl = 'no'
 				/>
 				<widget name = 'grJoystickDeadzoneLabel'
 						type = 'SmallLabel'
@@ -401,6 +403,7 @@
 				/>
 				<widget name = 'subSubtitleSpeedSlider'
 						type = 'Slider'
+						rtl = 'no'
 				/>
 				<widget name = 'subSubtitleSpeedLabel'
 						type = 'SmallLabel'
@@ -418,6 +421,7 @@
 					/>
 					<widget name = 'vcMusicSlider'
 							type = 'Slider'
+							rtl = 'no'
 					/>
 					<widget name = 'vcMusicLabel'
 							type = 'SmallLabel'
@@ -429,6 +433,7 @@
 					/>
 					<widget name = 'vcSfxSlider'
 							type = 'Slider'
+							rtl = 'no'
 					/>
 					<widget name = 'vcSfxLabel'
 							type = 'SmallLabel'
@@ -440,6 +445,7 @@
 					/>
 					<widget name = 'vcSpeechSlider'
 							type = 'Slider'
+							rtl = 'no'
 					/>
 					<widget name = 'vcSpeechLabel'
 							type = 'SmallLabel'
@@ -485,6 +491,7 @@
 				/>
 				<widget name = 'mcMidiGainSlider'
 						type = 'Slider'
+						rtl = 'no'
 				/>
 				<widget name = 'mcMidiGainLabel'
 						width = '32'
@@ -1267,6 +1274,7 @@
 						/>
 						<widget name = 'vcMusicSlider'
 								type = 'Slider'
+								rtl = 'no'
 						/>
 						<widget name = 'vcMusicLabel'
 								type = 'SmallLabel'
@@ -1278,6 +1286,7 @@
 						/>
 						<widget name = 'vcSfxSlider'
 								type = 'Slider'
+								rtl = 'no'
 						/>
 						<widget name = 'vcSfxLabel'
 								type = 'SmallLabel'
@@ -1289,6 +1298,7 @@
 						/>
 						<widget name = 'vcSpeechSlider'
 								type = 'Slider'
+								rtl = 'no'
 						/>
 						<widget name = 'vcSpeechLabel'
 								type = 'SmallLabel'
@@ -1326,6 +1336,7 @@
 				/>
 				<widget name = 'subSubtitleSpeedSlider'
 						type = 'Slider'
+						rtl = 'no'
 				/>
 				<widget name = 'subSubtitleSpeedLabel'
 						type = 'SmallLabel'
@@ -1375,6 +1386,7 @@
 				/>
 				<widget name = 'VoiceCountSlider'
 					type = 'Slider'
+					rtl = 'no'
 				/>
 				<widget name = 'VoiceCountLabel'
 					width = '32'
@@ -1387,6 +1399,7 @@
 				/>
 				<widget name = 'LevelSlider'
 					type = 'Slider'
+					rtl = 'no'
 				/>
 				<widget name = 'LevelLabel'
 					width = '32'
@@ -1399,6 +1412,7 @@
 				/>
 				<widget name = 'SpeedSlider'
 					type = 'Slider'
+					rtl = 'no'
 				/>
 				<widget name = 'SpeedLabel'
 					width = '32'
@@ -1411,6 +1425,7 @@
 				/>
 				<widget name = 'DepthSlider'
 					type = 'Slider'
+					rtl = 'no'
 				/>
 				<widget name = 'DepthLabel'
 					width = '32'
@@ -1439,6 +1454,7 @@
 				/>
 				<widget name = 'RoomSizeSlider'
 					type = 'Slider'
+					rtl = 'no'
 				/>
 				<widget name = 'RoomSizeLabel'
 					width = '32'
@@ -1451,6 +1467,7 @@
 				/>
 				<widget name = 'DampingSlider'
 					type = 'Slider'
+					rtl = 'no'
 				/>
 				<widget name = 'DampingLabel'
 					width = '32'
@@ -1463,6 +1480,7 @@
 				/>
 				<widget name = 'WidthSlider'
 					type = 'Slider'
+					rtl = 'no'
 				/>
 				<widget name = 'WidthLabel'
 					width = '32'
@@ -1475,6 +1493,7 @@
 				/>
 				<widget name = 'LevelSlider'
 					type = 'Slider'
+					rtl = 'no'
 				/>
 				<widget name = 'LevelLabel'
 					width = '32'
diff --git a/gui/themes/scummmodern/scummmodern_layout_lowres.stx b/gui/themes/scummmodern/scummmodern_layout_lowres.stx
index 8a2cafc498..2b7fe58fde 100644
--- a/gui/themes/scummmodern/scummmodern_layout_lowres.stx
+++ b/gui/themes/scummmodern/scummmodern_layout_lowres.stx
@@ -261,6 +261,7 @@
 				/>
 				<widget name = 'grKbdMouseSpeedSlider'
 						type = 'Slider'
+						rtl = 'no'
 				/>
 				<widget name = 'grKbdMouseSpeedLabel'
 						type = 'SmallLabel'
@@ -272,6 +273,7 @@
 				/>
 				<widget name = 'grJoystickDeadzoneSlider'
 						type = 'Slider'
+						rtl = 'no'
 				/>
 				<widget name = 'grJoystickDeadzoneLabel'
 						type = 'SmallLabel'
@@ -380,6 +382,7 @@
 				/>
 				<widget name = 'subSubtitleSpeedSlider'
 						type = 'Slider'
+						rtl = 'no'
 				/>
 				<widget name = 'subSubtitleSpeedLabel'
 						type = 'SmallLabel'
@@ -396,6 +399,7 @@
 				/>
 				<widget name = 'vcMusicSlider'
 						type = 'Slider'
+						rtl = 'no'
 				/>
 				<widget name = 'vcMusicLabel'
 						type = 'SmallLabel'
@@ -407,6 +411,7 @@
 				/>
 				<widget name = 'vcSfxSlider'
 						type = 'Slider'
+						rtl = 'no'
 				/>
 				<widget name = 'vcSfxLabel'
 						type = 'SmallLabel'
@@ -418,6 +423,7 @@
 				/>
 				<widget name = 'vcSpeechSlider'
 						type = 'Slider'
+						rtl = 'no'
 				/>
 				<widget name = 'vcSpeechLabel'
 						type = 'SmallLabel'
@@ -463,6 +469,7 @@
 				/>
 				<widget name = 'mcMidiGainSlider'
 						type = 'Slider'
+						rtl = 'no'
 				/>
 				<widget name = 'mcMidiGainLabel'
 						width = '32'
@@ -1259,6 +1266,7 @@
 				/>
 				<widget name = 'vcMusicSlider'
 						type = 'Slider'
+						rtl = 'no'
 				/>
 				<widget name = 'vcMusicLabel'
 						type = 'SmallLabel'
@@ -1270,6 +1278,7 @@
 				/>
 				<widget name = 'vcSfxSlider'
 						type = 'Slider'
+						rtl = 'no'
 				/>
 				<widget name = 'vcSfxLabel'
 						type = 'SmallLabel'
@@ -1281,6 +1290,7 @@
 				/>
 				<widget name = 'vcSpeechSlider'
 						type = 'Slider'
+						rtl = 'no'
 				/>
 				<widget name = 'vcSpeechLabel'
 						type = 'SmallLabel'
@@ -1320,6 +1330,7 @@
 				/>
 				<widget name = 'subSubtitleSpeedSlider'
 						type = 'Slider'
+						rtl = 'no'
 				/>
 				<widget name = 'subSubtitleSpeedLabel'
 						type = 'SmallLabel'
@@ -1369,6 +1380,7 @@
 				/>
 				<widget name = 'VoiceCountSlider'
 					type = 'Slider'
+					rtl = 'no'
 				/>
 				<widget name = 'VoiceCountLabel'
 					width = '32'
@@ -1381,6 +1393,7 @@
 				/>
 				<widget name = 'LevelSlider'
 					type = 'Slider'
+					rtl = 'no'
 				/>
 				<widget name = 'LevelLabel'
 					width = '32'
@@ -1393,6 +1406,7 @@
 				/>
 				<widget name = 'SpeedSlider'
 					type = 'Slider'
+					rtl = 'no'
 				/>
 				<widget name = 'SpeedLabel'
 					width = '32'
@@ -1405,6 +1419,7 @@
 				/>
 				<widget name = 'DepthSlider'
 					type = 'Slider'
+					rtl = 'no'
 				/>
 				<widget name = 'DepthLabel'
 					width = '32'
@@ -1433,6 +1448,7 @@
 				/>
 				<widget name = 'RoomSizeSlider'
 					type = 'Slider'
+					rtl = 'no'
 				/>
 				<widget name = 'RoomSizeLabel'
 					width = '32'
@@ -1445,6 +1461,7 @@
 				/>
 				<widget name = 'DampingSlider'
 					type = 'Slider'
+					rtl = 'no'
 				/>
 				<widget name = 'DampingLabel'
 					width = '32'
@@ -1457,6 +1474,7 @@
 				/>
 				<widget name = 'WidthSlider'
 					type = 'Slider'
+					rtl = 'no'
 				/>
 				<widget name = 'WidthLabel'
 					width = '32'
@@ -1469,6 +1487,7 @@
 				/>
 				<widget name = 'LevelSlider'
 					type = 'Slider'
+					rtl = 'no'
 				/>
 				<widget name = 'LevelLabel'
 					width = '32'
diff --git a/gui/themes/scummremastered/remastered_layout.stx b/gui/themes/scummremastered/remastered_layout.stx
index 27218aae6e..31be09b3da 100644
--- a/gui/themes/scummremastered/remastered_layout.stx
+++ b/gui/themes/scummremastered/remastered_layout.stx
@@ -282,6 +282,7 @@
 				/>
 				<widget name = 'grKbdMouseSpeedSlider'
 						type = 'Slider'
+						rtl = 'no'
 				/>
 				<widget name = 'grKbdMouseSpeedLabel'
 						type = 'SmallLabel'
@@ -293,6 +294,7 @@
 				/>
 				<widget name = 'grJoystickDeadzoneSlider'
 						type = 'Slider'
+						rtl = 'no'
 				/>
 				<widget name = 'grJoystickDeadzoneLabel'
 						type = 'SmallLabel'
@@ -401,6 +403,7 @@
 				/>
 				<widget name = 'subSubtitleSpeedSlider'
 						type = 'Slider'
+						rtl = 'no'
 				/>
 				<widget name = 'subSubtitleSpeedLabel'
 						type = 'SmallLabel'
@@ -418,6 +421,7 @@
 					/>
 					<widget name = 'vcMusicSlider'
 							type = 'Slider'
+							rtl = 'no'
 					/>
 					<widget name = 'vcMusicLabel'
 							type = 'SmallLabel'
@@ -429,6 +433,7 @@
 					/>
 					<widget name = 'vcSfxSlider'
 							type = 'Slider'
+							rtl = 'no'
 					/>
 					<widget name = 'vcSfxLabel'
 							type = 'SmallLabel'
@@ -440,6 +445,7 @@
 					/>
 					<widget name = 'vcSpeechSlider'
 							type = 'Slider'
+							rtl = 'no'
 					/>
 					<widget name = 'vcSpeechLabel'
 							type = 'SmallLabel'
@@ -485,6 +491,7 @@
 				/>
 				<widget name = 'mcMidiGainSlider'
 						type = 'Slider'
+						rtl = 'no'
 				/>
 				<widget name = 'mcMidiGainLabel'
 						width = '32'
@@ -1267,6 +1274,7 @@
 						/>
 						<widget name = 'vcMusicSlider'
 								type = 'Slider'
+								rtl = 'no'
 						/>
 						<widget name = 'vcMusicLabel'
 								type = 'SmallLabel'
@@ -1278,6 +1286,7 @@
 						/>
 						<widget name = 'vcSfxSlider'
 								type = 'Slider'
+								rtl = 'no'
 						/>
 						<widget name = 'vcSfxLabel'
 								type = 'SmallLabel'
@@ -1289,6 +1298,7 @@
 						/>
 						<widget name = 'vcSpeechSlider'
 								type = 'Slider'
+								rtl = 'no'
 						/>
 						<widget name = 'vcSpeechLabel'
 								type = 'SmallLabel'
@@ -1326,6 +1336,7 @@
 				/>
 				<widget name = 'subSubtitleSpeedSlider'
 						type = 'Slider'
+						rtl = 'no'
 				/>
 				<widget name = 'subSubtitleSpeedLabel'
 						type = 'SmallLabel'
@@ -1375,6 +1386,7 @@
 				/>
 				<widget name = 'VoiceCountSlider'
 					type = 'Slider'
+					rtl = 'no'
 				/>
 				<widget name = 'VoiceCountLabel'
 					width = '32'
@@ -1387,6 +1399,7 @@
 				/>
 				<widget name = 'LevelSlider'
 					type = 'Slider'
+					rtl = 'no'
 				/>
 				<widget name = 'LevelLabel'
 					width = '32'
@@ -1399,6 +1412,7 @@
 				/>
 				<widget name = 'SpeedSlider'
 					type = 'Slider'
+					rtl = 'no'
 				/>
 				<widget name = 'SpeedLabel'
 					width = '32'
@@ -1411,6 +1425,7 @@
 				/>
 				<widget name = 'DepthSlider'
 					type = 'Slider'
+					rtl = 'no'
 				/>
 				<widget name = 'DepthLabel'
 					width = '32'
@@ -1439,6 +1454,7 @@
 				/>
 				<widget name = 'RoomSizeSlider'
 					type = 'Slider'
+					rtl = 'no'
 				/>
 				<widget name = 'RoomSizeLabel'
 					width = '32'
@@ -1451,6 +1467,7 @@
 				/>
 				<widget name = 'DampingSlider'
 					type = 'Slider'
+					rtl = 'no'
 				/>
 				<widget name = 'DampingLabel'
 					width = '32'
@@ -1463,6 +1480,7 @@
 				/>
 				<widget name = 'WidthSlider'
 					type = 'Slider'
+					rtl = 'no'
 				/>
 				<widget name = 'WidthLabel'
 					width = '32'
@@ -1475,6 +1493,7 @@
 				/>
 				<widget name = 'LevelSlider'
 					type = 'Slider'
+					rtl = 'no'
 				/>
 				<widget name = 'LevelLabel'
 					width = '32'
diff --git a/gui/themes/scummremastered/remastered_layout_lowres.stx b/gui/themes/scummremastered/remastered_layout_lowres.stx
index 8a2cafc498..2b7fe58fde 100644
--- a/gui/themes/scummremastered/remastered_layout_lowres.stx
+++ b/gui/themes/scummremastered/remastered_layout_lowres.stx
@@ -261,6 +261,7 @@
 				/>
 				<widget name = 'grKbdMouseSpeedSlider'
 						type = 'Slider'
+						rtl = 'no'
 				/>
 				<widget name = 'grKbdMouseSpeedLabel'
 						type = 'SmallLabel'
@@ -272,6 +273,7 @@
 				/>
 				<widget name = 'grJoystickDeadzoneSlider'
 						type = 'Slider'
+						rtl = 'no'
 				/>
 				<widget name = 'grJoystickDeadzoneLabel'
 						type = 'SmallLabel'
@@ -380,6 +382,7 @@
 				/>
 				<widget name = 'subSubtitleSpeedSlider'
 						type = 'Slider'
+						rtl = 'no'
 				/>
 				<widget name = 'subSubtitleSpeedLabel'
 						type = 'SmallLabel'
@@ -396,6 +399,7 @@
 				/>
 				<widget name = 'vcMusicSlider'
 						type = 'Slider'
+						rtl = 'no'
 				/>
 				<widget name = 'vcMusicLabel'
 						type = 'SmallLabel'
@@ -407,6 +411,7 @@
 				/>
 				<widget name = 'vcSfxSlider'
 						type = 'Slider'
+						rtl = 'no'
 				/>
 				<widget name = 'vcSfxLabel'
 						type = 'SmallLabel'
@@ -418,6 +423,7 @@
 				/>
 				<widget name = 'vcSpeechSlider'
 						type = 'Slider'
+						rtl = 'no'
 				/>
 				<widget name = 'vcSpeechLabel'
 						type = 'SmallLabel'
@@ -463,6 +469,7 @@
 				/>
 				<widget name = 'mcMidiGainSlider'
 						type = 'Slider'
+						rtl = 'no'
 				/>
 				<widget name = 'mcMidiGainLabel'
 						width = '32'
@@ -1259,6 +1266,7 @@
 				/>
 				<widget name = 'vcMusicSlider'
 						type = 'Slider'
+						rtl = 'no'
 				/>
 				<widget name = 'vcMusicLabel'
 						type = 'SmallLabel'
@@ -1270,6 +1278,7 @@
 				/>
 				<widget name = 'vcSfxSlider'
 						type = 'Slider'
+						rtl = 'no'
 				/>
 				<widget name = 'vcSfxLabel'
 						type = 'SmallLabel'
@@ -1281,6 +1290,7 @@
 				/>
 				<widget name = 'vcSpeechSlider'
 						type = 'Slider'
+						rtl = 'no'
 				/>
 				<widget name = 'vcSpeechLabel'
 						type = 'SmallLabel'
@@ -1320,6 +1330,7 @@
 				/>
 				<widget name = 'subSubtitleSpeedSlider'
 						type = 'Slider'
+						rtl = 'no'
 				/>
 				<widget name = 'subSubtitleSpeedLabel'
 						type = 'SmallLabel'
@@ -1369,6 +1380,7 @@
 				/>
 				<widget name = 'VoiceCountSlider'
 					type = 'Slider'
+					rtl = 'no'
 				/>
 				<widget name = 'VoiceCountLabel'
 					width = '32'
@@ -1381,6 +1393,7 @@
 				/>
 				<widget name = 'LevelSlider'
 					type = 'Slider'
+					rtl = 'no'
 				/>
 				<widget name = 'LevelLabel'
 					width = '32'
@@ -1393,6 +1406,7 @@
 				/>
 				<widget name = 'SpeedSlider'
 					type = 'Slider'
+					rtl = 'no'
 				/>
 				<widget name = 'SpeedLabel'
 					width = '32'
@@ -1405,6 +1419,7 @@
 				/>
 				<widget name = 'DepthSlider'
 					type = 'Slider'
+					rtl = 'no'
 				/>
 				<widget name = 'DepthLabel'
 					width = '32'
@@ -1433,6 +1448,7 @@
 				/>
 				<widget name = 'RoomSizeSlider'
 					type = 'Slider'
+					rtl = 'no'
 				/>
 				<widget name = 'RoomSizeLabel'
 					width = '32'
@@ -1445,6 +1461,7 @@
 				/>
 				<widget name = 'DampingSlider'
 					type = 'Slider'
+					rtl = 'no'
 				/>
 				<widget name = 'DampingLabel'
 					width = '32'
@@ -1457,6 +1474,7 @@
 				/>
 				<widget name = 'WidthSlider'
 					type = 'Slider'
+					rtl = 'no'
 				/>
 				<widget name = 'WidthLabel'
 					width = '32'
@@ -1469,6 +1487,7 @@
 				/>
 				<widget name = 'LevelSlider'
 					type = 'Slider'
+					rtl = 'no'
 				/>
 				<widget name = 'LevelLabel'
 					width = '32'


Commit: 036927cd2e5b38c0fe0e2fd670d0b18277a07397
    https://github.com/scummvm/scummvm/commit/036927cd2e5b38c0fe0e2fd670d0b18277a07397
Author: aryanrawlani28 (aryanrawlani007 at gmail.com)
Date: 2020-06-22T00:03:02+02:00

Commit Message:
GUI: RTL: Fix consistency issues for draw steps for widgets in gfx files

Changed paths:
    gui/themes/scummclassic/classic_gfx.stx
    gui/themes/scummmodern/scummmodern_gfx.stx
    gui/themes/scummremastered/remastered_gfx.stx


diff --git a/gui/themes/scummclassic/classic_gfx.stx b/gui/themes/scummclassic/classic_gfx.stx
index f42c25aa14..1bfca70587 100644
--- a/gui/themes/scummclassic/classic_gfx.stx
+++ b/gui/themes/scummclassic/classic_gfx.stx
@@ -565,7 +565,7 @@
 					height = '4'
 					xpos = 'left'
 					ypos = '9'
-					padding = '0, 0, 3, 0'
+					padding = '2, 0, 3, 0'
 					orientation = 'bottom'
 		/>
 
@@ -576,7 +576,7 @@
 					height = '4'
 					xpos = 'left'
 					ypos = '4'
-					padding = '0, 0, 3, 0'
+					padding = '2, 0, 3, 0'
 					orientation = 'top'
 		/>
 
@@ -896,7 +896,7 @@
 					height = '6'
 					xpos = 'left'
 					ypos = 'center'
-					padding = '2,0,0,0'
+					padding = '0,0,0,0'
 					orientation = 'bottom'
 		/>
 	</drawdata>
@@ -1001,7 +1001,7 @@
 					height = '6'
 					xpos = 'left'
 					ypos = 'center'
-					padding = '2,0,0,0'
+					padding = '0,0,0,0'
 					orientation = 'bottom'
 		/>
 	</drawdata>
@@ -1106,7 +1106,7 @@
 					height = '6'
 					xpos = 'left'
 					ypos = 'center'
-					padding = '2,0,0,0'
+					padding = '0,0,0,0'
 					orientation = 'bottom'
 		/>
 	</drawdata>
@@ -1211,7 +1211,7 @@
 					height = '6'
 					xpos = 'left'
 					ypos = 'center'
-					padding = '2,0,0,0'
+					padding = '0,0,0,0'
 					orientation = 'bottom'
 		/>
 	</drawdata>
@@ -1300,7 +1300,7 @@
 					height = '6'
 					xpos = 'left'
 					ypos = 'center'
-					padding = '2,0,0,0'
+					padding = '0,0,0,0'
 					orientation = 'bottom'
 		/>
 	</drawdata>
@@ -1389,7 +1389,7 @@
 					height = '6'
 					xpos = 'left'
 					ypos = 'center'
-					padding = '2,0,0,0'
+					padding = '0,0,0,0'
 					orientation = 'bottom'
 		/>
 	</drawdata>
diff --git a/gui/themes/scummmodern/scummmodern_gfx.stx b/gui/themes/scummmodern/scummmodern_gfx.stx
index 2d7a8f6e04..fcd86799ed 100644
--- a/gui/themes/scummmodern/scummmodern_gfx.stx
+++ b/gui/themes/scummmodern/scummmodern_gfx.stx
@@ -631,7 +631,7 @@
 					height = '4'
 					xpos = 'left'
 					ypos = '4'
-					padding = '0, 0, 3, 0'
+					padding = '2, 0, 3, 0'
 					orientation = 'top'
 		/>
 
@@ -1197,7 +1197,7 @@
 					height = '6'
 					xpos = 'left'
 					ypos = 'center'
-					padding = '2,0,0,0'
+					padding = '0,0,0,0'
 					orientation = 'bottom'
 		/>
 	</drawdata>
@@ -1314,7 +1314,7 @@
 					height = '6'
 					xpos = 'left'
 					ypos = 'center'
-					padding = '2,0,0,0'
+					padding = '0,0,0,0'
 					orientation = 'bottom'
 		/>
 	</drawdata>
@@ -1544,7 +1544,7 @@
 					height = '6'
 					xpos = 'left'
 					ypos = 'center'
-					padding = '2,0,0,0'
+					padding = '0,0,0,0'
 					orientation = 'bottom'
 		/>
 	</drawdata>
@@ -1786,7 +1786,7 @@
 					height = '6'
 					xpos = 'left'
 					ypos = 'center'
-					padding = '2,0,0,0'
+					padding = '0,0,0,0'
 					orientation = 'bottom'
 		/>
 	</drawdata>
diff --git a/gui/themes/scummremastered/remastered_gfx.stx b/gui/themes/scummremastered/remastered_gfx.stx
index b81450967b..99e9588f81 100644
--- a/gui/themes/scummremastered/remastered_gfx.stx
+++ b/gui/themes/scummremastered/remastered_gfx.stx
@@ -636,7 +636,7 @@
 		<text	font = 'text_default'
 				text_color = 'color_normal'
 				vertical_align = 'center'
-				horizontal_align = 'left'
+				horizontal_align = 'right'
 		/>
 	</drawdata>
 
@@ -1173,7 +1173,7 @@
 					height = '6'
 					xpos = 'left'
 					ypos = 'center'
-					padding = '2,0,2,0'
+					padding = '0,0,0,0'
 					orientation = 'bottom'
 		/>
 	</drawdata>
@@ -1266,7 +1266,7 @@
 					height = '6'
 					xpos = 'left'
 					ypos = 'center'
-					padding = '2,0,2,0'
+					padding = '0,0,0,0'
 					orientation = 'bottom'
 		/>
 	</drawdata>
@@ -1448,7 +1448,7 @@
 					height = '6'
 					xpos = 'left'
 					ypos = 'center'
-					padding = '2,0,0,0'
+					padding = '0,0,0,0'
 					orientation = 'bottom'
 		/>
 	</drawdata>
@@ -1486,7 +1486,7 @@
 					radius = '5'
 					fill = 'foreground'
 					fg_color = 'button_pressed'
-					clip = '0,0,-13,0'
+					clip = '13,0,0,0'
 		/>
 		<drawstep	func = 'triangle'
 					fg_color = 'white'
@@ -1532,7 +1532,7 @@
 					radius = '5'
 					fill = 'foreground'
 					fg_color = 'button_pressed'
-					clip = '0,0,-7,0'
+					clip = '7,0,0,0'
 		/>
 		<drawstep	func = 'triangle'
 					fg_color = 'white'
@@ -1541,7 +1541,7 @@
 					height = '6'
 					xpos = 'left'
 					ypos = 'center'
-					padding = '2,0,0,0'
+					padding = '0,0,0,0'
 					orientation = 'bottom'
 		/>
 	</drawdata>
@@ -1634,7 +1634,7 @@
 					height = '6'
 					xpos = 'left'
 					ypos = 'center'
-					padding = '2,0,0,0'
+					padding = '0,0,0,0'
 					orientation = 'bottom'
 		/>
 	</drawdata>


Commit: 988f6fa03f331740766ec798d6a7078a86c6e44e
    https://github.com/scummvm/scummvm/commit/988f6fa03f331740766ec798d6a7078a86c6e44e
Author: aryanrawlani28 (aryanrawlani007 at gmail.com)
Date: 2020-06-22T00:03:02+02:00

Commit Message:
GUI: RTL: Rebuild themes for bugfixes and nortl flag for sliders

Changed paths:
    gui/themes/scummclassic.zip
    gui/themes/scummmodern.zip
    gui/themes/scummremastered.zip


diff --git a/gui/themes/scummclassic.zip b/gui/themes/scummclassic.zip
index 80a99f20e0..ee4246432f 100644
Binary files a/gui/themes/scummclassic.zip and b/gui/themes/scummclassic.zip differ
diff --git a/gui/themes/scummmodern.zip b/gui/themes/scummmodern.zip
index 49fad3901e..3c97b41922 100644
Binary files a/gui/themes/scummmodern.zip and b/gui/themes/scummmodern.zip differ
diff --git a/gui/themes/scummremastered.zip b/gui/themes/scummremastered.zip
index a1df8d9310..c7849b04df 100644
Binary files a/gui/themes/scummremastered.zip and b/gui/themes/scummremastered.zip differ


Commit: ef9942479282cc1712cdf8abbe1f2b8d9f1858c1
    https://github.com/scummvm/scummvm/commit/ef9942479282cc1712cdf8abbe1f2b8d9f1858c1
Author: aryanrawlani28 (aryanrawlani007 at gmail.com)
Date: 2020-06-22T00:03:02+02:00

Commit Message:
GUI: RTL: Fix mouse movements for slider when nortl

Changed paths:
    gui/widget.cpp


diff --git a/gui/widget.cpp b/gui/widget.cpp
index aff87098df..0d8591f42d 100644
--- a/gui/widget.cpp
+++ b/gui/widget.cpp
@@ -732,6 +732,9 @@ SliderWidget::SliderWidget(GuiObject *boss, const Common::String &name, const ch
 }
 
 void SliderWidget::handleMouseMoved(int x, int y, int button) {
+	if (g_gui.useRTL() && _useRTL == false) {
+		x = _w - x;		// If internal flipping is off, adjust the mouse to behave as if it were LTR.
+	}
 	if (isEnabled() && _isDragging) {
 		int newValue = posToValue(x);
 		if (newValue < _valueMin)


Commit: b8a9331138a93894f8b16101b4d21495a32c47c7
    https://github.com/scummvm/scummvm/commit/b8a9331138a93894f8b16101b4d21495a32c47c7
Author: aryanrawlani28 (aryanrawlani007 at gmail.com)
Date: 2020-06-22T00:03:02+02:00

Commit Message:
GUI: RTL: Shift to a better way of positioning when dialogs are stacked

Changed paths:
    backends/keymapper/remap-widget.cpp
    gui/widget.cpp
    gui/widgets/scrollbar.cpp
    gui/widgets/tab.cpp


diff --git a/backends/keymapper/remap-widget.cpp b/backends/keymapper/remap-widget.cpp
index 6017cefdd4..9e736bd3f8 100644
--- a/backends/keymapper/remap-widget.cpp
+++ b/backends/keymapper/remap-widget.cpp
@@ -108,7 +108,6 @@ void RemapWidget::reflowActionWidgets() {
 	int labelWidth = getWidth() - (spacing + keyButtonWidth + spacing);
 	labelWidth = MAX(0, labelWidth);
 
-	int xOffset = g_gui.getOverlayOffset();
 	uint textYOff = (buttonHeight - kLineHeight) / 2;
 
 	uint y = spacing;
@@ -131,9 +130,6 @@ void RemapWidget::reflowActionWidgets() {
 				int descriptionWidth = getWidth() - x - spacing - resetButtonWidth - spacing;
 				descriptionWidth = MAX(0, descriptionWidth);
 
-				if (g_gui.useRTL()) {
-					x = x - xOffset;
-				}
 				keymapTitle.descriptionText->resize(x, y + textYOff, descriptionWidth, kLineHeight);
 				keymapTitle.resetButton->resize(x + descriptionWidth, y, resetButtonWidth, buttonHeight);
 			}
@@ -143,15 +139,9 @@ void RemapWidget::reflowActionWidgets() {
 
 		x = spacing;
 
-		if (g_gui.useRTL()) {
-			x = x - xOffset;
-		}
 		row.keyButton->resize(x, y, keyButtonWidth, buttonHeight);
 
 		x += keyButtonWidth + spacing;
-		if (g_gui.useRTL()) {
-			x = x + spacing;		// GUI TODO: Some last characters keep getting cut off, but this may be a local testing language issue (i.e for English)
-		}
 		row.actionText->resize(x, y + textYOff, labelWidth, kLineHeight);
 
 		y += buttonHeight + spacing;
diff --git a/gui/widget.cpp b/gui/widget.cpp
index 0d8591f42d..93cb6e228f 100644
--- a/gui/widget.cpp
+++ b/gui/widget.cpp
@@ -114,7 +114,10 @@ void Widget::draw() {
 		if (g_gui.useRTL()) {
 			_x = g_system->getOverlayWidth() - _x - _w;
 
-			if (this->_name.contains("GameOptions") || this->_name.contains("GlobalOptions") || this->_name.contains("Browser")){
+			if (this->_name.contains("GameOptions") || this->_name.contains("GlobalOptions") || this->_name.contains("Browser") || this->_name.empty()) {
+				/** The dialogs named above are the stacked dialogs for which the left+right paddings need to be adjusted for RTL.
+					The _name is empty for some special widgets - like RemapWidgets, NavBars, ScrollBars and they need to be adjusted too.
+				*/
 				_x = _x + g_gui.getOverlayOffset();
 			}
 		}
diff --git a/gui/widgets/scrollbar.cpp b/gui/widgets/scrollbar.cpp
index 0f2c65dc2c..c45b4e0ec5 100644
--- a/gui/widgets/scrollbar.cpp
+++ b/gui/widgets/scrollbar.cpp
@@ -193,9 +193,6 @@ void ScrollBarWidget::drawWidget() {
 	if (_draggingPart != kNoPart)
 		_part = _draggingPart;
 
-	if (g_gui.useRTL() && _useRTL)
-		_x = _x + g_gui.getOverlayOffset();
-
 	ThemeEngine::ScrollbarState state = ThemeEngine::kScrollbarStateNo;
 	if (_numEntries <= _entriesPerPage) {
 		state = ThemeEngine::kScrollbarStateSinglePage;
diff --git a/gui/widgets/tab.cpp b/gui/widgets/tab.cpp
index d5ca1f880f..2b9fc2c463 100644
--- a/gui/widgets/tab.cpp
+++ b/gui/widgets/tab.cpp
@@ -424,16 +424,8 @@ void TabWidget::draw() {
 	Widget::draw();
 
 	if (_navButtonsVisible) {
-		int oldX = _x;
-		if (g_gui.useRTL()) {
-			/** By default, in RTL - everything is flipped and offset by the top stacked dialog's left and right paddings.
-				The navbars are relative to the main dialog, so temporarily subtract the additional offset used */
-			_x = _x - g_gui.getOverlayOffset();
-		}
-
 		_navLeft->draw();
 		_navRight->draw();
-		_x = oldX;		// Restore the orignal value, so other widgets behave normally
 	}
 }
 


Commit: 5d040e804f42139e3554538f6ee9b2781b7b7abe
    https://github.com/scummvm/scummvm/commit/5d040e804f42139e3554538f6ee9b2781b7b7abe
Author: aryanrawlani28 (aryanrawlani007 at gmail.com)
Date: 2020-06-22T00:03:02+02:00

Commit Message:
GUI: RTL: Correctly draw popups with text and fix mouse events

Changed paths:
    gui/widgets/popup.cpp


diff --git a/gui/widgets/popup.cpp b/gui/widgets/popup.cpp
index 8dfa4d6ab3..a338f7d2b1 100644
--- a/gui/widgets/popup.cpp
+++ b/gui/widgets/popup.cpp
@@ -116,9 +116,6 @@ void PopUpDialog::open() {
 	else if (_y + _h >= screenH)
 		_y = screenH - 1 - _h;
 
-	if (g_gui.useRTL())
-		_x = g_system->getOverlayWidth() - _x - _w;
-
 	// TODO - implement scrolling if we had to move the menu, or if there are too many entries
 
 	_lastRead = -1;
@@ -132,8 +129,9 @@ void PopUpDialog::reflowLayout() {
 void PopUpDialog::drawDialog(DrawLayer layerToDraw) {
 	Dialog::drawDialog(layerToDraw);
 
-	if (g_gui.useRTL())
-		_x = _x + g_gui.getOverlayOffset();
+	if (g_gui.useRTL()) {
+		_x = g_system->getOverlayWidth() - _x - _w + g_gui.getOverlayOffset();
+	}
 
 	// Draw the menu border
 	g_gui.theme()->drawWidgetBackground(Common::Rect(_x, _y, _x + _w, _y + _h), ThemeEngine::kWidgetBackgroundPlain);
@@ -300,8 +298,8 @@ void PopUpDialog::clearEntries() {
 
 int PopUpDialog::findItem(int x, int y) const {
 	if (x >= 0 && x < _w && y >= 0 && y < _h) {
-		if (_twoColumns) {							// GUI TODO: Problems with collisions in 2 coloumns.
-			uint entry = (y - 2) / _lineHeight;		//			 GUI Language in Options uses this. Basically, left coloumn highlights right and vice versa.
+		if (_twoColumns) {
+			uint entry = (y - 2) / _lineHeight;
 			if (x > _w / 2) {
 				entry += _entriesPerColumn;
 
@@ -399,8 +397,15 @@ void PopUpDialog::drawMenuEntry(int entry, bool hilite) {
 	Graphics::TextAlign alignment = Graphics::kTextAlignLeft;
 
 	if (g_gui.useRTL()) {
-		r2.translate(-g_gui.getOverlayOffset(), 0);
-		alignment = Graphics::kTextAlignRight;
+		if (_twoColumns) {
+			r1.translate(this->getWidth() - w, 0);
+		}
+
+		r2.left = g_system->getOverlayWidth() - r2.left - w + g_gui.getOverlayOffset();
+		r2.right = r2.left + w;
+
+		alignment = Graphics::kTextAlignRight;		// GUI TODO: Since the text for dropdowns is also drawn here, they must be center aligned in some way.
+
 		_leftPadding = 0;
 	}
 


Commit: 28e2a9e1c4614869620e95b2faa16f08deca96ed
    https://github.com/scummvm/scummvm/commit/28e2a9e1c4614869620e95b2faa16f08deca96ed
Author: aryanrawlani28 (aryanrawlani007 at gmail.com)
Date: 2020-06-22T00:03:02+02:00

Commit Message:
GUI: RTL: Fix uninitialized variable

Changed paths:
    gui/object.cpp
    gui/object.h


diff --git a/gui/object.cpp b/gui/object.cpp
index a7e0f6ce1e..339fbe8972 100644
--- a/gui/object.cpp
+++ b/gui/object.cpp
@@ -30,7 +30,7 @@
 namespace GUI {
 
 GuiObject::GuiObject(const Common::String &name)
-	: _x(-1000), _y(-1000), _w(0), _h(0), _name(name), _firstWidget(nullptr) {
+	: _x(-1000), _y(-1000), _w(0), _h(0), _useRTL(true), _name(name), _firstWidget(nullptr) {
 }
 
 GuiObject::~GuiObject() {
diff --git a/gui/object.h b/gui/object.h
index 6c09e3f00a..8320f4eb7b 100644
--- a/gui/object.h
+++ b/gui/object.h
@@ -71,7 +71,7 @@ protected:
 	Widget		*_firstWidget;
 
 public:
-	GuiObject(int x, int y, int w, int h) : _x(x), _y(y), _w(w), _h(h), _firstWidget(nullptr) { }
+	GuiObject(int x, int y, int w, int h) : _x(x), _y(y), _w(w), _h(h), _useRTL(true), _firstWidget(nullptr) { }
 	GuiObject(const Common::String &name);
 	~GuiObject() override;
 


Commit: 5c334d56ada78c4ba27b33117468193b56e84c99
    https://github.com/scummvm/scummvm/commit/5c334d56ada78c4ba27b33117468193b56e84c99
Author: aryanrawlani28 (aryanrawlani007 at gmail.com)
Date: 2020-06-22T00:03:02+02:00

Commit Message:
GUI: RTL: Fix tabs for smallres and when removed

Changed paths:
    gui/widgets/tab.cpp


diff --git a/gui/widgets/tab.cpp b/gui/widgets/tab.cpp
index 2b9fc2c463..f3ab9b11ee 100644
--- a/gui/widgets/tab.cpp
+++ b/gui/widgets/tab.cpp
@@ -150,6 +150,11 @@ void TabWidget::removeTab(int tabID) {
 		_firstWidget = nullptr;
 	}
 
+	// Remove this tab's width from class variable, which is used to adjust position in RTL based GUI
+	if (g_gui.useRTL()) {
+		_widthTillLastTab -= _tabs[tabID]._tabWidth;
+	}
+
 	// Dispose the widgets in that tab and then the tab itself
 	delete _tabs[tabID].firstWidget;
 	_tabs.remove_at(tabID);
@@ -408,6 +413,14 @@ void TabWidget::drawWidget() {
 			pad = 6;
 		}
 
+		if (g_gui.getOverlayOffset() == 0 && g_system->getOverlayHeight() < 400) {
+			/** When the overlay offset is 0 and overlay height < 400, we have a top stacked dialog with no
+				relative padding and are in lowres mode. Referring to the lowres.stx, the global TabWidget.Tab has
+				a size of 40, we add half of that towards our pad.
+			*/
+			pad += 20;
+		}
+
 		r2.translate(g_system->getOverlayWidth() - _x - _w + pad + _rtlSpaceOffset, 0);
 		if (_navButtonsVisible) {
 			r2.translate(_butW - 6, 0);


Commit: d9f483d311ee2b0b4de62477e450437c291f75c9
    https://github.com/scummvm/scummvm/commit/d9f483d311ee2b0b4de62477e450437c291f75c9
Author: aryanrawlani28 (aryanrawlani007 at gmail.com)
Date: 2020-06-22T00:03:02+02:00

Commit Message:
GUI: RTL: Fix loadgame icons not being displayed

Changed paths:
    gui/widget.cpp


diff --git a/gui/widget.cpp b/gui/widget.cpp
index 93cb6e228f..148df66f49 100644
--- a/gui/widget.cpp
+++ b/gui/widget.cpp
@@ -111,6 +111,8 @@ void Widget::draw() {
 		_x = getAbsX();
 		_y = getAbsY();
 
+		Common::Rect oldClip = g_gui.theme()->swapClipRect(_boss->getClipRect());
+
 		if (g_gui.useRTL()) {
 			_x = g_system->getOverlayWidth() - _x - _w;
 
@@ -120,9 +122,12 @@ void Widget::draw() {
 				*/
 				_x = _x + g_gui.getOverlayOffset();
 			}
-		}
 
-		Common::Rect oldClip = g_gui.theme()->swapClipRect(_boss->getClipRect());
+			Common::Rect r = _boss->getClipRect();
+			r.moveTo(_x, r.top);
+
+			g_gui.theme()->swapClipRect(r);
+		}
 
 		// Draw border
 		if (_flags & WIDGET_BORDER) {


Commit: c2708e350f8ca98fb151d5b0cb379e8e637c2a06
    https://github.com/scummvm/scummvm/commit/c2708e350f8ca98fb151d5b0cb379e8e637c2a06
Author: aryanrawlani28 (aryanrawlani007 at gmail.com)
Date: 2020-06-22T00:03:02+02:00

Commit Message:
GUI: RTL: Change alignment of editable to right in RTL

Changed paths:
    gui/widgets/editable.cpp
    gui/widgets/edittext.cpp


diff --git a/gui/widgets/editable.cpp b/gui/widgets/editable.cpp
index 33c50c757f..ddfb882611 100644
--- a/gui/widgets/editable.cpp
+++ b/gui/widgets/editable.cpp
@@ -289,6 +289,8 @@ void EditableWidget::drawCaret(bool erase) {
 	int x = editRect.left;
 	int y = editRect.top;
 
+	Graphics::TextAlign alignment = Graphics::kTextAlignLeft;
+
 	const int caretOffset = getCaretOffset();
 	x += caretOffset;
 
@@ -298,8 +300,10 @@ void EditableWidget::drawCaret(bool erase) {
 	x += getAbsX();
 	y += getAbsY();
 
-	if (g_gui.useRTL())
+	if (g_gui.useRTL()) {
 		x += (g_system->getOverlayWidth() - _x - _x - _w);
+		alignment = Graphics::kTextAlignRight;
+	}
 
 	g_gui.theme()->drawCaret(Common::Rect(x, y, x + 1, y + editRect.height()), erase);
 
@@ -331,7 +335,7 @@ void EditableWidget::drawCaret(bool erase) {
 		width = MIN(editRect.width() - caretOffset, width);
 		if (width > 0) {
 			g_gui.theme()->drawText(Common::Rect(x, y, x + width, y + editRect.height()), character,
-			                        _state, Graphics::kTextAlignLeft, _inversion, 0, false, _font,
+			                        _state, alignment, _inversion, 0, false, _font,
 			                        ThemeEngine::kFontColorNormal, true, _textDrawableArea);
 		}
 	}
diff --git a/gui/widgets/edittext.cpp b/gui/widgets/edittext.cpp
index ff21b3d3a9..8d20703b2e 100644
--- a/gui/widgets/edittext.cpp
+++ b/gui/widgets/edittext.cpp
@@ -99,9 +99,11 @@ void EditTextWidget::drawWidget() {
 	const Common::Rect &r = Common::Rect(_x + 2 + _leftPadding, _y + 2, _x + _leftPadding + getEditRect().width() + 8, _y + _h);
 	setTextDrawableArea(r);
 
+	Graphics::TextAlign alignment = g_gui.useRTL() ? Graphics::kTextAlignRight : Graphics::kTextAlignLeft;
+
 	g_gui.theme()->drawText(
 			Common::Rect(_x + 2 + _leftPadding, _y + 1, _x + _leftPadding + getEditRect().width() + 2, _y + _h),
-			_editString, _state, Graphics::kTextAlignLeft, ThemeEngine::kTextInversionNone,
+			_editString, _state, alignment, ThemeEngine::kTextInversionNone,
 			-_editScrollOffset, false, _font, ThemeEngine::kFontColorNormal, true, _textDrawableArea);
 }
 


Commit: 17193319b99466dcfcab013e588e923d42a34438
    https://github.com/scummvm/scummvm/commit/17193319b99466dcfcab013e588e923d42a34438
Author: aryanrawlani28 (aryanrawlani007 at gmail.com)
Date: 2020-06-22T00:03:02+02:00

Commit Message:
GUI: RTL: Fix alignment for DropDownButtonWidget

Changed paths:
    gui/widgets/popup.cpp


diff --git a/gui/widgets/popup.cpp b/gui/widgets/popup.cpp
index a338f7d2b1..bf198dba5b 100644
--- a/gui/widgets/popup.cpp
+++ b/gui/widgets/popup.cpp
@@ -404,7 +404,11 @@ void PopUpDialog::drawMenuEntry(int entry, bool hilite) {
 		r2.left = g_system->getOverlayWidth() - r2.left - w + g_gui.getOverlayOffset();
 		r2.right = r2.left + w;
 
-		alignment = Graphics::kTextAlignRight;		// GUI TODO: Since the text for dropdowns is also drawn here, they must be center aligned in some way.
+		if (_boss->getFlags() == 305) {
+			alignment = Graphics::kTextAlignCenter;		// GUI FIXME: This is not a good way to say that I am a DropDownButtonWidget
+		} else {
+			alignment = Graphics::kTextAlignRight;
+		}
 
 		_leftPadding = 0;
 	}


Commit: 6ecc90edf66bb5898875c26ed16fcd1314ee5ee5
    https://github.com/scummvm/scummvm/commit/6ecc90edf66bb5898875c26ed16fcd1314ee5ee5
Author: aryanrawlani28 (aryanrawlani007 at gmail.com)
Date: 2020-06-22T00:03:02+02:00

Commit Message:
GUI: RTL: Implement RTL for lists and numbers

Changed paths:
    gui/widgets/list.cpp


diff --git a/gui/widgets/list.cpp b/gui/widgets/list.cpp
index d925da7b05..fcc04a3b75 100644
--- a/gui/widgets/list.cpp
+++ b/gui/widgets/list.cpp
@@ -554,9 +554,10 @@ void ListWidget::drawWidget() {
 
 		Common::Rect r(getEditRect());
 		int pad = g_gui.useRTL() ? _rightPadding : _leftPadding;
+		int rtlPad = (_x + r.left + _leftPadding) - (_x + _hlLeftPadding);
 
-		// If in numbering mode, we first print a number prefix
-		if (_numberingMode != kListNumberingOff) {
+		// If in numbering mode & not in RTL based GUI, we first print a number prefix
+		if (_numberingMode != kListNumberingOff && g_gui.useRTL() == false) {
 			buffer = Common::String::format("%2d. ", (pos + _numberingMode));
 			g_gui.theme()->drawText(Common::Rect(_x + _hlLeftPadding, y, _x + r.left + _leftPadding, y + fontHeight - 2),
 									buffer, _state, alignment, inverted, _leftPadding, true);
@@ -574,8 +575,14 @@ void ListWidget::drawWidget() {
 
 		Common::Rect r1(_x + r.left, y, _x + r.right, y + fontHeight - 2);
 
-		if (g_gui.useRTL() && _numberingMode == kListNumberingOff && _scrollBar->isVisible()) {
-			r1.translate(_scrollBarWidth, 0);
+		if (g_gui.useRTL()) {
+			if (_scrollBar->isVisible()) {
+				r1.translate(_scrollBarWidth, 0);
+			}
+
+			if (_numberingMode != kListNumberingOff) {
+				r1.translate(-rtlPad, 0);
+			}
 		}
 
 		if (_selectedItem == pos && _editMode) {
@@ -589,6 +596,18 @@ void ListWidget::drawWidget() {
 			g_gui.theme()->drawText(r1, buffer, _state,
 									alignment, inverted, pad, true, ThemeEngine::kFontStyleBold, color);
 		}
+
+		// If in numbering mode & using RTL layout in GUI, we print a number suffix after drawing the text
+		if (_numberingMode != kListNumberingOff && g_gui.useRTL()) {
+			buffer = Common::String::format("%2d. ", (pos + _numberingMode));
+
+			Common::Rect r2 = r1;
+
+			r2.left = r1.right;
+			r2.right = r1.right + rtlPad;
+
+			g_gui.theme()->drawText(r2, buffer, _state, alignment, inverted, _leftPadding, true);
+		}
 	}
 }
 


Commit: 076623d41957bcdf06c6a46a825800bb6ac38eb1
    https://github.com/scummvm/scummvm/commit/076623d41957bcdf06c6a46a825800bb6ac38eb1
Author: aryanrawlani28 (aryanrawlani007 at gmail.com)
Date: 2020-06-22T00:03:02+02:00

Commit Message:
GUI: Remove useless code and comments

Changed paths:
    gui/options.cpp
    gui/saveload-dialog.cpp


diff --git a/gui/options.cpp b/gui/options.cpp
index 65086eb224..aaf3f5b05e 100644
--- a/gui/options.cpp
+++ b/gui/options.cpp
@@ -2914,10 +2914,6 @@ void GlobalOptionsDialog::shiftWidget(Widget *widget, const char *widgetName, in
 	if (!g_gui.xmlEval()->getWidgetData(widgetName, x, y, w, h, _useRTL))
 		warning("%s's position is undefined", widgetName);
 
-	// GUI TODO: I'm not sure what's this being used for. Will this be useful when using navbars?
-	if (g_gui.useRTL())
-		x = g_system->getOverlayWidth() - x - w;
-
 	widget->setPos(x + xOffset, y + yOffset);
 }
 #endif // USE_LIBCURL
diff --git a/gui/saveload-dialog.cpp b/gui/saveload-dialog.cpp
index 853a285aee..2e84f40dd0 100644
--- a/gui/saveload-dialog.cpp
+++ b/gui/saveload-dialog.cpp
@@ -1006,7 +1006,6 @@ void SaveLoadChooserGrid::reflowLayout() {
 
 			if (g_gui.useRTL()) {
 				alignment = Graphics::kTextAlignRight;
-				// GUI TODO: 1st and 3rd row pictures not being displayed.
 			}
 
 			PicButtonWidget *button = new PicButtonWidget(container, dstX, dstY, buttonWidth, buttonHeight, nullptr, buttonCmd);


Commit: 6268c9e8ef501e0464248d1b7968f13d2eb82f1b
    https://github.com/scummvm/scummvm/commit/6268c9e8ef501e0464248d1b7968f13d2eb82f1b
Author: aryanrawlani28 (aryanrawlani007 at gmail.com)
Date: 2020-06-22T00:03:02+02:00

Commit Message:
GUI: RTL: Fix padding for popup disabled in gfx file

Changed paths:
    gui/themes/scummremastered/remastered_gfx.stx


diff --git a/gui/themes/scummremastered/remastered_gfx.stx b/gui/themes/scummremastered/remastered_gfx.stx
index 99e9588f81..577fd82b26 100644
--- a/gui/themes/scummremastered/remastered_gfx.stx
+++ b/gui/themes/scummremastered/remastered_gfx.stx
@@ -773,7 +773,7 @@
 					height = '4'
 					xpos = 'left'
 					ypos = '9'
-					padding = '0, 0, 3, 0'
+					padding = '2, 0, 3, 0'
 					orientation = 'bottom'
 		/>
 


Commit: 92459c1773889c79712e14f9a12be44da5f2ea72
    https://github.com/scummvm/scummvm/commit/92459c1773889c79712e14f9a12be44da5f2ea72
Author: aryanrawlani28 (aryanrawlani007 at gmail.com)
Date: 2020-06-22T00:03:02+02:00

Commit Message:
GUI: RTL: Update Remastered theme for disabled dialog bugfix

Changed paths:
    gui/themes/scummremastered.zip


diff --git a/gui/themes/scummremastered.zip b/gui/themes/scummremastered.zip
index c7849b04df..905bd18f6e 100644
Binary files a/gui/themes/scummremastered.zip and b/gui/themes/scummremastered.zip differ


Commit: 7d4e110255f2c8ea1e0a60cc2fec8075f4def62f
    https://github.com/scummvm/scummvm/commit/7d4e110255f2c8ea1e0a60cc2fec8075f4def62f
Author: aryanrawlani28 (aryanrawlani007 at gmail.com)
Date: 2020-06-22T00:03:02+02:00

Commit Message:
GUI: RTL: Update default theme for all RTL changes

Changed paths:
    gui/themes/default.inc


diff --git a/gui/themes/default.inc b/gui/themes/default.inc
index a95e5e4132..964752b865 100644
--- a/gui/themes/default.inc
+++ b/gui/themes/default.inc
@@ -488,7 +488,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "height='4' "
 "xpos='left' "
 "ypos='9' "
-"padding='0,0,3,0' "
+"padding='2,0,3,0' "
 "orientation='bottom' "
 "/>"
 "<drawstep func='triangle' "
@@ -498,7 +498,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "height='4' "
 "xpos='left' "
 "ypos='4' "
-"padding='0,0,3,0' "
+"padding='2,0,3,0' "
 "orientation='top' "
 "/>"
 "<text font='text_default' "
@@ -797,7 +797,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "height='6' "
 "xpos='left' "
 "ypos='center' "
-"padding='2,0,0,0' "
+"padding='0,0,0,0' "
 "orientation='bottom' "
 "/>"
 "</drawdata>"
@@ -901,7 +901,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "height='6' "
 "xpos='left' "
 "ypos='center' "
-"padding='2,0,0,0' "
+"padding='0,0,0,0' "
 "orientation='bottom' "
 "/>"
 "</drawdata>"
@@ -1005,7 +1005,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "height='6' "
 "xpos='left' "
 "ypos='center' "
-"padding='2,0,0,0' "
+"padding='0,0,0,0' "
 "orientation='bottom' "
 "/>"
 "</drawdata>"
@@ -1109,7 +1109,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "height='6' "
 "xpos='left' "
 "ypos='center' "
-"padding='2,0,0,0' "
+"padding='0,0,0,0' "
 "orientation='bottom' "
 "/>"
 "</drawdata>"
@@ -1197,7 +1197,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "height='6' "
 "xpos='left' "
 "ypos='center' "
-"padding='2,0,0,0' "
+"padding='0,0,0,0' "
 "orientation='bottom' "
 "/>"
 "</drawdata>"
@@ -1285,7 +1285,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "height='6' "
 "xpos='left' "
 "ypos='center' "
-"padding='2,0,0,0' "
+"padding='0,0,0,0' "
 "orientation='bottom' "
 "/>"
 "</drawdata>"
@@ -1751,6 +1751,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "/>"
 "<widget name='grKbdMouseSpeedSlider' "
 "type='Slider' "
+"rtl='no' "
 "/>"
 "<widget name='grKbdMouseSpeedLabel' "
 "type='SmallLabel' "
@@ -1762,6 +1763,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "/>"
 "<widget name='grJoystickDeadzoneSlider' "
 "type='Slider' "
+"rtl='no' "
 "/>"
 "<widget name='grJoystickDeadzoneLabel' "
 "type='SmallLabel' "
@@ -1866,6 +1868,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "/>"
 "<widget name='subSubtitleSpeedSlider' "
 "type='Slider' "
+"rtl='no' "
 "/>"
 "<widget name='subSubtitleSpeedLabel' "
 "type='SmallLabel' "
@@ -1882,6 +1885,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "/>"
 "<widget name='vcMusicSlider' "
 "type='Slider' "
+"rtl='no' "
 "/>"
 "<widget name='vcMusicLabel' "
 "type='SmallLabel' "
@@ -1893,6 +1897,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "/>"
 "<widget name='vcSfxSlider' "
 "type='Slider' "
+"rtl='no' "
 "/>"
 "<widget name='vcSfxLabel' "
 "type='SmallLabel' "
@@ -1904,6 +1909,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "/>"
 "<widget name='vcSpeechSlider' "
 "type='Slider' "
+"rtl='no' "
 "/>"
 "<widget name='vcSpeechLabel' "
 "type='SmallLabel' "
@@ -1948,6 +1954,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "/>"
 "<widget name='mcMidiGainSlider' "
 "type='Slider' "
+"rtl='no' "
 "/>"
 "<widget name='mcMidiGainLabel' "
 "width='32' "
@@ -2699,6 +2706,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "/>"
 "<widget name='vcMusicSlider' "
 "type='Slider' "
+"rtl='no' "
 "/>"
 "<widget name='vcMusicLabel' "
 "type='SmallLabel' "
@@ -2710,6 +2718,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "/>"
 "<widget name='vcSfxSlider' "
 "type='Slider' "
+"rtl='no' "
 "/>"
 "<widget name='vcSfxLabel' "
 "type='SmallLabel' "
@@ -2721,6 +2730,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "/>"
 "<widget name='vcSpeechSlider' "
 "type='Slider' "
+"rtl='no' "
 "/>"
 "<widget name='vcSpeechLabel' "
 "type='SmallLabel' "
@@ -2757,6 +2767,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "/>"
 "<widget name='subSubtitleSpeedSlider' "
 "type='Slider' "
+"rtl='no' "
 "/>"
 "<widget name='subSubtitleSpeedLabel' "
 "type='SmallLabel' "
@@ -2802,6 +2813,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "/>"
 "<widget name='VoiceCountSlider' "
 "type='Slider' "
+"rtl='no' "
 "/>"
 "<widget name='VoiceCountLabel' "
 "width='32' "
@@ -2814,6 +2826,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "/>"
 "<widget name='LevelSlider' "
 "type='Slider' "
+"rtl='no' "
 "/>"
 "<widget name='LevelLabel' "
 "width='32' "
@@ -2826,6 +2839,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "/>"
 "<widget name='SpeedSlider' "
 "type='Slider' "
+"rtl='no' "
 "/>"
 "<widget name='SpeedLabel' "
 "width='32' "
@@ -2838,6 +2852,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "/>"
 "<widget name='DepthSlider' "
 "type='Slider' "
+"rtl='no' "
 "/>"
 "<widget name='DepthLabel' "
 "width='32' "
@@ -2865,6 +2880,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "/>"
 "<widget name='RoomSizeSlider' "
 "type='Slider' "
+"rtl='no' "
 "/>"
 "<widget name='RoomSizeLabel' "
 "width='32' "
@@ -2877,6 +2893,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "/>"
 "<widget name='DampingSlider' "
 "type='Slider' "
+"rtl='no' "
 "/>"
 "<widget name='DampingLabel' "
 "width='32' "
@@ -2889,6 +2906,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "/>"
 "<widget name='WidthSlider' "
 "type='Slider' "
+"rtl='no' "
 "/>"
 "<widget name='WidthLabel' "
 "width='32' "
@@ -2901,6 +2919,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "/>"
 "<widget name='LevelSlider' "
 "type='Slider' "
+"rtl='no' "
 "/>"
 "<widget name='LevelLabel' "
 "width='32' "
@@ -3565,6 +3584,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "/>"
 "<widget name='grKbdMouseSpeedSlider' "
 "type='Slider' "
+"rtl='no' "
 "/>"
 "<widget name='grKbdMouseSpeedLabel' "
 "type='SmallLabel' "
@@ -3576,6 +3596,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "/>"
 "<widget name='grJoystickDeadzoneSlider' "
 "type='Slider' "
+"rtl='no' "
 "/>"
 "<widget name='grJoystickDeadzoneLabel' "
 "type='SmallLabel' "
@@ -3680,6 +3701,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "/>"
 "<widget name='subSubtitleSpeedSlider' "
 "type='Slider' "
+"rtl='no' "
 "/>"
 "<widget name='subSubtitleSpeedLabel' "
 "type='SmallLabel' "
@@ -3695,6 +3717,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "/>"
 "<widget name='vcMusicSlider' "
 "type='Slider' "
+"rtl='no' "
 "/>"
 "<widget name='vcMusicLabel' "
 "type='SmallLabel' "
@@ -3706,6 +3729,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "/>"
 "<widget name='vcSfxSlider' "
 "type='Slider' "
+"rtl='no' "
 "/>"
 "<widget name='vcSfxLabel' "
 "type='SmallLabel' "
@@ -3717,6 +3741,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "/>"
 "<widget name='vcSpeechSlider' "
 "type='Slider' "
+"rtl='no' "
 "/>"
 "<widget name='vcSpeechLabel' "
 "type='SmallLabel' "
@@ -3761,6 +3786,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "/>"
 "<widget name='mcMidiGainSlider' "
 "type='Slider' "
+"rtl='no' "
 "/>"
 "<widget name='mcMidiGainLabel' "
 "width='32' "
@@ -4526,6 +4552,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "/>"
 "<widget name='vcMusicSlider' "
 "type='Slider' "
+"rtl='no' "
 "/>"
 "<widget name='vcMusicLabel' "
 "type='SmallLabel' "
@@ -4537,6 +4564,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "/>"
 "<widget name='vcSfxSlider' "
 "type='Slider' "
+"rtl='no' "
 "/>"
 "<widget name='vcSfxLabel' "
 "type='SmallLabel' "
@@ -4548,6 +4576,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "/>"
 "<widget name='vcSpeechSlider' "
 "type='Slider' "
+"rtl='no' "
 "/>"
 "<widget name='vcSpeechLabel' "
 "type='SmallLabel' "
@@ -4585,6 +4614,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "/>"
 "<widget name='subSubtitleSpeedSlider' "
 "type='Slider' "
+"rtl='no' "
 "/>"
 "<widget name='subSubtitleSpeedLabel' "
 "type='SmallLabel' "
@@ -4630,6 +4660,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "/>"
 "<widget name='VoiceCountSlider' "
 "type='Slider' "
+"rtl='no' "
 "/>"
 "<widget name='VoiceCountLabel' "
 "width='32' "
@@ -4642,6 +4673,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "/>"
 "<widget name='LevelSlider' "
 "type='Slider' "
+"rtl='no' "
 "/>"
 "<widget name='LevelLabel' "
 "width='32' "
@@ -4654,6 +4686,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "/>"
 "<widget name='SpeedSlider' "
 "type='Slider' "
+"rtl='no' "
 "/>"
 "<widget name='SpeedLabel' "
 "width='32' "
@@ -4666,6 +4699,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "/>"
 "<widget name='DepthSlider' "
 "type='Slider' "
+"rtl='no' "
 "/>"
 "<widget name='DepthLabel' "
 "width='32' "
@@ -4693,6 +4727,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "/>"
 "<widget name='RoomSizeSlider' "
 "type='Slider' "
+"rtl='no' "
 "/>"
 "<widget name='RoomSizeLabel' "
 "width='32' "
@@ -4705,6 +4740,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "/>"
 "<widget name='DampingSlider' "
 "type='Slider' "
+"rtl='no' "
 "/>"
 "<widget name='DampingLabel' "
 "width='32' "
@@ -4717,6 +4753,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "/>"
 "<widget name='WidthSlider' "
 "type='Slider' "
+"rtl='no' "
 "/>"
 "<widget name='WidthLabel' "
 "width='32' "
@@ -4729,6 +4766,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "/>"
 "<widget name='LevelSlider' "
 "type='Slider' "
+"rtl='no' "
 "/>"
 "<widget name='LevelLabel' "
 "width='32' "


Commit: 48eb0d095c0bb99bf4d5cf3ee6054994a349b4e8
    https://github.com/scummvm/scummvm/commit/48eb0d095c0bb99bf4d5cf3ee6054994a349b4e8
Author: aryanrawlani28 (aryanrawlani007 at gmail.com)
Date: 2020-06-22T00:03:02+02:00

Commit Message:
GUI: RTL: Remove hardcoded padding for RTL tabs layout

Changed paths:
    gui/widgets/tab.cpp


diff --git a/gui/widgets/tab.cpp b/gui/widgets/tab.cpp
index f3ab9b11ee..2f45635890 100644
--- a/gui/widgets/tab.cpp
+++ b/gui/widgets/tab.cpp
@@ -415,10 +415,10 @@ void TabWidget::drawWidget() {
 
 		if (g_gui.getOverlayOffset() == 0 && g_system->getOverlayHeight() < 400) {
 			/** When the overlay offset is 0 and overlay height < 400, we have a top stacked dialog with no
-				relative padding and are in lowres mode. Referring to the lowres.stx, the global TabWidget.Tab has
-				a size of 40, we add half of that towards our pad.
+				relative padding and are in lowres mode. The minimum size of TabWidget.Tab is in _minTabWidth,
+				we add half of that towards our pad.
 			*/
-			pad += 20;
+			pad += (_minTabWidth / 2);
 		}
 
 		r2.translate(g_system->getOverlayWidth() - _x - _w + pad + _rtlSpaceOffset, 0);


Commit: a832e7f423c52903c7561a8e50d334a92ed36543
    https://github.com/scummvm/scummvm/commit/a832e7f423c52903c7561a8e50d334a92ed36543
Author: aryanrawlani28 (aryanrawlani007 at gmail.com)
Date: 2020-06-22T00:03:02+02:00

Commit Message:
GUI: RTL: Allow switching from one layout to other after selecting languages

GUI: RTL: Add option for forced RTL from ConfMan

Changed paths:
    gui/gui-manager.cpp
    gui/gui-manager.h
    gui/options.cpp


diff --git a/gui/gui-manager.cpp b/gui/gui-manager.cpp
index c9b3c73981..eaaf148beb 100644
--- a/gui/gui-manager.cpp
+++ b/gui/gui-manager.cpp
@@ -81,9 +81,7 @@ GuiManager::GuiManager() : _redrawStatus(kRedrawDisabled), _stateIsSaved(false),
 #ifdef USE_TRANSLATION
 	// Enable translation
 	TransMan.setLanguage(ConfMan.get("gui_language").c_str());
-	if (TransMan.getCurrentLanguage() == "C" && false) {		// GUI TODO: Change this to enable RTL
-		_useRTL = true;
-	}
+	setLanguageRTL();
 #endif // USE_TRANSLATION
 
 #ifdef USE_TTS
@@ -664,6 +662,22 @@ void GuiManager::setLastMousePos(int16 x, int16 y) {
 	_lastMousePosition.time = _system->getMillis(true);
 }
 
+void GuiManager::setLanguageRTL() {
+	if (ConfMan.hasKey("guiRTL")) {
+		_useRTL = ConfMan.getBool("guiRTL");
+		return;
+	}
+#ifdef USE_TRANSLATION
+	Common::String language = TransMan.getCurrentLanguage();
+	if (language.equals("he") || language.equals("C")) {
+		_useRTL = true;
+		return;
+	}
+#endif // USE_TRANSLATION
+
+	_useRTL = false;
+}
+
 void GuiManager::setDialogPaddings(int l, int r) {
 	_topDialogLeftPadding = l;
 	_topDialogRightPadding = r;
diff --git a/gui/gui-manager.h b/gui/gui-manager.h
index 83a4f8bbb6..924cd3bfcf 100644
--- a/gui/gui-manager.h
+++ b/gui/gui-manager.h
@@ -90,6 +90,8 @@ public:
 	int getHeight() const { return _height; }
 
 	bool useRTL() const { return _useRTL; }
+	void setLanguageRTL();
+
 	void setDialogPaddings(int l, int r);
 	int getOverlayOffset() { return _topDialogRightPadding - _topDialogLeftPadding; }
 
diff --git a/gui/options.cpp b/gui/options.cpp
index aaf3f5b05e..5f59b65844 100644
--- a/gui/options.cpp
+++ b/gui/options.cpp
@@ -2297,6 +2297,7 @@ void GlobalOptionsDialog::apply() {
 		ConfMan.set("gui_language", newLang);
 		newCharset = TransMan.getCurrentCharset();
 		isRebuildNeeded = true;
+		g_gui.setLanguageRTL();
 	}
 
 	bool guiUseGameLanguage = _guiLanguageUseGameLanguageCheckbox->getState();


Commit: 12b26cec07c7577e32f4c55670802475288718e8
    https://github.com/scummvm/scummvm/commit/12b26cec07c7577e32f4c55670802475288718e8
Author: aryanrawlani28 (aryanrawlani007 at gmail.com)
Date: 2020-06-22T00:03:02+02:00

Commit Message:
GUI: RTL: Revise numeric layout in predictive dialog and flip them again

Changed paths:
    gui/predictivedialog.cpp


diff --git a/gui/predictivedialog.cpp b/gui/predictivedialog.cpp
index 73abd5a2c1..ab5172b43f 100644
--- a/gui/predictivedialog.cpp
+++ b/gui/predictivedialog.cpp
@@ -72,16 +72,42 @@ PredictiveDialog::PredictiveDialog() : Dialog("Predictive") {
 
 	_button[kCancelAct] =  new ButtonWidget(this, "Predictive.Cancel",  _("Cancel")   , nullptr, kCancelCmd);
 	_button[kOkAct] =      new ButtonWidget(this, "Predictive.OK",      _("Ok")       , nullptr, kOkCmd);
-	_button[kButton1Act] = new ButtonWidget(this, "Predictive.Button1", "1  `-.&"     , nullptr, kBut1Cmd);
-	_button[kButton2Act] = new ButtonWidget(this, "Predictive.Button2", "2  abc"      , nullptr, kBut2Cmd);
-	_button[kButton3Act] = new ButtonWidget(this, "Predictive.Button3", "3  def"      , nullptr, kBut3Cmd);
-	_button[kButton4Act] = new ButtonWidget(this, "Predictive.Button4", "4  ghi"      , nullptr, kBut4Cmd);
-	_button[kButton5Act] = new ButtonWidget(this, "Predictive.Button5", "5  jkl"      , nullptr, kBut5Cmd);
-	_button[kButton6Act] = new ButtonWidget(this, "Predictive.Button6", "6  mno"      , nullptr, kBut6Cmd);
-	_button[kButton7Act] = new ButtonWidget(this, "Predictive.Button7", "7  pqrs"     , nullptr, kBut7Cmd);
-	_button[kButton8Act] = new ButtonWidget(this, "Predictive.Button8", "8  tuv"      , nullptr, kBut8Cmd);
-	_button[kButton9Act] = new ButtonWidget(this, "Predictive.Button9", "9  wxyz"     , nullptr, kBut9Cmd);
-	_button[kButton0Act] = new ButtonWidget(this, "Predictive.Button0", "0"           , nullptr, kBut0Cmd);
+
+	if (g_gui.useRTL()) {
+		/** If using RTL, swap out the odd rows, as they will be flipped when drawing. (Swapping the commands and display data)
+			We flip them back to orignal, because the keyboard layout stays the same in LTR & RTL,
+			but the rest, like okButton, cancel, etc are all flipped.
+		*/
+
+		// Row 1
+		_button[kButton1Act] = new ButtonWidget(this, "Predictive.Button1", "3  def", nullptr, kBut3Cmd);
+		_button[kButton4Act] = new ButtonWidget(this, "Predictive.Button4", "6  mno", nullptr, kBut6Cmd);
+		_button[kButton7Act] = new ButtonWidget(this, "Predictive.Button7", "9  wxyz", nullptr, kBut9Cmd);
+
+		// Row 3
+		_button[kButton3Act] = new ButtonWidget(this, "Predictive.Button3", "1  `-.&", nullptr, kBut1Cmd);
+		_button[kButton6Act] = new ButtonWidget(this, "Predictive.Button6", "4  ghi", nullptr, kBut4Cmd);
+		_button[kButton9Act] = new ButtonWidget(this, "Predictive.Button9", "7  pqrs", nullptr, kBut7Cmd);
+
+		// Middle Row - Stays the same
+		_button[kButton2Act] = new ButtonWidget(this, "Predictive.Button2", "2  abc", nullptr, kBut2Cmd);
+		_button[kButton5Act] = new ButtonWidget(this, "Predictive.Button5", "5  jkl", nullptr, kBut5Cmd);
+		_button[kButton8Act] = new ButtonWidget(this, "Predictive.Button8", "8  tuv", nullptr, kBut8Cmd);
+		_button[kButton0Act] = new ButtonWidget(this, "Predictive.Button0", "0", nullptr, kBut0Cmd);
+
+	} else {
+		_button[kButton1Act] = new ButtonWidget(this, "Predictive.Button1", "1  `-.&"     , nullptr, kBut1Cmd);
+		_button[kButton2Act] = new ButtonWidget(this, "Predictive.Button2", "2  abc"      , nullptr, kBut2Cmd);
+		_button[kButton3Act] = new ButtonWidget(this, "Predictive.Button3", "3  def"      , nullptr, kBut3Cmd);
+		_button[kButton4Act] = new ButtonWidget(this, "Predictive.Button4", "4  ghi"      , nullptr, kBut4Cmd);
+		_button[kButton5Act] = new ButtonWidget(this, "Predictive.Button5", "5  jkl"      , nullptr, kBut5Cmd);
+		_button[kButton6Act] = new ButtonWidget(this, "Predictive.Button6", "6  mno"      , nullptr, kBut6Cmd);
+		_button[kButton7Act] = new ButtonWidget(this, "Predictive.Button7", "7  pqrs"     , nullptr, kBut7Cmd);
+		_button[kButton8Act] = new ButtonWidget(this, "Predictive.Button8", "8  tuv"      , nullptr, kBut8Cmd);
+		_button[kButton9Act] = new ButtonWidget(this, "Predictive.Button9", "9  wxyz"     , nullptr, kBut9Cmd);
+		_button[kButton0Act] = new ButtonWidget(this, "Predictive.Button0", "0"           , nullptr, kBut0Cmd);
+	}
+
 	// I18N: You must leave "#" as is, only word 'next' is translatable
 	_button[kNextAct] =    new ButtonWidget(this, "Predictive.Next",    _("#  next")  , nullptr, kNextCmd);
 	_button[kAddAct] =     new ButtonWidget(this, "Predictive.Add",     _("add")      , nullptr, kAddCmd);


Commit: 5e0d5b8322bfc22d8cfe7dcf43d5374a27b02d58
    https://github.com/scummvm/scummvm/commit/5e0d5b8322bfc22d8cfe7dcf43d5374a27b02d58
Author: aryanrawlani28 (aryanrawlani007 at gmail.com)
Date: 2020-06-22T00:03:02+02:00

Commit Message:
GUI: RTL: Disable RTL by default

Changed paths:
    gui/gui-manager.cpp


diff --git a/gui/gui-manager.cpp b/gui/gui-manager.cpp
index eaaf148beb..f777020cee 100644
--- a/gui/gui-manager.cpp
+++ b/gui/gui-manager.cpp
@@ -669,7 +669,7 @@ void GuiManager::setLanguageRTL() {
 	}
 #ifdef USE_TRANSLATION
 	Common::String language = TransMan.getCurrentLanguage();
-	if (language.equals("he") || language.equals("C")) {
+	if (language.equals("C") && false) {		// GUI TODO: Remove false condition to enable RTL
 		_useRTL = true;
 		return;
 	}


Commit: 0f40989633a1cf6b87a2e2e345561d3eb8111387
    https://github.com/scummvm/scummvm/commit/0f40989633a1cf6b87a2e2e345561d3eb8111387
Author: aryanrawlani28 (aryanrawlani007 at gmail.com)
Date: 2020-06-22T00:03:02+02:00

Commit Message:
GUI: Code cleanup, add comments about RTL

Changed paths:
    gui/ThemeLayout.cpp
    gui/gui-manager.cpp
    gui/gui-manager.h
    gui/widget.cpp


diff --git a/gui/ThemeLayout.cpp b/gui/ThemeLayout.cpp
index 91de80872b..f89014ea55 100644
--- a/gui/ThemeLayout.cpp
+++ b/gui/ThemeLayout.cpp
@@ -248,6 +248,11 @@ void ThemeLayoutMain::reflowLayout(Widget *widgetChain) {
 
 	if (g_gui.useRTL()) {
 		if (this->_name == "GameOptions" || this->_name == "GlobalOptions" || this->_name == "Browser") {
+			/** The dialogs named above are the stacked dialogs for which the left+right paddings need to be adjusted for RTL.
+				Whenever a stacked dialog is opened, the below code sets the left and right paddings and enables widgets to be
+				shifted by that amount. If any new stacked and padded dialogs are added in the future,
+				add them here and in Widget::draw() to enable RTL support for that particular dialog
+			*/
 			int oldX = _x;
 			_x = g_system->getOverlayWidth() - _w - _x;
 			g_gui.setDialogPaddings(oldX, _x);
diff --git a/gui/gui-manager.cpp b/gui/gui-manager.cpp
index f777020cee..0deae771a1 100644
--- a/gui/gui-manager.cpp
+++ b/gui/gui-manager.cpp
@@ -70,7 +70,6 @@ GuiManager::GuiManager() : _redrawStatus(kRedrawDisabled), _stateIsSaved(false),
 	_launched = false;
 
 	_useRTL = false;
-	_isAnotherDialogOverlayed = false;
 
 	_topDialogLeftPadding = 0;
 	_topDialogRightPadding = 0;
diff --git a/gui/gui-manager.h b/gui/gui-manager.h
index 924cd3bfcf..a8e88a4be2 100644
--- a/gui/gui-manager.h
+++ b/gui/gui-manager.h
@@ -145,7 +145,6 @@ protected:
 	bool		_useStdCursor;
 
 	bool		_useRTL;
-	bool		_isAnotherDialogOverlayed;
 
 	int			_topDialogLeftPadding;
 	int			_topDialogRightPadding;
diff --git a/gui/widget.cpp b/gui/widget.cpp
index 148df66f49..dc1c4d4197 100644
--- a/gui/widget.cpp
+++ b/gui/widget.cpp
@@ -226,7 +226,7 @@ bool Widget::isVisible() const {
 	return !(_flags & WIDGET_INVISIBLE);
 }
 
-bool Widget::useRTL() const{
+bool Widget::useRTL() const {
 	return _useRTL;
 }
 


Commit: 38e827d1e919b2758c53416e7531f4ee93a3b5b8
    https://github.com/scummvm/scummvm/commit/38e827d1e919b2758c53416e7531f4ee93a3b5b8
Author: aryanrawlani28 (aryanrawlani007 at gmail.com)
Date: 2020-06-22T00:03:02+02:00

Commit Message:
GUI: RTL: Correct behaviour of predictive dialogs for rtl layout

Changed paths:
    gui/predictivedialog.cpp


diff --git a/gui/predictivedialog.cpp b/gui/predictivedialog.cpp
index ab5172b43f..491f44e41e 100644
--- a/gui/predictivedialog.cpp
+++ b/gui/predictivedialog.cpp
@@ -74,20 +74,20 @@ PredictiveDialog::PredictiveDialog() : Dialog("Predictive") {
 	_button[kOkAct] =      new ButtonWidget(this, "Predictive.OK",      _("Ok")       , nullptr, kOkCmd);
 
 	if (g_gui.useRTL()) {
-		/** If using RTL, swap out the odd rows, as they will be flipped when drawing. (Swapping the commands and display data)
-			We flip them back to orignal, because the keyboard layout stays the same in LTR & RTL,
-			but the rest, like okButton, cancel, etc are all flipped.
+		/** If using RTL, swap the internal name of odd rows, to be flipped again when drawing.
+			We flip them back to orignal, because the keyboard layout stays the same in LTR & RTL.
+			The rest, like okButton, cancel, etc are all flipped.
 		*/
 
 		// Row 1
-		_button[kButton1Act] = new ButtonWidget(this, "Predictive.Button1", "3  def", nullptr, kBut3Cmd);
-		_button[kButton4Act] = new ButtonWidget(this, "Predictive.Button4", "6  mno", nullptr, kBut6Cmd);
-		_button[kButton7Act] = new ButtonWidget(this, "Predictive.Button7", "9  wxyz", nullptr, kBut9Cmd);
+		_button[kButton1Act] = new ButtonWidget(this, "Predictive.Button3", "1  `-.&", nullptr, kBut1Cmd);
+		_button[kButton4Act] = new ButtonWidget(this, "Predictive.Button6", "4  ghi", nullptr, kBut4Cmd);
+		_button[kButton7Act] = new ButtonWidget(this, "Predictive.Button9", "7  pqrs", nullptr, kBut7Cmd);
 
 		// Row 3
-		_button[kButton3Act] = new ButtonWidget(this, "Predictive.Button3", "1  `-.&", nullptr, kBut1Cmd);
-		_button[kButton6Act] = new ButtonWidget(this, "Predictive.Button6", "4  ghi", nullptr, kBut4Cmd);
-		_button[kButton9Act] = new ButtonWidget(this, "Predictive.Button9", "7  pqrs", nullptr, kBut7Cmd);
+		_button[kButton3Act] = new ButtonWidget(this, "Predictive.Button1", "3  def", nullptr, kBut3Cmd);
+		_button[kButton6Act] = new ButtonWidget(this, "Predictive.Button4", "6  mno", nullptr, kBut6Cmd);
+		_button[kButton9Act] = new ButtonWidget(this, "Predictive.Button7", "9  wxyz", nullptr, kBut9Cmd);
 
 		// Middle Row - Stays the same
 		_button[kButton2Act] = new ButtonWidget(this, "Predictive.Button2", "2  abc", nullptr, kBut2Cmd);


Commit: 19aa7baba7bf5ce9b26cefe6ea02cb0bd108fe0d
    https://github.com/scummvm/scummvm/commit/19aa7baba7bf5ce9b26cefe6ea02cb0bd108fe0d
Author: aryanrawlani28 (aryanrawlani007 at gmail.com)
Date: 2020-06-22T00:03:02+02:00

Commit Message:
GUI: RTL: Wrapping a variable used for rtl

Changed paths:
    gui/widgets/tab.cpp


diff --git a/gui/widgets/tab.cpp b/gui/widgets/tab.cpp
index 2f45635890..d108147e77 100644
--- a/gui/widgets/tab.cpp
+++ b/gui/widgets/tab.cpp
@@ -128,7 +128,9 @@ int TabWidget::addTab(const String &title, const String &dialogName) {
 	if (newWidth < _minTabWidth)
 		newWidth = _minTabWidth;
 	newTab._tabWidth = newWidth;
-	_widthTillLastTab += newWidth;
+
+	if (g_gui.useRTL())
+		_widthTillLastTab += newWidth;
 
 	_tabs.push_back(newTab);
 


Commit: 6211747fd3989bb78ec3dfae5aae1f43c1698d83
    https://github.com/scummvm/scummvm/commit/6211747fd3989bb78ec3dfae5aae1f43c1698d83
Author: aryanrawlani28 (aryanrawlani007 at gmail.com)
Date: 2020-06-22T00:03:02+02:00

Commit Message:
GUI: RTL: Fix missing backgrounds for tabs in hebrew when navbars present

Changed paths:
    gui/widgets/tab.cpp


diff --git a/gui/widgets/tab.cpp b/gui/widgets/tab.cpp
index d108147e77..7ef3569de3 100644
--- a/gui/widgets/tab.cpp
+++ b/gui/widgets/tab.cpp
@@ -423,11 +423,13 @@ void TabWidget::drawWidget() {
 			pad += (_minTabWidth / 2);
 		}
 
+		_rtlBackgroundOffset = ABS(this->getWidth() - _widthTillLastTab);
+
 		r2.translate(g_system->getOverlayWidth() - _x - _w + pad + _rtlSpaceOffset, 0);
 		if (_navButtonsVisible) {
 			r2.translate(_butW - 6, 0);
+			_rtlBackgroundOffset += (_butW * 2);
 		}
-		_rtlBackgroundOffset = ABS(this->getWidth() - _widthTillLastTab);
 
 		drawTab = _lastVisibleTab - drawTab + _rtlTabOffset;
 	}


Commit: 54279790b7a08e3082f7fc93c997bc5fdf4e71d0
    https://github.com/scummvm/scummvm/commit/54279790b7a08e3082f7fc93c997bc5fdf4e71d0
Author: aryanrawlani28 (aryanrawlani007 at gmail.com)
Date: 2020-06-22T00:03:02+02:00

Commit Message:
GUI: RTL: Enable RTL by default for Hebrew

Changed paths:
    gui/gui-manager.cpp


diff --git a/gui/gui-manager.cpp b/gui/gui-manager.cpp
index 0deae771a1..5b32086490 100644
--- a/gui/gui-manager.cpp
+++ b/gui/gui-manager.cpp
@@ -668,7 +668,7 @@ void GuiManager::setLanguageRTL() {
 	}
 #ifdef USE_TRANSLATION
 	Common::String language = TransMan.getCurrentLanguage();
-	if (language.equals("C") && false) {		// GUI TODO: Remove false condition to enable RTL
+	if (language.equals("he")) {		// GUI TODO: modify when we'll support other RTL languages, such as Arabic and Farsi
 		_useRTL = true;
 		return;
 	}


Commit: e50463f11f6d2d2e7c9a666250333e91277f1454
    https://github.com/scummvm/scummvm/commit/e50463f11f6d2d2e7c9a666250333e91277f1454
Author: aryanrawlani28 (aryanrawlani007 at gmail.com)
Date: 2020-06-22T00:03:02+02:00

Commit Message:
GUI: JANITORIAL: Improve readability - remove nested ternary op

Changed paths:
    gui/ThemeEngine.cpp


diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp
index 3765f00fe8..273858a4ea 100644
--- a/gui/ThemeEngine.cpp
+++ b/gui/ThemeEngine.cpp
@@ -1019,8 +1019,12 @@ void ThemeEngine::drawCheckbox(const Common::Rect &r, const Common::String &str,
 	if (checked)
 		dd = rtl ? kDDCheckboxSelectedRTL : kDDCheckboxSelected;
 
-	if (state == kStateDisabled)
-		dd = checked ? rtl ? kDDCheckboxDisabledSelectedRTL : kDDCheckboxDisabledSelected : rtl ? kDDCheckboxDisabledRTL : kDDCheckboxDisabled;
+	if (state == kStateDisabled) {
+		if (checked)
+			dd = rtl ? kDDCheckboxDisabledSelectedRTL : kDDCheckboxDisabledSelected;
+		else
+			dd = rtl ? kDDCheckboxDisabledRTL : kDDCheckboxDisabled;
+	}
 
 	const int checkBoxSize = MIN((int)r.height(), getFontHeight());
 	r2.bottom = r2.top + checkBoxSize;


Commit: 12a4af77bda04c8427ff2184be87c10cbe6bd113
    https://github.com/scummvm/scummvm/commit/12a4af77bda04c8427ff2184be87c10cbe6bd113
Author: aryanrawlani28 (aryanrawlani007 at gmail.com)
Date: 2020-06-22T00:03:02+02:00

Commit Message:
GUI: Code cleanup

Changed paths:
    gui/ThemeEngine.cpp
    gui/Tooltip.cpp
    gui/gui-manager.cpp
    gui/predictivedialog.cpp
    gui/widgets/list.cpp


diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp
index 273858a4ea..208ea42ec0 100644
--- a/gui/ThemeEngine.cpp
+++ b/gui/ThemeEngine.cpp
@@ -1086,7 +1086,7 @@ void ThemeEngine::drawRadiobutton(const Common::Rect &r, const Common::String &s
 	}
 
 	drawDDText(getTextData(dd), getTextColor(dd), r2, str, true, false, _widgets[dd]->_textAlignH,
-				_widgets[dd]->_textAlignV);
+		_widgets[dd]->_textAlignV);
 }
 
 void ThemeEngine::drawSlider(const Common::Rect &r, int width, WidgetStateInfo state, bool rtl) {
diff --git a/gui/Tooltip.cpp b/gui/Tooltip.cpp
index 5e40e59eb8..cb5ebba8b4 100644
--- a/gui/Tooltip.cpp
+++ b/gui/Tooltip.cpp
@@ -93,7 +93,7 @@ void Tooltip::drawDialog(DrawLayer layerToDraw) {
 			ThemeEngine::kFontColorNormal,
 			false
 		);
-		}
 	}
+}
 
 }
diff --git a/gui/gui-manager.cpp b/gui/gui-manager.cpp
index 5b32086490..270c1765ba 100644
--- a/gui/gui-manager.cpp
+++ b/gui/gui-manager.cpp
@@ -580,7 +580,6 @@ void GuiManager::processEvent(const Common::Event &event, Dialog *const activeDi
 		return;
 	int button;
 	uint32 time;
-
 	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 + g_gui.getOverlayOffset();
@@ -662,7 +661,7 @@ void GuiManager::setLastMousePos(int16 x, int16 y) {
 }
 
 void GuiManager::setLanguageRTL() {
-	if (ConfMan.hasKey("guiRTL")) {
+	if (ConfMan.hasKey("guiRTL")) {		// Put guiRTL = yes to your scummvm.ini to force RTL GUI
 		_useRTL = ConfMan.getBool("guiRTL");
 		return;
 	}
diff --git a/gui/predictivedialog.cpp b/gui/predictivedialog.cpp
index 491f44e41e..7670912b1c 100644
--- a/gui/predictivedialog.cpp
+++ b/gui/predictivedialog.cpp
@@ -74,27 +74,21 @@ PredictiveDialog::PredictiveDialog() : Dialog("Predictive") {
 	_button[kOkAct] =      new ButtonWidget(this, "Predictive.OK",      _("Ok")       , nullptr, kOkCmd);
 
 	if (g_gui.useRTL()) {
-		/** If using RTL, swap the internal name of odd rows, to be flipped again when drawing.
+		/** If using RTL, swap the internal name of odd columns, to be flipped again when drawing.
 			We flip them back to orignal, because the keyboard layout stays the same in LTR & RTL.
 			The rest, like okButton, cancel, etc are all flipped.
 		*/
 
-		// Row 1
-		_button[kButton1Act] = new ButtonWidget(this, "Predictive.Button3", "1  `-.&", nullptr, kBut1Cmd);
-		_button[kButton4Act] = new ButtonWidget(this, "Predictive.Button6", "4  ghi", nullptr, kBut4Cmd);
-		_button[kButton7Act] = new ButtonWidget(this, "Predictive.Button9", "7  pqrs", nullptr, kBut7Cmd);
-
-		// Row 3
-		_button[kButton3Act] = new ButtonWidget(this, "Predictive.Button1", "3  def", nullptr, kBut3Cmd);
-		_button[kButton6Act] = new ButtonWidget(this, "Predictive.Button4", "6  mno", nullptr, kBut6Cmd);
-		_button[kButton9Act] = new ButtonWidget(this, "Predictive.Button7", "9  wxyz", nullptr, kBut9Cmd);
-
-		// Middle Row - Stays the same
-		_button[kButton2Act] = new ButtonWidget(this, "Predictive.Button2", "2  abc", nullptr, kBut2Cmd);
-		_button[kButton5Act] = new ButtonWidget(this, "Predictive.Button5", "5  jkl", nullptr, kBut5Cmd);
-		_button[kButton8Act] = new ButtonWidget(this, "Predictive.Button8", "8  tuv", nullptr, kBut8Cmd);
-		_button[kButton0Act] = new ButtonWidget(this, "Predictive.Button0", "0", nullptr, kBut0Cmd);
-
+		_button[kButton3Act] = new ButtonWidget(this, "Predictive.Button1", "3  def"      , nullptr, kBut3Cmd);
+		_button[kButton2Act] = new ButtonWidget(this, "Predictive.Button2", "2  abc"      , nullptr, kBut2Cmd);
+		_button[kButton1Act] = new ButtonWidget(this, "Predictive.Button3", "1  `-.&"     , nullptr, kBut1Cmd);
+		_button[kButton6Act] = new ButtonWidget(this, "Predictive.Button4", "6  mno"      , nullptr, kBut6Cmd);
+		_button[kButton5Act] = new ButtonWidget(this, "Predictive.Button5", "5  jkl"      , nullptr, kBut5Cmd);
+		_button[kButton4Act] = new ButtonWidget(this, "Predictive.Button6", "4  ghi"      , nullptr, kBut4Cmd);
+		_button[kButton9Act] = new ButtonWidget(this, "Predictive.Button7", "9  wxyz"     , nullptr, kBut9Cmd);
+		_button[kButton8Act] = new ButtonWidget(this, "Predictive.Button8", "8  tuv"      , nullptr, kBut8Cmd);
+		_button[kButton7Act] = new ButtonWidget(this, "Predictive.Button9", "7  pqrs"     , nullptr, kBut7Cmd);
+		_button[kButton0Act] = new ButtonWidget(this, "Predictive.Button0", "0"           , nullptr, kBut0Cmd);
 	} else {
 		_button[kButton1Act] = new ButtonWidget(this, "Predictive.Button1", "1  `-.&"     , nullptr, kBut1Cmd);
 		_button[kButton2Act] = new ButtonWidget(this, "Predictive.Button2", "2  abc"      , nullptr, kBut2Cmd);
diff --git a/gui/widgets/list.cpp b/gui/widgets/list.cpp
index fcc04a3b75..3bac870fd5 100644
--- a/gui/widgets/list.cpp
+++ b/gui/widgets/list.cpp
@@ -589,13 +589,11 @@ void ListWidget::drawWidget() {
 			buffer = _editString;
 			color = _editColor;
 			adjustOffset();
-			g_gui.theme()->drawText(r1, buffer, _state,
-									alignment, inverted, pad, true, ThemeEngine::kFontStyleBold, color);
 		} else {
 			buffer = _list[pos];
-			g_gui.theme()->drawText(r1, buffer, _state,
-									alignment, inverted, pad, true, ThemeEngine::kFontStyleBold, color);
 		}
+		g_gui.theme()->drawText(r1, buffer, _state,
+								alignment, inverted, pad, true, ThemeEngine::kFontStyleBold, color);
 
 		// If in numbering mode & using RTL layout in GUI, we print a number suffix after drawing the text
 		if (_numberingMode != kListNumberingOff && g_gui.useRTL()) {


Commit: dde4200d3524dfa2f102f920d82a2d3d01b3ad80
    https://github.com/scummvm/scummvm/commit/dde4200d3524dfa2f102f920d82a2d3d01b3ad80
Author: aryanrawlani28 (aryanrawlani007 at gmail.com)
Date: 2020-06-22T00:03:02+02:00

Commit Message:
GUI: RTL: Overload and simplify getWidgetData for getting rtl flag

Changed paths:
    engines/scumm/dialogs.cpp
    gui/ThemeEval.cpp
    gui/ThemeEval.h
    gui/ThemeLayout.cpp
    gui/options.cpp
    gui/saveload-dialog.cpp


diff --git a/engines/scumm/dialogs.cpp b/engines/scumm/dialogs.cpp
index 20f63ce7b9..14bf29e1f2 100644
--- a/engines/scumm/dialogs.cpp
+++ b/engines/scumm/dialogs.cpp
@@ -309,7 +309,7 @@ void HelpDialog::reflowLayout() {
 
 	assert(lineHeight);
 
-	g_gui.xmlEval()->getWidgetData("ScummHelp.HelpText", x, y, w, h, _useRTL);
+	g_gui.xmlEval()->getWidgetData("ScummHelp.HelpText", x, y, w, h);
 
 	// Make sure than we don't have more lines than what we can fit
 	// on the space that the layout reserves for text
diff --git a/gui/ThemeEval.cpp b/gui/ThemeEval.cpp
index ceecb14303..f7d0fde913 100644
--- a/gui/ThemeEval.cpp
+++ b/gui/ThemeEval.cpp
@@ -50,6 +50,12 @@ void ThemeEval::reset() {
 	_layouts.clear();
 }
 
+bool ThemeEval::getWidgetData(const Common::String &widget, int16 &x, int16 &y, int16 &w, int16 &h) {
+	bool useRTL;
+
+	return getWidgetData(widget, x, y, w, h, useRTL);
+}
+
 bool ThemeEval::getWidgetData(const Common::String &widget, int16 &x, int16 &y, int16 &w, int16 &h, bool &useRTL) {
 	Common::StringTokenizer tokenizer(widget, ".");
 
diff --git a/gui/ThemeEval.h b/gui/ThemeEval.h
index 757b6c32d8..ff7fe82a94 100644
--- a/gui/ThemeEval.h
+++ b/gui/ThemeEval.h
@@ -88,6 +88,7 @@ public:
 	bool hasDialog(const Common::String &name);
 
 	void reflowDialogLayout(const Common::String &name, Widget *widgetChain);
+	bool getWidgetData(const Common::String &widget, int16 &x, int16 &y, int16 &w, int16 &h);
 	bool getWidgetData(const Common::String &widget, int16 &x, int16 &y, int16 &w, int16 &h, bool &useRTL);
 
 	Graphics::TextAlign getWidgetTextHAlign(const Common::String &widget);
diff --git a/gui/ThemeLayout.cpp b/gui/ThemeLayout.cpp
index f89014ea55..bc02efbd4c 100644
--- a/gui/ThemeLayout.cpp
+++ b/gui/ThemeLayout.cpp
@@ -233,7 +233,7 @@ void ThemeLayoutMain::reflowLayout(Widget *widgetChain) {
 		_w = _defaultW > 0 ? MIN(_defaultW, g_system->getOverlayWidth()) : -1;
 		_h = _defaultH > 0 ? MIN(_defaultH, g_system->getOverlayHeight()) : -1;
 	} else {
-		if (!g_gui.xmlEval()->getWidgetData(_overlays, _x, _y, _w, _h, _useRTL)) {
+		if (!g_gui.xmlEval()->getWidgetData(_overlays, _x, _y, _w, _h)) {
 			warning("Unable to retrieve overlayed dialog position %s", _overlays.c_str());
 		}
 
diff --git a/gui/options.cpp b/gui/options.cpp
index 5f59b65844..a9a8a568db 100644
--- a/gui/options.cpp
+++ b/gui/options.cpp
@@ -2786,10 +2786,10 @@ void GlobalOptionsDialog::setupCloudTab() {
 	int16 shiftUp = 0;
 	if (!showingCurrentStorage || enabled) {
 		// "storage is disabled" hint is not shown, shift everything up
-		if (!g_gui.xmlEval()->getWidgetData("GlobalOptions_Cloud_Container.StorageDisabledHint", x, y, w, h, _useRTL))
+		if (!g_gui.xmlEval()->getWidgetData("GlobalOptions_Cloud_Container.StorageDisabledHint", x, y, w, h))
 			warning("GlobalOptions_Cloud_Container.StorageUsernameDesc's position is undefined");
 		shiftUp = y;
-		if (!g_gui.xmlEval()->getWidgetData("GlobalOptions_Cloud_Container.StorageUsernameDesc", x, y, w, h, _useRTL))
+		if (!g_gui.xmlEval()->getWidgetData("GlobalOptions_Cloud_Container.StorageUsernameDesc", x, y, w, h))
 			warning("GlobalOptions_Cloud_Container.StorageWizardNotConnectedHint's position is undefined");
 		shiftUp = y - shiftUp;
 	}
@@ -2839,10 +2839,10 @@ void GlobalOptionsDialog::setupCloudTab() {
 
 	int16 disconnectWidgetsAdditionalShift = 0;
 	if (!showDownloadButton) {
-		if (!g_gui.xmlEval()->getWidgetData("GlobalOptions_Cloud_Container.StorageDownloadHint", x, y, w, h, _useRTL))
+		if (!g_gui.xmlEval()->getWidgetData("GlobalOptions_Cloud_Container.StorageDownloadHint", x, y, w, h))
 			warning("GlobalOptions_Cloud_Container.StorageDownloadHint's position is undefined");
 		disconnectWidgetsAdditionalShift = y;
-		if (!g_gui.xmlEval()->getWidgetData("GlobalOptions_Cloud_Container.StorageDisconnectHint", x, y, w, h, _useRTL))
+		if (!g_gui.xmlEval()->getWidgetData("GlobalOptions_Cloud_Container.StorageDisconnectHint", x, y, w, h))
 			warning("GlobalOptions_Cloud_Container.DownloadButton's position is undefined");
 		disconnectWidgetsAdditionalShift = y - disconnectWidgetsAdditionalShift;
 	}
@@ -2889,10 +2889,10 @@ void GlobalOptionsDialog::setupCloudTab() {
 	}
 
 	if (!shownConnectedInfo) {
-		if (!g_gui.xmlEval()->getWidgetData("GlobalOptions_Cloud_Container.StorageDisabledHint", x, y, w, h, _useRTL))
+		if (!g_gui.xmlEval()->getWidgetData("GlobalOptions_Cloud_Container.StorageDisabledHint", x, y, w, h))
 			warning("GlobalOptions_Cloud_Container.StorageUsernameDesc's position is undefined");
 		shiftUp = y;
-		if (!g_gui.xmlEval()->getWidgetData("GlobalOptions_Cloud_Container.StorageWizardNotConnectedHint", x, y, w, h, _useRTL))
+		if (!g_gui.xmlEval()->getWidgetData("GlobalOptions_Cloud_Container.StorageWizardNotConnectedHint", x, y, w, h))
 			warning("GlobalOptions_Cloud_Container.StorageWizardNotConnectedHint's position is undefined");
 		shiftUp = y - shiftUp;
 
@@ -2912,7 +2912,7 @@ void GlobalOptionsDialog::shiftWidget(Widget *widget, const char *widgetName, in
 
 	int16 x, y;
 	int16 w, h;
-	if (!g_gui.xmlEval()->getWidgetData(widgetName, x, y, w, h, _useRTL))
+	if (!g_gui.xmlEval()->getWidgetData(widgetName, x, y, w, h))
 		warning("%s's position is undefined", widgetName);
 
 	widget->setPos(x + xOffset, y + yOffset);
diff --git a/gui/saveload-dialog.cpp b/gui/saveload-dialog.cpp
index 2e84f40dd0..bc059fcb2b 100644
--- a/gui/saveload-dialog.cpp
+++ b/gui/saveload-dialog.cpp
@@ -493,7 +493,7 @@ void SaveLoadChooserSimple::reflowLayout() {
 		int16 x, y;
 		int16 w, h;
 
-		if (!g_gui.xmlEval()->getWidgetData("SaveLoadChooser.Thumbnail", x, y, w, h, _useRTL))
+		if (!g_gui.xmlEval()->getWidgetData("SaveLoadChooser.Thumbnail", x, y, w, h))
 			error("Error when loading position data for Save/Load Thumbnails");
 
 		// Even if there is no thumbnail support, getWidgetData() will provide default thumbnail values
@@ -934,7 +934,7 @@ void SaveLoadChooserGrid::reflowLayout() {
 
 	int16 x, y;
 	int16 w;
-	if (!g_gui.xmlEval()->getWidgetData("SaveLoadChooser.List", x, y, w, availableHeight, _useRTL))
+	if (!g_gui.xmlEval()->getWidgetData("SaveLoadChooser.List", x, y, w, availableHeight))
 		error("Could not load widget position for 'SaveLoadChooser.List'");
 
 	const int16 buttonWidth = kThumbnailWidth + 6;


Commit: 9cd2ef1271f40e7f80b760581f8d510b5ed4557a
    https://github.com/scummvm/scummvm/commit/9cd2ef1271f40e7f80b760581f8d510b5ed4557a
Author: aryanrawlani28 (aryanrawlani007 at gmail.com)
Date: 2020-06-22T00:03:02+02:00

Commit Message:
GUI: RTL: Cleanup tab drawing to make it simpler

Changed paths:
    gui/widgets/tab.cpp


diff --git a/gui/widgets/tab.cpp b/gui/widgets/tab.cpp
index 7ef3569de3..98507c4cd5 100644
--- a/gui/widgets/tab.cpp
+++ b/gui/widgets/tab.cpp
@@ -390,16 +390,11 @@ void TabWidget::reflowLayout() {
 void TabWidget::drawWidget() {
 	Common::Array<Common::String> tabs;
 	Common::Array<int> widths;
-	if (g_gui.useRTL()) {
-		for (int i = _firstVisibleTab; i <= _lastVisibleTab; ++i) {
-			tabs.insert_at(0, _tabs[i].title);
-			widths.insert_at(0, _tabs[i]._tabWidth);
-		}
-	} else {
-		for (int i = _firstVisibleTab; i <= _lastVisibleTab; ++i) {
-			tabs.push_back(_tabs[i].title);
-			widths.push_back(_tabs[i]._tabWidth);
-		}
+	for (int i = _firstVisibleTab; i <= _lastVisibleTab; ++i) {
+		int idx = g_gui.useRTL() ? (_lastVisibleTab - i - _rtlTabOffset) : i;
+
+		tabs.push_back(_tabs[idx].title);
+		widths.push_back(_tabs[idx]._tabWidth);
 	}
 
 	Common::Rect r1(_x + _bodyLP, _y + _bodyTP, _x + _w - _bodyRP, _y + _h - _bodyBP + _tabHeight);


Commit: 5a093e4e9500ce2ca947e820750cce225c55cb56
    https://github.com/scummvm/scummvm/commit/5a093e4e9500ce2ca947e820750cce225c55cb56
Author: aryanrawlani28 (aryanrawlani007 at gmail.com)
Date: 2020-06-22T00:03:02+02:00

Commit Message:
GUI: RTL: Improve right align text drawing

- Fix last chars being eaten
- Add support for input in right-align mode editables
- Fix issue with dirtyness of editables after clicking
- Improve spacing for lists and popup
- Make numbers reversed in lists

Changed paths:
    graphics/VectorRendererSpec.cpp
    graphics/font.cpp
    gui/widgets/editable.cpp
    gui/widgets/editable.h
    gui/widgets/edittext.cpp
    gui/widgets/list.cpp
    gui/widgets/popup.cpp


diff --git a/graphics/VectorRendererSpec.cpp b/graphics/VectorRendererSpec.cpp
index 06ce7c271d..e44ccd6328 100644
--- a/graphics/VectorRendererSpec.cpp
+++ b/graphics/VectorRendererSpec.cpp
@@ -1061,8 +1061,17 @@ drawString(const Graphics::Font *font, const Common::String &text, const Common:
 	drawArea = drawArea.findIntersectingRect(Common::Rect(0, 0, _activeSurface->w, _activeSurface->h));
 
 	if (!drawArea.isEmpty()) {
+		Common::Rect textArea(area);
+		textArea.right -= deltax;
+
 		Surface textAreaSurface = _activeSurface->getSubArea(drawArea);
-		font->drawString(&textAreaSurface, text, area.left - drawArea.left, offset - drawArea.top, area.width() - deltax, _fgColor, alignH, deltax, ellipsis);
+
+		if (deltax >= 0) {
+			textArea.left += deltax;
+			deltax = 0;
+		}
+
+		font->drawString(&textAreaSurface, text, textArea.left - drawArea.left, offset - drawArea.top, textArea.width(), _fgColor, alignH, deltax, ellipsis);
 	}
 }
 
diff --git a/graphics/font.cpp b/graphics/font.cpp
index 3bcfad22c3..cc460c4dfe 100644
--- a/graphics/font.cpp
+++ b/graphics/font.cpp
@@ -43,7 +43,7 @@ Common::Rect getBoundingBoxImpl(const Font &font, const StringType &str, int x,
 	// We follow the logic of drawStringImpl here. The only exception is
 	// that we do allow an empty width to be specified here. This allows us
 	// to obtain the complete bounding box of a string.
-	const int leftX = x, rightX = w ? (x + w) : 0x7FFFFFFF;
+	const int leftX = x, rightX = w ? (x + w + 1) : 0x7FFFFFFF;
 	int width = font.getStringWidth(str);
 
 	if (align == kTextAlignCenter)
@@ -100,7 +100,7 @@ void drawStringImpl(const Font &font, Surface *dst, const StringType &str, int x
 	// ever change something here we will need to change it there too.
 	assert(dst != 0);
 
-	const int leftX = x, rightX = x + w;
+	const int leftX = x, rightX = x + w + 1;
 	int width = font.getStringWidth(str);
 
 	if (align == kTextAlignCenter)
diff --git a/gui/widgets/editable.cpp b/gui/widgets/editable.cpp
index ddfb882611..2849350fc9 100644
--- a/gui/widgets/editable.cpp
+++ b/gui/widgets/editable.cpp
@@ -47,6 +47,9 @@ void EditableWidget::init() {
 
 	_editScrollOffset = 0;
 
+	_align = g_gui.useRTL() ? Graphics::kTextAlignRight : Graphics::kTextAlignLeft;
+	_drawAlign = _align;
+
 	_font = ThemeEngine::kFontStyleBold;
 	_inversion = ThemeEngine::kTextInversionNone;
 }
@@ -58,8 +61,12 @@ void EditableWidget::reflowLayout() {
 	Widget::reflowLayout();
 
 	_editScrollOffset = g_gui.getStringWidth(_editString, _font) - getEditRect().width();
-	if (_editScrollOffset < 0)
+	if (_editScrollOffset < 0) {
 		_editScrollOffset = 0;
+		_drawAlign = _align;
+	} else {
+		_drawAlign = Graphics::kTextAlignLeft;
+	}
 }
 
 void EditableWidget::setEditString(const String &str) {
@@ -265,18 +272,8 @@ void EditableWidget::defaultKeyDownHandler(Common::KeyState &state, bool &dirty,
 }
 
 int EditableWidget::getCaretOffset() const {
-	int caretpos = 0;
-
-	uint last = 0;
-	for (int i = 0; i < _caretPos; ++i) {
-		const uint cur = _editString[i];
-		caretpos += g_gui.getCharWidth(cur, _font) + g_gui.getKerningOffset(last, cur, _font);
-		last = cur;
-	}
-
-	caretpos -= _editScrollOffset;
-
-	return caretpos;
+	Common::String substr(_editString.c_str(), _caretPos);
+	return g_gui.getStringWidth(substr, _font) - _editScrollOffset;
 }
 
 void EditableWidget::drawCaret(bool erase) {
@@ -289,7 +286,16 @@ void EditableWidget::drawCaret(bool erase) {
 	int x = editRect.left;
 	int y = editRect.top;
 
-	Graphics::TextAlign alignment = Graphics::kTextAlignLeft;
+	if (_align == Graphics::kTextAlignRight) {
+		int strVisibleWidth = g_gui.getStringWidth(_editString, _font) - _editScrollOffset;
+		if (strVisibleWidth > editRect.width()) {
+			_drawAlign = Graphics::kTextAlignLeft;
+			strVisibleWidth = editRect.width();
+		} else {
+			_drawAlign = _align;
+		}
+		x = editRect.right - strVisibleWidth;
+	}
 
 	const int caretOffset = getCaretOffset();
 	x += caretOffset;
@@ -297,14 +303,12 @@ void EditableWidget::drawCaret(bool erase) {
 	if (y < 0 || y + editRect.height() > _h)
 		return;
 
-	x += getAbsX();
+	if (g_gui.useRTL())
+		x += g_system->getOverlayWidth() - _w - getAbsX() + g_gui.getOverlayOffset();
+	else
+		x += getAbsX();
 	y += getAbsY();
 
-	if (g_gui.useRTL()) {
-		x += (g_system->getOverlayWidth() - _x - _x - _w);
-		alignment = Graphics::kTextAlignRight;
-	}
-
 	g_gui.theme()->drawCaret(Common::Rect(x, y, x + 1, y + editRect.height()), erase);
 
 	if (erase) {
@@ -335,7 +339,7 @@ void EditableWidget::drawCaret(bool erase) {
 		width = MIN(editRect.width() - caretOffset, width);
 		if (width > 0) {
 			g_gui.theme()->drawText(Common::Rect(x, y, x + width, y + editRect.height()), character,
-			                        _state, alignment, _inversion, 0, false, _font,
+			                        _state, _drawAlign, _inversion, 0, false, _font,
 			                        ThemeEngine::kFontColorNormal, true, _textDrawableArea);
 		}
 	}
diff --git a/gui/widgets/editable.h b/gui/widgets/editable.h
index 78ee59104a..f1b86f75fd 100644
--- a/gui/widgets/editable.h
+++ b/gui/widgets/editable.h
@@ -55,6 +55,9 @@ protected:
 
 	int			_editScrollOffset;
 
+	Graphics::TextAlign _align;
+	Graphics::TextAlign _drawAlign;
+
 	ThemeEngine::FontStyle  _font;
 
 	ThemeEngine::TextInversionState  _inversion;
diff --git a/gui/widgets/edittext.cpp b/gui/widgets/edittext.cpp
index 8d20703b2e..b4116f5353 100644
--- a/gui/widgets/edittext.cpp
+++ b/gui/widgets/edittext.cpp
@@ -72,21 +72,28 @@ void EditTextWidget::handleMouseDown(int x, int y, int button, int clickCount) {
 	if (_caretVisible)
 		drawCaret(true);
 
-	x += _editScrollOffset;
+	if (g_gui.useRTL()) {
+		x = _w - x;
+	}
 
+	x += _editScrollOffset;
 	int width = 0;
+	if (_drawAlign == Graphics::kTextAlignRight)
+		width = _editScrollOffset + getEditRect().width() - g_gui.getStringWidth(_editString, _font);
+
 	uint i;
 
 	uint last = 0;
 	for (i = 0; i < _editString.size(); ++i) {
 		const uint cur = _editString[i];
 		width += g_gui.getCharWidth(cur, _font) + g_gui.getKerningOffset(last, cur, _font);
-		if (width >= x)
+		if (width >= x && width > _editScrollOffset + _leftPadding)
 			break;
 		last = cur;
 	}
-	if (setCaretPos(i))
-		markAsDirty();
+
+	setCaretPos(i);
+	markAsDirty();
 }
 
 void EditTextWidget::drawWidget() {
@@ -99,11 +106,9 @@ void EditTextWidget::drawWidget() {
 	const Common::Rect &r = Common::Rect(_x + 2 + _leftPadding, _y + 2, _x + _leftPadding + getEditRect().width() + 8, _y + _h);
 	setTextDrawableArea(r);
 
-	Graphics::TextAlign alignment = g_gui.useRTL() ? Graphics::kTextAlignRight : Graphics::kTextAlignLeft;
-
 	g_gui.theme()->drawText(
 			Common::Rect(_x + 2 + _leftPadding, _y + 1, _x + _leftPadding + getEditRect().width() + 2, _y + _h),
-			_editString, _state, alignment, ThemeEngine::kTextInversionNone,
+			_editString, _state, _drawAlign, ThemeEngine::kTextInversionNone,
 			-_editScrollOffset, false, _font, ThemeEngine::kFontColorNormal, true, _textDrawableArea);
 }
 
diff --git a/gui/widgets/list.cpp b/gui/widgets/list.cpp
index 3bac870fd5..2ee3a6793b 100644
--- a/gui/widgets/list.cpp
+++ b/gui/widgets/list.cpp
@@ -536,7 +536,6 @@ void ListWidget::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
 void ListWidget::drawWidget() {
 	int i, pos, len = _list.size();
 	Common::String buffer;
-	Graphics::TextAlign alignment = g_gui.useRTL() ? Graphics::kTextAlignRight : Graphics::kTextAlignLeft;
 
 	// Draw a thin frame around the list.
 	g_gui.theme()->drawWidgetBackground(Common::Rect(_x, _y, _x + _w, _y + _h),
@@ -553,14 +552,14 @@ void ListWidget::drawWidget() {
 			inverted = _inversion;
 
 		Common::Rect r(getEditRect());
-		int pad = g_gui.useRTL() ? _rightPadding : _leftPadding;
+		int pad = _leftPadding;
 		int rtlPad = (_x + r.left + _leftPadding) - (_x + _hlLeftPadding);
 
 		// If in numbering mode & not in RTL based GUI, we first print a number prefix
 		if (_numberingMode != kListNumberingOff && g_gui.useRTL() == false) {
 			buffer = Common::String::format("%2d. ", (pos + _numberingMode));
 			g_gui.theme()->drawText(Common::Rect(_x + _hlLeftPadding, y, _x + r.left + _leftPadding, y + fontHeight - 2),
-									buffer, _state, alignment, inverted, _leftPadding, true);
+									buffer, _state, _drawAlign, inverted, _leftPadding, true);
 			pad = 0;
 		}
 
@@ -593,18 +592,18 @@ void ListWidget::drawWidget() {
 			buffer = _list[pos];
 		}
 		g_gui.theme()->drawText(r1, buffer, _state,
-								alignment, inverted, pad, true, ThemeEngine::kFontStyleBold, color);
+								_drawAlign, inverted, pad, true, ThemeEngine::kFontStyleBold, color);
 
 		// If in numbering mode & using RTL layout in GUI, we print a number suffix after drawing the text
 		if (_numberingMode != kListNumberingOff && g_gui.useRTL()) {
-			buffer = Common::String::format("%2d. ", (pos + _numberingMode));
+			buffer = Common::String::format(" .%2d", (pos + _numberingMode));
 
 			Common::Rect r2 = r1;
 
 			r2.left = r1.right;
 			r2.right = r1.right + rtlPad;
 
-			g_gui.theme()->drawText(r2, buffer, _state, alignment, inverted, _leftPadding, true);
+			g_gui.theme()->drawText(r2, buffer, _state, _drawAlign, inverted, _leftPadding, true);
 		}
 	}
 }
diff --git a/gui/widgets/popup.cpp b/gui/widgets/popup.cpp
index bf198dba5b..05d31b079d 100644
--- a/gui/widgets/popup.cpp
+++ b/gui/widgets/popup.cpp
@@ -395,10 +395,11 @@ void PopUpDialog::drawMenuEntry(int entry, bool hilite) {
 	Common::Rect r1(x, y, x + w, y + _lineHeight);
 	Common::Rect r2(x + 1, y + 2, x + w, y + 2 + _lineHeight);
 	Graphics::TextAlign alignment = Graphics::kTextAlignLeft;
+	int pad = _leftPadding;
 
 	if (g_gui.useRTL()) {
 		if (_twoColumns) {
-			r1.translate(this->getWidth() - w, 0);
+			r1.translate(this->getWidth() - w, 0);		// Shift the line-separator to the "first" col of RTL popup
 		}
 
 		r2.left = g_system->getOverlayWidth() - r2.left - w + g_gui.getOverlayOffset();
@@ -410,7 +411,7 @@ void PopUpDialog::drawMenuEntry(int entry, bool hilite) {
 			alignment = Graphics::kTextAlignRight;
 		}
 
-		_leftPadding = 0;
+		pad = _rightPadding;
 	}
 
 	if (name.size() == 0) {
@@ -420,7 +421,7 @@ void PopUpDialog::drawMenuEntry(int entry, bool hilite) {
 		g_gui.theme()->drawText(
 			r2,
 			name, hilite ? ThemeEngine::kStateHighlight : ThemeEngine::kStateEnabled,
-			alignment, ThemeEngine::kTextInversionNone, _leftPadding
+			alignment, ThemeEngine::kTextInversionNone, pad
 		);
 	}
 }
@@ -537,10 +538,12 @@ void PopUpWidget::drawWidget() {
 	if (_selectedItem >= 0)
 		sel = _entries[_selectedItem].name;
 
+	int pad = _leftPadding;
+
 	if (g_gui.useRTL() && _useRTL)
-		_leftPadding = 0;
+		pad = _rightPadding;
 
-	g_gui.theme()->drawPopUpWidget(Common::Rect(_x, _y, _x + _w, _y + _h), sel, _leftPadding, _state, (g_gui.useRTL() && _useRTL));
+	g_gui.theme()->drawPopUpWidget(Common::Rect(_x, _y, _x + _w, _y + _h), sel, pad, _state, (g_gui.useRTL() && _useRTL));
 }
 
 } // End of namespace GUI


Commit: 0005944df3f47a24979fb580ab8dacbafd6cfffe
    https://github.com/scummvm/scummvm/commit/0005944df3f47a24979fb580ab8dacbafd6cfffe
Author: aryanrawlani28 (aryanrawlani007 at gmail.com)
Date: 2020-06-22T00:03:02+02:00

Commit Message:
GUI: RTL: Use proper alignment for achievements tab

Changed paths:
    gui/options.cpp


diff --git a/gui/options.cpp b/gui/options.cpp
index a9a8a568db..c7f19d79df 100644
--- a/gui/options.cpp
+++ b/gui/options.cpp
@@ -1135,6 +1135,8 @@ void OptionsDialog::addAchievementsControls(GuiObject *boss, const Common::Strin
 	uint16 width = g_system->getOverlayWidth() <= 320 ? 240 : 410;
 	uint16 descrDelta = g_system->getOverlayWidth() <= 320 ? 25 : 30;
 
+	Graphics::TextAlign alignment = g_gui.useRTL() ? Graphics::kTextAlignRight : Graphics::kTextAlignLeft;
+
 	for (int16 viewAchieved = 1; viewAchieved >= 0; viewAchieved--) {
 		// run this twice, first view all achieved, then view all non-hidden & non-achieved
 
@@ -1161,7 +1163,7 @@ void OptionsDialog::addAchievementsControls(GuiObject *boss, const Common::Strin
 			yPos += yStep;
 
 	        if (info.descriptions[idx].comment && strlen(info.descriptions[idx].comment) > 0) {
-				new StaticTextWidget(scrollContainer, lineHeight + descrDelta, yPos, width - descrDelta, yStep, info.descriptions[idx].comment, Graphics::kTextAlignLeft, "", ThemeEngine::kFontStyleNormal);
+				new StaticTextWidget(scrollContainer, lineHeight + descrDelta, yPos, width - descrDelta, yStep, info.descriptions[idx].comment, alignment, "", ThemeEngine::kFontStyleNormal);
 				yPos += yStep;
 			}
 
@@ -1171,12 +1173,12 @@ void OptionsDialog::addAchievementsControls(GuiObject *boss, const Common::Strin
 
 	if (nHidden) {
 		Common::String hiddenStr = Common::String::format(_("%d hidden achievements remaining"), nHidden);
-		new StaticTextWidget(scrollContainer, lineHeight, yPos, width, yStep, hiddenStr.c_str(), Graphics::kTextAlignLeft);
+		new StaticTextWidget(scrollContainer, lineHeight, yPos, width, yStep, hiddenStr.c_str(), alignment);
 	}
 
 	if (nMax) {
 		Common::String totalStr = Common::String::format(_("Achievements unlocked: %d/%d"), nAchieved, nMax);
-		new StaticTextWidget(scrollContainer, lineHeight, lineHeight, width, yStep, totalStr.c_str(), Graphics::kTextAlignLeft);
+		new StaticTextWidget(scrollContainer, lineHeight, lineHeight, width, yStep, totalStr.c_str(), alignment);
 
 		SliderWidget *progressBar;
 		progressBar = new SliderWidget(scrollContainer, lineHeight, lineHeight*2, progressBarWidth, lineHeight);


Commit: 1ae2de366b8cba6fd0983aaa9e658f24c26edf11
    https://github.com/scummvm/scummvm/commit/1ae2de366b8cba6fd0983aaa9e658f24c26edf11
Author: aryanrawlani28 (aryanrawlani007 at gmail.com)
Date: 2020-06-22T00:03:02+02:00

Commit Message:
GUI: RTL: Improve tab drawing for rtl

Changed paths:
    gui/ThemeEngine.cpp
    gui/ThemeEngine.h
    gui/widgets/tab.cpp
    gui/widgets/tab.h


diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp
index 208ea42ec0..a1dd39e4cc 100644
--- a/gui/ThemeEngine.cpp
+++ b/gui/ThemeEngine.cpp
@@ -1249,36 +1249,45 @@ void ThemeEngine::drawWidgetBackground(const Common::Rect &r, WidgetBackground b
 }
 
 void ThemeEngine::drawTab(const Common::Rect &r, int tabHeight, const Common::Array<int> &tabWidths,
-                          const Common::Array<Common::String> &tabs, int active, bool rtl, int rtlBackgroundOffset) {
+                          const Common::Array<Common::String> &tabs, int active, bool rtl) {
 	if (!ready())
 		return;
 
 	assert(tabs.size() == tabWidths.size());
 
+	drawDD(kDDTabBackground, Common::Rect(r.left, r.top, r.right, r.top + tabHeight));
+
+	const int numTabs = (int)tabs.size();
+	int width = 0;
+
 	if (rtl) {
-		Common::Rect r2 = r;
-		r2.translate(-rtlBackgroundOffset, 0);
-		drawDD(kDDTabBackground, Common::Rect(r2.left, r2.top, r2.right, r2.top + tabHeight));
-	} else {
-		drawDD(kDDTabBackground, Common::Rect(r.left, r.top, r.right, r.top + tabHeight));
+		for (int i = 0; i < numTabs; i++) {
+			width += tabWidths[i];
+		}
+		width = r.width() - width;
 	}
 
-	int width = 0;
 	int activePos = -1;
-	for (int i = 0; i < (int)tabs.size(); width += tabWidths[i++]) {
-		if (r.left + width > r.right || r.left + width + tabWidths[i] > r.right)
+	for (int i = 0; i < numTabs; i++) {
+		int current = rtl ? (numTabs - i - 1) : i;
+
+		if (r.left + width > r.right || r.left + width + tabWidths[current] > r.right) {
+			width += tabWidths[current];
 			continue;
+		}
 
-		if (i == active) {
+		if (current == active) {
 			activePos = width;
+			width += tabWidths[current];
 			continue;
 		}
 
 
-		Common::Rect tabRect(r.left + width, r.top, r.left + width + tabWidths[i], r.top + tabHeight);
+		Common::Rect tabRect(r.left + width, r.top, r.left + width + tabWidths[current], r.top + tabHeight);
 		drawDD(kDDTabInactive, tabRect);
-		drawDDText(getTextData(kDDTabInactive), getTextColor(kDDTabInactive), tabRect, tabs[i], false, false,
+		drawDDText(getTextData(kDDTabInactive), getTextColor(kDDTabInactive), tabRect, tabs[current], false, false,
 		           _widgets[kDDTabInactive]->_textAlignH, _widgets[kDDTabInactive]->_textAlignV);
+		width += tabWidths[current];
 	}
 
 	if (activePos >= 0) {
diff --git a/gui/ThemeEngine.h b/gui/ThemeEngine.h
index 952b9a8d8f..bdc92b103c 100644
--- a/gui/ThemeEngine.h
+++ b/gui/ThemeEngine.h
@@ -442,7 +442,7 @@ public:
 	                     WidgetStateInfo state = kStateEnabled, bool rtl = false);
 
 	void drawTab(const Common::Rect &r, int tabHeight, const Common::Array<int> &tabWidths,
-	             const Common::Array<Common::String> &tabs, int active, bool rtl = false, int rtlBackgroundOffset = 0);
+	             const Common::Array<Common::String> &tabs, int active, bool rtl = false);
 
 	void drawScrollbar(const Common::Rect &r, int sliderY, int sliderHeight, ScrollbarState scrollState);
 
diff --git a/gui/widgets/tab.cpp b/gui/widgets/tab.cpp
index 98507c4cd5..bc04b63f3a 100644
--- a/gui/widgets/tab.cpp
+++ b/gui/widgets/tab.cpp
@@ -80,10 +80,6 @@ void TabWidget::init() {
 	_navRight->setEnabled(true);
 
 	_lastRead = -1;
-	_widthTillLastTab = 0;
-	_rtlTabOffset = 0;
-	_rtlSpaceOffset = 0;
-	_rtlBackgroundOffset = 0;
 }
 
 TabWidget::~TabWidget() {
@@ -129,9 +125,6 @@ int TabWidget::addTab(const String &title, const String &dialogName) {
 		newWidth = _minTabWidth;
 	newTab._tabWidth = newWidth;
 
-	if (g_gui.useRTL())
-		_widthTillLastTab += newWidth;
-
 	_tabs.push_back(newTab);
 
 	int numTabs = _tabs.size();
@@ -152,11 +145,6 @@ void TabWidget::removeTab(int tabID) {
 		_firstWidget = nullptr;
 	}
 
-	// Remove this tab's width from class variable, which is used to adjust position in RTL based GUI
-	if (g_gui.useRTL()) {
-		_widthTillLastTab -= _tabs[tabID]._tabWidth;
-	}
-
 	// Dispose the widgets in that tab and then the tab itself
 	delete _tabs[tabID].firstWidget;
 	_tabs.remove_at(tabID);
@@ -212,9 +200,6 @@ void TabWidget::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
 
 		if (_firstVisibleTab > 0) {
 			setFirstVisible(_firstVisibleTab - 1);
-			if (g_gui.useRTL()) {
-				_rtlTabOffset++;
-			}
 		}
 		if (_firstVisibleTab == 0) {
 			_navLeft->setEnabled(false);
@@ -228,9 +213,6 @@ void TabWidget::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
 
 		if (_lastVisibleTab + 1 < (int)_tabs.size()) {
 			setFirstVisible(_firstVisibleTab + 1, false);
-			if (g_gui.useRTL()) {
-				_rtlTabOffset--;
-			}
 		}
 		if (_lastVisibleTab + 1 == (int)_tabs.size()) {
 			_navRight->setEnabled(false);
@@ -298,12 +280,26 @@ bool TabWidget::handleKeyDown(Common::KeyState state) {
 void TabWidget::adjustTabs(int value) {
 	// Determine which tab is next
 	int tabID = _activeTab + value;
+	int lastVis = _lastVisibleTab;
+
 	if (tabID >= (int)_tabs.size())
 		tabID = 0;
 	else if (tabID < 0)
 		tabID = ((int)_tabs.size() - 1);
 
 	setActiveTab(tabID);
+
+	if (_navButtonsVisible) {
+		if (lastVis != _lastVisibleTab) {
+			_navLeft->setEnabled(true);
+			_navRight->setEnabled(true);
+		}
+
+		if (_firstVisibleTab == 0)
+			_navLeft->setEnabled(false);
+		else if (_lastVisibleTab == _tabs.size() - 1)
+			_navRight->setEnabled(false);
+	}
 }
 
 int TabWidget::getFirstVisible() const {
@@ -390,46 +386,19 @@ void TabWidget::reflowLayout() {
 void TabWidget::drawWidget() {
 	Common::Array<Common::String> tabs;
 	Common::Array<int> widths;
+	int totalWidth = 0;
 	for (int i = _firstVisibleTab; i <= _lastVisibleTab; ++i) {
-		int idx = g_gui.useRTL() ? (_lastVisibleTab - i - _rtlTabOffset) : i;
-
-		tabs.push_back(_tabs[idx].title);
-		widths.push_back(_tabs[idx]._tabWidth);
+		tabs.push_back(_tabs[i].title);
+		widths.push_back(_tabs[i]._tabWidth);
+		totalWidth += _tabs[i]._tabWidth;
 	}
 
-	Common::Rect r1(_x + _bodyLP, _y + _bodyTP, _x + _w - _bodyRP, _y + _h - _bodyBP + _tabHeight);
-
-	g_gui.theme()->drawDialogBackground(r1, _bodyBackgroundType);
-
-	int drawTab = _activeTab - _firstVisibleTab;
-	Common::Rect r2(_x, _y, _x + _w, _y + _h);
-
-	if (g_gui.useRTL()) {
-		int pad = this->getWidth() - (_x + _widthTillLastTab) + g_gui.getOverlayOffset();
-		if (pad < 0) {
-			pad = 6;
-		}
-
-		if (g_gui.getOverlayOffset() == 0 && g_system->getOverlayHeight() < 400) {
-			/** When the overlay offset is 0 and overlay height < 400, we have a top stacked dialog with no
-				relative padding and are in lowres mode. The minimum size of TabWidget.Tab is in _minTabWidth,
-				we add half of that towards our pad.
-			*/
-			pad += (_minTabWidth / 2);
-		}
-
-		_rtlBackgroundOffset = ABS(this->getWidth() - _widthTillLastTab);
+	g_gui.theme()->drawDialogBackground(
+			Common::Rect(_x + _bodyLP, _y + _bodyTP, _x + _w - _bodyRP, _y + _h - _bodyBP + _tabHeight),
+			_bodyBackgroundType);
 
-		r2.translate(g_system->getOverlayWidth() - _x - _w + pad + _rtlSpaceOffset, 0);
-		if (_navButtonsVisible) {
-			r2.translate(_butW - 6, 0);
-			_rtlBackgroundOffset += (_butW * 2);
-		}
-
-		drawTab = _lastVisibleTab - drawTab + _rtlTabOffset;
-	}
-
-	g_gui.theme()->drawTab(r2, _tabHeight, widths, tabs, drawTab, (g_gui.useRTL() && _useRTL), _rtlBackgroundOffset);
+	g_gui.theme()->drawTab(Common::Rect(_x, _y, _x + _w, _y + _h), _tabHeight, widths, tabs,
+				_activeTab - _firstVisibleTab, (g_gui.useRTL() && _useRTL));
 }
 
 void TabWidget::draw() {
@@ -500,10 +469,6 @@ void TabWidget::computeLastVisibleTab(bool adjustFirstIfRoom) {
 			_firstVisibleTab--;
 		}
 	}
-
-	if (g_gui.useRTL() && _navButtonsVisible) {
-		_rtlSpaceOffset = availableWidth;
-	}
 }
 
 } // End of namespace GUI
diff --git a/gui/widgets/tab.h b/gui/widgets/tab.h
index abe4b2d320..d7f75bd460 100644
--- a/gui/widgets/tab.h
+++ b/gui/widgets/tab.h
@@ -51,10 +51,6 @@ protected:
 	TabList _tabs;
 	int _tabHeight;
 	int _minTabWidth;
-	int _widthTillLastTab;
-	int _rtlTabOffset;
-	int _rtlSpaceOffset;
-	int _rtlBackgroundOffset;
 
 	int _bodyRP, _bodyTP, _bodyLP, _bodyBP;
 	ThemeEngine::DialogBackground _bodyBackgroundType;


Commit: e6e32aeb7553533f73435bf281997de7f743b421
    https://github.com/scummvm/scummvm/commit/e6e32aeb7553533f73435bf281997de7f743b421
Author: BLooperZ (blooperz at users.noreply.github.com)
Date: 2020-06-22T00:03:02+02:00

Commit Message:
GUI: use start + end for horizontal align

Changed paths:
    gui/ThemeEngine.cpp
    gui/ThemeEngine.h
    gui/ThemeParser.cpp
    gui/themes/default.inc
    gui/themes/scummclassic.zip
    gui/themes/scummclassic/classic_gfx.stx
    gui/themes/scummmodern.zip
    gui/themes/scummmodern/scummmodern_gfx.stx
    gui/themes/scummremastered.zip
    gui/themes/scummremastered/remastered_gfx.stx


diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp
index a1dd39e4cc..9c1da2f2c0 100644
--- a/gui/ThemeEngine.cpp
+++ b/gui/ThemeEngine.cpp
@@ -76,7 +76,7 @@ struct WidgetDrawData {
 
 	TextData _textDataId;
 	TextColor _textColorId;
-	Graphics::TextAlign _textAlignH;
+	GUI::ThemeEngine::TextAlignH _textAlignH;
 	GUI::ThemeEngine::TextAlignVertical _textAlignV;
 
 	/** Extra space that the widget occupies when it's drawn.
@@ -153,19 +153,10 @@ static const DrawDataInfo kDrawDataDefaults[] = {
 	{kDDCheckboxSelected,           "checkbox_selected",          kDrawLayerForeground,  kDDCheckboxDefault},
 	{kDDCheckboxDisabledSelected,   "checkbox_disabled_selected", kDrawLayerForeground,  kDDCheckboxDisabled},
 
-	{kDDCheckboxDefaultRTL,            "checkbox_default_rtl",           kDrawLayerBackground,   kDDNone},
-	{kDDCheckboxDisabledRTL,           "checkbox_disabled_rtl",          kDrawLayerBackground,   kDDNone},
-	{kDDCheckboxSelectedRTL,           "checkbox_selected_rtl",          kDrawLayerForeground,  kDDCheckboxDefaultRTL},
-	{kDDCheckboxDisabledSelectedRTL,   "checkbox_disabled_selected_rtl", kDrawLayerForeground,  kDDCheckboxDisabledRTL},
-
 	{kDDRadiobuttonDefault,         "radiobutton_default",      kDrawLayerBackground,   kDDNone},
 	{kDDRadiobuttonDisabled,        "radiobutton_disabled",     kDrawLayerBackground,   kDDNone},
 	{kDDRadiobuttonSelected,        "radiobutton_selected",     kDrawLayerForeground,  kDDRadiobuttonDefault},
 
-	{kDDRadiobuttonDefaultRTL,		"radiobutton_default_rtl",	kDrawLayerBackground,	kDDNone},
-	{kDDRadiobuttonDisabledRTL,		"radiobutton_disabled_rtl",	kDrawLayerBackground,	kDDNone},
-	{kDDRadiobuttonSelectedRTL,		"radiobutton_selected_rtl",	kDrawLayerForeground,	kDDRadiobuttonDefaultRTL},
-
 	{kDDTabActive,                  "tab_active",               kDrawLayerForeground,  kDDTabInactive},
 	{kDDTabInactive,                "tab_inactive",             kDrawLayerBackground,   kDDNone},
 	{kDDTabBackground,              "tab_background",           kDrawLayerBackground,   kDDNone},
@@ -513,7 +504,7 @@ void ThemeEngine::addDrawStep(const Common::String &drawDataId, const Graphics::
 	_widgets[id]->_steps.push_back(step);
 }
 
-bool ThemeEngine::addTextData(const Common::String &drawDataId, TextData textId, TextColor colorId, Graphics::TextAlign alignH, TextAlignVertical alignV) {
+bool ThemeEngine::addTextData(const Common::String &drawDataId, TextData textId, TextColor colorId, TextAlignH alignH, TextAlignVertical alignV) {
 	DrawData id = parseDrawDataId(drawDataId);
 
 	if (id == -1 || textId == -1 || colorId == kTextColorMAX || !_widgets[id])
@@ -968,7 +959,7 @@ void ThemeEngine::drawButton(const Common::Rect &r, const Common::String &str, W
 		dd = kDDButtonPressed;
 
 	drawDD(dd, r, 0, hints & WIDGET_CLEARBG);
-	drawDDText(getTextData(dd), getTextColor(dd), r, str, false, true, _widgets[dd]->_textAlignH,
+	drawDDText(getTextData(dd), getTextColor(dd), r, str, false, true, convertTextAlignH(_widgets[dd]->_textAlignH, false),
 	           _widgets[dd]->_textAlignV);
 }
 
@@ -998,7 +989,7 @@ void ThemeEngine::drawDropDownButton(const Common::Rect &r, uint32 dropdownWidth
 	Common::Rect textRect = r;
 	textRect.left  = r.left  + dropdownWidth;
 	textRect.right = r.right - dropdownWidth;
-	drawDDText(getTextData(dd), getTextColor(dd), textRect, str, false, true, _widgets[dd]->_textAlignH,
+	drawDDText(getTextData(dd), getTextColor(dd), textRect, str, false, true, convertTextAlignH(_widgets[dd]->_textAlignH, rtl),
 	           _widgets[dd]->_textAlignV);
 }
 
@@ -1014,40 +1005,32 @@ void ThemeEngine::drawCheckbox(const Common::Rect &r, const Common::String &str,
 		return;
 
 	Common::Rect r2 = r;
-	DrawData dd = rtl ? kDDCheckboxDefaultRTL : kDDCheckboxDefault;
+	DrawData dd = kDDCheckboxDefault;
 
 	if (checked)
-		dd = rtl ? kDDCheckboxSelectedRTL : kDDCheckboxSelected;
+		dd = kDDCheckboxSelected;
 
-	if (state == kStateDisabled) {
-		if (checked)
-			dd = rtl ? kDDCheckboxDisabledSelectedRTL : kDDCheckboxDisabledSelected;
-		else
-			dd = rtl ? kDDCheckboxDisabledRTL : kDDCheckboxDisabled;
-	}
+	if (state == kStateDisabled)
+		dd = checked ? kDDCheckboxDisabledSelected : kDDCheckboxDisabled;
 
 	const int checkBoxSize = MIN((int)r.height(), getFontHeight());
-	r2.bottom = r2.top + checkBoxSize;
 
-	if (rtl) {
-		r2.left = r.right - checkBoxSize;
-		r2.right = r.right;
-	} else {
-		r2.right = r2.left + checkBoxSize;
-	}
+	r2.left = rtl ? r.right - checkBoxSize : r2.left;
+	r2.bottom = r2.top + checkBoxSize;
+	r2.right = r2.left + checkBoxSize;
 
 	drawDD(dd, r2);
 
 	if (rtl) {
+		r2.right = r2.left - checkBoxSize;
 		r2.left = r.left;
-		r2.right = r.right - (checkBoxSize * 2);
 	} else {
 		r2.left = r2.right + checkBoxSize;
 		r2.right = r.right;
 	}
 
 	if (r2.right > r2.left) {
-		drawDDText(getTextData(dd), getTextColor(dd), r2, str, true, false, _widgets[dd]->_textAlignH,
+		drawDDText(getTextData(dd), getTextColor(dd), r2, str, true, false, convertTextAlignH(_widgets[dd]->_textAlignH, rtl),
 		           _widgets[dd]->_textAlignV);
 	}
 }
@@ -1057,36 +1040,32 @@ void ThemeEngine::drawRadiobutton(const Common::Rect &r, const Common::String &s
 		return;
 
 	Common::Rect r2 = r;
-	DrawData dd = rtl ? kDDRadiobuttonDefaultRTL : kDDRadiobuttonDefault;
+	DrawData dd = kDDRadiobuttonDefault;
 
 	if (checked)
-		dd = rtl ? kDDRadiobuttonSelectedRTL : kDDRadiobuttonSelected;
+		dd = kDDRadiobuttonSelected;
 
 	if (state == kStateDisabled)
-		dd = rtl ? kDDRadiobuttonDisabledRTL : kDDRadiobuttonDisabled;
+		dd = kDDRadiobuttonDisabled;
 
-	const int radioButtonSize = MIN((int)r.height(), getFontHeight());
-	r2.bottom = r2.top + radioButtonSize;
+	const int checkBoxSize = MIN((int)r.height(), getFontHeight());
 
-	if (rtl) {
-		r2.left = r.right - radioButtonSize;
-		r2.right = r.right;
-	} else {
-		r2.right = r2.left + radioButtonSize;
-	}
+	r2.left = rtl ? r2.right - checkBoxSize : r2.left;
+	r2.bottom = r2.top + checkBoxSize;
+	r2.right = r2.left + checkBoxSize;
 
 	drawDD(dd, r2);
 
 	if (rtl) {
+		r2.right = r2.left - checkBoxSize;
 		r2.left = r.left;
-		r2.right = r.right - (radioButtonSize * 2);
 	} else {
-		r2.left = r2.right + radioButtonSize;
+		r2.left = r2.right + checkBoxSize;
 		r2.right = MAX(r2.left, r.right);
 	}
 
-	drawDDText(getTextData(dd), getTextColor(dd), r2, str, true, false, _widgets[dd]->_textAlignH,
-		_widgets[dd]->_textAlignV);
+	drawDDText(getTextData(dd), getTextColor(dd), r2, str, true, false, convertTextAlignH(_widgets[dd]->_textAlignH, rtl),
+	           _widgets[dd]->_textAlignV);
 }
 
 void ThemeEngine::drawSlider(const Common::Rect &r, int width, WidgetStateInfo state, bool rtl) {
@@ -1199,7 +1178,7 @@ void ThemeEngine::drawPopUpWidget(const Common::Rect &r, const Common::String &s
 
 	if (!sel.empty() && r.width() >= 13 && r.height() >= 1) {
 		Common::Rect text(r.left + 3, r.top + 1, r.right - 10, r.bottom);
-		drawDDText(getTextData(dd), getTextColor(dd), text, sel, true, false, _widgets[dd]->_textAlignH,
+		drawDDText(getTextData(dd), getTextColor(dd), text, sel, true, false, convertTextAlignH(_widgets[dd]->_textAlignH, rtl),
 		           _widgets[dd]->_textAlignV, deltax);
 	}
 }
@@ -1286,7 +1265,7 @@ void ThemeEngine::drawTab(const Common::Rect &r, int tabHeight, const Common::Ar
 		Common::Rect tabRect(r.left + width, r.top, r.left + width + tabWidths[current], r.top + tabHeight);
 		drawDD(kDDTabInactive, tabRect);
 		drawDDText(getTextData(kDDTabInactive), getTextColor(kDDTabInactive), tabRect, tabs[current], false, false,
-		           _widgets[kDDTabInactive]->_textAlignH, _widgets[kDDTabInactive]->_textAlignV);
+		           convertTextAlignH(_widgets[kDDTabInactive]->_textAlignH, rtl), _widgets[kDDTabInactive]->_textAlignV);
 		width += tabWidths[current];
 	}
 
@@ -1296,7 +1275,7 @@ void ThemeEngine::drawTab(const Common::Rect &r, int tabHeight, const Common::Ar
 		const uint16 tabRight = MAX(r.right - tabRect.right, 0);
 		drawDD(kDDTabActive, tabRect, (tabLeft << 16) | (tabRight & 0xFFFF));
 		drawDDText(getTextData(kDDTabActive), getTextColor(kDDTabActive), tabRect, tabs[active], false, false,
-		           _widgets[kDDTabActive]->_textAlignH, _widgets[kDDTabActive]->_textAlignV);
+		           convertTextAlignH(_widgets[kDDTabActive]->_textAlignH, rtl), _widgets[kDDTabActive]->_textAlignV);
 	}
 }
 
@@ -2017,6 +1996,23 @@ void ThemeEngine::drawToScreen() {
 	_vectorRenderer->setSurface(&_screen);
 }
 
+Graphics::TextAlign convertTextAlignH(GUI::ThemeEngine::TextAlignH alignH, bool rtl) {
+	switch (alignH) {
+		case GUI::ThemeEngine::kTextAlignHStart:
+			return rtl ? Graphics::kTextAlignRight : Graphics::kTextAlignLeft;
+		case GUI::ThemeEngine::kTextAlignHEnd:
+			return rtl ? Graphics::kTextAlignLeft : Graphics::kTextAlignRight;
+		case GUI::ThemeEngine::kTextAlignHLeft:
+			return Graphics::kTextAlignLeft;
+		case GUI::ThemeEngine::kTextAlignHCenter:
+			return Graphics::kTextAlignCenter;
+		case GUI::ThemeEngine::kTextAlignHRight:
+			return Graphics::kTextAlignRight;
+		default:
+			return Graphics::kTextAlignInvalid;
+	}
+}
+
 Common::Rect ThemeEngine::swapClipRect(const Common::Rect &newRect) {
 	Common::Rect oldRect = _clip;
 	_clip = newRect;
diff --git a/gui/ThemeEngine.h b/gui/ThemeEngine.h
index bdc92b103c..7c1c586f4b 100644
--- a/gui/ThemeEngine.h
+++ b/gui/ThemeEngine.h
@@ -103,19 +103,10 @@ enum DrawData {
 	kDDCheckboxSelected,
 	kDDCheckboxDisabledSelected,
 
-	kDDCheckboxDefaultRTL,
-	kDDCheckboxDisabledRTL,
-	kDDCheckboxSelectedRTL,
-	kDDCheckboxDisabledSelectedRTL,
-
 	kDDRadiobuttonDefault,
 	kDDRadiobuttonDisabled,
 	kDDRadiobuttonSelected,
 
-	kDDRadiobuttonDefaultRTL,
-	kDDRadiobuttonDisabledRTL,
-	kDDRadiobuttonSelectedRTL,
-
 	kDDTabActive,
 	kDDTabInactive,
 	kDDTabBackground,
@@ -195,6 +186,15 @@ public:
 		kTextAlignVTop
 	};
 
+	enum TextAlignH {
+		kTextAlignHInvalid,
+		kTextAlignHStart,     ///< Text should be aligned to start of line
+		kTextAlignHLeft,     ///< Text should be aligned to the left
+		kTextAlignHCenter,   ///< Text should be centered
+		kTextAlignHEnd,     ///< Text should be aligned to end of line
+		kTextAlignHRight     ///< Text should be aligned to the right
+	};
+
 	/// Widget background type
 	enum WidgetBackground {
 		kWidgetBackgroundNo,            ///< No background at all
@@ -555,7 +555,7 @@ public:
 	 * Adds a new TextStep from the ThemeParser. This will be deprecated/removed once the
 	 * new Font API is in place. FIXME: Is that so ???
 	 */
-	bool addTextData(const Common::String &drawDataId, TextData textId, TextColor id, Graphics::TextAlign alignH, TextAlignVertical alignV);
+	bool addTextData(const Common::String &drawDataId, TextData textId, TextColor id, TextAlignH alignH, TextAlignVertical alignV);
 
 protected:
 	/**
@@ -776,6 +776,8 @@ protected:
 	Common::Rect _clip;
 };
 
+Graphics::TextAlign convertTextAlignH(GUI::ThemeEngine::TextAlignH alignH, bool rtl);
+
 } // End of namespace GUI.
 
 #endif
diff --git a/gui/ThemeParser.cpp b/gui/ThemeParser.cpp
index 8e576feff6..eb14746a81 100644
--- a/gui/ThemeParser.cpp
+++ b/gui/ThemeParser.cpp
@@ -80,15 +80,19 @@ static TextColor parseTextColorId(const Common::String &name) {
 	return kTextColorMAX;
 }
 
-static Graphics::TextAlign parseTextHAlign(const Common::String &val) {
-	if (val == "left")
-		return Graphics::kTextAlignLeft;
+GUI::ThemeEngine::TextAlignH parseTextHAlign(const Common::String &val) {
+	if (val == "start")
+		return GUI::ThemeEngine::kTextAlignHStart;
+	else if (val == "end")
+		return GUI::ThemeEngine::kTextAlignHEnd;
+	else if (val == "left")
+		return GUI::ThemeEngine::kTextAlignHLeft;
 	else if (val == "right")
-		return Graphics::kTextAlignRight;
+		return GUI::ThemeEngine::kTextAlignHRight;
 	else if (val == "center")
-		return Graphics::kTextAlignCenter;
+		return GUI::ThemeEngine::kTextAlignHCenter;
 	else
-		return Graphics::kTextAlignInvalid;
+		return GUI::ThemeEngine::kTextAlignHInvalid;
 }
 
 static GUI::ThemeEngine::TextAlignVertical parseTextVAlign(const Common::String &val) {
@@ -253,10 +257,10 @@ bool ThemeParser::parserCallback_alphabitmap(ParserNode *node) {
 }
 
 bool ThemeParser::parserCallback_text(ParserNode *node) {
-	Graphics::TextAlign alignH;
+	GUI::ThemeEngine::TextAlignH alignH;
 	GUI::ThemeEngine::TextAlignVertical alignV;
 
-	if ((alignH = parseTextHAlign(node->values["horizontal_align"])) == Graphics::kTextAlignInvalid)
+	if ((alignH = parseTextHAlign(node->values["horizontal_align"])) == GUI::ThemeEngine::kTextAlignHInvalid)
 		return parserError("Invalid value for text alignment.");
 
 	if ((alignV = parseTextVAlign(node->values["vertical_align"])) == GUI::ThemeEngine::kTextAlignVInvalid)
@@ -702,10 +706,10 @@ bool ThemeParser::parserCallback_widget(ParserNode *node) {
 				return parserError("Corrupted height value in key for " + var);
 		}
 
-		Graphics::TextAlign alignH = Graphics::kTextAlignLeft;
+		GUI::ThemeEngine::TextAlignH alignH = GUI::ThemeEngine::kTextAlignHStart;
 
 		if (node->values.contains("textalign")) {
-			if ((alignH = parseTextHAlign(node->values["textalign"])) == Graphics::kTextAlignInvalid)
+			if ((alignH = parseTextHAlign(node->values["textalign"])) == GUI::ThemeEngine::kTextAlignHInvalid)
 				return parserError("Invalid value for text alignment.");
 		}
 
@@ -713,7 +717,8 @@ bool ThemeParser::parserCallback_widget(ParserNode *node) {
 			useRTL = false;
 		}
 
-		_theme->getEvaluator()->addWidget(var, node->values["type"], width, height, alignH, useRTL);
+		Graphics::TextAlign textAlign = GUI::convertTextAlignH(alignH, false);
+		_theme->getEvaluator()->addWidget(var, node->values["type"], width, height, textAlign, useRTL);
 	}
 
 	return true;
@@ -961,9 +966,9 @@ bool ThemeParser::parseCommonLayoutProps(ParserNode *node, const Common::String
 
 
 	if (node->values.contains("textalign")) {
-		Graphics::TextAlign alignH = Graphics::kTextAlignLeft;
+		GUI::ThemeEngine::TextAlignH alignH = GUI::ThemeEngine::kTextAlignHStart;
 
-		if ((alignH = parseTextHAlign(node->values["textalign"])) == Graphics::kTextAlignInvalid)
+		if ((alignH = parseTextHAlign(node->values["textalign"])) == GUI::ThemeEngine::kTextAlignHInvalid)
 			return parserError("Invalid value for text alignment.");
 
 		_theme->getEvaluator()->setVar(var + "Align", alignH);
diff --git a/gui/themes/default.inc b/gui/themes/default.inc
index 964752b865..9c6f0c01ae 100644
--- a/gui/themes/default.inc
+++ b/gui/themes/default.inc
@@ -1305,22 +1305,6 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "fg_color='lightgrey' "
 "/>"
 "</drawdata>"
-"<drawdata id='checkbox_disabled_selected_rtl' cache='false'>"
-"<drawstep func='bevelsq' "
-"bevel='2' "
-"fill='none' "
-"/>"
-"<drawstep func='cross' "
-"fill='foreground' "
-"stroke='2' "
-"fg_color='lightgrey' "
-"/>"
-"<text font='text_default' "
-"text_color='color_normal_disabled' "
-"vertical_align='top' "
-"horizontal_align='right' "
-"/>"
-"</drawdata>"
 "<drawdata id='checkbox_disabled' cache='false'>"
 "<text font='text_default' "
 "text_color='color_normal_disabled' "
@@ -1332,17 +1316,6 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "fill='none' "
 "/>"
 "</drawdata>"
-"<drawdata id='checkbox_disabled_rtl' cache='false'>"
-"<drawstep func='bevelsq' "
-"bevel='2' "
-"fill='none' "
-"/>"
-"<text font='text_default' "
-"text_color='color_normal_disabled' "
-"vertical_align='top' "
-"horizontal_align='right' "
-"/>"
-"</drawdata>"
 "<drawdata id='checkbox_selected' cache='false'>"
 "<text font='text_default' "
 "text_color='color_normal' "
@@ -1359,22 +1332,6 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "fg_color='green' "
 "/>"
 "</drawdata>"
-"<drawdata id='checkbox_selected_rtl' cache='false'>"
-"<drawstep func='bevelsq' "
-"bevel='2' "
-"fill='none' "
-"/>"
-"<drawstep func='cross' "
-"fill='foreground' "
-"stroke='2' "
-"fg_color='green' "
-"/>"
-"<text font='text_default' "
-"text_color='color_normal' "
-"vertical_align='top' "
-"horizontal_align='right' "
-"/>"
-"</drawdata>"
 "<drawdata id='checkbox_default' cache='false'>"
 "<text font='text_default' "
 "text_color='color_normal' "
@@ -1386,17 +1343,6 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "fill='none' "
 "/>"
 "</drawdata>"
-"<drawdata id='checkbox_default_rtl' cache='false'>"
-"<drawstep func='bevelsq' "
-"bevel='2' "
-"fill='none' "
-"/>"
-"<text font='text_default' "
-"text_color='color_normal' "
-"vertical_align='top' "
-"horizontal_align='right' "
-"/>"
-"</drawdata>"
 "<drawdata id='radiobutton_default' cache='false'>"
 "<text font='text_default' "
 "text_color='color_normal' "
@@ -1413,22 +1359,6 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "ypos='0' "
 "/>"
 "</drawdata>"
-"<drawdata id='radiobutton_default_rtl' cache='false'>"
-"<drawstep func='circle' "
-"width='7' "
-"height='7' "
-"radius='7' "
-"fill='background' "
-"bg_color='darkgrey' "
-"xpos='0' "
-"ypos='0' "
-"/>"
-"<text font='text_default' "
-"text_color='color_normal' "
-"vertical_align='center' "
-"horizontal_align='right' "
-"/>"
-"</drawdata>"
 "<drawdata id='radiobutton_selected' cache='false'>"
 "<text font='text_default' "
 "text_color='color_normal' "
@@ -1454,31 +1384,6 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "ypos='2' "
 "/>"
 "</drawdata>"
-"<drawdata id='radiobutton_selected_rtl' cache='false'>"
-"<drawstep func='circle' "
-"width='7' "
-"height='7' "
-"radius='7' "
-"fg_color='darkgrey' "
-"fill='none' "
-"xpos='0' "
-"ypos='0' "
-"/>"
-"<drawstep func='circle' "
-"width='7' "
-"height='7' "
-"radius='5' "
-"fg_color='green' "
-"fill='foreground' "
-"xpos='2' "
-"ypos='2' "
-"/>"
-"<text font='text_default' "
-"text_color='color_normal' "
-"vertical_align='center' "
-"horizontal_align='right' "
-"/>"
-"</drawdata>"
 "<drawdata id='radiobutton_disabled' cache='false'>"
 "<text font='text_default' "
 "text_color='color_normal_disabled' "
@@ -1495,22 +1400,6 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "ypos='0' "
 "/>"
 "</drawdata>"
-"<drawdata id='radiobutton_disabled_rtl' cache='false'>"
-"<drawstep func='circle' "
-"width='7' "
-"height='7' "
-"radius='7' "
-"bg_color='lightgrey' "
-"fill='background' "
-"xpos='0' "
-"ypos='0' "
-"/>"
-"<text font='text_default' "
-"text_color='color_normal_disabled' "
-"vertical_align='center' "
-"horizontal_align='right' "
-"/>"
-"</drawdata>"
 "<drawdata id='widget_default' cache='false'>"
 "<drawstep func='bevelsq' "
 "bevel='2' "
diff --git a/gui/themes/scummclassic.zip b/gui/themes/scummclassic.zip
index ee4246432f..22e23511ae 100644
Binary files a/gui/themes/scummclassic.zip and b/gui/themes/scummclassic.zip differ
diff --git a/gui/themes/scummclassic/classic_gfx.stx b/gui/themes/scummclassic/classic_gfx.stx
index 1bfca70587..4d8d404a4a 100644
--- a/gui/themes/scummclassic/classic_gfx.stx
+++ b/gui/themes/scummclassic/classic_gfx.stx
@@ -346,7 +346,7 @@
 		<text	font = 'text_default'
 				text_color = 'color_normal'
 				vertical_align = 'center'
-				horizontal_align = 'left'
+				horizontal_align = 'start'
 		/>
 	</drawdata>
 	<drawdata id = 'popup_idle_rtl' cache = 'false' resolution = 'y>399'>
@@ -380,7 +380,7 @@
 		<text	font = 'text_default'
 				text_color = 'color_normal'
 				vertical_align = 'center'
-				horizontal_align = 'right'
+				horizontal_align = 'start'
 		/>
 	</drawdata>
 
@@ -415,7 +415,7 @@
 		<text	font = 'text_default'
 				text_color = 'color_normal'
 				vertical_align = 'center'
-				horizontal_align = 'left'
+				horizontal_align = 'start'
 		/>
 	</drawdata>
 	<drawdata id = 'popup_idle_rtl' cache = 'false' resolution = 'y<400'>
@@ -449,7 +449,7 @@
 		<text	font = 'text_default'
 				text_color = 'color_normal'
 				vertical_align = 'center'
-				horizontal_align = 'right'
+				horizontal_align = 'start'
 		/>
 	</drawdata>
 
@@ -482,7 +482,7 @@
 		<text	font = 'text_default'
 				text_color = 'color_normal_disabled'
 				vertical_align = 'center'
-				horizontal_align = 'left'
+				horizontal_align = 'start'
 		/>
 	</drawdata>
 	<drawdata id = 'popup_disabled_rtl' cache = 'false' resolution = 'y>399'>
@@ -514,7 +514,7 @@
 		<text	font = 'text_default'
 				text_color = 'color_normal_disabled'
 				vertical_align = 'center'
-				horizontal_align = 'right'
+				horizontal_align = 'start'
 		/>
 	</drawdata>
 
@@ -549,7 +549,7 @@
 		<text	font = 'text_default'
 				text_color = 'color_normal'
 				vertical_align = 'center'
-				horizontal_align = 'left'
+				horizontal_align = 'start'
 		/>
 	</drawdata>
 	<drawdata id = 'popup_disabled_rtl' cache = 'false' resolution = 'y<400'>
@@ -583,7 +583,7 @@
 		<text	font = 'text_default'
 				text_color = 'color_normal'
 				vertical_align = 'center'
-				horizontal_align = 'right'
+				horizontal_align = 'start'
 		/>
 	</drawdata>
 
@@ -616,7 +616,7 @@
 		<text	font = 'text_default'
 				text_color = 'color_normal_hover'
 				vertical_align = 'center'
-				horizontal_align = 'left'
+				horizontal_align = 'start'
 		/>
 	</drawdata>
 	<drawdata id = 'popup_hover_rtl' cache = 'false' resolution = 'y>399'>
@@ -648,7 +648,7 @@
 		<text	font = 'text_default'
 				text_color = 'color_normal_hover'
 				vertical_align = 'center'
-				horizontal_align = 'right'
+				horizontal_align = 'start'
 		/>
 	</drawdata>
 
@@ -683,7 +683,7 @@
 		<text	font = 'text_default'
 				text_color = 'color_normal'
 				vertical_align = 'center'
-				horizontal_align = 'left'
+				horizontal_align = 'start'
 		/>
 	</drawdata>
 	<drawdata id = 'popup_hover_rtl' cache = 'false' resolution = 'y<400'>
@@ -717,7 +717,7 @@
 		<text	font = 'text_default'
 				text_color = 'color_normal'
 				vertical_align = 'center'
-				horizontal_align = 'right'
+				horizontal_align = 'start'
 		/>
 	</drawdata>
 
@@ -1398,7 +1398,7 @@
 		<text	font = 'text_default'
 				text_color = 'color_normal_disabled'
 				vertical_align = 'top'
-				horizontal_align = 'left'
+				horizontal_align = 'start'
 		/>
 		<drawstep	func = 'bevelsq'
 					bevel = '2'
@@ -1410,51 +1410,24 @@
 					fg_color = 'lightgrey'
 		/>
 	</drawdata>
-	<drawdata id = 'checkbox_disabled_selected_rtl' cache = 'false'>
-		<drawstep	func = 'bevelsq'
-					bevel = '2'
-					fill = 'none'
-		/>
-		<drawstep	func = 'cross'
-					fill = 'foreground'
-					stroke = '2'
-					fg_color = 'lightgrey'
-		/>
-		<text	font = 'text_default'
-				text_color = 'color_normal_disabled'
-				vertical_align = 'top'
-				horizontal_align = 'right'
-		/>
-	</drawdata>
 
 	<drawdata id = 'checkbox_disabled' cache = 'false'>
 		<text	font = 'text_default'
 				text_color = 'color_normal_disabled'
 				vertical_align = 'top'
-				horizontal_align = 'left'
-		/>
-		<drawstep	func = 'bevelsq'
-					bevel = '2'
-					fill = 'none'
+				horizontal_align = 'start'
 		/>
-	</drawdata>
-	<drawdata id = 'checkbox_disabled_rtl' cache = 'false'>
 		<drawstep	func = 'bevelsq'
 					bevel = '2'
 					fill = 'none'
 		/>
-		<text	font = 'text_default'
-				text_color = 'color_normal_disabled'
-				vertical_align = 'top'
-				horizontal_align = 'right'
-		/>
 	</drawdata>
 
 	<drawdata id = 'checkbox_selected' cache = 'false'>
 		<text	font = 'text_default'
 				text_color = 'color_normal'
 				vertical_align = 'top'
-				horizontal_align = 'left'
+				horizontal_align = 'start'
 		/>
 		<drawstep	func = 'bevelsq'
 					bevel = '2'
@@ -1466,52 +1439,25 @@
 					fg_color = 'green'
 		/>
 	</drawdata>
-	<drawdata id = 'checkbox_selected_rtl' cache = 'false'>
-		<drawstep	func = 'bevelsq'
-					bevel = '2'
-					fill = 'none'
-		/>
-		<drawstep	func = 'cross'
-					fill = 'foreground'
-					stroke = '2'
-					fg_color = 'green'
-		/>
-		<text	font = 'text_default'
-				text_color = 'color_normal'
-				vertical_align = 'top'
-				horizontal_align = 'right'
-		/>
-	</drawdata>
 
 	<drawdata id = 'checkbox_default' cache = 'false'>
 		<text	font = 'text_default'
 				text_color = 'color_normal'
 				vertical_align = 'top'
-				horizontal_align = 'left'
+				horizontal_align = 'start'
 		/>
 		<drawstep	func = 'bevelsq'
 					bevel = '2'
 					fill = 'none'
 		/>
 	</drawdata>
-	<drawdata id = 'checkbox_default_rtl' cache = 'false'>
-		<drawstep	func = 'bevelsq'
-					bevel = '2'
-					fill = 'none'
-		/>
-		<text	font = 'text_default'
-				text_color = 'color_normal'
-				vertical_align = 'top'
-				horizontal_align = 'right'
-		/>
-	</drawdata>
 
 	<!-- Idle radiobutton -->
 	<drawdata id = 'radiobutton_default' cache = 'false'>
 		<text	font = 'text_default'
 				text_color = 'color_normal'
 				vertical_align = 'center'
-				horizontal_align = 'left'
+				horizontal_align = 'start'
 		/>
 		<drawstep	func = 'circle'
 					width = '7'
@@ -1523,50 +1469,14 @@
 					ypos = '0'
 		/>
 	</drawdata>
-	<drawdata id = 'radiobutton_default_rtl' cache = 'false'>
-		<drawstep	func = 'circle'
-					width = '7'
-					height = '7'
-					radius = '7'
-					fill = 'background'
-					bg_color = 'darkgrey'
-					xpos = '0'
-					ypos = '0'
-		/>
-		<text	font = 'text_default'
-				text_color = 'color_normal'
-				vertical_align = 'center'
-				horizontal_align = 'right'
-		/>
-	</drawdata>
 
 	<!-- Selected radiobutton -->
 	<drawdata id = 'radiobutton_selected' cache = 'false'>
 		<text	font = 'text_default'
 				text_color = 'color_normal'
 				vertical_align = 'center'
-				horizontal_align = 'left'
-		/>
-		<drawstep	func = 'circle'
-					width = '7'
-					height = '7'
-					radius = '7'
-					fg_color = 'darkgrey'
-					fill = 'none'
-					xpos = '0'
-					ypos = '0'
-		/>
-		<drawstep	func = 'circle'
-					width = '7'
-					height = '7'
-					radius = '5'
-					fg_color = 'green'
-					fill = 'foreground'
-					xpos = '2'
-					ypos = '2'
+				horizontal_align = 'start'
 		/>
-	</drawdata>
-	<drawdata id = 'radiobutton_selected_rtl' cache = 'false'>
 		<drawstep	func = 'circle'
 					width = '7'
 					height = '7'
@@ -1585,11 +1495,6 @@
 					xpos = '2'
 					ypos = '2'
 		/>
-		<text	font = 'text_default'
-				text_color = 'color_normal'
-				vertical_align = 'center'
-				horizontal_align = 'right'
-		/>
 	</drawdata>
 
 	<!-- Disabled radiobutton -->
@@ -1597,19 +1502,8 @@
 		<text	font = 'text_default'
 				text_color = 'color_normal_disabled'
 				vertical_align = 'center'
-				horizontal_align = 'left'
-		/>
-		<drawstep	func = 'circle'
-					width = '7'
-					height = '7'
-					radius = '7'
-					bg_color = 'lightgrey'
-					fill = 'background'
-					xpos = '0'
-					ypos = '0'
+				horizontal_align = 'start'
 		/>
-	</drawdata>
-	<drawdata id = 'radiobutton_disabled_rtl' cache = 'false'>
 		<drawstep	func = 'circle'
 					width = '7'
 					height = '7'
@@ -1619,11 +1513,6 @@
 					xpos = '0'
 					ypos = '0'
 		/>
-		<text	font = 'text_default'
-				text_color = 'color_normal_disabled'
-				vertical_align = 'center'
-				horizontal_align = 'right'
-		/>
 	</drawdata>
 
 	<drawdata id = 'widget_default' cache = 'false'>
diff --git a/gui/themes/scummmodern.zip b/gui/themes/scummmodern.zip
index 3c97b41922..388117ce66 100644
Binary files a/gui/themes/scummmodern.zip and b/gui/themes/scummmodern.zip differ
diff --git a/gui/themes/scummmodern/scummmodern_gfx.stx b/gui/themes/scummmodern/scummmodern_gfx.stx
index fcd86799ed..8749774f30 100644
--- a/gui/themes/scummmodern/scummmodern_gfx.stx
+++ b/gui/themes/scummmodern/scummmodern_gfx.stx
@@ -523,7 +523,7 @@
 		<text	font = 'text_default'
 				text_color = 'color_normal'
 				vertical_align = 'center'
-				horizontal_align = 'left'
+				horizontal_align = 'start'
 		/>
 	</drawdata>
 	<drawdata id = 'popup_idle_rtl' cache = 'false' resolution = 'y>399'>
@@ -561,7 +561,7 @@
 		<text	font = 'text_default'
 				text_color = 'color_normal'
 				vertical_align = 'center'
-				horizontal_align = 'right'
+				horizontal_align = 'start'
 		/>
 	</drawdata>
 
@@ -600,7 +600,7 @@
 		<text	font = 'text_default'
 				text_color = 'color_normal'
 				vertical_align = 'center'
-				horizontal_align = 'left'
+				horizontal_align = 'start'
 		/>
 	</drawdata>
 	<drawdata id = 'popup_idle_rtl' cache = 'false' resolution ='y<400'>
@@ -638,7 +638,7 @@
 		<text	font = 'text_default'
 				text_color = 'color_normal'
 				vertical_align = 'center'
-				horizontal_align = 'right'
+				horizontal_align = 'start'
 		/>
 	</drawdata>
 
@@ -678,7 +678,7 @@
 		<text	font = 'text_default'
 				text_color = 'color_normal_hover'
 				vertical_align = 'center'
-				horizontal_align = 'left'
+				horizontal_align = 'start'
 		/>
 	</drawdata>
 	<drawdata id = 'popup_disabled_rtl' cache = 'false' resolution = 'y>399'>
@@ -716,7 +716,7 @@
 		<text	font = 'text_default'
 				text_color = 'color_normal_hover'
 				vertical_align = 'center'
-				horizontal_align = 'right'
+				horizontal_align = 'start'
 		/>
 	</drawdata>
 
@@ -755,7 +755,7 @@
 		<text	font = 'text_default'
 				text_color = 'color_normal'
 				vertical_align = 'center'
-				horizontal_align = 'left'
+				horizontal_align = 'start'
 		/>
 	</drawdata>
 	<drawdata id = 'popup_disabled_rtl' cache = 'false' resolution = 'y<400'>
@@ -793,7 +793,7 @@
 		<text	font = 'text_default'
 				text_color = 'color_normal'
 				vertical_align = 'center'
-				horizontal_align = 'right'
+				horizontal_align = 'start'
 		/>
 	</drawdata>
 
@@ -833,7 +833,7 @@
 		<text	font = 'text_default'
 				text_color = 'color_normal_hover'
 				vertical_align = 'center'
-				horizontal_align = 'left'
+				horizontal_align = 'start'
 		/>
 	</drawdata>
 	<drawdata id = 'popup_hover_rtl' cache = 'false' resolution = 'y>399'>
@@ -871,7 +871,7 @@
 		<text	font = 'text_default'
 				text_color = 'color_normal_hover'
 				vertical_align = 'center'
-				horizontal_align = 'right'
+				horizontal_align = 'start'
 		/>
 	</drawdata>
 
@@ -910,7 +910,7 @@
 		<text	font = 'text_default'
 				text_color = 'color_normal'
 				vertical_align = 'center'
-				horizontal_align = 'left'
+				horizontal_align = 'start'
 		/>
 	</drawdata>
 	<drawdata id = 'popup_hover_rtl' cache = 'false' resolution = 'y<400'>
@@ -948,7 +948,7 @@
 		<text	font = 'text_default'
 				text_color = 'color_normal'
 				vertical_align = 'center'
-				horizontal_align = 'right'
+				horizontal_align = 'start'
 		/>
 	</drawdata>
 
@@ -1796,109 +1796,59 @@
 		<text	font = 'text_default'
 				text_color = 'color_normal_disabled'
 				vertical_align = 'top'
-				horizontal_align = 'left'
+				horizontal_align = 'start'
 		/>
 		<drawstep	func = 'bitmap'
 					file = 'checkbox_disabled.bmp'
 		/>
 	</drawdata>
-	<drawdata id = 'checkbox_disabled_selected_rtl' cache = 'false'>
-		<drawstep	func = 'bitmap'
-					file = 'checkbox_disabled.bmp'
-		/>
-		<text	font = 'text_default'
-				text_color = 'color_normal_disabled'
-				vertical_align = 'top'
-				horizontal_align = 'right'
-		/>
-	</drawdata>
 
 	<!-- Disabled checkbox -->
 	<drawdata id = 'checkbox_disabled' cache = 'false'>
 		<text	font = 'text_default'
 				text_color = 'color_normal_disabled'
 				vertical_align = 'top'
-				horizontal_align = 'left'
+				horizontal_align = 'start'
 		/>
 		<drawstep	func = 'bitmap'
 					file = 'checkbox_empty.bmp'
 		/>
 	</drawdata>
-	<drawdata id = 'checkbox_disabled_rtl' cache = 'false'>
-		<drawstep	func = 'bitmap'
-					file = 'checkbox_empty.bmp'
-		/>
-		<text	font = 'text_default'
-				text_color = 'color_normal_disabled'
-				vertical_align = 'top'
-				horizontal_align = 'right'
-		/>
-	</drawdata>
 
 	<!-- Selected checkbox -->
 	<drawdata id = 'checkbox_selected' cache = 'false'>
 		<text	font = 'text_default'
 				text_color = 'color_normal'
 				vertical_align = 'top'
-				horizontal_align = 'left'
+				horizontal_align = 'start'
 		/>
 		<drawstep	func = 'bitmap'
 					file = 'checkbox.bmp'
 		/>
 	</drawdata>
-	<drawdata id = 'checkbox_selected_rtl' cache = 'false'>
-		<drawstep	func = 'bitmap'
-					file = 'checkbox.bmp'
-		/>
-		<text	font = 'text_default'
-				text_color = 'color_normal'
-				vertical_align = 'top'
-				horizontal_align = 'right'
-		/>
-	</drawdata>
 
 	<!-- Idle checkbox -->
 	<drawdata id = 'checkbox_default' cache = 'false'>
 		<text	font = 'text_default'
 				text_color = 'color_normal'
 				vertical_align = 'top'
-				horizontal_align = 'left'
+				horizontal_align = 'start'
 		/>
 		<drawstep	func = 'bitmap'
 					file = 'checkbox_empty.bmp'
 		/>
 	</drawdata>
-	<drawdata id = 'checkbox_default_rtl' cache = 'false'>
-		<drawstep	func = 'bitmap'
-					file = 'checkbox_empty.bmp'
-		/>
-		<text	font = 'text_default'
-				text_color = 'color_normal'
-				vertical_align = 'top'
-				horizontal_align = 'right'
-		/>
-	</drawdata>
 
 	<!-- Idle radiobutton -->
 	<drawdata id = 'radiobutton_default' cache = 'false'>
 		<text	font = 'text_default'
 				text_color = 'color_normal'
 				vertical_align = 'center'
-				horizontal_align = 'left'
-		/>
-		<drawstep	func = 'bitmap'
-					file = 'radiobutton_empty.bmp'
+				horizontal_align = 'start'
 		/>
-	</drawdata>
-	<drawdata id = 'radiobutton_default_rtl' cache = 'false'>
 		<drawstep	func = 'bitmap'
 					file = 'radiobutton_empty.bmp'
 		/>
-		<text	font = 'text_default'
-				text_color = 'color_normal'
-				vertical_align = 'center'
-				horizontal_align = 'right'
-		/>
 	</drawdata>
 
 	<!-- Selected radiobutton -->
@@ -1906,21 +1856,11 @@
 		<text	font = 'text_default'
 				text_color = 'color_normal'
 				vertical_align = 'center'
-				horizontal_align = 'left'
-		/>
-		<drawstep	func = 'bitmap'
-					file = 'radiobutton.bmp'
+				horizontal_align = 'start'
 		/>
-	</drawdata>
-	<drawdata id = 'radiobutton_selected_rtl' cache = 'false'>
 		<drawstep	func = 'bitmap'
 					file = 'radiobutton.bmp'
 		/>
-		<text	font = 'text_default'
-				text_color = 'color_normal'
-				vertical_align = 'center'
-				horizontal_align = 'right'
-		/>
 	</drawdata>
 
 	<!-- Disabled radiobutton -->
@@ -1928,21 +1868,11 @@
 		<text	font = 'text_default'
 				text_color = 'color_normal_disabled'
 				vertical_align = 'center'
-				horizontal_align = 'left'
-		/>
-		<drawstep	func = 'bitmap'
-					file = 'radiobutton_empty.bmp'
+				horizontal_align = 'start'
 		/>
-	</drawdata>
-	<drawdata id = 'radiobutton_disabled_rtl' cache = 'false'>
 		<drawstep	func = 'bitmap'
 					file = 'radiobutton_empty.bmp'
 		/>
-		<text	font = 'text_default'
-				text_color = 'color_normal_disabled'
-				vertical_align = 'center'
-				horizontal_align = 'right'
-		/>
 	</drawdata>
 
 	<!-- Background of the list widget (the games list and the list in the choosers) -->
diff --git a/gui/themes/scummremastered.zip b/gui/themes/scummremastered.zip
index 905bd18f6e..4264926ea3 100644
Binary files a/gui/themes/scummremastered.zip and b/gui/themes/scummremastered.zip differ
diff --git a/gui/themes/scummremastered/remastered_gfx.stx b/gui/themes/scummremastered/remastered_gfx.stx
index 577fd82b26..db0f1ae28d 100644
--- a/gui/themes/scummremastered/remastered_gfx.stx
+++ b/gui/themes/scummremastered/remastered_gfx.stx
@@ -521,7 +521,7 @@
 		<text	font = 'text_default'
 				text_color = 'color_normal'
 				vertical_align = 'center'
-				horizontal_align = 'left'
+				horizontal_align = 'start'
 		/>
 	</drawdata>
 	<drawdata id = 'popup_idle_rtl' cache = 'false' resolution = 'y>399'>
@@ -559,7 +559,7 @@
 		<text	font = 'text_default'
 				text_color = 'color_normal'
 				vertical_align = 'center'
-				horizontal_align = 'right'
+				horizontal_align = 'start'
 		/>
 	</drawdata>
 
@@ -598,7 +598,7 @@
 		<text	font = 'text_default'
 				text_color = 'color_normal'
 				vertical_align = 'center'
-				horizontal_align = 'left'
+				horizontal_align = 'start'
 		/>
 	</drawdata>
 	<drawdata id = 'popup_idle_rtl' cache = 'false' resolution = 'y<400'>
@@ -636,7 +636,7 @@
 		<text	font = 'text_default'
 				text_color = 'color_normal'
 				vertical_align = 'center'
-				horizontal_align = 'right'
+				horizontal_align = 'start'
 		/>
 	</drawdata>
 
@@ -676,7 +676,7 @@
 		<text	font = 'text_default'
 				text_color = 'color_normal_disabled'
 				vertical_align = 'center'
-				horizontal_align = 'left'
+				horizontal_align = 'start'
 		/>
 	</drawdata>
 	<drawdata id = 'popup_disabled_rtl' cache = 'false' resolution = 'y>399'>
@@ -714,7 +714,7 @@
 		<text	font = 'text_default'
 				text_color = 'color_normal_disabled'
 				vertical_align = 'center'
-				horizontal_align = 'right'
+				horizontal_align = 'start'
 		/>
 	</drawdata>
 
@@ -753,7 +753,7 @@
 		<text	font = 'text_default'
 				text_color = 'color_normal'
 				vertical_align = 'center'
-				horizontal_align = 'left'
+				horizontal_align = 'start'
 		/>
 	</drawdata>
 	<drawdata id = 'popup_disabled_rtl' cache = 'false' resolution = 'y<400'>
@@ -791,7 +791,7 @@
 		<text	font = 'text_default'
 				text_color = 'color_normal'
 				vertical_align = 'center'
-				horizontal_align = 'right'
+				horizontal_align = 'start'
 		/>
 	</drawdata>
 
@@ -831,7 +831,7 @@
 		<text	font = 'text_default'
 				text_color = 'color_normal_hover'
 				vertical_align = 'center'
-				horizontal_align = 'left'
+				horizontal_align = 'start'
 		/>
 	</drawdata>
 	<drawdata id = 'popup_hover_rtl' cache = 'false' resolution = 'y>399'>
@@ -869,7 +869,7 @@
 		<text	font = 'text_default'
 				text_color = 'color_normal_hover'
 				vertical_align = 'center'
-				horizontal_align = 'right'
+				horizontal_align = 'start'
 		/>
 	</drawdata>
 
@@ -908,7 +908,7 @@
 		<text	font = 'text_default'
 				text_color = 'color_normal'
 				vertical_align = 'center'
-				horizontal_align = 'left'
+				horizontal_align = 'start'
 		/>
 	</drawdata>
 	<drawdata id = 'popup_hover_rtl' cache = 'false' resolution = 'y<400'>
@@ -946,7 +946,7 @@
 		<text	font = 'text_default'
 				text_color = 'color_normal'
 				vertical_align = 'center'
-				horizontal_align = 'right'
+				horizontal_align = 'start'
 		/>
 	</drawdata>
 
@@ -1644,109 +1644,59 @@
 		<text	font = 'text_default'
 				text_color = 'color_normal_disabled'
 				vertical_align = 'top'
-				horizontal_align = 'left'
+				horizontal_align = 'start'
 		/>
 		<drawstep	func = 'bitmap'
 					file = 'checkbox_disabled.bmp'
 		/>
 	</drawdata>
-	<drawdata id = 'checkbox_disabled_selected_rtl' cache = 'false'>
-		<drawstep	func = 'bitmap'
-					file = 'checkbox_disabled.bmp'
-		/>
-		<text	font = 'text_default'
-				text_color = 'color_normal_disabled'
-				vertical_align = 'top'
-				horizontal_align = 'right'
-		/>
-	</drawdata>
 
 	<!-- Disabled checkbox -->
 	<drawdata id = 'checkbox_disabled' cache = 'false'>
 		<text	font = 'text_default'
 				text_color = 'color_normal_disabled'
 				vertical_align = 'top'
-				horizontal_align = 'left'
+				horizontal_align = 'start'
 		/>
 		<drawstep	func = 'bitmap'
 					file = 'checkbox_empty.bmp'
 		/>
 	</drawdata>
-	<drawdata id = 'checkbox_disabled_rtl' cache = 'false'>
-		<drawstep	func = 'bitmap'
-					file = 'checkbox_empty.bmp'
-		/>
-		<text	font = 'text_default'
-				text_color = 'color_normal_disabled'
-				vertical_align = 'top'
-				horizontal_align = 'right'
-		/>
-	</drawdata>
 
 	<!-- Selected checkbox -->
 	<drawdata id = 'checkbox_selected' cache = 'false'>
 		<text	font = 'text_default'
 				text_color = 'color_normal'
 				vertical_align = 'top'
-				horizontal_align = 'left'
+				horizontal_align = 'start'
 		/>
 		<drawstep	func = 'bitmap'
 					file = 'checkbox.bmp'
 		/>
 	</drawdata>
-	<drawdata id = 'checkbox_selected_rtl' cache = 'false'>
-		<drawstep	func = 'bitmap'
-					file = 'checkbox.bmp'
-		/>
-		<text	font = 'text_default'
-				text_color = 'color_normal'
-				vertical_align = 'top'
-				horizontal_align = 'right'
-		/>
-	</drawdata>
 
 	<!-- Idle checkbox -->
 	<drawdata id = 'checkbox_default' cache = 'false'>
 		<text	font = 'text_default'
 				text_color = 'color_normal'
 				vertical_align = 'top'
-				horizontal_align = 'left'
+				horizontal_align = 'start'
 		/>
 		<drawstep	func = 'bitmap'
 					file = 'checkbox_empty.bmp'
 		/>
 	</drawdata>
-	<drawdata id = 'checkbox_default_rtl' cache = 'false'>
-		<drawstep	func = 'bitmap'
-					file = 'checkbox_empty.bmp'
-		/>
-		<text	font = 'text_default'
-				text_color = 'color_normal'
-				vertical_align = 'top'
-				horizontal_align = 'right'
-		/>
-	</drawdata>
 
 	<!-- Idle radiobutton -->
 	<drawdata id = 'radiobutton_default' cache = 'false'>
 		<text	font = 'text_default'
 				text_color = 'color_normal'
 				vertical_align = 'center'
-				horizontal_align = 'left'
-		/>
-		<drawstep	func = 'bitmap'
-					file = 'radiobutton_empty.bmp'
+				horizontal_align = 'start'
 		/>
-	</drawdata>
-	<drawdata id = 'radiobutton_default_rtl' cache = 'false'>
 		<drawstep	func = 'bitmap'
 					file = 'radiobutton_empty.bmp'
 		/>
-		<text	font = 'text_default'
-				text_color = 'color_normal'
-				vertical_align = 'center'
-				horizontal_align = 'right'
-		/>
 	</drawdata>
 
 	<!-- Selected radiobutton -->
@@ -1754,21 +1704,11 @@
 		<text	font = 'text_default'
 				text_color = 'color_normal'
 				vertical_align = 'center'
-				horizontal_align = 'left'
-		/>
-		<drawstep	func = 'bitmap'
-					file = 'radiobutton.bmp'
+				horizontal_align = 'start'
 		/>
-	</drawdata>
-	<drawdata id = 'radiobutton_selected_rtl' cache = 'false'>
 		<drawstep	func = 'bitmap'
 					file = 'radiobutton.bmp'
 		/>
-		<text	font = 'text_default'
-				text_color = 'color_normal'
-				vertical_align = 'center'
-				horizontal_align = 'right'
-		/>
 	</drawdata>
 
 	<!-- Disabled radiobutton -->
@@ -1776,21 +1716,11 @@
 		<text	font = 'text_default'
 				text_color = 'color_normal_disabled'
 				vertical_align = 'center'
-				horizontal_align = 'left'
-		/>
-		<drawstep	func = 'bitmap'
-					file = 'radiobutton_empty.bmp'
+				horizontal_align = 'start'
 		/>
-	</drawdata>
-	<drawdata id = 'radiobutton_disabled_rtl' cache = 'false'>
 		<drawstep	func = 'bitmap'
 					file = 'radiobutton_empty.bmp'
 		/>
-		<text	font = 'text_default'
-				text_color = 'color_normal_disabled'
-				vertical_align = 'center'
-				horizontal_align = 'right'
-		/>
 	</drawdata>
 
 	<!-- Background of the list widget (the games list and the list in the choosers) -->


Commit: 4fc9c11bbeb4a8a0d8bec87947a04c82485288a6
    https://github.com/scummvm/scummvm/commit/4fc9c11bbeb4a8a0d8bec87947a04c82485288a6
Author: BLooperZ (blooperz at users.noreply.github.com)
Date: 2020-06-22T00:03:02+02:00

Commit Message:
GUI: use start + end for static widgets

Changed paths:
    backends/keymapper/remap-widget.cpp
    gui/ThemeEval.cpp
    gui/ThemeEval.h
    gui/ThemeLayout.cpp
    gui/ThemeLayout.h
    gui/ThemeParser.cpp
    gui/options.cpp
    gui/saveload-dialog.cpp
    gui/widget.cpp
    gui/widget.h


diff --git a/backends/keymapper/remap-widget.cpp b/backends/keymapper/remap-widget.cpp
index 9e736bd3f8..cb4150dffd 100644
--- a/backends/keymapper/remap-widget.cpp
+++ b/backends/keymapper/remap-widget.cpp
@@ -270,13 +270,11 @@ void RemapWidget::loadKeymap() {
 }
 
 void RemapWidget::refreshKeymap() {
-	Graphics::TextAlign alignment = g_gui.useRTL() ? Graphics::kTextAlignRight : Graphics::kTextAlignLeft;
-
 	for (uint i = 0; i < _actions.size(); i++) {
 		ActionRow &row = _actions[i];
 
 		if (!row.actionText) {
-			row.actionText = new GUI::StaticTextWidget(widgetsBoss(), 0, 0, 0, 0, "", alignment, nullptr, GUI::ThemeEngine::kFontStyleNormal);
+			row.actionText = new GUI::StaticTextWidget(widgetsBoss(), 0, 0, 0, 0, "", GUI::ThemeEngine::kTextAlignHStart, nullptr, GUI::ThemeEngine::kFontStyleNormal);
 			row.actionText->setLabel(row.action->description);
 
 			row.keyButton = new GUI::DropdownButtonWidget(widgetsBoss(), 0, 0, 0, 0, "", nullptr, kRemapCmd + i);
@@ -305,7 +303,7 @@ void RemapWidget::refreshKeymap() {
 
 		KeymapTitleRow &keymapTitle = _keymapSeparators[row.keymap];
 		if (!keymapTitle.descriptionText) {
-			keymapTitle.descriptionText = new GUI::StaticTextWidget(widgetsBoss(), 0, 0, 0, 0, row.keymap->getDescription(), alignment);
+			keymapTitle.descriptionText = new GUI::StaticTextWidget(widgetsBoss(), 0, 0, 0, 0, row.keymap->getDescription(), GUI::ThemeEngine::kTextAlignHStart);
 			keymapTitle.resetButton = new GUI::ButtonWidget(widgetsBoss(), 0, 0, 0, 0, "", nullptr, kResetKeymapCmd + i);
 
 			// I18N: Button to reset keymap mappings to defaults
diff --git a/gui/ThemeEval.cpp b/gui/ThemeEval.cpp
index f7d0fde913..62fed6f2af 100644
--- a/gui/ThemeEval.cpp
+++ b/gui/ThemeEval.cpp
@@ -71,7 +71,7 @@ bool ThemeEval::getWidgetData(const Common::String &widget, int16 &x, int16 &y,
 	return _layouts[dialogName]->getWidgetData(widgetName, x, y, w, h, useRTL);
 }
 
-Graphics::TextAlign ThemeEval::getWidgetTextHAlign(const Common::String &widget) {
+GUI::ThemeEngine::TextAlignH ThemeEval::getWidgetTextHAlign(const Common::String &widget) {
 	Common::StringTokenizer tokenizer(widget, ".");
 
 	if (widget.hasPrefix("Dialog."))
@@ -81,20 +81,20 @@ Graphics::TextAlign ThemeEval::getWidgetTextHAlign(const Common::String &widget)
 	Common::String widgetName = tokenizer.nextToken();
 
 	if (!_layouts.contains(dialogName))
-		return Graphics::kTextAlignInvalid;
+		return GUI::ThemeEngine::kTextAlignHInvalid;
 
 	return _layouts[dialogName]->getWidgetTextHAlign(widgetName);
 }
 
-ThemeEval &ThemeEval::addWidget(const Common::String &name, const Common::String &type, int w, int h, Graphics::TextAlign align, bool useRTL) {
+ThemeEval &ThemeEval::addWidget(const Common::String &name, const Common::String &type, int w, int h, GUI::ThemeEngine::TextAlignH align, bool useRTL) {
 	int typeW = -1;
 	int typeH = -1;
-	Graphics::TextAlign typeAlign = Graphics::kTextAlignInvalid;
+	GUI::ThemeEngine::TextAlignH typeAlign = GUI::ThemeEngine::kTextAlignHInvalid;
 
 	if (!type.empty()) {
 		typeW = getVar("Globals." + type + ".Width", -1);
 		typeH = getVar("Globals." + type + ".Height", -1);
-		typeAlign = (Graphics::TextAlign)getVar("Globals." + type + ".Align", Graphics::kTextAlignInvalid);
+		typeAlign = (GUI::ThemeEngine::TextAlignH)getVar("Globals." + type + ".Align", GUI::ThemeEngine::kTextAlignHInvalid);
 	}
 
 	ThemeLayoutWidget *widget;
@@ -102,13 +102,13 @@ ThemeEval &ThemeEval::addWidget(const Common::String &name, const Common::String
 		widget = new ThemeLayoutTabWidget(_curLayout.top(), name,
 									typeW == -1 ? w : typeW,
 									typeH == -1 ? h : typeH,
-									typeAlign == Graphics::kTextAlignInvalid ? align : typeAlign,
+									typeAlign == GUI::ThemeEngine::kTextAlignHInvalid ? align : typeAlign,
 									getVar("Globals.TabWidget.Tab.Height", 0));
 	else
 		widget = new ThemeLayoutWidget(_curLayout.top(), name,
 									typeW == -1 ? w : typeW,
 									typeH == -1 ? h : typeH,
-									typeAlign == Graphics::kTextAlignInvalid ? align : typeAlign,
+									typeAlign == GUI::ThemeEngine::kTextAlignHInvalid ? align : typeAlign,
 									useRTL);
 
 	_curLayout.top()->addChild(widget);
diff --git a/gui/ThemeEval.h b/gui/ThemeEval.h
index ff7fe82a94..b2f14a0f90 100644
--- a/gui/ThemeEval.h
+++ b/gui/ThemeEval.h
@@ -32,6 +32,7 @@
 #include "graphics/font.h"
 
 #include "gui/ThemeLayout.h"
+#include "gui/ThemeEngine.h"
 
 namespace GUI {
 
@@ -76,7 +77,7 @@ public:
 
 	ThemeEval &addDialog(const Common::String &name, const Common::String &overlays, int16 maxWidth = -1, int16 maxHeight = -1, int inset = 0);
 	ThemeEval &addLayout(ThemeLayout::LayoutType type, int spacing = -1, ThemeLayout::ItemAlign itemAlign = ThemeLayout::kItemAlignStart);
-	ThemeEval &addWidget(const Common::String &name, const Common::String &type, int w = -1, int h = -1, Graphics::TextAlign align = Graphics::kTextAlignLeft, bool useRTL = false);
+	ThemeEval &addWidget(const Common::String &name, const Common::String &type, int w = -1, int h = -1, GUI::ThemeEngine::TextAlignH align = GUI::ThemeEngine::kTextAlignHStart, bool useRTL = false);
 	ThemeEval &addImportedLayout(const Common::String &name);
 	ThemeEval &addSpace(int size = -1);
 
@@ -91,7 +92,7 @@ public:
 	bool getWidgetData(const Common::String &widget, int16 &x, int16 &y, int16 &w, int16 &h);
 	bool getWidgetData(const Common::String &widget, int16 &x, int16 &y, int16 &w, int16 &h, bool &useRTL);
 
-	Graphics::TextAlign getWidgetTextHAlign(const Common::String &widget);
+	GUI::ThemeEngine::TextAlignH getWidgetTextHAlign(const Common::String &widget);
 
 #ifdef LAYOUT_DEBUG_DIALOG
 	void debugDraw(Graphics::Surface *screen, const Graphics::Font *font) {
diff --git a/gui/ThemeLayout.cpp b/gui/ThemeLayout.cpp
index bc02efbd4c..743e8c56d8 100644
--- a/gui/ThemeLayout.cpp
+++ b/gui/ThemeLayout.cpp
@@ -89,20 +89,20 @@ bool ThemeLayout::getWidgetData(const Common::String &name, int16 &x, int16 &y,
 	return false;
 }
 
-Graphics::TextAlign ThemeLayout::getWidgetTextHAlign(const Common::String &name) {
+GUI::ThemeEngine::TextAlignH ThemeLayout::getWidgetTextHAlign(const Common::String &name) {
 	if (name.empty()) {
 		assert(getLayoutType() == kLayoutMain);
 		return _textHAlign;
 	}
 
-	Graphics::TextAlign res;
+	GUI::ThemeEngine::TextAlignH res;
 
 	for (uint i = 0; i < _children.size(); ++i) {
-		if ((res = _children[i]->getWidgetTextHAlign(name)) != Graphics::kTextAlignInvalid)
+		if ((res = _children[i]->getWidgetTextHAlign(name)) != GUI::ThemeEngine::kTextAlignHInvalid)
 			return res;
 	}
 
-	return Graphics::kTextAlignInvalid;
+	return GUI::ThemeEngine::kTextAlignHInvalid;
 }
 
 int16 ThemeLayoutStacked::getParentWidth() {
@@ -172,12 +172,12 @@ bool ThemeLayoutWidget::getWidgetData(const Common::String &name, int16 &x, int1
 	return false;
 }
 
-Graphics::TextAlign ThemeLayoutWidget::getWidgetTextHAlign(const Common::String &name) {
+GUI::ThemeEngine::TextAlignH ThemeLayoutWidget::getWidgetTextHAlign(const Common::String &name) {
 	if (name == _name) {
 		return _textHAlign;
 	}
 
-	return Graphics::kTextAlignInvalid;
+	return GUI::ThemeEngine::kTextAlignHInvalid;
 }
 
 void ThemeLayoutWidget::reflowLayout(Widget *widgetChain) {
diff --git a/gui/ThemeLayout.h b/gui/ThemeLayout.h
index 25ec9eb997..fafb82c1e3 100644
--- a/gui/ThemeLayout.h
+++ b/gui/ThemeLayout.h
@@ -26,6 +26,7 @@
 #include "common/array.h"
 #include "common/rect.h"
 #include "graphics/font.h"
+#include "gui/ThemeEngine.h"
 
 #ifdef LAYOUT_DEBUG_DIALOG
 namespace Graphics {
@@ -63,7 +64,7 @@ public:
 	ThemeLayout(ThemeLayout *p) :
 		_parent(p), _x(0), _y(0), _w(-1), _h(-1),
 		_defaultW(-1), _defaultH(-1),
-		_textHAlign(Graphics::kTextAlignInvalid) {}
+		_textHAlign(GUI::ThemeEngine::kTextAlignHInvalid) {}
 
 	virtual ~ThemeLayout() {
 		for (uint i = 0; i < _children.size(); ++i)
@@ -100,7 +101,7 @@ protected:
 
 	void setWidth(int16 width) { _w = width; }
 	void setHeight(int16 height) { _h = height; }
-	void setTextHAlign(Graphics::TextAlign align) { _textHAlign = align; }
+	void setTextHAlign(GUI::ThemeEngine::TextAlignH align) { _textHAlign = align; }
 
 	/**
 	 * Checks if the layout element is attached to a GUI widget
@@ -116,11 +117,11 @@ protected:
 public:
 	virtual bool getWidgetData(const Common::String &name, int16 &x, int16 &y, int16 &w, int16 &h, bool &useRTL);
 
-	virtual Graphics::TextAlign getWidgetTextHAlign(const Common::String &name);
+	virtual GUI::ThemeEngine::TextAlignH getWidgetTextHAlign(const Common::String &name);
 
 	void importLayout(ThemeLayout *layout);
 
-	Graphics::TextAlign getTextHAlign() { return _textHAlign; }
+	GUI::ThemeEngine::TextAlignH getTextHAlign() { return _textHAlign; }
 
 #ifdef LAYOUT_DEBUG_DIALOG
 	void debugDraw(Graphics::Surface *screen, const Graphics::Font *font);
@@ -135,7 +136,7 @@ protected:
 	Common::Rect _padding;
 	Common::Array<ThemeLayout *> _children;
 	int16 _defaultW, _defaultH;
-	Graphics::TextAlign _textHAlign;
+	GUI::ThemeEngine::TextAlignH _textHAlign;
 };
 
 class ThemeLayoutMain : public ThemeLayout {
@@ -220,7 +221,7 @@ protected:
 
 class ThemeLayoutWidget : public ThemeLayout {
 public:
-	ThemeLayoutWidget(ThemeLayout *p, const Common::String &name, int16 w, int16 h, Graphics::TextAlign align, bool &useRTL) : ThemeLayout(p), _name(name) {
+	ThemeLayoutWidget(ThemeLayout *p, const Common::String &name, int16 w, int16 h, GUI::ThemeEngine::TextAlignH align, bool &useRTL) : ThemeLayout(p), _name(name) {
 		_w = _defaultW = w;
 		_h = _defaultH = h;
 		_useRTL = useRTL;
@@ -229,7 +230,7 @@ public:
 	}
 
 	bool getWidgetData(const Common::String &name, int16 &x, int16 &y, int16 &w, int16 &h, bool &useRTL) override;
-	Graphics::TextAlign getWidgetTextHAlign(const Common::String &name) override;
+	GUI::ThemeEngine::TextAlignH getWidgetTextHAlign(const Common::String &name) override;
 
 	void reflowLayout(Widget *widgetChain) override;
 
@@ -254,7 +255,7 @@ class ThemeLayoutTabWidget : public ThemeLayoutWidget {
 	int _tabHeight;
 
 public:
-	ThemeLayoutTabWidget(ThemeLayout *p, const Common::String &name, int16 w, int16 h, Graphics::TextAlign align, int tabHeight):
+	ThemeLayoutTabWidget(ThemeLayout *p, const Common::String &name, int16 w, int16 h, GUI::ThemeEngine::TextAlignH align, int tabHeight):
 		ThemeLayoutWidget(p, name, w, h, align, _useRTL) {
 		_tabHeight = tabHeight;
 	}
diff --git a/gui/ThemeParser.cpp b/gui/ThemeParser.cpp
index eb14746a81..879925be86 100644
--- a/gui/ThemeParser.cpp
+++ b/gui/ThemeParser.cpp
@@ -717,8 +717,7 @@ bool ThemeParser::parserCallback_widget(ParserNode *node) {
 			useRTL = false;
 		}
 
-		Graphics::TextAlign textAlign = GUI::convertTextAlignH(alignH, false);
-		_theme->getEvaluator()->addWidget(var, node->values["type"], width, height, textAlign, useRTL);
+		_theme->getEvaluator()->addWidget(var, node->values["type"], width, height, alignH, useRTL);
 	}
 
 	return true;
diff --git a/gui/options.cpp b/gui/options.cpp
index c7f19d79df..ec9570065e 100644
--- a/gui/options.cpp
+++ b/gui/options.cpp
@@ -1135,8 +1135,6 @@ void OptionsDialog::addAchievementsControls(GuiObject *boss, const Common::Strin
 	uint16 width = g_system->getOverlayWidth() <= 320 ? 240 : 410;
 	uint16 descrDelta = g_system->getOverlayWidth() <= 320 ? 25 : 30;
 
-	Graphics::TextAlign alignment = g_gui.useRTL() ? Graphics::kTextAlignRight : Graphics::kTextAlignLeft;
-
 	for (int16 viewAchieved = 1; viewAchieved >= 0; viewAchieved--) {
 		// run this twice, first view all achieved, then view all non-hidden & non-achieved
 
@@ -1163,7 +1161,7 @@ void OptionsDialog::addAchievementsControls(GuiObject *boss, const Common::Strin
 			yPos += yStep;
 
 	        if (info.descriptions[idx].comment && strlen(info.descriptions[idx].comment) > 0) {
-				new StaticTextWidget(scrollContainer, lineHeight + descrDelta, yPos, width - descrDelta, yStep, info.descriptions[idx].comment, alignment, "", ThemeEngine::kFontStyleNormal);
+				new StaticTextWidget(scrollContainer, lineHeight + descrDelta, yPos, width - descrDelta, yStep, info.descriptions[idx].comment, GUI::ThemeEngine::kTextAlignHStart, "", ThemeEngine::kFontStyleNormal);
 				yPos += yStep;
 			}
 
@@ -1173,12 +1171,12 @@ void OptionsDialog::addAchievementsControls(GuiObject *boss, const Common::Strin
 
 	if (nHidden) {
 		Common::String hiddenStr = Common::String::format(_("%d hidden achievements remaining"), nHidden);
-		new StaticTextWidget(scrollContainer, lineHeight, yPos, width, yStep, hiddenStr.c_str(), alignment);
+		new StaticTextWidget(scrollContainer, lineHeight, yPos, width, yStep, hiddenStr.c_str(), GUI::ThemeEngine::kTextAlignHStart);
 	}
 
 	if (nMax) {
 		Common::String totalStr = Common::String::format(_("Achievements unlocked: %d/%d"), nAchieved, nMax);
-		new StaticTextWidget(scrollContainer, lineHeight, lineHeight, width, yStep, totalStr.c_str(), alignment);
+		new StaticTextWidget(scrollContainer, lineHeight, lineHeight, width, yStep, totalStr.c_str(), GUI::ThemeEngine::kTextAlignHStart);
 
 		SliderWidget *progressBar;
 		progressBar = new SliderWidget(scrollContainer, lineHeight, lineHeight*2, progressBarWidth, lineHeight);
diff --git a/gui/saveload-dialog.cpp b/gui/saveload-dialog.cpp
index bc059fcb2b..ebf31049d9 100644
--- a/gui/saveload-dialog.cpp
+++ b/gui/saveload-dialog.cpp
@@ -377,8 +377,6 @@ SaveLoadChooserSimple::SaveLoadChooserSimple(const String &title, const String &
 	_backgroundType = ThemeEngine::kDialogBackgroundSpecial;
 
 	_pageTitle = new StaticTextWidget(this, "SaveLoadChooser.Title", title);
-	if (g_gui.useRTL())
-		_pageTitle->setAlign(Graphics::kTextAlignRight);
 
 	// Add choice list
 	_list = new ListWidget(this, "SaveLoadChooser.List");
@@ -760,8 +758,6 @@ SaveLoadChooserGrid::SaveLoadChooserGrid(const Common::String &title, bool saveM
 	_backgroundType = ThemeEngine::kDialogBackgroundSpecial;
 
 	_pageTitle = new StaticTextWidget(this, "SaveLoadChooser.Title", title);
-	if (g_gui.useRTL())
-		_pageTitle->setAlign(Graphics::kTextAlignRight);
 
 	// The list widget needs to be bound so it takes space in the layout
 	ContainerWidget *list = new ContainerWidget(this, "SaveLoadChooser.List");
@@ -777,11 +773,7 @@ SaveLoadChooserGrid::SaveLoadChooserGrid(const Common::String &title, bool saveM
 
 	// Page display
 	_pageDisplay = new StaticTextWidget(this, "SaveLoadChooser.PageDisplay", Common::String());
-	if (g_gui.useRTL()) {
-		_pageDisplay->setAlign(Graphics::kTextAlignLeft);
-	} else {
-		_pageDisplay->setAlign(Graphics::kTextAlignRight);
-	}
+	_pageDisplay->setAlign(GUI::ThemeEngine::kTextAlignHEnd);
 }
 
 SaveLoadChooserGrid::~SaveLoadChooserGrid() {
@@ -955,8 +947,6 @@ void SaveLoadChooserGrid::reflowLayout() {
 	_lines = MAX<uint>(1, availableHeight / slotAreaHeight);
 	_entriesPerPage = _columns * _lines;
 
-	Graphics::TextAlign alignment = Graphics::kTextAlignLeft;
-
 	// In save mode the first button is always "New Save", thus we need to
 	// adjust the entries per page here.
 	if (_saveMode) {
@@ -1004,14 +994,10 @@ void SaveLoadChooserGrid::reflowLayout() {
 				buttonCmd += 1;
 			}
 
-			if (g_gui.useRTL()) {
-				alignment = Graphics::kTextAlignRight;
-			}
-
 			PicButtonWidget *button = new PicButtonWidget(container, dstX, dstY, buttonWidth, buttonHeight, nullptr, buttonCmd);
 			dstY += buttonHeight;
 
-			StaticTextWidget *description = new StaticTextWidget(container, dstX, dstY, buttonWidth, kLineHeight, Common::String(), alignment);
+			StaticTextWidget *description = new StaticTextWidget(container, dstX, dstY, buttonWidth, kLineHeight, Common::String(), GUI::ThemeEngine::kTextAlignHStart);
 
 			_buttons.push_back(SlotButton(container, button, description));
 		}
diff --git a/gui/widget.cpp b/gui/widget.cpp
index dc1c4d4197..1d4fbc2b89 100644
--- a/gui/widget.cpp
+++ b/gui/widget.cpp
@@ -299,20 +299,22 @@ StaticTextWidget::StaticTextWidget(GuiObject *boss, int x, int y, int w, int h,
 	_font = font;
 }
 
+StaticTextWidget::StaticTextWidget(GuiObject *boss, int x, int y, int w, int h, const Common::String &text, GUI::ThemeEngine::TextAlignH align, const char *tooltip, ThemeEngine::FontStyle font)
+	: Widget(boss, x, y, w, h, tooltip) {
+	setFlags(WIDGET_ENABLED);
+	_type = kStaticTextWidget;
+	_label = text;
+	_font = font;
+	_align = GUI::convertTextAlignH(align, g_gui.useRTL() && _useRTL);
+}
+
 StaticTextWidget::StaticTextWidget(GuiObject *boss, const Common::String &name, const Common::String &text, const char *tooltip, ThemeEngine::FontStyle font)
 	: Widget(boss, name, tooltip) {
 	setFlags(WIDGET_ENABLED | WIDGET_CLEARBG);
 	_type = kStaticTextWidget;
 	_label = text;
 
-	_align = g_gui.xmlEval()->getWidgetTextHAlign(name);
-	if (g_gui.useRTL() && _useRTL) {
-		if (_align == Graphics::kTextAlignLeft) {
-			_align = Graphics::kTextAlignRight;
-		} else if (_align == Graphics::kTextAlignRight) {
-			_align = Graphics::kTextAlignLeft;
-		}
-	}
+	_align = GUI::convertTextAlignH(g_gui.xmlEval()->getWidgetTextHAlign(name), g_gui.useRTL() && _useRTL);
 
 	_font = font;
 }
@@ -337,6 +339,9 @@ void StaticTextWidget::setAlign(Graphics::TextAlign align) {
 	}
 }
 
+void StaticTextWidget::setAlign(GUI::ThemeEngine::TextAlignH align) {
+	setAlign(GUI::convertTextAlignH(align, g_gui.useRTL() && _useRTL));
+}
 
 void StaticTextWidget::drawWidget() {
 	g_gui.theme()->drawText(
diff --git a/gui/widget.h b/gui/widget.h
index 7a81017f7d..8d080df150 100644
--- a/gui/widget.h
+++ b/gui/widget.h
@@ -201,12 +201,15 @@ protected:
 	ThemeEngine::FontStyle	_font;
 public:
 	StaticTextWidget(GuiObject *boss, int x, int y, int w, int h, const Common::String &text, Graphics::TextAlign align, const char *tooltip = nullptr, ThemeEngine::FontStyle font = ThemeEngine::kFontStyleBold);
+	StaticTextWidget(GuiObject *boss, int x, int y, int w, int h, const Common::String &text, GUI::ThemeEngine::TextAlignH align, const char *tooltip = nullptr, ThemeEngine::FontStyle font = ThemeEngine::kFontStyleBold);
 	StaticTextWidget(GuiObject *boss, const Common::String &name, const Common::String &text, const char *tooltip = nullptr, ThemeEngine::FontStyle font = ThemeEngine::kFontStyleBold);
 	void setValue(int value);
 	void setLabel(const Common::String &label);
 	void handleMouseEntered(int button) override	{ readLabel(); }
 	const Common::String &getLabel() const		{ return _label; }
 	void setAlign(Graphics::TextAlign align);
+	void setAlign(GUI::ThemeEngine::TextAlignH align);
+
 	Graphics::TextAlign getAlign() const		{ return _align; }
 	void readLabel() { read(_label); }
 


Commit: 51d95f89788850d8b694ba292e971b2e24b556ee
    https://github.com/scummvm/scummvm/commit/51d95f89788850d8b694ba292e971b2e24b556ee
Author: aryanrawlani28 (aryanrawlani007 at gmail.com)
Date: 2020-06-22T00:03:02+02:00

Commit Message:
GRAPHICS: move start + end to Graphics::TextAlign

Changed paths:
    backends/keymapper/remap-widget.cpp
    graphics/font.cpp
    graphics/font.h
    gui/ThemeEngine.cpp
    gui/ThemeEngine.h
    gui/ThemeEval.cpp
    gui/ThemeEval.h
    gui/ThemeLayout.cpp
    gui/ThemeLayout.h
    gui/ThemeParser.cpp
    gui/options.cpp
    gui/saveload-dialog.cpp
    gui/widget.cpp
    gui/widget.h


diff --git a/backends/keymapper/remap-widget.cpp b/backends/keymapper/remap-widget.cpp
index cb4150dffd..327e02c0a5 100644
--- a/backends/keymapper/remap-widget.cpp
+++ b/backends/keymapper/remap-widget.cpp
@@ -274,7 +274,7 @@ void RemapWidget::refreshKeymap() {
 		ActionRow &row = _actions[i];
 
 		if (!row.actionText) {
-			row.actionText = new GUI::StaticTextWidget(widgetsBoss(), 0, 0, 0, 0, "", GUI::ThemeEngine::kTextAlignHStart, nullptr, GUI::ThemeEngine::kFontStyleNormal);
+			row.actionText = new GUI::StaticTextWidget(widgetsBoss(), 0, 0, 0, 0, "", Graphics::kTextAlignStart, nullptr, GUI::ThemeEngine::kFontStyleNormal);
 			row.actionText->setLabel(row.action->description);
 
 			row.keyButton = new GUI::DropdownButtonWidget(widgetsBoss(), 0, 0, 0, 0, "", nullptr, kRemapCmd + i);
@@ -303,7 +303,7 @@ void RemapWidget::refreshKeymap() {
 
 		KeymapTitleRow &keymapTitle = _keymapSeparators[row.keymap];
 		if (!keymapTitle.descriptionText) {
-			keymapTitle.descriptionText = new GUI::StaticTextWidget(widgetsBoss(), 0, 0, 0, 0, row.keymap->getDescription(), GUI::ThemeEngine::kTextAlignHStart);
+			keymapTitle.descriptionText = new GUI::StaticTextWidget(widgetsBoss(), 0, 0, 0, 0, row.keymap->getDescription(), Graphics::kTextAlignStart);
 			keymapTitle.resetButton = new GUI::ButtonWidget(widgetsBoss(), 0, 0, 0, 0, "", nullptr, kResetKeymapCmd + i);
 
 			// I18N: Button to reset keymap mappings to defaults
diff --git a/graphics/font.cpp b/graphics/font.cpp
index cc460c4dfe..32eefc3c3a 100644
--- a/graphics/font.cpp
+++ b/graphics/font.cpp
@@ -466,4 +466,15 @@ Common::String Font::handleEllipsis(const Common::String &input, int w) const {
 	}
 }
 
+TextAlign convertTextAlignH(TextAlign alignH, bool rtl) {
+	switch (alignH) {
+	case kTextAlignStart:
+		return rtl ? kTextAlignRight : kTextAlignLeft;
+	case kTextAlignEnd:
+		return rtl ? kTextAlignLeft : kTextAlignRight;
+	default:
+		return alignH;
+	}
+}
+
 } // End of namespace Graphics
diff --git a/graphics/font.h b/graphics/font.h
index 4f5923e349..487f11b8ca 100644
--- a/graphics/font.h
+++ b/graphics/font.h
@@ -39,11 +39,20 @@ class ManagedSurface;
 /** Text alignment modes */
 enum TextAlign {
 	kTextAlignInvalid,
+	kTextAlignStart,     ///< Text should be aligned to start of line (virtual)
 	kTextAlignLeft,     ///< Text should be aligned to the left
 	kTextAlignCenter,   ///< Text should be centered
+	kTextAlignEnd,     ///< Text should be aligned to end of line (virtual)
 	kTextAlignRight     ///< Text should be aligned to the right
 };
 
+/**
+ * Converts virtual text alignments (start + end)
+ * to actual text alignment (left + right + center) for drawing,
+ * if given actual text alignments it is returned as-is
+ */
+TextAlign convertTextAlignH(TextAlign alignH, bool rtl);
+
 /**
  * Instances of this class represent a distinct font, with a built-in renderer.
  * @todo Maybe move the high-level methods (drawString etc.) to a separate
diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp
index 9c1da2f2c0..cb48ce3d4a 100644
--- a/gui/ThemeEngine.cpp
+++ b/gui/ThemeEngine.cpp
@@ -76,7 +76,7 @@ struct WidgetDrawData {
 
 	TextData _textDataId;
 	TextColor _textColorId;
-	GUI::ThemeEngine::TextAlignH _textAlignH;
+	Graphics::TextAlign _textAlignH;
 	GUI::ThemeEngine::TextAlignVertical _textAlignV;
 
 	/** Extra space that the widget occupies when it's drawn.
@@ -504,7 +504,7 @@ void ThemeEngine::addDrawStep(const Common::String &drawDataId, const Graphics::
 	_widgets[id]->_steps.push_back(step);
 }
 
-bool ThemeEngine::addTextData(const Common::String &drawDataId, TextData textId, TextColor colorId, TextAlignH alignH, TextAlignVertical alignV) {
+bool ThemeEngine::addTextData(const Common::String &drawDataId, TextData textId, TextColor colorId, Graphics::TextAlign alignH, TextAlignVertical alignV) {
 	DrawData id = parseDrawDataId(drawDataId);
 
 	if (id == -1 || textId == -1 || colorId == kTextColorMAX || !_widgets[id])
@@ -1065,7 +1065,7 @@ void ThemeEngine::drawRadiobutton(const Common::Rect &r, const Common::String &s
 	}
 
 	drawDDText(getTextData(dd), getTextColor(dd), r2, str, true, false, convertTextAlignH(_widgets[dd]->_textAlignH, rtl),
-	           _widgets[dd]->_textAlignV);
+		_widgets[dd]->_textAlignV);
 }
 
 void ThemeEngine::drawSlider(const Common::Rect &r, int width, WidgetStateInfo state, bool rtl) {
@@ -1996,23 +1996,6 @@ void ThemeEngine::drawToScreen() {
 	_vectorRenderer->setSurface(&_screen);
 }
 
-Graphics::TextAlign convertTextAlignH(GUI::ThemeEngine::TextAlignH alignH, bool rtl) {
-	switch (alignH) {
-		case GUI::ThemeEngine::kTextAlignHStart:
-			return rtl ? Graphics::kTextAlignRight : Graphics::kTextAlignLeft;
-		case GUI::ThemeEngine::kTextAlignHEnd:
-			return rtl ? Graphics::kTextAlignLeft : Graphics::kTextAlignRight;
-		case GUI::ThemeEngine::kTextAlignHLeft:
-			return Graphics::kTextAlignLeft;
-		case GUI::ThemeEngine::kTextAlignHCenter:
-			return Graphics::kTextAlignCenter;
-		case GUI::ThemeEngine::kTextAlignHRight:
-			return Graphics::kTextAlignRight;
-		default:
-			return Graphics::kTextAlignInvalid;
-	}
-}
-
 Common::Rect ThemeEngine::swapClipRect(const Common::Rect &newRect) {
 	Common::Rect oldRect = _clip;
 	_clip = newRect;
diff --git a/gui/ThemeEngine.h b/gui/ThemeEngine.h
index 7c1c586f4b..44c35f7e80 100644
--- a/gui/ThemeEngine.h
+++ b/gui/ThemeEngine.h
@@ -186,15 +186,6 @@ public:
 		kTextAlignVTop
 	};
 
-	enum TextAlignH {
-		kTextAlignHInvalid,
-		kTextAlignHStart,     ///< Text should be aligned to start of line
-		kTextAlignHLeft,     ///< Text should be aligned to the left
-		kTextAlignHCenter,   ///< Text should be centered
-		kTextAlignHEnd,     ///< Text should be aligned to end of line
-		kTextAlignHRight     ///< Text should be aligned to the right
-	};
-
 	/// Widget background type
 	enum WidgetBackground {
 		kWidgetBackgroundNo,            ///< No background at all
@@ -555,7 +546,7 @@ public:
 	 * Adds a new TextStep from the ThemeParser. This will be deprecated/removed once the
 	 * new Font API is in place. FIXME: Is that so ???
 	 */
-	bool addTextData(const Common::String &drawDataId, TextData textId, TextColor id, TextAlignH alignH, TextAlignVertical alignV);
+	bool addTextData(const Common::String &drawDataId, TextData textId, TextColor id, Graphics::TextAlign alignH, TextAlignVertical alignV);
 
 protected:
 	/**
@@ -776,8 +767,6 @@ protected:
 	Common::Rect _clip;
 };
 
-Graphics::TextAlign convertTextAlignH(GUI::ThemeEngine::TextAlignH alignH, bool rtl);
-
 } // End of namespace GUI.
 
 #endif
diff --git a/gui/ThemeEval.cpp b/gui/ThemeEval.cpp
index 62fed6f2af..f7d0fde913 100644
--- a/gui/ThemeEval.cpp
+++ b/gui/ThemeEval.cpp
@@ -71,7 +71,7 @@ bool ThemeEval::getWidgetData(const Common::String &widget, int16 &x, int16 &y,
 	return _layouts[dialogName]->getWidgetData(widgetName, x, y, w, h, useRTL);
 }
 
-GUI::ThemeEngine::TextAlignH ThemeEval::getWidgetTextHAlign(const Common::String &widget) {
+Graphics::TextAlign ThemeEval::getWidgetTextHAlign(const Common::String &widget) {
 	Common::StringTokenizer tokenizer(widget, ".");
 
 	if (widget.hasPrefix("Dialog."))
@@ -81,20 +81,20 @@ GUI::ThemeEngine::TextAlignH ThemeEval::getWidgetTextHAlign(const Common::String
 	Common::String widgetName = tokenizer.nextToken();
 
 	if (!_layouts.contains(dialogName))
-		return GUI::ThemeEngine::kTextAlignHInvalid;
+		return Graphics::kTextAlignInvalid;
 
 	return _layouts[dialogName]->getWidgetTextHAlign(widgetName);
 }
 
-ThemeEval &ThemeEval::addWidget(const Common::String &name, const Common::String &type, int w, int h, GUI::ThemeEngine::TextAlignH align, bool useRTL) {
+ThemeEval &ThemeEval::addWidget(const Common::String &name, const Common::String &type, int w, int h, Graphics::TextAlign align, bool useRTL) {
 	int typeW = -1;
 	int typeH = -1;
-	GUI::ThemeEngine::TextAlignH typeAlign = GUI::ThemeEngine::kTextAlignHInvalid;
+	Graphics::TextAlign typeAlign = Graphics::kTextAlignInvalid;
 
 	if (!type.empty()) {
 		typeW = getVar("Globals." + type + ".Width", -1);
 		typeH = getVar("Globals." + type + ".Height", -1);
-		typeAlign = (GUI::ThemeEngine::TextAlignH)getVar("Globals." + type + ".Align", GUI::ThemeEngine::kTextAlignHInvalid);
+		typeAlign = (Graphics::TextAlign)getVar("Globals." + type + ".Align", Graphics::kTextAlignInvalid);
 	}
 
 	ThemeLayoutWidget *widget;
@@ -102,13 +102,13 @@ ThemeEval &ThemeEval::addWidget(const Common::String &name, const Common::String
 		widget = new ThemeLayoutTabWidget(_curLayout.top(), name,
 									typeW == -1 ? w : typeW,
 									typeH == -1 ? h : typeH,
-									typeAlign == GUI::ThemeEngine::kTextAlignHInvalid ? align : typeAlign,
+									typeAlign == Graphics::kTextAlignInvalid ? align : typeAlign,
 									getVar("Globals.TabWidget.Tab.Height", 0));
 	else
 		widget = new ThemeLayoutWidget(_curLayout.top(), name,
 									typeW == -1 ? w : typeW,
 									typeH == -1 ? h : typeH,
-									typeAlign == GUI::ThemeEngine::kTextAlignHInvalid ? align : typeAlign,
+									typeAlign == Graphics::kTextAlignInvalid ? align : typeAlign,
 									useRTL);
 
 	_curLayout.top()->addChild(widget);
diff --git a/gui/ThemeEval.h b/gui/ThemeEval.h
index b2f14a0f90..c4158e5edd 100644
--- a/gui/ThemeEval.h
+++ b/gui/ThemeEval.h
@@ -32,7 +32,6 @@
 #include "graphics/font.h"
 
 #include "gui/ThemeLayout.h"
-#include "gui/ThemeEngine.h"
 
 namespace GUI {
 
@@ -77,7 +76,7 @@ public:
 
 	ThemeEval &addDialog(const Common::String &name, const Common::String &overlays, int16 maxWidth = -1, int16 maxHeight = -1, int inset = 0);
 	ThemeEval &addLayout(ThemeLayout::LayoutType type, int spacing = -1, ThemeLayout::ItemAlign itemAlign = ThemeLayout::kItemAlignStart);
-	ThemeEval &addWidget(const Common::String &name, const Common::String &type, int w = -1, int h = -1, GUI::ThemeEngine::TextAlignH align = GUI::ThemeEngine::kTextAlignHStart, bool useRTL = false);
+	ThemeEval &addWidget(const Common::String &name, const Common::String &type, int w = -1, int h = -1, Graphics::TextAlign align = Graphics::kTextAlignStart, bool useRTL = false);
 	ThemeEval &addImportedLayout(const Common::String &name);
 	ThemeEval &addSpace(int size = -1);
 
@@ -92,7 +91,7 @@ public:
 	bool getWidgetData(const Common::String &widget, int16 &x, int16 &y, int16 &w, int16 &h);
 	bool getWidgetData(const Common::String &widget, int16 &x, int16 &y, int16 &w, int16 &h, bool &useRTL);
 
-	GUI::ThemeEngine::TextAlignH getWidgetTextHAlign(const Common::String &widget);
+	Graphics::TextAlign getWidgetTextHAlign(const Common::String &widget);
 
 #ifdef LAYOUT_DEBUG_DIALOG
 	void debugDraw(Graphics::Surface *screen, const Graphics::Font *font) {
diff --git a/gui/ThemeLayout.cpp b/gui/ThemeLayout.cpp
index 743e8c56d8..bc02efbd4c 100644
--- a/gui/ThemeLayout.cpp
+++ b/gui/ThemeLayout.cpp
@@ -89,20 +89,20 @@ bool ThemeLayout::getWidgetData(const Common::String &name, int16 &x, int16 &y,
 	return false;
 }
 
-GUI::ThemeEngine::TextAlignH ThemeLayout::getWidgetTextHAlign(const Common::String &name) {
+Graphics::TextAlign ThemeLayout::getWidgetTextHAlign(const Common::String &name) {
 	if (name.empty()) {
 		assert(getLayoutType() == kLayoutMain);
 		return _textHAlign;
 	}
 
-	GUI::ThemeEngine::TextAlignH res;
+	Graphics::TextAlign res;
 
 	for (uint i = 0; i < _children.size(); ++i) {
-		if ((res = _children[i]->getWidgetTextHAlign(name)) != GUI::ThemeEngine::kTextAlignHInvalid)
+		if ((res = _children[i]->getWidgetTextHAlign(name)) != Graphics::kTextAlignInvalid)
 			return res;
 	}
 
-	return GUI::ThemeEngine::kTextAlignHInvalid;
+	return Graphics::kTextAlignInvalid;
 }
 
 int16 ThemeLayoutStacked::getParentWidth() {
@@ -172,12 +172,12 @@ bool ThemeLayoutWidget::getWidgetData(const Common::String &name, int16 &x, int1
 	return false;
 }
 
-GUI::ThemeEngine::TextAlignH ThemeLayoutWidget::getWidgetTextHAlign(const Common::String &name) {
+Graphics::TextAlign ThemeLayoutWidget::getWidgetTextHAlign(const Common::String &name) {
 	if (name == _name) {
 		return _textHAlign;
 	}
 
-	return GUI::ThemeEngine::kTextAlignHInvalid;
+	return Graphics::kTextAlignInvalid;
 }
 
 void ThemeLayoutWidget::reflowLayout(Widget *widgetChain) {
diff --git a/gui/ThemeLayout.h b/gui/ThemeLayout.h
index fafb82c1e3..25ec9eb997 100644
--- a/gui/ThemeLayout.h
+++ b/gui/ThemeLayout.h
@@ -26,7 +26,6 @@
 #include "common/array.h"
 #include "common/rect.h"
 #include "graphics/font.h"
-#include "gui/ThemeEngine.h"
 
 #ifdef LAYOUT_DEBUG_DIALOG
 namespace Graphics {
@@ -64,7 +63,7 @@ public:
 	ThemeLayout(ThemeLayout *p) :
 		_parent(p), _x(0), _y(0), _w(-1), _h(-1),
 		_defaultW(-1), _defaultH(-1),
-		_textHAlign(GUI::ThemeEngine::kTextAlignHInvalid) {}
+		_textHAlign(Graphics::kTextAlignInvalid) {}
 
 	virtual ~ThemeLayout() {
 		for (uint i = 0; i < _children.size(); ++i)
@@ -101,7 +100,7 @@ protected:
 
 	void setWidth(int16 width) { _w = width; }
 	void setHeight(int16 height) { _h = height; }
-	void setTextHAlign(GUI::ThemeEngine::TextAlignH align) { _textHAlign = align; }
+	void setTextHAlign(Graphics::TextAlign align) { _textHAlign = align; }
 
 	/**
 	 * Checks if the layout element is attached to a GUI widget
@@ -117,11 +116,11 @@ protected:
 public:
 	virtual bool getWidgetData(const Common::String &name, int16 &x, int16 &y, int16 &w, int16 &h, bool &useRTL);
 
-	virtual GUI::ThemeEngine::TextAlignH getWidgetTextHAlign(const Common::String &name);
+	virtual Graphics::TextAlign getWidgetTextHAlign(const Common::String &name);
 
 	void importLayout(ThemeLayout *layout);
 
-	GUI::ThemeEngine::TextAlignH getTextHAlign() { return _textHAlign; }
+	Graphics::TextAlign getTextHAlign() { return _textHAlign; }
 
 #ifdef LAYOUT_DEBUG_DIALOG
 	void debugDraw(Graphics::Surface *screen, const Graphics::Font *font);
@@ -136,7 +135,7 @@ protected:
 	Common::Rect _padding;
 	Common::Array<ThemeLayout *> _children;
 	int16 _defaultW, _defaultH;
-	GUI::ThemeEngine::TextAlignH _textHAlign;
+	Graphics::TextAlign _textHAlign;
 };
 
 class ThemeLayoutMain : public ThemeLayout {
@@ -221,7 +220,7 @@ protected:
 
 class ThemeLayoutWidget : public ThemeLayout {
 public:
-	ThemeLayoutWidget(ThemeLayout *p, const Common::String &name, int16 w, int16 h, GUI::ThemeEngine::TextAlignH align, bool &useRTL) : ThemeLayout(p), _name(name) {
+	ThemeLayoutWidget(ThemeLayout *p, const Common::String &name, int16 w, int16 h, Graphics::TextAlign align, bool &useRTL) : ThemeLayout(p), _name(name) {
 		_w = _defaultW = w;
 		_h = _defaultH = h;
 		_useRTL = useRTL;
@@ -230,7 +229,7 @@ public:
 	}
 
 	bool getWidgetData(const Common::String &name, int16 &x, int16 &y, int16 &w, int16 &h, bool &useRTL) override;
-	GUI::ThemeEngine::TextAlignH getWidgetTextHAlign(const Common::String &name) override;
+	Graphics::TextAlign getWidgetTextHAlign(const Common::String &name) override;
 
 	void reflowLayout(Widget *widgetChain) override;
 
@@ -255,7 +254,7 @@ class ThemeLayoutTabWidget : public ThemeLayoutWidget {
 	int _tabHeight;
 
 public:
-	ThemeLayoutTabWidget(ThemeLayout *p, const Common::String &name, int16 w, int16 h, GUI::ThemeEngine::TextAlignH align, int tabHeight):
+	ThemeLayoutTabWidget(ThemeLayout *p, const Common::String &name, int16 w, int16 h, Graphics::TextAlign align, int tabHeight):
 		ThemeLayoutWidget(p, name, w, h, align, _useRTL) {
 		_tabHeight = tabHeight;
 	}
diff --git a/gui/ThemeParser.cpp b/gui/ThemeParser.cpp
index 879925be86..23feda7b79 100644
--- a/gui/ThemeParser.cpp
+++ b/gui/ThemeParser.cpp
@@ -80,19 +80,19 @@ static TextColor parseTextColorId(const Common::String &name) {
 	return kTextColorMAX;
 }
 
-GUI::ThemeEngine::TextAlignH parseTextHAlign(const Common::String &val) {
+Graphics::TextAlign parseTextHAlign(const Common::String &val) {
 	if (val == "start")
-		return GUI::ThemeEngine::kTextAlignHStart;
+		return Graphics::kTextAlignStart;
 	else if (val == "end")
-		return GUI::ThemeEngine::kTextAlignHEnd;
+		return Graphics::kTextAlignEnd;
 	else if (val == "left")
-		return GUI::ThemeEngine::kTextAlignHLeft;
+		return Graphics::kTextAlignLeft;
 	else if (val == "right")
-		return GUI::ThemeEngine::kTextAlignHRight;
+		return Graphics::kTextAlignRight;
 	else if (val == "center")
-		return GUI::ThemeEngine::kTextAlignHCenter;
+		return Graphics::kTextAlignCenter;
 	else
-		return GUI::ThemeEngine::kTextAlignHInvalid;
+		return Graphics::kTextAlignInvalid;
 }
 
 static GUI::ThemeEngine::TextAlignVertical parseTextVAlign(const Common::String &val) {
@@ -257,10 +257,10 @@ bool ThemeParser::parserCallback_alphabitmap(ParserNode *node) {
 }
 
 bool ThemeParser::parserCallback_text(ParserNode *node) {
-	GUI::ThemeEngine::TextAlignH alignH;
+	Graphics::TextAlign alignH;
 	GUI::ThemeEngine::TextAlignVertical alignV;
 
-	if ((alignH = parseTextHAlign(node->values["horizontal_align"])) == GUI::ThemeEngine::kTextAlignHInvalid)
+	if ((alignH = parseTextHAlign(node->values["horizontal_align"])) == Graphics::kTextAlignInvalid)
 		return parserError("Invalid value for text alignment.");
 
 	if ((alignV = parseTextVAlign(node->values["vertical_align"])) == GUI::ThemeEngine::kTextAlignVInvalid)
@@ -706,10 +706,10 @@ bool ThemeParser::parserCallback_widget(ParserNode *node) {
 				return parserError("Corrupted height value in key for " + var);
 		}
 
-		GUI::ThemeEngine::TextAlignH alignH = GUI::ThemeEngine::kTextAlignHStart;
+		Graphics::TextAlign alignH = Graphics::kTextAlignStart;
 
 		if (node->values.contains("textalign")) {
-			if ((alignH = parseTextHAlign(node->values["textalign"])) == GUI::ThemeEngine::kTextAlignHInvalid)
+			if ((alignH = parseTextHAlign(node->values["textalign"])) == Graphics::kTextAlignInvalid)
 				return parserError("Invalid value for text alignment.");
 		}
 
@@ -965,9 +965,9 @@ bool ThemeParser::parseCommonLayoutProps(ParserNode *node, const Common::String
 
 
 	if (node->values.contains("textalign")) {
-		GUI::ThemeEngine::TextAlignH alignH = GUI::ThemeEngine::kTextAlignHStart;
+		Graphics::TextAlign alignH = Graphics::kTextAlignStart;
 
-		if ((alignH = parseTextHAlign(node->values["textalign"])) == GUI::ThemeEngine::kTextAlignHInvalid)
+		if ((alignH = parseTextHAlign(node->values["textalign"])) == Graphics::kTextAlignInvalid)
 			return parserError("Invalid value for text alignment.");
 
 		_theme->getEvaluator()->setVar(var + "Align", alignH);
diff --git a/gui/options.cpp b/gui/options.cpp
index ec9570065e..bc80e3d3c7 100644
--- a/gui/options.cpp
+++ b/gui/options.cpp
@@ -1161,7 +1161,7 @@ void OptionsDialog::addAchievementsControls(GuiObject *boss, const Common::Strin
 			yPos += yStep;
 
 	        if (info.descriptions[idx].comment && strlen(info.descriptions[idx].comment) > 0) {
-				new StaticTextWidget(scrollContainer, lineHeight + descrDelta, yPos, width - descrDelta, yStep, info.descriptions[idx].comment, GUI::ThemeEngine::kTextAlignHStart, "", ThemeEngine::kFontStyleNormal);
+				new StaticTextWidget(scrollContainer, lineHeight + descrDelta, yPos, width - descrDelta, yStep, info.descriptions[idx].comment, Graphics::kTextAlignStart, "", ThemeEngine::kFontStyleNormal);
 				yPos += yStep;
 			}
 
@@ -1171,12 +1171,12 @@ void OptionsDialog::addAchievementsControls(GuiObject *boss, const Common::Strin
 
 	if (nHidden) {
 		Common::String hiddenStr = Common::String::format(_("%d hidden achievements remaining"), nHidden);
-		new StaticTextWidget(scrollContainer, lineHeight, yPos, width, yStep, hiddenStr.c_str(), GUI::ThemeEngine::kTextAlignHStart);
+		new StaticTextWidget(scrollContainer, lineHeight, yPos, width, yStep, hiddenStr.c_str(), Graphics::kTextAlignStart);
 	}
 
 	if (nMax) {
 		Common::String totalStr = Common::String::format(_("Achievements unlocked: %d/%d"), nAchieved, nMax);
-		new StaticTextWidget(scrollContainer, lineHeight, lineHeight, width, yStep, totalStr.c_str(), GUI::ThemeEngine::kTextAlignHStart);
+		new StaticTextWidget(scrollContainer, lineHeight, lineHeight, width, yStep, totalStr.c_str(), Graphics::kTextAlignStart);
 
 		SliderWidget *progressBar;
 		progressBar = new SliderWidget(scrollContainer, lineHeight, lineHeight*2, progressBarWidth, lineHeight);
diff --git a/gui/saveload-dialog.cpp b/gui/saveload-dialog.cpp
index ebf31049d9..62678647b4 100644
--- a/gui/saveload-dialog.cpp
+++ b/gui/saveload-dialog.cpp
@@ -773,7 +773,7 @@ SaveLoadChooserGrid::SaveLoadChooserGrid(const Common::String &title, bool saveM
 
 	// Page display
 	_pageDisplay = new StaticTextWidget(this, "SaveLoadChooser.PageDisplay", Common::String());
-	_pageDisplay->setAlign(GUI::ThemeEngine::kTextAlignHEnd);
+	_pageDisplay->setAlign(Graphics::kTextAlignEnd);
 }
 
 SaveLoadChooserGrid::~SaveLoadChooserGrid() {
@@ -997,7 +997,7 @@ void SaveLoadChooserGrid::reflowLayout() {
 			PicButtonWidget *button = new PicButtonWidget(container, dstX, dstY, buttonWidth, buttonHeight, nullptr, buttonCmd);
 			dstY += buttonHeight;
 
-			StaticTextWidget *description = new StaticTextWidget(container, dstX, dstY, buttonWidth, kLineHeight, Common::String(), GUI::ThemeEngine::kTextAlignHStart);
+			StaticTextWidget *description = new StaticTextWidget(container, dstX, dstY, buttonWidth, kLineHeight, Common::String(), Graphics::kTextAlignStart);
 
 			_buttons.push_back(SlotButton(container, button, description));
 		}
diff --git a/gui/widget.cpp b/gui/widget.cpp
index 1d4fbc2b89..14bfc28da7 100644
--- a/gui/widget.cpp
+++ b/gui/widget.cpp
@@ -292,20 +292,12 @@ void Widget::read(Common::String str) {
 #pragma mark -
 
 StaticTextWidget::StaticTextWidget(GuiObject *boss, int x, int y, int w, int h, const Common::String &text, Graphics::TextAlign align, const char *tooltip, ThemeEngine::FontStyle font)
-	: Widget(boss, x, y, w, h, tooltip), _align(align) {
-	setFlags(WIDGET_ENABLED);
-	_type = kStaticTextWidget;
-	_label = text;
-	_font = font;
-}
-
-StaticTextWidget::StaticTextWidget(GuiObject *boss, int x, int y, int w, int h, const Common::String &text, GUI::ThemeEngine::TextAlignH align, const char *tooltip, ThemeEngine::FontStyle font)
 	: Widget(boss, x, y, w, h, tooltip) {
 	setFlags(WIDGET_ENABLED);
 	_type = kStaticTextWidget;
 	_label = text;
 	_font = font;
-	_align = GUI::convertTextAlignH(align, g_gui.useRTL() && _useRTL);
+	_align = Graphics::convertTextAlignH(align, g_gui.useRTL() && _useRTL);
 }
 
 StaticTextWidget::StaticTextWidget(GuiObject *boss, const Common::String &name, const Common::String &text, const char *tooltip, ThemeEngine::FontStyle font)
@@ -314,7 +306,7 @@ StaticTextWidget::StaticTextWidget(GuiObject *boss, const Common::String &name,
 	_type = kStaticTextWidget;
 	_label = text;
 
-	_align = GUI::convertTextAlignH(g_gui.xmlEval()->getWidgetTextHAlign(name), g_gui.useRTL() && _useRTL);
+	_align = Graphics::convertTextAlignH(g_gui.xmlEval()->getWidgetTextHAlign(name), g_gui.useRTL() && _useRTL);
 
 	_font = font;
 }
@@ -332,6 +324,7 @@ void StaticTextWidget::setLabel(const Common::String &label) {
 }
 
 void StaticTextWidget::setAlign(Graphics::TextAlign align) {
+	align = Graphics::convertTextAlignH(align, g_gui.useRTL() && _useRTL);
 	if (_align != align){
 		_align = align;
 
@@ -339,9 +332,6 @@ void StaticTextWidget::setAlign(Graphics::TextAlign align) {
 	}
 }
 
-void StaticTextWidget::setAlign(GUI::ThemeEngine::TextAlignH align) {
-	setAlign(GUI::convertTextAlignH(align, g_gui.useRTL() && _useRTL));
-}
 
 void StaticTextWidget::drawWidget() {
 	g_gui.theme()->drawText(
diff --git a/gui/widget.h b/gui/widget.h
index 8d080df150..7a81017f7d 100644
--- a/gui/widget.h
+++ b/gui/widget.h
@@ -201,15 +201,12 @@ protected:
 	ThemeEngine::FontStyle	_font;
 public:
 	StaticTextWidget(GuiObject *boss, int x, int y, int w, int h, const Common::String &text, Graphics::TextAlign align, const char *tooltip = nullptr, ThemeEngine::FontStyle font = ThemeEngine::kFontStyleBold);
-	StaticTextWidget(GuiObject *boss, int x, int y, int w, int h, const Common::String &text, GUI::ThemeEngine::TextAlignH align, const char *tooltip = nullptr, ThemeEngine::FontStyle font = ThemeEngine::kFontStyleBold);
 	StaticTextWidget(GuiObject *boss, const Common::String &name, const Common::String &text, const char *tooltip = nullptr, ThemeEngine::FontStyle font = ThemeEngine::kFontStyleBold);
 	void setValue(int value);
 	void setLabel(const Common::String &label);
 	void handleMouseEntered(int button) override	{ readLabel(); }
 	const Common::String &getLabel() const		{ return _label; }
 	void setAlign(Graphics::TextAlign align);
-	void setAlign(GUI::ThemeEngine::TextAlignH align);
-
 	Graphics::TextAlign getAlign() const		{ return _align; }
 	void readLabel() { read(_label); }
 


Commit: 2677b022d1ca6f702ae5f27e381f6e376a47ca30
    https://github.com/scummvm/scummvm/commit/2677b022d1ca6f702ae5f27e381f6e376a47ca30
Author: aryanrawlani28 (aryanrawlani007 at gmail.com)
Date: 2020-06-22T00:03:02+02:00

Commit Message:
GUI: Update layout files to use 'end' instead of 'right'

Changed paths:
    gui/themes/scummclassic/classic_layout.stx
    gui/themes/scummclassic/classic_layout_lowres.stx
    gui/themes/scummmodern/scummmodern_layout.stx
    gui/themes/scummmodern/scummmodern_layout_lowres.stx
    gui/themes/scummremastered/remastered_layout.stx
    gui/themes/scummremastered/remastered_layout_lowres.stx


diff --git a/gui/themes/scummclassic/classic_layout.stx b/gui/themes/scummclassic/classic_layout.stx
index 3ca84afa9e..357547942c 100644
--- a/gui/themes/scummclassic/classic_layout.stx
+++ b/gui/themes/scummclassic/classic_layout.stx
@@ -55,7 +55,7 @@
 
 		<widget name = 'OptionsLabel'
 				size = '110, Globals.Line.Height'
-				textalign = 'right'
+				textalign = 'end'
 		/>
 		<widget name = 'SmallLabel'
 				size = '24, Globals.Line.Height'
@@ -134,7 +134,7 @@
 				<widget name = 'SearchDesc'
 						width = '60'
 						height = 'Globals.Line.Height'
-						textalign = 'right'
+						textalign = 'end'
 				/>
 				<widget name = 'Search'
 						width = '150'
diff --git a/gui/themes/scummclassic/classic_layout_lowres.stx b/gui/themes/scummclassic/classic_layout_lowres.stx
index 28110a3b54..2bfbd89a63 100644
--- a/gui/themes/scummclassic/classic_layout_lowres.stx
+++ b/gui/themes/scummclassic/classic_layout_lowres.stx
@@ -68,7 +68,7 @@
 
 		<widget name = 'OptionsLabel'
 				size = '110, Globals.Line.Height'
-				textalign = 'right'
+				textalign = 'end'
 		/>
 		<widget name = 'SmallLabel'
 				size = '18, Globals.Line.Height'
@@ -132,7 +132,7 @@
 				<widget name = 'SearchDesc'
 						width = '50'
 						height = 'Globals.Line.Height'
-						textalign = 'right'
+						textalign = 'end'
 				/>
 				<widget name = 'Search'
 						width = '150'
@@ -577,7 +577,7 @@
 				<widget name = 'RendererPopupDesc'
 						width = '80'
 						height = 'Globals.Line.Height'
-						textalign = 'right'
+						textalign = 'end'
 				/>
 				<widget name = 'RendererPopup'
 					type = 'PopUp'
@@ -587,7 +587,7 @@
 				<widget name = 'AutosavePeriodPopupDesc'
 						width = '80'
 						height = 'Globals.Line.Height'
-						textalign = 'right'
+						textalign = 'end'
 				/>
 				<widget name = 'AutosavePeriodPopup'
 						type = 'PopUp'
@@ -597,7 +597,7 @@
 				<widget name = 'GuiLanguagePopupDesc'
 						width = '80'
 						height = 'Globals.Line.Height'
-						textalign = 'right'
+						textalign = 'end'
 				/>
 				<widget name = 'GuiLanguagePopup'
 						type = 'PopUp'
@@ -617,7 +617,7 @@
 				<widget name = 'UpdatesPopupDesc'
 						width = '80'
 						height = 'Globals.Line.Height'
-						textalign = 'right'
+						textalign = 'end'
 				/>
 				<widget name = 'UpdatesPopup'
 						type = 'PopUp'
@@ -645,7 +645,7 @@
 					<widget name = 'StoragePopupDesc'
 							width = '100'
 							height = 'Globals.Line.Height'
-							textalign = 'right'
+							textalign = 'end'
 					/>
 				</layout>
 				<layout type = 'vertical' padding = '0, 0, 0, 0' spacing = '1'>
@@ -798,7 +798,7 @@
 				<widget name = 'ServerPortDesc'
 						width = '80'
 						height = 'Globals.Line.Height'
-						textalign = 'right'
+						textalign = 'end'
 				/>
 				<widget name = 'ServerPortEditText'
 						width = '60'
@@ -1070,7 +1070,7 @@
 				<widget name = 'Id'
 						width = '35'
 						height = 'Globals.Line.Height'
-						textalign = 'right'
+						textalign = 'end'
 				/>
 				<widget name = 'Domain'
 						type = 'PopUp'
@@ -1080,7 +1080,7 @@
 				<widget name = 'Name'
 						width = '35'
 						height = 'Globals.Line.Height'
-						textalign = 'right'
+						textalign = 'end'
 				/>
 				<widget name = 'Desc'
 						type = 'PopUp'
@@ -1091,7 +1091,7 @@
 				<widget name = 'LangPopupDesc'
 						width = '60'
 						height = 'Globals.Line.Height'
-						textalign = 'right'
+						textalign = 'end'
 				/>
 				<widget name = 'LangPopup'
 						type = 'PopUp'
@@ -1101,7 +1101,7 @@
 				<widget name = 'PlatformPopupDesc'
 						width = '60'
 						height = 'Globals.Line.Height'
-						textalign = 'right'
+						textalign = 'end'
 				/>
 				<widget name = 'PlatformPopup'
 						type = 'PopUp'
diff --git a/gui/themes/scummmodern/scummmodern_layout.stx b/gui/themes/scummmodern/scummmodern_layout.stx
index 31be09b3da..1bdc1f8467 100644
--- a/gui/themes/scummmodern/scummmodern_layout.stx
+++ b/gui/themes/scummmodern/scummmodern_layout.stx
@@ -62,7 +62,7 @@
 
 		<widget name = 'OptionsLabel'
 				size = '115, Globals.Line.Height'
-				textalign = 'right'
+				textalign = 'end'
 		/>
 		<widget name = 'SmallLabel'
 				size = '24, Globals.Line.Height'
diff --git a/gui/themes/scummmodern/scummmodern_layout_lowres.stx b/gui/themes/scummmodern/scummmodern_layout_lowres.stx
index 2b7fe58fde..173b1c8d3a 100644
--- a/gui/themes/scummmodern/scummmodern_layout_lowres.stx
+++ b/gui/themes/scummmodern/scummmodern_layout_lowres.stx
@@ -66,7 +66,7 @@
 
 		<widget name = 'OptionsLabel'
 				size = '100, Globals.Line.Height'
-				textalign = 'right'
+				textalign = 'end'
 		/>
 		<widget name = 'SmallLabel'
 				size = '18, Globals.Line.Height'
@@ -130,7 +130,7 @@
 				<widget name = 'SearchDesc'
 						width = '50'
 						height = 'Globals.Line.Height'
-						textalign = 'right'
+						textalign = 'end'
 				/>
 				<widget name = 'Search'
 						width = '150'
@@ -575,7 +575,7 @@
 				<widget name = 'RendererPopupDesc'
 						width = '80'
 						height = 'Globals.Line.Height'
-						textalign = 'right'
+						textalign = 'end'
 				/>
 				<widget name = 'RendererPopup'
 						type = 'PopUp'
@@ -585,7 +585,7 @@
 				<widget name = 'AutosavePeriodPopupDesc'
 						width = '80'
 						height = 'Globals.Line.Height'
-						textalign = 'right'
+						textalign = 'end'
 				/>
 				<widget name = 'AutosavePeriodPopup'
 						type = 'PopUp'
@@ -595,7 +595,7 @@
 				<widget name = 'GuiLanguagePopupDesc'
 						width = '80'
 						height = 'Globals.Line.Height'
-						textalign = 'right'
+						textalign = 'end'
 				/>
 				<widget name = 'GuiLanguagePopup'
 						type = 'PopUp'
@@ -615,7 +615,7 @@
 				<widget name = 'UpdatesPopupDesc'
 						width = '80'
 						height = 'Globals.Line.Height'
-						textalign = 'right'
+						textalign = 'end'
 				/>
 				<widget name = 'UpdatesPopup'
 						type = 'PopUp'
@@ -643,7 +643,7 @@
 					<widget name = 'StoragePopupDesc'
 							width = '80'
 							height = 'Globals.Line.Height'
-							textalign = 'right'
+							textalign = 'end'
 					/>
 				</layout>
 				<layout type = 'vertical' padding = '0, 0, 0, 0' spacing = '1'>
@@ -796,7 +796,7 @@
 				<widget name = 'ServerPortDesc'
 						width = '80'
 						height = 'Globals.Line.Height'
-						textalign = 'right'
+						textalign = 'end'
 				/>
 				<widget name = 'ServerPortEditText'
 						width = '60'
@@ -1069,7 +1069,7 @@
 				<widget name = 'Id'
 						width = '35'
 						height = 'Globals.Line.Height'
-						textalign = 'right'
+						textalign = 'end'
 				/>
 				<widget name = 'Domain'
 						type = 'PopUp'
@@ -1079,7 +1079,7 @@
 				<widget name = 'Name'
 						width = '35'
 						height = 'Globals.Line.Height'
-						textalign = 'right'
+						textalign = 'end'
 				/>
 				<widget name = 'Desc'
 						type = 'PopUp'
@@ -1090,7 +1090,7 @@
 				<widget name = 'LangPopupDesc'
 						width = '60'
 						height = 'Globals.Line.Height'
-						textalign = 'right'
+						textalign = 'end'
 				/>
 				<widget name = 'LangPopup'
 						type = 'PopUp'
@@ -1100,7 +1100,7 @@
 				<widget name = 'PlatformPopupDesc'
 						width = '60'
 						height = 'Globals.Line.Height'
-						textalign = 'right'
+						textalign = 'end'
 				/>
 				<widget name = 'PlatformPopup'
 						type = 'PopUp'
diff --git a/gui/themes/scummremastered/remastered_layout.stx b/gui/themes/scummremastered/remastered_layout.stx
index 31be09b3da..1bdc1f8467 100644
--- a/gui/themes/scummremastered/remastered_layout.stx
+++ b/gui/themes/scummremastered/remastered_layout.stx
@@ -62,7 +62,7 @@
 
 		<widget name = 'OptionsLabel'
 				size = '115, Globals.Line.Height'
-				textalign = 'right'
+				textalign = 'end'
 		/>
 		<widget name = 'SmallLabel'
 				size = '24, Globals.Line.Height'
diff --git a/gui/themes/scummremastered/remastered_layout_lowres.stx b/gui/themes/scummremastered/remastered_layout_lowres.stx
index 2b7fe58fde..173b1c8d3a 100644
--- a/gui/themes/scummremastered/remastered_layout_lowres.stx
+++ b/gui/themes/scummremastered/remastered_layout_lowres.stx
@@ -66,7 +66,7 @@
 
 		<widget name = 'OptionsLabel'
 				size = '100, Globals.Line.Height'
-				textalign = 'right'
+				textalign = 'end'
 		/>
 		<widget name = 'SmallLabel'
 				size = '18, Globals.Line.Height'
@@ -130,7 +130,7 @@
 				<widget name = 'SearchDesc'
 						width = '50'
 						height = 'Globals.Line.Height'
-						textalign = 'right'
+						textalign = 'end'
 				/>
 				<widget name = 'Search'
 						width = '150'
@@ -575,7 +575,7 @@
 				<widget name = 'RendererPopupDesc'
 						width = '80'
 						height = 'Globals.Line.Height'
-						textalign = 'right'
+						textalign = 'end'
 				/>
 				<widget name = 'RendererPopup'
 						type = 'PopUp'
@@ -585,7 +585,7 @@
 				<widget name = 'AutosavePeriodPopupDesc'
 						width = '80'
 						height = 'Globals.Line.Height'
-						textalign = 'right'
+						textalign = 'end'
 				/>
 				<widget name = 'AutosavePeriodPopup'
 						type = 'PopUp'
@@ -595,7 +595,7 @@
 				<widget name = 'GuiLanguagePopupDesc'
 						width = '80'
 						height = 'Globals.Line.Height'
-						textalign = 'right'
+						textalign = 'end'
 				/>
 				<widget name = 'GuiLanguagePopup'
 						type = 'PopUp'
@@ -615,7 +615,7 @@
 				<widget name = 'UpdatesPopupDesc'
 						width = '80'
 						height = 'Globals.Line.Height'
-						textalign = 'right'
+						textalign = 'end'
 				/>
 				<widget name = 'UpdatesPopup'
 						type = 'PopUp'
@@ -643,7 +643,7 @@
 					<widget name = 'StoragePopupDesc'
 							width = '80'
 							height = 'Globals.Line.Height'
-							textalign = 'right'
+							textalign = 'end'
 					/>
 				</layout>
 				<layout type = 'vertical' padding = '0, 0, 0, 0' spacing = '1'>
@@ -796,7 +796,7 @@
 				<widget name = 'ServerPortDesc'
 						width = '80'
 						height = 'Globals.Line.Height'
-						textalign = 'right'
+						textalign = 'end'
 				/>
 				<widget name = 'ServerPortEditText'
 						width = '60'
@@ -1069,7 +1069,7 @@
 				<widget name = 'Id'
 						width = '35'
 						height = 'Globals.Line.Height'
-						textalign = 'right'
+						textalign = 'end'
 				/>
 				<widget name = 'Domain'
 						type = 'PopUp'
@@ -1079,7 +1079,7 @@
 				<widget name = 'Name'
 						width = '35'
 						height = 'Globals.Line.Height'
-						textalign = 'right'
+						textalign = 'end'
 				/>
 				<widget name = 'Desc'
 						type = 'PopUp'
@@ -1090,7 +1090,7 @@
 				<widget name = 'LangPopupDesc'
 						width = '60'
 						height = 'Globals.Line.Height'
-						textalign = 'right'
+						textalign = 'end'
 				/>
 				<widget name = 'LangPopup'
 						type = 'PopUp'
@@ -1100,7 +1100,7 @@
 				<widget name = 'PlatformPopupDesc'
 						width = '60'
 						height = 'Globals.Line.Height'
-						textalign = 'right'
+						textalign = 'end'
 				/>
 				<widget name = 'PlatformPopup'
 						type = 'PopUp'


Commit: cf208a711db22a757b7c95ebf477384e0c9624fa
    https://github.com/scummvm/scummvm/commit/cf208a711db22a757b7c95ebf477384e0c9624fa
Author: aryanrawlani28 (aryanrawlani007 at gmail.com)
Date: 2020-06-22T00:03:02+02:00

Commit Message:
GUI: Rebuild theme packages to use updated align 'end'

Changed paths:
    gui/themes/scummclassic.zip
    gui/themes/scummmodern.zip
    gui/themes/scummremastered.zip


diff --git a/gui/themes/scummclassic.zip b/gui/themes/scummclassic.zip
index 22e23511ae..4803a0b3f0 100644
Binary files a/gui/themes/scummclassic.zip and b/gui/themes/scummclassic.zip differ
diff --git a/gui/themes/scummmodern.zip b/gui/themes/scummmodern.zip
index 388117ce66..2734056f1d 100644
Binary files a/gui/themes/scummmodern.zip and b/gui/themes/scummmodern.zip differ
diff --git a/gui/themes/scummremastered.zip b/gui/themes/scummremastered.zip
index 4264926ea3..5e66ebeed1 100644
Binary files a/gui/themes/scummremastered.zip and b/gui/themes/scummremastered.zip differ


Commit: 86c11597b82f80fe584bd8c0706e346579cb564d
    https://github.com/scummvm/scummvm/commit/86c11597b82f80fe584bd8c0706e346579cb564d
Author: aryanrawlani28 (aryanrawlani007 at gmail.com)
Date: 2020-06-22T00:03:02+02:00

Commit Message:
GUI: Rebuild inbuilt theme to use new aligns 'start' and 'end'

Changed paths:
    gui/themes/default.inc


diff --git a/gui/themes/default.inc b/gui/themes/default.inc
index 9c6f0c01ae..9a9c4439e8 100644
--- a/gui/themes/default.inc
+++ b/gui/themes/default.inc
@@ -287,7 +287,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "<text font='text_default' "
 "text_color='color_normal' "
 "vertical_align='center' "
-"horizontal_align='left' "
+"horizontal_align='start' "
 "/>"
 "</drawdata>"
 "<drawdata id='popup_idle_rtl' cache='false' resolution='y>399'>"
@@ -318,7 +318,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "<text font='text_default' "
 "text_color='color_normal' "
 "vertical_align='center' "
-"horizontal_align='right' "
+"horizontal_align='start' "
 "/>"
 "</drawdata>"
 "<drawdata id='popup_idle' cache='false' resolution='y<400'>"
@@ -349,7 +349,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "<text font='text_default' "
 "text_color='color_normal' "
 "vertical_align='center' "
-"horizontal_align='left' "
+"horizontal_align='start' "
 "/>"
 "</drawdata>"
 "<drawdata id='popup_idle_rtl' cache='false' resolution='y<400'>"
@@ -380,7 +380,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "<text font='text_default' "
 "text_color='color_normal' "
 "vertical_align='center' "
-"horizontal_align='right' "
+"horizontal_align='start' "
 "/>"
 "</drawdata>"
 "<drawdata id='popup_disabled' cache='false' resolution='y>399'>"
@@ -411,7 +411,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "<text font='text_default' "
 "text_color='color_normal_disabled' "
 "vertical_align='center' "
-"horizontal_align='left' "
+"horizontal_align='start' "
 "/>"
 "</drawdata>"
 "<drawdata id='popup_disabled_rtl' cache='false' resolution='y>399'>"
@@ -442,7 +442,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "<text font='text_default' "
 "text_color='color_normal_disabled' "
 "vertical_align='center' "
-"horizontal_align='right' "
+"horizontal_align='start' "
 "/>"
 "</drawdata>"
 "<drawdata id='popup_disabled' cache='false' resolution='y<400'>"
@@ -473,7 +473,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "<text font='text_default' "
 "text_color='color_normal' "
 "vertical_align='center' "
-"horizontal_align='left' "
+"horizontal_align='start' "
 "/>"
 "</drawdata>"
 "<drawdata id='popup_disabled_rtl' cache='false' resolution='y<400'>"
@@ -504,7 +504,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "<text font='text_default' "
 "text_color='color_normal' "
 "vertical_align='center' "
-"horizontal_align='right' "
+"horizontal_align='start' "
 "/>"
 "</drawdata>"
 "<drawdata id='popup_hover' cache='false' resolution='y>399'>"
@@ -535,7 +535,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "<text font='text_default' "
 "text_color='color_normal_hover' "
 "vertical_align='center' "
-"horizontal_align='left' "
+"horizontal_align='start' "
 "/>"
 "</drawdata>"
 "<drawdata id='popup_hover_rtl' cache='false' resolution='y>399'>"
@@ -566,7 +566,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "<text font='text_default' "
 "text_color='color_normal_hover' "
 "vertical_align='center' "
-"horizontal_align='right' "
+"horizontal_align='start' "
 "/>"
 "</drawdata>"
 "<drawdata id='popup_hover' cache='false' resolution='y<400'>"
@@ -597,7 +597,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "<text font='text_default' "
 "text_color='color_normal' "
 "vertical_align='center' "
-"horizontal_align='left' "
+"horizontal_align='start' "
 "/>"
 "</drawdata>"
 "<drawdata id='popup_hover_rtl' cache='false' resolution='y<400'>"
@@ -628,7 +628,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "<text font='text_default' "
 "text_color='color_normal' "
 "vertical_align='center' "
-"horizontal_align='right' "
+"horizontal_align='start' "
 "/>"
 "</drawdata>"
 "<drawdata id='widget_textedit' cache='false'>"
@@ -1293,7 +1293,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "<text font='text_default' "
 "text_color='color_normal_disabled' "
 "vertical_align='top' "
-"horizontal_align='left' "
+"horizontal_align='start' "
 "/>"
 "<drawstep func='bevelsq' "
 "bevel='2' "
@@ -1309,7 +1309,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "<text font='text_default' "
 "text_color='color_normal_disabled' "
 "vertical_align='top' "
-"horizontal_align='left' "
+"horizontal_align='start' "
 "/>"
 "<drawstep func='bevelsq' "
 "bevel='2' "
@@ -1320,7 +1320,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "<text font='text_default' "
 "text_color='color_normal' "
 "vertical_align='top' "
-"horizontal_align='left' "
+"horizontal_align='start' "
 "/>"
 "<drawstep func='bevelsq' "
 "bevel='2' "
@@ -1336,7 +1336,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "<text font='text_default' "
 "text_color='color_normal' "
 "vertical_align='top' "
-"horizontal_align='left' "
+"horizontal_align='start' "
 "/>"
 "<drawstep func='bevelsq' "
 "bevel='2' "
@@ -1347,7 +1347,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "<text font='text_default' "
 "text_color='color_normal' "
 "vertical_align='center' "
-"horizontal_align='left' "
+"horizontal_align='start' "
 "/>"
 "<drawstep func='circle' "
 "width='7' "
@@ -1363,7 +1363,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "<text font='text_default' "
 "text_color='color_normal' "
 "vertical_align='center' "
-"horizontal_align='left' "
+"horizontal_align='start' "
 "/>"
 "<drawstep func='circle' "
 "width='7' "
@@ -1388,7 +1388,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "<text font='text_default' "
 "text_color='color_normal_disabled' "
 "vertical_align='center' "
-"horizontal_align='left' "
+"horizontal_align='start' "
 "/>"
 "<drawstep func='circle' "
 "width='7' "
@@ -1437,7 +1437,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "<def var='DropdownButton.Width' value='17'/>"
 "<widget name='OptionsLabel' "
 "size='110,Globals.Line.Height' "
-"textalign='right' "
+"textalign='end' "
 "/>"
 "<widget name='SmallLabel' "
 "size='24,Globals.Line.Height' "
@@ -1512,7 +1512,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "<widget name='SearchDesc' "
 "width='60' "
 "height='Globals.Line.Height' "
-"textalign='right' "
+"textalign='end' "
 "/>"
 "<widget name='Search' "
 "width='150' "
@@ -3283,7 +3283,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "/>"
 "<widget name='OptionsLabel' "
 "size='110,Globals.Line.Height' "
-"textalign='right' "
+"textalign='end' "
 "/>"
 "<widget name='SmallLabel' "
 "size='18,Globals.Line.Height' "
@@ -3346,7 +3346,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "<widget name='SearchDesc' "
 "width='50' "
 "height='Globals.Line.Height' "
-"textalign='right' "
+"textalign='end' "
 "/>"
 "<widget name='Search' "
 "width='150' "
@@ -3777,7 +3777,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "<widget name='RendererPopupDesc' "
 "width='80' "
 "height='Globals.Line.Height' "
-"textalign='right' "
+"textalign='end' "
 "/>"
 "<widget name='RendererPopup' "
 "type='PopUp' "
@@ -3787,7 +3787,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "<widget name='AutosavePeriodPopupDesc' "
 "width='80' "
 "height='Globals.Line.Height' "
-"textalign='right' "
+"textalign='end' "
 "/>"
 "<widget name='AutosavePeriodPopup' "
 "type='PopUp' "
@@ -3797,7 +3797,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "<widget name='GuiLanguagePopupDesc' "
 "width='80' "
 "height='Globals.Line.Height' "
-"textalign='right' "
+"textalign='end' "
 "/>"
 "<widget name='GuiLanguagePopup' "
 "type='PopUp' "
@@ -3817,7 +3817,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "<widget name='UpdatesPopupDesc' "
 "width='80' "
 "height='Globals.Line.Height' "
-"textalign='right' "
+"textalign='end' "
 "/>"
 "<widget name='UpdatesPopup' "
 "type='PopUp' "
@@ -3843,7 +3843,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "<widget name='StoragePopupDesc' "
 "width='100' "
 "height='Globals.Line.Height' "
-"textalign='right' "
+"textalign='end' "
 "/>"
 "</layout>"
 "<layout type='vertical' padding='0,0,0,0' spacing='1'>"
@@ -3993,7 +3993,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "<widget name='ServerPortDesc' "
 "width='80' "
 "height='Globals.Line.Height' "
-"textalign='right' "
+"textalign='end' "
 "/>"
 "<widget name='ServerPortEditText' "
 "width='60' "
@@ -4251,7 +4251,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "<widget name='Id' "
 "width='35' "
 "height='Globals.Line.Height' "
-"textalign='right' "
+"textalign='end' "
 "/>"
 "<widget name='Domain' "
 "type='PopUp' "
@@ -4261,7 +4261,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "<widget name='Name' "
 "width='35' "
 "height='Globals.Line.Height' "
-"textalign='right' "
+"textalign='end' "
 "/>"
 "<widget name='Desc' "
 "type='PopUp' "
@@ -4272,7 +4272,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "<widget name='LangPopupDesc' "
 "width='60' "
 "height='Globals.Line.Height' "
-"textalign='right' "
+"textalign='end' "
 "/>"
 "<widget name='LangPopup' "
 "type='PopUp' "
@@ -4282,7 +4282,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
 "<widget name='PlatformPopupDesc' "
 "width='60' "
 "height='Globals.Line.Height' "
-"textalign='right' "
+"textalign='end' "
 "/>"
 "<widget name='PlatformPopup' "
 "type='PopUp' "


Commit: e3db189f0b51f49c937e302f4b944d8495c62fc3
    https://github.com/scummvm/scummvm/commit/e3db189f0b51f49c937e302f4b944d8495c62fc3
Author: aryanrawlani28 (aryanrawlani007 at gmail.com)
Date: 2020-06-22T00:03:02+02:00

Commit Message:
GUI: RTL: Fix small issues

- Remove unused variable in tab.cpp
- Remove wrong check for alignment in popups. For rtl, set align to right.

Changed paths:
    gui/widgets/popup.cpp
    gui/widgets/tab.cpp


diff --git a/gui/widgets/popup.cpp b/gui/widgets/popup.cpp
index 05d31b079d..e557fc0402 100644
--- a/gui/widgets/popup.cpp
+++ b/gui/widgets/popup.cpp
@@ -405,12 +405,7 @@ void PopUpDialog::drawMenuEntry(int entry, bool hilite) {
 		r2.left = g_system->getOverlayWidth() - r2.left - w + g_gui.getOverlayOffset();
 		r2.right = r2.left + w;
 
-		if (_boss->getFlags() == 305) {
-			alignment = Graphics::kTextAlignCenter;		// GUI FIXME: This is not a good way to say that I am a DropDownButtonWidget
-		} else {
-			alignment = Graphics::kTextAlignRight;
-		}
-
+		alignment = Graphics::kTextAlignRight;
 		pad = _rightPadding;
 	}
 
diff --git a/gui/widgets/tab.cpp b/gui/widgets/tab.cpp
index bc04b63f3a..40621390b3 100644
--- a/gui/widgets/tab.cpp
+++ b/gui/widgets/tab.cpp
@@ -386,11 +386,9 @@ void TabWidget::reflowLayout() {
 void TabWidget::drawWidget() {
 	Common::Array<Common::String> tabs;
 	Common::Array<int> widths;
-	int totalWidth = 0;
 	for (int i = _firstVisibleTab; i <= _lastVisibleTab; ++i) {
 		tabs.push_back(_tabs[i].title);
 		widths.push_back(_tabs[i]._tabWidth);
-		totalWidth += _tabs[i]._tabWidth;
 	}
 
 	g_gui.theme()->drawDialogBackground(




More information about the Scummvm-git-logs mailing list