get rid of notes-mutate and explain that inset-forall can do the same

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@32986 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2010-01-12 15:54:33 +00:00
parent 26255aeaa5
commit ceb50a253c
6 changed files with 5 additions and 64 deletions

View File

@ -89,6 +89,10 @@ The following LyX functions have been removed:
- 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:

View File

@ -1014,7 +1014,6 @@ bool BufferView::getStatus(FuncRequest const & cmd, FuncStatus & flag)
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:
@ -1686,18 +1685,6 @@ bool BufferView::dispatch(FuncRequest const & cmd)
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

View File

@ -169,7 +169,7 @@ enum FuncCode
LFUN_WORD_DELETE_BACKWARD,
// 115
LFUN_LINE_DELETE,
LFUN_NOTES_MUTATE,
LFUN_DEBUG_LEVEL_SET,
LFUN_MARK_OFF,
LFUN_MARK_ON,
LFUN_LAYOUT,
@ -444,7 +444,6 @@ enum FuncCode
LFUN_SCREEN_SHOW_CURSOR, // vfr, 20090325
LFUN_CURSOR_FOLLOWS_SCROLLBAR_TOGGLE, // ARRae 971202
// 345
LFUN_DEBUG_LEVEL_SET,
LFUN_LASTACTION // end of the table
};

View File

@ -575,16 +575,6 @@ void LyXAction::init()
* \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,

View File

@ -384,37 +384,4 @@ void InsetNote::string2params(string const & in, InsetNoteParams & params)
}
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

View File

@ -111,12 +111,6 @@ private:
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