mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-06 14:27:16 +00:00
(svn r18126) -Codechange: remove duplicate (since r18119) scrollbar capacity/matrix initialisation
This commit is contained in:
parent
cb3c4f2ebe
commit
626de6b128
@ -60,9 +60,7 @@ struct AIListWindow : public Window {
|
|||||||
|
|
||||||
this->InitNested(desc); // Initializes 'this->line_height' as side effect.
|
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->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 */
|
/* Try if we can find the currently selected AI */
|
||||||
this->selected = -1;
|
this->selected = -1;
|
||||||
@ -277,9 +275,7 @@ struct AISettingsWindow : public Window {
|
|||||||
|
|
||||||
this->InitNested(desc); // Initializes 'this->line_height' as side effect.
|
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->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)
|
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->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->last_vscroll_pos = 0;
|
||||||
this->autoscroll = true;
|
this->autoscroll = true;
|
||||||
|
|
||||||
|
@ -143,13 +143,11 @@ public:
|
|||||||
this->SortBridgeList();
|
this->SortBridgeList();
|
||||||
|
|
||||||
this->vscroll.SetCount(bl->Length());
|
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.GetCapacity()) this->last_size = this->vscroll.GetCapacity();
|
||||||
if (this->last_size > this->vscroll.GetCount()) this->last_size = this->vscroll.GetCount();
|
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. */
|
/* Resize the bridge selection window if we used a bigger one the last time. */
|
||||||
if (this->last_size > this->vscroll.GetCapacity()) {
|
if (this->last_size > this->vscroll.GetCapacity()) {
|
||||||
ResizeWindow(this, 0, (this->last_size - this->vscroll.GetCapacity()) * this->resize.step_height);
|
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);
|
this->GetWidget<NWidgetCore>(BBSW_BRIDGE_LIST)->widget_data = (this->vscroll.GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
|
||||||
}
|
}
|
||||||
|
@ -225,6 +225,8 @@ struct DepotWindow : Window {
|
|||||||
|
|
||||||
DepotWindow(const WindowDesc *desc, TileIndex tile, VehicleType type) : 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->sel = INVALID_VEHICLE;
|
||||||
this->generate_list = true;
|
this->generate_list = true;
|
||||||
this->type = type;
|
this->type = type;
|
||||||
@ -234,7 +236,8 @@ struct DepotWindow : Window {
|
|||||||
this->FinishInitNested(desc, tile);
|
this->FinishInitNested(desc, tile);
|
||||||
|
|
||||||
this->owner = GetTileOwner(tile);
|
this->owner = GetTileOwner(tile);
|
||||||
this->CreateDepotListWindow(type);
|
_backup_orders_tile = 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
~DepotWindow()
|
~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)
|
virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *resize)
|
||||||
{
|
{
|
||||||
switch (widget) {
|
switch (widget) {
|
||||||
|
@ -206,23 +206,6 @@ public:
|
|||||||
this->CreateNestedTree(desc);
|
this->CreateNestedTree(desc);
|
||||||
|
|
||||||
this->vehicle_type = (VehicleType)GB(window_number, 11, 5);
|
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) {
|
switch (this->vehicle_type) {
|
||||||
default: NOT_REACHED();
|
default: NOT_REACHED();
|
||||||
case VEH_TRAIN: this->sorting = &_sorting.train; break;
|
case VEH_TRAIN: this->sorting = &_sorting.train; break;
|
||||||
|
@ -1036,7 +1036,6 @@ public:
|
|||||||
this->BuildSortIndustriesList();
|
this->BuildSortIndustriesList();
|
||||||
|
|
||||||
this->InitNested(desc, 0);
|
this->InitNested(desc, 0);
|
||||||
this->vscroll.SetCapacity(this->GetWidget<NWidgetBase>(IDW_INDUSTRY_LIST)->current_y / this->resize.step_height);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
~IndustryDirectoryWindow()
|
~IndustryDirectoryWindow()
|
||||||
|
@ -1777,7 +1777,6 @@ public:
|
|||||||
this->FinishInitNested(desc, 0);
|
this->FinishInitNested(desc, 0);
|
||||||
|
|
||||||
this->LowerWidget(SLWW_DRIVES_DIRECTORIES_LIST);
|
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
|
/* pause is only used in single-player, non-editor mode, non-menu mode. It
|
||||||
* will be unpaused in the WE_DESTROY event handler. */
|
* will be unpaused in the WE_DESTROY event handler. */
|
||||||
|
@ -363,9 +363,6 @@ public:
|
|||||||
this->FilterContentList();
|
this->FilterContentList();
|
||||||
this->SortContentList();
|
this->SortContentList();
|
||||||
this->InvalidateData();
|
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 */
|
/** Free everything we allocated */
|
||||||
|
@ -462,10 +462,6 @@ public:
|
|||||||
this->servers.SetSortFuncs(this->sorter_funcs);
|
this->servers.SetSortFuncs(this->sorter_funcs);
|
||||||
this->servers.ForceRebuild();
|
this->servers.ForceRebuild();
|
||||||
this->SortNetworkGameList();
|
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()
|
~NetworkGameWindow()
|
||||||
|
@ -262,7 +262,6 @@ public:
|
|||||||
|
|
||||||
this->BuildGrfList();
|
this->BuildGrfList();
|
||||||
this->SetWidgetDisabledState(ANGRFW_ADD, this->sel == NULL || this->sel->IsOpenTTDBaseGRF());
|
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)
|
virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *resize)
|
||||||
|
@ -922,7 +922,6 @@ struct MessageHistoryWindow : Window {
|
|||||||
MessageHistoryWindow(const WindowDesc *desc) : Window()
|
MessageHistoryWindow(const WindowDesc *desc) : Window()
|
||||||
{
|
{
|
||||||
this->InitNested(desc); // Initializes 'this->line_height' and 'this->date_width'.
|
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);
|
this->OnInvalidateData(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -677,9 +677,6 @@ public:
|
|||||||
this->selected_order = -1;
|
this->selected_order = -1;
|
||||||
this->owner = v->owner;
|
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 (_settings_client.gui.quick_goto && v->owner == _local_company) {
|
||||||
/* If there are less than 2 station, make Go To active. */
|
/* If there are less than 2 station, make Go To active. */
|
||||||
int station_orders = 0;
|
int station_orders = 0;
|
||||||
|
@ -1464,7 +1464,6 @@ struct GameSettingsWindow : Window {
|
|||||||
|
|
||||||
this->InitNested(desc, 0);
|
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());
|
this->vscroll.SetCount(_settings_main_page.Length());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,8 +95,6 @@ struct SignListWindow : Window, SignList {
|
|||||||
{
|
{
|
||||||
this->InitNested(desc, window_number);
|
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. */
|
/* Create initial list. */
|
||||||
this->signs.ForceRebuild();
|
this->signs.ForceRebuild();
|
||||||
this->signs.ForceResort();
|
this->signs.ForceResort();
|
||||||
|
@ -266,7 +266,6 @@ public:
|
|||||||
|
|
||||||
this->InitNested(desc, window_number);
|
this->InitNested(desc, window_number);
|
||||||
this->owner = (Owner)this->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++) {
|
for (uint i = 0; i < NUM_CARGO; i++) {
|
||||||
const CargoSpec *cs = CargoSpec::Get(i);
|
const CargoSpec *cs = CargoSpec::Get(i);
|
||||||
@ -792,8 +791,6 @@ struct StationViewWindow : public Window {
|
|||||||
|
|
||||||
Owner owner = Station::Get(window_number)->owner;
|
Owner owner = Station::Get(window_number)->owner;
|
||||||
if (owner != OWNER_NONE) this->owner = 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()
|
~StationViewWindow()
|
||||||
@ -1280,8 +1277,6 @@ struct SelectStationWindow : Window {
|
|||||||
this->CreateNestedTree(desc);
|
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->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->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);
|
this->OnInvalidateData(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,7 +39,6 @@ struct SubsidyListWindow : Window {
|
|||||||
{
|
{
|
||||||
this->InitNested(desc, window_number);
|
this->InitNested(desc, window_number);
|
||||||
this->OnInvalidateData(0);
|
this->OnInvalidateData(0);
|
||||||
this->vscroll.SetCapacity(this->GetWidget<NWidgetBase>(SLW_PANEL)->current_y / this->resize.step_height);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void OnClick(Point pt, int widget)
|
virtual void OnClick(Point pt, int widget)
|
||||||
|
@ -60,7 +60,6 @@ struct TimetableWindow : Window {
|
|||||||
this->InitNested(desc, window_number);
|
this->InitNested(desc, window_number);
|
||||||
this->owner = this->vehicle->owner;
|
this->owner = this->vehicle->owner;
|
||||||
this->sel_index = -1;
|
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)
|
virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *resize)
|
||||||
|
@ -659,7 +659,6 @@ public:
|
|||||||
this->BuildSortTownList();
|
this->BuildSortTownList();
|
||||||
|
|
||||||
this->InitNested(desc, 0);
|
this->InitNested(desc, 0);
|
||||||
this->vscroll.SetCapacity(this->GetWidget<NWidgetBase>(TDW_CENTERTOWN)->current_y / this->resize.step_height);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
~TownDirectoryWindow()
|
~TownDirectoryWindow()
|
||||||
|
@ -298,7 +298,6 @@ struct RefitWindow : public Window {
|
|||||||
|
|
||||||
this->FinishInitNested(desc, v->index);
|
this->FinishInitNested(desc, v->index);
|
||||||
this->owner = v->owner;
|
this->owner = v->owner;
|
||||||
this->vscroll.SetCapacity(this->GetWidget<NWidgetCore>(VRW_MATRIX)->current_y / this->resize.step_height);
|
|
||||||
|
|
||||||
this->order = order;
|
this->order = order;
|
||||||
this->sel = -1;
|
this->sel = -1;
|
||||||
@ -895,9 +894,6 @@ public:
|
|||||||
this->FinishInitNested(desc, window_number);
|
this->FinishInitNested(desc, window_number);
|
||||||
this->owner = company;
|
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);
|
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;
|
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->owner = v->owner;
|
||||||
this->tab = TDW_TAB_CARGO;
|
this->tab = TDW_TAB_CARGO;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user