X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ffrontends%2Fqt4%2FLayoutBox.cpp;h=23017cf6f89e8f8d75ecedfdca2528560bf206b6;hb=425d092204118ea6c24c28e85fdf03fcf2bb51a4;hp=f065c5cc5fbdd90713d3ae0c26137ef7e700625b;hpb=70fdfa86dfe4c6fa20b34aebf82370014e86561c;p=lyx.git diff --git a/src/frontends/qt4/LayoutBox.cpp b/src/frontends/qt4/LayoutBox.cpp index f065c5cc5f..23017cf6f8 100644 --- a/src/frontends/qt4/LayoutBox.cpp +++ b/src/frontends/qt4/LayoutBox.cpp @@ -17,10 +17,8 @@ #include "LayoutBox.h" -#include "Action.h" #include "GuiView.h" #include "qt_helpers.h" -#include "Toolbars.h" #include "Buffer.h" #include "BufferParams.h" @@ -28,7 +26,6 @@ #include "Cursor.h" #include "FuncRequest.h" #include "FuncStatus.h" -#include "Layout.h" #include "LyXFunc.h" #include "LyXRC.h" #include "Paragraph.h" @@ -37,33 +34,17 @@ #include "insets/InsetText.h" #include "support/debug.h" -#include "support/filetools.h" #include "support/gettext.h" +#include "support/lassert.h" #include "support/lstrings.h" -#include #include -#include -#include -#include #include #include -#include -#include -#include #include -#include -#include #include -#include #include -#include -#include #include -#include -#include - -#include "support/lassert.h" using namespace std; using namespace lyx::support; @@ -398,7 +379,7 @@ void LayoutBox::Private::setFilter(QString const & s) // on the QComboBox. LASSERT(!inShowPopup_, /**/); inShowPopup_ = true; - p->showPopup(); + p->QComboBox::showPopup(); inShowPopup_ = false; // The item delegate hack is off again. So trigger a relayout of the popup. @@ -416,7 +397,7 @@ void LayoutBox::Private::setFilter(QString const & s) } -LayoutBox::LayoutBox(QToolBar * bar, GuiView & owner) +LayoutBox::LayoutBox(GuiView & owner) : d(new Private(this, owner)) { setSizeAdjustPolicy(QComboBox::AdjustToContents); @@ -432,10 +413,7 @@ LayoutBox::LayoutBox(QToolBar * bar, GuiView & owner) QObject::connect(this, SIGNAL(activated(int)), this, SLOT(selected(int))); - QObject::connect(bar, SIGNAL(iconSizeChanged(QSize)), - this, SLOT(setIconSize(QSize))); - d->owner_.setLayoutDialog(this); updateContents(true); } @@ -638,23 +616,20 @@ void LayoutBox::addItemSort(docstring const & item, docstring const & category, void LayoutBox::updateContents(bool reset) { d->resetFilter(); - - Buffer const * buffer = d->owner_.buffer(); - if (!buffer) { + BufferView const * bv = d->owner_.currentBufferView(); + if (!bv) { d->model_->clear(); setEnabled(false); d->text_class_ = 0; d->inset_ = 0; return; } - // we'll only update the layout list if the text class has changed // or we've moved from one inset to another - DocumentClass const * text_class = &buffer->params().documentClass(); - Inset const * inset = - &(d->owner_.view()->cursor().innerText()->inset()); + DocumentClass const * text_class = &(bv->buffer().params().documentClass()); + Inset const * inset = &(bv->cursor().innerText()->inset()); if (!reset && d->text_class_ == text_class && d->inset_ == inset) { - set(d->owner_.view()->cursor().innerParagraph().layout().name()); + set(bv->cursor().innerParagraph().layout().name()); return; } @@ -682,13 +657,13 @@ void LayoutBox::updateContents(bool reset) lyxrc.group_layouts, lit->isUnknown()); } - set(d->owner_.view()->cursor().innerParagraph().layout().name()); + set(d->owner_.currentBufferView()->cursor().innerParagraph().layout().name()); d->countCategories(); // needed to recalculate size hint hide(); setMinimumWidth(sizeHint().width()); - setEnabled(!buffer->isReadonly() && + setEnabled(!bv->buffer().isReadonly() && lyx::getStatus(FuncRequest(LFUN_LAYOUT)).enabled()); show(); } @@ -712,7 +687,6 @@ void LayoutBox::selected(int index) // find corresponding text class if (d->text_class_->hasLayout(layoutName)) { FuncRequest const func(LFUN_LAYOUT, layoutName, FuncRequest::TOOLBAR); - theLyXFunc().setLyXView(&d->owner_); lyx::dispatch(func); updateContents(false); d->resetFilter();