Mercurial > hg > openttd
changeset 11524:420a4f0b4e0b draft
(svn r15885) -Codechange: Removed new_size parameter of Window::OnResize() callback
author | alberth <alberth@openttd.org> |
---|---|
date | Sun, 29 Mar 2009 09:49:11 +0000 |
parents | bef4285fff71 |
children | bbb51b4fef13 |
files | src/ai/ai_gui.cpp src/autoreplace_gui.cpp src/bridge_gui.cpp src/build_vehicle_gui.cpp src/depot_gui.cpp src/group_gui.cpp src/industry_gui.cpp src/misc_gui.cpp src/network/network_content_gui.cpp src/network/network_gui.cpp src/newgrf_gui.cpp src/news_gui.cpp src/order_gui.cpp src/settings_gui.cpp src/signs_gui.cpp src/smallmap_gui.cpp src/station_gui.cpp src/timetable_gui.cpp src/toolbar_gui.cpp src/town_gui.cpp src/vehicle_gui.cpp src/window.cpp src/window_gui.h |
diffstat | 23 files changed, 39 insertions(+), 49 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ai/ai_gui.cpp +++ b/src/ai/ai_gui.cpp @@ -167,7 +167,7 @@ } } - 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 @@ 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 @@ } } - 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 @@ 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; }
--- a/src/autoreplace_gui.cpp +++ b/src/autoreplace_gui.cpp @@ -402,7 +402,7 @@ 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;
--- a/src/bridge_gui.cpp +++ b/src/bridge_gui.cpp @@ -223,7 +223,7 @@ } } - 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;
--- a/src/build_vehicle_gui.cpp +++ b/src/build_vehicle_gui.cpp @@ -1099,7 +1099,7 @@ 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);
--- a/src/depot_gui.cpp +++ b/src/depot_gui.cpp @@ -1003,7 +1003,7 @@ _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;
--- a/src/group_gui.cpp +++ b/src/group_gui.cpp @@ -670,7 +670,7 @@ 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;
--- a/src/industry_gui.cpp +++ b/src/industry_gui.cpp @@ -352,7 +352,7 @@ } } - 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 @@ 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 @@ } } - virtual void OnResize(Point new_size, Point delta) + virtual void OnResize(Point delta) { this->vscroll.cap += delta.y / 10; }
--- a/src/misc_gui.cpp +++ b/src/misc_gui.cpp @@ -1727,7 +1727,7 @@ } } - 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;
--- a/src/network/network_content_gui.cpp +++ b/src/network/network_content_gui.cpp @@ -674,7 +674,7 @@ 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;
--- a/src/network/network_gui.cpp +++ b/src/network/network_gui.cpp @@ -722,7 +722,7 @@ } } - virtual void OnResize(Point new_size, Point delta) + virtual void OnResize(Point delta) { this->vscroll.cap += delta.y / (int)this->resize.step_height;
--- a/src/newgrf_gui.cpp +++ b/src/newgrf_gui.cpp @@ -684,7 +684,7 @@ } } - virtual void OnResize(Point new_size, Point delta) + virtual void OnResize(Point delta) { if (delta.x != 0) { ResizeButtons(this, SNGRFS_ADD, SNGRFS_MOVE_DOWN);
--- a/src/news_gui.cpp +++ b/src/news_gui.cpp @@ -767,7 +767,7 @@ } } - virtual void OnResize(Point new_size, Point delta) + virtual void OnResize(Point delta) { this->vscroll.cap += delta.y / 12; }
--- a/src/order_gui.cpp +++ b/src/order_gui.cpp @@ -1125,7 +1125,7 @@ } } - 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;
--- a/src/settings_gui.cpp +++ b/src/settings_gui.cpp @@ -1501,7 +1501,7 @@ } } - 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());
--- a/src/signs_gui.cpp +++ b/src/signs_gui.cpp @@ -136,7 +136,7 @@ } } - virtual void OnResize(Point new_size, Point delta) + virtual void OnResize(Point delta) { this->vscroll.cap += delta.y / 10; }
--- a/src/smallmap_gui.cpp +++ b/src/smallmap_gui.cpp @@ -1046,7 +1046,7 @@ 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 @@ } } - virtual void OnResize(Point new_size, Point delta) + virtual void OnResize(Point delta) { this->viewport->width += delta.x; this->viewport->height += delta.y;
--- a/src/station_gui.cpp +++ b/src/station_gui.cpp @@ -546,7 +546,7 @@ 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 @@ 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 @@ } } - 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; }
--- a/src/timetable_gui.cpp +++ b/src/timetable_gui.cpp @@ -325,7 +325,7 @@ 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;
--- a/src/toolbar_gui.cpp +++ b/src/toolbar_gui.cpp @@ -1117,7 +1117,7 @@ } } - 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 @@ _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
--- a/src/town_gui.cpp +++ b/src/town_gui.cpp @@ -625,7 +625,7 @@ this->SetDirty(); } - virtual void OnResize(Point new_size, Point delta) + virtual void OnResize(Point delta) { this->vscroll.cap += delta.y / 10; }
--- a/src/vehicle_gui.cpp +++ b/src/vehicle_gui.cpp @@ -392,7 +392,7 @@ } } - 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 @@ } } - 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 @@ 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 @@ } } - virtual void OnResize(Point new_size, Point delta) + virtual void OnResize(Point delta) { this->viewport->width += delta.x; this->viewport->height += delta.y;
--- a/src/window.cpp +++ b/src/window.cpp @@ -920,13 +920,10 @@ 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 @@ /* 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 @@ 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;
--- a/src/window_gui.h +++ b/src/window_gui.h @@ -497,11 +497,10 @@ /** - * 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.