GUI: RTL: Overload and simplify getWidgetData for getting rtl flag
This commit is contained in:
parent
12a4af77bd
commit
dde4200d35
6 changed files with 18 additions and 11 deletions
|
@ -309,7 +309,7 @@ void HelpDialog::reflowLayout() {
|
||||||
|
|
||||||
assert(lineHeight);
|
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
|
// Make sure than we don't have more lines than what we can fit
|
||||||
// on the space that the layout reserves for text
|
// on the space that the layout reserves for text
|
||||||
|
|
|
@ -50,6 +50,12 @@ void ThemeEval::reset() {
|
||||||
_layouts.clear();
|
_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) {
|
bool ThemeEval::getWidgetData(const Common::String &widget, int16 &x, int16 &y, int16 &w, int16 &h, bool &useRTL) {
|
||||||
Common::StringTokenizer tokenizer(widget, ".");
|
Common::StringTokenizer tokenizer(widget, ".");
|
||||||
|
|
||||||
|
|
|
@ -88,6 +88,7 @@ public:
|
||||||
bool hasDialog(const Common::String &name);
|
bool hasDialog(const Common::String &name);
|
||||||
|
|
||||||
void reflowDialogLayout(const Common::String &name, Widget *widgetChain);
|
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);
|
bool getWidgetData(const Common::String &widget, int16 &x, int16 &y, int16 &w, int16 &h, bool &useRTL);
|
||||||
|
|
||||||
Graphics::TextAlign getWidgetTextHAlign(const Common::String &widget);
|
Graphics::TextAlign getWidgetTextHAlign(const Common::String &widget);
|
||||||
|
|
|
@ -233,7 +233,7 @@ void ThemeLayoutMain::reflowLayout(Widget *widgetChain) {
|
||||||
_w = _defaultW > 0 ? MIN(_defaultW, g_system->getOverlayWidth()) : -1;
|
_w = _defaultW > 0 ? MIN(_defaultW, g_system->getOverlayWidth()) : -1;
|
||||||
_h = _defaultH > 0 ? MIN(_defaultH, g_system->getOverlayHeight()) : -1;
|
_h = _defaultH > 0 ? MIN(_defaultH, g_system->getOverlayHeight()) : -1;
|
||||||
} else {
|
} 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());
|
warning("Unable to retrieve overlayed dialog position %s", _overlays.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2786,10 +2786,10 @@ void GlobalOptionsDialog::setupCloudTab() {
|
||||||
int16 shiftUp = 0;
|
int16 shiftUp = 0;
|
||||||
if (!showingCurrentStorage || enabled) {
|
if (!showingCurrentStorage || enabled) {
|
||||||
// "storage is disabled" hint is not shown, shift everything up
|
// "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");
|
warning("GlobalOptions_Cloud_Container.StorageUsernameDesc's position is undefined");
|
||||||
shiftUp = y;
|
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");
|
warning("GlobalOptions_Cloud_Container.StorageWizardNotConnectedHint's position is undefined");
|
||||||
shiftUp = y - shiftUp;
|
shiftUp = y - shiftUp;
|
||||||
}
|
}
|
||||||
|
@ -2839,10 +2839,10 @@ void GlobalOptionsDialog::setupCloudTab() {
|
||||||
|
|
||||||
int16 disconnectWidgetsAdditionalShift = 0;
|
int16 disconnectWidgetsAdditionalShift = 0;
|
||||||
if (!showDownloadButton) {
|
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");
|
warning("GlobalOptions_Cloud_Container.StorageDownloadHint's position is undefined");
|
||||||
disconnectWidgetsAdditionalShift = y;
|
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");
|
warning("GlobalOptions_Cloud_Container.DownloadButton's position is undefined");
|
||||||
disconnectWidgetsAdditionalShift = y - disconnectWidgetsAdditionalShift;
|
disconnectWidgetsAdditionalShift = y - disconnectWidgetsAdditionalShift;
|
||||||
}
|
}
|
||||||
|
@ -2889,10 +2889,10 @@ void GlobalOptionsDialog::setupCloudTab() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!shownConnectedInfo) {
|
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");
|
warning("GlobalOptions_Cloud_Container.StorageUsernameDesc's position is undefined");
|
||||||
shiftUp = y;
|
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");
|
warning("GlobalOptions_Cloud_Container.StorageWizardNotConnectedHint's position is undefined");
|
||||||
shiftUp = y - shiftUp;
|
shiftUp = y - shiftUp;
|
||||||
|
|
||||||
|
@ -2912,7 +2912,7 @@ void GlobalOptionsDialog::shiftWidget(Widget *widget, const char *widgetName, in
|
||||||
|
|
||||||
int16 x, y;
|
int16 x, y;
|
||||||
int16 w, h;
|
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);
|
warning("%s's position is undefined", widgetName);
|
||||||
|
|
||||||
widget->setPos(x + xOffset, y + yOffset);
|
widget->setPos(x + xOffset, y + yOffset);
|
||||||
|
|
|
@ -493,7 +493,7 @@ void SaveLoadChooserSimple::reflowLayout() {
|
||||||
int16 x, y;
|
int16 x, y;
|
||||||
int16 w, h;
|
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");
|
error("Error when loading position data for Save/Load Thumbnails");
|
||||||
|
|
||||||
// Even if there is no thumbnail support, getWidgetData() will provide default thumbnail values
|
// Even if there is no thumbnail support, getWidgetData() will provide default thumbnail values
|
||||||
|
@ -934,7 +934,7 @@ void SaveLoadChooserGrid::reflowLayout() {
|
||||||
|
|
||||||
int16 x, y;
|
int16 x, y;
|
||||||
int16 w;
|
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'");
|
error("Could not load widget position for 'SaveLoadChooser.List'");
|
||||||
|
|
||||||
const int16 buttonWidth = kThumbnailWidth + 6;
|
const int16 buttonWidth = kThumbnailWidth + 6;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue