From 37b429e34738bfb1915e6df5dc4be5458ebdab23 Mon Sep 17 00:00:00 2001 From: Abdelrazak Younes Date: Tue, 4 Mar 2008 17:47:47 +0000 Subject: [PATCH] Add citations to Navigator. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23458 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/MenuBackend.cpp | 2 ++ src/frontends/qt4/GuiToc.cpp | 2 ++ src/insets/InsetCitation.cpp | 19 ++++++++++++++++--- src/insets/InsetCitation.h | 5 +++++ 4 files changed, 25 insertions(+), 3 deletions(-) diff --git a/src/MenuBackend.cpp b/src/MenuBackend.cpp index df4de67b54..de7172f5d0 100644 --- a/src/MenuBackend.cpp +++ b/src/MenuBackend.cpp @@ -780,6 +780,8 @@ void expandToc(Menu & tomenu, Buffer const * buf) label = _("List of Foot notes"); else if (cit->first == "label") label = _("Labels and References"); + else if (cit->first == "citation") + label = _("List of Citations"); // this should not happen now, but if something else like // listings is added later, this can avoid an empty menu name. else diff --git a/src/frontends/qt4/GuiToc.cpp b/src/frontends/qt4/GuiToc.cpp index 40233e83f4..43485fa320 100644 --- a/src/frontends/qt4/GuiToc.cpp +++ b/src/frontends/qt4/GuiToc.cpp @@ -233,6 +233,8 @@ docstring GuiToc::guiName(string const & type) const return _("List of Marginal notes"); if (type == "note") return _("List of Notes"); + if (type == "citation") + return _("List of Citations"); if (type == "label") return _("Labels and References"); diff --git a/src/insets/InsetCitation.cpp b/src/insets/InsetCitation.cpp index 8407f997ba..917b8fd8f4 100644 --- a/src/insets/InsetCitation.cpp +++ b/src/insets/InsetCitation.cpp @@ -16,13 +16,15 @@ #include "Buffer.h" #include "BufferParams.h" #include "DispatchResult.h" -#include "support/gettext.h" #include "EmbeddedFiles.h" #include "FuncRequest.h" #include "LaTeXFeatures.h" +#include "ParIterator.h" +#include "TocBackend.h" #include "support/debug.h" #include "support/docstream.h" +#include "support/gettext.h" #include "support/lstrings.h" #include @@ -425,10 +427,16 @@ docstring InsetCitation::generateLabel() const docstring InsetCitation::screenLabel() const +{ + return cache.screen_label; +} + + +void InsetCitation::updateLabels(ParIterator const &) { biblio::CiteEngine const engine = buffer().params().getEngine(); if (cache.params == params() && cache.engine == engine) - return cache.screen_label; + return; // The label has changed, so we have to re-create it. docstring const glabel = generateLabel(); @@ -445,8 +453,13 @@ docstring InsetCitation::screenLabel() const cache.params = params(); cache.generated_label = glabel; cache.screen_label = label; +} - return label; + +void InsetCitation::addToToc(ParConstIterator const & cpit) const +{ + Toc & toc = buffer().tocBackend().toc("citation"); + toc.push_back(TocItem(cpit, 0, cache.screen_label)); } diff --git a/src/insets/InsetCitation.h b/src/insets/InsetCitation.h index 0cf4f77a15..e30d036caa 100644 --- a/src/insets/InsetCitation.h +++ b/src/insets/InsetCitation.h @@ -45,6 +45,11 @@ public: void textString(odocstream &) const; /// void validate(LaTeXFeatures &) const; + /// + void updateLabels(ParIterator const & it); + /// + void addToToc(ParConstIterator const &) const; + /// static ParamInfo const & findInfo(std::string const &); //FIXME This is the locus of the design problem we have. -- 2.39.2