#include <config.h>
-#include <algorithm>
#include "MenuBackend.h"
#include "lyxlex.h"
#include "LyXAction.h"
#include "importer.h"
#include "FloatList.h"
#include "toc.h"
+#include "CutAndPaste.h"
#include "frontends/LyXView.h"
#include "support/LAssert.h"
#include "support/filetools.h"
#include "support/lyxfunctional.h"
#include "support/lstrings.h"
+#include "support/tostr.h"
+
+#include <algorithm>
extern BufferList bufferlist;
extern boost::scoped_ptr<kb_keymap> toplevel_keymap;
case ImportFormats:
case FloatListInsert:
case FloatInsert:
+ case PasteRecent:
break;
case Command:
action_ = lyxaction.LookupFunc(command);
md_viewformats,
md_floatlistinsert,
md_floatinsert,
+ md_pasterecent,
md_last
};
{ "lastfiles", md_lastfiles },
{ "optitem", md_optitem },
{ "optsubmenu", md_optsubmenu },
+ { "pasterecent", md_pasterecent },
{ "separator", md_separator },
{ "submenu", md_submenu },
{ "toc", md_toc },
add(MenuItem(MenuItem::FloatInsert));
break;
+ case md_pasterecent:
+ add(MenuItem(MenuItem::PasteRecent));
+ break;
+
case md_optsubmenu:
optional = true;
// fallback to md_submenu
for (; docit != end; ++docit, ++ii) {
int const action =
lyxaction.getPseudoAction(LFUN_SWITCHBUFFER, *docit);
- string label = MakeDisplayPath(*docit, 30);
+ string label = MakeDisplayPath(*docit, 20);
if (ii < 10)
label = tostr(ii) + ". " + label + '|' + tostr(ii);
tomenu.add(MenuItem(MenuItem::Command, label, action), view);
}
+void expandPasteRecent(Menu & tomenu, LyXView const * view)
+{
+ vector<string> const selL =
+ CutAndPaste::availableSelections(*view->buffer());
+
+ vector<string>::const_iterator cit = selL.begin();
+ vector<string>::const_iterator end = selL.end();
+
+ for (unsigned int index = 0; cit != end; ++cit, ++index) {
+ int const action = lyxaction.getPseudoAction(LFUN_PASTE,
+ tostr(index));
+ tomenu.add(MenuItem(MenuItem::Command, *cit, action));
+ }
+}
+
+
} // namespace anon
expandFloatInsert(tomenu, view);
break;
+ case MenuItem::PasteRecent:
+ expandPasteRecent(tomenu, view);
+ break;
+
case MenuItem::Toc:
expandToc(tomenu, view);
break;