From f53467871fc0ac2132ae7e449cd3fbaaaa5501a6 Mon Sep 17 00:00:00 2001 From: Abdelrazak Younes Date: Tue, 11 Mar 2008 09:04:09 +0000 Subject: [PATCH] add "Embedded Files" to Navigator. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23658 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/qt4/GuiToc.cpp | 2 ++ src/frontends/qt4/Menus.cpp | 4 +++- src/insets/InsetInclude.cpp | 22 +++++++++++++++++----- src/insets/InsetInclude.h | 1 + 4 files changed, 23 insertions(+), 6 deletions(-) diff --git a/src/frontends/qt4/GuiToc.cpp b/src/frontends/qt4/GuiToc.cpp index 274ba3e1b6..076c62a0f4 100644 --- a/src/frontends/qt4/GuiToc.cpp +++ b/src/frontends/qt4/GuiToc.cpp @@ -223,6 +223,8 @@ docstring GuiToc::guiName(string const & type) const return _("Table of Contents"); if (type == "child") return _("Child Documents"); + if (type == "embedded") + return _("Embedded Files"); if (type == "equation") return _("List of Equations"); if (type == "footnote") diff --git a/src/frontends/qt4/Menus.cpp b/src/frontends/qt4/Menus.cpp index de4732af03..671d426ddb 100644 --- a/src/frontends/qt4/Menus.cpp +++ b/src/frontends/qt4/Menus.cpp @@ -923,7 +923,9 @@ void MenuDefinition::expandToc(Buffer const * buf) else if (cit->first == "child") { label = qt_("Child Documents"); in_other_list = false; - } else if (cit->first == "equation") + } else if (cit->first == "embedded") + label = qt_("Embedded Files"); + else if (cit->first == "equation") label = qt_("List of Equations"); else if (cit->first == "index") label = qt_("List of Indexes"); diff --git a/src/insets/InsetInclude.cpp b/src/insets/InsetInclude.cpp index caafae4be5..c2b3aeb6ed 100644 --- a/src/insets/InsetInclude.cpp +++ b/src/insets/InsetInclude.cpp @@ -863,6 +863,9 @@ void InsetInclude::addPreview(graphics::PreviewLoader & ploader) const void InsetInclude::addToToc(ParConstIterator const & cpit) const { + bool const embedded_status = !params()["embed"].empty(); + TocBackend & backend = buffer().tocBackend(); + if (isListings(params())) { if (label_) label_->addToToc(cpit); @@ -871,25 +874,34 @@ void InsetInclude::addToToc(ParConstIterator const & cpit) const string caption = p.getParamValue("caption"); if (caption.empty()) return; - Toc & toc = buffer().tocBackend().toc("listing"); + Toc & toc = backend.toc("listing"); docstring const str = convert(toc.size() + 1) + ". " + from_utf8(caption); ParConstIterator pit = cpit; pit.push_back(*this); toc.push_back(TocItem(pit, 0, str)); + if (embedded_status) + backend.toc("embedded").push_back(TocItem(cpit, 0, str)); return; } Buffer const * const childbuffer = getChildBuffer(buffer(), params()); - if (!childbuffer) + if (!childbuffer) { + if (embedded_status) + // Add it to the embedded list nonetheless. + backend.toc("embedded").push_back(TocItem(cpit, 0, + params()["filename"])); return; + } - Toc & toc = buffer().tocBackend().toc("child"); + Toc & toc = backend.toc("child"); docstring str = childbuffer->fileName().displayName(); - if (!params()["embed"].empty()) + if (embedded_status) str += _(" (embedded)"); toc.push_back(TocItem(cpit, 0, str)); + if (embedded_status) + backend.toc("embedded").push_back(TocItem(cpit, 0, str)); - TocList & toclist = buffer().tocBackend().tocs(); + TocList & toclist = backend.tocs(); TocList const & childtoclist = childbuffer->tocBackend().tocs(); TocList::const_iterator it = childtoclist.begin(); TocList::const_iterator const end = childtoclist.end(); diff --git a/src/insets/InsetInclude.h b/src/insets/InsetInclude.h index 405a4c0c2f..78cfa959a6 100644 --- a/src/insets/InsetInclude.h +++ b/src/insets/InsetInclude.h @@ -39,6 +39,7 @@ public: ~InsetInclude(); void setBuffer(Buffer & buffer); + bool isLabeled() const { return true; } /// Override these InsetButton methods if Previewing void metrics(MetricsInfo & mi, Dimension & dim) const; -- 2.39.2