mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-12 10:30:28 +00:00
(svn r25539) -Codechange: Setup object GUI matrix before restoring selected object, so that the matrix state can be properly set. (sbr)
This commit is contained in:
parent
bcb0e04bf2
commit
d798766f2e
@ -81,6 +81,10 @@ public:
|
|||||||
this->vscroll->SetPosition(0);
|
this->vscroll->SetPosition(0);
|
||||||
this->vscroll->SetCount(ObjectClass::GetUIClassCount());
|
this->vscroll->SetCount(ObjectClass::GetUIClassCount());
|
||||||
|
|
||||||
|
NWidgetMatrix *matrix = this->GetWidget<NWidgetMatrix>(WID_BO_SELECT_MATRIX);
|
||||||
|
matrix->SetScrollbar(this->GetScrollbar(WID_BO_SELECT_SCROLL));
|
||||||
|
matrix->SetCount(ObjectClass::Get(_selected_object_class)->GetUISpecCount());
|
||||||
|
|
||||||
if (this->CanRestoreSelectedObject()) {
|
if (this->CanRestoreSelectedObject()) {
|
||||||
this->SelectOtherObject(_selected_object_index);
|
this->SelectOtherObject(_selected_object_index);
|
||||||
} else {
|
} else {
|
||||||
@ -90,10 +94,6 @@ public:
|
|||||||
this->EnsureSelectedObjectClassIsVisible();
|
this->EnsureSelectedObjectClassIsVisible();
|
||||||
this->GetWidget<NWidgetMatrix>(WID_BO_OBJECT_MATRIX)->SetCount(4);
|
this->GetWidget<NWidgetMatrix>(WID_BO_OBJECT_MATRIX)->SetCount(4);
|
||||||
|
|
||||||
NWidgetMatrix *matrix = this->GetWidget<NWidgetMatrix>(WID_BO_SELECT_MATRIX);
|
|
||||||
matrix->SetScrollbar(this->GetScrollbar(WID_BO_SELECT_SCROLL));
|
|
||||||
matrix->SetCount(ObjectClass::Get(_selected_object_class)->GetUISpecCount());
|
|
||||||
|
|
||||||
/* If needed restore the window previous size with the stored values.*/
|
/* If needed restore the window previous size with the stored values.*/
|
||||||
uint default_num_cols = this->GetMatrixColumnCount();
|
uint default_num_cols = this->GetMatrixColumnCount();
|
||||||
uint default_num_rows = this->vscroll->GetCapacity();
|
uint default_num_rows = this->vscroll->GetCapacity();
|
||||||
@ -106,8 +106,6 @@ public:
|
|||||||
* matrix columns are visible. */
|
* matrix columns are visible. */
|
||||||
this->FindWindowPlacementAndResize(this->width, this->height);
|
this->FindWindowPlacementAndResize(this->width, this->height);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_selected_object_index != -1) matrix->SetClicked(ObjectClass::Get(_selected_object_class)->GetUIFromIndex(_selected_object_index));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ~BuildObjectWindow()
|
virtual ~BuildObjectWindow()
|
||||||
@ -424,6 +422,7 @@ public:
|
|||||||
const ObjectSpec *spec = objclass->GetSpec(i);
|
const ObjectSpec *spec = objclass->GetSpec(i);
|
||||||
if (spec->IsAvailable()) {
|
if (spec->IsAvailable()) {
|
||||||
_selected_object_class = j;
|
_selected_object_class = j;
|
||||||
|
this->GetWidget<NWidgetMatrix>(WID_BO_SELECT_MATRIX)->SetCount(ObjectClass::Get(_selected_object_class)->GetUISpecCount());
|
||||||
this->SelectOtherObject(i);
|
this->SelectOtherObject(i);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user