From d4f1cc25d5685c4de36fbe4c884a136673a7e209 Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Sun, 15 Sep 2013 18:49:37 +0000
Subject: [PATCH] remove submenu buttons until fltk bug is fixed

---
 Fltk/onelabGroup.cpp | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/Fltk/onelabGroup.cpp b/Fltk/onelabGroup.cpp
index d242f7e467..a223d9dca8 100644
--- a/Fltk/onelabGroup.cpp
+++ b/Fltk/onelabGroup.cpp
@@ -976,6 +976,7 @@ static void onelab_tree_cb(Fl_Widget *w, void *data)
   setOpenedClosed(item, tree->callback_reason());
 }
 
+#if 0 // FIXME until the FLTK bug with widgets is solved
 static void onelab_subtree_cb(Fl_Widget *w, void *data)
 {
   Fl_Tree_Item *n = (Fl_Tree_Item*)data;
@@ -991,6 +992,7 @@ static void onelab_subtree_cb(Fl_Widget *w, void *data)
   setOpenedClosed(n, reason);
   FlGui::instance()->onelab->redrawTree();
 }
+#endif
 
 void onelabGroup::_computeWidths()
 {
@@ -1659,11 +1661,19 @@ void onelabGroup::rebuildTree(bool deleteWidgets)
     if(n->has_children()){
       int ww = _baseWidth - (n->depth() + 1) * _indent;
       _tree->begin();
+#if 0 // FIXME this can crash FLTK when submenus are intially closed (somehow
+      // the widget is badly positioned and overlaps the open icon, leading to
+      // a corrupted Fl_Tree_Item)
       Fl_Button *but = new Fl_Button(1, 1, ww, 1);
       but->box(FL_NO_BOX);
       but->clear_visible_focus();
       but->align(FL_ALIGN_LEFT | FL_ALIGN_INSIDE);
       but->callback(onelab_subtree_cb, (void*)n);
+#else
+      Fl_Box *but = new Fl_Box(1, 1, ww, 1);
+      //but->labelfont(FL_HELVETICA_ITALIC);
+      but->align(FL_ALIGN_LEFT | FL_ALIGN_INSIDE);
+#endif
       _treeWidgets.push_back(but);
       onelab::string o(n->label());
       but->copy_label(o.getShortName().c_str());
-- 
GitLab