Jean-Marc Lasgouttes wrote:
"Abdelrazak" == Abdelrazak Younes <[EMAIL PROTECTED]> writes:

Abdelrazak> Jean-Marc Lasgouttes wrote:
When creating a new document, I see: Trying to select non existent
layout type Standard

This is because LyXView::setBuffer sets the layout before updating
layout list.

Abdel, is the following patch OK?

Abdelrazak> Hum I atalked too fast, sorry.

Abdelrazak> updateLayoutChoice() is doing different things if there is
Abdelrazak> a visible Buffer. This is guaranteed only after the check
Abdelrazak> on BufferView::buffer() so I think the aatched patch is
Abdelrazak> more correct.

You may be right indeed. But it seems that updateLayoutChoice does a
setLayout. Is it necessary to do another one?

Maybe not. Actually it may well be that the BufferView::Pimpl::firstLayout() method can go altogether. updateLayoutChoice() will set the layout that match the current cursor position anyway. An the cursor is always valid right?

The attached patch should work, will test.

Abdel.

Index: LyXView.C
===================================================================
--- LyXView.C   (revision 14830)
+++ LyXView.C   (working copy)
@@ -139,19 +139,17 @@
 
        work_area_->bufferView().setBuffer(b);
 
-       updateLayoutChoice();
-
        if (work_area_->bufferView().buffer()) {
                // Buffer-dependent dialogs should be updated or
                // hidden. This should go here because some dialogs (eg ToC)
                // require bv_->text.
                getDialogs().updateBufferDependent(true);
                connectBuffer(*work_area_->bufferView().buffer());
-               setLayout(work_area_->bufferView().firstLayout());
        }
 
        updateMenubar();
        updateToolbars();
+       updateLayoutChoice();
        updateWindowTitle();
        redrawWorkArea();
 }
@@ -170,7 +168,6 @@
        updateWindowTitle();
        if (loaded) {
                connectBuffer(*work_area_->bufferView().buffer());
-               setLayout(work_area_->bufferView().firstLayout());
                showErrorList("Parse");
        }
        redrawWorkArea();

Reply via email to