aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTorbjörn Andersson2005-05-18 09:41:13 +0000
committerTorbjörn Andersson2005-05-18 09:41:13 +0000
commit6ef7dbf97c21cc44d59185ce6a1df9978ce09003 (patch)
tree8fb213c272c09c10b7e9c7234a2468cc14918116
parentf0e43fb2a6b3ffdf3d00b03d3f0118ccb5aa3b4d (diff)
downloadscummvm-rg350-6ef7dbf97c21cc44d59185ce6a1df9978ce09003.tar.gz
scummvm-rg350-6ef7dbf97c21cc44d59185ce6a1df9978ce09003.tar.bz2
scummvm-rg350-6ef7dbf97c21cc44d59185ce6a1df9978ce09003.zip
The SCUMM options dialog mostly scales itself. Mostly.
svn-id: r18160
-rw-r--r--scumm/dialogs.cpp74
-rw-r--r--scumm/dialogs.h4
2 files changed, 49 insertions, 29 deletions
diff --git a/scumm/dialogs.cpp b/scumm/dialogs.cpp
index aa53d599e3..e1d1e422d6 100644
--- a/scumm/dialogs.cpp
+++ b/scumm/dialogs.cpp
@@ -551,41 +551,63 @@ ConfigDialog::ConfigDialog(ScummEngine *scumm)
const int screenH = g_system->getOverlayHeight();
_w = screenW - 2 * 40;
- _h = screenH - 2 * 30 - 16;
-#ifdef _WIN32_WCE
- _h += 4;
-#endif
-
+ GUI::WidgetSize ws;
+ int buttonWidth;
+ int buttonHeight;
- //
- // Add the buttons
- //
-#ifdef _WIN32_WCE
- addButton(_w - kButtonWidth - 8, _h - 24 - 4, "OK", GUI::OptionsDialog::kOKCmd, 'O');
- addButton(_w - 2 * kButtonWidth - 12, _h - 24 - 4, "Cancel", kCloseCmd, 'C');
- addButton(_w - 3 * kButtonWidth - 16, _h - 24 - 4, "Keys", kKeysCmd, 'K');
-#else
- addButton(_w - kButtonWidth-8, _h - 24, "OK", GUI::OptionsDialog::kOKCmd, 'O');
- addButton(_w - 2 * kButtonWidth-12, _h - 24, "Cancel", kCloseCmd, 'C');
-#endif
+ if (screenW >= 400 && screenH >= 300) {
+ ws = GUI::kBigWidgetSize;
+ buttonWidth = kBigButtonWidth;
+ buttonHeight = kBigButtonHeight;
+ } else {
+ ws = GUI::kNormalWidgetSize;
+ buttonWidth = kButtonWidth;
+ buttonHeight = kButtonHeight;
+ }
+
+ int yoffset = 8;
//
// Sound controllers
//
- int yoffset = 8;
- yoffset = addVolumeControls(this, yoffset);
+
+ yoffset = addVolumeControls(this, yoffset) + 4;
//
// Some misc options
//
- subtitlesCheckbox = new GUI::CheckboxWidget(this, 15, 78, 200, 16, "Show subtitles", 0, 'S');
- speechCheckbox = new GUI::CheckboxWidget(this, 130, 78, 200, 16, "Enable speech", 0, 'E');
+
+ _subtitlesCheckbox = addCheckbox(15, yoffset, "Show subtitles", 0, 'S', ws);
+ yoffset += _subtitlesCheckbox->getHeight();
+
+ _speechCheckbox = addCheckbox(15, yoffset, "Enable speech", 0, 'E', ws);
+ yoffset += _speechCheckbox->getHeight() + 4;
//
- // Create the sub dialog(s)
+ // Add the buttons
//
+
+ _w = 8 + 3 * (buttonWidth + 4); // FIXME/TODO
+
+ addButton(_w - (buttonWidth + 4) - 4, yoffset, "OK", GUI::OptionsDialog::kOKCmd, 'O', ws);
+ addButton(_w - 2 * (buttonWidth + 4) - 4, yoffset, "Cancel", kCloseCmd, 'C', ws);
+#ifdef _WIN32_WCE
+ addButton(_w - 3 * (buttonWidth + 4) - 4, yoffset, "Keys", kKeysCmd, 'K', ws);
+#endif
+
+ yoffset += buttonHeight;
+
+ _h = yoffset + 8;
+
+ _x = (screenW - _w) / 2;
+ _y = (screenH - _h) / 2;
+
#ifdef _WIN32_WCE
+ //
+ // Create the sub dialog(s)
+ //
+
_keysDialog = new CEKeysDialog();
#endif
}
@@ -600,16 +622,15 @@ void ConfigDialog::open() {
GUI_OptionsDialog::open();
// update checkboxes, too
- subtitlesCheckbox->setState(ConfMan.getBool("subtitles"));
- speechCheckbox->setState(!ConfMan.getBool("speech_mute"));
+ _subtitlesCheckbox->setState(ConfMan.getBool("subtitles"));
+ _speechCheckbox->setState(!ConfMan.getBool("speech_mute"));
}
void ConfigDialog::close() {
-
if (getResult()) {
// Subtitles
- ConfMan.set("subtitles", subtitlesCheckbox->getState(), _domain);
- ConfMan.set("speech_mute", !speechCheckbox->getState(), _domain);
+ ConfMan.set("subtitles", _subtitlesCheckbox->getState(), _domain);
+ ConfMan.set("speech_mute", !_speechCheckbox->getState(), _domain);
// Sync with current setting
if (ConfMan.getBool("speech_mute"))
_vm->_voiceMode = 2;
@@ -625,7 +646,6 @@ void ConfigDialog::close() {
_vm->setupVolumes();
}
-
void ConfigDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
switch (cmd) {
case kKeysCmd:
diff --git a/scumm/dialogs.h b/scumm/dialogs.h
index 3ca76c3712..b973f81883 100644
--- a/scumm/dialogs.h
+++ b/scumm/dialogs.h
@@ -129,8 +129,8 @@ public:
virtual void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data);
protected:
- GUI::CheckboxWidget *subtitlesCheckbox;
- GUI::CheckboxWidget *speechCheckbox;
+ GUI::CheckboxWidget *_subtitlesCheckbox;
+ GUI::CheckboxWidget *_speechCheckbox;
};
/**