From 492d837e623e7ed33453ea09db92de87bbb5c1de Mon Sep 17 00:00:00 2001 From: Tommaso Cucinotta Date: Thu, 26 May 2011 17:33:36 +0000 Subject: [PATCH] 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/trunk@38847 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/qt4/GuiCitation.cpp | 12 +++++++++++- src/frontends/qt4/GuiCitation.h | 3 +++ 2 files changed, 14 insertions(+), 1 deletion(-) 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(); -- 2.39.2