summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-11-16 16:42:04 +0000
committerrubidium <rubidium@openttd.org>2009-11-16 16:42:04 +0000
commite7dd53dffcde2d42e99036b7ec4bba3d01e018f9 (patch)
tree23a2482137d651212ff2bb6e25c060fea10c78d9 /src
parent5589792d0c33bf99060947a58ebe65fe5dc4d311 (diff)
downloadopenttd-e7dd53dffcde2d42e99036b7ec4bba3d01e018f9.tar.xz
(svn r18119) -Codechange/Fix: always call OnResize so the matrices/scrollbars are initialised without the need for duplicating the OnResize code
Diffstat (limited to 'src')
-rw-r--r--src/autoreplace_gui.cpp3
-rw-r--r--src/build_vehicle_gui.cpp3
-rw-r--r--src/window.cpp17
3 files changed, 5 insertions, 18 deletions
diff --git a/src/autoreplace_gui.cpp b/src/autoreplace_gui.cpp
index 9b5adbfd6..7e1d78cb2 100644
--- a/src/autoreplace_gui.cpp
+++ b/src/autoreplace_gui.cpp
@@ -227,9 +227,6 @@ public:
this->InitNested(desc, vehicletype);
- /* Update the scrollbars/matrix 'definitions' */
- this->OnResize();
-
this->owner = _local_company;
this->sel_group = id_g;
}
diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp
index 25b78867d..44818d309 100644
--- a/src/build_vehicle_gui.cpp
+++ b/src/build_vehicle_gui.cpp
@@ -837,9 +837,6 @@ struct BuildVehicleWindow : Window {
this->FinishInitNested(desc, tile == INVALID_TILE ? (int)type : tile);
- /* Update the scrollbars/matrix 'definitions' */
- this->OnResize();
-
this->eng_list.ForceRebuild();
this->GenerateBuildList(); // generate the list, since we need it in the next line
/* Select the first engine in the list as default when opening the window */
diff --git a/src/window.cpp b/src/window.cpp
index 873bfa616..34a6b2bcd 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -517,17 +517,8 @@ void Window::ReInit(int rx, int ry)
if (this->resize.step_width > 1) dx -= dx % (int)this->resize.step_width;
if (this->resize.step_height > 1) dy -= dy % (int)this->resize.step_height;
- if (dx == 0 && dy == 0) { // No resize needed.
- this->SetDirty();
- if (this->viewport != NULL) {
- NWidgetViewport *nvp = (NWidgetViewport *)nested_root->GetWidgetOfType(NWID_VIEWPORT);
- nvp->UpdateViewportCoordinates(this);
- }
- return;
- }
-
- ResizeWindow(this, dx, dy); // Sets post-resize dirty blocks.
- this->OnResize(); // Calls NWidgetViewport::UpdateViewportCoordinates()
+ ResizeWindow(this, dx, dy);
+ this->OnResize();
}
/** Find the Window whose parent pointer points to this window
@@ -901,9 +892,11 @@ void Window::FindWindowPlacementAndResize(int def_width, int def_height)
if (this->resize.step_height > 1) enlarge_y -= enlarge_y % (int)this->resize.step_height;
ResizeWindow(this, enlarge_x, enlarge_y);
- this->OnResize();
}
+ /* Always call OnResize; that way the scrollbars and matrices get initialized */
+ this->OnResize();
+
int nx = this->left;
int ny = this->top;