FS#5503 - BuildObjectWindow: ensure selected object visibility / restore previously selected object

Attached to Project: OpenTTD
Opened by Sébastien Brissaud (sbr) - Friday, 15 March 2013, 08:05 GMT
Last edited by Alberth (Alberth) - Friday, 24 May 2013, 19:24 GMT
Type Patch
Category Interface
Status Closed
Assigned To No-one
Operating System All
Severity Low
Priority Normal
Reported Version trunk
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


The first patch ensure that the selected object class is visible in the class selection matrix.
The second patch restore the selected object when reopening the window.
The third patch ensure that the selected object is visible in the object selection matrix.

Please find attached these three patches against r25086.
This task depends upon

Closed by  Alberth (Alberth)
Friday, 24 May 2013, 19:24 GMT
Reason for closing:  Implemented
Comment by Sébastien Brissaud (sbr) - Saturday, 16 March 2013, 16:38 GMT
-Change: move new methods inside private scope of BuildObjectWindow.
-Fix: clear unsigned-signed comparison warning.
-Fix: compare spec index with SpecCount not with UiSpecCount.
-Fix: tests if an object is selected before trying to make it visible.

Please find attached these three patches against r25087.
Comment by Alberth (Alberth) - Wednesday, 08 May 2013, 18:22 GMT
Suggestion: also restore the width of the matrix?
(Drag the object window so the matrix has several columns, select the 'bomb' to delete an object, re-select the object window, and you're back to a single column of objects.)
Comment by Sébastien Brissaud (sbr) - Thursday, 09 May 2013, 09:51 GMT
I have an old unpublished patch that restore the size of BuildRailStationWindow (by storing the count of rows/columns of the matrix).
I'll update it and also adapt it to the BuildObjectWindow; these two windows could benefit from this functionality.
Comment by Sébastien Brissaud (sbr) - Saturday, 18 May 2013, 10:43 GMT
The first three patches are bumped to r25246.
The fourth patch restore the previous size of the BuildObjectWindow. The window dimension aren't stored in pixels. It's the number of row of the classes list and the number of columns of the types matrix that are stored. This allow to recompute the size of the window by taking in account the font size.

Please find attached these four patches against r25246.
Comment by Alberth (Alberth) - Friday, 24 May 2013, 19:23 GMT
Thrown in trunk r25281-r25284

- Fixed some bits in the Doxygen comments,
- 01 had a space behind the cast, and the "<" of the object test should be "<=" (counts are one bigger than the largest index),
- 03 was simplified a lot, and added prevention in reducing the window in size (if one dimension was larger but the other one was smaller).

thanks for the patches. Eye-candy players will like it a lot.