[latexila] Beamer environments: frame, block, columns, column



commit 183105024a92b1a22f22d55705f3692f3cc2fa4d
Author: Erwan Bousse <erwan bousse gmail com>
Date:   Tue Jan 31 10:58:55 2012 +0100

    Beamer environments: frame, block, columns, column
    
    Add a Beamer submenu in the LaTeX menu and the toolbar.
    Add the environments also for the completion.

 data/completion.xml |    3 +++
 src/latex_menu.vala |   44 ++++++++++++++++++++++++++++++++++++++++++++
 src/latexila.vala   |    1 +
 src/ui/ui.xml       |   16 ++++++++++++++++
 4 files changed, 64 insertions(+), 0 deletions(-)
---
diff --git a/data/completion.xml b/data/completion.xml
index 55b995f..3067ab2 100644
--- a/data/completion.xml
+++ b/data/completion.xml
@@ -875,10 +875,13 @@ Example:
 			<choice name="align*" package="amsmath" />
 			<choice name="appendix" />
 			<choice name="array" />
+			<choice name="block" />
 			<choice name="Bmatrix" package="amsmath" />
 			<choice name="bmatrix" package="amsmath" />
 			<choice name="cases" package="amsmath" />
 			<choice name="center" />
+			<choice name="columns" />
+			<choice name="column" />
 			<choice name="document" />
 			<choice name="description">
 				<insert>\item[</insert>
diff --git a/src/latex_menu.vala b/src/latex_menu.vala
index 68b44a4..4b99bfb 100644
--- a/src/latex_menu.vala
+++ b/src/latex_menu.vala
@@ -83,6 +83,17 @@ public class LatexMenu : Gtk.ActionGroup
         { "EnvTitlepage", null, "\\begin{titlepage}", null,
             N_("Title page - \\begin{titlepage}"), on_env_titlepage },
 
+
+        // LaTeX: Presentation
+        { "Presentation", "presentation", "_Presentation" },
+        { "PresentationFrame", null, "\\begin{frame}", null,
+            N_("Frame - \\begin{frame}"), on_present_frame },
+        { "PresentationBlock", null, "\\begin{block}", null,
+            N_("Block - \\begin{block}"), on_present_block },
+        { "PresentationColumns", null, "\\begin{columns}", null,
+            N_("Two columns - \\begin{columns}"), on_present_columns },
+
+
         // LaTeX: list environments
         { "ListEnvironments", "list-enumerate", N_("_List Environments") },
         { "ListEnvItemize", "list-itemize", "\\begin{_itemize}", null,
@@ -431,6 +442,9 @@ public class LatexMenu : Gtk.ActionGroup
         Gtk.Action references = get_menu_tool_action ("ReferencesToolItem",
             _("References"), "references");
 
+        Gtk.Action presentation_env = get_menu_tool_action ("PresentationToolItem",
+            _("Presentation Environments"), "presentation");
+
         Gtk.Action math_env = get_menu_tool_action ("MathEnvironmentsToolItem",
             _("Math Environments"), "math");
 
@@ -444,6 +458,7 @@ public class LatexMenu : Gtk.ActionGroup
         add_action (sectioning);
         add_action (sizes);
         add_action (references);
+        add_action (presentation_env);
         add_action (math_env);
         add_action (math_left_del);
         add_action (math_right_del);
@@ -1012,6 +1027,35 @@ public class LatexMenu : Gtk.ActionGroup
         text_buffer_insert ("\\t{", "}");
     }
 
+    /* Presentation */
+
+    public void on_present_frame ()
+    {
+        string indent = get_indentation ();
+        string begin_frame = "\\begin{frame}\n"
+                           + @"$indent\\frametitle{}\n"
+                           + @"$indent\\framesubtitle{}\n";
+        string end_frame = "\n\\end{frame}";
+        text_buffer_insert (begin_frame, end_frame);
+    }
+
+    public void on_present_columns ()
+    {
+        string indent = get_indentation ();
+        string begin_columns = "\\begin{columns}\n"
+                             + @"$indent\\begin{column}{.5\\textwidth}\n";
+        string end_columns = @"\n$indent\\end{column}\n"
+                           + @"$indent\\begin{column}{.5\\textwidth}\n\n"
+                           + @"$indent\\end{column}\n"
+                           + "\\end{columns}";
+        text_buffer_insert (begin_columns, end_columns);
+    }
+
+    public void on_present_block ()
+    {
+        text_buffer_insert ("\\begin{block}{}\n","\n\\end{block}");
+    }
+
     /* Others */
 
     public void on_documentclass ()
diff --git a/src/latexila.vala b/src/latexila.vala
index f558fd1..d9b4d38 100644
--- a/src/latexila.vala
+++ b/src/latexila.vala
@@ -170,6 +170,7 @@ public class Latexila : GLib.Object
 
         register_my_stock_icons ();
         add_theme_icon_to_stock ("image-x-generic", "image");
+        add_theme_icon_to_stock ("x-office-presentation", "presentation");
 
         AppSettings.get_default ();
         create_window ();
diff --git a/src/ui/ui.xml b/src/ui/ui.xml
index f944e37..f8ebe8d 100644
--- a/src/ui/ui.xml
+++ b/src/ui/ui.xml
@@ -184,6 +184,12 @@ along with LaTeXila.  If not, see <http://www.gnu.org/licenses/>.
         <menuitem action="TabularCline" />
       </menu>
 
+      <menu action="Presentation">
+        <menuitem action="PresentationFrame" />
+        <menuitem action="PresentationBlock" />
+        <menuitem action="PresentationColumns" />
+      </menu>
+
       <menu action="Spacing">
         <menuitem action="SpacingNewLine" />
         <menuitem action="SpacingNewPage" />
@@ -459,6 +465,16 @@ along with LaTeXila.  If not, see <http://www.gnu.org/licenses/>.
 
     <separator />
 
+    <toolitem action="PresentationToolItem">
+      <menu action="Presentation">
+        <menuitem action="PresentationFrame" />
+        <menuitem action="PresentationBlock" />
+        <menuitem action="PresentationColumns" />
+      </menu>
+    </toolitem>
+
+    <separator />
+
     <toolitem action="MathEnvironmentsToolItem">
       <menu action="MathEnvironments">
         <menuitem action="MathEnvNormal" />



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]