mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-26 19:25:39 +00:00
Add inactive labels to the toc
It makes sense to navigate to them. They are marked as inactive with the cross.
This commit is contained in:
parent
54366c38ef
commit
e61c60fae8
@ -186,17 +186,20 @@ void InsetLabel::updateBuffer(ParIterator const & par, UpdateType utype)
|
|||||||
|
|
||||||
|
|
||||||
void InsetLabel::addToToc(DocIterator const & cpit, bool output_active,
|
void InsetLabel::addToToc(DocIterator const & cpit, bool output_active,
|
||||||
UpdateType, TocBackend & backend) const
|
UpdateType, TocBackend & backend) const
|
||||||
{
|
{
|
||||||
docstring const & label = getParam("name");
|
docstring const & label = getParam("name");
|
||||||
if (!buffer().activeLabel(label))
|
|
||||||
return;
|
|
||||||
|
|
||||||
|
// inactive labels get a cross mark
|
||||||
|
if (buffer().insetLabel(label, true) != this)
|
||||||
|
output_active = false;
|
||||||
|
|
||||||
|
// We put both active and inactive labels to the outliner
|
||||||
shared_ptr<Toc> toc = backend.toc("label");
|
shared_ptr<Toc> toc = backend.toc("label");
|
||||||
if (buffer().insetLabel(label, true) != this) {
|
toc->push_back(TocItem(cpit, 0, screen_label_, output_active));
|
||||||
toc->push_back(TocItem(cpit, 0, screen_label_, output_active));
|
// The refs get assigned only to the active label. If no active one exists,
|
||||||
} else {
|
// assign the (BROKEN) refs to the first inactive one.
|
||||||
toc->push_back(TocItem(cpit, 0, screen_label_, output_active));
|
if (buffer().insetLabel(label, true) == this || !buffer().activeLabel(label)) {
|
||||||
for (auto const & p : buffer().references(label)) {
|
for (auto const & p : buffer().references(label)) {
|
||||||
DocIterator const ref_pit(p.second);
|
DocIterator const ref_pit(p.second);
|
||||||
if (p.first->lyxCode() == MATH_REF_CODE)
|
if (p.first->lyxCode() == MATH_REF_CODE)
|
||||||
|
@ -423,9 +423,11 @@ void InsetRef::addToToc(DocIterator const & cpit, bool output_active,
|
|||||||
UpdateType, TocBackend & backend) const
|
UpdateType, TocBackend & backend) const
|
||||||
{
|
{
|
||||||
docstring const & label = getParam("reference");
|
docstring const & label = getParam("reference");
|
||||||
if (buffer().activeLabel(label))
|
if (buffer().insetLabel(label)) {
|
||||||
|
broken_ = !buffer().activeLabel(label);
|
||||||
// This InsetRef has already been taken care of in InsetLabel::addToToc().
|
// This InsetRef has already been taken care of in InsetLabel::addToToc().
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// It seems that this reference does not point to any valid label.
|
// It seems that this reference does not point to any valid label.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user