GUI: Code cleanup

This commit is contained in:
aryanrawlani28 2020-06-06 05:03:43 +05:30 committed by Eugene Sandulenko
parent e50463f11f
commit 12a4af77bd
5 changed files with 16 additions and 25 deletions

View File

@ -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) {

View File

@ -93,7 +93,7 @@ void Tooltip::drawDialog(DrawLayer layerToDraw) {
ThemeEngine::kFontColorNormal,
false
);
}
}
}
}

View File

@ -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;
}

View File

@ -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);

View File

@ -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()) {