]> git.lyx.org Git - features.git/commitdiff
Small factorization.
authorAbdelrazak Younes <younes@lyx.org>
Sun, 6 Sep 2009 09:31:05 +0000 (09:31 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Sun, 6 Sep 2009 09:31:05 +0000 (09:31 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31304 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt4/LayoutBox.cpp

index 3cb4d433e5270a136cf61f5d5dc1a1be713646ce..f8c99d59e8ccc36e2e51fe3d220a1bda3795c1ba 100644 (file)
@@ -616,22 +616,20 @@ void LayoutBox::addItemSort(docstring const & item, docstring const & category,
 void LayoutBox::updateContents(bool reset)
 {
        d->resetFilter();
-       
-       if (!d->owner_.currentBufferView()) {
+       BufferView const * bv = d->owner_.currentBufferView();
+       if (!bv) {
                d->model_->clear();
                setEnabled(false);
                d->text_class_ = 0;
                d->inset_ = 0;
                return;
        }
-       Buffer const * buffer = &d->owner_.currentBufferView()->buffer();
        // 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_.currentBufferView()->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_.currentBufferView()->cursor().innerParagraph().layout().name());
+               set(bv->cursor().innerParagraph().layout().name());
                return;
        }
 
@@ -665,7 +663,7 @@ void LayoutBox::updateContents(bool reset)
        // needed to recalculate size hint
        hide();
        setMinimumWidth(sizeHint().width());
-       setEnabled(!buffer->isReadonly() &&
+       setEnabled(!bv->buffer().isReadonly() &&
                lyx::getStatus(FuncRequest(LFUN_LAYOUT)).enabled());
        show();
 }