]> git.lyx.org Git - lyx.git/blobdiff - src/ToolbarBackend.cpp
even example code should follow the style conventions
[lyx.git] / src / ToolbarBackend.cpp
index 8dbe44e7257e8b638ce6b16c9f6ac14810553eff..a406cb48ab25691453095343bb5f001bdf0874a6 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 <boost/bind.hpp>
-#include <algorithm>
+#include "support/debug.h"
+#include "support/gettext.h"
 
-namespace lyx {
+#include <boost/bind.hpp>
 
-using support::compare_ascii_no_case;
-using support::getVectorFromString;
+#include <algorithm>
 
-using std::endl;
-using std::make_pair;
-using std::string;
-using std::vector;
-using std::find_if;
+using namespace std;
+using namespace lyx::support;
 
+namespace lyx {
 
 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_;
@@ -104,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);
@@ -116,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;
        }
 
@@ -135,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);
@@ -147,12 +141,12 @@ ToolbarInfo & ToolbarInfo::read(Lexer & lex)
 
                case TO_MINIBUFFER:
                        add(ToolbarItem(ToolbarItem::MINIBUFFER,
-                               FuncRequest(kb_action(ToolbarItem::MINIBUFFER))));
+                               FuncRequest(FuncCode(ToolbarItem::MINIBUFFER))));
                        break;
 
                case TO_SEPARATOR:
                        add(ToolbarItem(ToolbarItem::SEPARATOR,
-                               FuncRequest(kb_action(ToolbarItem::SEPARATOR))));
+                               FuncRequest(FuncCode(ToolbarItem::SEPARATOR))));
                        break;
 
                case TO_POPUPMENU:
@@ -175,14 +169,14 @@ ToolbarInfo & ToolbarInfo::read(Lexer & lex)
 
                case TO_LAYOUTS:
                        add(ToolbarItem(ToolbarItem::LAYOUTS,
-                               FuncRequest(kb_action(ToolbarItem::LAYOUTS))));
+                               FuncRequest(FuncCode(ToolbarItem::LAYOUTS))));
                        break;
 
                case TO_TABLEINSERT:
                        if (lex.next(true)) {
                                docstring const tooltip = lex.getDocString();
                                add(ToolbarItem(ToolbarItem::TABLEINSERT,
-                                       FuncRequest(kb_action(ToolbarItem::TABLEINSERT)), tooltip));
+                                       FuncRequest(FuncCode(ToolbarItem::TABLEINSERT)), tooltip));
                        }
                        break;
 
@@ -206,6 +200,7 @@ ToolbarInfo & ToolbarInfo::read(Lexer & lex)
 
 ToolbarBackend::ToolbarBackend()
 {
+       fullScreenWindows = 0;
 }
 
 
@@ -224,8 +219,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);
@@ -260,8 +255,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);
@@ -281,8 +276,7 @@ void ToolbarBackend::readToolbarSettings(Lexer & lex)
                }
 
                if (tcit == tend) {
-                       lyxerr << "ToolbarBackend: undefined toolbar "
-                               << name << endl;
+                       LYXERR0("ToolbarBackend: undefined toolbar " << name);
                        return;
                }
 
@@ -304,6 +298,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"))
@@ -314,9 +310,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);
                }