-bool mutateNotes(Cursor & cur, string const & source, string const & target)
-{
- InsetNoteParams::Type typeSrc = notetranslator().find(source);
- InsetNoteParams::Type typeTrt = notetranslator().find(target);
- // syntax check of arguments
- string src = notetranslator().find(typeSrc);
- string trt = notetranslator().find(typeTrt);
- if (src != source || trt != target)
- return false;
-
- // did we found some conforming inset?
- bool ret = false;
-
- cur.beginUndoGroup();
- Inset & inset = cur.buffer()->inset();
- InsetIterator it = inset_iterator_begin(inset);
- InsetIterator const end = inset_iterator_end(inset);
- for (; it != end; ++it) {
- if (it->lyxCode() == NOTE_CODE) {
- InsetNote & ins = static_cast<InsetNote &>(*it);
- if (ins.params().type == typeSrc) {
- cur.buffer()->undo().recordUndo(it);
- FuncRequest fr(LFUN_INSET_MODIFY, "note Note " + target);
- ins.dispatch(cur, fr);
- ret = true;
- }
- }
- }
- cur.endUndoGroup();
-
- return ret;
-}
-