mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 01:59:02 +00:00
Implement auto-nesting.
Now layouts can specify other layouts that should be nested in and after the current one (if the layout is switched from the current one and if it follows a paragraph in the current one). This is particularly useful for things such as the beamer frames, where particular layouts are practically always nested. This is a backport from master, including all fixes.
This commit is contained in:
parent
438b067b5a
commit
12bd7352fd
@ -124,11 +124,12 @@ logicalmkup
|
||||
\papercolumns 1
|
||||
\papersides 2
|
||||
\paperpagestyle headings
|
||||
\tracking_changes false
|
||||
\tracking_changes true
|
||||
\output_changes false
|
||||
\html_math_output 0
|
||||
\html_css_as_file 0
|
||||
\html_be_strict true
|
||||
\author -712698321 "Jürgen Spitzmüller"
|
||||
\end_header
|
||||
|
||||
\begin_body
|
||||
@ -12160,6 +12161,61 @@ Argument item:1
|
||||
\end_layout
|
||||
|
||||
\end_deeper
|
||||
\begin_layout Description
|
||||
|
||||
\change_inserted -712698321 1514539256
|
||||
\begin_inset Flex Code
|
||||
status collapsed
|
||||
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\change_inserted -712698321 1514534780
|
||||
AutoNests
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
|
||||
Includes a comma-separated list of layout names that should be nested in
|
||||
and after the current one.
|
||||
Only makes sense for nestable layouts (such as environments).
|
||||
Must be ended by
|
||||
\begin_inset Quotes eld
|
||||
\end_inset
|
||||
|
||||
|
||||
\begin_inset Flex Code
|
||||
status collapsed
|
||||
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\change_inserted -712698321 1514538124
|
||||
EndAutoNests
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
|
||||
|
||||
\begin_inset Quotes erd
|
||||
\end_inset
|
||||
|
||||
.
|
||||
See also
|
||||
\begin_inset Flex Code
|
||||
status collapsed
|
||||
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\change_inserted -712698321 1514539161
|
||||
IsAutoNestedBy
|
||||
\change_unchanged
|
||||
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
|
||||
.
|
||||
\end_layout
|
||||
|
||||
\begin_layout Description
|
||||
\begin_inset Flex Code
|
||||
status collapsed
|
||||
@ -12889,6 +12945,63 @@ TitleLatexName
|
||||
\end_inset
|
||||
|
||||
global entries).
|
||||
\change_inserted -712698321 1514539171
|
||||
|
||||
\end_layout
|
||||
|
||||
\begin_layout Description
|
||||
|
||||
\change_inserted -712698321 1514539282
|
||||
\begin_inset Flex Code
|
||||
status collapsed
|
||||
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\change_inserted -712698321 1514539190
|
||||
IsAutoNestedBy
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
|
||||
Includes a comma-separated list of layout names after which this one should
|
||||
be nested.
|
||||
Only makes sense with regard to nestable layouts (such as environments).
|
||||
Must be ended by
|
||||
\begin_inset Quotes eld
|
||||
\end_inset
|
||||
|
||||
|
||||
\begin_inset Flex Code
|
||||
status collapsed
|
||||
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\change_inserted -712698321 1514539279
|
||||
EndIsAutoNestedBy
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
|
||||
|
||||
\begin_inset Quotes erd
|
||||
\end_inset
|
||||
|
||||
.
|
||||
See also
|
||||
\begin_inset Flex Code
|
||||
status collapsed
|
||||
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\change_inserted -712698321 1514710776
|
||||
AutoNests
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
|
||||
.
|
||||
\change_unchanged
|
||||
|
||||
\end_layout
|
||||
|
||||
\begin_layout Description
|
||||
|
@ -10615,6 +10615,43 @@ Argument item:1
|
||||
\begin_inset Flex Code
|
||||
status collapsed
|
||||
|
||||
\begin_layout Plain Layout
|
||||
AutoNests
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
|
||||
beinhaltet eine mit Kommata separierte Liste von Layoutnamen, welche in
|
||||
und nach der aktuellen automatisch eingebettet werden sollen.
|
||||
Dies ist nur für Layouts sinnvoll, die auch einbetten können (etwa Umgebungen).
|
||||
Muss mit
|
||||
\begin_inset Flex Code
|
||||
status collapsed
|
||||
|
||||
\begin_layout Plain Layout
|
||||
EndAutoNests
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
|
||||
beendet werden.
|
||||
Siehe auch
|
||||
\begin_inset Flex Code
|
||||
status collapsed
|
||||
|
||||
\begin_layout Plain Layout
|
||||
IsAutoNestedBy
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
|
||||
.
|
||||
\end_layout
|
||||
|
||||
\begin_layout Description
|
||||
\begin_inset Flex Code
|
||||
status collapsed
|
||||
|
||||
\begin_layout Plain Layout
|
||||
BabelPreamble
|
||||
\end_layout
|
||||
@ -11401,6 +11438,44 @@ TitleLatexName
|
||||
\begin_inset Flex Code
|
||||
status collapsed
|
||||
|
||||
\begin_layout Plain Layout
|
||||
IsAutoNestedBy
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
|
||||
beinhaltet eine mit Kommata separierte Liste von Layoutnamen, nach welchen
|
||||
Absätze mit dem aktuellen Layout automatisch eingebettet werden sollen.
|
||||
Sinnvolle Layouts für diese Liste sind nur solche, die auch einbetten können
|
||||
(etwa Umgebungen).
|
||||
Muss mit
|
||||
\begin_inset Flex Code
|
||||
status collapsed
|
||||
|
||||
\begin_layout Plain Layout
|
||||
EndIsAutoNestedBy
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
|
||||
beendet werden.
|
||||
Siehe auch
|
||||
\begin_inset Flex Code
|
||||
status collapsed
|
||||
|
||||
\begin_layout Plain Layout
|
||||
AutoNests
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
|
||||
.
|
||||
\end_layout
|
||||
|
||||
\begin_layout Description
|
||||
\begin_inset Flex Code
|
||||
status collapsed
|
||||
|
||||
\begin_layout Plain Layout
|
||||
IsTocCaption
|
||||
\end_layout
|
||||
|
@ -123,11 +123,12 @@ logicalmkup
|
||||
\papercolumns 1
|
||||
\papersides 2
|
||||
\paperpagestyle headings
|
||||
\tracking_changes false
|
||||
\tracking_changes true
|
||||
\output_changes false
|
||||
\html_math_output 0
|
||||
\html_css_as_file 0
|
||||
\html_be_strict true
|
||||
\author -712698321 "Jürgen Spitzmüller"
|
||||
\end_header
|
||||
|
||||
\begin_body
|
||||
@ -11816,6 +11817,69 @@ Argument item:1
|
||||
\end_layout
|
||||
|
||||
\end_deeper
|
||||
\begin_layout Description
|
||||
|
||||
\change_inserted -712698321 1514710560
|
||||
|
||||
\lang english
|
||||
\begin_inset Flex Code
|
||||
status collapsed
|
||||
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\change_inserted -712698321 1514710560
|
||||
|
||||
\lang english
|
||||
AutoNests
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
|
||||
Includes a comma-separated list of layout names that should be nested in
|
||||
and after the current one.
|
||||
Only makes sense for nestable layouts (such as environments).
|
||||
Must be ended by
|
||||
\begin_inset Quotes eld
|
||||
\end_inset
|
||||
|
||||
|
||||
\begin_inset Flex Code
|
||||
status collapsed
|
||||
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\change_inserted -712698321 1514710560
|
||||
|
||||
\lang english
|
||||
EndAutoNests
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
|
||||
|
||||
\begin_inset Quotes erd
|
||||
\end_inset
|
||||
|
||||
.
|
||||
See also
|
||||
\begin_inset Flex Code
|
||||
status collapsed
|
||||
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\change_inserted -712698321 1514710560
|
||||
|
||||
\lang english
|
||||
IsAutoNestedBy
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
|
||||
.
|
||||
\change_unchanged
|
||||
|
||||
\end_layout
|
||||
|
||||
\begin_layout Description
|
||||
\begin_inset Flex Code
|
||||
status collapsed
|
||||
@ -12600,6 +12664,71 @@ TitleLatexName
|
||||
\end_inset
|
||||
|
||||
).
|
||||
\change_inserted -712698321 1514710606
|
||||
|
||||
\end_layout
|
||||
|
||||
\begin_layout Description
|
||||
|
||||
\change_inserted -712698321 1514710606
|
||||
|
||||
\lang english
|
||||
\begin_inset Flex Code
|
||||
status collapsed
|
||||
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\change_inserted -712698321 1514710606
|
||||
|
||||
\lang english
|
||||
IsAutoNestedBy
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
|
||||
Includes a comma-separated list of layout names after which this one should
|
||||
be nested.
|
||||
Only makes sense with regard to nestable layouts (such as environments).
|
||||
Must be ended by
|
||||
\begin_inset Quotes eld
|
||||
\end_inset
|
||||
|
||||
|
||||
\begin_inset Flex Code
|
||||
status collapsed
|
||||
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\change_inserted -712698321 1514710606
|
||||
|
||||
\lang english
|
||||
EndIsAutoNestedBy
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
|
||||
|
||||
\begin_inset Quotes erd
|
||||
\end_inset
|
||||
|
||||
.
|
||||
See also
|
||||
\begin_inset Flex Code
|
||||
status collapsed
|
||||
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\change_inserted -712698321 1514710757
|
||||
|
||||
\lang english
|
||||
AutoNests
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
|
||||
.
|
||||
\change_unchanged
|
||||
|
||||
\end_layout
|
||||
|
||||
\begin_layout Description
|
||||
|
@ -123,11 +123,12 @@ logicalmkup
|
||||
\papercolumns 1
|
||||
\papersides 2
|
||||
\paperpagestyle headings
|
||||
\tracking_changes false
|
||||
\tracking_changes true
|
||||
\output_changes false
|
||||
\html_math_output 0
|
||||
\html_css_as_file 0
|
||||
\html_be_strict false
|
||||
\author -712698321 "Jürgen Spitzmüller"
|
||||
\end_header
|
||||
|
||||
\begin_body
|
||||
@ -12540,6 +12541,69 @@ Argument item:1
|
||||
\end_deeper
|
||||
\begin_layout Description
|
||||
|
||||
\change_inserted -712698321 1514710551
|
||||
|
||||
\lang english
|
||||
\begin_inset Flex Code
|
||||
status collapsed
|
||||
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\change_inserted -712698321 1514710551
|
||||
|
||||
\lang english
|
||||
AutoNests
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
|
||||
Includes a comma-separated list of layout names that should be nested in
|
||||
and after the current one.
|
||||
Only makes sense for nestable layouts (such as environments).
|
||||
Must be ended by
|
||||
\begin_inset Quotes eld
|
||||
\end_inset
|
||||
|
||||
|
||||
\begin_inset Flex Code
|
||||
status collapsed
|
||||
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\change_inserted -712698321 1514710551
|
||||
|
||||
\lang english
|
||||
EndAutoNests
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
|
||||
|
||||
\begin_inset Quotes erd
|
||||
\end_inset
|
||||
|
||||
.
|
||||
See also
|
||||
\begin_inset Flex Code
|
||||
status collapsed
|
||||
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\change_inserted -712698321 1514710551
|
||||
|
||||
\lang english
|
||||
IsAutoNestedBy
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
|
||||
.
|
||||
\change_unchanged
|
||||
|
||||
\end_layout
|
||||
|
||||
\begin_layout Description
|
||||
|
||||
\lang english
|
||||
\begin_inset Flex Code
|
||||
status collapsed
|
||||
@ -13388,6 +13452,71 @@ TitleLatexName
|
||||
\end_inset
|
||||
|
||||
dans les paramètres généraux).
|
||||
\change_inserted -712698321 1514710619
|
||||
|
||||
\end_layout
|
||||
|
||||
\begin_layout Description
|
||||
|
||||
\change_inserted -712698321 1514710619
|
||||
|
||||
\lang english
|
||||
\begin_inset Flex Code
|
||||
status collapsed
|
||||
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\change_inserted -712698321 1514710619
|
||||
|
||||
\lang english
|
||||
IsAutoNestedBy
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
|
||||
Includes a comma-separated list of layout names after which this one should
|
||||
be nested.
|
||||
Only makes sense with regard to nestable layouts (such as environments).
|
||||
Must be ended by
|
||||
\begin_inset Quotes eld
|
||||
\end_inset
|
||||
|
||||
|
||||
\begin_inset Flex Code
|
||||
status collapsed
|
||||
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\change_inserted -712698321 1514710619
|
||||
|
||||
\lang english
|
||||
EndIsAutoNestedBy
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
|
||||
|
||||
\begin_inset Quotes erd
|
||||
\end_inset
|
||||
|
||||
.
|
||||
See also
|
||||
\begin_inset Flex Code
|
||||
status collapsed
|
||||
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\change_inserted -712698321 1514710764
|
||||
|
||||
\lang english
|
||||
AutoNests
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
|
||||
.
|
||||
\change_unchanged
|
||||
|
||||
\end_layout
|
||||
|
||||
\begin_layout Description
|
||||
|
@ -172,6 +172,7 @@ End
|
||||
\html_math_output 0
|
||||
\html_css_as_file 0
|
||||
\html_be_strict true
|
||||
\author -712698321 "Jürgen Spitzmüller"
|
||||
\end_header
|
||||
|
||||
\begin_body
|
||||
@ -10616,6 +10617,69 @@ Argument item:1
|
||||
\end_layout
|
||||
|
||||
\end_deeper
|
||||
\begin_layout Description
|
||||
|
||||
\change_inserted -712698321 1514710543
|
||||
|
||||
\lang english
|
||||
\begin_inset Flex Code
|
||||
status collapsed
|
||||
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\change_inserted -712698321 1514710543
|
||||
|
||||
\lang english
|
||||
AutoNests
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
|
||||
Includes a comma-separated list of layout names that should be nested in
|
||||
and after the current one.
|
||||
Only makes sense for nestable layouts (such as environments).
|
||||
Must be ended by
|
||||
\begin_inset Quotes eld
|
||||
\end_inset
|
||||
|
||||
|
||||
\begin_inset Flex Code
|
||||
status collapsed
|
||||
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\change_inserted -712698321 1514710543
|
||||
|
||||
\lang english
|
||||
EndAutoNests
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
|
||||
|
||||
\begin_inset Quotes erd
|
||||
\end_inset
|
||||
|
||||
.
|
||||
See also
|
||||
\begin_inset Flex Code
|
||||
status collapsed
|
||||
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\change_inserted -712698321 1514710543
|
||||
|
||||
\lang english
|
||||
IsAutoNestedBy
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
|
||||
.
|
||||
\change_unchanged
|
||||
|
||||
\end_layout
|
||||
|
||||
\begin_layout Description
|
||||
\begin_inset Flex Code
|
||||
status collapsed
|
||||
@ -11276,6 +11340,71 @@ TitleLatexName
|
||||
\end_inset
|
||||
|
||||
も参照).
|
||||
\change_inserted -712698321 1514710627
|
||||
|
||||
\end_layout
|
||||
|
||||
\begin_layout Description
|
||||
|
||||
\change_inserted -712698321 1514710627
|
||||
|
||||
\lang english
|
||||
\begin_inset Flex Code
|
||||
status collapsed
|
||||
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\change_inserted -712698321 1514710627
|
||||
|
||||
\lang english
|
||||
IsAutoNestedBy
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
|
||||
Includes a comma-separated list of layout names after which this one should
|
||||
be nested.
|
||||
Only makes sense with regard to nestable layouts (such as environments).
|
||||
Must be ended by
|
||||
\begin_inset Quotes eld
|
||||
\end_inset
|
||||
|
||||
|
||||
\begin_inset Flex Code
|
||||
status collapsed
|
||||
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\change_inserted -712698321 1514710627
|
||||
|
||||
\lang english
|
||||
EndIsAutoNestedBy
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
|
||||
|
||||
\begin_inset Quotes erd
|
||||
\end_inset
|
||||
|
||||
.
|
||||
See also
|
||||
\begin_inset Flex Code
|
||||
status collapsed
|
||||
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\change_inserted -712698321 1514710769
|
||||
|
||||
\lang english
|
||||
AutoNests
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
|
||||
.
|
||||
\change_unchanged
|
||||
|
||||
\end_layout
|
||||
|
||||
\begin_layout Description
|
||||
|
@ -6,7 +6,7 @@
|
||||
# Richard Heck <rgheck@lyx.org>, Martin Vermeer <martin.vermeer@hut.fi> and probably others.
|
||||
|
||||
|
||||
Format 65
|
||||
Format 66
|
||||
|
||||
#
|
||||
# GLOBAL SETTINGS
|
||||
@ -487,6 +487,12 @@ Style Frame
|
||||
AutoInsert 1
|
||||
IsTocCaption 1
|
||||
EndArgument
|
||||
AutoNests
|
||||
Standard,Itemize,Enumerate,Description,FrameTitle,FrameSubtitle,Column,
|
||||
Columns,ColumnsCenterAligned,ColumnsTopAligned,Pause,Overprint,OverlayArea,Only,Block,
|
||||
ExampleBlock,AlertBlock,Bibliography,Quotation,Quote,Verse,Corollary,Definition,Definitions,
|
||||
Example,Examples,Fact,Lemma,Proof,Theorem,LyX-Code
|
||||
EndAutoNests
|
||||
End
|
||||
|
||||
Style PlainFrame
|
||||
@ -670,6 +676,11 @@ Style Columns
|
||||
Family Roman
|
||||
Color latex
|
||||
EndFont
|
||||
AutoNests
|
||||
Standard,Itemize,Enumerate,Description,Pause,Overprint,OverlayArea,Only,Block,
|
||||
ExampleBlock,AlertBlock,Bibliography,Quotation,Quote,Verse,Corollary,Definition,Definitions,
|
||||
Example,Examples,Fact,Lemma,Proof,Theorem,LyX-Code
|
||||
EndAutoNests
|
||||
End
|
||||
|
||||
Style ColumnsCenterAligned
|
||||
@ -890,6 +901,10 @@ Style Block
|
||||
EndFont
|
||||
AutoInsert 1
|
||||
EndArgument
|
||||
AutoNests
|
||||
Standard,Itemize,Enumerate,Description,Pause,Overprint,OverlayArea,Only,Quotation,
|
||||
Quote,Verse,Corollary,Definition,Definitions,Example,Examples,Fact,Lemma,Proof,Theorem,LyX-Code
|
||||
EndAutoNests
|
||||
End
|
||||
|
||||
Style ExampleBlock
|
||||
@ -1233,6 +1248,9 @@ Style Corollary
|
||||
LabelString "Additional Theorem Text"
|
||||
Tooltip "Additional text appended to the theorem header"
|
||||
EndArgument
|
||||
AutoNests
|
||||
Standard,Itemize,Enumerate,Description,Pause,Overprint,OverlayArea,Only,LyX-Code
|
||||
EndAutoNests
|
||||
End
|
||||
|
||||
Style Definition
|
||||
|
@ -11,7 +11,7 @@
|
||||
# This script will update a .layout file to current format
|
||||
|
||||
# The latest layout format is also defined in src/TextClass.cpp
|
||||
currentFormat = 65
|
||||
currentFormat = 66
|
||||
|
||||
|
||||
# Incremented to format 4, 6 April 2007, lasgouttes
|
||||
@ -220,6 +220,10 @@ currentFormat = 65
|
||||
# Incremented to format 65, 16 October 2017 by spitz
|
||||
# Color collapsable -> collapsible
|
||||
|
||||
# Incremented to format 66, 28 December 2017 by spitz
|
||||
# New Layout tags "AutoNests ... EndAutoNests" and
|
||||
# "IsAutoNestedBy ... EndIsAutoNestedBy"
|
||||
|
||||
# Do not forget to document format change in Customization
|
||||
# Manual (section "Declaring a new text class").
|
||||
|
||||
@ -469,6 +473,11 @@ def convert(lines, end_format):
|
||||
i += 1
|
||||
continue
|
||||
|
||||
if format == 65:
|
||||
# nothing to do.
|
||||
i += 1
|
||||
continue
|
||||
|
||||
if format == 64:
|
||||
match = re.compile(b'(\\s*Color\\s+)(\\w+)', re.IGNORECASE).match(lines[i])
|
||||
if not match:
|
||||
|
@ -40,6 +40,8 @@ enum LayoutTags {
|
||||
LT_ALIGN = 1,
|
||||
LT_ALIGNPOSSIBLE,
|
||||
LT_ARGUMENT,
|
||||
LT_AUTONESTS,
|
||||
LT_AUTONESTEDBY,
|
||||
LT_MARGIN,
|
||||
LT_BOTTOMSEP,
|
||||
LT_CATEGORY,
|
||||
@ -191,6 +193,7 @@ bool Layout::readIgnoreForcelocal(Lexer & lex, TextClass const & tclass)
|
||||
{ "align", LT_ALIGN },
|
||||
{ "alignpossible", LT_ALIGNPOSSIBLE },
|
||||
{ "argument", LT_ARGUMENT },
|
||||
{ "autonests", LT_AUTONESTS },
|
||||
{ "babelpreamble", LT_BABELPREAMBLE },
|
||||
{ "bottomsep", LT_BOTTOMSEP },
|
||||
{ "category", LT_CATEGORY },
|
||||
@ -217,6 +220,7 @@ bool Layout::readIgnoreForcelocal(Lexer & lex, TextClass const & tclass)
|
||||
{ "innertag", LT_INNERTAG },
|
||||
{ "inpreamble", LT_INPREAMBLE },
|
||||
{ "intitle", LT_INTITLE },
|
||||
{ "isautonestedby", LT_AUTONESTEDBY },
|
||||
{ "istoccaption", LT_ISTOCCAPTION },
|
||||
{ "itemcommand", LT_ITEMCOMMAND },
|
||||
{ "itemsep", LT_ITEMSEP },
|
||||
@ -592,6 +596,30 @@ bool Layout::readIgnoreForcelocal(Lexer & lex, TextClass const & tclass)
|
||||
break;
|
||||
}
|
||||
|
||||
case LT_AUTONESTS: {
|
||||
docstring const autonest =
|
||||
subst(subst(subst(lex.getLongString(from_ascii("EndAutoNests")),
|
||||
from_ascii("\n"), docstring()),
|
||||
from_ascii(" "), docstring()),
|
||||
from_ascii("\t"), docstring());
|
||||
vector<docstring> const autonests =
|
||||
getVectorFromString(autonest);
|
||||
autonests_.insert(autonests.begin(), autonests.end());
|
||||
break;
|
||||
}
|
||||
|
||||
case LT_AUTONESTEDBY: {
|
||||
docstring const autonest =
|
||||
subst(subst(subst(lex.getLongString(from_ascii("EndIsAutoNestedBy")),
|
||||
from_ascii("\n"), docstring()),
|
||||
from_ascii(" "), docstring()),
|
||||
from_ascii("\t"), docstring());
|
||||
vector<docstring> const autonests =
|
||||
getVectorFromString(autonest);
|
||||
autonested_by_.insert(autonests.begin(), autonests.end());
|
||||
break;
|
||||
}
|
||||
|
||||
case LT_REFPREFIX: {
|
||||
docstring arg;
|
||||
lex >> arg;
|
||||
@ -1387,6 +1415,26 @@ void Layout::write(ostream & os) const
|
||||
}
|
||||
os << '\n';
|
||||
}
|
||||
if (!autonests_.empty()) {
|
||||
os << "\tAutoNests\n\t";
|
||||
for (set<docstring>::const_iterator it = autonests_.begin();
|
||||
it != autonests_.end(); ++it) {
|
||||
if (it != autonests_.begin())
|
||||
os << ',';
|
||||
os << to_utf8(*it);
|
||||
}
|
||||
os << "\n\tEndAutoNests\n";
|
||||
}
|
||||
if (!autonested_by_.empty()) {
|
||||
os << "\tIsAutoNestedBy\n\t";
|
||||
for (set<docstring>::const_iterator it = autonested_by_.begin();
|
||||
it != autonested_by_.end(); ++it) {
|
||||
if (it != autonested_by_.begin())
|
||||
os << ',';
|
||||
os << to_utf8(*it);
|
||||
}
|
||||
os << "\n\tIsAutoNestedBy\n";
|
||||
}
|
||||
if (refprefix.empty())
|
||||
os << "\tRefPrefix OFF\n";
|
||||
else
|
||||
|
@ -149,6 +149,10 @@ public:
|
||||
///
|
||||
std::set<std::string> const & requires() const { return requires_; }
|
||||
///
|
||||
std::set<docstring> const & autonests() const { return autonests_; }
|
||||
///
|
||||
std::set<docstring> const & isAutonestedBy() const { return autonested_by_; }
|
||||
///
|
||||
std::string const & latexparam() const { return latexparam_; }
|
||||
///
|
||||
docstring leftdelim() const { return leftdelim_; }
|
||||
@ -468,6 +472,10 @@ private:
|
||||
bool par_group_;
|
||||
/// Packages needed for this layout
|
||||
std::set<std::string> requires_;
|
||||
/// Layouts that are by default nested after this one
|
||||
std::set<docstring> autonests_;
|
||||
/// Layouts that by auto-nest this one
|
||||
std::set<docstring> autonested_by_;
|
||||
///
|
||||
LaTeXArgMap latexargs_;
|
||||
///
|
||||
|
@ -2300,8 +2300,9 @@ void LyXAction::init()
|
||||
/*!
|
||||
* \var lyx::FuncCode lyx::LFUN_LAYOUT
|
||||
* \li Action: Sets the layout (that is, environment) for the current paragraph.
|
||||
* \li Syntax: layout <LAYOUT>
|
||||
* \li Params: <LAYOUT>: the layout to use
|
||||
* \li Syntax: layout <LAYOUT> [ignorenests]
|
||||
* \li Params: <LAYOUT>: the layout to use\n
|
||||
ignorenests: If specified, nesting advices will be ignored.
|
||||
* \endvar
|
||||
*/
|
||||
{ LFUN_LAYOUT, "layout", Noop, Layout },
|
||||
|
@ -1407,7 +1407,8 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
|
||||
break;
|
||||
|
||||
case LFUN_LAYOUT: {
|
||||
docstring layout = cmd.argument();
|
||||
bool const ignoreautonests = cmd.getArg(1) == "ignoreautonests";
|
||||
docstring layout = ignoreautonests ? from_utf8(cmd.getArg(0)) : cmd.argument();
|
||||
LYXERR(Debug::INFO, "LFUN_LAYOUT: (arg) " << to_utf8(layout));
|
||||
|
||||
Paragraph const & para = cur.paragraph();
|
||||
@ -1461,8 +1462,18 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
|
||||
}
|
||||
}
|
||||
|
||||
if (change_layout)
|
||||
if (change_layout) {
|
||||
setLayout(cur, layout);
|
||||
if (cur.pit() > 0 && !ignoreautonests) {
|
||||
set<docstring> const & autonests =
|
||||
pars_[cur.pit() - 1].layout().autonests();
|
||||
set<docstring> const & autonested =
|
||||
pars_[cur.pit()].layout().isAutonestedBy();
|
||||
if (autonests.find(layout) != autonests.end()
|
||||
|| autonested.find(old_layout) != autonested.end())
|
||||
lyx::dispatch(FuncRequest(LFUN_DEPTH_INCREMENT));
|
||||
}
|
||||
}
|
||||
|
||||
Layout::LaTeXArgMap args = tclass[layout].args();
|
||||
Layout::LaTeXArgMap::const_iterator lait = args.begin();
|
||||
@ -3141,7 +3152,8 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
|
||||
case LFUN_LAYOUT: {
|
||||
DocumentClass const & tclass = cur.buffer()->params().documentClass();
|
||||
docstring layout = cmd.argument();
|
||||
bool const ignoreautonests = cmd.getArg(1) == "ignoreautonests";
|
||||
docstring layout = ignoreautonests ? from_utf8(cmd.getArg(0)) : cmd.argument();
|
||||
if (layout.empty())
|
||||
layout = tclass.defaultLayoutName();
|
||||
enable = !owner_->forcePlainLayout() && tclass.hasLayout(layout);
|
||||
|
@ -62,7 +62,7 @@ namespace lyx {
|
||||
// You should also run the development/tools/updatelayouts.py script,
|
||||
// to update the format of all of our layout files.
|
||||
//
|
||||
int const LAYOUT_FORMAT = 65; //spitz: Color collapsable -> collapsible.
|
||||
int const LAYOUT_FORMAT = 66; //spitz: New layout tag AutoNests
|
||||
|
||||
|
||||
// Layout format for the current lyx file format. Controls which format is
|
||||
|
Loading…
Reference in New Issue
Block a user