[gnome-latex] LaTeX commands: port Math right 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 right delimiter commands to GAction
- Date: Tue, 27 Feb 2018 09:47:12 +0000 (UTC)
commit cc08744f87de58d3785d9b0c75e8c9a9db676453
Author: Robert Griesel <r griesel gmail com>
Date: Mon Feb 26 21:38:47 2018 +0100
LaTeX commands: port Math right delimiter commands to GAction
Remove private function "text_buffer_insert()", since it's no longer
needed.
src/latex_menu.vala | 104 +++++++++---------------------
src/liblatexila/latexila-latex-commands.c | 99 ++++++++++++++++++++++++++++
2 files changed, 128 insertions(+), 75 deletions(-)
---
diff --git a/src/latex_menu.vala b/src/latex_menu.vala
index c449328..18eb306 100644
--- a/src/latex_menu.vala
+++ b/src/latex_menu.vala
@@ -377,24 +377,15 @@ public class LatexMenu : Gtk.ActionGroup
// Math: Right Delimiters
{ "MathRightDelimiters", "delimiters-right", N_("Right _Delimiters") },
- { "MathRightDelimiter1", null, N_("right )"), null,
- null, on_math_right_delimiter_1 },
- { "MathRightDelimiter2", null, N_("right ]"), null,
- null, on_math_right_delimiter_2 },
- { "MathRightDelimiter3", null, N_("right }"), null,
- null, on_math_right_delimiter_3 },
- { "MathRightDelimiter4", null, N_("right >"), null,
- null, on_math_right_delimiter_4 },
- { "MathRightDelimiter5", null, N_("right ("), null,
- null, on_math_right_delimiter_5 },
- { "MathRightDelimiter6", null, N_("right ["), null,
- null, on_math_right_delimiter_6 },
- { "MathRightDelimiter7", null, N_("right { "), null,
- null, on_math_right_delimiter_7 },
- { "MathRightDelimiter8", null, N_("right <"), null,
- null, on_math_right_delimiter_8 },
- { "MathRightDelimiter9", null, N_("right ."), null,
- null, on_math_right_delimiter_9 }
+ { "MathRightDelimiter1", null, N_("right )"), null, null },
+ { "MathRightDelimiter2", null, N_("right ]"), null, null },
+ { "MathRightDelimiter3", null, N_("right }"), null, null },
+ { "MathRightDelimiter4", null, N_("right >"), null, null },
+ { "MathRightDelimiter5", null, N_("right ("), null, null },
+ { "MathRightDelimiter6", null, N_("right ["), null, null },
+ { "MathRightDelimiter7", null, N_("right { "), null, null },
+ { "MathRightDelimiter8", null, N_("right <"), null, null },
+ { "MathRightDelimiter9", null, N_("right ."), null, null }
};
private unowned MainWindow main_window;
@@ -819,6 +810,26 @@ public class LatexMenu : Gtk.ActionGroup
this, "MathLeftDelimiter8");
Amtk.utils_bind_g_action_to_gtk_action (main_window, "math-command-delimiter-left9",
this, "MathLeftDelimiter9");
+
+ // Math Right Delimiters
+ Amtk.utils_bind_g_action_to_gtk_action (main_window, "math-command-delimiter-right1",
+ this, "MathRightDelimiter1");
+ Amtk.utils_bind_g_action_to_gtk_action (main_window, "math-command-delimiter-right2",
+ this, "MathRightDelimiter2");
+ Amtk.utils_bind_g_action_to_gtk_action (main_window, "math-command-delimiter-right3",
+ this, "MathRightDelimiter3");
+ Amtk.utils_bind_g_action_to_gtk_action (main_window, "math-command-delimiter-right4",
+ this, "MathRightDelimiter4");
+ Amtk.utils_bind_g_action_to_gtk_action (main_window, "math-command-delimiter-right5",
+ this, "MathRightDelimiter5");
+ Amtk.utils_bind_g_action_to_gtk_action (main_window, "math-command-delimiter-right6",
+ this, "MathRightDelimiter6");
+ Amtk.utils_bind_g_action_to_gtk_action (main_window, "math-command-delimiter-right7",
+ this, "MathRightDelimiter7");
+ Amtk.utils_bind_g_action_to_gtk_action (main_window, "math-command-delimiter-right8",
+ this, "MathRightDelimiter8");
+ Amtk.utils_bind_g_action_to_gtk_action (main_window, "math-command-delimiter-right9",
+ this, "MathRightDelimiter9");
}
private Gtk.Action get_menu_tool_action (string name, string? label, string? icon_name)
@@ -828,61 +839,4 @@ public class LatexMenu : Gtk.ActionGroup
menu_tool_button.set_related_action (action);
return action;
}
-
- private void text_buffer_insert (string text_before, string text_after,
- string? text_if_no_selection = null)
- {
- Tepl.ApplicationWindow tepl_window =
- Tepl.ApplicationWindow.get_from_gtk_application_window (main_window);
-
- Latexila.latex_commands_insert_text (tepl_window, text_before, text_after,
- text_if_no_selection);
- }
-
- /* Right Delimiters */
-
- public void on_math_right_delimiter_1 ()
- {
- text_buffer_insert ("\\right) ", "");
- }
-
- public void on_math_right_delimiter_2 ()
- {
- text_buffer_insert ("\\right] ", "");
- }
-
- public void on_math_right_delimiter_3 ()
- {
- text_buffer_insert ("\\right\\rbrace ", "");
- }
-
- public void on_math_right_delimiter_4 ()
- {
- text_buffer_insert ("\\right\\rangle ", "");
- }
-
- public void on_math_right_delimiter_5 ()
- {
- text_buffer_insert ("\\right( ", "");
- }
-
- public void on_math_right_delimiter_6 ()
- {
- text_buffer_insert ("\\right[ ", "");
- }
-
- public void on_math_right_delimiter_7 ()
- {
- text_buffer_insert ("\\right\\lbrace ", "");
- }
-
- public void on_math_right_delimiter_8 ()
- {
- text_buffer_insert ("\\right\\langle ", "");
- }
-
- public void on_math_right_delimiter_9 ()
- {
- text_buffer_insert ("\\right. ", "");
- }
}
diff --git a/src/liblatexila/latexila-latex-commands.c b/src/liblatexila/latexila-latex-commands.c
index ba58a2c..540a0ee 100644
--- a/src/liblatexila/latexila-latex-commands.c
+++ b/src/liblatexila/latexila-latex-commands.c
@@ -820,6 +820,96 @@ math_command_delimiter_left9_cb (GSimpleAction *action,
latexila_latex_commands_insert_text (tepl_window, "\\left. ", "", NULL);
}
+static void
+math_command_delimiter_right1_cb (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
+{
+ TeplApplicationWindow *tepl_window = TEPL_APPLICATION_WINDOW (user_data);
+
+ latexila_latex_commands_insert_text (tepl_window, "\\right) ", "", NULL);
+}
+
+static void
+math_command_delimiter_right2_cb (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
+{
+ TeplApplicationWindow *tepl_window = TEPL_APPLICATION_WINDOW (user_data);
+
+ latexila_latex_commands_insert_text (tepl_window, "\\right] ", "", NULL);
+}
+
+static void
+math_command_delimiter_right3_cb (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
+{
+ TeplApplicationWindow *tepl_window = TEPL_APPLICATION_WINDOW (user_data);
+
+ latexila_latex_commands_insert_text (tepl_window, "\\right\\rbrace ", "", NULL);
+}
+
+static void
+math_command_delimiter_right4_cb (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
+{
+ TeplApplicationWindow *tepl_window = TEPL_APPLICATION_WINDOW (user_data);
+
+ latexila_latex_commands_insert_text (tepl_window, "\\right\\rangle ", "", NULL);
+}
+
+static void
+math_command_delimiter_right5_cb (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
+{
+ TeplApplicationWindow *tepl_window = TEPL_APPLICATION_WINDOW (user_data);
+
+ latexila_latex_commands_insert_text (tepl_window, "\\right( ", "", NULL);
+}
+
+static void
+math_command_delimiter_right6_cb (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
+{
+ TeplApplicationWindow *tepl_window = TEPL_APPLICATION_WINDOW (user_data);
+
+ latexila_latex_commands_insert_text (tepl_window, "\\right[ ", "", NULL);
+}
+
+static void
+math_command_delimiter_right7_cb (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
+{
+ TeplApplicationWindow *tepl_window = TEPL_APPLICATION_WINDOW (user_data);
+
+ latexila_latex_commands_insert_text (tepl_window, "\\right\\lbrace ", "", NULL);
+}
+
+static void
+math_command_delimiter_right8_cb (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
+{
+ TeplApplicationWindow *tepl_window = TEPL_APPLICATION_WINDOW (user_data);
+
+ latexila_latex_commands_insert_text (tepl_window, "\\right\\langle ", "", NULL);
+}
+
+static void
+math_command_delimiter_right9_cb (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
+{
+ TeplApplicationWindow *tepl_window = TEPL_APPLICATION_WINDOW (user_data);
+
+ latexila_latex_commands_insert_text (tepl_window, "\\right. ", "", NULL);
+}
+
/**
* latexila_latex_commands_add_actions:
* @gtk_window: a #GtkApplicationWindow.
@@ -871,6 +961,15 @@ latexila_latex_commands_add_actions (GtkApplicationWindow *gtk_window)
{ "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 },
+ { "math-command-delimiter-right1", math_command_delimiter_right1_cb },
+ { "math-command-delimiter-right2", math_command_delimiter_right2_cb },
+ { "math-command-delimiter-right3", math_command_delimiter_right3_cb },
+ { "math-command-delimiter-right4", math_command_delimiter_right4_cb },
+ { "math-command-delimiter-right5", math_command_delimiter_right5_cb },
+ { "math-command-delimiter-right6", math_command_delimiter_right6_cb },
+ { "math-command-delimiter-right7", math_command_delimiter_right7_cb },
+ { "math-command-delimiter-right8", math_command_delimiter_right8_cb },
+ { "math-command-delimiter-right9", math_command_delimiter_right9_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]