]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/Toolbars.cpp
Use <cstdint> instead of <boost/cstdint.hpp>
[lyx.git] / src / frontends / qt4 / Toolbars.cpp
index 2c0d2ab1a3a0a1abbc1191132cf8e53b1ff386aa..bf4617cd5b0d4842d601466178144b9fc4c29b7e 100644 (file)
@@ -74,10 +74,12 @@ ToolbarInfo & ToolbarInfo::read(Lexer & lex)
                TO_EXPORTFORMATS,
                TO_IMPORTFORMATS,
                TO_UPDATEFORMATS,
-               TO_VIEWFORMATS
+               TO_VIEWFORMATS,
+               TO_DYNAMICMENU
        };
 
        struct LexerKeyword toolTags[] = {
+               { "dynamicmenu", TO_DYNAMICMENU},
                { "end", TO_ENDTOOLBAR },
                { "exportformats", TO_EXPORTFORMATS },
                { "iconpalette", TO_ICONPALETTE },
@@ -147,29 +149,39 @@ ToolbarInfo & ToolbarInfo::read(Lexer & lex)
                        break;
 
                case TO_POPUPMENU:
+                       if (lex.next(true)) {
+                               string const pname = lex.getString();
+                               lex.next(true);
+                               docstring const label = lex.getDocString();
+                               add(ToolbarItem(ToolbarItem::POPUPMENU, pname, label));
+                       }
+                       break;
+
+               case TO_DYNAMICMENU: {
                        if (lex.next(true)) {
                                string const name = lex.getString();
                                lex.next(true);
                                docstring const label = lex.getDocString();
-                               add(ToolbarItem(ToolbarItem::POPUPMENU, name, label));
+                               add(ToolbarItem(ToolbarItem::DYNAMICMENU, name, label));
                        }
                        break;
+               }
 
                case TO_STICKYPOPUPMENU:
                        if (lex.next(true)) {
-                               string const name = lex.getString();
+                               string const pname = lex.getString();
                                lex.next(true);
                                docstring const label = lex.getDocString();
-                               add(ToolbarItem(ToolbarItem::STICKYPOPUPMENU, name, label));
+                               add(ToolbarItem(ToolbarItem::STICKYPOPUPMENU, pname, label));
                        }
                        break;
 
                case TO_ICONPALETTE:
                        if (lex.next(true)) {
-                               string const name = lex.getString();
+                               string const pname = lex.getString();
                                lex.next(true);
                                docstring const label = lex.getDocString();
-                               add(ToolbarItem(ToolbarItem::ICONPALETTE, name, label));
+                               add(ToolbarItem(ToolbarItem::ICONPALETTE, pname, label));
                        }
                        break;
 
@@ -194,9 +206,13 @@ ToolbarInfo & ToolbarInfo::read(Lexer & lex)
                case TO_IMPORTFORMATS:
                case TO_UPDATEFORMATS:
                case TO_VIEWFORMATS: {
-                       FormatList formats = (code == TO_IMPORTFORMATS) ?
-                               theConverters().importableFormats() :
-                               theConverters().exportableFormats(true);
+                       FormatList formats;
+                       if (code == TO_IMPORTFORMATS)
+                               formats = theConverters().importableFormats();
+                       else if (code == TO_EXPORTFORMATS)
+                               formats = theConverters().exportableFormats(false);
+                       else
+                               formats = theConverters().exportableFormats(true);
                        sort(formats.begin(), formats.end());
                        for (Format const * f : formats) {
                                if (f->dummy())
@@ -229,7 +245,7 @@ ToolbarInfo & ToolbarInfo::read(Lexer & lex)
                                FuncRequest func(lfun, f->name(),
                                                FuncRequest::TOOLBAR);
                                add(ToolbarItem(ToolbarItem::COMMAND, func,
-                                               bformat(tooltip, prettyname)));
+                                               bformat(tooltip, translateIfPossible(prettyname))));
                        }
                        break;
                }