add "Embedded Files" to Navigator.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23658 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2008-03-11 09:04:09 +00:00
parent b1742b5736
commit f53467871f
4 changed files with 23 additions and 6 deletions

View File

@ -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")

View File

@ -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");

View File

@ -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<docstring>(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();

View File

@ -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;