- //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());
+ 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();
+ size_type count = 0;
+ for (; ccit != eend; ++ccit) {
+ ++count;
+ if (count > max_number_of_items) {
+ int menu_tmp = get_new_submenu(smn, win);
+ string label = _("More");
+ label += "...%m";
+ fl_addtopup(menu_current, label.c_str(), menu_tmp);
+ count = 1;
+ menu_current = menu_tmp;