39
43
#include "bspf.hxx"
55
kMainMenuWidth = (kBigButtonWidth + 2 * 8),
56
kMainMenuHeight = 8 * kRowHeight + 10,
59
#define addBigButton(label, cmd, hotkey) \
60
new ButtonWidget(this, font, xoffset, yoffset, kBigButtonWidth, 18, label, cmd, hotkey); yoffset += kRowHeight
45
#define addBigButton(label, cmd) \
46
new ButtonWidget(this, font, xoffset, yoffset, buttonWidth, buttonHeight, label, cmd); yoffset += rowHeight
62
48
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
63
OptionsDialog::OptionsDialog(OSystem* osystem, DialogContainer* parent)
64
: Dialog(osystem, parent, 0, 0, kMainMenuWidth, kMainMenuHeight),
49
OptionsDialog::OptionsDialog(OSystem* osystem, DialogContainer* parent,
50
GuiObject* boss, bool global)
51
: Dialog(osystem, parent, 0, 0, 1, 1),
65
52
myVideoDialog(NULL),
66
53
myAudioDialog(NULL),
67
54
myInputDialog(NULL),
56
myFileSnapDialog(NULL),
68
57
myGameInfoDialog(NULL),
69
58
myCheatCodeDialog(NULL),
70
59
myHelpDialog(NULL),
73
// Set actual dialog dimensions
74
_x = (osystem->frameBuffer().baseWidth() - kMainMenuWidth) / 2;
75
_y = (osystem->frameBuffer().baseHeight() - kMainMenuHeight) / 2;
78
const int xoffset = (_w - kBigButtonWidth) / 2;
79
const GUI::Font& font = instance()->font(); // FIXME - change reference to optionsFont()
63
const GUI::Font& font = instance()->font();
64
const int buttonWidth = font.getStringWidth("Game Properties") + 20,
65
buttonHeight = font.getLineHeight() + 6,
66
rowHeight = font.getLineHeight() + 10;
68
_w = 2 * buttonWidth + 30;
69
_h = 6 * rowHeight + 15;
71
int xoffset = 10, yoffset = 10;
80
73
ButtonWidget* b = NULL;
82
b = addBigButton("Video Settings", kVidCmd, 0);
84
addBigButton("Audio Settings", kAudCmd, 0);
86
b = addBigButton("Audio Settings", kAudCmd, 0);
87
b->clearFlags(WIDGET_ENABLED);
89
addBigButton("Input Settings", kInptCmd, 0);
90
addBigButton("Game Properties", kInfoCmd, 0);
91
#ifdef CHEATCODE_SUPPORT
92
addBigButton("Cheat Code", kCheatCmd, 0);
94
b = addBigButton("Cheat Code", kCheatCmd, 0);
95
b->clearFlags(WIDGET_ENABLED);
97
addBigButton("Help", kHelpCmd, 0);
98
addBigButton("About", kAboutCmd, 0);
99
addBigButton("Exit Menu", kExitCmd, 0);
75
myVideoSettingsButton = addBigButton("Video Settings", kVidCmd);
76
wid.push_back(myVideoSettingsButton);
78
myAudioSettingsButton = addBigButton("Audio Settings", kAudCmd);
80
myAudioSettingsButton->clearFlags(WIDGET_ENABLED);
82
wid.push_back(myAudioSettingsButton);
84
b = addBigButton("Input Settings", kInptCmd);
87
myUIButton = addBigButton("UI Settings", kUsrIfaceCmd);
88
wid.push_back(myUIButton);
90
myFileSnapButton = addBigButton("Config Files", kFileSnapCmd);
91
wid.push_back(myFileSnapButton);
93
myRomAuditButton = addBigButton("Audit ROMs", kAuditCmd);
94
wid.push_back(myRomAuditButton);
96
// Move to second column
97
xoffset += buttonWidth + 10; yoffset = 10;
99
myGameInfoButton = addBigButton("Game Properties", kInfoCmd);
100
wid.push_back(myGameInfoButton);
102
myCheatCodeButton = addBigButton("Cheat Code", kCheatCmd);
103
#ifndef CHEATCODE_SUPPORT
104
myCheatCodeButton->clearFlags(WIDGET_ENABLED);
106
wid.push_back(myCheatCodeButton);
108
myHelpButton = addBigButton("Help", kHelpCmd);
109
wid.push_back(myHelpButton);
111
myAboutButton = addBigButton("About", kAboutCmd);
112
wid.push_back(myAboutButton);
114
b = addBigButton("Exit Menu", kExitCmd);
101
118
// Set some sane values for the dialog boxes
102
int fbWidth = osystem->frameBuffer().baseWidth();
103
int fbHeight = osystem->frameBuffer().baseHeight();
119
int x = 0, y = 0, w, h;
106
121
// Now create all the dialogs attached to each menu button
108
checkBounds(fbWidth, fbHeight, &x, &y, &w, &h);
109
123
myVideoDialog = new VideoDialog(myOSystem, parent, font, x, y, w, h);
112
checkBounds(fbWidth, fbHeight, &x, &y, &w, &h);
113
126
myAudioDialog = new AudioDialog(myOSystem, parent, font, x, y, w, h);
129
// we scale the input dialog down a bit in low res devices.
130
// looks only a little ugly, but the functionality is very welcome
131
if(myOSystem->desktopWidth() < 320) { w = 220; h = 176; }
132
else { w = 230; h = 185; }
115
134
w = 230; h = 185;
116
checkBounds(fbWidth, fbHeight, &x, &y, &w, &h);
117
136
myInputDialog = new InputDialog(myOSystem, parent, font, x, y, w, h);
120
checkBounds(fbWidth, fbHeight, &x, &y, &w, &h);
139
myUIDialog = new UIDialog(myOSystem, parent, font, x, y, w, h);
142
myFileSnapDialog = new FileSnapDialog(myOSystem, parent, font,
146
myRomAuditDialog = new RomAuditDialog(myOSystem, parent, font, x, y, w, h);
121
149
myGameInfoDialog = new GameInfoDialog(myOSystem, parent, font, this, x, y, w, h);
123
151
#ifdef CHEATCODE_SUPPORT
124
152
w = 230; h = 150;
125
checkBounds(fbWidth, fbHeight, &x, &y, &w, &h);
126
153
myCheatCodeDialog = new CheatCodeDialog(myOSystem, parent, font, x, y, w, h);
129
156
w = 255; h = 150;
130
checkBounds(fbWidth, fbHeight, &x, &y, &w, &h);
131
157
myHelpDialog = new HelpDialog(myOSystem, parent, font, x, y, w, h);
133
159
w = 255; h = 150;
134
checkBounds(fbWidth, fbHeight, &x, &y, &w, &h);
135
160
myAboutDialog = new AboutDialog(myOSystem, parent, font, x, y, w, h);
164
// Certain buttons are disabled depending on mode
167
myCheatCodeButton->clearFlags(WIDGET_ENABLED);
171
myRomAuditButton->clearFlags(WIDGET_ENABLED);
174
myAudioSettingsButton->clearFlags(WIDGET_ENABLED); // not honored in wince port
176
if(myOSystem->desktopWidth() < 320)
178
// These cannot be displayed in low res devices
179
myVideoSettingsButton->clearFlags(WIDGET_ENABLED);
180
myFileSnapButton->clearFlags(WIDGET_ENABLED);
181
myGameInfoButton->clearFlags(WIDGET_ENABLED);
182
myHelpButton->clearFlags(WIDGET_ENABLED);
183
myAboutButton->clearFlags(WIDGET_ENABLED);
138
187
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -