It is possible in LyX 2.0
using insets as named parameters inside of a frame inset. The downside is that there is less checking, so you might get side effects if you put other stuff like spaces or parskips in there.
My layout defines a Synopsis inset for 1 to 4 columns using tabulary
(and ugly colors). Table heads and caption are optional. The Head and Text insets are supposed to be used multiple times.
Here are two examples, one with table heads and caption, and one without:
The result:
The key is to first collect all necessary parameters and store them locally. Here's the layout code:
#\DeclareLyXModule{Synopsis}
#DescriptionBegin
# Synopsis Inset Example for LyX 2.0
# A frame inset with multiple, mostly optional named parameter insets.
#
# Usage:
# Synopsis[ SynopsisHead... SynopsisText... SynopsisCaption ]
# Synopsis[ SynopsisHead+SynopsisText... SynopsisCaption ]
#
# There must be 1..4 Texts, everything else is optional.
# If you use Heads you must define one Head for each Text.
# The 1st Head must be before the 1st Text.
#DescriptionEnd
Format 21
Preamble
\usepackage{etoolbox}
\usepackage{tabulary}
\def\setSysnopsisColumnType#1{\newcolumntype{Q}{#1}}%
\long\def\synopsisFrame#1{%
\begin{table}[h]%
\small%
%
%%% execute parameter insets
%%% (there should be nothing else, not even parskips!)
#1%
%
%%% set table format
\expandafter\setSysnopsisColumnType\expandafter{\theSynopsisFormat}%
\begin{tabulary}{\textwidth}{Q}%
%
%%% table head (depends on body)
\ifdef{\theSynopsisHeadi}{%
\theSynopsisHeadi%
\ifdef{\theSynopsisTextii}{ & \theSynopsisHeadii}{}%
\ifdef{\theSynopsisTextiii}{ & \theSynopsisHeadiii}{}%
\ifdef{\theSynopsisTextiv}{ & \theSynopsisHeadiv}{}%
\\[1em]
}{}%
%
%%% table body
\theSynopsisTexti
\ifdef{\theSynopsisTextii}{ & \theSynopsisTextii}{}%
\ifdef{\theSynopsisTextiii}{ & \theSynopsisTextiii}{}%
\ifdef{\theSynopsisTextiv}{ & \theSynopsisTextiv}{}%
%
\end{tabulary}%
\ifdef{\theSynopsisCaption}{\caption{\theSynopsisCaption}}{}%
\end{table}%
}
\long\def\synopsisHead#1{%
%%% set next Head
\ifdef{\theSynopsisHeadiv}{%
\PackageError{SynopsisInset}{Too many Heads.}%
{Only 4 Head insets are supported.}%
}{%
\ifdef{\theSynopsisHeadiii}{%
\def\theSynopsisHeadiv{#1}%
}{%
\ifdef{\theSynopsisHeadii}{%
\def\theSynopsisHeadiii{#1}%
}{%
\ifdef{\theSynopsisHeadi}{%
\def\theSynopsisHeadii{#1}%
}{%
\def\theSynopsisHeadi{#1}%
}%
}%
}%
}%
}
\long\def\synopsisText#1{%
%%% set next Text
\ifdef{\theSynopsisTextiv}{%
\PackageError{SynopsisInset}{Too many Texts.}%
{Only 4 Text insets are supported.}%
}{%
\ifdef{\theSynopsisTextiii}{%
\def\theSynopsisTextiv{#1}% set Text
\def\theSynopsisFormat{|J|J|J|J|}% set format
}{%
\ifdef{\theSynopsisTextii}{%
\def\theSynopsisTextiii{#1}%
\def\theSynopsisFormat{|J|J|J|}%
}{%
\ifdef{\theSynopsisTexti}{%
\def\theSynopsisTextii{#1}%
\def\theSynopsisFormat{|J|J|}%
}{%
\def\theSynopsisTexti{#1}%
\def\theSynopsisFormat{|J|}%
}%
}%
}%
}%
}
\long\def\synopsisCaption#1{%
\def\theSynopsisCaption{#1}%
}
EndPreamble
InsetLayout Flex:Synopsis
LyXType Custom
LabelString Synopsis
LatexType Command
LatexName synopsisFrame
BgColor blue
ContentAsLabel 0
CustomPars 1
Decoration Classic
LabelFont
Color blue
Size Small
EndFont
End
InsetLayout Flex:SynopsisHead
LyXType Custom
LabelString Head
LatexType Command
LatexName synopsisHead
BgColor white
ContentAsLabel 0
CustomPars 1
Decoration Classic
LabelFont
Color blue
Size Small
EndFont
End
InsetLayout Flex:SynopsisText
LyXType Custom
LabelString Text
LatexType Command
LatexName synopsisText
BgColor white
ContentAsLabel 0
CustomPars 1
Decoration Classic
LabelFont
Color blue
Size Small
EndFont
End
InsetLayout Flex:SynopsisCaption
LyXType Custom
LabelString Caption
LatexType Command
LatexName synopsisCaption
BgColor white
ContentAsLabel 0
CustomPars 1
Decoration Classic
LabelFont
Color blue
Size Small
EndFont
End