Changeset - r13334:52f3226937dd
[Not reviewed]
master
0 26 0
rubidium - 15 years ago 2009-10-24 14:53:55
rubidium@openttd.org
(svn r17853) -Codechange: remove the 'delta' parameter from OnResize; it was used in ways that aren't always wanted, causing bugs and the like. Also with nested widgets most reasons for handling OnResize have gone.
26 files changed with 41 insertions and 57 deletions:
0 comments (0 inline, 0 general)
src/ai/ai_gui.cpp
Show inline comments
 
@@ -203,7 +203,7 @@ struct AIListWindow : public Window {
 
		}
 
	}
 

	
 
	virtual void OnResize(Point delta)
 
	virtual void OnResize()
 
	{
 
		this->vscroll.SetCapacity(this->GetWidget<NWidgetCore>(AIL_WIDGET_LIST)->current_y / this->line_height);
 
		this->GetWidget<NWidgetCore>(AIL_WIDGET_LIST)->widget_data = (this->vscroll.GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
 
@@ -399,7 +399,7 @@ struct AISettingsWindow : public Window 
 
		this->SetDirty();
 
	}
 

	
 
	virtual void OnResize(Point delta)
 
	virtual void OnResize()
 
	{
 
		this->vscroll.SetCapacity(this->GetWidget<NWidgetCore>(AIS_WIDGET_BACKGROUND)->current_y / this->line_height);
 
		this->GetWidget<NWidgetCore>(AIS_WIDGET_BACKGROUND)->widget_data = (this->vscroll.GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
 
@@ -876,7 +876,7 @@ struct AIDebugWindow : public Window {
 
		if (data == -1 || ai_debug_company == data) this->SetDirty();
 
	}
 

	
 
	virtual void OnResize(Point delta)
 
	virtual void OnResize()
 
	{
 
		this->vscroll.SetCapacity(this->GetWidget<NWidgetBase>(AID_WIDGET_LOG_PANEL)->current_y / this->resize.step_height);
 
	}
src/autoreplace_gui.cpp
Show inline comments
 
@@ -455,7 +455,7 @@ public:
 
		this->SetDirty();
 
	}
 

	
 
	virtual void OnResize(Point delta)
 
	virtual void OnResize()
 
	{
 
		this->vscroll.SetCapacity(this->GetWidget<NWidgetBase>(RVW_WIDGET_LEFT_MATRIX)->current_y / this->resize.step_height);
 
		this->vscroll2.SetCapacity(this->GetWidget<NWidgetBase>(RVW_WIDGET_RIGHT_MATRIX)->current_y / this->resize.step_height);
src/bridge_gui.cpp
Show inline comments
 
@@ -282,7 +282,7 @@ public:
 
		}
 
	}
 

	
 
	virtual void OnResize(Point delta)
 
	virtual void OnResize()
 
	{
 
		this->vscroll.SetCapacity(this->GetWidget<NWidgetBase>(BBSW_BRIDGE_LIST)->current_y / this->resize.step_height);
 
		this->GetWidget<NWidgetCore>(BBSW_BRIDGE_LIST)->widget_data = (this->vscroll.GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
src/build_vehicle_gui.cpp
Show inline comments
 
@@ -1170,7 +1170,7 @@ struct BuildVehicleWindow : Window {
 
		this->SetDirty();
 
	}
 

	
 
	virtual void OnResize(Point delta)
 
	virtual void OnResize()
 
	{
 
		if (!this->listview_mode) ResizeButtons(this, BUILD_VEHICLE_WIDGET_BUILD, BUILD_VEHICLE_WIDGET_RENAME);
 

	
src/depot_gui.cpp
Show inline comments
 
@@ -907,7 +907,7 @@ struct DepotWindow : Window {
 
		}
 
	}
 

	
 
	virtual void OnResize(Point delta)
 
	virtual void OnResize()
 
	{
 
		this->vscroll.SetCapacity(this->GetWidget<NWidgetCore>(DEPOT_WIDGET_MATRIX)->current_y / (int)this->resize.step_height);
 
		this->hscroll.SetCapacity(this->GetWidget<NWidgetCore>(DEPOT_WIDGET_MATRIX)->current_x / (int)this->resize.step_width);
src/group_gui.cpp
Show inline comments
 
@@ -612,7 +612,7 @@ public:
 
		this->group_rename = INVALID_GROUP;
 
	}
 

	
 
	virtual void OnResize(Point delta)
 
	virtual void OnResize()
 
	{
 
		this->vscroll2.SetCapacity((this->widget[GRP_WIDGET_LIST_GROUP].bottom - this->widget[GRP_WIDGET_LIST_GROUP].top + 1) / PLY_WND_PRC__SIZE_OF_ROW_TINY);
 
		this->widget[GRP_WIDGET_LIST_GROUP].data = (this->vscroll2.GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
src/industry_gui.cpp
Show inline comments
 
@@ -387,7 +387,7 @@ public:
 
		}
 
	}
 

	
 
	virtual void OnResize(Point delta)
 
	virtual void OnResize()
 
	{
 
		/* Adjust the number of items in the matrix depending of the rezise */
 
		this->vscroll.SetCapacity((this->widget[DPIW_MATRIX_WIDGET].bottom - this->widget[DPIW_MATRIX_WIDGET].top + 1) / this->resize.step_height);
 
@@ -706,7 +706,7 @@ public:
 
		this->SetDirty();
 
	}
 

	
 
	virtual void OnResize(Point delta)
 
	virtual void OnResize()
 
	{
 
		if (this->viewport != NULL) {
 
			NWidgetViewport *nvp = this->GetWidget<NWidgetViewport>(IVW_VIEWPORT);
 
@@ -1091,7 +1091,7 @@ public:
 
		}
 
	}
 

	
 
	virtual void OnResize(Point delta)
 
	virtual void OnResize()
 
	{
 
		this->vscroll.SetCapacity(this->GetWidget<NWidgetBase>(IDW_INDUSTRY_LIST)->current_y / this->resize.step_height);
 
	}
src/main_gui.cpp
Show inline comments
 
@@ -380,7 +380,7 @@ struct MainWindow : Window
 
		ZoomInOrOutToCursorWindow(wheel < 0, this);
 
	}
 

	
 
	virtual void OnResize(Point delta)
 
	virtual void OnResize()
 
	{
 
		if (this->viewport != NULL) {
 
			NWidgetViewport *nvp = this->GetWidget<NWidgetViewport>(MW_VIEWPORT);
src/misc_gui.cpp
Show inline comments
 
@@ -2045,7 +2045,7 @@ public:
 
		}
 
	}
 

	
 
	virtual void OnResize(Point delta)
 
	virtual void OnResize()
 
	{
 
		this->vscroll.SetCapacity(this->GetWidget<NWidgetBase>(SLWW_DRIVES_DIRECTORIES_LIST)->current_y / this->resize.step_height);
 
	}
src/network/network_content_gui.cpp
Show inline comments
 
@@ -734,7 +734,7 @@ public:
 
		this->InvalidateData();
 
	}
 

	
 
	virtual void OnResize(Point delta)
 
	virtual void OnResize()
 
	{
 
		this->vscroll.SetCapacity(this->GetWidget<NWidgetBase>(NCLWW_MATRIX)->current_y / this->resize.step_height);
 
		this->GetWidget<NWidgetCore>(NCLWW_MATRIX)->widget_data = (this->vscroll.GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
src/network/network_gui.cpp
Show inline comments
 
@@ -712,7 +712,7 @@ public:
 
		if (!StrEmpty(str)) NetworkAddServer(str);
 
	}
 

	
 
	virtual void OnResize(Point delta)
 
	virtual void OnResize()
 
	{
 
		this->vscroll.SetCapacity((this->widget[NGWW_MATRIX].bottom - this->widget[NGWW_MATRIX].top + 1) / this->resize.step_height);
 
		this->widget[NGWW_MATRIX].data = (this->vscroll.GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
src/newgrf_gui.cpp
Show inline comments
 
@@ -279,7 +279,7 @@ public:
 
		}
 
	}
 

	
 
	virtual void OnResize(Point delta)
 
	virtual void OnResize()
 
	{
 
		this->vscroll.SetCapacity(this->GetWidget<NWidgetBase>(ANGRFW_GRF_LIST)->current_y / this->resize.step_height);
 
	}
 
@@ -608,7 +608,7 @@ struct NewGRFWindow : public Window {
 
		}
 
	}
 

	
 
	virtual void OnResize(Point delta)
 
	virtual void OnResize()
 
	{
 
		this->vscroll.SetCapacity(this->GetWidget<NWidgetCore>(SNGRFS_FILE_LIST)->current_y / this->resize.step_height);
 
		this->GetWidget<NWidgetCore>(SNGRFS_FILE_LIST)->widget_data = (this->vscroll.GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
src/news_gui.cpp
Show inline comments
 
@@ -991,7 +991,7 @@ struct MessageHistoryWindow : Window {
 
		}
 
	}
 

	
 
	virtual void OnResize(Point delta)
 
	virtual void OnResize()
 
	{
 
		this->vscroll.SetCapacity(this->GetWidget<NWidgetBase>(MHW_BACKGROUND)->current_y / this->line_height);
 
	}
src/order_gui.cpp
Show inline comments
 
@@ -1266,7 +1266,7 @@ public:
 
		}
 
	}
 

	
 
	virtual void OnResize(Point delta)
 
	virtual void OnResize()
 
	{
 
		/* Update the scroll bar */
 
		this->vscroll.SetCapacity(this->GetWidget<NWidgetBase>(ORDER_WIDGET_ORDER_LIST)->current_y / this->resize.step_height);
src/settings_gui.cpp
Show inline comments
 
@@ -1623,7 +1623,7 @@ struct GameSettingsWindow : Window {
 
		}
 
	}
 

	
 
	virtual void OnResize(Point delta)
 
	virtual void OnResize()
 
	{
 
		this->vscroll.SetCapacity((this->widget[SETTINGSEL_OPTIONSPANEL].bottom - this->widget[SETTINGSEL_OPTIONSPANEL].top - 8) / SETTING_HEIGHT);
 
	}
src/signs_gui.cpp
Show inline comments
 
@@ -155,7 +155,7 @@ struct SignListWindow : Window, SignList
 
		}
 
	}
 

	
 
	virtual void OnResize(Point delta)
 
	virtual void OnResize()
 
	{
 
		this->vscroll.SetCapacity((this->GetWidget<NWidgetBase>(SLW_LIST)->current_y - WD_FRAMERECT_TOP - WD_FRAMERECT_BOTTOM) / this->resize.step_height);
 
	}
src/smallmap_gui.cpp
Show inline comments
 
@@ -1133,7 +1133,7 @@ public:
 
		this->SetDirty();
 
	}
 

	
 
	virtual void OnResize(Point delta)
 
	virtual void OnResize()
 
	{
 
		if (this->map_type == SMT_INDUSTRY) this->ResizeLegend();
 
	}
src/station_gui.cpp
Show inline comments
 
@@ -564,7 +564,7 @@ public:
 
		this->SetDirty();
 
	}
 

	
 
	virtual void OnResize(Point delta)
 
	virtual void OnResize()
 
	{
 
		this->vscroll.SetCapacity((this->widget[SLW_LIST].bottom - this->widget[SLW_LIST].top + 1) / 10);
 
	}
 
@@ -1049,7 +1049,7 @@ struct StationViewWindow : public Window
 
		DoCommandP(0, this->window_number, 0, CMD_RENAME_STATION | CMD_MSG(STR_ERROR_CAN_T_RENAME_STATION), NULL, str);
 
	}
 

	
 
	virtual void OnResize(Point delta)
 
	virtual void OnResize()
 
	{
 
		ResizeButtons(this, SVW_LOCATION, SVW_RENAME);
 
		this->vscroll.SetCapacity((this->widget[SVW_WAITING].bottom - this->widget[SVW_WAITING].top + 1) / this->resize.step_height);
 
@@ -1294,7 +1294,7 @@ struct SelectStationWindow : Window {
 
		}
 
	}
 

	
 
	virtual void OnResize(Point delta)
 
	virtual void OnResize()
 
	{
 
		this->vscroll.SetCapacity((this->GetWidget<NWidgetBase>(JSW_PANEL)->current_y - WD_FRAMERECT_TOP - WD_FRAMERECT_BOTTOM) / this->resize.step_height);
 
	}
src/subsidy_gui.cpp
Show inline comments
 
@@ -220,7 +220,7 @@ struct SubsidyListWindow : Window {
 
		}
 
	}
 

	
 
	virtual void OnResize(Point delta)
 
	virtual void OnResize()
 
	{
 
		this->vscroll.SetCapacity(this->GetWidget<NWidgetBase>(SLW_PANEL)->current_y / this->resize.step_height);
 
	}
src/timetable_gui.cpp
Show inline comments
 
@@ -331,7 +331,7 @@ struct TimetableWindow : Window {
 
		DoCommandP(0, p1, p2, CMD_CHANGE_TIMETABLE | CMD_MSG(STR_ERROR_CAN_T_TIMETABLE_VEHICLE));
 
	}
 

	
 
	virtual void OnResize(Point delta)
 
	virtual void OnResize()
 
	{
 
		/* Update the scroll bar */
 
		this->vscroll.SetCapacity((this->widget[TTV_TIMETABLE_PANEL].bottom - this->widget[TTV_TIMETABLE_PANEL].top + 1) / this->resize.step_height);
src/toolbar_gui.cpp
Show inline comments
 
@@ -1127,7 +1127,7 @@ struct MainToolbarWindow : Window {
 
		}
 
	}
 

	
 
	virtual void OnResize(Point delta)
 
	virtual void OnResize()
 
	{
 
		if (this->width <= TBP_NORMAL_MAXBUTTON * TBP_BUTTONWIDTH) {
 
			SplitToolbar(this);
 
@@ -1322,7 +1322,7 @@ public:
 
		_place_proc(tile);
 
	}
 

	
 
	virtual void OnResize(Point delta)
 
	virtual void OnResize()
 
	{
 
		/* There are 16 buttons plus some spacings if the space allows it.
 
		 * Furthermore there are two panels of which one is non - essential
src/town_gui.cpp
Show inline comments
 
@@ -466,7 +466,7 @@ public:
 
		}
 
	}
 

	
 
	virtual void OnResize(Point delta)
 
	virtual void OnResize()
 
	{
 
		if (this->viewport != NULL) {
 
			NWidgetViewport *nvp = this->GetWidget<NWidgetViewport>(TVW_VIEWPORT);
 
@@ -801,7 +801,7 @@ public:
 
		this->SetDirty();
 
	}
 

	
 
	virtual void OnResize(Point delta)
 
	virtual void OnResize()
 
	{
 
		this->vscroll.SetCapacity(this->GetWidget<NWidgetBase>(TDW_CENTERTOWN)->current_y / this->resize.step_height);
 
	}
src/vehicle_gui.cpp
Show inline comments
 
@@ -387,7 +387,7 @@ struct RefitWindow : public Window {
 
		}
 
	}
 

	
 
	virtual void OnResize(Point delta)
 
	virtual void OnResize()
 
	{
 
		this->vscroll.SetCapacity((this->widget[VRW_MATRIX].bottom - this->widget[VRW_MATRIX].top + 1) / this->resize.step_height);
 
		this->widget[VRW_MATRIX].data = (this->vscroll.GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
 
@@ -1103,7 +1103,7 @@ struct VehicleListWindow : public BaseVe
 
		}
 
	}
 

	
 
	virtual void OnResize(Point delta)
 
	virtual void OnResize()
 
	{
 
		this->vscroll.SetCapacity((this->widget[VLW_WIDGET_LIST].bottom - this->widget[VLW_WIDGET_LIST].top + 1) / this->resize.step_height);
 
		this->widget[VLW_WIDGET_LIST].data = (this->vscroll.GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
 
@@ -1496,7 +1496,7 @@ struct VehicleDetailsWindow : Window {
 
		DoCommandP(0, this->window_number, 0, CMD_RENAME_VEHICLE | CMD_MSG(STR_ERROR_CAN_T_RENAME_TRAIN + Vehicle::Get(this->window_number)->type), NULL, str);
 
	}
 

	
 
	virtual void OnResize(Point delta)
 
	virtual void OnResize()
 
	{
 
		ResizeButtons(this, VLD_WIDGET_DETAILS_CARGO_CARRIED, VLD_WIDGET_DETAILS_TOTAL_CARGO);
 

	
 
@@ -1920,7 +1920,7 @@ public:
 
		}
 
	}
 

	
 
	virtual void OnResize(Point delta)
 
	virtual void OnResize()
 
	{
 
		if (this->viewport != NULL) {
 
			NWidgetViewport *nvp = this->GetWidget<NWidgetViewport>(VVW_WIDGET_VIEWPORT);
src/viewport_gui.cpp
Show inline comments
 
@@ -133,7 +133,7 @@ public:
 
		}
 
	}
 

	
 
	virtual void OnResize(Point delta)
 
	virtual void OnResize()
 
	{
 
		if (this->viewport != NULL) {
 
			NWidgetViewport *nvp = this->GetWidget<NWidgetViewport>(EVW_VIEWPORT);
src/window.cpp
Show inline comments
 
@@ -640,10 +640,7 @@ void Window::ReInit()
 
	}
 

	
 
	ResizeWindow(this, dx, dy); // Sets post-resize dirty blocks.
 
	Point diff;
 
	diff.x = dx;
 
	diff.y = dy;
 
	this->OnResize(diff); // Calls NWidgetViewport::UpdateViewportCoordinates()
 
	this->OnResize(); // Calls NWidgetViewport::UpdateViewportCoordinates()
 
}
 

	
 
/** Find the Window whose parent pointer points to this window
 
@@ -1046,11 +1043,7 @@ void Window::FindWindowPlacementAndResiz
 
		if (this->resize.step_height > 1) enlarge_y -= enlarge_y % (int)this->resize.step_height;
 

	
 
		ResizeWindow(this, enlarge_x, enlarge_y);
 

	
 
		Point diff;
 
		diff.x = enlarge_x;
 
		diff.y = enlarge_y;
 
		this->OnResize(diff);
 
		this->OnResize();
 
	}
 

	
 
	int nx = this->left;
 
@@ -1840,11 +1833,7 @@ static bool HandleWindowDragging()
 

	
 
			/* ResizeWindow sets both pre- and after-size to dirty for redrawal */
 
			ResizeWindow(w, x, y);
 

	
 
			Point diff;
 
			diff.x = x;
 
			diff.y = y;
 
			w->OnResize(diff);
 
			w->OnResize();
 
			return false;
 
		}
 
	}
 
@@ -2696,11 +2685,7 @@ void RelocateAllWindows(int neww, int ne
 
			case WC_MAIN_TOOLBAR:
 
				if (neww - w->width != 0) {
 
					ResizeWindow(w, min(neww, 640) - w->width, 0);
 

	
 
					Point delta;
 
					delta.x = neww - w->width;
 
					delta.y = 0;
 
					w->OnResize(delta);
 
					w->OnResize();
 
				}
 

	
 
				top = w->top;
src/window_gui.h
Show inline comments
 
@@ -771,9 +771,8 @@ public:
 
	/**
 
	 * Called after the window got resized.
 
	 * For nested windows with a viewport, call NWidgetViewport::UpdateViewportCoordinates.
 
	 * @param delta The amount of which the window size changed.
 
	 */
 
	virtual void OnResize(Point delta) {}
 
	virtual void OnResize() {}
 

	
 
	/**
 
	 * A dropdown option associated to this window has been selected.
0 comments (0 inline, 0 general)