]> git.lyx.org Git - features.git/commitdiff
Support for beamer \frametitle
authorJuergen Spitzmueller <spitz@lyx.org>
Sat, 22 Dec 2012 15:28:43 +0000 (16:28 +0100)
committerJuergen Spitzmueller <spitz@lyx.org>
Sat, 22 Dec 2012 15:28:43 +0000 (16:28 +0100)
The \frametitle command is less convenient to use than the \frame argument, but it provides more options (overlay/action and short title). We thus provide this additionally to the option, like beamer itself does.

development/FORMAT
lib/layouts/beamer.layout
lib/lyx2lyx/lyx_2_1.py
src/tex2lyx/TODO.txt
src/version.h

index d33bd979db42547eb24b38845375ef4cf54b1fda..1f8d9e158729bf1e48f4de03e7a45adb47808473 100644 (file)
@@ -11,6 +11,10 @@ adjustments are made to tex2lyx and bugs are fixed in lyx2lyx.
 
 -----------------------
 
+2012-12-22 Jürgen Spitzmüller <spitz@lyx.org>
+       * Format incremented to 455: Support for beamer \frametitle
+         \frametitle<overlay>[short]{title} > begin_layout FrameTitle
+
 2012-12-19 Jürgen Spitzmüller <spitz@lyx.org>
        * Format incremented to 454:
          Real support for beamer overprint environment. This environment has a
index a550a034681f08157da5194edf8e6b0c3c57b98b..a9e14eceabc0d828f3589b85acc351bba345040c 100644 (file)
@@ -554,6 +554,36 @@ Style EndFrame
   EndPreamble
 End
 
+Style FrameTitle
+  Category         Frames
+  Margin           Static
+  LatexType        Command
+  LatexName        frametitle
+  ParSkip          0.4
+  ItemSep          0
+  TopSep           0
+  BottomSep        1
+  ParSep           1
+  Align            Center
+  LabelType        No_Label
+  Font 
+    Series         Bold
+    Color          Blue
+    Size           Largest
+  EndFont
+  Argument 1
+    LabelString    "On Slide"
+    MenuString     "Overlay Specifications|S"
+    Tooltip        "Specify the overlay settings (see beamer manual)"
+    LeftDelim      <
+    RightDelim     >
+  EndArgument
+  Argument 2
+    LabelString    "Short Frame Title|S"
+    Tooltip        "A short form of the frame title used in some themes"
+  EndArgument
+End
+
 Style FrameSubtitle
   Category         Frames
   Margin           Static
index db7e391adedf3bc9664d70adfc6e5bd2a1af0bfe..684f5c83b09ad21059c23c946e73ca45d580c490 100644 (file)
@@ -2843,6 +2843,61 @@ def revert_overprint(document):
         i = endseq
 
 
+def revert_frametitle(document):
+    " Reverts beamer frametitle layout to ERT "
+    
+    beamer_classes = ["beamer", "article-beamer", "scrarticle-beamer"]
+    if document.textclass not in beamer_classes:
+        return
+
+    rx = re.compile(r'^\\begin_inset Argument (\S+)$')
+    i = 0
+    while True:
+        i = find_token(document.body, "\\begin_layout FrameTitle", 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 FrameTitle 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("\\frametitle")
+        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
 #
@@ -2889,10 +2944,12 @@ convert = [
            [451, [convert_beamerargs, convert_againframe_args, convert_corollary_args, convert_quote_args]],
            [452, [convert_beamerblocks]],
            [453, [convert_use_stmaryrd]],
-           [454, [convert_overprint]]
+           [454, [convert_overprint]],
+           [455, []]
           ]
 
 revert =  [
+           [454, [revert_frametitle]],
            [453, [revert_overprint]],
            [452, [revert_use_stmaryrd]],
            [451, [revert_beamerblocks]],
index cd0b0ede014f70629ab50c9b5a3c56e8a796b164..fec204a8ee132e7d5ee3a5f1e8327ee362c1742a 100644 (file)
@@ -94,6 +94,8 @@ Format LaTeX feature                        LyX feature
        \begin{overprint}[maxlength]
        \onslide<slide> text ...
        \end{overprint}
+455    beamer frametitle command            \begin_layout FrameTitle
+       \frametitle<overlay>[short}{long}
 
 
 General
index f7b72dbea1f575156e7c0cdd21da58e4f9ab1d8d..255c47e62352a44c8de1fc14d78e5658fc28d795 100644 (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 454 // spitz: support for beamer overprint
-#define LYX_FORMAT_TEX2LYX 454 // spitz: support for beamer overprint
+#define LYX_FORMAT_LYX 455 // spitz: support for beamer FrameTitle layout
+#define LYX_FORMAT_TEX2LYX 455 // spitz: support for beamer FrameTitle layout
 
 #if LYX_FORMAT_TEX2LYX != LYX_FORMAT_LYX
 #ifndef _MSC_VER