#include "BufferParams.h"
#include "Converter.h"
#include "CutAndPaste.h"
-#include "support/debug.h"
#include "Floating.h"
#include "FloatList.h"
#include "Format.h"
-#include "support/gettext.h"
#include "KeyMap.h"
#include "Session.h"
#include "LyXAction.h"
#include "TocBackend.h"
#include "ToolbarBackend.h"
+#include "frontends/Application.h"
+
+#include "support/convert.h"
+#include "support/debug.h"
#include "support/filetools.h"
+#include "support/gettext.h"
#include "support/lstrings.h"
-#include "support/convert.h"
#include <boost/bind.hpp>
namespace {
-class MenuNamesEqual : public std::unary_function<Menu, bool> {
+class MenuNamesEqual : public unary_function<Menu, bool> {
public:
MenuNamesEqual(docstring const & name)
: name_(name) {}
} // namespace anon
-// This is the global menu definition
-MenuBackend menubackend;
-
-
MenuItem::MenuItem(Kind kind)
: kind_(kind), optional_(false)
{}
}
-docstring const MenuItem::binding(bool forgui) const
+docstring const MenuItem::binding() const
{
if (kind_ != Command)
return docstring();
bool Menu::hasFunc(FuncRequest const & func) const
{
return find_if(begin(), end(),
- bind(std::equal_to<FuncRequest>(),
+ bind(equal_to<FuncRequest>(),
bind(&MenuItem::func, _1),
func)) != end();
}
}
-bool Menu::searchFunc(FuncRequest & func, stack<docstring> & names)
+bool Menu::searchFunc(FuncRequest & func, stack<docstring> & names) const
{
const_iterator m = begin();
const_iterator m_end = end();
return true;
} else if (m->kind() == MenuItem::Submenu) {
names.push(m->label());
- Menu submenu = menubackend.getMenu(m->submenuname());
+ Menu submenu = theApp()->menuBackend().getMenu(m->submenuname());
if (submenu.searchFunc(func, names))
return true;
else
if ((*fit)->dummy())
continue;
docstring label = from_utf8((*fit)->prettyname());
+ docstring const shortcut = from_utf8((*fit)->shortcut());
switch (kind) {
case MenuItem::ImportFormats:
BOOST_ASSERT(false);
break;
}
- if (!(*fit)->shortcut().empty())
- label += char_type('|') + from_utf8((*fit)->shortcut());
+ // FIXME: if we had proper support for translating the
+ // format names defined in configure.py, there would
+ // not be a need to check whether the shortcut is
+ // correct. If we add it uncondiitonally, it would
+ // create useless warnings on bad shortcuts
+ if (!shortcut.empty() && contains(label, shortcut))
+ label += char_type('|') + shortcut;
if (buf)
tomenu.addWithStatusCheck(MenuItem(MenuItem::Command, label,
return;
}
- FloatList const & floats =
- buf->params().getTextClass().floats();
+ FloatList const & floats = buf->params().documentClass().floats();
FloatList::const_iterator cit = floats.begin();
FloatList::const_iterator end = floats.end();
for (; cit != end; ++cit) {
return;
}
- FloatList const & floats =
- buf->params().getTextClass().floats();
+ FloatList const & floats = buf->params().documentClass().floats();
FloatList::const_iterator cit = floats.begin();
FloatList::const_iterator end = floats.end();
for (; cit != end; ++cit) {
}
-void expandFlexInsert(Menu & tomenu, Buffer const * buf, std::string s)
+void expandFlexInsert(Menu & tomenu, Buffer const * buf, string s)
{
if (!buf) {
tomenu.add(MenuItem(MenuItem::Command,
FuncRequest(LFUN_NOACTION)));
return;
}
- InsetLayouts const & insetlayouts =
- buf->params().getTextClass().insetlayouts();
- InsetLayouts::const_iterator cit = insetlayouts.begin();
- InsetLayouts::const_iterator end = insetlayouts.end();
+ TextClass::InsetLayouts const & insetLayouts =
+ buf->params().documentClass().insetLayouts();
+ TextClass::InsetLayouts::const_iterator cit = insetLayouts.begin();
+ TextClass::InsetLayouts::const_iterator end = insetLayouts.end();
for (; cit != end; ++cit) {
docstring const label = cit->first;
- if (cit->second.lyxtype == s)
+ if (cit->second.lyxtype() == s)
tomenu.addWithStatusCheck(MenuItem(MenuItem::Command,
label, FuncRequest(LFUN_FLEX_INSERT,
label)));
// check whether depth is smaller than the smallest depth in toc.
int min_depth = 1000;
for (Toc::size_type i = from; i < to; ++i)
- min_depth = std::min(min_depth, toc_list[i].depth());
+ min_depth = min(min_depth, toc_list[i].depth());
if (min_depth > depth)
depth = min_depth;
tomenu.add(MenuItem(MenuItem::Command, _("Master Document"), f));
}
- FloatList const & floatlist = buf->params().getTextClass().floats();
+ FloatList const & floatlist = buf->params().documentClass().floats();
TocList const & toc_list = buf->tocBackend().tocs();
TocList::const_iterator cit = toc_list.begin();
TocList::const_iterator end = toc_list.end();
label = _(floatName);
// BUG3633: listings is not a proper float so its name
// is not shown in floatlist.
+ else if (cit->first == "equation")
+ label = _("List of Equations");
+ else if (cit->first == "index")
+ label = _("List of Indexes");
else if (cit->first == "listing")
- label = _("List of listings");
+ label = _("List of Listings");
+ else if (cit->first == "marginalnote")
+ label = _("List of Marginal notes");
+ else if (cit->first == "note")
+ label = _("List of Notes");
+ else if (cit->first == "footnote")
+ label = _("List of Foot notes");
+ else if (cit->first == "label")
+ label = _("Labels and References");
// this should not happen now, but if something else like
// listings is added later, this can avoid an empty menu name.
else
}
-void expandPasteRecent(Menu & tomenu, Buffer const * buf)
+void expandPasteRecent(Menu & tomenu)
{
- if (!buf)
- return;
-
- vector<docstring> const sel =
- cap::availableSelections(*buf);
+ vector<docstring> const sel = cap::availableSelections();
vector<docstring>::const_iterator cit = sel.begin();
vector<docstring>::const_iterator end = sel.end();
break;
case MenuItem::PasteRecent:
- expandPasteRecent(tomenu, buf);
+ expandPasteRecent(tomenu);
break;
case MenuItem::Toolbars: