aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gui/dialog.cpp6
-rw-r--r--gui/dialog.h1
-rw-r--r--gui/launcher.cpp24
-rw-r--r--gui/options.cpp40
-rw-r--r--gui/options.h3
-rw-r--r--gui/theme-config.cpp18
-rw-r--r--gui/theme.h2
7 files changed, 54 insertions, 40 deletions
diff --git a/gui/dialog.cpp b/gui/dialog.cpp
index 9272b63c7a..2e9099de1b 100644
--- a/gui/dialog.cpp
+++ b/gui/dialog.cpp
@@ -45,6 +45,12 @@ Dialog::Dialog(int x, int y, int w, int h)
_drawingHints = THEME_HINT_FIRST_DRAW | THEME_HINT_SAVE_BACKGROUND;
}
+Dialog::Dialog(String name)
+ : GuiObject(name),
+ _mouseWidget(0), _focusedWidget(0), _dragWidget(0), _visible(false), _drawingHints(0) {
+ _drawingHints = THEME_HINT_FIRST_DRAW | THEME_HINT_SAVE_BACKGROUND;
+}
+
Dialog::~Dialog() {
delete _firstWidget;
_firstWidget = 0;
diff --git a/gui/dialog.h b/gui/dialog.h
index 99a8d855af..4a1e47add8 100644
--- a/gui/dialog.h
+++ b/gui/dialog.h
@@ -52,6 +52,7 @@ private:
public:
Dialog(int x, int y, int w, int h);
+ Dialog(Common::String name);
virtual ~Dialog();
virtual int runModal();
diff --git a/gui/launcher.cpp b/gui/launcher.cpp
index 187b171e18..dd81e6afc3 100644
--- a/gui/launcher.cpp
+++ b/gui/launcher.cpp
@@ -477,19 +477,6 @@ void EditGameDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat
#pragma mark -
-#define BEGIN_BUTTONS(numButtons, hSpace, top) \
- { \
- const int space = hSpace; \
- const int width = (_w - 2 * hBorder - space * (numButtons - 1)) / numButtons; \
- int x = hBorder; \
- const int y = top;
-
-#define ADD(name, cmd, hotkey) \
- new ButtonWidget(this, x, y, width, buttonHeight, name, cmd, hotkey, ws); x += space + width
-
-#define END_BUTTONS \
- }
-
LauncherDialog::LauncherDialog(GameDetector &detector)
: Dialog(0, 0, 320, 200), _detector(detector) {
_drawingHints |= THEME_HINT_MAIN_DIALOG;
@@ -497,22 +484,15 @@ LauncherDialog::LauncherDialog(GameDetector &detector)
const int screenW = g_system->getOverlayWidth();
const int screenH = g_system->getOverlayHeight();
- const int hBorder = 10;
-
_w = screenW;
_h = screenH;
GUI::WidgetSize ws;
- int buttonHeight;
- int top;
- if (screenW >= 400 && screenH >= 300) {
+ if (screenW >= 400 && screenH >= 300)
ws = GUI::kBigWidgetSize;
- buttonHeight = kBigButtonHeight;
- } else {
+ else
ws = GUI::kNormalWidgetSize;
- buttonHeight = kButtonHeight;
- }
// Show ScummVM version
new StaticTextWidget(this, "launcher_version", gScummVMFullVersion, kTextAlignCenter, ws);
diff --git a/gui/options.cpp b/gui/options.cpp
index 8787477857..0eb596bb0e 100644
--- a/gui/options.cpp
+++ b/gui/options.cpp
@@ -73,18 +73,34 @@ enum {
OptionsDialog::OptionsDialog(const String &domain, int x, int y, int w, int h)
- : Dialog(x, y, w, h),
- _domain(domain),
- _enableGraphicSettings(false),
- _gfxPopUp(0), _renderModePopUp(0), _fullscreenCheckbox(0), _aspectCheckbox(0),
- _enableAudioSettings(false),
- _subCheckbox(0),
- _enableMIDISettings(false),
- _multiMidiCheckbox(0), _mt32Checkbox(0), _enableGSCheckbox(0),
- _enableVolumeSettings(false),
- _musicVolumeSlider(0), _musicVolumeLabel(0),
- _sfxVolumeSlider(0), _sfxVolumeLabel(0),
- _speechVolumeSlider(0), _speechVolumeLabel(0) {
+ : Dialog(x, y, w, h), _domain(domain) {
+ init();
+}
+
+OptionsDialog::OptionsDialog(const String &domain, String name)
+ : Dialog(name), _domain(domain) {
+ init();
+}
+
+void OptionsDialog::init() {
+ _enableGraphicSettings = false;
+ _gfxPopUp = 0;
+ _renderModePopUp = 0;
+ _fullscreenCheckbox = 0;
+ _aspectCheckbox = 0;
+ _enableAudioSettings = false;
+ _subCheckbox = 0;
+ _enableMIDISettings = false;
+ _multiMidiCheckbox = 0;
+ _mt32Checkbox = 0;
+ _enableGSCheckbox = 0;
+ _enableVolumeSettings = false;
+ _musicVolumeSlider = 0;
+ _musicVolumeLabel = 0;
+ _sfxVolumeSlider = 0;
+ _sfxVolumeLabel = 0;
+ _speechVolumeSlider = 0;
+ _speechVolumeLabel = 0;
}
void OptionsDialog::open() {
diff --git a/gui/options.h b/gui/options.h
index 40e6905f6a..7ea4f09170 100644
--- a/gui/options.h
+++ b/gui/options.h
@@ -41,6 +41,9 @@ class OptionsDialog : public Dialog {
typedef Common::String String;
public:
OptionsDialog(const String &domain, int x, int y, int w, int h);
+ OptionsDialog(const String &domain, String name);
+
+ void init();
void open();
void close();
diff --git a/gui/theme-config.cpp b/gui/theme-config.cpp
index 20ee93fdd5..68ecb08478 100644
--- a/gui/theme-config.cpp
+++ b/gui/theme-config.cpp
@@ -120,7 +120,7 @@ void Theme::processSingleLine(const String &section, const String name, const St
}
-void Theme::processResSection(Common::ConfigFile &config, String name, bool skipDefs) {
+void Theme::processResSection(Common::ConfigFile &config, String name, bool skipDefs, const String prefix) {
debug(3, "Reading section: [%s]", name.c_str());
const Common::ConfigFile::SectionKeyList &keys = config.getKeys(name);
@@ -128,16 +128,16 @@ void Theme::processResSection(Common::ConfigFile &config, String name, bool skip
Common::ConfigFile::SectionKeyList::const_iterator iterk;
for (iterk = keys.begin(); iterk != keys.end(); ++iterk) {
if (iterk->key == "set_parent") {
- setSpecialAlias("parent", iterk->value);
+ setSpecialAlias("parent", prefix + iterk->value);
continue;
}
if (iterk->key.hasPrefix("set_")) {
- _evaluator->setAlias(name, iterk->key, iterk->value);
+ _evaluator->setAlias(name, iterk->key, prefix + iterk->value);
continue;
}
if (iterk->key.hasPrefix("def_")) {
if (!skipDefs)
- _evaluator->setVariable(name, iterk->key, iterk->value);
+ _evaluator->setVariable(name, prefix + iterk->key, iterk->value);
continue;
}
if (iterk->key == "use") {
@@ -148,7 +148,15 @@ void Theme::processResSection(Common::ConfigFile &config, String name, bool skip
processResSection(config, iterk->value, true);
continue;
}
- processSingleLine(name, iterk->key, iterk->value);
+ if (iterk->key == "useWithPrefix") {
+ if (iterk->value == name)
+ error("Theme section [%s]: cannot use itself", name.c_str());
+ if (!config.hasSection(name))
+ error("Undefined use of section [%s]", name.c_str());
+ processResSection(config, iterk->value, true, iterk->value + "_");
+ continue;
+ }
+ processSingleLine(name, prefix + iterk->key, iterk->value);
}
}
diff --git a/gui/theme.h b/gui/theme.h
index 45216cc83b..26190df436 100644
--- a/gui/theme.h
+++ b/gui/theme.h
@@ -169,7 +169,7 @@ public:
return kTextAlignCenter;
}
- void processResSection(Common::ConfigFile &config, String name, bool skipDefs = false);
+ void processResSection(Common::ConfigFile &config, String name, bool skipDefs = false, const String prefix = "");
void processSingleLine(const String &section, const String name, const String str);
void setSpecialAlias(const String alias, const String &name);