diff options
author | rubidium <rubidium@openttd.org> | 2009-11-16 20:34:57 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-11-16 20:34:57 +0000 |
commit | 626de6b128f3580c9559b2d09b15bb4ed314a20a (patch) | |
tree | 93239d913d9ad578483f4e7cbd42e76427bcf7a5 /src | |
parent | cb3c4f2ebe01b91562ecf21b56742e31b4086d91 (diff) | |
download | openttd-626de6b128f3580c9559b2d09b15bb4ed314a20a.tar.xz |
(svn r18126) -Codechange: remove duplicate (since r18119) scrollbar capacity/matrix initialisation
Diffstat (limited to 'src')
-rw-r--r-- | src/ai/ai_gui.cpp | 6 | ||||
-rw-r--r-- | src/bridge_gui.cpp | 2 | ||||
-rw-r--r-- | src/depot_gui.cpp | 20 | ||||
-rw-r--r-- | src/group_gui.cpp | 17 | ||||
-rw-r--r-- | src/industry_gui.cpp | 1 | ||||
-rw-r--r-- | src/misc_gui.cpp | 1 | ||||
-rw-r--r-- | src/network/network_content_gui.cpp | 3 | ||||
-rw-r--r-- | src/network/network_gui.cpp | 4 | ||||
-rw-r--r-- | src/newgrf_gui.cpp | 1 | ||||
-rw-r--r-- | src/news_gui.cpp | 1 | ||||
-rw-r--r-- | src/order_gui.cpp | 3 | ||||
-rw-r--r-- | src/settings_gui.cpp | 1 | ||||
-rw-r--r-- | src/signs_gui.cpp | 2 | ||||
-rw-r--r-- | src/station_gui.cpp | 5 | ||||
-rw-r--r-- | src/subsidy_gui.cpp | 1 | ||||
-rw-r--r-- | src/timetable_gui.cpp | 1 | ||||
-rw-r--r-- | src/town_gui.cpp | 1 | ||||
-rw-r--r-- | src/vehicle_gui.cpp | 9 |
18 files changed, 4 insertions, 75 deletions
diff --git a/src/ai/ai_gui.cpp b/src/ai/ai_gui.cpp index aa51f568c..d316a011a 100644 --- a/src/ai/ai_gui.cpp +++ b/src/ai/ai_gui.cpp @@ -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; diff --git a/src/bridge_gui.cpp b/src/bridge_gui.cpp index 0f30cb423..73359d8e9 100644 --- a/src/bridge_gui.cpp +++ b/src/bridge_gui.cpp @@ -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); } diff --git a/src/depot_gui.cpp b/src/depot_gui.cpp index 4b06bc576..a55f4c8a3 100644 --- a/src/depot_gui.cpp +++ b/src/depot_gui.cpp @@ -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) { diff --git a/src/group_gui.cpp b/src/group_gui.cpp index bf5e55320..58b516bb2 100644 --- a/src/group_gui.cpp +++ b/src/group_gui.cpp @@ -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; diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp index 37563de68..9173cc11c 100644 --- a/src/industry_gui.cpp +++ b/src/industry_gui.cpp @@ -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() diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp index 28c209013..11ef35b5c 100644 --- a/src/misc_gui.cpp +++ b/src/misc_gui.cpp @@ -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. */ diff --git a/src/network/network_content_gui.cpp b/src/network/network_content_gui.cpp index 06ed8a047..ca706330c 100644 --- a/src/network/network_content_gui.cpp +++ b/src/network/network_content_gui.cpp @@ -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 */ diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp index 4e6bcead1..434fdb6d7 100644 --- a/src/network/network_gui.cpp +++ b/src/network/network_gui.cpp @@ -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() diff --git a/src/newgrf_gui.cpp b/src/newgrf_gui.cpp index 7980733b2..53348f0e7 100644 --- a/src/newgrf_gui.cpp +++ b/src/newgrf_gui.cpp @@ -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) diff --git a/src/news_gui.cpp b/src/news_gui.cpp index 55aec1c22..ba6cf2059 100644 --- a/src/news_gui.cpp +++ b/src/news_gui.cpp @@ -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); } diff --git a/src/order_gui.cpp b/src/order_gui.cpp index 36f5dba41..1cb88c346 100644 --- a/src/order_gui.cpp +++ b/src/order_gui.cpp @@ -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; diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp index 3849d53dc..b65770cbd 100644 --- a/src/settings_gui.cpp +++ b/src/settings_gui.cpp @@ -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()); } diff --git a/src/signs_gui.cpp b/src/signs_gui.cpp index 212e7f5b0..412f43260 100644 --- a/src/signs_gui.cpp +++ b/src/signs_gui.cpp @@ -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(); diff --git a/src/station_gui.cpp b/src/station_gui.cpp index f9b304593..d3974523e 100644 --- a/src/station_gui.cpp +++ b/src/station_gui.cpp @@ -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); } diff --git a/src/subsidy_gui.cpp b/src/subsidy_gui.cpp index 6cbae2da0..da41901e2 100644 --- a/src/subsidy_gui.cpp +++ b/src/subsidy_gui.cpp @@ -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) diff --git a/src/timetable_gui.cpp b/src/timetable_gui.cpp index fe19a27e4..fff8325b0 100644 --- a/src/timetable_gui.cpp +++ b/src/timetable_gui.cpp @@ -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) diff --git a/src/town_gui.cpp b/src/town_gui.cpp index 2e60e5704..fa36382af 100644 --- a/src/town_gui.cpp +++ b/src/town_gui.cpp @@ -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() diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp index 63a944c14..627d85871 100644 --- a/src/vehicle_gui.cpp +++ b/src/vehicle_gui.cpp @@ -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; } |