Fixed bug 2820514 ("Help dialog causes crash")

svn-id: r42537
This commit is contained in:
Vicent Marti committed 2009-07-16 17:29:31 +00:00
1 parent ff75d68f1c
commit af289bdb03
9 files changed
+1116 -1111

No files matched your search

+12 -4
View File
@@ -641,6 +641,8 @@ HelpDialog::HelpDialog(const GameSettings &game)
new GUI::ButtonWidget(this, "ScummHelp.Close", "Close", kCloseCmd, 'C');
_prevButton->clearFlags(WIDGET_ENABLED);
_numLines = HELP_NUM_LINES;
// Dummy entries
for (int i = 0; i < HELP_NUM_LINES; i++) {
_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);
/* 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 dscX = x + keyW + 32;
int dscW = w * 80 / 100;
int xoff = (_w >> 1) - (w >> 1);
for (int i = 0; i < HELP_NUM_LINES; i++) {
_key[i]->resize(xoff + x, y + lineHeight * i, keyW, lineHeight + 2);
_dsc[i]->resize(xoff + dscX, y + lineHeight * i, dscW, lineHeight + 2);
for (int i = 0; i < _numLines; i++) {
_key[i]->resize(xoff + x, y + lineHeight * i, keyW, lineHeight);
_dsc[i]->resize(xoff + dscX, y + lineHeight * i, dscW, lineHeight);
}
displayKeyBindings();
@@ -675,6 +682,7 @@ void HelpDialog::reflowLayout() {
void HelpDialog::displayKeyBindings() {
String titleStr, *keyStr, *dscStr;
int i;
#ifndef __DS__
ScummHelp::updateStrings(_game.id, _game.version, _game.platform, _page, titleStr, keyStr, dscStr);
@@ -684,7 +692,7 @@ void HelpDialog::displayKeyBindings() {
#endif
_title->setLabel(titleStr);
for (int i = 0; i < HELP_NUM_LINES; i++) {
for (i = 0; i < _numLines; i++) {
_key[i]->setLabel(keyStr[i]);
_dsc[i]->setLabel(dscStr[i]);
}
+1
View File
@@ -124,6 +124,7 @@ protected:
int _page;
int _numPages;
int _numLines;
const GameSettings _game;
+4 -8
View File
@@ -596,8 +596,6 @@ drawSquare(int x, int y, int w, int h) {
template<typename PixelType>
void VectorRendererSpec<PixelType>::
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 ||
w <= 0 || h <= 0 || x < 0 || y < 0 || r <= 0)
return;
@@ -606,8 +604,8 @@ drawRoundedSquare(int x, int y, int r, int w, int h) {
r = MIN(w /2, h / 2);
if (Base::_fillMode != kFillDisabled && Base::_shadowOffset
&& x + w + Base::_shadowOffset < Base::_activeSurface->w
&& y + h + Base::_shadowOffset < Base::_activeSurface->h) {
&& x + w + Base::_shadowOffset + 1 < Base::_activeSurface->w
&& y + h + Base::_shadowOffset + 1 < Base::_activeSurface->h) {
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;
#if 0
x = MAX(x - bevel, 0);
y = MAX(y - bevel, 0);
w = w + (bevel * 2);
h = h + (bevel * 2);
#endif
w = MIN(w + (bevel * 2), (int)_activeSurface->w);
h = MIN(h + (bevel * 2), (int)_activeSurface->h);
PixelType *ptr_left = (PixelType *)_activeSurface->getBasePtr(x, y);
+1085 -1085
View File
File diff suppressed because it is too large. Load diff
Binary file not shown.
+10 -10
View File
@@ -54,7 +54,7 @@
/>
<widget name = 'Button'
size = '112, 28'
size = '108, 24'
/>
<widget name = 'Slider'
size = '128, 18'
@@ -115,31 +115,31 @@
<widget name = 'GameList'/>
<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10'>
<widget name = 'LoadGameButton'
height = '24'
height = '20'
/>
<widget name = 'AddGameButton'
height = '24'
height = '20'
/>
<widget name = 'EditGameButton'
height = '24'
height = '20'
/>
<widget name = 'RemoveGameButton'
height = '24'
height = '20'
/>
</layout>
<space size = '4'/>
<layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10'>
<widget name = 'QuitButton'
height = '24'
height = '20'
/>
<widget name = 'AboutButton'
height = '24'
height = '20'
/>
<widget name = 'OptionsButton'
height = '24'
height = '20'
/>
<widget name = 'StartButton'
height = '24'
height = '20'
/>
</layout>
</layout>
@@ -745,7 +745,7 @@
height = 'Globals.Line.Height'
/>
<widget name = 'HelpText'
height = '220'
height = '200'
/>
<layout type = 'horizontal' padding = '0, 0, 16, 0'>
<widget name = 'Prev'
@@ -744,7 +744,7 @@
</dialog>
<dialog name = 'ScummHelp' overlays = 'screen'>
<layout type = 'vertical' padding = '8, 8, 0, 0'>
<layout type = 'vertical' padding = '8, 8, 8, 8'>
<widget name = 'Title'
width = '180'
height = 'Globals.Line.Height'
Binary file not shown.
@@ -732,14 +732,14 @@
</layout>
</dialog>
<dialog name = 'ScummHelp' overlays = 'screen'>
<layout type = 'vertical' padding = '8, 8, 0, 0'>
<dialog name = 'ScummHelp' overlays = 'screen' inset = '8'>
<layout type = 'vertical' padding = '8, 8, 8, 8'>
<widget name = 'Title'
width = '180'
height = 'Globals.Line.Height'
/>
<widget name = 'HelpText'
height = '140'
height = '130'
/>
<layout type = 'horizontal' padding = '0, 0, 0, 0'>
<widget name = 'Prev'