Fixed bug 2820514 ("Help dialog causes crash")
svn-id: r42537
This commit is contained in:
parent
ff75d68f1c
commit
af289bdb03
9 changed files with 1116 additions and 1111 deletions
|
@ -641,6 +641,8 @@ HelpDialog::HelpDialog(const GameSettings &game)
|
||||||
new GUI::ButtonWidget(this, "ScummHelp.Close", "Close", kCloseCmd, 'C');
|
new GUI::ButtonWidget(this, "ScummHelp.Close", "Close", kCloseCmd, 'C');
|
||||||
_prevButton->clearFlags(WIDGET_ENABLED);
|
_prevButton->clearFlags(WIDGET_ENABLED);
|
||||||
|
|
||||||
|
_numLines = HELP_NUM_LINES;
|
||||||
|
|
||||||
// Dummy entries
|
// Dummy entries
|
||||||
for (int i = 0; i < HELP_NUM_LINES; i++) {
|
for (int i = 0; i < HELP_NUM_LINES; i++) {
|
||||||
_key[i] = new StaticTextWidget(this, 0, 0, 10, 10, "", Graphics::kTextAlignRight);
|
_key[i] = new StaticTextWidget(this, 0, 0, 10, 10, "", Graphics::kTextAlignRight);
|
||||||
|
@ -658,15 +660,20 @@ void HelpDialog::reflowLayout() {
|
||||||
|
|
||||||
g_gui.xmlEval()->getWidgetData("ScummHelp.HelpText", x, y, w, h);
|
g_gui.xmlEval()->getWidgetData("ScummHelp.HelpText", x, y, w, h);
|
||||||
|
|
||||||
|
/* Make sure than we don't have more lines than what we can fit
|
||||||
|
* on the space that the layout reserves for text */
|
||||||
|
_numLines = MIN(HELP_NUM_LINES, (int)(h / lineHeight));
|
||||||
|
|
||||||
|
|
||||||
int keyW = w * 20 / 100;
|
int keyW = w * 20 / 100;
|
||||||
int dscX = x + keyW + 32;
|
int dscX = x + keyW + 32;
|
||||||
int dscW = w * 80 / 100;
|
int dscW = w * 80 / 100;
|
||||||
|
|
||||||
int xoff = (_w >> 1) - (w >> 1);
|
int xoff = (_w >> 1) - (w >> 1);
|
||||||
|
|
||||||
for (int i = 0; i < HELP_NUM_LINES; i++) {
|
for (int i = 0; i < _numLines; i++) {
|
||||||
_key[i]->resize(xoff + x, y + lineHeight * i, keyW, lineHeight + 2);
|
_key[i]->resize(xoff + x, y + lineHeight * i, keyW, lineHeight);
|
||||||
_dsc[i]->resize(xoff + dscX, y + lineHeight * i, dscW, lineHeight + 2);
|
_dsc[i]->resize(xoff + dscX, y + lineHeight * i, dscW, lineHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
displayKeyBindings();
|
displayKeyBindings();
|
||||||
|
@ -675,6 +682,7 @@ void HelpDialog::reflowLayout() {
|
||||||
void HelpDialog::displayKeyBindings() {
|
void HelpDialog::displayKeyBindings() {
|
||||||
|
|
||||||
String titleStr, *keyStr, *dscStr;
|
String titleStr, *keyStr, *dscStr;
|
||||||
|
int i;
|
||||||
|
|
||||||
#ifndef __DS__
|
#ifndef __DS__
|
||||||
ScummHelp::updateStrings(_game.id, _game.version, _game.platform, _page, titleStr, keyStr, dscStr);
|
ScummHelp::updateStrings(_game.id, _game.version, _game.platform, _page, titleStr, keyStr, dscStr);
|
||||||
|
@ -684,7 +692,7 @@ void HelpDialog::displayKeyBindings() {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
_title->setLabel(titleStr);
|
_title->setLabel(titleStr);
|
||||||
for (int i = 0; i < HELP_NUM_LINES; i++) {
|
for (i = 0; i < _numLines; i++) {
|
||||||
_key[i]->setLabel(keyStr[i]);
|
_key[i]->setLabel(keyStr[i]);
|
||||||
_dsc[i]->setLabel(dscStr[i]);
|
_dsc[i]->setLabel(dscStr[i]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,6 +124,7 @@ protected:
|
||||||
|
|
||||||
int _page;
|
int _page;
|
||||||
int _numPages;
|
int _numPages;
|
||||||
|
int _numLines;
|
||||||
|
|
||||||
const GameSettings _game;
|
const GameSettings _game;
|
||||||
|
|
||||||
|
|
|
@ -596,8 +596,6 @@ drawSquare(int x, int y, int w, int h) {
|
||||||
template<typename PixelType>
|
template<typename PixelType>
|
||||||
void VectorRendererSpec<PixelType>::
|
void VectorRendererSpec<PixelType>::
|
||||||
drawRoundedSquare(int x, int y, int r, int w, int h) {
|
drawRoundedSquare(int x, int y, int r, int w, int h) {
|
||||||
x++; y++; w--; h--;
|
|
||||||
|
|
||||||
if (x + w > Base::_activeSurface->w || y + h > Base::_activeSurface->h ||
|
if (x + w > Base::_activeSurface->w || y + h > Base::_activeSurface->h ||
|
||||||
w <= 0 || h <= 0 || x < 0 || y < 0 || r <= 0)
|
w <= 0 || h <= 0 || x < 0 || y < 0 || r <= 0)
|
||||||
return;
|
return;
|
||||||
|
@ -606,8 +604,8 @@ drawRoundedSquare(int x, int y, int r, int w, int h) {
|
||||||
r = MIN(w /2, h / 2);
|
r = MIN(w /2, h / 2);
|
||||||
|
|
||||||
if (Base::_fillMode != kFillDisabled && Base::_shadowOffset
|
if (Base::_fillMode != kFillDisabled && Base::_shadowOffset
|
||||||
&& x + w + Base::_shadowOffset < Base::_activeSurface->w
|
&& x + w + Base::_shadowOffset + 1 < Base::_activeSurface->w
|
||||||
&& y + h + Base::_shadowOffset < Base::_activeSurface->h) {
|
&& y + h + Base::_shadowOffset + 1 < Base::_activeSurface->h) {
|
||||||
drawRoundedSquareShadow(x, y, r, w, h, Base::_shadowOffset);
|
drawRoundedSquareShadow(x, y, r, w, h, Base::_shadowOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -922,13 +920,11 @@ drawBevelSquareAlg(int x, int y, int w, int h, int bevel, PixelType top_color, P
|
||||||
|
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
#if 0
|
|
||||||
x = MAX(x - bevel, 0);
|
x = MAX(x - bevel, 0);
|
||||||
y = MAX(y - bevel, 0);
|
y = MAX(y - bevel, 0);
|
||||||
|
|
||||||
w = w + (bevel * 2);
|
w = MIN(w + (bevel * 2), (int)_activeSurface->w);
|
||||||
h = h + (bevel * 2);
|
h = MIN(h + (bevel * 2), (int)_activeSurface->h);
|
||||||
#endif
|
|
||||||
|
|
||||||
PixelType *ptr_left = (PixelType *)_activeSurface->getBasePtr(x, y);
|
PixelType *ptr_left = (PixelType *)_activeSurface->getBasePtr(x, y);
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
Binary file not shown.
|
@ -54,7 +54,7 @@
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<widget name = 'Button'
|
<widget name = 'Button'
|
||||||
size = '112, 28'
|
size = '108, 24'
|
||||||
/>
|
/>
|
||||||
<widget name = 'Slider'
|
<widget name = 'Slider'
|
||||||
size = '128, 18'
|
size = '128, 18'
|
||||||
|
@ -115,31 +115,31 @@
|
||||||
<widget name = 'GameList'/>
|
<widget name = 'GameList'/>
|
||||||
<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10'>
|
<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10'>
|
||||||
<widget name = 'LoadGameButton'
|
<widget name = 'LoadGameButton'
|
||||||
height = '24'
|
height = '20'
|
||||||
/>
|
/>
|
||||||
<widget name = 'AddGameButton'
|
<widget name = 'AddGameButton'
|
||||||
height = '24'
|
height = '20'
|
||||||
/>
|
/>
|
||||||
<widget name = 'EditGameButton'
|
<widget name = 'EditGameButton'
|
||||||
height = '24'
|
height = '20'
|
||||||
/>
|
/>
|
||||||
<widget name = 'RemoveGameButton'
|
<widget name = 'RemoveGameButton'
|
||||||
height = '24'
|
height = '20'
|
||||||
/>
|
/>
|
||||||
</layout>
|
</layout>
|
||||||
<space size = '4'/>
|
<space size = '4'/>
|
||||||
<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10'>
|
<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10'>
|
||||||
<widget name = 'QuitButton'
|
<widget name = 'QuitButton'
|
||||||
height = '24'
|
height = '20'
|
||||||
/>
|
/>
|
||||||
<widget name = 'AboutButton'
|
<widget name = 'AboutButton'
|
||||||
height = '24'
|
height = '20'
|
||||||
/>
|
/>
|
||||||
<widget name = 'OptionsButton'
|
<widget name = 'OptionsButton'
|
||||||
height = '24'
|
height = '20'
|
||||||
/>
|
/>
|
||||||
<widget name = 'StartButton'
|
<widget name = 'StartButton'
|
||||||
height = '24'
|
height = '20'
|
||||||
/>
|
/>
|
||||||
</layout>
|
</layout>
|
||||||
</layout>
|
</layout>
|
||||||
|
@ -745,7 +745,7 @@
|
||||||
height = 'Globals.Line.Height'
|
height = 'Globals.Line.Height'
|
||||||
/>
|
/>
|
||||||
<widget name = 'HelpText'
|
<widget name = 'HelpText'
|
||||||
height = '220'
|
height = '200'
|
||||||
/>
|
/>
|
||||||
<layout type = 'horizontal' padding = '0, 0, 16, 0'>
|
<layout type = 'horizontal' padding = '0, 0, 16, 0'>
|
||||||
<widget name = 'Prev'
|
<widget name = 'Prev'
|
||||||
|
|
|
@ -744,7 +744,7 @@
|
||||||
</dialog>
|
</dialog>
|
||||||
|
|
||||||
<dialog name = 'ScummHelp' overlays = 'screen'>
|
<dialog name = 'ScummHelp' overlays = 'screen'>
|
||||||
<layout type = 'vertical' padding = '8, 8, 0, 0'>
|
<layout type = 'vertical' padding = '8, 8, 8, 8'>
|
||||||
<widget name = 'Title'
|
<widget name = 'Title'
|
||||||
width = '180'
|
width = '180'
|
||||||
height = 'Globals.Line.Height'
|
height = 'Globals.Line.Height'
|
||||||
|
|
Binary file not shown.
|
@ -732,14 +732,14 @@
|
||||||
</layout>
|
</layout>
|
||||||
</dialog>
|
</dialog>
|
||||||
|
|
||||||
<dialog name = 'ScummHelp' overlays = 'screen'>
|
<dialog name = 'ScummHelp' overlays = 'screen' inset = '8'>
|
||||||
<layout type = 'vertical' padding = '8, 8, 0, 0'>
|
<layout type = 'vertical' padding = '8, 8, 8, 8'>
|
||||||
<widget name = 'Title'
|
<widget name = 'Title'
|
||||||
width = '180'
|
width = '180'
|
||||||
height = 'Globals.Line.Height'
|
height = 'Globals.Line.Height'
|
||||||
/>
|
/>
|
||||||
<widget name = 'HelpText'
|
<widget name = 'HelpText'
|
||||||
height = '140'
|
height = '130'
|
||||||
/>
|
/>
|
||||||
<layout type = 'horizontal' padding = '0, 0, 0, 0'>
|
<layout type = 'horizontal' padding = '0, 0, 0, 0'>
|
||||||
<widget name = 'Prev'
|
<widget name = 'Prev'
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue