]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiToolbar.cpp
* fix spelling in comments to please John.
[lyx.git] / src / frontends / qt4 / GuiToolbar.cpp
index b813d4647fcd66a9df2cf125d5cb527442389750..0469db25151c5542926b60ce49d4b9565da55f57 100644 (file)
@@ -53,7 +53,7 @@ namespace frontend {
 
 GuiToolbar::GuiToolbar(ToolbarInfo const & tbinfo, GuiView & owner)
        : QToolBar(toqstr(tbinfo.gui_name), &owner), visibility_(0),
-         allowauto_(false), owner_(owner), layout_(0), command_buffer_(0),
+         allowauto_(false), owner_(owner), command_buffer_(0),
          tbinfo_(tbinfo), filled_(false)
 {
        setIconSize(owner.iconSize());
@@ -175,7 +175,12 @@ MenuButton::MenuButton(GuiToolbar * bar, ToolbarItem const & item, bool const st
        setToolTip(label);
        setStatusTip(label);
        setText(label);
-       setIcon(QIcon(getPixmap("images/math/", toqstr(tbitem_.name_), "png")));
+       QString const name = toqstr(tbitem_.name_);
+       FileName const fname = libFileSearch("images/math/", name, "png");
+       if (fname.exists())
+           setIcon(QIcon(getPixmap("images/math/", name, "png")));
+       else
+           setIcon(QIcon(getPixmap("images/", name, "png")));
        if (sticky)
                connect(this, SIGNAL(triggered(QAction *)),
                        this, SLOT(actionTriggered(QAction *)));
@@ -226,10 +231,14 @@ void GuiToolbar::add(ToolbarItem const & item)
        case ToolbarItem::SEPARATOR:
                addSeparator();
                break;
-       case ToolbarItem::LAYOUTS:
-               layout_ = new LayoutBox(this, owner_);
-               addWidget(layout_);
+       case ToolbarItem::LAYOUTS: {
+               LayoutBox * layout = owner_.getLayoutDialog();
+               QObject::connect(this, SIGNAL(iconSizeChanged(QSize)),
+                       layout, SLOT(setIconSize(QSize)));
+               QAction * action = addWidget(layout);
+               action->setVisible(true);
                break;
+       }
        case ToolbarItem::MINIBUFFER:
                command_buffer_ = new GuiCommandBuffer(&owner_);
                addWidget(command_buffer_);
@@ -294,8 +303,9 @@ void GuiToolbar::update(bool in_math, bool in_table, bool in_review,
        for (int i = 0; i < actions_.size(); ++i)
                actions_[i]->update();
 
-       if (layout_)
-               layout_->setEnabled(lyx::getStatus(FuncRequest(LFUN_LAYOUT)).enabled());
+       LayoutBox * layout = owner_.getLayoutDialog();
+       if (layout)
+               layout->setEnabled(lyx::getStatus(FuncRequest(LFUN_LAYOUT)).enabled());
 
        // emit signal
        updated();