Options menu fully parsed. Needs tweaking.

svn-id: r33657
This commit is contained in:
Vicent Marti 2008-08-06 10:50:28 +00:00
parent 4256c35791
commit ef7a14dbe2
6 changed files with 215 additions and 33 deletions

View File

@ -79,12 +79,9 @@ void ThemeLayoutVertical::reflowLayout() {
if (i != _children.size() - 1)
assert(_children[i]->getHeight() != -1);
if (i == 0)
assert(_children[i]->getWidth() != -1);
if (_children[i]->getWidth() == -1)
_children[i]->setWidth(_w - _paddingLeft - _paddingRight);
_children[i]->setWidth((_w == -1 ? getParentW() : _w) - _paddingLeft - _paddingRight);
if (_children[i]->getHeight() == -1)
_children[i]->setHeight(getParentH() - _h - _spacing);
@ -187,13 +184,16 @@ void ThemeEval::addDialog(const Common::String &name, const Common::String &over
_curLayout.push(layout);
}
void ThemeEval::addLayout(ThemeLayout::LayoutType type, bool reverse, bool center) {
void ThemeEval::addLayout(ThemeLayout::LayoutType type, int spacing, bool reverse, bool center) {
ThemeLayout *layout = 0;
if (spacing == -1)
spacing = getVar("Globals.Layout.Spacing", 4);
if (type == ThemeLayout::kLayoutVertical)
layout = new ThemeLayoutVertical(_curLayout.top(), getVar("Globals.Layout.Spacing", 4), reverse, center);
layout = new ThemeLayoutVertical(_curLayout.top(), spacing, reverse, center);
else if (type == ThemeLayout::kLayoutHorizontal)
layout = new ThemeLayoutHorizontal(_curLayout.top(), getVar("Globals.Layout.Spacing", 4), reverse, center);
layout = new ThemeLayoutHorizontal(_curLayout.top(), spacing, reverse, center);
layout->setPadding(
getVar("Globals.Padding.Left", 0),
@ -206,7 +206,7 @@ void ThemeEval::addLayout(ThemeLayout::LayoutType type, bool reverse, bool cente
_curLayout.push(layout);
}
void ThemeEval::addSpacing(int size) {
void ThemeEval::addSpace(int size) {
ThemeLayout *space = new ThemeLayoutSpacing(_curLayout.top(), size);
_curLayout.top()->addChild(space);
}

View File

@ -254,9 +254,9 @@ public:
bool hasVar(const Common::String &name) { return _vars.contains(name); }
void addDialog(const Common::String &name, const Common::String &overlays);
void addLayout(ThemeLayout::LayoutType type, bool reverse, bool center = false);
void addLayout(ThemeLayout::LayoutType type, int spacing, bool reverse, bool center = false);
void addWidget(const Common::String &name, int w, int h);
void addSpacing(int size);
void addSpace(int size);
void addPadding(int16 l, int16 r, int16 t, int16 b) {
_curLayout.top()->setPadding(l, r, t, b);
@ -267,11 +267,11 @@ public:
bool getWidgetData(const Common::String &widget, int16 &x, int16 &y, uint16 &w, uint16 &h) {
Common::StringTokenizer tokenizer(widget, ".");
if (widget.hasPrefix("Dialog."))
tokenizer.nextToken();
Common::String dialogName = "Dialog." + tokenizer.nextToken();
if (dialogName == "Dialog.Dialog")
dialogName = "Dialog." + tokenizer.nextToken();
Common::String widgetName = tokenizer.nextToken();
if (!_layouts.contains(dialogName))

View File

@ -499,14 +499,20 @@ bool ThemeParser::parserCallback_dialog(ParserNode *node) {
}
bool ThemeParser::parserCallback_layout(ParserNode *node) {
int spacing = -1;
if (node->values.contains("spacing")) {
if (!parseIntegerKey(node->values["spacing"].c_str(), 1, &spacing))
return false;
}
if (node->values["type"] == "vertical")
_theme->themeEval()->addLayout(GUI::ThemeLayout::kLayoutVertical,
_theme->themeEval()->addLayout(GUI::ThemeLayout::kLayoutVertical, spacing,
node->values["direction"] == "bottom2top",
node->values["center"] == "true");
else if (node->values["type"] == "horizontal")
_theme->themeEval()->addLayout(GUI::ThemeLayout::kLayoutHorizontal,
_theme->themeEval()->addLayout(GUI::ThemeLayout::kLayoutHorizontal, spacing,
node->values["direction"] == "right2left",
node->values["center"] == "true");
@ -518,6 +524,8 @@ bool ThemeParser::parserCallback_layout(ParserNode *node) {
_theme->themeEval()->addPadding(paddingL, paddingR, paddingT, paddingB);
}
return true;
}
@ -529,7 +537,7 @@ bool ThemeParser::parserCallback_space(ParserNode *node) {
if (!parseIntegerKey(node->values["size"].c_str(), 1, &size))
return parserError("Invalid value for Spacing size.");
_theme->themeEval()->addSpacing(size);
_theme->themeEval()->addSpace(size);
return true;
}

View File

@ -675,7 +675,7 @@ GlobalOptionsDialog::GlobalOptionsDialog()
// 2) The audio tab
//
tab->addTab("Audio");
addAudioControls(tab, "GlobalOptions.");
addAudioControls(tab, "GlobalOptions_Audio.");
addSubtitleControls(tab, "GlobalOptions_Audio.");
tab->addTab("Volume");

File diff suppressed because one or more lines are too long

View File

@ -298,6 +298,10 @@
horizontal_align = 'right'
/>
</drawdata>
/* Tanoku-TODO: text editing width + CARET!
/* <drawdata id = 'widget_textedit' cache = false>
<drawstep func = 'roundedsq' */
<drawdata id = 'default_bg' cache = false>
<drawstep func = 'roundedsq'
@ -429,15 +433,17 @@
<def var = 'Padding.Right' value = '16' />
<def var = 'Padding.Top' value = '16' />
<widget name = 'Inset'
pos = '23, 94'
size = '666, 666'
<widget name = 'OptionsLabel'
size = '110, 16'
/>
<widget name = 'Button'
size = '120, 25'
/>
<widget name = 'Slider'
size = '666, 666'
size = '256, 32'
/>
<widget name = 'PopUp'
size = '-1, 19'
/>
<widget name = 'ListWidget'
padding = '7, 5, 5, 5'
@ -532,22 +538,190 @@
</dialog>
<dialog name = 'GlobalOptions_Graphics' overlays = 'Dialog.GlobalOptions.TabWidget'>
<layout type = 'vertical' padding = '16, 16, 16, 16'>
<layout type = 'vertical' padding = '16, 16, 16, 16' spacing = '8'>
<widget name = 'grModePopup'
width = '512'
height = '64'
height = 'Globals.PopUp.Height'
/>
<widget name = 'grRenderPopup'
width = '512'
height = '64'
height = 'Globals.PopUp.Height'
/>
<widget name = 'grAspectCheckbox'
width = '256'
height = '32'
height = 'Globals.Line.Height'
/>
<widget name = 'grFullscreenCheckbox'
width = '256'
height = '32'
height = 'Globals.Line.Height'
/>
</layout>
</dialog>
<dialog name = 'GlobalOptions_Audio' overlays = 'Dialog.GlobalOptions.TabWidget'>
<layout type = 'vertical' padding = '16, 16, 16, 16' spacing = '8'>
<widget name = 'auMidiPopup'
height = 'Globals.Line.Height'
/>
<widget name = 'auSampleRatePopup'
height = 'Globals.Line.Height'
/>
<layout type = 'horizontal' padding = '0, 0, 0, 0'>
<widget name = 'subToggleDesc'
width = 'Globals.OptionsLabel.Width'
height = 'Globals.OptionsLabel.Height'
/>
<widget name = 'subToggleButton'
width = '150'
height = 'Globals.Slider.Height'
/>
</layout>
<layout type = 'horizontal' padding = '0, 0, 0, 0'>
<widget name = 'subSubtitleSpeedDesc'
width = 'Globals.OptionsLabel.Width'
height = 'Globals.OptionsLabel.Height'
/>
<widget name = 'subSubtitleSpeedSlider'
width = 'Globals.Slider.Width'
height = 'Globals.Slider.Height'
/>
<widget name = 'subSubtitleSpeedLabel'
width = '32'
height = 'Globals.Line.Height'
/>
</layout>
</layout>
</dialog>
<dialog name = 'GlobalOptions_Volume' overlays = 'Dialog.GlobalOptions.TabWidget'>
<layout type = 'vertical' padding = '16, 16, 16, 16' spacing = '8'>
<layout type = 'horizontal' padding = '0, 0, 0, 0'>
<widget name = 'vcMusicText'
width = 'Globals.OptionsLabel.Width'
height = 'Globals.OptionsLabel.Height'
/>
<widget name = 'vcMusicSlider'
width = 'Globals.Slider.Width'
height = 'Globals.Slider.Height'
/>
<widget name = 'vcMusicLabel'
width = '32'
height = 'Globals.Line.Height'
/>
</layout>
<layout type = 'horizontal' padding = '0, 0, 0, 0'>
<widget name = 'vcSfxText'
width = 'Globals.OptionsLabel.Width'
height = 'Globals.OptionsLabel.Height'
/>
<widget name = 'vcSfxSlider'
width = 'Globals.Slider.Width'
height = 'Globals.Slider.Height'
/>
<widget name = 'vcSfxLabel'
width = '32'
height = 'Globals.Line.Height'
/>
</layout>
<layout type = 'horizontal' padding = '0, 0, 0, 0'>
<widget name = 'vcSpeechText'
width = 'Globals.OptionsLabel.Width'
height = 'Globals.OptionsLabel.Height'
/>
<widget name = 'vcSpeechSlider'
width = 'Globals.Slider.Width'
height = 'Globals.Slider.Height'
/>
<widget name = 'vcSpeechLabel'
width = '32'
height = 'Globals.Line.Height'
/>
</layout>
</layout>
</dialog>
<dialog name = 'GlobalOptions_MIDI' overlays = 'Dialog.GlobalOptions.TabWidget'>
<layout type = 'vertical' padding = '16, 16, 16, 16' spacing = '8'>
<layout type = 'horizontal' padding = '0, 0, 0, 0'>
<widget name = 'mcFontButton'
width = 'Globals.Button.Width'
height = 'Globals.Button.Height'
/>
<widget name = 'mcFontClearButton'
height = 'Globals.Line.Height'
width = 'Globals.Line.Height'
/>
<widget name = 'mcFontPath'
height = 'Globals.Line.Height'
/>
</layout>
<widget name = 'mcMixedCheckbox'
height = 'Globals.Line.Height'
/>
<widget name = 'mcMt32Checkbox'
height = 'Globals.Line.Height'
/>
<widget name = 'mcGSCheckbox'
height = 'Globals.Line.Height'
/>
<layout type = 'horizontal' padding = '0, 0, 0, 0'>
<widget name = 'mcMidiGainText'
width = 'Globals.OptionsLabel.Width'
height = 'Globals.OptionsLabel.Height'
/>
<widget name = 'mcMidiGainSlider'
width = 'Globals.Slider.Width'
height = 'Globals.Slider.Height'
/>
<widget name = 'mcMidiGainLabel'
width = '32'
height = 'Globals.Line.Height'
/>
</layout>
</layout>
</dialog>
<dialog name = 'GlobalOptions_Paths' overlays = 'Dialog.GlobalOptions.TabWidget'>
<layout type = 'vertical' padding = '16, 16, 16, 16' spacing = '8'>
<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '16'>
<widget name = 'SaveButton'
width = 'Globals.Button.Width'
height = 'Globals.Button.Height'
/>
<widget name = 'SavePath'
height = 'Globals.Line.Height'
/>
</layout>
<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '16'>
<widget name = 'ThemeButton'
width = 'Globals.Button.Width'
height = 'Globals.Button.Height'
/>
<widget name = 'ThemePath'
height = 'Globals.Line.Height'
/>
</layout>
<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '16'>
<widget name = 'ExtraButton'
width = 'Globals.Button.Width'
height = 'Globals.Button.Height'
/>
<widget name = 'ExtraPath'
height = 'Globals.Line.Height'
/>
</layout>
</layout>
</dialog>
<dialog name = 'GlobalOptions_Misc' overlays = 'Dialog.GlobalOptions.TabWidget'>
<layout type = 'vertical' padding = '16, 16, 16, 16' spacing = '8'>
<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '16'>
<widget name = 'ThemeButton'
width = 'Globals.Button.Width'
height = 'Globals.Button.Height'
/>
<widget name = 'CurTheme'
height = 'Globals.Line.Height'
/>
</layout>
<widget name = 'AutosavePeriod'
height = 'Globals.PopUp.Height'
/>
</layout>
</dialog>