mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-27 03:36:39 +00:00
Add "DUPLICATE:" prefix to screen labels. 1.6 won't allow them now but importing a 1.5 documents can contain duplicate labels.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23412 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
34d15c9150
commit
aef2959b26
@ -100,17 +100,20 @@ void InsetLabel::getLabelList(vector<docstring> & list) const
|
||||
|
||||
docstring InsetLabel::screenLabel() const
|
||||
{
|
||||
return getParam("name");
|
||||
return screen_label_;
|
||||
}
|
||||
|
||||
|
||||
void InsetLabel::updateLabels(ParIterator const &)
|
||||
{
|
||||
docstring const & label = getParam("name");
|
||||
if (buffer().insetLabel(label))
|
||||
if (buffer().insetLabel(label)) {
|
||||
// Problem: We already have an InsetLabel with the same name!
|
||||
screen_label_ = _("DUPLICATE: ") + label;
|
||||
return;
|
||||
}
|
||||
buffer().setInsetLabel(label, this);
|
||||
screen_label_ = label;
|
||||
}
|
||||
|
||||
|
||||
@ -119,10 +122,10 @@ void InsetLabel::addToToc(ParConstIterator const & cpit) const
|
||||
docstring const & label = getParam("name");
|
||||
Toc & toc = buffer().tocBackend().toc("label");
|
||||
if (buffer().insetLabel(label) != this) {
|
||||
toc.push_back(TocItem(cpit, 0, _("DUPLICATE: ") + label));
|
||||
toc.push_back(TocItem(cpit, 0, screen_label_));
|
||||
return;
|
||||
}
|
||||
toc.push_back(TocItem(cpit, 0, label));
|
||||
toc.push_back(TocItem(cpit, 0, screen_label_));
|
||||
Buffer::References const & refs = buffer().references(label);
|
||||
Buffer::References::const_iterator it = refs.begin();
|
||||
Buffer::References::const_iterator end = refs.end();
|
||||
|
@ -61,6 +61,8 @@ protected:
|
||||
private:
|
||||
///
|
||||
Inset * clone() const { return new InsetLabel(*this); }
|
||||
///
|
||||
docstring screen_label_;
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user