mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-23 02:14:50 +00:00
Move layout from GuiToolbar to GuiView. Now, it is possible to use the popup also when the Toolbar has not been visible before.
see: http://www.mail-archive.com/lyx-users@lists.lyx.org/msg75503.html git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31042 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
7215b099d3
commit
81554c90f1
@ -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());
|
||||
@ -226,12 +226,14 @@ void GuiToolbar::add(ToolbarItem const & item)
|
||||
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_);
|
||||
@ -296,8 +298,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();
|
||||
|
@ -122,8 +122,6 @@ private:
|
||||
///
|
||||
GuiView & owner_;
|
||||
///
|
||||
LayoutBox * layout_;
|
||||
///
|
||||
GuiCommandBuffer * command_buffer_;
|
||||
///
|
||||
ToolbarInfo const & tbinfo_;
|
||||
|
@ -296,6 +296,8 @@ GuiView::GuiView(int id)
|
||||
// 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
|
||||
@ -433,7 +435,6 @@ void GuiView::constructToolbars()
|
||||
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();
|
||||
@ -1068,9 +1069,9 @@ void GuiView::removeWorkArea(GuiWorkArea * wa)
|
||||
}
|
||||
|
||||
|
||||
void GuiView::setLayoutDialog(LayoutBox * layout)
|
||||
LayoutBox * GuiView::getLayoutDialog() const
|
||||
{
|
||||
d.layout_ = layout;
|
||||
return d.layout_;
|
||||
}
|
||||
|
||||
|
||||
@ -2070,8 +2071,7 @@ bool GuiView::dispatch(FuncRequest const & cmd)
|
||||
break;
|
||||
}
|
||||
case LFUN_DROP_LAYOUTS_CHOICE:
|
||||
if (d.layout_)
|
||||
d.layout_->showPopup();
|
||||
d.layout_->showPopup();
|
||||
break;
|
||||
|
||||
case LFUN_MENU_OPEN:
|
||||
@ -2480,8 +2480,7 @@ void GuiView::resetDialogs()
|
||||
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();
|
||||
|
@ -82,7 +82,7 @@ public:
|
||||
bool dispatch(FuncRequest const & cmd);
|
||||
|
||||
///
|
||||
void setLayoutDialog(LayoutBox *);
|
||||
LayoutBox * getLayoutDialog() const;
|
||||
|
||||
/// \return the buffer currently shown in this window
|
||||
Buffer * buffer();
|
||||
|
@ -414,7 +414,6 @@ LayoutBox::LayoutBox(GuiView & owner)
|
||||
QObject::connect(this, SIGNAL(activated(int)),
|
||||
this, SLOT(selected(int)));
|
||||
|
||||
d->owner_.setLayoutDialog(this);
|
||||
updateContents(true);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user