From d5d307d503dc4c3b5f5ad645559ca5e1d9c98609 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Tue, 25 Sep 2018 14:15:55 +0200 Subject: gl: Fix dialog size calculation in text field dialog. --- platform/gl/gl-font.c | 10 +++++----- platform/gl/gl-form.c | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/platform/gl/gl-font.c b/platform/gl/gl-font.c index 33dbcdf5..0e33a6a3 100644 --- a/platform/gl/gl-font.c +++ b/platform/gl/gl-font.c @@ -346,8 +346,8 @@ int ui_break_lines(char *a, struct line *lines, int maxlines, int width, int *ma { lines[n].a = a; lines[n].b = b; - ++n; } + ++n; if (maxwidth && *maxwidth < x) *maxwidth = x; a = next; @@ -371,8 +371,8 @@ int ui_break_lines(char *a, struct line *lines, int maxlines, int width, int *ma { lines[n].a = a; lines[n].b = space; - ++n; } + ++n; if (maxwidth && *maxwidth < space_x) *maxwidth = space_x; a = next = space + 1; @@ -385,8 +385,8 @@ int ui_break_lines(char *a, struct line *lines, int maxlines, int width, int *ma { lines[n].a = a; lines[n].b = b; - ++n; } + ++n; if (maxwidth && *maxwidth < x) *maxwidth = x; a = b; @@ -406,11 +406,11 @@ int ui_break_lines(char *a, struct line *lines, int maxlines, int width, int *ma { lines[n].a = a; lines[n].b = b; - ++n; } + ++n; if (maxwidth && *maxwidth < x) *maxwidth = x; - return n; + return n < maxlines ? n : maxlines; } void ui_draw_lines(float x, float y, struct line *lines, int n) diff --git a/platform/gl/gl-form.c b/platform/gl/gl-form.c index 4e0c4b88..94daa8e2 100644 --- a/platform/gl/gl-form.c +++ b/platform/gl/gl-form.c @@ -92,7 +92,7 @@ static void sig_dialog(void) { const char *label = pdf_field_label(ctx, sig_widget->page->doc, sig_widget->obj); - ui_dialog_begin(400, ui.gridsize*3 + ui.lineheight*10); + ui_dialog_begin(400, (ui.gridsize+4)*3 + ui.lineheight*10); { ui_layout(T, X, NW, 2, 2); @@ -141,7 +141,7 @@ static void tx_dialog(void) int lbl_h = ui_break_lines((char*)label, NULL, 20, 394, NULL); int is; - ui_dialog_begin(400, ui.gridsize*3 + ui.lineheight*(tx_h+lbl_h-1)); + ui_dialog_begin(400, (ui.gridsize+4)*3 + ui.lineheight*(tx_h+lbl_h-2)); { ui_layout(T, X, NW, 2, 2); ui_label("%s", label); @@ -194,7 +194,7 @@ static void ch_dialog(void) pdf_choice_widget_options(ctx, ch_widget->page->doc, ch_widget, 0, options); value = pdf_field_value(ctx, ch_widget->page->doc, ch_widget->obj); - ui_dialog_begin(400, ui.gridsize*3 + ui.lineheight*label_h); + ui_dialog_begin(400, (ui.gridsize+4)*3 + ui.lineheight*(label_h-1)); { ui_layout(T, X, NW, 2, 2); -- cgit v1.2.3