1
0
Fork 0

(svn r15885) -Codechange: Removed new_size parameter of Window::OnResize() callback

release/1.0
alberth 2009-03-29 09:49:11 +00:00
parent 7a9a5cd139
commit 9d2738b9c4
23 changed files with 39 additions and 49 deletions

View File

@ -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) { if (delta.x != 0) {
ResizeButtons(this, AIL_WIDGET_ACCEPT, AIL_WIDGET_CANCEL); ResizeButtons(this, AIL_WIDGET_ACCEPT, AIL_WIDGET_CANCEL);
@ -365,7 +365,7 @@ struct AISettingsWindow : public Window {
this->SetDirty(); this->SetDirty();
} }
virtual void OnResize(Point new_size, Point delta) virtual void OnResize(Point delta)
{ {
if (delta.x != 0) { if (delta.x != 0) {
ResizeButtons(this, AIS_WIDGET_ACCEPT, AIS_WIDGET_RESET); 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->vscroll.cap += delta.y / 14;
this->widget[AIC_WIDGET_LIST].data = (this->vscroll.cap << 8) + 1; 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(); 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; this->vscroll.cap += delta.y / (int)this->resize.step_height;
} }

View File

@ -402,7 +402,7 @@ public:
this->SetDirty(); 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->vscroll.cap += delta.y / (int)this->resize.step_height;
this->vscroll2.cap += delta.y / (int)this->resize.step_height; this->vscroll2.cap += delta.y / (int)this->resize.step_height;

View File

@ -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->vscroll.cap += delta.y / (int)this->resize.step_height;
this->widget[BBSW_BRIDGE_LIST].data = (this->vscroll.cap << 8) + 1; this->widget[BBSW_BRIDGE_LIST].data = (this->vscroll.cap << 8) + 1;

View File

@ -1099,7 +1099,7 @@ struct BuildVehicleWindow : Window {
this->SetDirty(); this->SetDirty();
} }
virtual void OnResize(Point new_size, Point delta) virtual void OnResize(Point delta)
{ {
if (delta.x != 0 && !this->listview_mode) { if (delta.x != 0 && !this->listview_mode) {
ResizeButtons(this, BUILD_VEHICLE_WIDGET_BUILD, BUILD_VEHICLE_WIDGET_RENAME); ResizeButtons(this, BUILD_VEHICLE_WIDGET_BUILD, BUILD_VEHICLE_WIDGET_RENAME);

View File

@ -1003,7 +1003,7 @@ struct DepotWindow : Window {
_cursor.vehchain = false; _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->vscroll.cap += delta.y / (int)this->resize.step_height;
this->hscroll.cap += delta.x / (int)this->resize.step_width; this->hscroll.cap += delta.x / (int)this->resize.step_width;

View File

@ -670,7 +670,7 @@ public:
DoCommandP(0, this->group_sel, 0, CMD_RENAME_GROUP | CMD_MSG(STR_GROUP_CAN_T_RENAME), NULL, str); 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->vscroll2.cap += delta.y / PLY_WND_PRC__SIZE_OF_ROW_TINY;
this->vscroll.cap += delta.y / (int)this->resize.step_height; this->vscroll.cap += delta.y / (int)this->resize.step_height;

View File

@ -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 */ /* Adjust the number of items in the matrix depending of the rezise */
this->vscroll.cap += delta.y / (int)this->resize.step_height; this->vscroll.cap += delta.y / (int)this->resize.step_height;
@ -643,7 +643,7 @@ public:
this->SetDirty(); this->SetDirty();
} }
virtual void OnResize(Point new_size, Point delta) virtual void OnResize(Point delta)
{ {
this->viewport->width += delta.x; this->viewport->width += delta.x;
this->viewport->height += delta.y; 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; this->vscroll.cap += delta.y / 10;
} }

View File

@ -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 */ /* Widget 2 and 3 have to go with halve speed, make it so obiwan */
uint diff = delta.x / 2; uint diff = delta.x / 2;

View File

@ -674,7 +674,7 @@ public:
this->SetDirty(); 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->vscroll.cap += delta.y / (int)this->resize.step_height;

View File

@ -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; this->vscroll.cap += delta.y / (int)this->resize.step_height;

View File

@ -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) { if (delta.x != 0) {
ResizeButtons(this, SNGRFS_ADD, SNGRFS_MOVE_DOWN); ResizeButtons(this, SNGRFS_ADD, SNGRFS_MOVE_DOWN);

View File

@ -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; this->vscroll.cap += delta.y / 12;
} }

View File

@ -1125,7 +1125,7 @@ public:
} }
} }
virtual void OnResize(Point new_size, Point delta) virtual void OnResize(Point delta)
{ {
/* Update the scroll + matrix */ /* Update the scroll + matrix */
this->vscroll.cap = (this->widget[ORDER_WIDGET_ORDER_LIST].bottom - this->widget[ORDER_WIDGET_ORDER_LIST].top) / 10; this->vscroll.cap = (this->widget[ORDER_WIDGET_ORDER_LIST].bottom - this->widget[ORDER_WIDGET_ORDER_LIST].top) / 10;

View File

@ -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; this->vscroll.cap += delta.y / SETTING_HEIGHT;
SetVScrollCount(this, _settings_main_page.Length()); SetVScrollCount(this, _settings_main_page.Length());

View File

@ -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; this->vscroll.cap += delta.y / 10;
} }

View File

@ -1046,7 +1046,7 @@ public:
this->SetDirty(); 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(); 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->width += delta.x;
this->viewport->height += delta.y; this->viewport->height += delta.y;

View File

@ -546,7 +546,7 @@ public:
this->SetDirty(); this->SetDirty();
} }
virtual void OnResize(Point new_size, Point delta) virtual void OnResize(Point delta)
{ {
this->vscroll.cap += delta.y / 10; 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); 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); if (delta.x != 0) ResizeButtons(this, SVW_LOCATION, SVW_RENAME);
this->vscroll.cap += delta.y / (int)this->resize.step_height; 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; this->vscroll.cap = (this->widget[JSW_PANEL].bottom - this->widget[JSW_PANEL].top) / 10;
} }

View File

@ -325,7 +325,7 @@ struct TimetableWindow : Window {
DoCommandP(0, p1, p2, CMD_CHANGE_TIMETABLE | CMD_MSG(STR_CAN_T_TIMETABLE_VEHICLE)); 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 */ /* Update the scroll + matrix */
this->vscroll.cap = (this->widget[TTV_TIMETABLE_PANEL].bottom - this->widget[TTV_TIMETABLE_PANEL].top) / 10; this->vscroll.cap = (this->widget[TTV_TIMETABLE_PANEL].bottom - this->widget[TTV_TIMETABLE_PANEL].top) / 10;

View File

@ -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) { if (this->width <= TBP_NORMAL_MAXBUTTON * TBP_BUTTONWIDTH) {
SplitToolbar(this); SplitToolbar(this);
@ -1311,7 +1311,7 @@ public:
_place_proc(tile); _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. /* There are 16 buttons plus some spacings if the space allows it.
* Furthermore there are two panels of which one is non - essential * Furthermore there are two panels of which one is non - essential

View File

@ -625,7 +625,7 @@ public:
this->SetDirty(); this->SetDirty();
} }
virtual void OnResize(Point new_size, Point delta) virtual void OnResize(Point delta)
{ {
this->vscroll.cap += delta.y / 10; this->vscroll.cap += delta.y / 10;
} }

View File

@ -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->vscroll.cap += delta.y / (int)this->resize.step_height;
this->widget[3].data = (this->vscroll.cap << 8) + 1; this->widget[3].data = (this->vscroll.cap << 8) + 1;
@ -1152,7 +1152,7 @@ struct VehicleListWindow : public BaseVehicleListWindow {
} }
} }
virtual void OnResize(Point new_size, Point delta) virtual void OnResize(Point delta)
{ {
this->vscroll.cap += delta.y / (int)this->resize.step_height; this->vscroll.cap += delta.y / (int)this->resize.step_height;
this->widget[VLW_WIDGET_LIST].data = (this->vscroll.cap << 8) + 1; 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); 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.x != 0) ResizeButtons(this, VLD_WIDGET_DETAILS_CARGO_CARRIED, VLD_WIDGET_DETAILS_TOTAL_CARGO);
if (delta.y == 0) return; 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->width += delta.x;
this->viewport->height += delta.y; this->viewport->height += delta.y;

View File

@ -920,13 +920,10 @@ void Window::FindWindowPlacementAndResize(int def_width, int def_height)
ResizeWindow(this, enlarge_x, enlarge_y); ResizeWindow(this, enlarge_x, enlarge_y);
Point size;
Point diff; Point diff;
size.x = this->width;
size.y = this->height;
diff.x = enlarge_x; diff.x = enlarge_x;
diff.y = enlarge_y; diff.y = enlarge_y;
this->OnResize(size, diff); this->OnResize(diff);
} }
int nx = this->left; int nx = this->left;
@ -1600,13 +1597,10 @@ static bool HandleWindowDragging()
/* ResizeWindow sets both pre- and after-size to dirty for redrawal */ /* ResizeWindow sets both pre- and after-size to dirty for redrawal */
ResizeWindow(w, x, y); ResizeWindow(w, x, y);
Point size;
Point diff; Point diff;
size.x = x + w->width;
size.y = y + w->height;
diff.x = x; diff.x = x;
diff.y = y; diff.y = y;
w->OnResize(size, diff); w->OnResize(diff);
return false; return false;
} }
} }
@ -2478,13 +2472,10 @@ void RelocateAllWindows(int neww, int newh)
if (neww - w->width != 0) { if (neww - w->width != 0) {
ResizeWindow(w, min(neww, 640) - w->width, 0); ResizeWindow(w, min(neww, 640) - w->width, 0);
Point size;
Point delta; Point delta;
size.x = w->width;
size.y = w->height;
delta.x = neww - w->width; delta.x = neww - w->width;
delta.y = 0; delta.y = 0;
w->OnResize(size, delta); w->OnResize(delta);
} }
top = w->top; top = w->top;

View File

@ -497,11 +497,10 @@ public:
/** /**
* Called when the window got resized. * Called after the window got resized.
* @param new_size the new size of the window. * @param delta The amount of which the window size changed.
* @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. * A dropdown option associated to this window has been selected.