\begin_layout Itemize
-\change_inserted -712698321 1355661160
+\change_inserted -712698321 1355747298
\begin_inset Flex Code
status collapsed
\end_inset
, this argument is automatically inserted when the respective style is selected.
- This option is currently only available for paragraph styles, not for InsetLayo
-uts.
+ Currently, only one argument per style\SpecialChar \slash{}
+layout can be automatically inserted.
\change_inserted 155139281 1354198988
\end_layout
// Merge multiple paragraphs -- hack
while (cur.lastpit() > 0)
mergeParagraph(bparams, cur.text()->paragraphs(), 0);
+ if (cmd.action() == LFUN_FLEX_INSERT)
+ return true;
Cursor old = cur;
cur.leaveInset(*inset);
if (cmd.action() == LFUN_PREVIEW_INSERT
case LFUN_CAPTION_INSERT:
case LFUN_FOOTNOTE_INSERT:
case LFUN_NOTE_INSERT:
- case LFUN_FLEX_INSERT:
case LFUN_BOX_INSERT:
case LFUN_BRANCH_INSERT:
case LFUN_PHANTOM_INSERT:
cur.forceBufferUpdate();
break;
+ case LFUN_FLEX_INSERT: {
+ // Open the inset, and move the current selection
+ // inside it.
+ bool const sel = cur.selection();
+ doInsertInset(cur, this, cmd, true, true);
+ // Insert auto-insert arguments
+ bool autoargs = false;
+ Layout::LaTeXArgMap args = cur.inset().getLayout().latexargs();
+ Layout::LaTeXArgMap::const_iterator lait = args.begin();
+ Layout::LaTeXArgMap::const_iterator const laend = args.end();
+ for (; lait != laend; ++lait) {
+ Layout::latexarg arg = (*lait).second;
+ if (arg.autoinsert) {
+ // The cursor might have been invalidated by the replaceSelection.
+ cur.buffer()->changed(true);
+ FuncRequest cmd(LFUN_ARGUMENT_INSERT, (*lait).first);
+ lyx::dispatch(cmd);
+ autoargs = true;
+ }
+ }
+ if (!autoargs) {
+ if (sel)
+ cur.leaveInset(cur.inset());
+ cur.posForward();
+ }
+ // Some insets are numbered, others are shown in the outline pane so
+ // let's update the labels and the toc backend.
+ cur.forceBufferUpdate();
+ break;
+ }
+
case LFUN_TABULAR_INSERT:
// if there were no arguments, just open the dialog
if (doInsertInset(cur, this, cmd, false, true))
{
Layout::latexarg arg;
arg.mandatory = false;
+ arg.autoinsert = false;
bool error = false;
bool finished = false;
arg.font = inherit_font;
} else if (tok == "mandatory") {
lex.next();
arg.mandatory = lex.getBool();
+ } else if (tok == "autoinsert") {
+ lex.next();
+ arg.autoinsert = lex.getBool();
} else if (tok == "leftdelim") {
lex.next();
arg.ldelim = lex.getDocString();