[gnome-latex] LaTeX commands: port Math left delimiter commands to GAction
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-latex] LaTeX commands: port Math left delimiter commands to GAction
- Date: Mon, 26 Feb 2018 19:13:45 +0000 (UTC)
commit c97ba2ef72d3c84527099ac63e85c09739ca7535
Author: Robert Griesel <r griesel gmail com>
Date: Mon Feb 26 16:34:55 2018 +0100
LaTeX commands: port Math left delimiter commands to GAction
src/latex_menu.vala | 94 ++++++++++-------------------
src/liblatexila/latexila-latex-commands.c | 99 +++++++++++++++++++++++++++++++
2 files changed, 129 insertions(+), 64 deletions(-)
---
diff --git a/src/latex_menu.vala b/src/latex_menu.vala
index 63254f6..c449328 100644
--- a/src/latex_menu.vala
+++ b/src/latex_menu.vala
@@ -364,24 +364,15 @@ public class LatexMenu : Gtk.ActionGroup
// Math: Left Delimiters
{ "MathLeftDelimiters", "delimiters-left", N_("_Left Delimiters") },
- { "MathLeftDelimiter1", null, N_("left ("), null,
- null, on_math_left_delimiter_1 },
- { "MathLeftDelimiter2", null, N_("left ["), null,
- null, on_math_left_delimiter_2 },
- { "MathLeftDelimiter3", null, N_("left { "), null,
- null, on_math_left_delimiter_3 },
- { "MathLeftDelimiter4", null, N_("left <"), null,
- null, on_math_left_delimiter_4 },
- { "MathLeftDelimiter5", null, N_("left )"), null,
- null, on_math_left_delimiter_5 },
- { "MathLeftDelimiter6", null, N_("left ]"), null,
- null, on_math_left_delimiter_6 },
- { "MathLeftDelimiter7", null, N_("left }"), null,
- null, on_math_left_delimiter_7 },
- { "MathLeftDelimiter8", null, N_("left >"), null,
- null, on_math_left_delimiter_8 },
- { "MathLeftDelimiter9", null, N_("left ."), null,
- null, on_math_left_delimiter_9 },
+ { "MathLeftDelimiter1", null, N_("left ("), null, null },
+ { "MathLeftDelimiter2", null, N_("left ["), null, null },
+ { "MathLeftDelimiter3", null, N_("left { "), null, null },
+ { "MathLeftDelimiter4", null, N_("left <"), null, null },
+ { "MathLeftDelimiter5", null, N_("left )"), null, null },
+ { "MathLeftDelimiter6", null, N_("left ]"), null, null },
+ { "MathLeftDelimiter7", null, N_("left }"), null, null },
+ { "MathLeftDelimiter8", null, N_("left >"), null, null },
+ { "MathLeftDelimiter9", null, N_("left ."), null, null },
// Math: Right Delimiters
@@ -808,6 +799,26 @@ public class LatexMenu : Gtk.ActionGroup
this, "MathSpaceQuad");
Amtk.utils_bind_g_action_to_gtk_action (main_window, "latex-command-with-space::qquad",
this, "MathSpaceQquad");
+
+ // Math Left Delimiters
+ Amtk.utils_bind_g_action_to_gtk_action (main_window, "math-command-delimiter-left1",
+ this, "MathLeftDelimiter1");
+ Amtk.utils_bind_g_action_to_gtk_action (main_window, "math-command-delimiter-left2",
+ this, "MathLeftDelimiter2");
+ Amtk.utils_bind_g_action_to_gtk_action (main_window, "math-command-delimiter-left3",
+ this, "MathLeftDelimiter3");
+ Amtk.utils_bind_g_action_to_gtk_action (main_window, "math-command-delimiter-left4",
+ this, "MathLeftDelimiter4");
+ Amtk.utils_bind_g_action_to_gtk_action (main_window, "math-command-delimiter-left5",
+ this, "MathLeftDelimiter5");
+ Amtk.utils_bind_g_action_to_gtk_action (main_window, "math-command-delimiter-left6",
+ this, "MathLeftDelimiter6");
+ Amtk.utils_bind_g_action_to_gtk_action (main_window, "math-command-delimiter-left7",
+ this, "MathLeftDelimiter7");
+ Amtk.utils_bind_g_action_to_gtk_action (main_window, "math-command-delimiter-left8",
+ this, "MathLeftDelimiter8");
+ Amtk.utils_bind_g_action_to_gtk_action (main_window, "math-command-delimiter-left9",
+ this, "MathLeftDelimiter9");
}
private Gtk.Action get_menu_tool_action (string name, string? label, string? icon_name)
@@ -828,52 +839,7 @@ public class LatexMenu : Gtk.ActionGroup
text_if_no_selection);
}
- /* Left Delimiters */
-
- public void on_math_left_delimiter_1 ()
- {
- text_buffer_insert ("\\left( ", "");
- }
-
- public void on_math_left_delimiter_2 ()
- {
- text_buffer_insert ("\\left[ ", "");
- }
-
- public void on_math_left_delimiter_3 ()
- {
- text_buffer_insert ("\\left\\lbrace ", "");
- }
-
- public void on_math_left_delimiter_4 ()
- {
- text_buffer_insert ("\\left\\langle ", "");
- }
-
- public void on_math_left_delimiter_5 ()
- {
- text_buffer_insert ("\\left) ", "");
- }
-
- public void on_math_left_delimiter_6 ()
- {
- text_buffer_insert ("\\left] ", "");
- }
-
- public void on_math_left_delimiter_7 ()
- {
- text_buffer_insert ("\\left\\rbrace ", "");
- }
-
- public void on_math_left_delimiter_8 ()
- {
- text_buffer_insert ("\\left\\rangle ", "");
- }
-
- public void on_math_left_delimiter_9 ()
- {
- text_buffer_insert ("\\left. ", "");
- }
+ /* Right Delimiters */
public void on_math_right_delimiter_1 ()
{
diff --git a/src/liblatexila/latexila-latex-commands.c b/src/liblatexila/latexila-latex-commands.c
index 4b3d19e..ba58a2c 100644
--- a/src/liblatexila/latexila-latex-commands.c
+++ b/src/liblatexila/latexila-latex-commands.c
@@ -730,6 +730,96 @@ math_command_spaces_large_cb (GSimpleAction *action,
latexila_latex_commands_insert_text (tepl_window, "\\; ", "", NULL);
}
+static void
+math_command_delimiter_left1_cb (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
+{
+ TeplApplicationWindow *tepl_window = TEPL_APPLICATION_WINDOW (user_data);
+
+ latexila_latex_commands_insert_text (tepl_window, "\\left( ", "", NULL);
+}
+
+static void
+math_command_delimiter_left2_cb (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
+{
+ TeplApplicationWindow *tepl_window = TEPL_APPLICATION_WINDOW (user_data);
+
+ latexila_latex_commands_insert_text (tepl_window, "\\left[ ", "", NULL);
+}
+
+static void
+math_command_delimiter_left3_cb (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
+{
+ TeplApplicationWindow *tepl_window = TEPL_APPLICATION_WINDOW (user_data);
+
+ latexila_latex_commands_insert_text (tepl_window, "\\left\\lbrace ", "", NULL);
+}
+
+static void
+math_command_delimiter_left4_cb (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
+{
+ TeplApplicationWindow *tepl_window = TEPL_APPLICATION_WINDOW (user_data);
+
+ latexila_latex_commands_insert_text (tepl_window, "\\left\\langle ", "", NULL);
+}
+
+static void
+math_command_delimiter_left5_cb (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
+{
+ TeplApplicationWindow *tepl_window = TEPL_APPLICATION_WINDOW (user_data);
+
+ latexila_latex_commands_insert_text (tepl_window, "\\left) ", "", NULL);
+}
+
+static void
+math_command_delimiter_left6_cb (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
+{
+ TeplApplicationWindow *tepl_window = TEPL_APPLICATION_WINDOW (user_data);
+
+ latexila_latex_commands_insert_text (tepl_window, "\\left] ", "", NULL);
+}
+
+static void
+math_command_delimiter_left7_cb (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
+{
+ TeplApplicationWindow *tepl_window = TEPL_APPLICATION_WINDOW (user_data);
+
+ latexila_latex_commands_insert_text (tepl_window, "\\left\\rbrace ", "", NULL);
+}
+
+static void
+math_command_delimiter_left8_cb (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
+{
+ TeplApplicationWindow *tepl_window = TEPL_APPLICATION_WINDOW (user_data);
+
+ latexila_latex_commands_insert_text (tepl_window, "\\left\\rangle ", "", NULL);
+}
+
+static void
+math_command_delimiter_left9_cb (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
+{
+ TeplApplicationWindow *tepl_window = TEPL_APPLICATION_WINDOW (user_data);
+
+ latexila_latex_commands_insert_text (tepl_window, "\\left. ", "", NULL);
+}
+
/**
* latexila_latex_commands_add_actions:
* @gtk_window: a #GtkApplicationWindow.
@@ -772,6 +862,15 @@ latexila_latex_commands_add_actions (GtkApplicationWindow *gtk_window)
{ "math-command-spaces-small", math_command_spaces_small_cb },
{ "math-command-spaces-medium", math_command_spaces_medium_cb },
{ "math-command-spaces-large", math_command_spaces_large_cb },
+ { "math-command-delimiter-left1", math_command_delimiter_left1_cb },
+ { "math-command-delimiter-left2", math_command_delimiter_left2_cb },
+ { "math-command-delimiter-left3", math_command_delimiter_left3_cb },
+ { "math-command-delimiter-left4", math_command_delimiter_left4_cb },
+ { "math-command-delimiter-left5", math_command_delimiter_left5_cb },
+ { "math-command-delimiter-left6", math_command_delimiter_left6_cb },
+ { "math-command-delimiter-left7", math_command_delimiter_left7_cb },
+ { "math-command-delimiter-left8", math_command_delimiter_left8_cb },
+ { "math-command-delimiter-left9", math_command_delimiter_left9_cb },
};
g_return_if_fail (GTK_IS_APPLICATION_WINDOW (gtk_window));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]