]> git.lyx.org Git - lyx.git/commitdiff
Add "DUPLICATE:" prefix to screen labels. 1.6 won't allow them now but importing...
authorAbdelrazak Younes <younes@lyx.org>
Mon, 3 Mar 2008 13:31:44 +0000 (13:31 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Mon, 3 Mar 2008 13:31:44 +0000 (13:31 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23412 a592a061-630c-0410-9148-cb99ea01b6c8

src/insets/InsetLabel.cpp
src/insets/InsetLabel.h

index 15843c18fda855bc2a0b97f2bd3d894e7bf99c18..80d46ab750cd52de7a984ebd46a894bce7ce9711 100644 (file)
@@ -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();
index 7fe8a0c290134a29a8fdfed290df1629b8275d44..ca868400457dcb2d29cc116463951dcdc66f12fa 100644 (file)
@@ -61,6 +61,8 @@ protected:
 private:
        ///
        Inset * clone() const { return new InsetLabel(*this); }
+       ///
+       docstring screen_label_;
 };