@@ -205,7 +205,7 @@ struct AIListWindow : public Window {
virtual void OnResize(Point delta)
{
this->vscroll.UpdateCapacity(delta.y / this->line_height);
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);
}
};
@@ -401,7 +401,7 @@ struct AISettingsWindow : public Window
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);
@@ -662,8 +662,6 @@ struct AIDebugWindow : public Window {
AIDebugWindow(const WindowDesc *desc, WindowNumber number) : Window()
this->vscroll.SetCapacity(14); // Minimal number of lines in the log panel.
this->InitNested(desc, number);
/* Disable the companies who are not active or not an AI */
for (CompanyID i = COMPANY_FIRST; i < MAX_COMPANIES; i++) {
@@ -671,6 +669,8 @@ 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;
@@ -681,7 +681,7 @@ struct AIDebugWindow : public Window {
if (widget == AID_WIDGET_LOG_PANEL) {
resize->height = FONT_HEIGHT_NORMAL + WD_PAR_VSEP_NORMAL;
size->height = this->vscroll.GetCapacity() * resize->height + this->top_offset + this->bottom_offset;
size->height = 14 * resize->height + this->top_offset + this->bottom_offset;
@@ -878,7 +878,7 @@ struct AIDebugWindow : public Window {
this->vscroll.UpdateCapacity(delta.y / (int)this->resize.step_height);
@@ -284,7 +284,7 @@ public:
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);
this->last_size = max(this->vscroll.GetCapacity(), this->last_size);
@@ -1177,7 +1177,7 @@ struct BuildVehicleWindow : Window {
if (delta.y == 0) return;
this->vscroll.UpdateCapacity(delta.y / (int)GetVehicleListHeight(this->vehicle_type));
this->vscroll.SetCapacity((this->widget[BUILD_VEHICLE_WIDGET_LIST].bottom - this->widget[BUILD_VEHICLE_WIDGET_LIST].top + 1) / GetVehicleListHeight(this->vehicle_type));
this->widget[BUILD_VEHICLE_WIDGET_LIST].data = (this->vscroll.GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
@@ -906,8 +906,8 @@ struct DepotWindow : Window {
this->hscroll.UpdateCapacity(delta.x / (int)this->resize.step_width);
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);
this->GetWidget<NWidgetCore>(DEPOT_WIDGET_MATRIX)->widget_data = (this->vscroll.GetCapacity() << MAT_ROW_START) +
((this->type == VEH_TRAIN ? 1 : this->hscroll.GetCapacity()) << MAT_COL_START);
@@ -614,10 +614,10 @@ public:
this->vscroll2.UpdateCapacity(delta.y / PLY_WND_PRC__SIZE_OF_ROW_TINY);
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);
this->vscroll.SetCapacity((this->widget[GRP_WIDGET_LIST_VEHICLE].bottom - this->widget[GRP_WIDGET_LIST_VEHICLE].top + 1) / this->resize.step_height);
this->widget[GRP_WIDGET_LIST_VEHICLE].data = (this->vscroll.GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
@@ -361,7 +361,7 @@ public:
/* 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);
this->widget[DPIW_MATRIX_WIDGET].data = (this->vscroll.GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
@@ -1050,7 +1050,7 @@ public:
this->vscroll.SetCapacity(this->GetWidget<NWidgetBase>(IDW_INDUSTRY_LIST)->current_y / this->resize.step_height);
virtual void OnHundredthTick()
@@ -1857,7 +1857,7 @@ public:
case SLD_LOAD_SCENARIO:
case SLD_LOAD_HEIGHTMAP:
this->vscroll.UpdateCapacity(-1);
this->vscroll.SetCapacity(this->vscroll.GetCapacity() - 1);
case SLD_SAVE_GAME: this->GenerateFileName(); break;
case SLD_SAVE_SCENARIO: strecpy(this->edit_str_buf, "UNNAMED", &this->edit_str_buf[edit_str_size - 1]); break;
@@ -1974,7 +1974,7 @@ public:
break;
case SLWW_DRIVES_DIRECTORIES_LIST: { // Click the listbox
int y = (pt.y - this->widget[widget].top - 1) / 10;
int y = (pt.y - this->widget[SLWW_DRIVES_DIRECTORIES_LIST].top - 1) / 10;
if (y < 0 || (y += this->vscroll.GetPosition()) >= this->vscroll.GetCount()) return;
@@ -2092,7 +2092,7 @@ public:
this->widget[SLWW_SAVE_GAME].left += diff;
this->vscroll.UpdateCapacity(delta.y / 10);
this->vscroll.SetCapacity((this->widget[SLWW_DRIVES_DIRECTORIES_LIST].bottom - this->widget[SLWW_DRIVES_DIRECTORIES_LIST].top + 1) / 10);
virtual void OnInvalidateData(int data)
@@ -692,7 +692,7 @@ public:
this->vscroll.SetCapacity((this->widget[NCLWW_MATRIX].bottom - this->widget[NCLWW_MATRIX].top + 1) / this->resize.step_height);
this->widget[NCLWW_MATRIX].data = (this->vscroll.GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
/* Make the matrix and details section grow both bigger (or smaller) */
@@ -714,7 +714,7 @@ public:
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);
/* Additional colums in server list */
@@ -281,7 +281,7 @@ public:
this->vscroll.SetCapacity(this->GetWidget<NWidgetBase>(ANGRFW_GRF_LIST)->current_y / this->resize.step_height);
virtual void OnPaint()
@@ -610,7 +610,7 @@ struct NewGRFWindow : public Window {
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);
@@ -993,7 +993,7 @@ struct MessageHistoryWindow : Window {
this->vscroll.SetCapacity(this->GetWidget<NWidgetBase>(MHW_BACKGROUND)->current_y / this->line_height);
@@ -1268,8 +1268,8 @@ public:
/* Update the scroll + matrix */
/* Update the scroll bar */
this->vscroll.SetCapacity(this->GetWidget<NWidgetBase>(ORDER_WIDGET_ORDER_LIST)->current_y / this->resize.step_height);
virtual void OnTimeout()
@@ -1625,7 +1625,7 @@ struct GameSettingsWindow : Window {
this->vscroll.UpdateCapacity(delta.y / SETTING_HEIGHT);
this->vscroll.SetCapacity((this->widget[SETTINGSEL_OPTIONSPANEL].bottom - this->widget[SETTINGSEL_OPTIONSPANEL].top - 8) / SETTING_HEIGHT);
@@ -157,7 +157,7 @@ struct SignListWindow : Window, SignList
this->vscroll.SetCapacity((this->GetWidget<NWidgetBase>(SLW_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)
@@ -566,7 +566,7 @@ public:
this->vscroll.SetCapacity((this->widget[SLW_LIST].bottom - this->widget[SLW_LIST].top + 1) / 10);
@@ -1052,7 +1052,7 @@ struct StationViewWindow : public Window
if (delta.x != 0) ResizeButtons(this, SVW_LOCATION, SVW_RENAME);
this->vscroll.SetCapacity((this->widget[SVW_WAITING].bottom - this->widget[SVW_WAITING].top + 1) / this->resize.step_height);
@@ -1296,7 +1296,7 @@ struct SelectStationWindow : Window {
this->vscroll.SetCapacity((this->GetWidget<NWidgetBase>(JSW_PANEL)->current_y - WD_FRAMERECT_TOP - WD_FRAMERECT_BOTTOM) / this->resize.step_height);
@@ -222,7 +222,7 @@ struct SubsidyListWindow : Window {
this->vscroll.SetCapacity(this->GetWidget<NWidgetBase>(SLW_PANEL)->current_y / this->resize.step_height);
@@ -333,8 +333,8 @@ struct TimetableWindow : Window {
this->vscroll.SetCapacity((this->widget[TTV_TIMETABLE_PANEL].bottom - this->widget[TTV_TIMETABLE_PANEL].top + 1) / this->resize.step_height);
@@ -659,7 +659,7 @@ public:
this->BuildSortTownList();
this->InitNested(desc, 0);
this->vscroll.SetCapacity(this->GetWidget<NWidgetBase>(TDW_CENTERTOWN)->current_y / (int)this->resize.step_height);
this->vscroll.SetCapacity(this->GetWidget<NWidgetBase>(TDW_CENTERTOWN)->current_y / this->resize.step_height);
~TownDirectoryWindow()
@@ -803,7 +803,7 @@ public:
@@ -389,7 +389,7 @@ struct RefitWindow : public Window {
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);
@@ -1105,7 +1105,7 @@ struct VehicleListWindow : public BaseVe
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);
@@ -1501,7 +1501,7 @@ struct VehicleDetailsWindow : Window {
if (delta.x != 0) ResizeButtons(this, VLD_WIDGET_DETAILS_CARGO_CARRIED, VLD_WIDGET_DETAILS_TOTAL_CARGO);
this->vscroll.UpdateCapacity(delta.y / 14);
this->vscroll.SetCapacity((this->widget[VLD_WIDGET_MIDDLE_DETAILS].bottom - this->widget[VLD_WIDGET_MIDDLE_DETAILS].top + 1) / 14);
this->widget[VLD_WIDGET_MIDDLE_DETAILS].data = (this->vscroll.GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
@@ -258,17 +258,6 @@ public:
/**
* Updates the capacity by adding/removing a number of (visible) elements.
* @param difference the difference in capacity
* @note updates the position if needed
*/
void UpdateCapacity(int difference)
if (difference == 0) return;
this->SetCapacity(this->cap + difference);
* Sets the position of the first visible element
* @param position the position of the element
Status change: