Change: Unify station/waypoint/roadstop/object build-picker window code.

These windows now share a common code base for choosing and display class and types.

An additional text filter is added to search types by name instead of just classes.
This commit is contained in:
Peter Nelson
2024-05-07 12:13:48 +01:00
committed by Peter Nelson
parent d2c8b476b5
commit cdc356e7bf
16 changed files with 1261 additions and 1691 deletions
+1
View File
@@ -39,6 +39,7 @@ add_files(
object_widget.h
order_widget.h
osk_widget.h
picker_widget.h
rail_widget.h
road_widget.h
screenshot_widget.h
-8
View File
@@ -12,18 +12,10 @@
/** Widgets of the #BuildObjectWindow class. */
enum BuildObjectWidgets : WidgetID {
WID_BO_FILTER, ///< The filter text box for the object list.
WID_BO_CLASS_LIST, ///< The list with classes.
WID_BO_SCROLLBAR, ///< The scrollbar associated with the list.
WID_BO_OBJECT_MATRIX, ///< The matrix with preview sprites.
WID_BO_OBJECT_SPRITE, ///< A preview sprite of the object.
WID_BO_OBJECT_NAME, ///< The name of the selected object.
WID_BO_OBJECT_SIZE, ///< The size of the selected object.
WID_BO_INFO, ///< Other information about the object (from the NewGRF).
WID_BO_SELECT_MATRIX, ///< Selection preview matrix of objects of a given class.
WID_BO_SELECT_IMAGE, ///< Preview image in the #WID_BO_SELECT_MATRIX.
WID_BO_SELECT_SCROLL, ///< Scrollbar next to the #WID_BO_SELECT_MATRIX.
};
#endif /* WIDGETS_OBJECT_WIDGET_H */
+31
View File
@@ -0,0 +1,31 @@
/*
* This file is part of OpenTTD.
* OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
* OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
*/
/** @file picker_widget.h Types related to the picker widgets. */
#ifndef WIDGETS_PICKER_WIDGET_H
#define WIDGETS_PICKER_WIDGET_H
/** Widgets of the #PickerWindow class. */
enum PickerClassWindowWidgets : WidgetID {
WID_PW_START = 1 << 16, ///< Dummy to ensure widgets don't overlap.
WID_PW_CLASS_SEL, ///< Stack to hide the class picker.
WID_PW_CLASS_FILTER, ///< Editbox filter.
WID_PW_CLASS_LIST, ///< List of classes.
WID_PW_CLASS_SCROLL, ///< Scrollbar for list of classes.
WID_PW_TYPE_SEL, ///< Stack to hide the type picker.
WID_PW_TYPE_FILTER, ///< Text filter.
WID_PW_TYPE_MATRIX, ///< Matrix with items.
WID_PW_TYPE_ITEM, ///< A single item.
WID_PW_TYPE_SCROLL, ///< Scrollbar for the matrix.
WID_PW_TYPE_NAME, ///< Name of selected item.
WID_PW_TYPE_RESIZE, ///< Type resize handle.
};
#endif /* WIDGETS_PICKER_WIDGET_H */
-14
View File
@@ -60,20 +60,6 @@ enum BuildRailStationWidgets : WidgetID {
WID_BRAS_HIGHLIGHT_ON, ///< Button for turning coverage highlighting on.
WID_BRAS_COVERAGE_TEXTS, ///< Empty space for the coverage texts.
WID_BRAS_MATRIX, ///< Matrix widget displaying the available stations.
WID_BRAS_IMAGE, ///< Panel used at each cell of the matrix.
WID_BRAS_MATRIX_SCROLL, ///< Scrollbar of the matrix widget.
WID_BRAS_FILTER_CONTAINER, ///< Container for the filter text box for the station class list.
WID_BRAS_FILTER_EDITBOX, ///< Filter text box for the station class list.
WID_BRAS_SHOW_NEWST_DEFSIZE, ///< Selection for default-size button for newstation.
WID_BRAS_SHOW_NEWST_ADDITIONS, ///< Selection for newstation class selection list.
WID_BRAS_SHOW_NEWST_MATRIX, ///< Selection for newstation image matrix.
WID_BRAS_SHOW_NEWST_RESIZE, ///< Selection for panel and resize at bottom right for newstation.
WID_BRAS_SHOW_NEWST_TYPE, ///< Display of selected station type.
WID_BRAS_NEWST_LIST, ///< List with available newstation classes.
WID_BRAS_NEWST_SCROLL, ///< Scrollbar of the #WID_BRAS_NEWST_LIST.
WID_BRAS_PLATFORM_NUM_BEGIN = WID_BRAS_PLATFORM_NUM_1 - 1, ///< Helper for determining the chosen platform width.
WID_BRAS_PLATFORM_LEN_BEGIN = WID_BRAS_PLATFORM_LEN_1 - 1, ///< Helper for determining the chosen platform length.
};
-14
View File
@@ -53,21 +53,7 @@ enum BuildRoadStationWidgets : WidgetID {
WID_BROS_LT_OFF, ///< Turn off area highlight.
WID_BROS_LT_ON, ///< Turn on area highlight.
WID_BROS_ACCEPTANCE, ///< Station acceptance info.
WID_BROS_MATRIX, ///< Matrix widget displaying all available road stops.
WID_BROS_IMAGE, ///< Panel used for each image of the matrix.
WID_BROS_MATRIX_SCROLL, ///< Scrollbar of the #WID_BROS_SHOW_NEWST_ADDITIONS.
WID_BROS_FILTER_CONTAINER, ///< Container for the filter text box for the road stop class list.
WID_BROS_FILTER_EDITBOX, ///< Filter text box for the road stop class list.
WID_BROS_AVAILABLE_ORIENTATIONS, ///< Selection for selecting 6 or 2 orientations.
WID_BROS_SHOW_NEWST_DEFSIZE, ///< Selection for default-size button for new road stops.
WID_BROS_SHOW_NEWST_ADDITIONS, ///< Selection for new class selection list.
WID_BROS_SHOW_NEWST_MATRIX, ///< Selection for new stop image matrix.
WID_BROS_SHOW_NEWST_RESIZE, ///< Selection for panel and resize at bottom right for new stops.
WID_BROS_SHOW_NEWST_ORIENTATION, ///< Selection for the orientation string for new stops.
WID_BROS_SHOW_NEWST_TYPE_SEL, ///< Selection for the type name.
WID_BROS_SHOW_NEWST_TYPE, ///< Display of selected stop type.
WID_BROS_NEWST_LIST, ///< List with new road stops.
WID_BROS_NEWST_SCROLL, ///< Scrollbar of the #WID_BROS_NEWST_LIST.
};
#endif /* WIDGETS_ROAD_WIDGET_H */