[latexila] Improve figure environment insertion
- From: SÃbastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [latexila] Improve figure environment insertion
- Date: Thu, 15 Sep 2011 14:05:41 +0000 (UTC)
commit 7c367532cee36896450fcc58bb1b77781ccd7a78
Author: Simon Claessens <gagalago gmail com>
Date: Thu Sep 15 11:01:18 2011 +0200
Improve figure environment insertion
- add icon in menu and in toolbar
- improve latex code added
src/latex_menu.vala | 16 ++++++++++++++--
src/ui/ui.xml | 4 ++++
2 files changed, 18 insertions(+), 2 deletions(-)
---
diff --git a/src/latex_menu.vala b/src/latex_menu.vala
index cd272fe..9fd811a 100644
--- a/src/latex_menu.vala
+++ b/src/latex_menu.vala
@@ -66,7 +66,7 @@ public class LatexMenu : Gtk.ActionGroup
N_("Align Left - \\begin{flushleft}"), on_env_left },
{ "EnvRight", Stock.JUSTIFY_RIGHT, "\\begin{flush_right}", null,
N_("Align Right - \\begin{flushright}"), on_env_right },
- { "EnvFigure", null, "\\begin{_figure}", null,
+ { "EnvFigure", "insert-image", "\\begin{_figure}", null,
N_("Figure - \\begin{figure}"), on_env_figure },
{ "EnvTable", null, "\\begin{_table}", null,
N_("Table - \\begin{table}"), on_env_table },
@@ -629,7 +629,19 @@ public class LatexMenu : Gtk.ActionGroup
public void on_env_figure ()
{
- text_buffer_insert ("\\begin{figure}\n", "\n\\caption{}\n\\end{figure}");
+ string indent = get_indentation ();
+
+ string begin = @"\\begin{figure}\n" +
+ @"$indent\\begin{center}\n" +
+ @"$indent$indent\\includegraphics{";
+
+ string end = @"}\n" +
+ @"$indent$indent\\label{fig:}\n" +
+ @"$indent$indent\\caption{}\n" +
+ @"$indent\\end{center}\n" +
+ "\\end{figure}";
+
+ text_buffer_insert (begin, end);
}
public void on_env_table ()
diff --git a/src/ui/ui.xml b/src/ui/ui.xml
index b0f8fca..484c95a 100644
--- a/src/ui/ui.xml
+++ b/src/ui/ui.xml
@@ -455,6 +455,10 @@ along with LaTeXila. If not, see <http://www.gnu.org/licenses/>.
<separator />
+ <toolitem action="EnvFigure" />
+
+ <separator />
+
<toolitem action="MathEnvironmentsToolItem">
<menu action="MathEnvironments">
<menuitem action="MathEnvNormal" />
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]