Author: tommaso
Date: Fri May 27 08:05:14 2011
New Revision: 38849
URL: http://www.lyx.org/trac/changeset/38849

Log:
Use the main document's buffer(), when scanning for citations from within the 
citation dialog.
> 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/[email protected]/msg169277.html

Modified:
   lyx-devel/branches/BRANCH_2_0_X/src/frontends/qt4/GuiCitation.cpp
   lyx-devel/branches/BRANCH_2_0_X/src/frontends/qt4/GuiCitation.h

Modified: lyx-devel/branches/BRANCH_2_0_X/src/frontends/qt4/GuiCitation.cpp
==============================================================================
--- lyx-devel/branches/BRANCH_2_0_X/src/frontends/qt4/GuiCitation.cpp   Thu May 
26 21:10:12 2011        (r38848)
+++ lyx-devel/branches/BRANCH_2_0_X/src/frontends/qt4/GuiCitation.cpp   Fri May 
27 08:05:14 2011        (r38849)
@@ -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 @@
 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 @@
 }
 
 
+Buffer const & GuiCitation::buffer() const
+{
+       if (lyxview().documentBufferView())
+               return lyxview().documentBufferView()->buffer();
+       else
+               return lyxview().currentBufferView()->buffer();
+}
+
+
 void GuiCitation::saveSession() const
 {
        Dialog::saveSession();

Modified: lyx-devel/branches/BRANCH_2_0_X/src/frontends/qt4/GuiCitation.h
==============================================================================
--- lyx-devel/branches/BRANCH_2_0_X/src/frontends/qt4/GuiCitation.h     Thu May 
26 21:10:12 2011        (r38848)
+++ lyx-devel/branches/BRANCH_2_0_X/src/frontends/qt4/GuiCitation.h     Fri May 
27 08:05:14 2011        (r38849)
@@ -42,6 +42,9 @@
        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();

Reply via email to