[Scummvm-cvs-logs] CVS: scummvm/gui console.cpp,1.57,1.58 console.h,1.29,1.30 dialog.cpp,1.50,1.51 dialog.h,1.31,1.32 newgui.cpp,1.107,1.108 newgui.h,1.55,1.56
Max Horn
fingolfin at users.sourceforge.net
Sun Apr 17 04:21:43 CEST 2005
Update of /cvsroot/scummvm/scummvm/gui
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16627
Modified Files:
console.cpp console.h dialog.cpp dialog.h newgui.cpp newgui.h
Log Message:
Added Dialog::wantsScaling(), to allow dialogs to turn off automatic scaling
Index: console.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/console.cpp,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -d -r1.57 -r1.58
--- console.cpp 6 Feb 2005 18:12:28 -0000 1.57
+++ console.cpp 17 Apr 2005 11:20:58 -0000 1.58
@@ -116,9 +116,6 @@
}
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 @@
} else if (_slideMode == kUpSlideMode && _y <= -_h) {
// End the slide
_slideMode = kNoSlideMode;
- g_gui.enableScaling(true);
close();
} else
draw();
Index: console.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/console.h,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- console.h 1 Jan 2005 16:09:06 -0000 1.29
+++ console.h 17 Apr 2005 11:20:58 -0000 1.30
@@ -115,6 +115,9 @@
_completionCallbackRefCon = refCon;
}
+ // disable scaling
+ bool wantsScaling() const { return false; }
+
protected:
inline char &buffer(int idx) {
return _buffer[idx % kBufferSize];
Index: dialog.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/dialog.cpp,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -d -r1.50 -r1.51
--- dialog.cpp 12 Mar 2005 17:03:59 -0000 1.50
+++ dialog.cpp 17 Apr 2005 11:20:58 -0000 1.51
@@ -99,6 +99,10 @@
g_gui._needRedraw = true;
}
+bool Dialog::wantsScaling() const {
+ return true;
+}
+
void Dialog::drawDialog() {
if (!isVisible())
Index: dialog.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/dialog.h,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- dialog.h 1 Jan 2005 16:09:06 -0000 1.31
+++ dialog.h 17 Apr 2005 11:20:58 -0000 1.32
@@ -57,6 +57,16 @@
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();
Index: newgui.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/newgui.cpp,v
retrieving revision 1.107
retrieving revision 1.108
diff -u -d -r1.107 -r1.108
--- newgui.cpp 16 Apr 2005 11:40:09 -0000 1.107
+++ newgui.cpp 17 Apr 2005 11:20:58 -0000 1.108
@@ -106,6 +106,7 @@
// 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 @@
// 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;
}
Index: newgui.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/newgui.h,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -d -r1.55 -r1.56
--- newgui.h 16 Apr 2005 11:40:15 -0000 1.55
+++ newgui.h 17 Apr 2005 11:20:59 -0000 1.56
@@ -67,9 +67,6 @@
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 @@
void animateCursor();
void updateColors();
+
void updateScaleFactor();
OverlayColor *getBasePtr(int x, int y);
More information about the Scummvm-git-logs
mailing list