GUI: Rename getBaseWidth/Height to getGUIWidth/Height

This reflects its purpose better, so the user code will be
more logical
This commit is contained in:
Eugene Sandulenko 2021-03-31 23:50:40 +02:00
parent 493a343e6a
commit 48faae426a
4 changed files with 15 additions and 15 deletions

View file

@ -89,7 +89,7 @@ MainMenuDialog::MainMenuDialog(Engine *engine)
new GUI::ButtonWidget(this, "GlobalMenu.About", _("~A~bout"), Common::U32String(), kAboutCmd); new GUI::ButtonWidget(this, "GlobalMenu.About", _("~A~bout"), Common::U32String(), kAboutCmd);
if (g_gui.getBaseWidth() > 320) if (g_gui.getGUIWidth() > 320)
_returnToLauncherButton = new GUI::ButtonWidget(this, "GlobalMenu.ReturnToLauncher", _("~R~eturn to Launcher"), Common::U32String(), kLauncherCmd); _returnToLauncherButton = new GUI::ButtonWidget(this, "GlobalMenu.ReturnToLauncher", _("~R~eturn to Launcher"), Common::U32String(), kLauncherCmd);
else else
_returnToLauncherButton = new GUI::ButtonWidget(this, "GlobalMenu.ReturnToLauncher", _c("~R~eturn to Launcher", "lowres"), Common::U32String(), kLauncherCmd); _returnToLauncherButton = new GUI::ButtonWidget(this, "GlobalMenu.ReturnToLauncher", _c("~R~eturn to Launcher", "lowres"), Common::U32String(), kLauncherCmd);
@ -165,7 +165,7 @@ void MainMenuDialog::reflowLayout() {
// Update labels when it might be needed // Update labels when it might be needed
// FIXME: it might be better to declare GUI::StaticTextWidget::setLabel() virtual // FIXME: it might be better to declare GUI::StaticTextWidget::setLabel() virtual
// and to reimplement it in GUI::ButtonWidget to handle the hotkey. // and to reimplement it in GUI::ButtonWidget to handle the hotkey.
if (g_gui.getBaseWidth() > 320) if (g_gui.getGUIWidth() > 320)
_returnToLauncherButton->setLabel(_returnToLauncherButton->cleanupHotkey(_("~R~eturn to Launcher"))); _returnToLauncherButton->setLabel(_returnToLauncherButton->cleanupHotkey(_("~R~eturn to Launcher")));
else else
_returnToLauncherButton->setLabel(_returnToLauncherButton->cleanupHotkey(_c("~R~eturn to Launcher", "lowres"))); _returnToLauncherButton->setLabel(_returnToLauncherButton->cleanupHotkey(_c("~R~eturn to Launcher", "lowres")));

View file

@ -225,13 +225,13 @@ void ThemeLayoutMain::reflowLayout(Widget *widgetChain) {
if (_overlays == "screen") { if (_overlays == "screen") {
_x = 0; _x = 0;
_y = 0; _y = 0;
_w = g_gui.getBaseWidth() * g_gui.getScaleFactor(); _w = g_gui.getGUIWidth() * g_gui.getScaleFactor();
_h = g_gui.getBaseHeight() * g_gui.getScaleFactor(); _h = g_gui.getGUIHeight() * g_gui.getScaleFactor();
} else if (_overlays == "screen_center") { } else if (_overlays == "screen_center") {
_x = -1; _x = -1;
_y = -1; _y = -1;
_w = _defaultW > 0 ? MIN(_defaultW, g_gui.getBaseWidth()) * g_gui.getScaleFactor() : -1; _w = _defaultW > 0 ? MIN(_defaultW, g_gui.getGUIWidth()) * g_gui.getScaleFactor() : -1;
_h = _defaultH > 0 ? MIN(_defaultH, g_gui.getBaseHeight()) * g_gui.getScaleFactor() : -1; _h = _defaultH > 0 ? MIN(_defaultH, g_gui.getGUIHeight()) * g_gui.getScaleFactor() : -1;
} else { } else {
if (!g_gui.xmlEval()->getWidgetData(_overlays, _x, _y, _w, _h)) { 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());
@ -239,10 +239,10 @@ void ThemeLayoutMain::reflowLayout(Widget *widgetChain) {
if (_w == -1 || _h == -1) { if (_w == -1 || _h == -1) {
warning("The overlayed dialog %s has not been sized, using a default size for %s", _overlays.c_str(), _name.c_str()); warning("The overlayed dialog %s has not been sized, using a default size for %s", _overlays.c_str(), _name.c_str());
_x = g_gui.getBaseWidth() / 10 * g_gui.getScaleFactor(); _x = g_gui.getGUIWidth() / 10 * g_gui.getScaleFactor();
_y = g_gui.getBaseHeight() / 10 * g_gui.getScaleFactor(); _y = g_gui.getGUIHeight() / 10 * g_gui.getScaleFactor();
_w = g_gui.getBaseWidth() * 8 / 10 * g_gui.getScaleFactor(); _w = g_gui.getGUIWidth() * 8 / 10 * g_gui.getScaleFactor();
_h = g_gui.getBaseHeight() * 8 / 10 * g_gui.getScaleFactor(); _h = g_gui.getGUIHeight() * 8 / 10 * g_gui.getScaleFactor();
} }
} }
@ -254,7 +254,7 @@ void ThemeLayoutMain::reflowLayout(Widget *widgetChain) {
add them here and in Widget::draw() to enable RTL support for that particular dialog add them here and in Widget::draw() to enable RTL support for that particular dialog
*/ */
int oldX = _x; int oldX = _x;
_x = g_gui.getBaseWidth() * g_gui.getScaleFactor() - _w - _x; _x = g_gui.getGUIWidth() * g_gui.getScaleFactor() - _w - _x;
g_gui.setDialogPaddings(oldX, _x); g_gui.setDialogPaddings(oldX, _x);
} }
} }

View file

@ -91,8 +91,8 @@ public:
ThemeEval *xmlEval() { return _theme->getEvaluator(); } ThemeEval *xmlEval() { return _theme->getEvaluator(); }
int16 getBaseWidth() const { return _baseWidth; } int16 getGUIWidth() const { return _baseWidth; }
int16 getBaseHeight() const { return _baseHeight; } int16 getGUIHeight() const { return _baseHeight; }
float getScaleFactor() const { return _scaleFactor; } float getScaleFactor() const { return _scaleFactor; }
bool useRTL() const { return _useRTL; } bool useRTL() const { return _useRTL; }

View file

@ -113,7 +113,7 @@ SaveLoadChooserType getRequestedSaveLoadDialog(const MetaEngine *metaEngine) {
// possible to use it. // possible to use it.
g_gui.checkScreenChange(); g_gui.checkScreenChange();
if (g_gui.getBaseWidth() >= 640 && g_gui.getBaseHeight() >= 400 if (g_gui.getGUIWidth() >= 640 && g_gui.getGUIHeight() >= 400
&& metaEngine->hasFeature(MetaEngine::kSavesSupportMetaInfo) && metaEngine->hasFeature(MetaEngine::kSavesSupportMetaInfo)
&& metaEngine->hasFeature(MetaEngine::kSavesSupportThumbnail) && metaEngine->hasFeature(MetaEngine::kSavesSupportThumbnail)
&& userConfig.equalsIgnoreCase("grid")) { && userConfig.equalsIgnoreCase("grid")) {
@ -342,7 +342,7 @@ void SaveLoadChooserDialog::addChooserButtons() {
_listButton = createSwitchButton("SaveLoadChooser.ListSwitch", Common::U32String("L"), _("List view"), ThemeEngine::kImageList, kListSwitchCmd); _listButton = createSwitchButton("SaveLoadChooser.ListSwitch", Common::U32String("L"), _("List view"), ThemeEngine::kImageList, kListSwitchCmd);
_gridButton = createSwitchButton("SaveLoadChooser.GridSwitch", Common::U32String("G"), _("Grid view"), ThemeEngine::kImageGrid, kGridSwitchCmd); _gridButton = createSwitchButton("SaveLoadChooser.GridSwitch", Common::U32String("G"), _("Grid view"), ThemeEngine::kImageGrid, kGridSwitchCmd);
if (!_metaInfoSupport || !_thumbnailSupport || !(g_gui.getBaseWidth() >= 640 && g_gui.getBaseHeight() >= 400)) { if (!_metaInfoSupport || !_thumbnailSupport || !(g_gui.getGUIWidth() >= 640 && g_gui.getGUIHeight() >= 400)) {
_gridButton->setEnabled(false); _gridButton->setEnabled(false);
_listButton->setEnabled(false); _listButton->setEnabled(false);
} }