--- a/src/misc_gui.cpp Mon Feb 19 20:37:33 2007 +0000
+++ b/src/misc_gui.cpp Tue Feb 27 13:26:47 2007 +0000
@@ -249,7 +249,7 @@
switch (e->event) {
case WE_CREATE: /* Set up window counter and start position of scroller */
WP(w, scroller_d).counter = 0;
- WP(w, scroller_d).height = w->height - 40;
+ WP(w, scroller_d).height = w->Height() - 40;
break;
case WE_PAINT: {
uint i;
@@ -262,17 +262,17 @@
// Show all scrolling credits
for (i = 0; i < lengthof(credits); i++) {
- if (y >= 50 && y < (w->height - 40)) {
+ if (y >= 50 && y < (w->Height() - 40)) {
DoDrawString(credits[i], 10, y, 0x10);
}
y += 10;
}
// If the last text has scrolled start anew from the start
- if (y < 50) WP(w, scroller_d).height = w->height - 40;
+ if (y < 50) WP(w, scroller_d).height = w->Height() - 40;
- DoDrawStringCentered(210, w->height - 25, "Website: http://www.openttd.org", 16);
- DrawStringCentered(210, w->height - 15, STR_00BA_COPYRIGHT_OPENTTD, 0);
+ DoDrawStringCentered(210, w->Height() - 25, "Website: http://www.openttd.org", 16);
+ DrawStringCentered(210, w->Height() - 15, STR_00BA_COPYRIGHT_OPENTTD, 0);
} break;
case WE_MOUSELOOP: /* Timer to scroll the text and adjust the new top */
if (WP(w, scroller_d).counter++ % 3 == 0) {
@@ -649,13 +649,13 @@
switch (e->event) {
case WE_PAINT: {
uint arg;
- GfxFillRect(0, 0, w->width - 1, w->height - 1, 0);
- GfxFillRect(1, 1, w->width - 2, w->height - 2, 0x44);
+ GfxFillRect(0, 0, w->Width() - 1, w->Height() - 1, 0);
+ GfxFillRect(1, 1, w->Width() - 2, w->Height() - 2, 0x44);
for (arg = 0; arg < WP(w, tooltips_d).paramcount; arg++) {
SetDParam(arg, WP(w, tooltips_d).params[arg]);
}
- DrawStringMultiCenter((w->width >> 1), (w->height >> 1) - 5, WP(w, tooltips_d).string_id, 197);
+ DrawStringMultiCenter((w->Width() >> 1), (w->Height() >> 1) - 5, WP(w, tooltips_d).string_id, 197);
break;
}
@@ -1208,7 +1208,7 @@
w->DrawWidgets();
COPY_IN_DPARAM(0, q->params, lengthof(q->params));
- DrawStringMultiCenter(w->width / 2, (w->height / 2) - 10, q->message, w->width);
+ DrawStringMultiCenter(w->Width() / 2, (w->Height() / 2) - 10, q->message, w->Width());
break;
case WE_CLICK:
@@ -1280,8 +1280,9 @@
if (parent == NULL) parent = BaseWindow::FindById(WC_MAIN_WINDOW, 0);
w->parent = parent;
- w->left = parent->left + (parent->width / 2) - (w->width / 2);
- w->top = parent->top + (parent->height / 2) - (w->height / 2);
+ /* Center window to the center of parent */
+ w->SetTopLeft(parent->TopLeft() + (parent->Size() - w->Size()) / 2);
+
/* Create a backup of the variadic arguments to strings because it will be
* overridden pretty often. We will copy these back for drawing */
@@ -1433,7 +1434,7 @@
SetVScrollCount(w, _fios_num);
w->DrawWidgets();
- DrawFiosTexts(w->width);
+ DrawFiosTexts(w->Width());
if (_savegame_sort_dirty) {
_savegame_sort_dirty = false;
@@ -1451,7 +1452,7 @@
for (pos = w->vscroll.pos; pos < _fios_num; pos++) {
const FiosItem *item = _fios_list + pos;
- DoDrawStringTruncated(item->title, 4, y, _fios_colors[item->type], w->width - 18);
+ DoDrawStringTruncated(item->title, 4, y, _fios_colors[item->type], w->Width() - 18);
y += 10;
if (y >= w->vscroll.cap * 10 + w->widget[7].top + 1) break;
}
@@ -1644,7 +1645,7 @@
w->vscroll.cap = 24;
w->resize.step_width = 2;
w->resize.step_height = 10;
- w->resize.height = w->height - 14 * 10; // Minimum of 10 items
+ w->resize.height = w->Height() - 14 * 10; // Minimum of 10 items
w->LowerWidget(7);
WP(w, querystr_d).afilter = CS_ALPHANUMERAL;