Bugfix: Inverse layout reflowing.

Bugfix: Glitches with several layouts when using Aspect Ratio Correction.

svn-id: r33764
This commit is contained in:
Vicent Marti 2008-08-10 18:26:14 +00:00
parent 8a31616f46
commit 559c19e9f4
6 changed files with 55 additions and 25 deletions

View file

@ -318,7 +318,7 @@ void SaveLoadChooser::handleCommand(CommandSender *sender, uint32 cmd, uint32 da
}
void SaveLoadChooser::reflowLayout() {
if (g_gui.evaluator()->getVar("scummsaveload_extinfo.visible") == 1) {
if (g_gui.xmlEval()->getVar("ScummSaveLoad.ExtInfo.Visible", 1) == 1) {
int16 x, y;
uint16 w, h;
@ -644,16 +644,16 @@ enum {
};
HelpDialog::HelpDialog(const GameSettings &game)
: ScummDialog("scummhelp"), _game(game) {
_title = new StaticTextWidget(this, "scummhelp_title", "");
: 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 = 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
@ -670,19 +670,18 @@ void HelpDialog::reflowLayout() {
_drawingHints &= ~GUI::THEME_HINT_SPECIAL_COLOR;
int lineHeight = g_gui.getFontHeight();
int16 x, y;
uint16 w, h;
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");
int keyH = g_gui.evaluator()->getVar("scummhelp_key.h");
int dscX = g_gui.evaluator()->getVar("scummhelp_dsc.x");
int dscYoff = g_gui.evaluator()->getVar("scummhelp_dsc.yoffset");
int dscW = g_gui.evaluator()->getVar("scummhelp_dsc.w");
int dscH = g_gui.evaluator()->getVar("scummhelp_dsc.h");
g_gui.xmlEval()->getWidgetData("ScummHelp.HelpText", x, y, w, h);
int keyW = w * 20 / 100;
int dscX = x + keyW;
int dscW = w * 80 / 100;
for (int i = 0; i < HELP_NUM_LINES; i++) {
_key[i]->resize(keyX, keyYoff + lineHeight * (i + 2), keyW, keyH);
_dsc[i]->resize(dscX, dscYoff + lineHeight * (i + 2), dscW, dscH);
_key[i]->resize(x, y + lineHeight * i, keyW, lineHeight + 2);
_dsc[i]->resize(dscX, y + lineHeight * i, dscW, lineHeight + 2);
}
displayKeyBindings();

View file

@ -124,8 +124,11 @@ void ThemeLayoutVertical::reflowLayout() {
if (autoWidget != -1 && autoWidget != (int)i) {
_children[autoWidget]->setHeight(_children[autoWidget]->getHeight() - (_children[i]->getHeight() + _spacing));
for (int j = autoWidget - 1; j >= 0; --j)
if (_reverse) for (int j = autoWidget - 1; j >= 0; --j)
_children[j]->setY(-(_children[i]->getHeight() + _spacing));
else
_children[i]->setY(-2 * (_children[i]->getHeight() + _spacing));
} else {
_h += _children[i]->getHeight() + _spacing;
}
@ -172,8 +175,11 @@ void ThemeLayoutHorizontal::reflowLayout() {
if (autoWidget != -1 && autoWidget != (int)i) {
_children[autoWidget]->setWidth(_children[autoWidget]->getWidth() - (_children[i]->getWidth() + _spacing));
for (int j = autoWidget - 1; j >= 0; --j)
if (_reverse) for (int j = autoWidget - 1; j >= 0; --j)
_children[j]->setX(-(_children[i]->getWidth() + _spacing));
else
_children[i]->setX(-2 * (_children[i]->getWidth() + _spacing));
} else {
_w += _children[i]->getWidth() + _spacing;
}

View file

@ -377,7 +377,7 @@ public:
}
void debugDraw(Graphics::Surface *screen, const Graphics::Font *font) {
_layouts["Dialog.Browser"]->debugDraw(screen, font);
_layouts["Dialog.Launcher"]->debugDraw(screen, font);
// _layouts["Dialog.GameOptions_Graphics"]->debugDraw(screen, font);
}

View file

@ -866,11 +866,11 @@ void ThemeRenderer::updateScreen() {
_textQueue.clear();
}
renderDirtyScreen();
// renderDirtyScreen();
// _vectorRenderer->fillSurface();
// themeEval()->debugDraw(_screen, _font);
// _vectorRenderer->copyWholeFrame(_system);
_vectorRenderer->fillSurface();
themeEval()->debugDraw(_screen, _font);
_vectorRenderer->copyWholeFrame(_system);
}
void ThemeRenderer::renderDirtyScreen() {

View file

@ -484,6 +484,8 @@
<def var = 'ShowLauncherLogo' value = '1'/>
<def resolution = '320xY' var = 'ShowLauncherLogo' value = '0'/>
<def var = 'ScummSaveLoad.ExtInfo.Visible' value = '1'/>
<widget name = 'OptionsLabel'
size = '110, Globals.Line.Height'
/>
@ -582,7 +584,7 @@
<widget name = 'Version'
height = 'Globals.Line.Height'
/>
<widget name = 'GameList' width = '304' height = '120'/>
<widget name = 'GameList'/>
<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '6'>
<widget name = 'AddGameButton'
width = '95'
@ -1050,4 +1052,27 @@
</layout>
</layout>
</dialog>
<dialog name = 'ScummHelp' overlays = 'screen_center'>
<layout type = 'vertical' padding = '8, 8, 8, 8' direction = 'bottom2top'>
<layout type = 'horizontal' padding = '0, 0, 16, 0'>
<widget name = 'Prev'
type = 'Button'
/>
<widget name = 'Next'
type = 'Button'
/>
<space size = '32'/>
<widget name = 'Close'
type = 'Button'
/>
</layout>
<widget name = 'HelpText'
height = '220'
/>
<widget name = 'Title'
height = 'Globals.Line.Height'
/>
</layout>
</dialog>
</layout_info>

Binary file not shown.