Changeset - r11519:80d5a7e0eeb8
[Not reviewed]
master
0 23 0
alberth - 15 years ago 2009-03-29 09:49:11
alberth@openttd.org
(svn r15885) -Codechange: Removed new_size parameter of Window::OnResize() callback
23 files changed with 39 insertions and 49 deletions:
0 comments (0 inline, 0 general)
src/ai/ai_gui.cpp
Show inline comments
 
@@ -164,13 +164,13 @@ struct AIListWindow : public Window {
 
				}
 
				break;
 
			}
 
		}
 
	}
 

	
 
	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);
 
		}
 

	
 
		this->vscroll.cap += delta.y / 14;
 
@@ -362,13 +362,13 @@ struct AISettingsWindow : public Window 
 
		for (int i = 0; i < this->clicked_row; i++) it++;
 
		int32 value = atoi(str);
 
		this->ai_config->SetSetting((*it).name, value);
 
		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);
 
		}
 

	
 
		this->vscroll.cap += delta.y / 14;
 
@@ -585,13 +585,13 @@ struct AIConfigWindow : public Window {
 
				this->OnClick(pt, widget);
 
				if (this->selected_slot != INVALID_COMPANY) ShowAIListWindow((CompanyID)this->selected_slot);
 
				break;
 
		}
 
	}
 

	
 
	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;
 
	}
 

	
 
	virtual void OnTick()
 
@@ -774,13 +774,13 @@ struct AIDebugWindow : public Window {
 

	
 
	virtual void OnInvalidateData(int data = 0)
 
	{
 
		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;
 
	}
 
};
 

	
 
CompanyID AIDebugWindow::ai_debug_company = INVALID_COMPANY;
src/autoreplace_gui.cpp
Show inline comments
 
@@ -399,13 +399,13 @@ public:
 
		this->update_left  = true;
 
		this->update_right = true;
 
		this->init_lists   = true;
 
		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;
 

	
 
		Widget *widget = this->widget;
 

	
 
		widget[RVW_WIDGET_LEFT_MATRIX].data = widget[RVW_WIDGET_RIGHT_MATRIX].data = (this->vscroll2.cap << 8) + 1;
src/bridge_gui.cpp
Show inline comments
 
@@ -220,13 +220,13 @@ public:
 
			this->bridges->SetSortType(index);
 

	
 
			this->SortBridgeList();
 
		}
 
	}
 

	
 
	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;
 
		SetVScrollCount(this, this->bridges->Length());
 

	
 
		this->last_size = max(this->vscroll.cap, this->last_size);
src/build_vehicle_gui.cpp
Show inline comments
 
@@ -1096,13 +1096,13 @@ struct BuildVehicleWindow : Window {
 
			_last_sort_criteria[this->vehicle_type] = this->sort_criteria;
 
			this->regenerate_list = true;
 
		}
 
		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);
 
		}
 
		if (delta.y == 0) return;
 

	
src/depot_gui.cpp
Show inline comments
 
@@ -1000,13 +1000,13 @@ struct DepotWindow : Window {
 
				this->sel = INVALID_VEHICLE;
 
				this->SetDirty();
 
		}
 
		_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;
 
		this->widget[DEPOT_WIDGET_MATRIX].data = (this->vscroll.cap << 8) + (this->type == VEH_TRAIN ? 1 : this->hscroll.cap);
 
		ResizeDepotButtons(this);
 
	}
src/group_gui.cpp
Show inline comments
 
@@ -667,13 +667,13 @@ public:
 
	{
 
		if (str == NULL) return;
 

	
 
		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;
 

	
 
		this->widget[GRP_WIDGET_LIST_GROUP].data = (this->vscroll2.cap << 8) + 1;
 
		this->widget[GRP_WIDGET_LIST_VEHICLE].data = (this->vscroll.cap << 8) + 1;
src/industry_gui.cpp
Show inline comments
 
@@ -349,13 +349,13 @@ public:
 
					HandlePlacePushButton(this, DPIW_FUND_WIDGET, SPR_CURSOR_INDUSTRY, VHM_RECT, NULL);
 
				}
 
			} break;
 
		}
 
	}
 

	
 
	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;
 
		this->widget[DPIW_MATRIX_WIDGET].data = (this->vscroll.cap << 8) + 1;
 
	}
 

	
 
@@ -640,13 +640,13 @@ public:
 
	{
 
		this->clicked_line = 0;
 
		this->clicked_button = 0;
 
		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;
 
		this->viewport->virtual_width    += delta.x;
 
		this->viewport->virtual_height   += delta.y;
 
		this->viewport->dest_scrollpos_x -= delta.x;
 
@@ -1005,13 +1005,13 @@ public:
 
			this->industries.SetSortType(index);
 
			this->widget[IDW_DROPDOWN_CRITERIA].data = this->sorter_names[this->industries.SortType()];
 
			this->SetDirty();
 
		}
 
	}
 

	
 
	virtual void OnResize(Point new_size, Point delta)
 
	virtual void OnResize(Point delta)
 
	{
 
		this->vscroll.cap += delta.y / 10;
 
	}
 

	
 
	virtual void OnInvalidateData(int data)
 
	{
src/misc_gui.cpp
Show inline comments
 
@@ -1724,13 +1724,13 @@ public:
 

	
 
			/* In the editor set up the vehicle engines correctly (date might have changed) */
 
			if (_game_mode == GM_EDITOR) StartupEngines();
 
		}
 
	}
 

	
 
	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;
 
		this->widget[SLWW_SORT_BYNAME].right += diff;
 
		this->widget[SLWW_SORT_BYDATE].left  += diff;
 
		this->widget[SLWW_SORT_BYDATE].right += delta.x;
src/network/network_content_gui.cpp
Show inline comments
 
@@ -671,13 +671,13 @@ public:
 
	{
 
		this->content.SetFilterState(!StrEmpty(this->edit_str_buf));
 
		this->content.ForceRebuild();
 
		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->widget[NCLWW_MATRIX].data = (this->vscroll.cap << 8) + 1;
 

	
 
		SetVScrollCount(this, this->content.Length());
src/network/network_gui.cpp
Show inline comments
 
@@ -719,13 +719,13 @@ public:
 
		if (!StrEmpty(str)) {
 
			NetworkAddServer(str);
 
			NetworkRebuildHostList();
 
		}
 
	}
 

	
 
	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[NGWW_MATRIX].data = (this->vscroll.cap << 8) + 1;
 

	
 
		SetVScrollCount(this, this->servers.Length());
src/newgrf_gui.cpp
Show inline comments
 
@@ -681,13 +681,13 @@ struct NewGRFWindow : public Window {
 
				this->SetDirty();
 
				break;
 
			}
 
		}
 
	}
 

	
 
	virtual void OnResize(Point new_size, Point delta)
 
	virtual void OnResize(Point delta)
 
	{
 
		if (delta.x != 0) {
 
			ResizeButtons(this, SNGRFS_ADD, SNGRFS_MOVE_DOWN);
 
			ResizeButtons(this, SNGRFS_SET_PARAMETERS, SNGRFS_APPLY_CHANGES);
 
		}
 

	
src/news_gui.cpp
Show inline comments
 
@@ -764,13 +764,13 @@ struct MessageHistoryWindow : Window {
 
			}
 

	
 
			ShowNewsMessage(ni);
 
		}
 
	}
 

	
 
	virtual void OnResize(Point new_size, Point delta)
 
	virtual void OnResize(Point delta)
 
	{
 
		this->vscroll.cap += delta.y / 12;
 
	}
 
};
 

	
 
static const Widget _message_history_widgets[] = {
src/order_gui.cpp
Show inline comments
 
@@ -1122,13 +1122,13 @@ public:
 
		if (v != NULL && this->IsWidgetLowered(ORDER_WIDGET_GOTO)) {
 
			_place_clicked_vehicle = NULL;
 
			this->HandleOrderVehClick(v);
 
		}
 
	}
 

	
 
	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;
 
	}
 

	
 
	virtual void OnTimeout()
src/settings_gui.cpp
Show inline comments
 
@@ -1498,13 +1498,13 @@ struct GameSettingsWindow : Window {
 

	
 
			SetSettingValue(this->valuewindow_entry->d.entry.index, value);
 
			this->SetDirty();
 
		}
 
	}
 

	
 
	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());
 
	}
 
};
 

	
src/signs_gui.cpp
Show inline comments
 
@@ -133,13 +133,13 @@ struct SignListWindow : Window, SignList
 

	
 
			const Sign *si = this->signs[id_v];
 
			ScrollMainWindowToTile(TileVirtXY(si->x, si->y));
 
		}
 
	}
 

	
 
	virtual void OnResize(Point new_size, Point delta)
 
	virtual void OnResize(Point delta)
 
	{
 
		this->vscroll.cap += delta.y / 10;
 
	}
 

	
 
	virtual void OnInvalidateData(int data)
 
	{
src/smallmap_gui.cpp
Show inline comments
 
@@ -1043,13 +1043,13 @@ public:
 
		this->scroll_y = y;
 
		this->subscroll = sub;
 

	
 
		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();
 
	}
 
};
 

	
 
SmallMapWindow::SmallMapType SmallMapWindow::map_type = SMT_CONTOUR;
 
@@ -1163,13 +1163,13 @@ public:
 
				this->viewport->dest_scrollpos_x =  x + (w->viewport->virtual_width -  this->viewport->virtual_width) / 2;
 
				this->viewport->dest_scrollpos_y =  y + (w->viewport->virtual_height - this->viewport->virtual_height) / 2;
 
			} break;
 
		}
 
	}
 

	
 
	virtual void OnResize(Point new_size, Point delta)
 
	virtual void OnResize(Point delta)
 
	{
 
		this->viewport->width          += delta.x;
 
		this->viewport->height         += delta.y;
 
		this->viewport->virtual_width  += delta.x;
 
		this->viewport->virtual_height += delta.y;
 
	}
src/station_gui.cpp
Show inline comments
 
@@ -543,13 +543,13 @@ public:
 
	virtual void OnTimeout()
 
	{
 
		this->RaiseWidget(SLW_SORTBY);
 
		this->SetDirty();
 
	}
 

	
 
	virtual void OnResize(Point new_size, Point delta)
 
	virtual void OnResize(Point delta)
 
	{
 
		this->vscroll.cap += delta.y / 10;
 
	}
 

	
 
	virtual void OnInvalidateData(int data)
 
	{
 
@@ -972,13 +972,13 @@ struct StationViewWindow : public Window
 
	{
 
		if (str == NULL) return;
 

	
 
		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;
 
	}
 
};
 

	
 
@@ -1184,13 +1184,13 @@ struct SelectStationWindow : Window {
 
		if (_thd.dirty & 2) {
 
			_thd.dirty &= ~2;
 
			this->SetDirty();
 
		}
 
	}
 

	
 
	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;
 
	}
 

	
 
	virtual void OnInvalidateData(int data)
 
	{
src/timetable_gui.cpp
Show inline comments
 
@@ -322,13 +322,13 @@ struct TimetableWindow : Window {
 

	
 
		uint32 p2 = minu(time, UINT16_MAX);
 

	
 
		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;
 
	}
 
};
 

	
src/toolbar_gui.cpp
Show inline comments
 
@@ -1114,13 +1114,13 @@ struct MainToolbarWindow : Window {
 
		if (this->IsWidgetLowered(TBN_FASTFORWARD) != !!_fast_forward) {
 
			this->ToggleWidgetLoweredState(TBN_FASTFORWARD);
 
			this->InvalidateWidget(TBN_FASTFORWARD);
 
		}
 
	}
 

	
 
	virtual void OnResize(Point new_size, Point delta)
 
	virtual void OnResize(Point delta)
 
	{
 
		if (this->width <= TBP_NORMAL_MAXBUTTON * TBP_BUTTONWIDTH) {
 
			SplitToolbar(this);
 
		} else {
 
			ResizeToolbar(this);
 
		}
 
@@ -1308,13 +1308,13 @@ public:
 

	
 
	virtual void OnPlaceObject(Point pt, TileIndex 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.
 
		 * Furthermore there are two panels of which one is non - essential
 
		 * and that one can be removed if the space is too small. */
 
		uint buttons_width;
 
		uint spacing;
src/town_gui.cpp
Show inline comments
 
@@ -622,13 +622,13 @@ public:
 

	
 
	virtual void OnHundredthTick()
 
	{
 
		this->SetDirty();
 
	}
 

	
 
	virtual void OnResize(Point new_size, Point delta)
 
	virtual void OnResize(Point delta)
 
	{
 
		this->vscroll.cap += delta.y / 10;
 
	}
 

	
 
	virtual void OnInvalidateData(int data)
 
	{
src/vehicle_gui.cpp
Show inline comments
 
@@ -389,13 +389,13 @@ struct RefitWindow : public Window {
 
					}
 
				}
 
				break;
 
		}
 
	}
 

	
 
	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;
 
	}
 
};
 

	
 
@@ -1149,13 +1149,13 @@ struct VehicleListWindow : public BaseVe
 

	
 
			DEBUG(misc, 3, "Periodic resort %d list company %d at station %d", this->vehicle_type, this->owner, station);
 
			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->widget[VLW_WIDGET_LIST].data = (this->vscroll.cap << 8) + 1;
 
	}
 

	
 
	virtual void OnInvalidateData(int data)
 
@@ -1572,13 +1572,13 @@ struct VehicleDetailsWindow : Window {
 

	
 
		if (str == NULL) return;
 

	
 
		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;
 

	
 
		this->vscroll.cap += delta.y / 14;
 
		this->widget[VLD_WIDGET_MIDDLE_DETAILS].data = (this->vscroll.cap << 8) + 1;
 
@@ -2034,13 +2034,13 @@ struct VehicleViewWindow : Window {
 
				assert(v->type == VEH_TRAIN);
 
				DoCommandP(v->tile, v->index, 0, CMD_FORCE_TRAIN_PROCEED | CMD_MSG(STR_8862_CAN_T_MAKE_TRAIN_PASS_SIGNAL));
 
				break;
 
		}
 
	}
 

	
 
	virtual void OnResize(Point new_size, Point delta)
 
	virtual void OnResize(Point delta)
 
	{
 
		this->viewport->width          += delta.x;
 
		this->viewport->height         += delta.y;
 
		this->viewport->virtual_width  += delta.x;
 
		this->viewport->virtual_height += delta.y;
 
	}
src/window.cpp
Show inline comments
 
@@ -917,19 +917,16 @@ void Window::FindWindowPlacementAndResiz
 
		 * unsigned int, which won't work. */
 
		if (this->resize.step_width  > 1) enlarge_x -= enlarge_x % (int)this->resize.step_width;
 
		if (this->resize.step_height > 1) enlarge_y -= enlarge_y % (int)this->resize.step_height;
 

	
 
		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;
 
	int ny = this->top;
 

	
 
	if (nx + this->width > _screen.width) nx -= (nx + this->width - _screen.width);
 
@@ -1597,19 +1594,16 @@ static bool HandleWindowDragging()
 
				_drag_delta.x += x;
 
			}
 

	
 
			/* 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;
 
		}
 
	}
 

	
 
	_dragging_window = false;
 
	return false;
 
@@ -2475,19 +2469,16 @@ void RelocateAllWindows(int neww, int ne
 
		 * in a 'backup'-desc that the window should always be centred. */
 
		switch (w->window_class) {
 
			case WC_MAIN_TOOLBAR:
 
				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;
 
				left = PositionMainToolbar(w); // changes toolbar orientation
 
				break;
 

	
src/window_gui.h
Show inline comments
 
@@ -494,17 +494,16 @@ public:
 
	 * Called when this window's timeout has been reached.
 
	 */
 
	virtual void OnTimeout() {}
 

	
 

	
 
	/**
 
	 * 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.
 
	 * @param widget the widget (button) that the dropdown is associated with.
 
	 * @param index  the element in the dropdown that is selected.
 
	 */
0 comments (0 inline, 0 general)