]> git.lyx.org Git - features.git/commitdiff
From Vincent:
authorRichard Heck <rgheck@comcast.net>
Tue, 28 Oct 2008 15:38:28 +0000 (15:38 +0000)
committerRichard Heck <rgheck@comcast.net>
Tue, 28 Oct 2008 15:38:28 +0000 (15:38 +0000)
> Hi all,
> >
> > A.
> > 1. create a new document (doc1),
> > 2. insert a label,
> > 3. insert a cross-ref
> > 4. create a new document (doc2)
> > 5. insert a cross-ref (in doc2)
> > then the labels in the cross-ref dialog are those from doc1.
> >

This is solved by the attached patch.

We should not restore the last used buffer if the active buffer has
changed. Especially not when you cannot choose the buffer which is now
still the case.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@27165 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt4/GuiRef.cpp
src/frontends/qt4/GuiRef.h

index 24bae1550f4fdf84ee9c17394716702bd54e5215..1c5210dae6b6265a76984c9bb20475d27b911abc 100644 (file)
@@ -96,6 +96,7 @@ GuiRef::GuiRef(GuiView & lv)
        bc().addReadOnly(bufferCO);
 
        restored_buffer_ = -1;
+       active_buffer_ = -1;
 }
 
 
@@ -230,14 +231,18 @@ void GuiRef::updateContents()
                bufferCO->addItem(toqstr(makeDisplayPath(it->absFilename())));
        }
 
+       int thebuffer = theBufferList().bufferNum(buffer().fileName());
        // restore the buffer combo setting for new insets
        if (params_["reference"].empty() && restored_buffer_ != -1
-           && restored_buffer_ < bufferCO->count()
+           && restored_buffer_ < bufferCO->count() && thebuffer == active_buffer_)
                bufferCO->setCurrentIndex(restored_buffer_);
        else {
                int num = theBufferList().bufferNum(buffer().fileName());
                bufferCO->setCurrentIndex(num);
+               if (thebuffer != active_buffer_)
+                       restored_buffer_ = num;
        }
+       active_buffer_ = thebuffer;
 
        updateRefs();
        bc().setValid(false);
index 5ff45c8635e646c3b397fbaab3b1cb01f6eca22a..a7f389e66e3eb44fa93d2d4365f93030d8eb05e7 100644 (file)
@@ -94,6 +94,8 @@ private:
        QString last_reference_;
        /// store the buffer settings
        int restored_buffer_;
+       /// store the last active buffer
+       int active_buffer_;
        /// the references
        std::vector<docstring> refs_;
 };