From b5a73c78e61c18f4d08aec39a6edf5b19b1dbfd4 Mon Sep 17 00:00:00 2001 From: Matthias Melcher Date: Sat, 30 Oct 2010 21:32:15 +0000 Subject: Fixed label alignment (STR #2436) git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7782 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/fl_draw.cxx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/fl_draw.cxx') diff --git a/src/fl_draw.cxx b/src/fl_draw.cxx index 36a4e5cb7..5e07aaf69 100644 --- a/src/fl_draw.cxx +++ b/src/fl_draw.cxx @@ -193,7 +193,7 @@ void fl_draw( char buf[MAXBUF]; int buflen; char symbol[2][255], *symptr; - int symwidth[2], symoffset, symtotal; + int symwidth[2], symoffset, symtotal, imgtotal; // count how many lines and put the last one into the buffer: int lines; @@ -226,13 +226,14 @@ void fl_draw( } symtotal = symwidth[0] + symwidth[1]; + imgtotal = (img && (align&FL_ALIGN_IMAGE_NEXT_TO_TEXT)) ? img->w() : 0; int strw = 0; int strh; if (str) { for (p = str, lines=0; p;) { - e = fl_expand_text(p, buf, MAXBUF, w - symtotal, buflen, width, + e = fl_expand_text(p, buf, MAXBUF, w - symtotal - imgtotal, buflen, width, align&FL_ALIGN_WRAP, draw_symbols); if (strw1) e = fl_expand_text(p, buf, MAXBUF, w - symtotal, buflen, + if (lines>1) e = fl_expand_text(p, buf, MAXBUF, w - symtotal - imgtotal, buflen, width, align&FL_ALIGN_WRAP, draw_symbols); else e = ""; -- cgit v1.2.3