From 9ebc60fa374a8cb754779c5c6c496eb61d32e031 Mon Sep 17 00:00:00 2001 From: "p.kosyh" Date: Wed, 4 Nov 2009 12:43:01 +0000 Subject: [PATCH] no emty lines at end of layout --- src/sdl-instead/game.c | 12 ++++++++++-- src/sdl-instead/graphics.c | 6 +++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/sdl-instead/game.c b/src/sdl-instead/game.c index 7dd16cb..d3f5346 100644 --- a/src/sdl-instead/game.c +++ b/src/sdl-instead/game.c @@ -725,7 +725,7 @@ int box_isscroll_down(int n) return -1; el_size(n, NULL, &h); l = txt_box_layout(el_box(n)); - txt_layout_size(l, NULL, &hh); + txt_layout_real_size(l, NULL, &hh); off = txt_box_off(el_box(n)); if (hh - off > h) @@ -755,7 +755,7 @@ void box_update_scrollbar(int n) y2 = y1 + h - gfx_img_h(game_theme.a_down); l = txt_box_layout(el_box(n)); - txt_layout_size(l, NULL, &hh); + txt_layout_real_size(l, NULL, &hh); off = txt_box_off(el_box(n)); if (n == el_scene) { elup = el(el_sup); @@ -1485,6 +1485,8 @@ static void menu_toggle(void) static void scroll_pup(int id) { + if (box_isscroll_up(id)) + return; game_highlight(-1, -1, 0); if (game_theme.gfx_mode == GFX_MODE_EMBEDDED) { int hh; @@ -1499,6 +1501,8 @@ static void scroll_pup(int id) static void scroll_pdown(int id) { + if (box_isscroll_down(id)) + return; game_highlight(-1, -1, 0); if (game_theme.gfx_mode == GFX_MODE_EMBEDDED) { int hh; @@ -1722,6 +1726,8 @@ void game_cursor(int on) static void scroll_up(int id, int count) { int i; + if (box_isscroll_up(id)) + return; game_highlight(-1, -1, 0); if (game_theme.gfx_mode == GFX_MODE_EMBEDDED) txt_box_scroll(el_box(id), -(FONT_SZ(game_theme.font_size)) * count); @@ -1736,6 +1742,8 @@ static void scroll_up(int id, int count) static void scroll_down(int id, int count) { int i; + if (box_isscroll_down(id)) + return; game_highlight(-1, -1, 0); if (game_theme.gfx_mode == GFX_MODE_EMBEDDED) txt_box_scroll(el_box(id), (FONT_SZ(game_theme.font_size)) * count); diff --git a/src/sdl-instead/graphics.c b/src/sdl-instead/graphics.c index d19e682..6cdb645 100644 --- a/src/sdl-instead/graphics.c +++ b/src/sdl-instead/graphics.c @@ -2464,7 +2464,11 @@ void txt_layout_real_size(layout_t lay, int *pw, int *ph) for (line = layout->lines; line; line = line->next) { if (line->w > w) w = line->w; - if (line->y + line->h > h) + + while (!line->num && line->next) + line = line->next; + + if (line->num && line->y + line->h > h) h = line->y + line->h; } if (pw)