diff --git a/src/ai/ai_gui.cpp b/src/ai/ai_gui.cpp --- a/src/ai/ai_gui.cpp +++ b/src/ai/ai_gui.cpp @@ -167,7 +167,7 @@ struct AIListWindow : public Window { } } - virtual void OnResize(Point new_size, Point delta) + virtual void OnResize(Point delta) { if (delta.x != 0) { ResizeButtons(this, AIL_WIDGET_ACCEPT, AIL_WIDGET_CANCEL); @@ -365,7 +365,7 @@ struct AISettingsWindow : public Window this->SetDirty(); } - virtual void OnResize(Point new_size, Point delta) + virtual void OnResize(Point delta) { if (delta.x != 0) { ResizeButtons(this, AIS_WIDGET_ACCEPT, AIS_WIDGET_RESET); @@ -588,7 +588,7 @@ struct AIConfigWindow : public Window { } } - virtual void OnResize(Point new_size, Point delta) + virtual void OnResize(Point delta) { this->vscroll.cap += delta.y / 14; this->widget[AIC_WIDGET_LIST].data = (this->vscroll.cap << 8) + 1; @@ -777,7 +777,7 @@ struct AIDebugWindow : public Window { if (data == -1 || ai_debug_company == data) this->SetDirty(); } - virtual void OnResize(Point new_size, Point delta) + virtual void OnResize(Point delta) { this->vscroll.cap += delta.y / (int)this->resize.step_height; } diff --git a/src/autoreplace_gui.cpp b/src/autoreplace_gui.cpp --- a/src/autoreplace_gui.cpp +++ b/src/autoreplace_gui.cpp @@ -402,7 +402,7 @@ public: this->SetDirty(); } - virtual void OnResize(Point new_size, Point delta) { + virtual void OnResize(Point delta) { this->vscroll.cap += delta.y / (int)this->resize.step_height; this->vscroll2.cap += delta.y / (int)this->resize.step_height; diff --git a/src/bridge_gui.cpp b/src/bridge_gui.cpp --- a/src/bridge_gui.cpp +++ b/src/bridge_gui.cpp @@ -223,7 +223,7 @@ public: } } - virtual void OnResize(Point new_size, Point delta) + virtual void OnResize(Point delta) { this->vscroll.cap += delta.y / (int)this->resize.step_height; this->widget[BBSW_BRIDGE_LIST].data = (this->vscroll.cap << 8) + 1; diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp --- a/src/build_vehicle_gui.cpp +++ b/src/build_vehicle_gui.cpp @@ -1099,7 +1099,7 @@ struct BuildVehicleWindow : Window { this->SetDirty(); } - virtual void OnResize(Point new_size, Point delta) + virtual void OnResize(Point delta) { if (delta.x != 0 && !this->listview_mode) { ResizeButtons(this, BUILD_VEHICLE_WIDGET_BUILD, BUILD_VEHICLE_WIDGET_RENAME); diff --git a/src/depot_gui.cpp b/src/depot_gui.cpp --- a/src/depot_gui.cpp +++ b/src/depot_gui.cpp @@ -1003,7 +1003,7 @@ struct DepotWindow : Window { _cursor.vehchain = false; } - virtual void OnResize(Point new_size, Point delta) + virtual void OnResize(Point delta) { this->vscroll.cap += delta.y / (int)this->resize.step_height; this->hscroll.cap += delta.x / (int)this->resize.step_width; diff --git a/src/group_gui.cpp b/src/group_gui.cpp --- a/src/group_gui.cpp +++ b/src/group_gui.cpp @@ -670,7 +670,7 @@ public: DoCommandP(0, this->group_sel, 0, CMD_RENAME_GROUP | CMD_MSG(STR_GROUP_CAN_T_RENAME), NULL, str); } - virtual void OnResize(Point new_size, Point delta) + virtual void OnResize(Point delta) { this->vscroll2.cap += delta.y / PLY_WND_PRC__SIZE_OF_ROW_TINY; this->vscroll.cap += delta.y / (int)this->resize.step_height; diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp --- a/src/industry_gui.cpp +++ b/src/industry_gui.cpp @@ -352,7 +352,7 @@ public: } } - virtual void OnResize(Point new_size, Point delta) + virtual void OnResize(Point delta) { /* Adjust the number of items in the matrix depending of the rezise */ this->vscroll.cap += delta.y / (int)this->resize.step_height; @@ -643,7 +643,7 @@ public: this->SetDirty(); } - virtual void OnResize(Point new_size, Point delta) + virtual void OnResize(Point delta) { this->viewport->width += delta.x; this->viewport->height += delta.y; @@ -1008,7 +1008,7 @@ public: } } - virtual void OnResize(Point new_size, Point delta) + virtual void OnResize(Point delta) { this->vscroll.cap += delta.y / 10; } diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp --- a/src/misc_gui.cpp +++ b/src/misc_gui.cpp @@ -1727,7 +1727,7 @@ public: } } - virtual void OnResize(Point new_size, Point delta) + virtual void OnResize(Point delta) { /* Widget 2 and 3 have to go with halve speed, make it so obiwan */ uint diff = delta.x / 2; diff --git a/src/network/network_content_gui.cpp b/src/network/network_content_gui.cpp --- a/src/network/network_content_gui.cpp +++ b/src/network/network_content_gui.cpp @@ -674,7 +674,7 @@ public: this->SetDirty(); } - virtual void OnResize(Point new_size, Point delta) + virtual void OnResize(Point delta) { this->vscroll.cap += delta.y / (int)this->resize.step_height; diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp --- a/src/network/network_gui.cpp +++ b/src/network/network_gui.cpp @@ -722,7 +722,7 @@ public: } } - virtual void OnResize(Point new_size, Point delta) + virtual void OnResize(Point delta) { this->vscroll.cap += delta.y / (int)this->resize.step_height; diff --git a/src/newgrf_gui.cpp b/src/newgrf_gui.cpp --- a/src/newgrf_gui.cpp +++ b/src/newgrf_gui.cpp @@ -684,7 +684,7 @@ struct NewGRFWindow : public Window { } } - virtual void OnResize(Point new_size, Point delta) + virtual void OnResize(Point delta) { if (delta.x != 0) { ResizeButtons(this, SNGRFS_ADD, SNGRFS_MOVE_DOWN); diff --git a/src/news_gui.cpp b/src/news_gui.cpp --- a/src/news_gui.cpp +++ b/src/news_gui.cpp @@ -767,7 +767,7 @@ struct MessageHistoryWindow : Window { } } - virtual void OnResize(Point new_size, Point delta) + virtual void OnResize(Point delta) { this->vscroll.cap += delta.y / 12; } diff --git a/src/order_gui.cpp b/src/order_gui.cpp --- a/src/order_gui.cpp +++ b/src/order_gui.cpp @@ -1125,7 +1125,7 @@ public: } } - virtual void OnResize(Point new_size, Point delta) + virtual void OnResize(Point delta) { /* Update the scroll + matrix */ this->vscroll.cap = (this->widget[ORDER_WIDGET_ORDER_LIST].bottom - this->widget[ORDER_WIDGET_ORDER_LIST].top) / 10; diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp --- a/src/settings_gui.cpp +++ b/src/settings_gui.cpp @@ -1501,7 +1501,7 @@ struct GameSettingsWindow : Window { } } - virtual void OnResize(Point new_size, Point delta) + virtual void OnResize(Point delta) { this->vscroll.cap += delta.y / SETTING_HEIGHT; SetVScrollCount(this, _settings_main_page.Length()); diff --git a/src/signs_gui.cpp b/src/signs_gui.cpp --- a/src/signs_gui.cpp +++ b/src/signs_gui.cpp @@ -136,7 +136,7 @@ struct SignListWindow : Window, SignList } } - virtual void OnResize(Point new_size, Point delta) + virtual void OnResize(Point delta) { this->vscroll.cap += delta.y / 10; } diff --git a/src/smallmap_gui.cpp b/src/smallmap_gui.cpp --- a/src/smallmap_gui.cpp +++ b/src/smallmap_gui.cpp @@ -1046,7 +1046,7 @@ public: this->SetDirty(); } - virtual void OnResize(Point new_size, Point delta) + virtual void OnResize(Point delta) { if (delta.x != 0 && this->map_type == SMT_INDUSTRY) this->ResizeLegend(); } @@ -1166,7 +1166,7 @@ public: } } - virtual void OnResize(Point new_size, Point delta) + virtual void OnResize(Point delta) { this->viewport->width += delta.x; this->viewport->height += delta.y; diff --git a/src/station_gui.cpp b/src/station_gui.cpp --- a/src/station_gui.cpp +++ b/src/station_gui.cpp @@ -546,7 +546,7 @@ public: this->SetDirty(); } - virtual void OnResize(Point new_size, Point delta) + virtual void OnResize(Point delta) { this->vscroll.cap += delta.y / 10; } @@ -975,7 +975,7 @@ struct StationViewWindow : public Window DoCommandP(0, this->window_number, 0, CMD_RENAME_STATION | CMD_MSG(STR_3031_CAN_T_RENAME_STATION), NULL, str); } - virtual void OnResize(Point new_size, Point delta) + virtual void OnResize(Point delta) { if (delta.x != 0) ResizeButtons(this, SVW_LOCATION, SVW_RENAME); this->vscroll.cap += delta.y / (int)this->resize.step_height; @@ -1187,7 +1187,7 @@ struct SelectStationWindow : Window { } } - virtual void OnResize(Point new_size, Point delta) + virtual void OnResize(Point delta) { this->vscroll.cap = (this->widget[JSW_PANEL].bottom - this->widget[JSW_PANEL].top) / 10; } diff --git a/src/timetable_gui.cpp b/src/timetable_gui.cpp --- a/src/timetable_gui.cpp +++ b/src/timetable_gui.cpp @@ -325,7 +325,7 @@ struct TimetableWindow : Window { DoCommandP(0, p1, p2, CMD_CHANGE_TIMETABLE | CMD_MSG(STR_CAN_T_TIMETABLE_VEHICLE)); } - virtual void OnResize(Point new_size, Point delta) + virtual void OnResize(Point delta) { /* Update the scroll + matrix */ this->vscroll.cap = (this->widget[TTV_TIMETABLE_PANEL].bottom - this->widget[TTV_TIMETABLE_PANEL].top) / 10; diff --git a/src/toolbar_gui.cpp b/src/toolbar_gui.cpp --- a/src/toolbar_gui.cpp +++ b/src/toolbar_gui.cpp @@ -1117,7 +1117,7 @@ struct MainToolbarWindow : Window { } } - virtual void OnResize(Point new_size, Point delta) + virtual void OnResize(Point delta) { if (this->width <= TBP_NORMAL_MAXBUTTON * TBP_BUTTONWIDTH) { SplitToolbar(this); @@ -1311,7 +1311,7 @@ public: _place_proc(tile); } - virtual void OnResize(Point new_size, Point delta) + virtual void OnResize(Point delta) { /* There are 16 buttons plus some spacings if the space allows it. * Furthermore there are two panels of which one is non - essential diff --git a/src/town_gui.cpp b/src/town_gui.cpp --- a/src/town_gui.cpp +++ b/src/town_gui.cpp @@ -625,7 +625,7 @@ public: this->SetDirty(); } - virtual void OnResize(Point new_size, Point delta) + virtual void OnResize(Point delta) { this->vscroll.cap += delta.y / 10; } diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp --- a/src/vehicle_gui.cpp +++ b/src/vehicle_gui.cpp @@ -392,7 +392,7 @@ struct RefitWindow : public Window { } } - virtual void OnResize(Point new_size, Point delta) + virtual void OnResize(Point delta) { this->vscroll.cap += delta.y / (int)this->resize.step_height; this->widget[3].data = (this->vscroll.cap << 8) + 1; @@ -1152,7 +1152,7 @@ struct VehicleListWindow : public BaseVe } } - virtual void OnResize(Point new_size, Point delta) + virtual void OnResize(Point delta) { this->vscroll.cap += delta.y / (int)this->resize.step_height; this->widget[VLW_WIDGET_LIST].data = (this->vscroll.cap << 8) + 1; @@ -1575,7 +1575,7 @@ struct VehicleDetailsWindow : Window { DoCommandP(0, this->window_number, 0, CMD_RENAME_VEHICLE | CMD_MSG(_name_vehicle_error[GetVehicle(this->window_number)->type]), NULL, str); } - virtual void OnResize(Point new_size, Point delta) + virtual void OnResize(Point delta) { if (delta.x != 0) ResizeButtons(this, VLD_WIDGET_DETAILS_CARGO_CARRIED, VLD_WIDGET_DETAILS_TOTAL_CARGO); if (delta.y == 0) return; @@ -2037,7 +2037,7 @@ struct VehicleViewWindow : Window { } } - virtual void OnResize(Point new_size, Point delta) + virtual void OnResize(Point delta) { this->viewport->width += delta.x; this->viewport->height += delta.y; diff --git a/src/window.cpp b/src/window.cpp --- a/src/window.cpp +++ b/src/window.cpp @@ -920,13 +920,10 @@ void Window::FindWindowPlacementAndResiz ResizeWindow(this, enlarge_x, enlarge_y); - Point size; Point diff; - size.x = this->width; - size.y = this->height; diff.x = enlarge_x; diff.y = enlarge_y; - this->OnResize(size, diff); + this->OnResize(diff); } int nx = this->left; @@ -1600,13 +1597,10 @@ static bool HandleWindowDragging() /* ResizeWindow sets both pre- and after-size to dirty for redrawal */ ResizeWindow(w, x, y); - Point size; Point diff; - size.x = x + w->width; - size.y = y + w->height; diff.x = x; diff.y = y; - w->OnResize(size, diff); + w->OnResize(diff); return false; } } @@ -2478,13 +2472,10 @@ void RelocateAllWindows(int neww, int ne if (neww - w->width != 0) { ResizeWindow(w, min(neww, 640) - w->width, 0); - Point size; Point delta; - size.x = w->width; - size.y = w->height; delta.x = neww - w->width; delta.y = 0; - w->OnResize(size, delta); + w->OnResize(delta); } top = w->top; diff --git a/src/window_gui.h b/src/window_gui.h --- a/src/window_gui.h +++ b/src/window_gui.h @@ -497,11 +497,10 @@ public: /** - * Called when the window got resized. - * @param new_size the new size of the window. - * @param delta the amount of which the window size changed. + * Called after the window got resized. + * @param delta The amount of which the window size changed. */ - virtual void OnResize(Point new_size, Point delta) {} + virtual void OnResize(Point delta) {} /** * A dropdown option associated to this window has been selected.