- LFUN_PARAGRAPH_SPACING ("paragraph-spacing"): use "paragraph-params" instead.
+- LFUN_NOTES_MUTATE ("notes-mutate"): replace
+ notes-mutate <SOURCE> <TARGET>
+ with the more general function inset-forall
+ inset-forall Note:<SOURCE> inset-modify changetype <TARGET>
The following LyX functions have been changed:
case LFUN_SCREEN_SHOW_CURSOR:
case LFUN_BIBTEX_DATABASE_ADD:
case LFUN_BIBTEX_DATABASE_DEL:
- case LFUN_NOTES_MUTATE:
case LFUN_ALL_INSETS_TOGGLE:
case LFUN_STATISTICS:
case LFUN_BRANCH_ADD_INSERT:
break;
}
- // This could be rewriten using some command like forall <insetname> <command>
- // once the insets refactoring is done.
- case LFUN_NOTES_MUTATE: {
- if (cmd.argument().empty())
- break;
-
- if (mutateNotes(cur, cmd.getArg(0), cmd.getArg(1))) {
- processUpdateFlags(Update::Force);
- }
- break;
- }
-
// This would be in Buffer class if only Cursor did not
// require a bufferview
LFUN_WORD_DELETE_BACKWARD,
// 115
LFUN_LINE_DELETE,
- LFUN_NOTES_MUTATE,
+ LFUN_DEBUG_LEVEL_SET,
LFUN_MARK_OFF,
LFUN_MARK_ON,
LFUN_LAYOUT,
LFUN_SCREEN_SHOW_CURSOR, // vfr, 20090325
LFUN_CURSOR_FOLLOWS_SCROLLBAR_TOGGLE, // ARRae 971202
// 345
- LFUN_DEBUG_LEVEL_SET,
LFUN_LASTACTION // end of the table
};
* \endvar
*/
{ LFUN_NOTE_NEXT, "note-next", ReadOnly, Edit },
-/*!
- * \var lyx::FuncCode lyx::LFUN_NOTES_MUTATE
- * \li Action: Changes all Note insets of a particular type (source)
- to a different type (target) fot the current document.
- * \li Syntax: notes-mutate <SOURCE> <TARGET>
- * \li Params: <SOURCE/TARGET>: Note|Comment|Greyedout
- * \li Origin: sanda, 18 Jun 2008
- * \endvar
- */
- { LFUN_NOTES_MUTATE, "notes-mutate", Argument, Edit },
/*!
* \var lyx::FuncCode lyx::LFUN_PHANTOM_INSERT
* \li Action: Inserts phantom on the current cursor postion,
}
-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;
-}
-
} // namespace lyx
InsetNoteParams params_;
};
-/**
- * Mutate all NoteInsets of "source" type to the "target" type in the document.
- * Returns true when some inset was changed.
- */
-bool mutateNotes(lyx::Cursor & cur, std::string const & source, std::string const &target);
-
} // namespace lyx
#endif // INSET_NOTE_H