+void Menubar::Pimpl::add_toc(int menu, string const & extra_label,
+ vector<int> & smn, Window win)
+{
+#if 0
+ //xgettext:no-c-format
+ static char const * MenuNames[3] = { N_("List of Figures%m"),
+ //xgettext:no-c-format
+ N_("List of Tables%m"),
+ //xgettext:no-c-format
+ N_("List of Algorithms%m") };
+
+ vector<vector<Buffer::TocItem> > toc_list =
+ owner_->buffer()->getTocList();
+
+ // Handle LOF/LOT/LOA
+ int max_nonempty = 0;
+ for (int i = 1; i <= 3; ++i)
+ if (!toc_list[i].empty())
+ max_nonempty = i;
+
+ for (int j = 1; j <= 3; ++j)
+ if (!toc_list[j].empty()) {
+ int menu2 = get_new_submenu(smn, win);
+ for (size_type i = 0; i < toc_list[j].size(); ++i) {
+ if (i > max_number_of_items) {
+ fl_addtopup(menu2, ". . .%d");
+ break;
+ }
+ int const action = lyxaction.
+ getPseudoAction(LFUN_GOTO_PARAGRAPH,
+ tostr(toc_list[j][i].par->id()));
+ string label = fixlabel(toc_list[j][i].str);
+ label = limit_string_length(label);
+ label += "%x" + tostr(action + action_offset);
+ fl_addtopup(menu2, label.c_str());
+ }
+ if (j == max_nonempty) {
+ string label = _(MenuNames[j - 1]);
+ label += "%l";
+ fl_addtopup(menu, label.c_str(), menu2);
+ } else
+ fl_addtopup(menu, _(MenuNames[j - 1]), menu2);
+ }
+
+ // Handle normal TOC
+ if (max_nonempty == 0 && toc_list[0].empty()) {
+ fl_addtopup(menu, (_("No Table of Contents%i")
+ + extra_label).c_str());
+ return;
+ }
+
+ add_toc2(menu, extra_label, smn, win,
+ toc_list[0], 0, toc_list[0].size(), 0);
+#else
+#warning Fix Me! (Lgb)
+ Buffer::Lists toc_list = owner_->buffer()->getLists();
+ Buffer::Lists::const_iterator cit = toc_list.begin();
+ Buffer::Lists::const_iterator end = toc_list.end();
+ for (; cit != end; ++cit) {
+ // Handle this elsewhere
+ if (cit->first == "TOC") continue;
+
+ int menu2 = get_new_submenu(smn, win);
+ Buffer::SingleList::const_iterator ccit = cit->second.begin();
+ Buffer::SingleList::const_iterator eend = cit->second.end();
+ for (; ccit != eend; ++ccit) {
+ int const action =
+ lyxaction
+ .getPseudoAction(LFUN_GOTO_PARAGRAPH,
+ tostr(ccit->par->id()));
+ string label = fixlabel(ccit->str);
+ label = limit_string_length(label);
+ label += "%x" + tostr(action + action_offset);
+ fl_addtopup(menu2, label.c_str());
+ }
+ string const m = cit->first + "%m";
+ fl_addtopup(menu, m.c_str(), menu2);
+ }
+
+
+ // Handle normal TOC
+ cit = toc_list.find("TOC");
+ if (cit == end) {
+ string const tmp = _("No Table of contents%i") + extra_label;
+ fl_addtopup(menu, tmp.c_str());
+ return;
+ } else {
+ add_toc2(menu, extra_label, smn, win,
+ cit->second, 0, cit->second.size(), 0);
+ }
+
+#endif
+}
+