+void expandPasteRecent(Menu & tomenu, Buffer const * buf)
+{
+ if (!buf)
+ return;
+
+ vector<docstring> const sel =
+ cap::availableSelections(*buf);
+
+ vector<docstring>::const_iterator cit = sel.begin();
+ vector<docstring>::const_iterator end = sel.end();
+
+ for (unsigned int index = 0; cit != end; ++cit, ++index) {
+ tomenu.add(MenuItem(MenuItem::Command, *cit,
+ FuncRequest(LFUN_PASTE, convert<string>(index))));
+ }
+}
+
+
+void expandToolbars(Menu & tomenu)
+{
+ //
+ // extracts the toolbars from the backend
+ ToolbarBackend::Toolbars::const_iterator cit = toolbarbackend.begin();
+ ToolbarBackend::Toolbars::const_iterator end = toolbarbackend.end();
+
+ for (; cit != end; ++cit) {
+ docstring label = _(cit->gui_name);
+ // frontends are not supposed to turn on/off toolbars, if they cannot
+ // update ToolbarBackend::flags. That is to say, ToolbarsBackend::flags
+ // should reflect the true state of toolbars.
+ //
+ // menu is displayed as
+ // on/off review
+ // and
+ // review (auto)
+ // in the case of auto.
+ if (cit->flags & ToolbarBackend::AUTO)
+ label += _(" (auto)");
+ tomenu.add(MenuItem(MenuItem::Command, label,
+ FuncRequest(LFUN_TOOLBAR_TOGGLE_STATE, cit->name)));
+ }
+}
+
+
+void expandBranches(Menu & tomenu, Buffer const * buf)
+{
+ if (!buf)
+ return;
+
+ BufferParams const & params = buf->getMasterBuffer()->params();
+
+ BranchList::const_iterator cit = params.branchlist().begin();
+ BranchList::const_iterator end = params.branchlist().end();
+
+ for (int ii = 1; cit != end; ++cit, ++ii) {
+ docstring label = cit->getBranch();
+ if (ii < 10)
+ label = convert<docstring>(ii) + ". " + label + char_type('|') + convert<docstring>(ii);
+ tomenu.addWithStatusCheck(MenuItem(MenuItem::Command, label,
+ FuncRequest(LFUN_BRANCH_INSERT,
+ cit->getBranch())));
+ }
+}
+
+