mirror of https://github.com/OpenRCT2/OpenRCT2.git
Rename DROPDOWN_HEIGHT to kDropdownHeight
This commit is contained in:
parent
9fa917ae57
commit
b294d97f03
|
@ -52,7 +52,7 @@ static Widget WindowAssetPacksWidgets[] = {
|
|||
class AssetPacksWindow final : public Window
|
||||
{
|
||||
private:
|
||||
static constexpr int32_t ItemHeight = kScrollableRowHeight + 1;
|
||||
static constexpr int32_t ItemHeight = SCROLLABLE_ROW_HEIGHT + 1;
|
||||
static constexpr int32_t ItemCheckBoxSize = ItemHeight - 3;
|
||||
std::optional<size_t> _highlightedIndex;
|
||||
std::optional<size_t> _selectedIndex;
|
||||
|
|
|
@ -230,11 +230,11 @@ static Widget _inventionListDragWidgets[] = {
|
|||
ScreenSize size{};
|
||||
if (scrollIndex == 0)
|
||||
{
|
||||
size.height = static_cast<int32_t>(gameState.ResearchItemsInvented.size()) * kScrollableRowHeight;
|
||||
size.height = static_cast<int32_t>(gameState.ResearchItemsInvented.size()) * SCROLLABLE_ROW_HEIGHT;
|
||||
}
|
||||
else
|
||||
{
|
||||
size.height = static_cast<int32_t>(gameState.ResearchItemsUninvented.size()) * kScrollableRowHeight;
|
||||
size.height = static_cast<int32_t>(gameState.ResearchItemsUninvented.size()) * SCROLLABLE_ROW_HEIGHT;
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
@ -279,14 +279,14 @@ static Widget _inventionListDragWidgets[] = {
|
|||
GfxClear(dpi, paletteIndex);
|
||||
|
||||
int16_t boxWidth = widgets[WIDX_RESEARCH_ORDER_SCROLL].width();
|
||||
int32_t itemY = -kScrollableRowHeight;
|
||||
int32_t itemY = -SCROLLABLE_ROW_HEIGHT;
|
||||
auto* dragItem = WindowEditorInventionsListDragGetItem();
|
||||
|
||||
const auto& researchList = scrollIndex == 0 ? gameState.ResearchItemsInvented : gameState.ResearchItemsUninvented;
|
||||
for (const auto& researchItem : researchList)
|
||||
{
|
||||
itemY += kScrollableRowHeight;
|
||||
if (itemY + kScrollableRowHeight < dpi.y || itemY >= dpi.y + dpi.height)
|
||||
itemY += SCROLLABLE_ROW_HEIGHT;
|
||||
if (itemY + SCROLLABLE_ROW_HEIGHT < dpi.y || itemY >= dpi.y + dpi.height)
|
||||
continue;
|
||||
|
||||
if (_selectedResearchItem == &researchItem)
|
||||
|
@ -296,7 +296,7 @@ static Widget _inventionListDragWidgets[] = {
|
|||
{
|
||||
// Highlight
|
||||
top = itemY;
|
||||
bottom = itemY + kScrollableRowHeight - 1;
|
||||
bottom = itemY + SCROLLABLE_ROW_HEIGHT - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -559,7 +559,7 @@ static Widget _inventionListDragWidgets[] = {
|
|||
auto& researchList = isInvented ? gameState.ResearchItemsInvented : gameState.ResearchItemsUninvented;
|
||||
for (auto& researchItem : researchList)
|
||||
{
|
||||
y -= kScrollableRowHeight;
|
||||
y -= SCROLLABLE_ROW_HEIGHT;
|
||||
if (y < 0)
|
||||
{
|
||||
return &researchItem;
|
||||
|
@ -575,7 +575,7 @@ static Widget _inventionListDragWidgets[] = {
|
|||
auto& researchList = isInvented ? gameState.ResearchItemsInvented : gameState.ResearchItemsUninvented;
|
||||
for (auto& researchItem : researchList)
|
||||
{
|
||||
y -= kScrollableRowHeight;
|
||||
y -= SCROLLABLE_ROW_HEIGHT;
|
||||
if (y < 0)
|
||||
{
|
||||
return &researchItem;
|
||||
|
|
|
@ -583,7 +583,7 @@ static std::vector<Widget> _window_editor_object_selection_widgets = {
|
|||
*/
|
||||
ScreenSize OnScrollGetSize(int32_t scrollIndex) override
|
||||
{
|
||||
const auto newHeight = static_cast<int32_t>(_listItems.size() * kScrollableRowHeight);
|
||||
const auto newHeight = static_cast<int32_t>(_listItems.size() * SCROLLABLE_ROW_HEIGHT);
|
||||
return { 0, newHeight };
|
||||
}
|
||||
|
||||
|
@ -728,7 +728,7 @@ static std::vector<Widget> _window_editor_object_selection_widgets = {
|
|||
for (size_t i = 0; i < _listItems.size(); i++)
|
||||
{
|
||||
const auto& listItem = _listItems[i];
|
||||
if (screenCoords.y + kScrollableRowHeight >= dpi.y && screenCoords.y <= dpi.y + dpi.height)
|
||||
if (screenCoords.y + SCROLLABLE_ROW_HEIGHT >= dpi.y && screenCoords.y <= dpi.y + dpi.height)
|
||||
{
|
||||
// Draw checkbox
|
||||
if (!(gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) && !(*listItem.flags & 0x20))
|
||||
|
@ -740,7 +740,7 @@ static std::vector<Widget> _window_editor_object_selection_widgets = {
|
|||
&& !(*listItem.flags & ObjectSelectionFlags::Flag6);
|
||||
if (highlighted)
|
||||
{
|
||||
auto bottom = screenCoords.y + (kScrollableRowHeight - 1);
|
||||
auto bottom = screenCoords.y + (SCROLLABLE_ROW_HEIGHT - 1);
|
||||
GfxFilterRect(dpi, { 0, screenCoords.y, width, bottom }, FilterPaletteID::PaletteDarken1);
|
||||
}
|
||||
|
||||
|
@ -799,7 +799,7 @@ static std::vector<Widget> _window_editor_object_selection_widgets = {
|
|||
ft.Add<const char*>(gCommonStringFormatBuffer);
|
||||
DrawTextEllipsised(dpi, screenCoords, width_limit, STR_STRING, ft, { colour, FontStyle::Medium, darkness });
|
||||
}
|
||||
screenCoords.y += kScrollableRowHeight;
|
||||
screenCoords.y += SCROLLABLE_ROW_HEIGHT;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1537,7 +1537,7 @@ static std::vector<Widget> _window_editor_object_selection_widgets = {
|
|||
*/
|
||||
int32_t GetObjectFromObjectSelection(ObjectType object_type, int32_t y)
|
||||
{
|
||||
int32_t listItemIndex = y / kScrollableRowHeight;
|
||||
int32_t listItemIndex = y / SCROLLABLE_ROW_HEIGHT;
|
||||
if (listItemIndex < 0 || static_cast<size_t>(listItemIndex) >= _listItems.size())
|
||||
return -1;
|
||||
|
||||
|
|
|
@ -129,9 +129,9 @@ static Widget window_guest_list_widgets[] = {
|
|||
char Name[256];
|
||||
};
|
||||
|
||||
static constexpr uint8_t SUMMARISED_GUEST_ROW_HEIGHT = kScrollableRowHeight + 11;
|
||||
static constexpr uint8_t SUMMARISED_GUEST_ROW_HEIGHT = SCROLLABLE_ROW_HEIGHT + 11;
|
||||
static constexpr auto GUESTS_PER_PAGE = 2000;
|
||||
static constexpr const auto GUEST_PAGE_HEIGHT = GUESTS_PER_PAGE * kScrollableRowHeight;
|
||||
static constexpr const auto GUEST_PAGE_HEIGHT = GUESTS_PER_PAGE * SCROLLABLE_ROW_HEIGHT;
|
||||
static constexpr size_t MaxGroups = 240;
|
||||
|
||||
TabId _selectedTab{};
|
||||
|
@ -502,7 +502,7 @@ static Widget window_guest_list_widgets[] = {
|
|||
{
|
||||
case TabId::Individual:
|
||||
// Count the number of guests
|
||||
y = static_cast<int32_t>(_guestList.size()) * kScrollableRowHeight;
|
||||
y = static_cast<int32_t>(_guestList.size()) * SCROLLABLE_ROW_HEIGHT;
|
||||
_numPages = (_guestList.size() + GUESTS_PER_PAGE - 1) / GUESTS_PER_PAGE;
|
||||
if (_numPages == 0)
|
||||
_selectedPage = 0;
|
||||
|
@ -541,7 +541,7 @@ static Widget window_guest_list_widgets[] = {
|
|||
|
||||
void OnScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override
|
||||
{
|
||||
auto i = screenCoords.y / (_selectedTab == TabId::Individual ? kScrollableRowHeight : SUMMARISED_GUEST_ROW_HEIGHT);
|
||||
auto i = screenCoords.y / (_selectedTab == TabId::Individual ? SCROLLABLE_ROW_HEIGHT : SUMMARISED_GUEST_ROW_HEIGHT);
|
||||
i += static_cast<int32_t>(_selectedPage * GUESTS_PER_PAGE);
|
||||
if (static_cast<size_t>(i) != _highlightedIndex)
|
||||
{
|
||||
|
@ -556,7 +556,7 @@ static Widget window_guest_list_widgets[] = {
|
|||
{
|
||||
case TabId::Individual:
|
||||
{
|
||||
auto i = screenCoords.y / kScrollableRowHeight;
|
||||
auto i = screenCoords.y / SCROLLABLE_ROW_HEIGHT;
|
||||
i += static_cast<int32_t>(_selectedPage * GUESTS_PER_PAGE);
|
||||
for (const auto& guestItem : _guestList)
|
||||
{
|
||||
|
@ -669,14 +669,14 @@ static Widget window_guest_list_widgets[] = {
|
|||
for (const auto& guestItem : _guestList)
|
||||
{
|
||||
// Check if y is beyond the scroll control
|
||||
if (y + kScrollableRowHeight + 1 >= -0x7FFF && y + kScrollableRowHeight + 1 > dpi.y && y < 0x7FFF
|
||||
if (y + SCROLLABLE_ROW_HEIGHT + 1 >= -0x7FFF && y + SCROLLABLE_ROW_HEIGHT + 1 > dpi.y && y < 0x7FFF
|
||||
&& y < dpi.y + dpi.height)
|
||||
{
|
||||
// Highlight backcolour and text colour (format)
|
||||
StringId format = STR_BLACK_STRING;
|
||||
if (index == _highlightedIndex)
|
||||
{
|
||||
GfxFilterRect(dpi, { 0, y, 800, y + kScrollableRowHeight - 1 }, FilterPaletteID::PaletteDarken1);
|
||||
GfxFilterRect(dpi, { 0, y, 800, y + SCROLLABLE_ROW_HEIGHT - 1 }, FilterPaletteID::PaletteDarken1);
|
||||
format = STR_WINDOW_COLOUR_2_STRINGID;
|
||||
}
|
||||
|
||||
|
@ -724,7 +724,7 @@ static Widget window_guest_list_widgets[] = {
|
|||
break;
|
||||
}
|
||||
}
|
||||
y += kScrollableRowHeight;
|
||||
y += SCROLLABLE_ROW_HEIGHT;
|
||||
index++;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -903,14 +903,14 @@ static Widget window_loadsave_widgets[] =
|
|||
|
||||
ScreenSize OnScrollGetSize(int32_t scrollIndex) override
|
||||
{
|
||||
return { 0, no_list_items * kScrollableRowHeight };
|
||||
return { 0, no_list_items * SCROLLABLE_ROW_HEIGHT };
|
||||
}
|
||||
|
||||
void OnScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override
|
||||
{
|
||||
int32_t selectedItem;
|
||||
|
||||
selectedItem = screenCoords.y / kScrollableRowHeight;
|
||||
selectedItem = screenCoords.y / SCROLLABLE_ROW_HEIGHT;
|
||||
if (selectedItem >= no_list_items)
|
||||
return;
|
||||
|
||||
|
@ -923,7 +923,7 @@ static Widget window_loadsave_widgets[] =
|
|||
{
|
||||
int32_t selectedItem;
|
||||
|
||||
selectedItem = screenCoords.y / kScrollableRowHeight;
|
||||
selectedItem = screenCoords.y / SCROLLABLE_ROW_HEIGHT;
|
||||
if (selectedItem >= no_list_items)
|
||||
return;
|
||||
|
||||
|
@ -964,11 +964,11 @@ static Widget window_loadsave_widgets[] =
|
|||
|
||||
for (int32_t i = 0; i < no_list_items; i++)
|
||||
{
|
||||
int32_t y = i * kScrollableRowHeight;
|
||||
int32_t y = i * SCROLLABLE_ROW_HEIGHT;
|
||||
if (y > dpi.y + dpi.height)
|
||||
break;
|
||||
|
||||
if (y + kScrollableRowHeight < dpi.y)
|
||||
if (y + SCROLLABLE_ROW_HEIGHT < dpi.y)
|
||||
continue;
|
||||
|
||||
StringId stringId = STR_BLACK_STRING;
|
||||
|
@ -977,7 +977,7 @@ static Widget window_loadsave_widgets[] =
|
|||
if (i == selected_list_item)
|
||||
{
|
||||
stringId = STR_WINDOW_COLOUR_2_STRINGID;
|
||||
GfxFilterRect(dpi, { 0, y, listWidth, y + kScrollableRowHeight }, FilterPaletteID::PaletteDarken1);
|
||||
GfxFilterRect(dpi, { 0, y, listWidth, y + SCROLLABLE_ROW_HEIGHT }, FilterPaletteID::PaletteDarken1);
|
||||
}
|
||||
// display a marker next to the currently loaded game file
|
||||
if (_listItems[i].loaded)
|
||||
|
|
|
@ -569,7 +569,7 @@ static constexpr StringId WindowMultiplayerPageTitles[] = {
|
|||
Invalidate();
|
||||
}
|
||||
|
||||
screenSize = { 0, NetworkGetNumPlayers() * kScrollableRowHeight };
|
||||
screenSize = { 0, NetworkGetNumPlayers() * SCROLLABLE_ROW_HEIGHT };
|
||||
int32_t i = screenSize.height - window_multiplayer_players_widgets[WIDX_LIST].bottom
|
||||
+ window_multiplayer_players_widgets[WIDX_LIST].top + 21;
|
||||
if (i < 0)
|
||||
|
@ -590,7 +590,7 @@ static constexpr StringId WindowMultiplayerPageTitles[] = {
|
|||
Invalidate();
|
||||
}
|
||||
|
||||
screenSize = { 0, NetworkGetNumActions() * kScrollableRowHeight };
|
||||
screenSize = { 0, NetworkGetNumActions() * SCROLLABLE_ROW_HEIGHT };
|
||||
int32_t i = screenSize.height - window_multiplayer_groups_widgets[WIDX_LIST].bottom
|
||||
+ window_multiplayer_groups_widgets[WIDX_LIST].top + 21;
|
||||
if (i < 0)
|
||||
|
@ -612,7 +612,7 @@ static constexpr StringId WindowMultiplayerPageTitles[] = {
|
|||
{
|
||||
case WINDOW_MULTIPLAYER_PAGE_PLAYERS:
|
||||
{
|
||||
int32_t index = screenCoords.y / kScrollableRowHeight;
|
||||
int32_t index = screenCoords.y / SCROLLABLE_ROW_HEIGHT;
|
||||
if (index >= no_list_items)
|
||||
return;
|
||||
|
||||
|
@ -626,7 +626,7 @@ static constexpr StringId WindowMultiplayerPageTitles[] = {
|
|||
|
||||
case WINDOW_MULTIPLAYER_PAGE_GROUPS:
|
||||
{
|
||||
int32_t index = screenCoords.y / kScrollableRowHeight;
|
||||
int32_t index = screenCoords.y / SCROLLABLE_ROW_HEIGHT;
|
||||
if (index >= no_list_items)
|
||||
return;
|
||||
|
||||
|
@ -648,7 +648,7 @@ static constexpr StringId WindowMultiplayerPageTitles[] = {
|
|||
case WINDOW_MULTIPLAYER_PAGE_PLAYERS:
|
||||
case WINDOW_MULTIPLAYER_PAGE_GROUPS:
|
||||
{
|
||||
int32_t index = screenCoords.y / kScrollableRowHeight;
|
||||
int32_t index = screenCoords.y / SCROLLABLE_ROW_HEIGHT;
|
||||
if (index >= no_list_items)
|
||||
return;
|
||||
|
||||
|
@ -751,7 +751,7 @@ static constexpr StringId WindowMultiplayerPageTitles[] = {
|
|||
break;
|
||||
}
|
||||
|
||||
if (screenCoords.y + kScrollableRowHeight + 1 >= dpi.y)
|
||||
if (screenCoords.y + SCROLLABLE_ROW_HEIGHT + 1 >= dpi.y)
|
||||
{
|
||||
thread_local std::string _buffer;
|
||||
_buffer.reserve(512);
|
||||
|
@ -762,7 +762,7 @@ static constexpr StringId WindowMultiplayerPageTitles[] = {
|
|||
if (listPosition == selected_list_item)
|
||||
{
|
||||
GfxFilterRect(
|
||||
dpi, { 0, screenCoords.y, 800, screenCoords.y + kScrollableRowHeight - 1 },
|
||||
dpi, { 0, screenCoords.y, 800, screenCoords.y + SCROLLABLE_ROW_HEIGHT - 1 },
|
||||
FilterPaletteID::PaletteDarken1);
|
||||
_buffer += NetworkGetPlayerName(player);
|
||||
colour = colours[2];
|
||||
|
@ -831,7 +831,7 @@ static constexpr StringId WindowMultiplayerPageTitles[] = {
|
|||
screenCoords.x = 356;
|
||||
GfxDrawString(dpi, screenCoords, _buffer.c_str(), { colour });
|
||||
}
|
||||
screenCoords.y += kScrollableRowHeight;
|
||||
screenCoords.y += SCROLLABLE_ROW_HEIGHT;
|
||||
listPosition++;
|
||||
}
|
||||
}
|
||||
|
@ -893,7 +893,7 @@ static constexpr StringId WindowMultiplayerPageTitles[] = {
|
|||
if (i == selected_list_item)
|
||||
{
|
||||
GfxFilterRect(
|
||||
dpi, { 0, screenCoords.y, 800, screenCoords.y + kScrollableRowHeight - 1 },
|
||||
dpi, { 0, screenCoords.y, 800, screenCoords.y + SCROLLABLE_ROW_HEIGHT - 1 },
|
||||
FilterPaletteID::PaletteDarken1);
|
||||
}
|
||||
if (screenCoords.y > dpi.y + dpi.height)
|
||||
|
@ -901,7 +901,7 @@ static constexpr StringId WindowMultiplayerPageTitles[] = {
|
|||
break;
|
||||
}
|
||||
|
||||
if (screenCoords.y + kScrollableRowHeight + 1 >= dpi.y)
|
||||
if (screenCoords.y + SCROLLABLE_ROW_HEIGHT + 1 >= dpi.y)
|
||||
{
|
||||
int32_t groupindex = NetworkGetGroupIndex(_selectedGroup);
|
||||
if (groupindex != -1)
|
||||
|
@ -918,7 +918,7 @@ static constexpr StringId WindowMultiplayerPageTitles[] = {
|
|||
ft.Add<uint16_t>(NetworkGetActionNameStringID(i));
|
||||
DrawTextBasic(dpi, { 10, screenCoords.y }, STR_WINDOW_COLOUR_2_STRINGID, ft);
|
||||
}
|
||||
screenCoords.y += kScrollableRowHeight;
|
||||
screenCoords.y += SCROLLABLE_ROW_HEIGHT;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -465,19 +465,19 @@ static Widget window_object_load_error_widgets[] = {
|
|||
|
||||
ScreenSize OnScrollGetSize(const int32_t scrollIndex) override
|
||||
{
|
||||
return ScreenSize(0, no_list_items * kScrollableRowHeight);
|
||||
return ScreenSize(0, no_list_items * SCROLLABLE_ROW_HEIGHT);
|
||||
}
|
||||
|
||||
void OnScrollMouseDown(const int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override
|
||||
{
|
||||
const auto selectedItem = screenCoords.y / kScrollableRowHeight;
|
||||
const auto selectedItem = screenCoords.y / SCROLLABLE_ROW_HEIGHT;
|
||||
SelectObjectFromList(selectedItem);
|
||||
}
|
||||
|
||||
void OnScrollMouseOver(const int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override
|
||||
{
|
||||
// Highlight item that the cursor is over, or remove highlighting if none
|
||||
const auto selectedItem = screenCoords.y / kScrollableRowHeight;
|
||||
const auto selectedItem = screenCoords.y / SCROLLABLE_ROW_HEIGHT;
|
||||
if (selectedItem < 0 || selectedItem >= no_list_items)
|
||||
_highlightedIndex = -1;
|
||||
else
|
||||
|
@ -513,15 +513,15 @@ static Widget window_object_load_error_widgets[] = {
|
|||
for (int32_t i = 0; i < no_list_items; i++)
|
||||
{
|
||||
ScreenCoordsXY screenCoords;
|
||||
screenCoords.y = i * kScrollableRowHeight;
|
||||
screenCoords.y = i * SCROLLABLE_ROW_HEIGHT;
|
||||
if (screenCoords.y > dpi.y + dpi.height)
|
||||
break;
|
||||
|
||||
if (screenCoords.y + kScrollableRowHeight < dpi.y)
|
||||
if (screenCoords.y + SCROLLABLE_ROW_HEIGHT < dpi.y)
|
||||
continue;
|
||||
|
||||
const auto screenRect = ScreenRect{ { 0, screenCoords.y },
|
||||
{ listWidth, screenCoords.y + kScrollableRowHeight - 1 } };
|
||||
{ listWidth, screenCoords.y + SCROLLABLE_ROW_HEIGHT - 1 } };
|
||||
// If hovering over item, change the color and fill the backdrop.
|
||||
if (i == selected_list_item)
|
||||
GfxFillRect(dpi, screenRect, ColourMapA[colours[1]].darker);
|
||||
|
|
|
@ -211,7 +211,7 @@ static Widget _rideListWidgets[] = {
|
|||
widgets[WIDX_SORT].left = width - 60;
|
||||
widgets[WIDX_SORT].right = width - 60 + 54;
|
||||
|
||||
ResizeDropdown(WIDX_CURRENT_INFORMATION_TYPE, { 150, 46 }, { width - 216, DROPDOWN_HEIGHT });
|
||||
ResizeDropdown(WIDX_CURRENT_INFORMATION_TYPE, { 150, 46 }, { width - 216, kDropdownHeight });
|
||||
|
||||
// Refreshing the list can be a very intensive operation
|
||||
// owing to its use of ride_has_any_track_elements().
|
||||
|
@ -386,7 +386,7 @@ static Widget _rideListWidgets[] = {
|
|||
*/
|
||||
ScreenSize OnScrollGetSize(int32_t scrollIndex) override
|
||||
{
|
||||
const auto newHeight = static_cast<int32_t>(_rideList.size() * kScrollableRowHeight);
|
||||
const auto newHeight = static_cast<int32_t>(_rideList.size() * SCROLLABLE_ROW_HEIGHT);
|
||||
if (selected_list_item != -1)
|
||||
{
|
||||
selected_list_item = -1;
|
||||
|
@ -411,7 +411,7 @@ static Widget _rideListWidgets[] = {
|
|||
*/
|
||||
void OnScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override
|
||||
{
|
||||
const auto index = screenCoords.y / kScrollableRowHeight;
|
||||
const auto index = screenCoords.y / SCROLLABLE_ROW_HEIGHT;
|
||||
if (index < 0 || static_cast<size_t>(index) >= _rideList.size())
|
||||
return;
|
||||
|
||||
|
@ -437,7 +437,7 @@ static Widget _rideListWidgets[] = {
|
|||
*/
|
||||
void OnScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override
|
||||
{
|
||||
const auto index = screenCoords.y / kScrollableRowHeight;
|
||||
const auto index = screenCoords.y / SCROLLABLE_ROW_HEIGHT;
|
||||
if (index < 0 || static_cast<size_t>(index) >= _rideList.size())
|
||||
return;
|
||||
|
||||
|
@ -552,7 +552,7 @@ static Widget _rideListWidgets[] = {
|
|||
if (i == static_cast<size_t>(selected_list_item))
|
||||
{
|
||||
// Background highlight
|
||||
GfxFilterRect(dpi, { 0, y, 800, y + kScrollableRowHeight - 1 }, FilterPaletteID::PaletteDarken1);
|
||||
GfxFilterRect(dpi, { 0, y, 800, y + SCROLLABLE_ROW_HEIGHT - 1 }, FilterPaletteID::PaletteDarken1);
|
||||
format = (_quickDemolishMode ? STR_LIGHTPINK_STRINGID : STR_WINDOW_COLOUR_2_STRINGID);
|
||||
}
|
||||
|
||||
|
@ -742,7 +742,7 @@ static Widget _rideListWidgets[] = {
|
|||
ft.Add<StringId>(formatSecondary);
|
||||
}
|
||||
DrawTextEllipsised(dpi, { 160, y - 1 }, 157, format, ft);
|
||||
y += kScrollableRowHeight;
|
||||
y += SCROLLABLE_ROW_HEIGHT;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -263,7 +263,7 @@ static Widget window_shortcut_change_widgets[] = {
|
|||
|
||||
ScreenSize OnScrollGetSize(int32_t scrollIndex) override
|
||||
{
|
||||
auto h = static_cast<int32_t>(_list.size() * kScrollableRowHeight);
|
||||
auto h = static_cast<int32_t>(_list.size() * SCROLLABLE_ROW_HEIGHT);
|
||||
auto bottom = std::max(0, h - widgets[WIDX_SCROLL].bottom + widgets[WIDX_SCROLL].top + 21);
|
||||
if (bottom < scrolls[0].v_top)
|
||||
{
|
||||
|
@ -275,7 +275,7 @@ static Widget window_shortcut_change_widgets[] = {
|
|||
|
||||
void OnScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override
|
||||
{
|
||||
auto index = static_cast<int_fast16_t>((screenCoords.y - 1) / kScrollableRowHeight);
|
||||
auto index = static_cast<int_fast16_t>((screenCoords.y - 1) / SCROLLABLE_ROW_HEIGHT);
|
||||
if (static_cast<size_t>(index) < _list.size())
|
||||
{
|
||||
_highlightedItem = index;
|
||||
|
@ -289,7 +289,7 @@ static Widget window_shortcut_change_widgets[] = {
|
|||
|
||||
void OnScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override
|
||||
{
|
||||
auto selectedItem = static_cast<size_t>((screenCoords.y - 1) / kScrollableRowHeight);
|
||||
auto selectedItem = static_cast<size_t>((screenCoords.y - 1) / SCROLLABLE_ROW_HEIGHT);
|
||||
if (selectedItem < _list.size())
|
||||
{
|
||||
// Is this a separator?
|
||||
|
@ -314,13 +314,13 @@ static Widget window_shortcut_change_widgets[] = {
|
|||
|
||||
for (size_t i = 0; i < _list.size(); ++i)
|
||||
{
|
||||
auto y = static_cast<int32_t>(1 + i * kScrollableRowHeight);
|
||||
auto y = static_cast<int32_t>(1 + i * SCROLLABLE_ROW_HEIGHT);
|
||||
if (y > dpi.y + dpi.height)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (y + kScrollableRowHeight < dpi.y)
|
||||
if (y + SCROLLABLE_ROW_HEIGHT < dpi.y)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
@ -504,7 +504,7 @@ static Widget window_shortcut_change_widgets[] = {
|
|||
|
||||
void DrawSeparator(DrawPixelInfo& dpi, int32_t y, int32_t scrollWidth)
|
||||
{
|
||||
const int32_t top = y + (kScrollableRowHeight / 2) - 1;
|
||||
const int32_t top = y + (SCROLLABLE_ROW_HEIGHT / 2) - 1;
|
||||
GfxFillRect(dpi, { { 0, top }, { scrollWidth, top } }, ColourMapA[colours[0]].mid_dark);
|
||||
GfxFillRect(dpi, { { 0, top + 1 }, { scrollWidth, top + 1 } }, ColourMapA[colours[0]].lightest);
|
||||
}
|
||||
|
@ -516,7 +516,7 @@ static Widget window_shortcut_change_widgets[] = {
|
|||
if (isHighlighted)
|
||||
{
|
||||
format = STR_WINDOW_COLOUR_2_STRINGID;
|
||||
GfxFilterRect(dpi, { 0, y - 1, scrollWidth, y + (kScrollableRowHeight - 2) }, FilterPaletteID::PaletteDarken1);
|
||||
GfxFilterRect(dpi, { 0, y - 1, scrollWidth, y + (SCROLLABLE_ROW_HEIGHT - 2) }, FilterPaletteID::PaletteDarken1);
|
||||
}
|
||||
|
||||
auto bindingOffset = (scrollWidth * 2) / 3;
|
||||
|
|
|
@ -323,7 +323,7 @@ static Widget _staffListWidgets[] = {
|
|||
Invalidate();
|
||||
}
|
||||
|
||||
auto scrollHeight = static_cast<int32_t>(_staffList.size()) * kScrollableRowHeight;
|
||||
auto scrollHeight = static_cast<int32_t>(_staffList.size()) * SCROLLABLE_ROW_HEIGHT;
|
||||
auto i = scrollHeight - widgets[WIDX_STAFF_LIST_LIST].bottom + widgets[WIDX_STAFF_LIST_LIST].top + 21;
|
||||
if (i < 0)
|
||||
i = 0;
|
||||
|
@ -339,7 +339,7 @@ static Widget _staffListWidgets[] = {
|
|||
|
||||
void OnScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override
|
||||
{
|
||||
auto i = static_cast<size_t>(screenCoords.y / kScrollableRowHeight);
|
||||
auto i = static_cast<size_t>(screenCoords.y / SCROLLABLE_ROW_HEIGHT);
|
||||
if (i != _highlightedIndex)
|
||||
{
|
||||
_highlightedIndex = static_cast<size_t>(i);
|
||||
|
@ -349,7 +349,7 @@ static Widget _staffListWidgets[] = {
|
|||
|
||||
void OnScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override
|
||||
{
|
||||
int32_t i = screenCoords.y / kScrollableRowHeight;
|
||||
int32_t i = screenCoords.y / SCROLLABLE_ROW_HEIGHT;
|
||||
for (const auto& entry : _staffList)
|
||||
{
|
||||
if (i == 0)
|
||||
|
@ -409,7 +409,7 @@ static Widget _staffListWidgets[] = {
|
|||
|
||||
if (i == _highlightedIndex)
|
||||
{
|
||||
GfxFilterRect(dpi, { 0, y, 800, y + (kScrollableRowHeight - 1) }, FilterPaletteID::PaletteDarken1);
|
||||
GfxFilterRect(dpi, { 0, y, 800, y + (SCROLLABLE_ROW_HEIGHT - 1) }, FilterPaletteID::PaletteDarken1);
|
||||
format = (_quickFireMode ? STR_LIGHTPINK_STRINGID : STR_WINDOW_COLOUR_2_STRINGID);
|
||||
}
|
||||
|
||||
|
@ -451,7 +451,7 @@ static Widget _staffListWidgets[] = {
|
|||
}
|
||||
}
|
||||
|
||||
y += kScrollableRowHeight;
|
||||
y += SCROLLABLE_ROW_HEIGHT;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -994,7 +994,7 @@ static uint64_t PageDisabledWidgets[] = {
|
|||
|
||||
ScreenSize OnScrollGetSize(int32_t scrollIndex) override
|
||||
{
|
||||
return ScreenSize(WW - 30, windowTileInspectorElementCount * kScrollableRowHeight);
|
||||
return ScreenSize(WW - 30, windowTileInspectorElementCount * SCROLLABLE_ROW_HEIGHT);
|
||||
}
|
||||
|
||||
void OnScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override
|
||||
|
@ -1004,7 +1004,7 @@ static uint64_t PageDisabledWidgets[] = {
|
|||
return;
|
||||
|
||||
// Because the list items are displayed in reverse order, subtract the calculated index from the amount of elements
|
||||
const int16_t index = windowTileInspectorElementCount - (screenCoords.y - 1) / kScrollableRowHeight - 1;
|
||||
const int16_t index = windowTileInspectorElementCount - (screenCoords.y - 1) / SCROLLABLE_ROW_HEIGHT - 1;
|
||||
const ScreenRect checkboxColumnRect{ { 2, 0 }, { 15, screenCoords.y } };
|
||||
if (index >= 0 && checkboxColumnRect.Contains(screenCoords))
|
||||
{ // Checkbox was clicked
|
||||
|
@ -1018,7 +1018,7 @@ static uint64_t PageDisabledWidgets[] = {
|
|||
|
||||
void OnScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override
|
||||
{
|
||||
int16_t index = windowTileInspectorElementCount - (screenCoords.y - 1) / kScrollableRowHeight - 1;
|
||||
int16_t index = windowTileInspectorElementCount - (screenCoords.y - 1) / SCROLLABLE_ROW_HEIGHT - 1;
|
||||
if (index < 0 || index >= windowTileInspectorElementCount)
|
||||
_highlightedIndex = -1;
|
||||
else
|
||||
|
@ -1585,7 +1585,7 @@ static uint64_t PageDisabledWidgets[] = {
|
|||
}
|
||||
|
||||
ScreenCoordsXY screenCoords{};
|
||||
screenCoords.y = kScrollableRowHeight * (windowTileInspectorElementCount - 1);
|
||||
screenCoords.y = SCROLLABLE_ROW_HEIGHT * (windowTileInspectorElementCount - 1);
|
||||
int32_t i = 0;
|
||||
char buffer[256];
|
||||
|
||||
|
@ -1602,7 +1602,7 @@ static uint64_t PageDisabledWidgets[] = {
|
|||
|
||||
// Draw row background colour
|
||||
auto fillRectangle = ScreenRect{ { 0, screenCoords.y },
|
||||
{ listWidth, screenCoords.y + kScrollableRowHeight - 1 } };
|
||||
{ listWidth, screenCoords.y + SCROLLABLE_ROW_HEIGHT - 1 } };
|
||||
if (selectedRow)
|
||||
GfxFillRect(dpi, fillRectangle, ColourMapA[colours[1]].mid_dark);
|
||||
else if (hoveredRow)
|
||||
|
@ -1719,7 +1719,7 @@ static uint64_t PageDisabledWidgets[] = {
|
|||
if (last)
|
||||
DrawTextBasic(dpi, screenCoords + ScreenCoordsXY{ LastFlagColumnXY.x, 0 }, stringFormat, checkboxFormatter);
|
||||
|
||||
screenCoords.y -= kScrollableRowHeight;
|
||||
screenCoords.y -= SCROLLABLE_ROW_HEIGHT;
|
||||
i++;
|
||||
} while (!(tileElement++)->IsLastForTile());
|
||||
}
|
||||
|
|
|
@ -173,7 +173,7 @@ static Widget _trackListWidgets[] = {
|
|||
maxItems++;
|
||||
}
|
||||
|
||||
int32_t index = screenCoords.y / kScrollableRowHeight;
|
||||
int32_t index = screenCoords.y / SCROLLABLE_ROW_HEIGHT;
|
||||
if (index < 0 || static_cast<uint32_t>(index) >= maxItems)
|
||||
{
|
||||
index = -1;
|
||||
|
@ -330,7 +330,7 @@ static Widget _trackListWidgets[] = {
|
|||
// Extra item: custom design
|
||||
numItems++;
|
||||
}
|
||||
int32_t scrollHeight = static_cast<int32_t>(numItems * kScrollableRowHeight);
|
||||
int32_t scrollHeight = static_cast<int32_t>(numItems * SCROLLABLE_ROW_HEIGHT);
|
||||
|
||||
return { width, scrollHeight };
|
||||
}
|
||||
|
@ -521,7 +521,7 @@ static Widget _trackListWidgets[] = {
|
|||
{
|
||||
// Vehicle design not available
|
||||
DrawTextEllipsised(dpi, screenPos, 368, STR_VEHICLE_DESIGN_UNAVAILABLE, {}, { TextAlignment::CENTRE });
|
||||
screenPos.y -= kScrollableRowHeight;
|
||||
screenPos.y -= SCROLLABLE_ROW_HEIGHT;
|
||||
}
|
||||
|
||||
if (_loadedTrackDesign->track_flags & TRACK_DESIGN_FLAG_SCENERY_UNAVAILABLE)
|
||||
|
@ -531,7 +531,7 @@ static Widget _trackListWidgets[] = {
|
|||
// Scenery not available
|
||||
DrawTextEllipsised(
|
||||
dpi, screenPos, 368, STR_DESIGN_INCLUDES_SCENERY_WHICH_IS_UNAVAILABLE, {}, { TextAlignment::CENTRE });
|
||||
screenPos.y -= kScrollableRowHeight;
|
||||
screenPos.y -= SCROLLABLE_ROW_HEIGHT;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -698,7 +698,7 @@ static Widget _trackListWidgets[] = {
|
|||
{
|
||||
// Highlight
|
||||
GfxFilterRect(
|
||||
dpi, { screenCoords, { width, screenCoords.y + kScrollableRowHeight - 1 } },
|
||||
dpi, { screenCoords, { width, screenCoords.y + SCROLLABLE_ROW_HEIGHT - 1 } },
|
||||
FilterPaletteID::PaletteDarken1);
|
||||
stringId = STR_WINDOW_COLOUR_2_STRINGID;
|
||||
}
|
||||
|
@ -710,20 +710,20 @@ static Widget _trackListWidgets[] = {
|
|||
auto ft = Formatter();
|
||||
ft.Add<StringId>(STR_BUILD_CUSTOM_DESIGN);
|
||||
DrawTextBasic(dpi, screenCoords - ScreenCoordsXY{ 0, 1 }, stringId, ft);
|
||||
screenCoords.y += kScrollableRowHeight;
|
||||
screenCoords.y += SCROLLABLE_ROW_HEIGHT;
|
||||
listIndex++;
|
||||
}
|
||||
|
||||
for (auto i : _filteredTrackIds)
|
||||
{
|
||||
if (screenCoords.y + kScrollableRowHeight >= dpi.y && screenCoords.y < dpi.y + dpi.height)
|
||||
if (screenCoords.y + SCROLLABLE_ROW_HEIGHT >= dpi.y && screenCoords.y < dpi.y + dpi.height)
|
||||
{
|
||||
StringId stringId;
|
||||
if (listIndex == static_cast<size_t>(selected_list_item))
|
||||
{
|
||||
// Highlight
|
||||
GfxFilterRect(
|
||||
dpi, { screenCoords, { width, screenCoords.y + kScrollableRowHeight - 1 } },
|
||||
dpi, { screenCoords, { width, screenCoords.y + SCROLLABLE_ROW_HEIGHT - 1 } },
|
||||
FilterPaletteID::PaletteDarken1);
|
||||
stringId = STR_WINDOW_COLOUR_2_STRINGID;
|
||||
}
|
||||
|
@ -739,7 +739,7 @@ static Widget _trackListWidgets[] = {
|
|||
DrawTextBasic(dpi, screenCoords - ScreenCoordsXY{ 0, 1 }, stringId, ft);
|
||||
}
|
||||
|
||||
screenCoords.y += kScrollableRowHeight;
|
||||
screenCoords.y += SCROLLABLE_ROW_HEIGHT;
|
||||
listIndex++;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,12 +42,12 @@ enum class CloseWindowModifier : uint8_t;
|
|||
|
||||
constexpr uint8_t CloseButtonWidth = 10;
|
||||
|
||||
constexpr uint8_t kScrollableRowHeight = 12;
|
||||
#define SCROLLABLE_ROW_HEIGHT 12
|
||||
constexpr uint8_t kListRowHeight = 12;
|
||||
constexpr uint8_t kTableCellHeight = 12;
|
||||
constexpr uint8_t kButtonFaceHeight = 12;
|
||||
constexpr uint8_t kSpinnerHeight = 12;
|
||||
#define DROPDOWN_HEIGHT 12
|
||||
constexpr uint8_t kDropdownHeight = 12;
|
||||
|
||||
#define TEXT_INPUT_SIZE 1024
|
||||
#define TOP_TOOLBAR_HEIGHT 27
|
||||
|
|
Loading…
Reference in New Issue