#include "BufferParams.h"
#include "CutAndPaste.h"
#include "debug.h"
-#include "Exporter.h"
#include "Floating.h"
#include "FloatList.h"
#include "Format.h"
using std::sort;
using std::string;
using std::vector;
-
+using std::stack;
namespace {
}
+bool Menu::searchFunc(FuncRequest & func, stack<docstring> & names)
+{
+ const_iterator m = begin();
+ const_iterator m_end = end();
+ for (; m != m_end; ++m) {
+ if (m->kind() == MenuItem::Command && m->func() == func) {
+ names.push(m->label());
+ return true;
+ } else if (m->kind() == MenuItem::Submenu) {
+ names.push(m->label());
+ Menu submenu = menubackend.getMenu(m->submenuname());
+ if (submenu.searchFunc(func, names))
+ return true;
+ else
+ names.pop();
+ }
+ }
+ return false;
+}
+
+
void MenuBackend::specialMenu(Menu const & menu)
{
specialmenu_ = menu;
// We cannot use a for loop as the buffer list cycles.
do {
- docstring label = makeDisplayPath(b->fileName(), 20);
+ docstring label = makeDisplayPath(b->absFileName(), 20);
if (!b->isClean()) label = label + "*";
if (ii < 10)
label = convert<docstring>(ii) + ". " + label + '|' + convert<docstring>(ii);
- tomenu.add(MenuItem(MenuItem::Command, label, FuncRequest(LFUN_BUFFER_SWITCH, b->fileName())));
+ tomenu.add(MenuItem(MenuItem::Command, label,
+ FuncRequest(LFUN_BUFFER_SWITCH, b->absFileName())));
b = theBufferList().next(b);
++ii;
action = LFUN_BUFFER_IMPORT;
break;
case MenuItem::ViewFormats:
- formats = Exporter::getExportableFormats(*buf, true);
+ formats = buf->exportableFormats(true);
action = LFUN_BUFFER_VIEW;
break;
case MenuItem::UpdateFormats:
- formats = Exporter::getExportableFormats(*buf, true);
+ formats = buf->exportableFormats(true);
action = LFUN_BUFFER_UPDATE;
break;
default:
- formats = Exporter::getExportableFormats(*buf, false);
+ formats = buf->exportableFormats(false);
action = LFUN_BUFFER_EXPORT;
}
sort(formats.begin(), formats.end(), compare_format());
cbuf->structureChanged();
// Add an entry for the master doc if this is a child doc
- Buffer const * const master = buf->getMasterBuffer();
+ Buffer const * const master = buf->masterBuffer();
if (buf != master) {
ParIterator const pit = par_iterator_begin(master->inset());
string const arg = convert<string>(pit->id());
return;
}
- BufferParams const & params = buf->getMasterBuffer()->params();
+ BufferParams const & params = buf->masterBuffer()->params();
if (params.branchlist().empty()) {
tomenu.add(MenuItem(MenuItem::Command,
_("No Branch in Document!"),