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;
// use selected text as info to avoid a separate UI
docstring ds = cur.selectionAsString(false);
cutSelection(cur, true, false);
// 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);
static_cast<InsetInfo *>(inset)->setInfo(to_utf8(ds));
}
insertInset(cur, inset);
static_cast<InsetInfo *>(inset)->setInfo(to_utf8(ds));
cur.posRight();
break;
}

View File

@ -33,32 +33,36 @@ InsetInfo can have type "shortcut", "lyxrc", "package", "textclass", or
"menu". Arguments and outputs vary by type.
shortcut: name of the LFUN such as "math-insert \alpha". The syntax
is the same as what is used in the bind and ui files.
The output of this inset is all shortcuts separated by comma.
is the same as what is used in the bind and ui files.
The output of this inset is all shortcuts separated by comma.
lyxrc: name of the rc entry such as "bind_file". Look in src/LyXRC.h
for available entries. The output is the content of this RC
entry.
for available entries. The output is the content of this RC
entry.
package: name of a latex package such as "listings". The output is
"yes" or "no".
"yes" or "no".
textclass: name of a textclass such as "article". The output is "yes"
or "no".
or "no".
menu: name of the LFUN such as "paste". The syntax is the same as
what is used in the bind and ui files. The output is the
menu item that trigger this LFUN. For example, "File > Paste".
'>' is actually \lyxarrow (an InsetSpecialChar).
what is used in the bind and ui files. The output is the
menu item that trigger this LFUN. For example, "File > Paste".
'>' is actually \lyxarrow (an InsetSpecialChar).
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 {