Fixed symbol demo label bug (STR #777)

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@4260 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Michael R Sweet 2005-04-10 21:53:03 +00:00
parent ba3bde19c5
commit 5b20fbdce4
2 changed files with 15 additions and 11 deletions

View File

@ -2,7 +2,8 @@ CHANGES IN FLTK 1.1.7
- Documentation fixes (STR #648, STR #692, STR #730, STR
#744, STR #745)
- Fixed position of menu titles (STR #794)
- Fixed symbol demo label bug (STR #777)
- Fixed position of menu titles (STR #795)
- Added missing Fl_Window::copy_label() method.
- Fixed wrong tooltip in fluid (STR #784)
- Added zlib path to fluid (STR #783)

View File

@ -49,24 +49,21 @@ void slider_cb(Fl_Widget *w, void *) {
int sze = (int)size->value();
for (int i = window->children(); i--; ) { // all window children
Fl_Widget *wc = window->child(i);
const char *l = wc->label();
if ( *l == '@' ) { // all children with '@'
if ( *(++l) == '@' ) { // ascii legend?
l++;
while (isdigit(*l)||(*l=='+'&&l[1])||*l=='-') { l++; }
const char *l = (const char *)(wc->user_data());
if ( l && *l == '@' ) { // all children with '@'
l ++;
if ( wc->box() == FL_NO_BOX ) { // ascii legend?
if (val&&sze) sprintf(buf, "@@%+d%d%s", sze, val, l);
else if (val) sprintf(buf, "@@%d%s", val, l);
else if (sze) sprintf(buf, "@@%+d%s", sze, l);
else sprintf(buf, "@@%s", l);
} else { // box with symbol
while (isdigit(*l)||(*l=='+'&&l[1])||*l=='-') { l++; }
if (val&&sze) sprintf(buf, "@%+d%d%s", sze, val, l);
else if (val) sprintf(buf, "@%d%s", val, l);
else if (sze) sprintf(buf, "@%+d%s", sze, l);
else sprintf(buf, "@%s", l);
}
free((void*)(wc->label()));
wc->label(strdup(buf));
wc->copy_label(buf);
}
}
window->redraw();
@ -80,11 +77,17 @@ void bt(const char *name) {
x = x*W+10;
y = y*H+10;
sprintf(buf, "@%s", name);
Fl_Box *a = new Fl_Box(FL_NO_BOX,x,y,W-20,H-20,strdup(buf));
Fl_Box *a = new Fl_Box(x,y,W-20,H-20);
a->box(FL_NO_BOX);
a->copy_label(buf);
a->align(FL_ALIGN_BOTTOM);
a->labelsize(11);
Fl_Box *b = new Fl_Box(FL_UP_BOX,x,y,W-20,H-20,strdup(name));
a->user_data((void *)name);
Fl_Box *b = new Fl_Box(x,y,W-20,H-20);
b->box(FL_UP_BOX);
b->copy_label(name);
b->labelcolor(FL_DARK3);
b->user_data((void *)name);
}
int main(int argc, char ** argv) {