]> git.lyx.org Git - features.git/commitdiff
Use the main document's buffer(), when scanning for citations from within the citatio...
authorTommaso Cucinotta <tommaso@lyx.org>
Fri, 27 May 2011 06:05:14 +0000 (06:05 +0000)
committerTommaso Cucinotta <tommaso@lyx.org>
Fri, 27 May 2011 06:05:14 +0000 (06:05 +0000)
> This allows to pick and search for citations present in the main document.
>
> This was started to be discussed in a relatively unrelated bug #7581, then the patch
> was proposed here: http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg169277.html

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_2_0_X@38849 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt4/GuiCitation.cpp
src/frontends/qt4/GuiCitation.h

index 9da6f1016d3d3da83e432006114a2d5dbcba5e7a..092470f9947268ce641ef3e1c0e94f09d8501092 100644 (file)
@@ -20,6 +20,7 @@
 #include "qt_helpers.h"
 
 #include "Buffer.h"
+#include "BufferView.h"
 #include "BiblioInfo.h"
 #include "BufferParams.h"
 #include "FuncRequest.h"
@@ -625,7 +626,7 @@ void GuiCitation::setCitedKeys()
 bool GuiCitation::initialiseParams(string const & data)
 {
        InsetCommand::string2params(data, params_);
-       CiteEngine const engine = buffer().params().citeEngine();
+       CiteEngine const engine = citeEngine();
        citeStyles_ = citeStyles(engine);
        init();
        return true;
@@ -763,6 +764,15 @@ BiblioInfo const & GuiCitation::bibInfo() const
 }
 
 
+Buffer const & GuiCitation::buffer() const
+{
+       if (lyxview().documentBufferView())
+               return lyxview().documentBufferView()->buffer();
+       else
+               return lyxview().currentBufferView()->buffer();
+}
+
+
 void GuiCitation::saveSession() const
 {
        Dialog::saveSession();
index 27f69e56bc457ab1bb5c7f7a1bf63b968850c39a..8746a1aa65f004f829280a6b06d4982b40c55151 100644 (file)
@@ -42,6 +42,9 @@ public:
        GuiCitation(GuiView & lv);
        ///
        ~GuiCitation();
+       /// We use the main document's buffer() so to catch the citations
+       /// defined there, also while using the dialog from the Adv F&R.
+       Buffer const & buffer() const;
 
 private Q_SLOTS:
        void on_okPB_clicked();