From: Holger Schemel Date: Mon, 4 Feb 2019 08:10:18 +0000 (+0100) Subject: fixed bug with cutting text on setup screens without scrollbar X-Git-Tag: 4.1.2.0~36 X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=commitdiff_plain;h=24287f46944159fd6ea121877aaa001e0f92e452 fixed bug with cutting text on setup screens without scrollbar When drawing selection lists on setup sub-screens, text was always cut on the right side to prevent drawing text over a potential scrollbar, even if the selection list is short enough that there is no scrollbar. Now it is checked if the setup sub-screens has a scrollbar or not, and the right edge where text has to be cut is calculated accordingly. --- diff --git a/src/screens.c b/src/screens.c index c8324210..64677bd2 100644 --- a/src/screens.c +++ b/src/screens.c @@ -4036,6 +4036,10 @@ static void DrawChooseTree(TreeInfo **ti_ptr) static void drawChooseTreeList(int first_entry, int num_page_entries, TreeInfo *ti) { + int num_entries = numTreeInfoInGroup(ti); + boolean scrollbar_needed = (num_entries > NUM_MENU_ENTRIES_ON_SCREEN); + int scrollbar_xpos = SC_SCROLLBAR_XPOS + menu.scrollbar_xoffset; + int screen_width = (scrollbar_needed ? scrollbar_xpos : SXSIZE); int i; char *title_string = NULL; int yoffset_sets = MENU_TITLE1_YPOS; @@ -4060,8 +4064,8 @@ static void drawChooseTreeList(int first_entry, int num_page_entries, int font_nr = FONT_TEXT_1; int font_xoffset = getFontBitmapInfo(font_nr)->draw_xoffset; int startx_text = startx + font_xoffset; - int startx_scrollbar = mSX + SC_SCROLLBAR_XPOS + menu.scrollbar_xoffset; - int text_size = startx_scrollbar - startx_text; + int endx_text = mSX + screen_width; + int text_size = endx_text - startx_text; int max_buffer_len = text_size / getFontWidth(font_nr); char buffer[max_buffer_len + 1];