Changeset - r13592:acc23e8ddd40
[Not reviewed]
master
0 18 0
rubidium - 15 years ago 2009-11-16 20:34:57
rubidium@openttd.org
(svn r18126) -Codechange: remove duplicate (since r18119) scrollbar capacity/matrix initialisation
18 files changed with 4 insertions and 75 deletions:
0 comments (0 inline, 0 general)
src/ai/ai_gui.cpp
Show inline comments
 
@@ -60,9 +60,7 @@ struct AIListWindow : public Window {
 

	
 
		this->InitNested(desc); // Initializes 'this->line_height' as side effect.
 

	
 
		this->vscroll.SetCapacity(this->GetWidget<NWidgetBase>(AIL_WIDGET_LIST)->current_y / this->line_height);
 
		this->vscroll.SetCount((int)this->ai_info_list->size() + 1);
 
		this->GetWidget<NWidgetCore>(AIL_WIDGET_LIST)->widget_data = (this->vscroll.GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
 

	
 
		/* Try if we can find the currently selected AI */
 
		this->selected = -1;
 
@@ -277,9 +275,7 @@ struct AISettingsWindow : public Window 
 

	
 
		this->InitNested(desc);  // Initializes 'this->line_height' as side effect.
 

	
 
		this->vscroll.SetCapacity(this->GetWidget<NWidgetBase>(AIS_WIDGET_BACKGROUND)->current_y / this->line_height);
 
		this->vscroll.SetCount((int)this->ai_config->GetConfigList()->size());
 
		this->GetWidget<NWidgetCore>(AIS_WIDGET_BACKGROUND)->widget_data = (this->vscroll.GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
 
	}
 

	
 
	virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *resize)
 
@@ -677,8 +673,6 @@ struct AIDebugWindow : public Window {
 
		}
 
		this->DisableWidget(AID_WIDGET_RELOAD_TOGGLE);
 

	
 
		this->vscroll.SetCapacity(this->GetWidget<NWidgetBase>(AID_WIDGET_LOG_PANEL)->current_y / this->resize.step_height);
 

	
 
		this->last_vscroll_pos = 0;
 
		this->autoscroll = true;
 

	
src/bridge_gui.cpp
Show inline comments
 
@@ -143,13 +143,11 @@ public:
 
		this->SortBridgeList();
 

	
 
		this->vscroll.SetCount(bl->Length());
 
		this->vscroll.SetCapacity(this->GetWidget<NWidgetBase>(BBSW_BRIDGE_LIST)->current_y / this->resize.step_height);
 
		if (this->last_size < this->vscroll.GetCapacity()) this->last_size = this->vscroll.GetCapacity();
 
		if (this->last_size > this->vscroll.GetCount()) this->last_size = this->vscroll.GetCount();
 
		/* Resize the bridge selection window if we used a bigger one the last time. */
 
		if (this->last_size > this->vscroll.GetCapacity()) {
 
			ResizeWindow(this, 0, (this->last_size - this->vscroll.GetCapacity()) * this->resize.step_height);
 
			this->vscroll.SetCapacity(this->last_size);
 
		}
 
		this->GetWidget<NWidgetCore>(BBSW_BRIDGE_LIST)->widget_data = (this->vscroll.GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
 
	}
src/depot_gui.cpp
Show inline comments
 
@@ -225,6 +225,8 @@ struct DepotWindow : Window {
 

	
 
	DepotWindow(const WindowDesc *desc, TileIndex tile, VehicleType type) : Window()
 
	{
 
		assert(IsCompanyBuildableVehicleType(type)); // ensure that we make the call with a valid type
 

	
 
		this->sel = INVALID_VEHICLE;
 
		this->generate_list = true;
 
		this->type = type;
 
@@ -234,7 +236,8 @@ struct DepotWindow : Window {
 
		this->FinishInitNested(desc, tile);
 

	
 
		this->owner = GetTileOwner(tile);
 
		this->CreateDepotListWindow(type);
 
		_backup_orders_tile = 0;
 

	
 
	}
 

	
 
	~DepotWindow()
 
@@ -593,21 +596,6 @@ struct DepotWindow : Window {
 
		}
 
	}
 

	
 
	void CreateDepotListWindow(VehicleType type)
 
	{
 
		_backup_orders_tile = 0;
 

	
 
		assert(IsCompanyBuildableVehicleType(type)); // ensure that we make the call with a valid type
 

	
 
		/* Set the number of blocks in each direction */
 
		this->hscroll.SetCapacity(_resize_cap[type].width);
 
		this->vscroll.SetCapacity(_resize_cap[type].height);
 

	
 
		this->GetWidget<NWidgetCore>(DEPOT_WIDGET_MATRIX)->widget_data =
 
			(this->vscroll.GetCapacity() << MAT_ROW_START) // number of rows to draw on the background
 
			+ ((type == VEH_TRAIN ? 1 : this->hscroll.GetCapacity()) << MAT_COL_START); // number of boxes in each row. Trains always have just one
 
	}
 

	
 
	virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *resize)
 
	{
 
		switch (widget) {
src/group_gui.cpp
Show inline comments
 
@@ -208,23 +208,6 @@ public:
 
		this->vehicle_type = (VehicleType)GB(window_number, 11, 5);
 
		switch (this->vehicle_type) {
 
			default: NOT_REACHED();
 
			case VEH_TRAIN:
 
			case VEH_ROAD:
 
				this->vscroll2.SetCapacity(9);
 
				this->vscroll.SetCapacity(6);
 
				break;
 
			case VEH_SHIP:
 
			case VEH_AIRCRAFT:
 
				this->vscroll2.SetCapacity(9);
 
				this->vscroll.SetCapacity(4);
 
				break;
 
		}
 

	
 
		this->GetWidget<NWidgetCore>(GRP_WIDGET_LIST_GROUP)->widget_data = (this->vscroll2.GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
 
		this->GetWidget<NWidgetCore>(GRP_WIDGET_LIST_VEHICLE)->widget_data = (this->vscroll.GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
 

	
 
		switch (this->vehicle_type) {
 
			default: NOT_REACHED();
 
			case VEH_TRAIN:    this->sorting = &_sorting.train;    break;
 
			case VEH_ROAD:     this->sorting = &_sorting.roadveh;  break;
 
			case VEH_SHIP:     this->sorting = &_sorting.ship;     break;
src/industry_gui.cpp
Show inline comments
 
@@ -1036,7 +1036,6 @@ public:
 
		this->BuildSortIndustriesList();
 

	
 
		this->InitNested(desc, 0);
 
		this->vscroll.SetCapacity(this->GetWidget<NWidgetBase>(IDW_INDUSTRY_LIST)->current_y / this->resize.step_height);
 
	}
 

	
 
	~IndustryDirectoryWindow()
src/misc_gui.cpp
Show inline comments
 
@@ -1777,7 +1777,6 @@ public:
 
		this->FinishInitNested(desc, 0);
 

	
 
		this->LowerWidget(SLWW_DRIVES_DIRECTORIES_LIST);
 
		this->vscroll.SetCapacity(this->GetWidget<NWidgetBase>(SLWW_DRIVES_DIRECTORIES_LIST)->current_y / this->resize.step_height);
 

	
 
		/* pause is only used in single-player, non-editor mode, non-menu mode. It
 
		 * will be unpaused in the WE_DESTROY event handler. */
src/network/network_content_gui.cpp
Show inline comments
 
@@ -363,9 +363,6 @@ public:
 
		this->FilterContentList();
 
		this->SortContentList();
 
		this->InvalidateData();
 

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

	
 
	/** Free everything we allocated */
src/network/network_gui.cpp
Show inline comments
 
@@ -462,10 +462,6 @@ public:
 
		this->servers.SetSortFuncs(this->sorter_funcs);
 
		this->servers.ForceRebuild();
 
		this->SortNetworkGameList();
 

	
 
		NWidgetCore *nwi = this->GetWidget<NWidgetCore>(NGWW_MATRIX);
 
		this->vscroll.SetCapacity(nwi->current_y / this->resize.step_height);
 
		nwi->widget_data = (this->vscroll.GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
 
	}
 

	
 
	~NetworkGameWindow()
src/newgrf_gui.cpp
Show inline comments
 
@@ -262,7 +262,6 @@ public:
 

	
 
		this->BuildGrfList();
 
		this->SetWidgetDisabledState(ANGRFW_ADD, this->sel == NULL || this->sel->IsOpenTTDBaseGRF());
 
		this->vscroll.SetCapacity((this->GetWidget<NWidgetBase>(ANGRFW_GRF_LIST)->current_y - WD_FRAMERECT_TOP - WD_FRAMERECT_BOTTOM) / this->resize.step_height);
 
	}
 

	
 
	virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *resize)
src/news_gui.cpp
Show inline comments
 
@@ -922,7 +922,6 @@ struct MessageHistoryWindow : Window {
 
	MessageHistoryWindow(const WindowDesc *desc) : Window()
 
	{
 
		this->InitNested(desc); // Initializes 'this->line_height' and 'this->date_width'.
 
		this->vscroll.SetCapacity((this->GetWidget<NWidgetBase>(MHW_BACKGROUND)->current_y - this->top_spacing - this->bottom_spacing) / this->line_height);
 
		this->OnInvalidateData(0);
 
	}
 

	
src/order_gui.cpp
Show inline comments
 
@@ -677,9 +677,6 @@ public:
 
		this->selected_order = -1;
 
		this->owner = v->owner;
 

	
 
		int num_lines = (this->GetWidget<NWidgetBase>(ORDER_WIDGET_ORDER_LIST)->current_y - WD_FRAMERECT_TOP - WD_FRAMERECT_BOTTOM) / this->resize.step_height;
 
		this->vscroll.SetCapacity(num_lines);
 

	
 
		if (_settings_client.gui.quick_goto && v->owner == _local_company) {
 
			/* If there are less than 2 station, make Go To active. */
 
			int station_orders = 0;
src/settings_gui.cpp
Show inline comments
 
@@ -1464,7 +1464,6 @@ struct GameSettingsWindow : Window {
 

	
 
		this->InitNested(desc, 0);
 

	
 
		this->vscroll.SetCapacity((this->GetWidget<NWidgetBase>(SETTINGSEL_OPTIONSPANEL)->current_y - SETTINGTREE_TOP_OFFSET - SETTINGTREE_BOTTOM_OFFSET) / this->resize.step_height);
 
		this->vscroll.SetCount(_settings_main_page.Length());
 
	}
 

	
src/signs_gui.cpp
Show inline comments
 
@@ -95,8 +95,6 @@ struct SignListWindow : Window, SignList
 
	{
 
		this->InitNested(desc, window_number);
 

	
 
		this->vscroll.SetCapacity((this->GetWidget<NWidgetBase>(SLW_LIST)->current_y - WD_FRAMERECT_TOP - WD_FRAMERECT_BOTTOM) / this->resize.step_height);
 

	
 
		/* Create initial list. */
 
		this->signs.ForceRebuild();
 
		this->signs.ForceResort();
src/station_gui.cpp
Show inline comments
 
@@ -266,7 +266,6 @@ public:
 

	
 
		this->InitNested(desc, window_number);
 
		this->owner = (Owner)this->window_number;
 
		this->vscroll.SetCapacity((this->GetWidget<NWidgetBase>(SLW_LIST)->current_y - WD_FRAMERECT_TOP - WD_FRAMERECT_BOTTOM) / FONT_HEIGHT_NORMAL);
 

	
 
		for (uint i = 0; i < NUM_CARGO; i++) {
 
			const CargoSpec *cs = CargoSpec::Get(i);
 
@@ -792,8 +791,6 @@ struct StationViewWindow : public Window
 

	
 
		Owner owner = Station::Get(window_number)->owner;
 
		if (owner != OWNER_NONE) this->owner = owner;
 

	
 
		this->vscroll.SetCapacity((this->GetWidget<NWidgetBase>(SVW_WAITING)->current_y - WD_FRAMERECT_TOP - WD_FRAMERECT_BOTTOM) / this->resize.step_height);
 
	}
 

	
 
	~StationViewWindow()
 
@@ -1280,8 +1277,6 @@ struct SelectStationWindow : Window {
 
		this->CreateNestedTree(desc);
 
		this->GetWidget<NWidgetCore>(JSW_WIDGET_CAPTION)->widget_data = T::EXPECTED_FACIL == FACIL_WAYPOINT ? STR_JOIN_WAYPOINT_CAPTION : STR_JOIN_STATION_CAPTION;
 
		this->FinishInitNested(desc, 0);
 

	
 
		this->vscroll.SetCapacity((this->GetWidget<NWidgetBase>(JSW_PANEL)->current_y - WD_FRAMERECT_TOP - WD_FRAMERECT_BOTTOM) / this->resize.step_height);
 
		this->OnInvalidateData(0);
 
	}
 

	
src/subsidy_gui.cpp
Show inline comments
 
@@ -39,7 +39,6 @@ struct SubsidyListWindow : Window {
 
	{
 
		this->InitNested(desc, window_number);
 
		this->OnInvalidateData(0);
 
		this->vscroll.SetCapacity(this->GetWidget<NWidgetBase>(SLW_PANEL)->current_y / this->resize.step_height);
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
src/timetable_gui.cpp
Show inline comments
 
@@ -60,7 +60,6 @@ struct TimetableWindow : Window {
 
		this->InitNested(desc, window_number);
 
		this->owner = this->vehicle->owner;
 
		this->sel_index = -1;
 
		this->vscroll.SetCapacity((this->GetWidget<NWidgetBase>(TTV_TIMETABLE_PANEL)->current_y - WD_FRAMERECT_TOP - WD_FRAMERECT_BOTTOM) / this->resize.step_height);
 
	}
 

	
 
	virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *resize)
src/town_gui.cpp
Show inline comments
 
@@ -659,7 +659,6 @@ public:
 
		this->BuildSortTownList();
 

	
 
		this->InitNested(desc, 0);
 
		this->vscroll.SetCapacity(this->GetWidget<NWidgetBase>(TDW_CENTERTOWN)->current_y / this->resize.step_height);
 
	}
 

	
 
	~TownDirectoryWindow()
src/vehicle_gui.cpp
Show inline comments
 
@@ -298,7 +298,6 @@ struct RefitWindow : public Window {
 

	
 
		this->FinishInitNested(desc, v->index);
 
		this->owner = v->owner;
 
		this->vscroll.SetCapacity(this->GetWidget<NWidgetCore>(VRW_MATRIX)->current_y / this->resize.step_height);
 

	
 
		this->order = order;
 
		this->sel  = -1;
 
@@ -895,9 +894,6 @@ public:
 
		this->FinishInitNested(desc, window_number);
 
		this->owner = company;
 

	
 
		this->vscroll.SetCapacity(this->GetWidget<NWidgetBase>(VLW_WIDGET_LIST)->current_y / this->resize.step_height);
 
		this->GetWidget<NWidgetCore>(VLW_WIDGET_LIST)->widget_data = (this->vscroll.GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
 

	
 
		if (this->vehicle_type == VEH_TRAIN) ResizeWindow(this, 65, 0);
 
	}
 

	
 
@@ -1307,11 +1303,6 @@ struct VehicleDetailsWindow : Window {
 

	
 
		this->GetWidget<NWidgetCore>(VLD_WIDGET_RENAME_VEHICLE)->tool_tip = STR_VEHICLE_DETAILS_TRAIN_RENAME + v->type;
 

	
 
		if (v->type == VEH_TRAIN) {
 
			NWidgetCore *nwi = this->GetWidget<NWidgetCore>(VLD_WIDGET_MATRIX);
 
			this->vscroll.SetCapacity(nwi->current_y / this->resize.step_height);
 
			nwi->widget_data = (this->vscroll.GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
 
		}
 
		this->owner = v->owner;
 
		this->tab = TDW_TAB_CARGO;
 
	}
0 comments (0 inline, 0 general)