]> git.lyx.org Git - lyx.git/blobdiff - src/ToolbarBackend.C
Fix bug 2474; partial fix for 1777. Added last_reference_ member to QRef class and...
[lyx.git] / src / ToolbarBackend.C
index ccb37649a92a2a4ec2b6ced070b86137fc88f1c1..0c339c454737cd2df072b96fad348038aa86a5cc 100644 (file)
@@ -20,6 +20,7 @@
 #include "support/lstrings.h"
 
 #include <boost/bind.hpp>
+#include <algorithm>
 
 #include "frontends/controllers/ControlMath.h"
 
@@ -41,9 +42,9 @@ class ToolbarNamesEqual : public std::unary_function<ToolbarInfo, bool> {
 public:
        ToolbarNamesEqual(string const & name)
                : name_(name) {}
-       bool operator()(ToolbarInfo const & tb) const
+       bool operator()(ToolbarInfo const & tbinfo) const
        {
-               return tb.name == name_;
+               return tbinfo.name == name_;
        }
 private:
        string name_;
@@ -87,14 +88,18 @@ ToolbarInfo & ToolbarInfo::read(LyXLex & lex)
                TO_LAYOUTS,
                TO_MINIBUFFER,
                TO_TABLEINSERT,
+               TO_POPUPMENU,
+               TO_ICONPALETTE,
                TO_LAST
        };
        
        struct keyword_item toolTags[TO_LAST - 1] = {
                { "end", TO_ENDTOOLBAR },
+               { "iconpalette", TO_ICONPALETTE },
                { "item", TO_COMMAND },
                { "layouts", TO_LAYOUTS },
                { "minibuffer", TO_MINIBUFFER },
+               { "popupmenu", TO_POPUPMENU },
                { "separator", TO_SEPARATOR },
                { "tableinsert", TO_TABLEINSERT }
        };
@@ -152,6 +157,24 @@ ToolbarInfo & ToolbarInfo::read(LyXLex & lex)
                                FuncRequest(kb_action(ToolbarItem::SEPARATOR))));
                        break;
 
+               case TO_POPUPMENU:
+                       if (lex.next(true)) {
+                               string const name = lex.getString();
+                               lex.next(true);
+                               docstring const label = lex.getDocString();
+                               add(ToolbarItem(ToolbarItem::POPUPMENU, name, label));
+                       }
+                       break;
+                       
+               case TO_ICONPALETTE:
+                       if (lex.next(true)) {
+                               string const name = lex.getString();
+                               lex.next(true);
+                               docstring const label = lex.getDocString();
+                               add(ToolbarItem(ToolbarItem::ICONPALETTE, name, label));
+                       }
+                       break;
+                       
                case TO_LAYOUTS:
                        add(ToolbarItem(ToolbarItem::LAYOUTS,
                                FuncRequest(kb_action(ToolbarItem::LAYOUTS))));
@@ -213,9 +236,9 @@ void ToolbarBackend::readToolbars(LyXLex & lex)
        while (lex.isOK() && !quit) {
                switch (lex.lex()) {
                case TO_TOOLBAR: {
-                       ToolbarInfo tb;
-                       tb.read(lex);
-                       toolbars.push_back(tb);
+                       ToolbarInfo tbinfo;
+                       tbinfo.read(lex);
+                       toolbars.push_back(tbinfo);
                        break;
                        }
                case TO_ENDTOOLBARSET: