summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2008-02-18 12:36:10 +0000
committerpeter1138 <peter1138@openttd.org>2008-02-18 12:36:10 +0000
commitb3f304cde3400d08f1513c8a80e75e7edab2993c (patch)
treea44b27ee1caba399285f62bb1e0de834f80581a5 /src
parent06de1215c1db2d1483bb140444e6f034094e5e25 (diff)
downloadopenttd-b3f304cde3400d08f1513c8a80e75e7edab2993c.tar.xz
(svn r12174) -Codechange: Make the patches window dynamically resize to the largest patch tab, so adding patch options is simply a case of adding to the lists.
Diffstat (limited to 'src')
-rw-r--r--src/settings_gui.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp
index b6245e2d7..15b41b32c 100644
--- a/src/settings_gui.cpp
+++ b/src/settings_gui.cpp
@@ -860,6 +860,7 @@ enum PatchesSelectionWidgets {
static void PatchesSelectionWndProc(Window *w, WindowEvent *e)
{
static Patches *patches_ptr;
+ static int patches_max = 0;
switch (e->event) {
case WE_CREATE: {
@@ -873,6 +874,8 @@ static void PatchesSelectionWndProc(Window *w, WindowEvent *e)
for (page = &_patches_page[0]; page != endof(_patches_page); page++) {
uint i;
+ if (patches_max < page->num) patches_max = page->num;
+
page->entries = MallocT<PatchEntry>(page->num);
for (i = 0; i != page->num; i++) {
uint index;
@@ -885,6 +888,10 @@ static void PatchesSelectionWndProc(Window *w, WindowEvent *e)
}
first_time = false;
}
+
+ /* Resize the window to fit the largest patch tab */
+ ResizeWindowForWidget(w, PATCHSEL_OPTIONSPANEL, 0, patches_max * 11);
+
w->LowerWidget(4);
} break;
@@ -1071,7 +1078,7 @@ static const Widget _patches_selection_widgets[] = {
{ WWT_CLOSEBOX, RESIZE_NONE, 10, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
{ WWT_CAPTION, RESIZE_NONE, 10, 11, 369, 0, 13, STR_CONFIG_PATCHES_CAPTION, STR_018C_WINDOW_TITLE_DRAG_THIS},
{ WWT_PANEL, RESIZE_NONE, 10, 0, 369, 14, 41, 0x0, STR_NULL},
-{ WWT_PANEL, RESIZE_NONE, 10, 0, 369, 42, 380, 0x0, STR_NULL},
+{ WWT_PANEL, RESIZE_NONE, 10, 0, 369, 42, 50, 0x0, STR_NULL},
{ WWT_TEXTBTN, RESIZE_NONE, 3, 10, 96, 16, 27, STR_CONFIG_PATCHES_GUI, STR_NULL},
{ WWT_TEXTBTN, RESIZE_NONE, 3, 97, 183, 16, 27, STR_CONFIG_PATCHES_CONSTRUCTION, STR_NULL},
@@ -1083,7 +1090,7 @@ static const Widget _patches_selection_widgets[] = {
};
static const WindowDesc _patches_selection_desc = {
- WDP_CENTER, WDP_CENTER, 370, 381, 370, 381,
+ WDP_CENTER, WDP_CENTER, 370, 51, 370, 51,
WC_GAME_OPTIONS, WC_NONE,
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET,
_patches_selection_widgets,