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());
case ToolbarItem::SEPARATOR:
addSeparator();
break;
- case ToolbarItem::LAYOUTS:
- layout_ = new LayoutBox(this, owner_);
+ case ToolbarItem::LAYOUTS: {
+ LayoutBox * layout = owner_.getLayoutDialog();
QObject::connect(this, SIGNAL(iconSizeChanged(QSize)),
- layout_, SLOT(setIconSize(QSize)));
- addWidget(layout_);
+ layout, SLOT(setIconSize(QSize)));
+ QAction * action = addWidget(layout);
+ action->setVisible(true);
break;
+ }
case ToolbarItem::MINIBUFFER:
command_buffer_ = new GuiCommandBuffer(&owner_);
addWidget(command_buffer_);
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();
// GuiToolbars *must* be initialised before the menu bar.
normalSizedIcons(); // at least on Mac the default is 32 otherwise, which is huge
constructToolbars();
+ d.layout_ = new LayoutBox(*this);
+ d.stack_widget_->addWidget(d.layout_);
// set ourself as the current view. This is needed for the menu bar
// filling, at least for the static special menu item on Mac. Otherwise
for (; it != d.toolbars_.end(); ++it)
delete it->second;
d.toolbars_.clear();
- d.layout_ = 0;
// extracts the toolbars from the backend
Toolbars::Infos::iterator cit = guiApp->toolbars().begin();
}
-void GuiView::setLayoutDialog(LayoutBox * layout)
+LayoutBox * GuiView::getLayoutDialog() const
{
- d.layout_ = layout;
+ return d.layout_;
}
break;
}
case LFUN_DROP_LAYOUTS_CHOICE:
- if (d.layout_)
- d.layout_->showPopup();
+ d.layout_->showPopup();
break;
case LFUN_MENU_OPEN:
menuBar()->clear();
constructToolbars();
guiApp->menus().fillMenuBar(menuBar(), this, false);
- if (d.layout_)
- d.layout_->updateContents(true);
+ d.layout_->updateContents(true);
// Now update controls with current buffer.
theLyXFunc().setLyXView(this);
restoreLayout();