]> git.lyx.org Git - lyx.git/blobdiff - src/ToolbarBackend.cpp
Embedding: saving inzip name to .lyx file so that embedded files can always be found...
[lyx.git] / src / ToolbarBackend.cpp
index c6f78f61edfd64092842ba87298ff25eea640d8f..b038623fcb14260b114cc71036b5863fb8f92b4a 100644 (file)
 #include "ToolbarBackend.h"
 #include "FuncRequest.h"
 #include "Lexer.h"
-#include "debug.h"
-#include "gettext.h"
+#include "support/debug.h"
+#include "support/gettext.h"
 #include "LyXAction.h"
 #include "support/lstrings.h"
 
 #include <boost/bind.hpp>
 #include <algorithm>
 
-#include "frontends/controllers/ControlMath.h"
+using namespace std;
+using namespace lyx::support;
 
 namespace lyx {
 
-using support::compare_ascii_no_case;
-using support::getVectorFromString;
-
-using std::endl;
-using std::make_pair;
-using std::string;
-using std::vector;
-using std::find_if;
-
-
 namespace {
 
-class ToolbarNamesEqual : public std::unary_function<ToolbarInfo, bool> {
+class ToolbarNamesEqual
+{
 public:
-       ToolbarNamesEqual(string const & name)
-               : name_(name) {}
+       ToolbarNamesEqual(string const & name) : name_(name) {}
        bool operator()(ToolbarInfo const & tbinfo) const
        {
                return tbinfo.name == name_;
@@ -63,7 +54,7 @@ ToolbarItem::ToolbarItem(Type type, FuncRequest const & func, docstring const &
 
 
 ToolbarItem::ToolbarItem(Type type, string const & name, docstring const & label)
-       : type_(type), name_(name), label_(label)
+       : type_(type), label_(label), name_(name)
 {
 }
 
@@ -106,8 +97,8 @@ ToolbarInfo & ToolbarInfo::read(Lexer & lex)
 
        //consistency check
        if (compare_ascii_no_case(lex.getString(), "toolbar")) {
-               lyxerr << "ToolbarInfo::read: ERROR wrong token:`"
-                      << lex.getString() << '\'' << endl;
+               LYXERR0("ToolbarInfo::read: ERROR wrong token:`"
+                      << lex.getString() << '\'');
        }
 
        lex.next(true);
@@ -118,8 +109,8 @@ ToolbarInfo & ToolbarInfo::read(Lexer & lex)
 
        // FIXME what to do here?
        if (!lex) {
-               lyxerr << "ToolbarInfo::read: Malformed toolbar "
-                       "description " <<  lex.getString() << endl;
+               LYXERR0("ToolbarInfo::read: Malformed toolbar "
+                       "description " <<  lex.getString());
                return *this;
        }
 
@@ -137,9 +128,8 @@ ToolbarInfo & ToolbarInfo::read(Lexer & lex)
                                docstring const tooltip = translateIfPossible(lex.getDocString());
                                lex.next(true);
                                string const func_arg = lex.getString();
-                               LYXERR(Debug::PARSER)
-                                       << "ToolbarInfo::read TO_COMMAND func: `"
-                                       << func_arg << '\'' << endl;
+                               LYXERR(Debug::PARSER, "ToolbarInfo::read TO_COMMAND func: `"
+                                       << func_arg << '\'');
 
                                FuncRequest func =
                                        lyxaction.lookupFunc(func_arg);
@@ -226,8 +216,8 @@ void ToolbarBackend::readToolbars(Lexer & lex)
 
        //consistency check
        if (compare_ascii_no_case(lex.getString(), "toolbarset")) {
-               lyxerr << "ToolbarBackend::readToolbars: ERROR wrong token:`"
-                      << lex.getString() << '\'' << endl;
+               LYXERR0("ToolbarBackend::readToolbars: ERROR wrong token:`"
+                      << lex.getString() << '\'');
        }
 
        lex.pushTable(toolTags, TO_LAST - 1);
@@ -262,8 +252,8 @@ void ToolbarBackend::readToolbarSettings(Lexer & lex)
 {
        //consistency check
        if (compare_ascii_no_case(lex.getString(), "toolbars")) {
-               lyxerr << "ToolbarBackend::readToolbarSettings: ERROR wrong token:`"
-                      << lex.getString() << '\'' << endl;
+               LYXERR0("ToolbarBackend::readToolbarSettings: ERROR wrong token:`"
+                      << lex.getString() << '\'');
        }
 
        lex.next(true);
@@ -283,8 +273,7 @@ void ToolbarBackend::readToolbarSettings(Lexer & lex)
                }
 
                if (tcit == tend) {
-                       lyxerr << "ToolbarBackend: undefined toolbar "
-                               << name << endl;
+                       LYXERR0("ToolbarBackend: undefined toolbar " << name);
                        return;
                }
 
@@ -306,6 +295,8 @@ void ToolbarBackend::readToolbarSettings(Lexer & lex)
                                flag = ToolbarInfo::MATH;
                        else if (!compare_ascii_no_case(*cit, "table"))
                                flag = ToolbarInfo::TABLE;
+                       else if (!compare_ascii_no_case(*cit, "mathmacrotemplate"))
+                               flag = ToolbarInfo::MATHMACROTEMPLATE;
                        else if (!compare_ascii_no_case(*cit, "review"))
                                flag = ToolbarInfo::REVIEW;
                        else if (!compare_ascii_no_case(*cit, "top"))
@@ -317,8 +308,9 @@ void ToolbarBackend::readToolbarSettings(Lexer & lex)
                        else if (!compare_ascii_no_case(*cit, "right"))
                                flag = ToolbarInfo::RIGHT;
                        else {
-                               lyxerr << "ToolbarBackend::readToolbarSettings: unrecognised token:`"
-                                      << *cit << '\'' << endl;
+                               LYXERR(Debug::ANY,
+                                       "ToolbarBackend::readToolbarSettings: unrecognised token:`"
+                                       << *cit << '\'');
                        }
                        tcit->flags = static_cast<ToolbarInfo::Flags>(tcit->flags | flag);
                }