]> git.lyx.org Git - lyx.git/blobdiff - src/ToolbarBackend.cpp
this we don't need anymore
[lyx.git] / src / ToolbarBackend.cpp
index 8dbe44e7257e8b638ce6b16c9f6ac14810553eff..419f0518f4008bf2e39b41078d1a4c8a2fa53fa7 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_;
@@ -54,6 +49,12 @@ private:
 ToolbarBackend toolbarbackend;
 
 
+/////////////////////////////////////////////////////////////////////////
+//
+// ToolbarItem
+//
+/////////////////////////////////////////////////////////////////////////
+
 ToolbarItem::ToolbarItem(Type type, FuncRequest const & func, docstring const & label)
        : type_(type), func_(func), label_(label)
 {
@@ -79,7 +80,7 @@ void ToolbarInfo::add(ToolbarItem const & item)
 
 ToolbarInfo & ToolbarInfo::read(Lexer & lex)
 {
-       enum tooltags {
+       enum {
                TO_COMMAND = 1,
                TO_ENDTOOLBAR,
                TO_SEPARATOR,
@@ -88,10 +89,9 @@ ToolbarInfo & ToolbarInfo::read(Lexer & lex)
                TO_TABLEINSERT,
                TO_POPUPMENU,
                TO_ICONPALETTE,
-               TO_LAST
        };
 
-       struct keyword_item toolTags[TO_LAST - 1] = {
+       struct LexerKeyword toolTags[] = {
                { "end", TO_ENDTOOLBAR },
                { "iconpalette", TO_ICONPALETTE },
                { "item", TO_COMMAND },
@@ -104,8 +104,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,14 +116,14 @@ 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;
        }
 
        bool quit = false;
 
-       lex.pushTable(toolTags, TO_LAST - 1);
+       lex.pushTable(toolTags);
 
        if (lyxerr.debugging(Debug::PARSER))
                lex.printTable(lyxerr);
@@ -135,9 +135,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 +146,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 +174,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;
 
@@ -203,32 +202,38 @@ ToolbarInfo & ToolbarInfo::read(Lexer & lex)
 
 
 
+/////////////////////////////////////////////////////////////////////////
+//
+// ToolbarBackend
+//
+/////////////////////////////////////////////////////////////////////////
+
 
 ToolbarBackend::ToolbarBackend()
 {
+       fullScreenWindows = 0;
 }
 
 
 void ToolbarBackend::readToolbars(Lexer & lex)
 {
-       enum tooltags {
+       enum {
                TO_TOOLBAR = 1,
                TO_ENDTOOLBARSET,
-               TO_LAST
        };
 
-       struct keyword_item toolTags[TO_LAST - 1] = {
+       struct LexerKeyword toolTags[] = {
                { "end", TO_ENDTOOLBARSET },
                { "toolbar", TO_TOOLBAR }
        };
 
        //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);
+       lex.pushTable(toolTags);
 
        if (lyxerr.debugging(Debug::PARSER))
                lex.printTable(lyxerr);
@@ -260,8 +265,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 +286,7 @@ void ToolbarBackend::readToolbarSettings(Lexer & lex)
                }
 
                if (tcit == tend) {
-                       lyxerr << "ToolbarBackend: undefined toolbar "
-                               << name << endl;
+                       LYXERR0("ToolbarBackend: undefined toolbar " << name);
                        return;
                }
 
@@ -304,6 +308,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 +320,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);
                }