Merge remote-tracking branch 'upstream/master'
This commit is contained in:
@@ -66,7 +66,7 @@ static const NWidgetPart _nested_land_info_widgets[] = {
|
||||
};
|
||||
|
||||
static WindowDesc _land_info_desc(
|
||||
WDP_MANUAL, nullptr, 0, 0,
|
||||
WDP_MANUAL, {}, 0, 0,
|
||||
WC_LAND_INFO, WC_NONE,
|
||||
{},
|
||||
_nested_land_info_widgets
|
||||
@@ -373,7 +373,7 @@ static constexpr NWidgetPart _nested_about_widgets[] = {
|
||||
};
|
||||
|
||||
static WindowDesc _about_desc(
|
||||
WDP_CENTER, nullptr, 0, 0,
|
||||
WDP_CENTER, {}, 0, 0,
|
||||
WC_GAME_OPTIONS, WC_NONE,
|
||||
{},
|
||||
_nested_about_widgets
|
||||
@@ -502,7 +502,7 @@ struct AboutWindow : public Window {
|
||||
*
|
||||
* The interval of 2100ms is chosen to maintain parity: 2100 / GetCharacterHeight(FS_NORMAL) = 150ms.
|
||||
*/
|
||||
IntervalTimer<TimerWindow> scroll_interval = {std::chrono::milliseconds(2100) / GetCharacterHeight(FS_NORMAL), [this](uint count) {
|
||||
const IntervalTimer<TimerWindow> scroll_interval = {std::chrono::milliseconds(2100) / GetCharacterHeight(FS_NORMAL), [this](uint count) {
|
||||
this->text_position -= count;
|
||||
/* If the last text has scrolled start a new from the start */
|
||||
if (this->text_position < (int)(this->GetWidget<NWidgetBase>(WID_A_SCROLLING_TEXT)->pos_y - std::size(_credits) * this->line_height)) {
|
||||
@@ -628,7 +628,7 @@ static constexpr NWidgetPart _nested_tooltips_widgets[] = {
|
||||
};
|
||||
|
||||
static WindowDesc _tool_tips_desc(
|
||||
WDP_MANUAL, nullptr, 0, 0, // Coordinates and sizes are not used,
|
||||
WDP_MANUAL, {}, 0, 0, // Coordinates and sizes are not used,
|
||||
WC_TOOLTIPS, WC_NONE,
|
||||
{WindowDefaultFlag::NoFocus, WindowDefaultFlag::NoClose},
|
||||
_nested_tooltips_widgets
|
||||
@@ -781,7 +781,7 @@ void QueryString::DrawEditBox(const Window *w, WidgetID wid) const
|
||||
|
||||
DrawFrameRect(cr, wi->colour, wi->IsLowered() ? FrameFlag::Lowered : FrameFlags{});
|
||||
DrawSpriteIgnorePadding(rtl ? SPR_IMG_DELETE_RIGHT : SPR_IMG_DELETE_LEFT, PAL_NONE, cr, SA_CENTER);
|
||||
if (StrEmpty(this->text.GetText())) GfxFillRect(cr.Shrink(WidgetDimensions::scaled.bevel), GetColourGradient(wi->colour, SHADE_DARKER), FILLRECT_CHECKER);
|
||||
if (this->text.GetText().empty()) GfxFillRect(cr.Shrink(WidgetDimensions::scaled.bevel), GetColourGradient(wi->colour, SHADE_DARKER), FILLRECT_CHECKER);
|
||||
|
||||
DrawFrameRect(fr, wi->colour, {FrameFlag::Lowered, FrameFlag::Darkened});
|
||||
GfxFillRect(fr.Shrink(WidgetDimensions::scaled.bevel), PC_BLACK);
|
||||
@@ -804,14 +804,14 @@ void QueryString::DrawEditBox(const Window *w, WidgetID wid) const
|
||||
/* If we have a marked area, draw a background highlight. */
|
||||
if (tb->marklength != 0) GfxFillRect(fr.left + tb->markxoffs, fr.top, fr.left + tb->markxoffs + tb->marklength - 1, fr.bottom, PC_GREY);
|
||||
|
||||
DrawString(fr.left, fr.right, CenterBounds(fr.top, fr.bottom, GetCharacterHeight(FS_NORMAL)), tb->GetText(), TC_YELLOW);
|
||||
DrawString(fr.left, fr.right, CentreBounds(fr.top, fr.bottom, GetCharacterHeight(FS_NORMAL)), tb->GetText(), TC_YELLOW);
|
||||
bool focussed = w->IsWidgetGloballyFocused(wid) || IsOSKOpenedFor(w, wid);
|
||||
if (focussed && tb->caret) {
|
||||
int caret_width = GetCaretWidth();
|
||||
if (rtl) {
|
||||
DrawString(fr.right - tb->pixels + tb->caretxoffs - caret_width, fr.right - tb->pixels + tb->caretxoffs, CenterBounds(fr.top, fr.bottom, GetCharacterHeight(FS_NORMAL)), "_", TC_WHITE);
|
||||
DrawString(fr.right - tb->pixels + tb->caretxoffs - caret_width, fr.right - tb->pixels + tb->caretxoffs, CentreBounds(fr.top, fr.bottom, GetCharacterHeight(FS_NORMAL)), "_", TC_WHITE);
|
||||
} else {
|
||||
DrawString(fr.left + tb->caretxoffs, fr.left + tb->caretxoffs + caret_width, CenterBounds(fr.top, fr.bottom, GetCharacterHeight(FS_NORMAL)), "_", TC_WHITE);
|
||||
DrawString(fr.left + tb->caretxoffs, fr.left + tb->caretxoffs + caret_width, CentreBounds(fr.top, fr.bottom, GetCharacterHeight(FS_NORMAL)), "_", TC_WHITE);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -850,7 +850,7 @@ Point QueryString::GetCaretPosition(const Window *w, WidgetID wid) const
|
||||
* @param to End of the string range.
|
||||
* @return Rectangle encompassing the string range, relative to the window.
|
||||
*/
|
||||
Rect QueryString::GetBoundingRect(const Window *w, WidgetID wid, const char *from, const char *to) const
|
||||
Rect QueryString::GetBoundingRect(const Window *w, WidgetID wid, size_t from, size_t to) const
|
||||
{
|
||||
const NWidgetLeaf *wi = w->GetWidget<NWidgetLeaf>(wid);
|
||||
|
||||
@@ -914,7 +914,7 @@ void QueryString::ClickEditBox(Window *w, Point pt, WidgetID wid, int click_coun
|
||||
Rect cr = wi->GetCurrentRect().WithWidth(clearbtn_width, !rtl);
|
||||
|
||||
if (IsInsideMM(pt.x, cr.left, cr.right)) {
|
||||
if (!StrEmpty(this->text.GetText())) {
|
||||
if (!this->text.GetText().empty()) {
|
||||
this->text.DeleteAll();
|
||||
w->HandleButtonClick(wid);
|
||||
w->OnEditboxChanged(wid);
|
||||
@@ -979,7 +979,7 @@ struct QueryStringWindow : public Window
|
||||
if (!this->editbox.orig.has_value() || this->editbox.text.GetText() != this->editbox.orig) {
|
||||
assert(this->parent != nullptr);
|
||||
|
||||
this->parent->OnQueryTextFinished(this->editbox.text.GetText());
|
||||
this->parent->OnQueryTextFinished(std::string{this->editbox.text.GetText()});
|
||||
this->editbox.handled = true;
|
||||
}
|
||||
}
|
||||
@@ -1028,7 +1028,7 @@ static constexpr NWidgetPart _nested_query_string_widgets[] = {
|
||||
};
|
||||
|
||||
static WindowDesc _query_string_desc(
|
||||
WDP_CENTER, nullptr, 0, 0,
|
||||
WDP_CENTER, {}, 0, 0,
|
||||
WC_QUERY_STRING, WC_NONE,
|
||||
{},
|
||||
_nested_query_string_widgets
|
||||
@@ -1074,7 +1074,7 @@ struct QueryWindow : public Window {
|
||||
this->Window::Close();
|
||||
}
|
||||
|
||||
void FindWindowPlacementAndResize([[maybe_unused]] int def_width, [[maybe_unused]] int def_height) override
|
||||
void FindWindowPlacementAndResize(int, int, bool) override
|
||||
{
|
||||
/* Position query window over the calling window, ensuring it's within screen bounds. */
|
||||
this->left = SoftClamp(parent->left + (parent->width / 2) - (this->width / 2), 0, _screen.width - this->width);
|
||||
@@ -1167,7 +1167,7 @@ static constexpr NWidgetPart _nested_query_widgets[] = {
|
||||
};
|
||||
|
||||
static WindowDesc _query_desc(
|
||||
WDP_CENTER, nullptr, 0, 0,
|
||||
WDP_CENTER, {}, 0, 0,
|
||||
WC_CONFIRM_POPUP_QUERY, WC_NONE,
|
||||
WindowDefaultFlag::Modal,
|
||||
_nested_query_widgets
|
||||
|
||||
Reference in New Issue
Block a user