On 26-5-2011 19:33, tomm...@lyx.org wrote: > 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/lyx-devel@lists.lyx.org/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 > ============================================================================== > @@ -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(); >
I don't like this. In all dialogs, calling buffer() will give you the currentBufferView(). It is confusing if it is suddenly different here. If this is an exception, then you might better want to get the document buffer explicitly. What makes GuiCitation an exception? Why does GuiRef not have to refer to the documentBuffer as well. > 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; > By the way, buffer() is not declared virtual in Dialog. Everything starts itching if I read a comment about a special case about Adv F&R in the header of the citation dialog. Last, if you add a function to the class, it would be much more suited in the section: "/// Dialog inherited methods" rather than in the constructor/destructor section. Vincent