Mercurial > hg > openttd
changeset 8419:a2befdde2e85 draft
(svn r11989) -Fix: Resize autoreplace window to fit purchase information text if it is too large.
author | peter1138 <peter1138@openttd.org> |
---|---|
date | Sat, 26 Jan 2008 21:02:35 +0000 |
parents | 3a56a9f2f4c3 |
children | 370ea805f591 |
files | src/autoreplace_gui.cpp |
diffstat | 1 files changed, 7 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/autoreplace_gui.cpp +++ b/src/autoreplace_gui.cpp @@ -345,7 +345,13 @@ /* Also draw the details if an engine is selected */ if (WP(w, replaceveh_d).sel_engine[i] != INVALID_ENGINE) { const Widget *wi = &w->widget[i == 0 ? RVW_WIDGET_LEFT_DETAILS : RVW_WIDGET_RIGHT_DETAILS]; - DrawVehiclePurchaseInfo(wi->left + 2, wi->top + 1, wi->right - wi->left - 2, WP(w, replaceveh_d).sel_engine[i]); + int text_end = DrawVehiclePurchaseInfo(wi->left + 2, wi->top + 1, wi->right - wi->left - 2, WP(w, replaceveh_d).sel_engine[i]); + + if (text_end > wi->bottom) { + SetWindowDirty(w); + ResizeWindowForWidget(w, i == 0 ? RVW_WIDGET_LEFT_DETAILS : RVW_WIDGET_RIGHT_DETAILS, 0, text_end - wi->bottom); + SetWindowDirty(w); + } } }