Allow the input of an InsetInfo using command buffer (e.g. "info-insert menu paste"). Document this change in InsetInfo.h

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20961 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Bo Peng 2007-10-14 00:47:52 +00:00
parent 7d0b8eecb7
commit 4385c156e2
2 changed files with 24 additions and 18 deletions

View File

@ -1097,16 +1097,18 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
}
case LFUN_INFO_INSERT: {
if (!cur.selection())
break;
Inset * inset = createInset(&cur.bv(), cmd);
if (!inset)
break;
// if an empty inset is created (cmd.argument() is empty)
// use current selection as parameter.
if (cmd.argument().empty() && cur.selection()) {
// use selected text as info to avoid a separate UI
docstring ds = cur.selectionAsString(false);
cutSelection(cur, true, false);
insertInset(cur, inset);
static_cast<InsetInfo *>(inset)->setInfo(to_utf8(ds));
}
insertInset(cur, inset);
cur.posRight();
break;
}

View File

@ -53,12 +53,16 @@ menu: name of the LFUN such as "paste". The syntax is the same as
Because this inset is intended to be used only by document maintainers,
there is no GUI, no menu entry for this inset. A user would have to
define a shortcut for "info-insert" (e.g. C-S-I), and
there is no GUI, no menu entry for this inset. A user can define a
shortcut for "info-insert" (e.g. C-S-I), and
1. input the type and argument of this inset. E.g. "menu paste".
1. input the type and argument of this inset, e.g. "menu paste", in
the work area.
2. select the text and run "info-insert" (e.g. press C-S-I).
An alternative method is to enter command "info-insert type args" in
the command buffer (view->Toolbar->Command Buffer).
*/
namespace lyx {