Commit 0def359b authored by cvfsammmm's avatar cvfsammmm

LaTeX commands: port Math spaces commands to GAction

parent 558be81d
......@@ -355,14 +355,11 @@ public class LatexMenu : Gtk.ActionGroup
// Math Spaces
{ "MathSpaces", null, N_("Math _Spaces") },
{ "MathSpaceSmall", null, N_("_Small"), null,
N_("Small - \\,"), on_math_space_small },
{ "MathSpaceMedium", null, N_("_Medium"), null,
N_("Medium - \\:"), on_math_space_medium },
{ "MathSpaceLarge", null, N_("_Large"), null,
N_("Large - \\;"), on_math_space_large },
{ "MathSpaceQuad", null, "\\_quad", null, null, on_math_space_quad },
{ "MathSpaceQquad", null, "\\qqu_ad", null, null, on_math_space_qquad },
{ "MathSpaceSmall", null, N_("_Small"), null, N_("Small - \\,") },
{ "MathSpaceMedium", null, N_("_Medium"), null, N_("Medium - \\:") },
{ "MathSpaceLarge", null, N_("_Large"), null, N_("Large - \\;") },
{ "MathSpaceQuad", null, "\\_quad", null, null },
{ "MathSpaceQquad", null, "\\qqu_ad", null, null },
// Math: Left Delimiters
......@@ -799,6 +796,18 @@ public class LatexMenu : Gtk.ActionGroup
this, "MathAccentDdot");
Amtk.utils_bind_g_action_to_gtk_action (main_window, "latex-command-with-braces::mathring",
this, "MathAccentRing");
// Math Spaces
Amtk.utils_bind_g_action_to_gtk_action (main_window, "math-command-spaces-small",
this, "MathSpaceSmall");
Amtk.utils_bind_g_action_to_gtk_action (main_window, "math-command-spaces-medium",
this, "MathSpaceMedium");
Amtk.utils_bind_g_action_to_gtk_action (main_window, "math-command-spaces-large",
this, "MathSpaceLarge");
Amtk.utils_bind_g_action_to_gtk_action (main_window, "latex-command-with-space::quad",
this, "MathSpaceQuad");
Amtk.utils_bind_g_action_to_gtk_action (main_window, "latex-command-with-space::qquad",
this, "MathSpaceQquad");
}
private Gtk.Action get_menu_tool_action (string name, string? label, string? icon_name)
......@@ -819,33 +828,6 @@ public class LatexMenu : Gtk.ActionGroup
text_if_no_selection);
}
/* Math Spaces */
public void on_math_space_small ()
{
text_buffer_insert ("\\, ", "");
}
public void on_math_space_medium ()
{
text_buffer_insert ("\\: ", "");
}
public void on_math_space_large ()
{
text_buffer_insert ("\\; ", "");
}
public void on_math_space_quad ()
{
text_buffer_insert ("\\quad ", "");
}
public void on_math_space_qquad ()
{
text_buffer_insert ("\\qquad ", "");
}
/* Left Delimiters */
public void on_math_left_delimiter_1 ()
......
......@@ -700,6 +700,36 @@ math_command_misc_nth_root_cb (GSimpleAction *action,
latexila_latex_commands_insert_text (tepl_window, "\\sqrt[]{", "}", NULL);
}
static void
math_command_spaces_small_cb (GSimpleAction *action,
GVariant *parameter,
gpointer user_data)
{
TeplApplicationWindow *tepl_window = TEPL_APPLICATION_WINDOW (user_data);
latexila_latex_commands_insert_text (tepl_window, "\\, ", "", NULL);
}
static void
math_command_spaces_medium_cb (GSimpleAction *action,
GVariant *parameter,
gpointer user_data)
{
TeplApplicationWindow *tepl_window = TEPL_APPLICATION_WINDOW (user_data);
latexila_latex_commands_insert_text (tepl_window, "\\: ", "", NULL);
}
static void
math_command_spaces_large_cb (GSimpleAction *action,
GVariant *parameter,
gpointer user_data)
{
TeplApplicationWindow *tepl_window = TEPL_APPLICATION_WINDOW (user_data);
latexila_latex_commands_insert_text (tepl_window, "\\; ", "", NULL);
}
/**
* latexila_latex_commands_add_actions:
* @gtk_window: a #GtkApplicationWindow.
......@@ -739,6 +769,9 @@ latexila_latex_commands_add_actions (GtkApplicationWindow *gtk_window)
{ "math-command-misc-subscript", math_command_misc_subscript_cb },
{ "math-command-misc-frac", math_command_misc_frac_cb },
{ "math-command-misc-nth-root", math_command_misc_nth_root_cb },
{ "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 },
};
g_return_if_fail (GTK_IS_APPLICATION_WINDOW (gtk_window));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment