Author: tommaso Date: Thu May 26 19:33:36 2011 New Revision: 38847 URL: http://www.lyx.org/trac/changeset/38847
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/trunk/src/frontends/qt4/GuiCitation.cpp lyx-devel/trunk/src/frontends/qt4/GuiCitation.h Modified: lyx-devel/trunk/src/frontends/qt4/GuiCitation.cpp ============================================================================== --- lyx-devel/trunk/src/frontends/qt4/GuiCitation.cpp Thu May 26 19:08:48 2011 (r38846) +++ lyx-devel/trunk/src/frontends/qt4/GuiCitation.cpp Thu May 26 19:33:36 2011 (r38847) @@ -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/trunk/src/frontends/qt4/GuiCitation.h ============================================================================== --- lyx-devel/trunk/src/frontends/qt4/GuiCitation.h Thu May 26 19:08:48 2011 (r38846) +++ lyx-devel/trunk/src/frontends/qt4/GuiCitation.h Thu May 26 19:33:36 2011 (r38847) @@ -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();
