aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gui/console.cpp4
-rw-r--r--gui/console.h3
-rw-r--r--gui/dialog.cpp4
-rw-r--r--gui/dialog.h10
-rw-r--r--gui/newgui.cpp8
-rw-r--r--gui/newgui.h4
6 files changed, 25 insertions, 8 deletions
diff --git a/gui/console.cpp b/gui/console.cpp
index 2e1e67d491..9e5abe6b2e 100644
--- a/gui/console.cpp
+++ b/gui/console.cpp
@@ -116,9 +116,6 @@ void ConsoleDialog::slideUpAndClose() {
}
void ConsoleDialog::open() {
- // disable scaling because the console is using non fixed positions
- g_gui.enableScaling(false);
-
// Initiate sliding the console down. We do a very simple trick to achieve
// this effect: we simply move the console dialog just above (outside) the
// visible screen area, then shift it down in handleTickle() over a
@@ -191,7 +188,6 @@ void ConsoleDialog::handleTickle() {
} else if (_slideMode == kUpSlideMode && _y <= -_h) {
// End the slide
_slideMode = kNoSlideMode;
- g_gui.enableScaling(true);
close();
} else
draw();
diff --git a/gui/console.h b/gui/console.h
index c094c1c1c7..af68a82355 100644
--- a/gui/console.h
+++ b/gui/console.h
@@ -115,6 +115,9 @@ public:
_completionCallbackRefCon = refCon;
}
+ // disable scaling
+ bool wantsScaling() const { return false; }
+
protected:
inline char &buffer(int idx) {
return _buffer[idx % kBufferSize];
diff --git a/gui/dialog.cpp b/gui/dialog.cpp
index 7579cce519..42433ea659 100644
--- a/gui/dialog.cpp
+++ b/gui/dialog.cpp
@@ -99,6 +99,10 @@ void Dialog::draw() {
g_gui._needRedraw = true;
}
+bool Dialog::wantsScaling() const {
+ return true;
+}
+
void Dialog::drawDialog() {
if (!isVisible())
diff --git a/gui/dialog.h b/gui/dialog.h
index 0deae935dd..f17eb30181 100644
--- a/gui/dialog.h
+++ b/gui/dialog.h
@@ -57,6 +57,16 @@ public:
void releaseFocus();
+ /**
+ * We can optionally scale dialogs by a factor of two. This is the
+ * default behaviour if the GUI is displayed on a 640x400 or bigger
+ * screen. However, some dialogs can cope with multiple screen sizes,
+ * and thus do not want automatic scaling.
+ *
+ * @return true if the dialog adjusts itself to the screen size
+ */
+ virtual bool wantsScaling() const;
+
protected:
virtual void open();
virtual void close();
diff --git a/gui/newgui.cpp b/gui/newgui.cpp
index 59f7149123..a9b6070efc 100644
--- a/gui/newgui.cpp
+++ b/gui/newgui.cpp
@@ -106,6 +106,7 @@ void NewGui::runLoop() {
// EVENT_SCREEN_CHANGED is received. However, not yet all backends support
// that event, so we also do it "manually" whenever a run loop is entered.
updateColors();
+ _scaleEnable = activeDialog->wantsScaling();
updateScaleFactor();
if (!_stateIsSaved) {
@@ -121,8 +122,13 @@ void NewGui::runLoop() {
// This is necessary to get the blending right.
_system->clearOverlay();
_system->grabOverlay((OverlayColor *)_screen.pixels, _screenPitch);
- for (int i = 0; i < _dialogStack.size(); i++)
+ for (int i = 0; i < _dialogStack.size(); i++) {
+ // For each dialog we draw we have to ensure the correct
+ // scaling mode is active.
+ _scaleEnable = _dialogStack[i]->wantsScaling();
+ updateScaleFactor();
_dialogStack[i]->drawDialog();
+ }
_needRedraw = false;
}
diff --git a/gui/newgui.h b/gui/newgui.h
index 78e166e6cf..bdff549838 100644
--- a/gui/newgui.h
+++ b/gui/newgui.h
@@ -67,9 +67,6 @@ public:
bool isActive() const { return ! _dialogStack.empty(); }
- int getScaleFactor() const { return _scaleFactor; }
- void enableScaling(bool enable) { _scaleEnable = enable; updateScaleFactor(); }
-
protected:
OSystem *_system;
Graphics::Surface _screen;
@@ -116,6 +113,7 @@ protected:
void animateCursor();
void updateColors();
+
void updateScaleFactor();
OverlayColor *getBasePtr(int x, int y);