1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-21 22:13:07 +01:00

Merge pull request #23350 from mrmbernardi/resize-ride-graph

Increase the maximum width of the ride graph window
This commit is contained in:
mrmbernardi
2024-12-12 20:17:19 +11:00
committed by GitHub
6 changed files with 15 additions and 12 deletions

View File

@@ -918,7 +918,7 @@ namespace OpenRCT2::Ui::Windows
return _currentTextBox;
}
void WindowResize(WindowBase& w, int32_t dw, int32_t dh)
void WindowResize(WindowBase& w, int16_t dw, int16_t dh)
{
if (dw == 0 && dh == 0)
return;
@@ -927,8 +927,8 @@ namespace OpenRCT2::Ui::Windows
w.Invalidate();
// Clamp new size to minimum and maximum
w.width = std::clamp<int32_t>(w.width + dw, w.min_width, w.max_width);
w.height = std::clamp<int32_t>(w.height + dh, w.min_height, w.max_height);
w.width = std::clamp<int16_t>(w.width + dw, w.min_width, w.max_width);
w.height = std::clamp<int16_t>(w.height + dh, w.min_height, w.max_height);
w.OnResize();
w.OnPrepareDraw();
@@ -1251,7 +1251,7 @@ namespace OpenRCT2::Ui::Windows
});
}
void WindowSetResize(WindowBase& w, int32_t minWidth, int32_t minHeight, int32_t maxWidth, int32_t maxHeight)
void WindowSetResize(WindowBase& w, int16_t minWidth, int16_t minHeight, int16_t maxWidth, int16_t maxHeight)
{
w.min_width = minWidth;
w.min_height = minHeight;
@@ -1259,8 +1259,8 @@ namespace OpenRCT2::Ui::Windows
w.max_height = maxHeight;
// Clamp width and height to minimum and maximum
int32_t width = std::clamp<int32_t>(w.width, std::min(minWidth, maxWidth), std::max(minWidth, maxWidth));
int32_t height = std::clamp<int32_t>(w.height, std::min(minHeight, maxHeight), std::max(minHeight, maxHeight));
int16_t width = std::clamp<int16_t>(w.width, std::min(minWidth, maxWidth), std::max(minWidth, maxWidth));
int16_t height = std::clamp<int16_t>(w.height, std::min(minHeight, maxHeight), std::max(minHeight, maxHeight));
// Resize window if size has changed
if (w.width != width || w.height != height)

View File

@@ -130,7 +130,7 @@ namespace OpenRCT2::Ui::Windows
bool TextBoxCaretIsFlashed();
const WidgetIdentifier& GetCurrentTextBox();
void WindowResize(WindowBase& w, int32_t dw, int32_t dh);
void WindowResize(WindowBase& w, int16_t dw, int16_t dh);
void WindowInitScrollWidgets(WindowBase& w);
void WindowUpdateScrollWidgets(WindowBase& w);
@@ -139,7 +139,7 @@ namespace OpenRCT2::Ui::Windows
void WindowMoveAndSnap(WindowBase& w, ScreenCoordsXY newWindowCoords, int32_t snapProximity);
void WindowRelocateWindows(int32_t width, int32_t height);
void WindowSetResize(WindowBase& w, int32_t minWidth, int32_t minHeight, int32_t maxWidth, int32_t maxHeight);
void WindowSetResize(WindowBase& w, int16_t minWidth, int16_t minHeight, int16_t maxWidth, int16_t maxHeight);
bool WindowCanResize(const WindowBase& w);
void InvalidateAllWindowsAfterInput();

View File

@@ -412,8 +412,8 @@ namespace OpenRCT2::Ui::Windows
{
min_width = _info.Desc.MinWidth.value_or(0);
min_height = _info.Desc.MinHeight.value_or(0);
max_width = _info.Desc.MaxWidth.value_or(std::numeric_limits<uint16_t>::max());
max_height = _info.Desc.MaxHeight.value_or(std::numeric_limits<uint16_t>::max());
max_width = _info.Desc.MaxWidth.value_or(std::numeric_limits<int16_t>::max());
max_height = _info.Desc.MaxHeight.value_or(std::numeric_limits<int16_t>::max());
}
RefreshWidgets();
}

View File

@@ -521,7 +521,9 @@ namespace OpenRCT2::Ui::Windows
|| p == WINDOW_FINANCES_PAGE_FINANCIAL_GRAPH)
{
flags |= WF_RESIZABLE;
WindowSetResize(*this, WW_OTHER_TABS, WH_OTHER_TABS, 2000, 2000);
WindowSetResize(
*this, WW_OTHER_TABS, WH_OTHER_TABS, std::numeric_limits<uint16_t>::max(),
std::numeric_limits<int16_t>::max());
}
else
{

View File

@@ -5946,7 +5946,7 @@ namespace OpenRCT2::Ui::Windows
void GraphsResize()
{
WindowSetResize(*this, 316, 182, 500, 450);
WindowSetResize(*this, 316, 182, std::numeric_limits<int16_t>::max(), 450);
}
void GraphsOnMouseDown(WidgetIndex widgetIndex)