]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insetlabel.C
The speed patch: redraw only rows that have changed
[lyx.git] / src / insets / insetlabel.C
index ccdef93a06f1c94de82ef92e2f417f46bc0854ab..9d1264dbe0b955da8f64f76fad7a334c9805317a 100644 (file)
@@ -58,40 +58,6 @@ string const InsetLabel::getScreenLabel(Buffer const &) const
 }
 
 
-namespace {
-
-void changeRefsIfUnique(BufferView & bv, string const & from, string const & to)
-{
-       // Check if the label 'from' appears more than once
-       vector<string> labels;
-       bv.buffer()->getLabelList(labels);
-
-       if (lyx::count(labels.begin(), labels.end(), from) > 1)
-               return;
-
-       InsetBase::Code code = InsetBase::REF_CODE;
-
-       ParIterator it = bv.buffer()->par_iterator_begin();
-       ParIterator end = bv.buffer()->par_iterator_end();
-       for ( ; it != end; ++it) {
-               bool changed_inset = false;
-               for (InsetList::iterator it2 = it->insetlist.begin();
-                    it2 != it->insetlist.end(); ++it2) {
-                       if (it2->inset->lyxCode() == code) {
-                               InsetCommand * inset = static_cast<InsetCommand *>(it2->inset);
-                               if (inset->getContents() == from) {
-                                       inset->setContents(to);
-                                       //inset->setButtonLabel();
-                                       changed_inset = true;
-                               }
-                       }
-               }
-       }
-}
-
-} // namespace anon
-
-
 void InsetLabel::doDispatch(LCursor & cur, FuncRequest & cmd)
 {
        switch (cmd.action) {
@@ -104,7 +70,7 @@ void InsetLabel::doDispatch(LCursor & cur, FuncRequest & cmd)
                        break;
                }
                if (p.getContents() != params().getContents())
-                       changeRefsIfUnique(cur.bv(), params().getContents(),
+                       cur.bv().buffer()->changeRefsIfUnique(params().getContents(),
                                                       p.getContents());
                setParams(p);
                break;