From 2fc218812721a37e4beb78dba6f84ade70ecb737 Mon Sep 17 00:00:00 2001 From: peter1138 Date: Sat, 26 Jan 2008 21:02:35 +0000 Subject: (svn r11989) -Fix: Resize autoreplace window to fit purchase information text if it is too large. --- src/autoreplace_gui.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/autoreplace_gui.cpp b/src/autoreplace_gui.cpp index 29a7490cf..a478f1456 100644 --- a/src/autoreplace_gui.cpp +++ b/src/autoreplace_gui.cpp @@ -345,7 +345,13 @@ static void ReplaceVehicleWndProc(Window *w, WindowEvent *e) /* 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); + } } } -- cgit v1.2.3-70-g09d2