From: Tommaso Cucinotta Date: Fri, 27 May 2011 06:05:14 +0000 (+0000) Subject: Use the main document's buffer(), when scanning for citations from within the citatio... X-Git-Tag: 2.0.1~285 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=b7532cd3b3518b23a41b98721ce7e3b8f246e305;p=features.git 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/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 --- diff --git a/src/frontends/qt4/GuiCitation.cpp b/src/frontends/qt4/GuiCitation.cpp index 9da6f1016d..092470f994 100644 --- a/src/frontends/qt4/GuiCitation.cpp +++ b/src/frontends/qt4/GuiCitation.cpp @@ -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(); diff --git a/src/frontends/qt4/GuiCitation.h b/src/frontends/qt4/GuiCitation.h index 27f69e56bc..8746a1aa65 100644 --- a/src/frontends/qt4/GuiCitation.h +++ b/src/frontends/qt4/GuiCitation.h @@ -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();