Fixed the write-menu bug introduced in .10

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.0@1355 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Bill Spitzak 2001-01-21 07:36:45 +00:00
parent b7496f2c59
commit b88f1b2609
2 changed files with 13 additions and 14 deletions

View File

@ -1,5 +1,5 @@
//
// "$Id: Fl_Menu_Type.cxx,v 1.16.2.10 2000/11/21 21:37:07 easysw Exp $"
// "$Id: Fl_Menu_Type.cxx,v 1.16.2.11 2001/01/21 07:36:45 spitzak Exp $"
//
// Menu item code for the Fast Light Tool Kit (FLTK).
//
@ -168,21 +168,19 @@ void Fl_Menu_Item_Type::write_static() {
if (next && next->is_menu_item()) return;
// okay, when we hit last item in the menu we have to write the
// entire array out:
int mylevel;
const char* k = class_name(1);
if (k) {
write_c("\nFl_Menu_Item %s::%s[] = {\n", k, menu_name(level));
} else
write_c("\nFl_Menu_Item %s[] = {\n", menu_name(level));
int i; write_c("\nFl_Menu_Item %s::%s[] = {\n", k, menu_name(i));
} else {
int i; write_c("\nFl_Menu_Item %s[] = {\n", menu_name(i));
}
Fl_Type* t = prev; while (t && t->is_menu_item()) t = t->prev;
mylevel = t->level+1;
for (Fl_Type* q = t->next; q && q->is_menu_item(); q = q->next) {
((Fl_Menu_Item_Type*)q)->write_item();
if (q->is_parent()) mylevel++;
int l1 =
(q->next && q->next->is_menu_item()) ? q->next->level : t->next->level;
while (mylevel > l1) {write_c(" {0},\n"); mylevel--;}
mylevel = l1;
int thislevel = q->level; if (q->is_parent()) thislevel++;
int nextlevel =
(q->next && q->next->is_menu_item()) ? q->next->level : t->level+1;
while (thislevel > nextlevel) {write_c(" {0},\n"); thislevel--;}
}
write_c(" {0}\n};\n");
@ -462,5 +460,5 @@ void shortcut_in_cb(Shortcut_Button* i, void* v) {
}
//
// End of "$Id: Fl_Menu_Type.cxx,v 1.16.2.10 2000/11/21 21:37:07 easysw Exp $".
// End of "$Id: Fl_Menu_Type.cxx,v 1.16.2.11 2001/01/21 07:36:45 spitzak Exp $".
//

View File

@ -1,5 +1,5 @@
//
// "$Id: Fl_Type.cxx,v 1.6.2.4 2000/09/23 08:15:11 spitzak Exp $"
// "$Id: Fl_Type.cxx,v 1.6.2.5 2001/01/21 07:36:45 spitzak Exp $"
//
// Widget type code for the Fast Light Tool Kit (FLTK).
//
@ -334,6 +334,7 @@ void Fl_Type::remove_child(Fl_Type*) {}
// add a list of widgets as a new child of p:
void Fl_Type::add(Fl_Type *p) {
if (p && parent == p) return;
parent = p;
Fl_Type *end = this;
while (end->next) end = end->next;
@ -666,5 +667,5 @@ void Fl_Type::read_property(const char *c) {
int Fl_Type::read_fdesign(const char*, const char*) {return 0;}
//
// End of "$Id: Fl_Type.cxx,v 1.6.2.4 2000/09/23 08:15:11 spitzak Exp $".
// End of "$Id: Fl_Type.cxx,v 1.6.2.5 2001/01/21 07:36:45 spitzak Exp $".
//