From d7736e3797f80fcaa0c96bc562672ee6bfaad304 Mon Sep 17 00:00:00 2001 From: frosch Date: Tue, 8 Jul 2014 20:07:50 +0000 Subject: (svn r26680) -Codechange: Simplify dropdown height computation. (Juanjo) --- src/widgets/dropdown.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/widgets/dropdown.cpp b/src/widgets/dropdown.cpp index 1f32b778e..0ff6ab577 100644 --- a/src/widgets/dropdown.cpp +++ b/src/widgets/dropdown.cpp @@ -355,16 +355,13 @@ void ShowDropDownListAt(Window *w, const DropDownList *list, int selected, int b } /* Total length of list */ - int list_height = 0; + int height = 0; for (const DropDownListItem * const *it = list->Begin(); it != list->End(); ++it) { const DropDownListItem *item = *it; - list_height += item->Height(width); + height += item->Height(width); } - /* Height of window visible */ - int height = list_height; - /* Check if the status bar is visible, as we don't want to draw over it */ int screen_bottom = GetMainViewBottom(); bool scroll = false; @@ -377,7 +374,7 @@ void ShowDropDownListAt(Window *w, const DropDownList *list, int selected, int b } else { /* ... and lastly if it won't, enable the scroll bar and fit the * list in below the widget */ - int avg_height = list_height / (int)list->Length(); + int avg_height = height / (int)list->Length(); int rows = (screen_bottom - 4 - top) / avg_height; height = rows * avg_height; scroll = true; -- cgit v1.2.3-54-g00ecf