]> git.lyx.org Git - lyx.git/blobdiff - src/ToolbarBackend.cpp
Revert 23154.
[lyx.git] / src / ToolbarBackend.cpp
index 8baddc4f54c9dfdeec1d626cfdab4a0b0d7469b9..34f3d5bac1d28a7e9e22a39f6333ff509a07630d 100644 (file)
 #include "ToolbarBackend.h"
 #include "FuncRequest.h"
 #include "Lexer.h"
-#include "debug.h"
-#include "gettext.h"
 #include "LyXAction.h"
 #include "support/lstrings.h"
 
+#include "support/debug.h"
+#include "support/gettext.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_;
@@ -106,8 +99,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 +111,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 +130,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 +218,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 +254,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 +275,7 @@ void ToolbarBackend::readToolbarSettings(Lexer & lex)
                }
 
                if (tcit == tend) {
-                       lyxerr << "ToolbarBackend: undefined toolbar "
-                               << name << endl;
+                       LYXERR0("ToolbarBackend: undefined toolbar " << name);
                        return;
                }
 
@@ -306,6 +297,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"))
@@ -316,9 +309,12 @@ void ToolbarBackend::readToolbarSettings(Lexer & lex)
                                flag = ToolbarInfo::LEFT;
                        else if (!compare_ascii_no_case(*cit, "right"))
                                flag = ToolbarInfo::RIGHT;
+                       else if (!compare_ascii_no_case(*cit, "auto"))
+                               flag = ToolbarInfo::AUTO;
                        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);
                }