]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/LayoutBox.cpp
* fix spelling in comments to please John.
[lyx.git] / src / frontends / qt4 / LayoutBox.cpp
index 27e19c4dbb663f1c1599b155289b405a864ed7d1..23017cf6f89e8f8d75ecedfdca2528560bf206b6 100644 (file)
@@ -414,7 +414,6 @@ LayoutBox::LayoutBox(GuiView & owner)
        QObject::connect(this, SIGNAL(activated(int)),
                this, SLOT(selected(int)));
 
-       d->owner_.setLayoutDialog(this);
        updateContents(true);
 }
 
@@ -617,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;
        }
 
@@ -661,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();
 }
@@ -691,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();