DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

Link: http://www.fltk.org/str.php?L2597
Version: 1.3-current


Since gettext() was moved from static structure into special function,
there is a bug in counting of quantity of array lines
(fluid/Fl_Menu_Type.cxx:467, variable nItem).

Author forgot about dummy strings like as "{0,0,0...}" which separate
submenus within the menu array. Thus, runtime cycle of initializing menu
will be completed before all labels will be assigned via gettext(). To fix
this bug I propose small patch:

--- a\Fl_Menu_Type.cxx  2011-03-28 23:36:09.196969400 +0400
+++ b\Fl_Menu_Type.cxx  2011-03-28 23:37:04.062107500 +0400
@@ -466,7 +466,10 @@ void Fl_Menu_Type::write_code2() {
       const char *mName = mi->menu_name(i);
       for (Fl_Type* q = next; q && q->is_menu_item(); q = q->next) {
         if (((Fl_Menu_Item_Type*)q)->label()) nLabel++;
-        nItem++;
+        int thislevel = q->level; if (q->is_parent()) thislevel++;
+        int nextlevel =
+            (q->next && q->next->is_menu_item()) ? q->next->level :
next->level+1;
+        nItem += 1+(thislevel-nextlevel);
       }
       if (nLabel) {
         write_c("%sif (!%s_i18n_done) {\n", indent(), mName);

I have taken that method of counting from here:
fluid/Fl_Menu_Type.cxx:242.

There is one more problem, at the moment the text strings inside the menu
array have no mark like "_()" or "gettext()". Do you understand?
Automatization tools like as xgettext or poEdit can't extract these
strings from the source code. Any ideas?


Link: http://www.fltk.org/str.php?L2597
Version: 1.3-current

_______________________________________________
fltk-bugs mailing list
fltk-bugs@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk-bugs

Reply via email to