Fix group info when GUI/font is scaled.

This commit is contained in:
Jonathan G Rennison
2016-01-03 15:22:40 +00:00
parent 248bd3b2f7
commit b45e721faa

View File

@@ -193,7 +193,7 @@ private:
uint ComputeGroupInfoSize()
{
this->column_size[VGC_NAME] = maxdim(GetStringBoundingBox(STR_GROUP_DEFAULT_TRAINS + this->vli.vtype), GetStringBoundingBox(STR_GROUP_ALL_TRAINS + this->vli.vtype));
this->column_size[VGC_NAME].width = max(170u, this->column_size[VGC_NAME].width);
this->column_size[VGC_NAME].width = max((170u * FONT_HEIGHT_NORMAL) / 10u, this->column_size[VGC_NAME].width);
this->tiny_step_height = this->column_size[VGC_NAME].height;
this->column_size[VGC_PROTECT] = GetSpriteSize(SPR_GROUP_REPLACE_PROTECT);
@@ -373,7 +373,7 @@ public:
max_icon_height = max(max_icon_height, GetSpriteSize(this->GetWidget<NWidgetCore>(WID_GL_REPLACE_PROTECTION)->widget_data).height);
/* ... minus the height of the group info ... */
max_icon_height += 37;
max_icon_height += (FONT_HEIGHT_NORMAL * 3) + 7;
/* Get a multiple of tiny_step_height of that amount */
size->height = Ceil(size->height - max_icon_height, tiny_step_height);
@@ -407,6 +407,11 @@ public:
*size = maxdim(*size, d);
break;
}
case WID_GL_INFO: {
size->height = (FONT_HEIGHT_NORMAL * 3) + 7;
break;
}
}
}