mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2026-07-26 00:45:35 +00:00
Codechange: Replace Alignment enum with struct
Alignment struct contains separate horizontal and vertical alignment members.
This commit is contained in:
committed by
Peter Nelson
parent
8e637cefed
commit
b4d16d319f
+6
-6
@@ -192,14 +192,14 @@ public:
|
||||
|
||||
case WID_EM_MESSAGE:
|
||||
if (this->detailed_msg.empty()) {
|
||||
DrawStringMultiLineWithClipping(r, this->summary_msg.GetDecodedString(), TextColour::White, SA_CENTER);
|
||||
DrawStringMultiLineWithClipping(r, this->summary_msg.GetDecodedString(), TextColour::White, {AlignmentH::Centre, AlignmentV::Middle});
|
||||
} else if (this->extra_msg.empty()) {
|
||||
/* Extra space when message is shorter than company face window */
|
||||
int extra = (r.Height() - this->height_summary - this->height_detailed - WidgetDimensions::scaled.vsep_wide) / 2;
|
||||
|
||||
/* Note: NewGRF supplied error message often do not start with a colour code, so default to white. */
|
||||
DrawStringMultiLineWithClipping(r.WithHeight(this->height_summary + extra, false), this->summary_msg.GetDecodedString(), TextColour::White, SA_CENTER);
|
||||
DrawStringMultiLineWithClipping(r.WithHeight(this->height_detailed + extra, true), this->detailed_msg.GetDecodedString(), TextColour::White, SA_CENTER);
|
||||
DrawStringMultiLineWithClipping(r.WithHeight(this->height_summary + extra, false), this->summary_msg.GetDecodedString(), TextColour::White, {AlignmentH::Centre, AlignmentV::Middle});
|
||||
DrawStringMultiLineWithClipping(r.WithHeight(this->height_detailed + extra, true), this->detailed_msg.GetDecodedString(), TextColour::White, {AlignmentH::Centre, AlignmentV::Middle});
|
||||
} else {
|
||||
/* Extra space when message is shorter than company face window */
|
||||
int extra = (r.Height() - this->height_summary - this->height_detailed - this->height_extra - (WidgetDimensions::scaled.vsep_wide * 2)) / 3;
|
||||
@@ -208,9 +208,9 @@ public:
|
||||
Rect top_section = r.WithHeight(this->height_summary + extra, false);
|
||||
Rect bottom_section = r.WithHeight(this->height_extra + extra, true);
|
||||
Rect middle_section = top_section.WithY(top_section.bottom, bottom_section.top);
|
||||
DrawStringMultiLineWithClipping(top_section, this->summary_msg.GetDecodedString(), TextColour::White, SA_CENTER);
|
||||
DrawStringMultiLineWithClipping(middle_section, this->detailed_msg.GetDecodedString(), TextColour::White, SA_CENTER);
|
||||
DrawStringMultiLineWithClipping(bottom_section, this->extra_msg.GetDecodedString(), TextColour::White, SA_CENTER);
|
||||
DrawStringMultiLineWithClipping(top_section, this->summary_msg.GetDecodedString(), TextColour::White, {AlignmentH::Centre, AlignmentV::Middle});
|
||||
DrawStringMultiLineWithClipping(middle_section, this->detailed_msg.GetDecodedString(), TextColour::White, {AlignmentH::Centre, AlignmentV::Middle});
|
||||
DrawStringMultiLineWithClipping(bottom_section, this->extra_msg.GetDecodedString(), TextColour::White, {AlignmentH::Centre, AlignmentV::Middle});
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user