Powerdot updates

* Powerdot now also uses the native overlay item arguments
* a list option argument is finally available
* \pause natively supported (like in beamer)
* support for \onslide (via InsetFlex)
* support for \twocolumn

File format change.
This commit is contained in:
Juergen Spitzmueller 2013-03-18 13:36:56 +01:00
parent c33f98624e
commit 3ab2798b6e
5 changed files with 373 additions and 11 deletions

View File

@ -11,6 +11,14 @@ adjustments are made to tex2lyx and bugs are fixed in lyx2lyx.
-----------------------
2013-03-17 Jürgen Spitzmüller <spitz@lyx.org>
* Format incremented to 466: Powerdot updates.
- Support for item arguments ([...], <...>)
- Support for list option
- Support for Pause layout (like in beamer)
- Support for twocolumn layout
- Support for \onslide, \onslide* and \onslide+ via fle inset.
2013-03-16 Jürgen Spitzmüller <spitz@lyx.org>
* Format incremented to 465: Convert old beamer frames to new ones.
The layouts BeginFrame, BeginPlainFrame and EndFrame are now not

View File

@ -3,7 +3,7 @@
# \DeclareCategory{Presentations}
# PowerDot textclass definition file.
# Created: 29-Aug-05 by Mael Hilléreau
# Last modified: 20-May-06 by Uwe Stöhr
# Modified: 20-May-06 by Uwe Stöhr, 18-Mar-2013 Jürgen Spitzmüller
Format 45
@ -40,7 +40,7 @@ End
# Title style definition
###
Style Title
Category FrontMatter
Category TitleSlide
Margin Static
LatexType Command
InTitle 1
@ -64,7 +64,7 @@ End
# Author style definition
###
Style Author
Category FrontMatter
Category TitleSlide
Margin Static
LatexType Command
InTitle 1
@ -86,6 +86,7 @@ End
# Date style definition
###
Style Date
Category TitleSlide
Margin Dynamic
LatexType Command
InTitle 1
@ -121,6 +122,7 @@ End
# Slide styles definition
###
Style Slide
Category Slides
TocLevel 3
Margin Static
LatexType Command
@ -146,6 +148,7 @@ Style Slide
End
Style EndSlide
Category Slides
KeepEmpty 1
LatexType Command
LatexName lyxend
@ -199,6 +202,7 @@ End
# Note style definition
###
Style Note
Category Slides
Margin Static
LatexType Command
LatexName lyxend\lyxnote
@ -237,13 +241,17 @@ Style Section
Color Blue
EndFont
LabelStringAppendix "\Alph{section}"
Argument 1
LabelString "Section Option"
Tooltip "Optional arguments to the section command (see powerdot manual)"
EndArgument
End
###
# Itemize styles definition
###
Style Itemize
Category List
Category Lists
Margin Static
LatexType Item_Environment
LatexName itemize
@ -257,18 +265,41 @@ Style Itemize
Align Block
AlignPossible Block, Left
LabelType Itemize
Argument 1
LabelString "Itemize Type"
Tooltip "Itemize type spezification (see powerdot manual)"
EndArgument
Argument 2
LabelString "Itemize Options"
Tooltip "Optional arguments for this list (see enumitem manual)"
EndArgument
Argument item:1
LabelString "Custom Item|s"
Tooltip "A customized item string"
EndArgument
Argument item:2
MenuString "Item Overlay Specifications"
LabelString "On Slide"
Tooltip "Overlay specifications for this item"
LeftDelim <
RightDelim >
EndArgument
End
Style ItemizeType1
CopyStyle Itemize
LatexParam [type=1]
Argument 1
LabelString "Itemize Type"
Tooltip "Itemize type spezification (see powerdot manual)"
DefaultArg "type=1"
EndArgument
End
###
# Enumerate styles definition
###
Style Enumerate
Category List
Category Lists
Margin Static
LatexType Item_Environment
LatexName enumerate
@ -284,11 +315,34 @@ Style Enumerate
AlignPossible Block, Left
LabelType Enumerate
RefPrefix enu
Argument 1
LabelString "Enumerate Type"
Tooltip "Enumerate type spezification (see powerdot manual)"
EndArgument
Argument 2
LabelString "Enumerate Options"
Tooltip "Optional arguments for this list (see enumitem manual)"
EndArgument
Argument item:1
LabelString "Custom Item|s"
Tooltip "A customized item string"
EndArgument
Argument item:2
MenuString "Item Overlay Specifications"
LabelString "On Slide"
Tooltip "Overlay specifications for this item"
LeftDelim <
RightDelim >
EndArgument
End
Style EnumerateType1
CopyStyle Enumerate
LatexParam [type=1]
CopyStyle Enumerate
Argument 1
LabelString "Enumerate Type"
Tooltip "Enumerate type spezification (see powerdot manual)"
DefaultArg "type=1"
EndArgument
End
###
@ -317,6 +371,7 @@ End
# Quotation style definition
###
Style Quotation
Category MainText
Margin Static
LatexType Environment
LatexName quotation
@ -337,6 +392,7 @@ End
# Quote style definition
###
Style Quote
Category MainText
Margin Static
LatexType Environment
LatexName quote
@ -357,6 +413,7 @@ End
Style Verse
# LaTeX type is first dynamic because of LaTeX implementation.
# In LyX this does not make sense.
Category MainText
LatexType Environment
LatexName verse
Margin First_Dynamic
@ -372,6 +429,65 @@ Style Verse
LabelType No_Label
End
###
# Twocolumn style definition
###
Style Twocolumn
Category MainText
LatexType command
LatexName twocolumn
Margin First_Dynamic
NextNoIndent 1
ParSkip 0.4
TopSep 0.7
BottomSep 0.7
ParSep 0.5
Align Block
AlignPossible Block, Left, Right, Center
LabelType No_Label
Argument 1
LabelString "Column Options"
Tooltip "Twocolumn options (see powerdot manual)"
EndArgument
Argument 2
LabelString "Left Column"
Tooltip "Enter the text of the left column here (right column in main paragraph)"
Mandatory 1
AutoInsert 1
EndArgument
End
###
# Overlay style definitions
###
Style Pause
Category Overlays
KeepEmpty 1
LatexType Command
LatexName pause
Margin First_Dynamic
Argument 1
LabelString "Pause number"
Tooltip "Number of slide where the context below the pause gets visible"
EndArgument
NextNoIndent 1
ParSkip 0
TopSep 0
BottomSep 0.25
ParSep 0
Align Center
LabelType Static
LabelBottomSep 0
LeftMargin MMMMM
LabelString "_ _ _ _ _ _ _ _ _ _ _ _ _ _"
LabelFont
Family typewriter
Series Medium
Size Normal
Color latex
EndFont
End
###
# Caption style definition
###
@ -443,3 +559,33 @@ End
Counter algorithm
End
###
# Charstyle definitions
###
InsetLayout Flex:onslide
LyXType charstyle
LabelString "Visible"
LatexType command
LatexName onslide
Argument 1
LabelString "On Slides"
MenuString "Overlay Specification|S"
Tooltip "Specify the overlay settings (see powerdot manual)"
Mandatory 1
DefaultArg "1-"
EndArgument
End
InsetLayout Flex:onslide+
CopyStyle Flex:onslide
LatexName onslide+
LabelString "Uncover"
End
InsetLayout Flex:onslide*
CopyStyle Flex:onslide
LatexName onslide*
LabelString "Only"
End

View File

@ -3831,6 +3831,204 @@ def remove_endframes(document):
del document.body[i : j + 1]
def revert_powerdot_flexes(document):
" Reverts powerdot flex insets "
if document.textclass != "powerdot":
return
flexes = {"onslide" : "\\onslide",
"onslide*" : "\\onslide*",
"onslide+" : "\\onslide+"}
rx = re.compile(r'^\\begin_inset Flex (.+)$')
i = 0
while True:
i = find_token(document.body, "\\begin_inset Flex", i)
if i == -1:
return
m = rx.match(document.body[i])
if m:
flextype = m.group(1)
z = find_end_of_inset(document.body, i)
if z == -1:
document.warning("Can't find end of Flex " + flextype + " inset.")
i += 1
continue
if flextype in flexes:
pre = put_cmd_in_ert(flexes[flextype])
arg = find_token(document.body, "\\begin_inset Argument 1", i, z)
if arg != -1:
argend = find_end_of_inset(document.body, arg)
if argend == -1:
document.warning("Can't find end of Argument!")
i += 1
continue
# Find containing paragraph layout
beginPlain = find_token(document.body, "\\begin_layout Plain Layout", arg)
endPlain = find_end_of_layout(document.body, beginPlain)
argcontent = document.body[beginPlain + 1 : endPlain]
# Adjust range end
z = z - len(document.body[arg : argend + 1])
# Remove arg inset
del document.body[arg : argend + 1]
pre += put_cmd_in_ert("{") + argcontent + put_cmd_in_ert("}")
pre += put_cmd_in_ert("{")
beginPlain = find_token(document.body, "\\begin_layout Plain Layout", i)
endPlain = find_end_of_layout(document.body, beginPlain)
# Adjust range end
z = z - len(document.body[i : beginPlain + 1])
z += len(pre)
document.body[i : beginPlain + 1] = pre
post = put_cmd_in_ert("}")
document.body[z - 2 : z + 1] = post
i += 1
def revert_powerdot_pause(document):
" Reverts powerdot pause layout to ERT "
if document.textclass != "powerdot":
return
i = 0
while True:
i = find_token(document.body, "\\begin_layout Pause", i)
if i == -1:
return
j = find_end_of_layout(document.body, i)
if j == -1:
document.warning("Malformed lyx document: Can't find end of Pause layout")
i = i + 1
continue
endlay = j
subst = ["\\begin_layout Standard"] + put_cmd_in_ert("\\pause")
for p in range(i, j):
if p >= endlay:
break
arg = find_token(document.body, "\\begin_inset Argument 1", i, j)
if arg != -1:
beginPlain = find_token(document.body, "\\begin_layout Plain Layout", p)
endPlain = find_end_of_layout(document.body, beginPlain)
endInset = find_end_of_inset(document.body, p)
content = document.body[beginPlain + 1 : endPlain]
# Adjust range end
endlay = endlay - len(document.body[p : endInset + 1])
# Remove arg inset
del document.body[p : endInset + 1]
subst += put_cmd_in_ert("[") + content + put_cmd_in_ert("]")
document.body[i : i + 1] = subst
i = endlay
def revert_powerdot_itemargs(document):
" Reverts powerdot item arguments to ERT "
if document.textclass != "powerdot":
return
i = 0
list_layouts = ["Itemize", "ItemizeType1", "Enumerate", "EnumerateType1"]
rx = re.compile(r'^\\begin_inset Argument (\S+)$')
while True:
i = find_token(document.body, "\\begin_inset Argument", i)
if i == -1:
return
# Find containing paragraph layout
parent = get_containing_layout(document.body, i)
if parent == False:
document.warning("Malformed lyx document: Can't find parent paragraph layout")
i = i + 1
continue
parbeg = parent[1]
parend = parent[2]
realparbeg = parent[3]
layoutname = parent[0]
realparend = parend
for p in range(parbeg, parend):
if p >= realparend:
i = realparend
break
if layoutname in list_layouts:
m = rx.match(document.body[p])
if m:
argnr = m.group(1)
if argnr == "item:1":
j = find_end_of_inset(document.body, i)
# Find containing paragraph layout
beginPlain = find_token(document.body, "\\begin_layout Plain Layout", i)
endPlain = find_end_of_layout(document.body, beginPlain)
content = document.body[beginPlain + 1 : endPlain]
del document.body[i:j+1]
subst = put_cmd_in_ert("[") + content + put_cmd_in_ert("]")
document.body[realparbeg : realparbeg] = subst
elif argnr == "item:2":
j = find_end_of_inset(document.body, i)
# Find containing paragraph layout
beginPlain = find_token(document.body, "\\begin_layout Plain Layout", i)
endPlain = find_end_of_layout(document.body, beginPlain)
content = document.body[beginPlain + 1 : endPlain]
del document.body[i:j+1]
subst = put_cmd_in_ert("<") + content + put_cmd_in_ert(">")
document.body[realparbeg : realparbeg] = subst
i = realparend
def revert_powerdot_columns(document):
" Reverts powerdot twocolumn to TeX-code "
if document.textclass != "powerdot":
return
rx = re.compile(r'^\\begin_inset Argument (\S+)$')
i = 0
while True:
i = find_token(document.body, "\\begin_layout Twocolumn", i)
if i == -1:
return
j = find_end_of_layout(document.body, i)
if j == -1:
document.warning("Malformed lyx document: Can't find end of Twocolumn layout")
i = i + 1
continue
endlay = j
document.body[j : j] = put_cmd_in_ert("}") + document.body[j : j]
endlay += len(put_cmd_in_ert("}"))
subst = ["\\begin_layout Standard"] + put_cmd_in_ert("\\twocolumn")
for p in range(i, j):
if p >= endlay:
break
m = rx.match(document.body[p])
if m:
argnr = m.group(1)
if argnr == "1":
beginPlain = find_token(document.body, "\\begin_layout Plain Layout", p)
endPlain = find_end_of_layout(document.body, beginPlain)
endInset = find_end_of_inset(document.body, p)
content = document.body[beginPlain + 1 : endPlain]
# Adjust range end
endlay = endlay - len(document.body[p : endInset + 1])
# Remove arg inset
del document.body[p : endInset + 1]
subst += put_cmd_in_ert("[") + content + put_cmd_in_ert("]")
elif argnr == "2":
beginPlain = find_token(document.body, "\\begin_layout Plain Layout", p)
endPlain = find_end_of_layout(document.body, beginPlain)
endInset = find_end_of_inset(document.body, p)
content = document.body[beginPlain + 1 : endPlain]
# Adjust range end
endlay = endlay - len(document.body[p : endInset + 1])
# Remove arg inset
del document.body[p : endInset + 1]
subst += put_cmd_in_ert("{") + content + put_cmd_in_ert("}")
subst += put_cmd_in_ert("{")
document.body[i : i + 1] = subst
i = endlay
##
# Conversion hub
#
@ -3888,10 +4086,12 @@ convert = [
[462, []],
[463, [convert_encodings]],
[464, [convert_use_cancel]],
[465, [convert_lyxframes, remove_endframes]]
[465, [convert_lyxframes, remove_endframes]],
[466, []]
]
revert = [
[465, [revert_powerdot_flexes, revert_powerdot_pause, revert_powerdot_itemargs, revert_powerdot_columns]],
[464, []],
[463, [revert_use_cancel]],
[462, [revert_encodings]],

View File

@ -89,6 +89,14 @@ Format LaTeX feature LyX feature
\font_sf_scale
463
465
466 Powerdot updates:
\pause[] layout Pause
\onslide{}{} InsetFlex, InsetArgument
\onslide*{}{} InsetFlex, InsetArgument
\onslide+{}{} InsetFlex, InsetArgument
\twocolumn[]{}{} Layout Twocolumn, InsetArgument
\item[]<> InsetArgument
\begin{enumerate|itemize|...}[] InsetArgument
General

View File

@ -30,8 +30,8 @@ extern char const * const lyx_version_info;
// Do not remove the comment below, so we get merge conflict in
// independent branches. Instead add your own.
#define LYX_FORMAT_LYX 465 // spitz: new beamer frames
#define LYX_FORMAT_TEX2LYX 465 // spitz: new beamer frames
#define LYX_FORMAT_LYX 466 // spitz: powerdot updates
#define LYX_FORMAT_TEX2LYX 466 // spitz: powerdot updates
#if LYX_FORMAT_TEX2LYX != LYX_FORMAT_LYX
#ifndef _MSC_VER