aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Sandulenko2006-05-18 16:44:44 +0000
committerEugene Sandulenko2006-05-18 16:44:44 +0000
commite98278228158a0a7aa69450bf44c912ac508a207 (patch)
tree91b5cf428e6e7e2761c1782f2c76ad13d16a7a58
parente950d171f56a1d8ae9d41146284a506cd9d6e429 (diff)
downloadscummvm-rg350-e98278228158a0a7aa69450bf44c912ac508a207.tar.gz
scummvm-rg350-e98278228158a0a7aa69450bf44c912ac508a207.tar.bz2
scummvm-rg350-e98278228158a0a7aa69450bf44c912ac508a207.zip
Fix bug #1483272: "GUI: SCUMM pause dialog breaks upon scaler switch". Also
fix same problem in scumm help dialog. svn-id: r22522
-rw-r--r--engines/scumm/dialogs.cpp47
-rw-r--r--engines/scumm/dialogs.h5
-rw-r--r--gui/widget.h4
3 files changed, 41 insertions, 15 deletions
diff --git a/engines/scumm/dialogs.cpp b/engines/scumm/dialogs.cpp
index 17b86067f9..bfe1e31a6b 100644
--- a/engines/scumm/dialogs.cpp
+++ b/engines/scumm/dialogs.cpp
@@ -712,11 +712,32 @@ enum {
HelpDialog::HelpDialog(const GameSettings &game)
: ScummDialog("scummhelp"), _game(game) {
+ _title = new StaticTextWidget(this, "scummhelp_title", "");
+
+ _page = 1;
+
+ _numPages = ScummHelp::numPages(_game.id);
+
+ _prevButton = new GUI::ButtonWidget(this, "scummhelp_prev", "Previous", kPrevCmd, 'P');
+ _nextButton = new GUI::ButtonWidget(this, "scummhelp_next", "Next", kNextCmd, 'N');
+ new GUI::ButtonWidget(this, "scummhelp_close", "Close", kCloseCmd, 'C');
+ _prevButton->clearFlags(WIDGET_ENABLED);
+
+ // Dummy entries
+ for (int i = 0; i < HELP_NUM_LINES; i++) {
+ _key[i] = new StaticTextWidget(this, 0, 0, 10, 10, "", kTextAlignLeft);
+ _dsc[i] = new StaticTextWidget(this, 0, 0, 10, 10, "", kTextAlignLeft);
+ }
+
+}
+
+void HelpDialog::handleScreenChanged() {
+ ScummDialog::handleScreenChanged();
+
_drawingHints &= ~GUI::THEME_HINT_SPECIAL_COLOR;
int lineHeight = g_gui.getFontHeight();
- _title = new StaticTextWidget(this, "scummhelp_title", "");
int keyX = g_gui.evaluator()->getVar("scummhelp_key.x");
int keyYoff = g_gui.evaluator()->getVar("scummhelp_key.yoffset");
int keyW = g_gui.evaluator()->getVar("scummhelp_key.w");
@@ -727,18 +748,12 @@ HelpDialog::HelpDialog(const GameSettings &game)
int dscH = g_gui.evaluator()->getVar("scummhelp_dsc.h");
for (int i = 0; i < HELP_NUM_LINES; i++) {
- _key[i] = new StaticTextWidget(this, keyX, keyYoff + lineHeight * (i + 2), keyW, keyH, "", kTextAlignLeft);
- _dsc[i] = new StaticTextWidget(this, dscX, dscYoff + lineHeight * (i + 2), dscW, dscH, "", kTextAlignLeft);
+ _key[i]->setPos(keyX, keyYoff + lineHeight * (i + 2));
+ _key[i]->setSize(keyW, keyH);
+ _dsc[i]->setPos(dscX, dscYoff + lineHeight * (i + 2));
+ _dsc[i]->setSize(dscW, dscH);
}
- _page = 1;
- _numPages = ScummHelp::numPages(game.id);
-
- _prevButton = new GUI::ButtonWidget(this, "scummhelp_prev", "Previous", kPrevCmd, 'P');
- _nextButton = new GUI::ButtonWidget(this, "scummhelp_next", "Next", kNextCmd, 'N');
- new GUI::ButtonWidget(this, "scummhelp_close", "Close", kCloseCmd, 'C');
- _prevButton->clearFlags(WIDGET_ENABLED);
-
displayKeyBindings();
}
@@ -803,10 +818,16 @@ InfoDialog::InfoDialog(ScummEngine *scumm, const String& message)
}
void InfoDialog::setInfoText(const String& message) {
+ _message = message;
+
+ handleScreenChanged();
+}
+
+void InfoDialog::handleScreenChanged() {
const int screenW = g_system->getOverlayWidth();
const int screenH = g_system->getOverlayHeight();
- int width = g_gui.getStringWidth(message) + 16;
+ int width = g_gui.getStringWidth(_message) + 16;
int height = g_gui.getFontHeight() + 8;
_w = width;
@@ -814,7 +835,7 @@ void InfoDialog::setInfoText(const String& message) {
_x = (screenW - width) / 2;
_y = (screenH - height) / 2;
- new StaticTextWidget(this, 4, 4, _w - 8, _h, message, kTextAlignCenter);
+ new StaticTextWidget(this, 4, 4, _w - 8, _h, _message, kTextAlignCenter);
}
const Common::String InfoDialog::queryResString(int stringno) {
diff --git a/engines/scumm/dialogs.h b/engines/scumm/dialogs.h
index 37b706b96e..6e6e6227b3 100644
--- a/engines/scumm/dialogs.h
+++ b/engines/scumm/dialogs.h
@@ -107,6 +107,8 @@ public:
HelpDialog(const GameSettings &game);
virtual void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data);
+ virtual void handleScreenChanged();
+
protected:
typedef Common::String String;
@@ -151,6 +153,7 @@ public:
class InfoDialog : public ScummDialog {
protected:
ScummEngine *_vm;
+ String _message;
public:
// arbitrary message
@@ -167,6 +170,8 @@ public:
close();
}
+ virtual void handleScreenChanged();
+
protected:
void setInfoText (const String& message);
diff --git a/gui/widget.h b/gui/widget.h
index 08e811cd6a..4fcd277f9d 100644
--- a/gui/widget.h
+++ b/gui/widget.h
@@ -114,8 +114,8 @@ public:
virtual int16 getAbsX() const { return _x + _boss->getChildX(); }
virtual int16 getAbsY() const { return _y + _boss->getChildY(); }
-// virtual void setPos(int x, int y);
-// virtual void setSize(int w, int h);
+ virtual void setPos(int x, int y) { _x = x; _y = y; }
+ virtual void setSize(int w, int h) { _w = w; _h = h; }
virtual void handleMouseDown(int x, int y, int button, int clickCount) {}
virtual void handleMouseUp(int x, int y, int button, int clickCount) {}