]> git.lyx.org Git - lyx.git/blobdiff - src/MenuBackend.cpp
make frontend::Application a bit slimmer
[lyx.git] / src / MenuBackend.cpp
index b35a78375d2b7c6776216f04f3d2f0785b142e6e..8368f8e5c31e594eff262f06e264ff972fcaa85f 100644 (file)
 #include "Buffer.h"
 #include "BufferList.h"
 #include "BufferParams.h"
+#include "Converter.h"
 #include "CutAndPaste.h"
 #include "debug.h"
 #include "Floating.h"
 #include "FloatList.h"
 #include "Format.h"
 #include "gettext.h"
-#include "Importer.h"
 #include "KeyMap.h"
 #include "Session.h"
 #include "LyXAction.h"
@@ -35,6 +35,7 @@
 #include "LyXFunc.h"
 #include "Lexer.h"
 #include "Paragraph.h"
+#include "TextClass.h"
 #include "TocBackend.h"
 #include "ToolbarBackend.h"
 
@@ -72,8 +73,7 @@ class MenuNamesEqual : public std::unary_function<Menu, bool> {
 public:
        MenuNamesEqual(docstring const & name)
                : name_(name) {}
-       bool operator()(Menu const & menu) const
-       {
+       bool operator()(Menu const & menu) const {
                return menu.name() == name_;
        }
 private:
@@ -138,18 +138,15 @@ docstring const MenuItem::binding(bool forgui) const
 
        // Get the keys bound to this action, but keep only the
        // first one later
-       KeyMap::Bindings bindings = theTopLevelKeymap().findbindings(func_);
+       KeyMap::Bindings bindings = theTopLevelKeymap().findBindings(func_);
 
-       if (bindings.size()) {
+       if (bindings.size())
                return bindings.begin()->print(KeySequence::ForGui);
-       } else {
-               LYXERR(Debug::KBMAP)
-                       << "No binding for "
-                       << lyxaction.getActionName(func_.action)
-                       << '(' << to_utf8(func_.argument()) << ')' << endl;
-               return docstring();
-       }
 
+       LYXERR(Debug::KBMAP, "No binding for "
+               << lyxaction.getActionName(func_.action)
+               << '(' << to_utf8(func_.argument()) << ')');
+       return docstring();
 }
 
 
@@ -495,8 +492,9 @@ void expandDocuments(Menu & tomenu)
                
                // We cannot use a for loop as the buffer list cycles.
                do {
-                       docstring label = makeDisplayPath(b->absFileName(), 20);
-                       if (!b->isClean()) label = label + "*";
+                       docstring label = b->fileName().displayName(20);
+                       if (!b->isClean())
+                               label = label + "*";
                        if (ii < 10)
                                label = convert<docstring>(ii) + ". " + label + '|' + convert<docstring>(ii);
                        tomenu.add(MenuItem(MenuItem::Command, label,
@@ -508,7 +506,6 @@ void expandDocuments(Menu & tomenu)
        } else {
                tomenu.add(MenuItem(MenuItem::Command, _("No Documents Open!"),
                           FuncRequest(LFUN_NOACTION)));
-               return;
        }
 }
 
@@ -544,7 +541,7 @@ void expandFormats(MenuItem::Kind kind, Menu & tomenu, Buffer const * buf)
 
        switch (kind) {
        case MenuItem::ImportFormats:
-               formats = Importer::GetImportableFormats();
+               formats = theConverters().importableFormats();
                action = LFUN_BUFFER_IMPORT;
                break;
        case MenuItem::ViewFormats: