From 141c3594d27be719da816775de788cbd6797375c Mon Sep 17 00:00:00 2001 From: Albrecht Schlosser Date: Tue, 12 Sep 2017 13:44:15 +0000 Subject: Fluid: remove redundant code, fix FL_IMAGE_LABEL labeltype. Remove leading underscore from _FL_IMAGE_LABEL. Remove redundant assignment of image(). Thanks to Greg for finding these issues. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12449 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- fluid/factory.cxx | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/fluid/factory.cxx b/fluid/factory.cxx index edde697f9..d7133377e 100644 --- a/fluid/factory.cxx +++ b/fluid/factory.cxx @@ -1046,23 +1046,25 @@ Fl_Menu_Item New_Menu[] = { #include -// modify a menuitem to display an icon in front of the label -static void make_iconlabel( Fl_Menu_Item *mi, Fl_Image *ic, const char *txt ) +// Modify a menuitem to display an icon in front of the label. This is +// implemented using Fl_Multi_Label as the labeltype (FL_MULTI_LABEL). +// The icon (ic) may be null. If ic is null only the text (txt) is assigned +// to the label - Fl_Multi_Label is not used. txt must not be null. +static void make_iconlabel(Fl_Menu_Item *mi, Fl_Image *ic, const char *txt) { if (ic) { char *t1 = new char[strlen(txt)+6]; - strcpy( t1, " " ); + strcpy(t1, " "); strcat(t1, txt); strcat(t1, "..."); - mi->image( ic ); Fl_Multi_Label *ml = new Fl_Multi_Label; ml->labela = (char*)ic; ml->labelb = t1; - ml->typea = _FL_IMAGE_LABEL; + ml->typea = FL_IMAGE_LABEL; ml->typeb = FL_NORMAL_LABEL; - ml->label( mi ); + ml->label(mi); } - else if (txt!=mi->text) + else if (txt != mi->text) mi->label(txt); } -- cgit v1.2.3