- //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);
-
-}
-
-void add_references2(int menu, vector<int> & smn, Window win,
- vector<string> const & label_list, string const & type)
-{
- size_type const max_number_of_items = 25;
- size_type const max_number_of_items2 = 20;
- string::size_type const max_item_length = 40;
- string::size_type const max_item_length2 = 20;
-
- if (label_list.size() <= max_number_of_items)
- for (size_type i = 0; i < label_list.size(); ++i) {
- int const action = (type == "goto")
- ? lyxaction.getPseudoAction(LFUN_REF_GOTO,
- label_list[i])
- : lyxaction.getPseudoAction(LFUN_REF_INSERT,
- type + "|++||++|"
- + label_list[i]);
- string label = label_list[i];
- if (label.size() > max_item_length)
- label = label.substr(0, max_item_length-1) + "$";
- label += "%x" + tostr(action + action_offset);
- fl_addtopup(menu, label.c_str());
- }
- else {
+ 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;
+
+ // All the rest is for floats
+ int menu_first_sub = get_new_submenu(smn, win);
+ int menu_current = menu_first_sub;
+ Buffer::SingleList::const_iterator ccit = cit->second.begin();
+ Buffer::SingleList::const_iterator eend = cit->second.end();