summaryrefslogtreecommitdiff
path: root/src/error_gui.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2015-06-20 12:57:34 +0000
committerfrosch <frosch@openttd.org>2015-06-20 12:57:34 +0000
commitbf64a8c2006bae1734c2f7f1f7dc89b7474597f3 (patch)
tree2e9195d7847168f9f054003e75a0e18c7620cebe /src/error_gui.cpp
parentab69952f2abb114381900a479ece2f7b7fc92910 (diff)
downloadopenttd-bf64a8c2006bae1734c2f7f1f7dc89b7474597f3.tar.xz
(svn r27307) -Fix [FS#6259]: Error message window with manager face failed with GUI zoom. (Johnnei)
Diffstat (limited to 'src/error_gui.cpp')
-rw-r--r--src/error_gui.cpp31
1 files changed, 20 insertions, 11 deletions
diff --git a/src/error_gui.cpp b/src/error_gui.cpp
index 98988de5a..c8c603afb 100644
--- a/src/error_gui.cpp
+++ b/src/error_gui.cpp
@@ -182,21 +182,30 @@ public:
virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
{
- if (widget != WID_EM_MESSAGE) return;
-
- CopyInDParam(0, this->decode_params, lengthof(this->decode_params));
- if (this->textref_stack_size > 0) StartTextRefStackUsage(this->textref_stack_grffile, this->textref_stack_size, this->textref_stack);
+ switch (widget) {
+ case WID_EM_MESSAGE: {
+ CopyInDParam(0, this->decode_params, lengthof(this->decode_params));
+ if (this->textref_stack_size > 0) StartTextRefStackUsage(this->textref_stack_grffile, this->textref_stack_size, this->textref_stack);
- int text_width = max(0, (int)size->width - WD_FRAMETEXT_LEFT - WD_FRAMETEXT_RIGHT);
- this->height_summary = GetStringHeight(this->summary_msg, text_width);
- this->height_detailed = (this->detailed_msg == INVALID_STRING_ID) ? 0 : GetStringHeight(this->detailed_msg, text_width);
+ int text_width = max(0, (int)size->width - WD_FRAMETEXT_LEFT - WD_FRAMETEXT_RIGHT);
+ this->height_summary = GetStringHeight(this->summary_msg, text_width);
+ this->height_detailed = (this->detailed_msg == INVALID_STRING_ID) ? 0 : GetStringHeight(this->detailed_msg, text_width);
- if (this->textref_stack_size > 0) StopTextRefStackUsage();
+ if (this->textref_stack_size > 0) StopTextRefStackUsage();
- uint panel_height = WD_FRAMERECT_TOP + this->height_summary + WD_FRAMERECT_BOTTOM;
- if (this->detailed_msg != INVALID_STRING_ID) panel_height += this->height_detailed + WD_PAR_VSEP_WIDE;
+ uint panel_height = WD_FRAMERECT_TOP + this->height_summary + WD_FRAMERECT_BOTTOM;
+ if (this->detailed_msg != INVALID_STRING_ID) panel_height += this->height_detailed + WD_PAR_VSEP_WIDE;
- size->height = max(size->height, panel_height);
+ size->height = max(size->height, panel_height);
+ break;
+ }
+ case WID_EM_FACE: {
+ Dimension face_size = GetSpriteSize(SPR_GRADIENT);
+ size->width = max(size->width, face_size.width);
+ size->height = max(size->height, face_size.height);
+ break;
+ }
+ }
}
virtual Point OnInitialPosition(int16 sm_width, int16 sm_height, int window_number)