[gnome-latex] LaTeX commands: create the Math menu with Amtk
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-latex] LaTeX commands: create the Math menu with Amtk
- Date: Wed, 29 Apr 2020 00:07:11 +0000 (UTC)
commit 5acf4e56dce06d8617c687dcc0a894980afcbcce
Author: Sébastien Wilmet <swilmet gnome org>
Date: Wed Apr 29 01:12:05 2020 +0200
LaTeX commands: create the Math menu with Amtk
docs/reference/gnome-latex-sections.txt | 1 +
po/POTFILES.in | 1 -
po/POTFILES.skip | 1 -
src/Makefile.am | 1 -
src/latex_menu.vala | 237 --------------------------
src/liblatexila/latexila-latex-commands.c | 267 +++++++++++++++++++-----------
src/liblatexila/latexila-latex-commands.h | 2 +
src/main_window.vala | 19 ++-
src/ui/ui.xml | 112 +------------
9 files changed, 186 insertions(+), 455 deletions(-)
---
diff --git a/docs/reference/gnome-latex-sections.txt b/docs/reference/gnome-latex-sections.txt
index 50f5c4e..c88167e 100644
--- a/docs/reference/gnome-latex-sections.txt
+++ b/docs/reference/gnome-latex-sections.txt
@@ -178,6 +178,7 @@ latexila_latex_commands_add_action_infos
latexila_latex_commands_add_actions
latexila_latex_commands_create_edit_toolbar
latexila_latex_commands_create_latex_menu
+latexila_latex_commands_create_math_menu
</SECTION>
<SECTION>
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 336aecd..59d4774 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -21,7 +21,6 @@ src/document_view.vala
src/encodings.vala
src/file_browser.vala
src/glatex_app.vala
-src/latex_menu.vala
src/liblatexila/dh-dconf-migration.c
src/liblatexila/latexila-app.c
src/liblatexila/latexila-buffer.c
diff --git a/po/POTFILES.skip b/po/POTFILES.skip
index 45dc23b..403d5cf 100644
--- a/po/POTFILES.skip
+++ b/po/POTFILES.skip
@@ -16,7 +16,6 @@ src/document_view.c
src/encodings.c
src/file_browser.c
src/glatex_app.c
-src/latex_menu.c
src/main.c
src/main_window_build_tools.c
src/main_window.c
diff --git a/src/Makefile.am b/src/Makefile.am
index c9dcf4b..636ca25 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -38,7 +38,6 @@ vala_files = \
factory.vala \
file_browser.vala \
glatex_app.vala \
- latex_menu.vala \
main.vala \
main_window_build_tools.vala \
main_window_documents.vala \
diff --git a/src/liblatexila/latexila-latex-commands.c b/src/liblatexila/latexila-latex-commands.c
index 6d63944..f8dd582 100644
--- a/src/liblatexila/latexila-latex-commands.c
+++ b/src/liblatexila/latexila-latex-commands.c
@@ -152,6 +152,116 @@ static const AmtkActionInfoEntry action_info_entries_math_environments[] = {
{ NULL }
};
+/* Math functions */
+static const AmtkActionInfoEntry action_info_entries_math_functions[] = {
+ { "win.latex-command-with-space::arccos", NULL, "\\arccos", NULL, NULL },
+ { "win.latex-command-with-space::arcsin", NULL, "\\arcsin", NULL, NULL },
+ { "win.latex-command-with-space::arctan", NULL, "\\arctan", NULL, NULL },
+ { "win.latex-command-with-space::cos", NULL, "\\cos", NULL, NULL },
+ { "win.latex-command-with-space::cosh", NULL, "\\cosh", NULL, NULL },
+ { "win.latex-command-with-space::cot", NULL, "\\cot", NULL, NULL },
+ { "win.latex-command-with-space::coth", NULL, "\\coth", NULL, NULL },
+ { "win.latex-command-with-space::csc", NULL, "\\csc", NULL, NULL },
+ { "win.latex-command-with-space::deg", NULL, "\\deg", NULL, NULL },
+ { "win.latex-command-with-space::det", NULL, "\\det", NULL, NULL },
+ { "win.latex-command-with-space::dim", NULL, "\\dim", NULL, NULL },
+ { "win.latex-command-with-space::exp", NULL, "\\exp", NULL, NULL },
+ { "win.latex-command-with-space::gcd", NULL, "\\gcd", NULL, NULL },
+ { "win.latex-command-with-space::hom", NULL, "\\hom", NULL, NULL },
+ { "win.latex-command-with-space::inf", NULL, "\\inf", NULL, NULL },
+ { "win.latex-command-with-space::ker", NULL, "\\ker", NULL, NULL },
+ { "win.latex-command-with-space::lg", NULL, "\\lg", NULL, NULL },
+ { "win.latex-command-with-space::lim", NULL, "\\lim", NULL, NULL },
+ { "win.latex-command-with-space::liminf", NULL, "\\liminf", NULL, NULL },
+ { "win.latex-command-with-space::limsup", NULL, "\\limsup", NULL, NULL },
+ { "win.latex-command-with-space::ln", NULL, "\\ln", NULL, NULL },
+ { "win.latex-command-with-space::log", NULL, "\\log", NULL, NULL },
+ { "win.latex-command-with-space::max", NULL, "\\max", NULL, NULL },
+ { "win.latex-command-with-space::min", NULL, "\\min", NULL, NULL },
+ { "win.latex-command-with-space::sec", NULL, "\\sec", NULL, NULL },
+ { "win.latex-command-with-space::sin", NULL, "\\sin", NULL, NULL },
+ { "win.latex-command-with-space::sinh", NULL, "\\sinh", NULL, NULL },
+ { "win.latex-command-with-space::sup", NULL, "\\sup", NULL, NULL },
+ { "win.latex-command-with-space::tan", NULL, "\\tan", NULL, NULL },
+ { "win.latex-command-with-space::tanh", NULL, "\\tanh", NULL, NULL },
+ { NULL }
+};
+
+/* Math Font Styles */
+static const AmtkActionInfoEntry action_info_entries_math_font_styles[] = {
+ { "win.latex-command-with-braces::mathrm", "roman", "\\math_rm", NULL,
+ N_("Roman — \\mathrm") },
+ { "win.latex-command-with-braces::mathit", "italic", "\\math_it", NULL,
+ N_("Italic — \\mathit") },
+ { "win.latex-command-with-braces::mathbf", "bold", "\\math_bf", NULL,
+ N_("Bold — \\mathbf") },
+ { "win.latex-command-with-braces::mathsf", "sans_serif", "\\math_sf", NULL,
+ N_("Sans Serif — \\mathsf") },
+ { "win.latex-command-with-braces::mathtt", "typewriter", "\\math_tt", NULL,
+ N_("Typewriter — \\mathtt") },
+ { "win.latex-command-with-braces::mathcal", "mathcal", "\\math_cal", NULL,
+ N_("Calligraphic — \\mathcal") },
+ { "win.latex-command-with-braces::mathbb", "blackboard", "\\_mathbb", NULL,
+ N_("Blackboard (uppercase only) — \\mathbb (amsfonts package)") },
+ { "win.latex-command-with-braces::mathfrak", "mathfrak", "\\math_frak", NULL,
+ N_("Euler Fraktur — \\mathfrak (amsfonts package)") },
+ { NULL }
+};
+
+/* Math Accents */
+static const AmtkActionInfoEntry action_info_entries_math_accents[] = {
+ { "win.latex-command-with-braces::acute", "mathaccent0", "\\_acute", NULL, NULL },
+ { "win.latex-command-with-braces::grave", "mathaccent1", "\\_grave", NULL, NULL },
+ { "win.latex-command-with-braces::tilde", "mathaccent2", "\\_tilde", NULL, NULL },
+ { "win.latex-command-with-braces::bar", "mathaccent3", "\\_bar", NULL, NULL },
+ { "win.latex-command-with-braces::vec", "mathaccent4", "\\_vec", NULL, NULL },
+ { "win.latex-command-with-braces::hat", "mathaccent5", "\\_hat", NULL, NULL },
+ { "win.latex-command-with-braces::check", "mathaccent6", "\\_check", NULL, NULL },
+ { "win.latex-command-with-braces::breve", "mathaccent7", "\\b_reve", NULL, NULL },
+ { "win.latex-command-with-braces::dot", "mathaccent8", "\\_dot", NULL, NULL },
+ { "win.latex-command-with-braces::ddot", "mathaccent9", "\\dd_ot", NULL, NULL },
+ { "win.latex-command-with-braces::mathring", "mathaccent10", "\\_mathring", NULL, NULL },
+ { NULL }
+};
+
+/* Math Spaces */
+static const AmtkActionInfoEntry action_info_entries_math_spaces[] = {
+ { "win.math-command-spaces-small", NULL, N_("_Small"), NULL, N_("Small — \\,") },
+ { "win.math-command-spaces-medium", NULL, N_("_Medium"), NULL, N_("Medium — \\:") },
+ { "win.math-command-spaces-large", NULL, N_("_Large"), NULL, N_("Large — \\;") },
+ { "win.latex-command-with-space::quad", NULL, "\\_quad", NULL, NULL },
+ { "win.latex-command-with-space::qquad", NULL, "\\qqu_ad", NULL, NULL },
+ { NULL }
+};
+
+/* Math: Left Delimiters */
+static const AmtkActionInfoEntry action_info_entries_math_left_delimiters[] = {
+ { "win.math-command-delimiter-left1", NULL, N_("left ("), NULL, NULL },
+ { "win.math-command-delimiter-left2", NULL, N_("left ["), NULL, NULL },
+ { "win.math-command-delimiter-left3", NULL, N_("left { "), NULL, NULL },
+ { "win.math-command-delimiter-left4", NULL, N_("left <"), NULL, NULL },
+ { "win.math-command-delimiter-left5", NULL, N_("left )"), NULL, NULL },
+ { "win.math-command-delimiter-left6", NULL, N_("left ]"), NULL, NULL },
+ { "win.math-command-delimiter-left7", NULL, N_("left }"), NULL, NULL },
+ { "win.math-command-delimiter-left8", NULL, N_("left >"), NULL, NULL },
+ { "win.math-command-delimiter-left9", NULL, N_("left ."), NULL, NULL },
+ { NULL }
+};
+
+/* Math: Right Delimiters */
+static const AmtkActionInfoEntry action_info_entries_math_right_delimiters[] = {
+ { "win.math-command-delimiter-right1", NULL, N_("right )"), NULL, NULL },
+ { "win.math-command-delimiter-right2", NULL, N_("right ]"), NULL, NULL },
+ { "win.math-command-delimiter-right3", NULL, N_("right }"), NULL, NULL },
+ { "win.math-command-delimiter-right4", NULL, N_("right >"), NULL, NULL },
+ { "win.math-command-delimiter-right5", NULL, N_("right ("), NULL, NULL },
+ { "win.math-command-delimiter-right6", NULL, N_("right ["), NULL, NULL },
+ { "win.math-command-delimiter-right7", NULL, N_("right { "), NULL, NULL },
+ { "win.math-command-delimiter-right8", NULL, N_("right <"), NULL, NULL },
+ { "win.math-command-delimiter-right9", NULL, N_("right ."), NULL, NULL },
+ { NULL }
+};
+
/**
* latexila_latex_commands_add_action_infos:
* @gtk_app: the #GtkApplication instance.
@@ -185,6 +295,14 @@ latexila_latex_commands_add_action_infos (GtkApplication *gtk_app)
{ "no-gaction-latex-accents", NULL, N_("International _Accents") },
{ "no-gaction-latex-misc", NULL, N_("_Misc") },
+ { "no-gaction-math-environments", NULL, N_("_Math Environments") },
+ { "no-gaction-math-functions", NULL, N_("Math _Functions") },
+ { "no-gaction-math-font-styles", NULL, N_("Math Font _Styles") },
+ { "no-gaction-math-accents", NULL, N_("Math _Accents") },
+ { "no-gaction-math-spaces", NULL, N_("Math _Spaces") },
+ { "no-gaction-math-left-delimiters", "delimiters-left", N_("_Left Delimiters") },
+ { "no-gaction-math-right-delimiters", "delimiters-right", N_("Right _Delimiters") },
+
/* LaTeX: Sectioning */
{ "win.latex-command-with-braces::part", NULL, "\\_part", NULL,
@@ -315,104 +433,6 @@ latexila_latex_commands_add_action_infos (GtkApplication *gtk_app)
N_("Square Root — \\sqrt{}") },
{ "win.math-command-misc-nth-root", "math-nth-root", N_("_N-th Root — \\sqrt[]{}"), NULL,
N_("N-th Root — \\sqrt[]{}") },
-
- /* Math functions */
-
- { "win.latex-command-with-space::arccos", NULL, "\\arccos", NULL, NULL },
- { "win.latex-command-with-space::arcsin", NULL, "\\arcsin", NULL, NULL },
- { "win.latex-command-with-space::arctan", NULL, "\\arctan", NULL, NULL },
- { "win.latex-command-with-space::cos", NULL, "\\cos", NULL, NULL },
- { "win.latex-command-with-space::cosh", NULL, "\\cosh", NULL, NULL },
- { "win.latex-command-with-space::cot", NULL, "\\cot", NULL, NULL },
- { "win.latex-command-with-space::coth", NULL, "\\coth", NULL, NULL },
- { "win.latex-command-with-space::csc", NULL, "\\csc", NULL, NULL },
- { "win.latex-command-with-space::deg", NULL, "\\deg", NULL, NULL },
- { "win.latex-command-with-space::det", NULL, "\\det", NULL, NULL },
- { "win.latex-command-with-space::dim", NULL, "\\dim", NULL, NULL },
- { "win.latex-command-with-space::exp", NULL, "\\exp", NULL, NULL },
- { "win.latex-command-with-space::gcd", NULL, "\\gcd", NULL, NULL },
- { "win.latex-command-with-space::hom", NULL, "\\hom", NULL, NULL },
- { "win.latex-command-with-space::inf", NULL, "\\inf", NULL, NULL },
- { "win.latex-command-with-space::ker", NULL, "\\ker", NULL, NULL },
- { "win.latex-command-with-space::lg", NULL, "\\lg", NULL, NULL },
- { "win.latex-command-with-space::lim", NULL, "\\lim", NULL, NULL },
- { "win.latex-command-with-space::liminf", NULL, "\\liminf", NULL, NULL },
- { "win.latex-command-with-space::limsup", NULL, "\\limsup", NULL, NULL },
- { "win.latex-command-with-space::ln", NULL, "\\ln", NULL, NULL },
- { "win.latex-command-with-space::log", NULL, "\\log", NULL, NULL },
- { "win.latex-command-with-space::max", NULL, "\\max", NULL, NULL },
- { "win.latex-command-with-space::min", NULL, "\\min", NULL, NULL },
- { "win.latex-command-with-space::sec", NULL, "\\sec", NULL, NULL },
- { "win.latex-command-with-space::sin", NULL, "\\sin", NULL, NULL },
- { "win.latex-command-with-space::sinh", NULL, "\\sinh", NULL, NULL },
- { "win.latex-command-with-space::sup", NULL, "\\sup", NULL, NULL },
- { "win.latex-command-with-space::tan", NULL, "\\tan", NULL, NULL },
- { "win.latex-command-with-space::tanh", NULL, "\\tanh", NULL, NULL },
-
- /* Math Font Styles */
-
- { "win.latex-command-with-braces::mathrm", "roman", "\\math_rm", NULL,
- N_("Roman — \\mathrm") },
- { "win.latex-command-with-braces::mathit", "italic", "\\math_it", NULL,
- N_("Italic — \\mathit") },
- { "win.latex-command-with-braces::mathbf", "bold", "\\math_bf", NULL,
- N_("Bold — \\mathbf") },
- { "win.latex-command-with-braces::mathsf", "sans_serif", "\\math_sf", NULL,
- N_("Sans Serif — \\mathsf") },
- { "win.latex-command-with-braces::mathtt", "typewriter", "\\math_tt", NULL,
- N_("Typewriter — \\mathtt") },
- { "win.latex-command-with-braces::mathcal", "mathcal", "\\math_cal", NULL,
- N_("Calligraphic — \\mathcal") },
- { "win.latex-command-with-braces::mathbb", "blackboard", "\\_mathbb", NULL,
- N_("Blackboard (uppercase only) — \\mathbb (amsfonts package)") },
- { "win.latex-command-with-braces::mathfrak", "mathfrak", "\\math_frak", NULL,
- N_("Euler Fraktur — \\mathfrak (amsfonts package)") },
-
- /* Math Accents */
-
- { "win.latex-command-with-braces::acute", "mathaccent0", "\\_acute", NULL, NULL },
- { "win.latex-command-with-braces::grave", "mathaccent1", "\\_grave", NULL, NULL },
- { "win.latex-command-with-braces::tilde", "mathaccent2", "\\_tilde", NULL, NULL },
- { "win.latex-command-with-braces::bar", "mathaccent3", "\\_bar", NULL, NULL },
- { "win.latex-command-with-braces::vec", "mathaccent4", "\\_vec", NULL, NULL },
- { "win.latex-command-with-braces::hat", "mathaccent5", "\\_hat", NULL, NULL },
- { "win.latex-command-with-braces::check", "mathaccent6", "\\_check", NULL, NULL },
- { "win.latex-command-with-braces::breve", "mathaccent7", "\\b_reve", NULL, NULL },
- { "win.latex-command-with-braces::dot", "mathaccent8", "\\_dot", NULL, NULL },
- { "win.latex-command-with-braces::ddot", "mathaccent9", "\\dd_ot", NULL, NULL },
- { "win.latex-command-with-braces::mathring", "mathaccent10", "\\_mathring", NULL, NULL },
-
- /* Math Spaces */
-
- { "win.math-command-spaces-small", NULL, N_("_Small"), NULL, N_("Small — \\,") },
- { "win.math-command-spaces-medium", NULL, N_("_Medium"), NULL, N_("Medium — \\:") },
- { "win.math-command-spaces-large", NULL, N_("_Large"), NULL, N_("Large — \\;") },
- { "win.latex-command-with-space::quad", NULL, "\\_quad", NULL, NULL },
- { "win.latex-command-with-space::qquad", NULL, "\\qqu_ad", NULL, NULL },
-
- /* Math: Left Delimiters */
-
- { "win.math-command-delimiter-left1", NULL, N_("left ("), NULL, NULL },
- { "win.math-command-delimiter-left2", NULL, N_("left ["), NULL, NULL },
- { "win.math-command-delimiter-left3", NULL, N_("left { "), NULL, NULL },
- { "win.math-command-delimiter-left4", NULL, N_("left <"), NULL, NULL },
- { "win.math-command-delimiter-left5", NULL, N_("left )"), NULL, NULL },
- { "win.math-command-delimiter-left6", NULL, N_("left ]"), NULL, NULL },
- { "win.math-command-delimiter-left7", NULL, N_("left }"), NULL, NULL },
- { "win.math-command-delimiter-left8", NULL, N_("left >"), NULL, NULL },
- { "win.math-command-delimiter-left9", NULL, N_("left ."), NULL, NULL },
-
- /* Math: Right Delimiters */
-
- { "win.math-command-delimiter-right1", NULL, N_("right )"), NULL, NULL },
- { "win.math-command-delimiter-right2", NULL, N_("right ]"), NULL, NULL },
- { "win.math-command-delimiter-right3", NULL, N_("right }"), NULL, NULL },
- { "win.math-command-delimiter-right4", NULL, N_("right >"), NULL, NULL },
- { "win.math-command-delimiter-right5", NULL, N_("right ("), NULL, NULL },
- { "win.math-command-delimiter-right6", NULL, N_("right ["), NULL, NULL },
- { "win.math-command-delimiter-right7", NULL, N_("right { "), NULL, NULL },
- { "win.math-command-delimiter-right8", NULL, N_("right <"), NULL, NULL },
- { "win.math-command-delimiter-right9", NULL, N_("right ."), NULL, NULL },
};
g_return_if_fail (GTK_IS_APPLICATION (gtk_app));
@@ -429,6 +449,12 @@ latexila_latex_commands_add_action_infos (GtkApplication *gtk_app)
amtk_action_info_store_add_entries (store, action_info_entries_latex_spacing, -1, GETTEXT_PACKAGE);
amtk_action_info_store_add_entries (store, action_info_entries_latex_accents, -1, GETTEXT_PACKAGE);
amtk_action_info_store_add_entries (store, action_info_entries_math_environments, -1,
GETTEXT_PACKAGE);
+ amtk_action_info_store_add_entries (store, action_info_entries_math_functions, -1, GETTEXT_PACKAGE);
+ amtk_action_info_store_add_entries (store, action_info_entries_math_font_styles, -1, GETTEXT_PACKAGE);
+ amtk_action_info_store_add_entries (store, action_info_entries_math_accents, -1, GETTEXT_PACKAGE);
+ amtk_action_info_store_add_entries (store, action_info_entries_math_spaces, -1, GETTEXT_PACKAGE);
+ amtk_action_info_store_add_entries (store, action_info_entries_math_left_delimiters, -1,
GETTEXT_PACKAGE);
+ amtk_action_info_store_add_entries (store, action_info_entries_math_right_delimiters, -1,
GETTEXT_PACKAGE);
}
/* Util functions */
@@ -1757,3 +1783,48 @@ latexila_latex_commands_create_latex_menu (GtkApplicationWindow *gtk_window)
gtk_widget_show_all (GTK_WIDGET (menu));
return GTK_MENU (menu);
}
+
+/**
+ * latexila_latex_commands_create_math_menu:
+ * @gtk_window: a #GtkApplicationWindow.
+ *
+ * Returns: (transfer floating): a new #GtkMenu with a lot of math LaTeX
+ * commands.
+ */
+GtkMenu *
+latexila_latex_commands_create_math_menu (GtkApplicationWindow *gtk_window)
+{
+ GtkMenuShell *menu;
+ AmtkFactory *factory;
+ AmtkApplicationWindow *amtk_window;
+
+ g_return_val_if_fail (GTK_IS_APPLICATION_WINDOW (gtk_window), NULL);
+
+ menu = GTK_MENU_SHELL (gtk_menu_new ());
+
+ add_menu_item_with_subentries (menu, "no-gaction-math-environments",
action_info_entries_math_environments);
+
+ factory = amtk_factory_new_with_default_application ();
+ gtk_menu_shell_append (menu, gtk_separator_menu_item_new ());
+ gtk_menu_shell_append (menu, amtk_factory_create_menu_item (factory,
"win.math-command-misc-superscript"));
+ gtk_menu_shell_append (menu, amtk_factory_create_menu_item (factory,
"win.math-command-misc-subscript"));
+ gtk_menu_shell_append (menu, gtk_separator_menu_item_new ());
+ gtk_menu_shell_append (menu, amtk_factory_create_menu_item (factory, "win.math-command-misc-frac"));
+ gtk_menu_shell_append (menu, amtk_factory_create_menu_item (factory,
"win.latex-command-with-braces::sqrt"));
+ gtk_menu_shell_append (menu, amtk_factory_create_menu_item (factory,
"win.math-command-misc-nth-root"));
+ gtk_menu_shell_append (menu, gtk_separator_menu_item_new ());
+ g_object_unref (factory);
+
+ add_menu_item_with_subentries (menu, "no-gaction-math-functions", action_info_entries_math_functions);
+ add_menu_item_with_subentries (menu, "no-gaction-math-font-styles",
action_info_entries_math_font_styles);
+ add_menu_item_with_subentries (menu, "no-gaction-math-accents", action_info_entries_math_accents);
+ add_menu_item_with_subentries (menu, "no-gaction-math-spaces", action_info_entries_math_spaces);
+ add_menu_item_with_subentries (menu, "no-gaction-math-left-delimiters",
action_info_entries_math_left_delimiters);
+ add_menu_item_with_subentries (menu, "no-gaction-math-right-delimiters",
action_info_entries_math_right_delimiters);
+
+ amtk_window = amtk_application_window_get_from_gtk_application_window (gtk_window);
+ amtk_application_window_connect_menu_to_statusbar (amtk_window, menu);
+
+ gtk_widget_show_all (GTK_WIDGET (menu));
+ return GTK_MENU (menu);
+}
diff --git a/src/liblatexila/latexila-latex-commands.h b/src/liblatexila/latexila-latex-commands.h
index 4493375..6edc1f2 100644
--- a/src/liblatexila/latexila-latex-commands.h
+++ b/src/liblatexila/latexila-latex-commands.h
@@ -32,6 +32,8 @@ GtkToolbar * latexila_latex_commands_create_edit_toolbar (GtkApplicationWindow *
GtkMenu * latexila_latex_commands_create_latex_menu (GtkApplicationWindow *gtk_window);
+GtkMenu * latexila_latex_commands_create_math_menu (GtkApplicationWindow *gtk_window);
+
G_END_DECLS
#endif /* LATEXILA_LATEX_COMMANDS_H */
diff --git a/src/main_window.vala b/src/main_window.vala
index 8faa33e..93d89b4 100644
--- a/src/main_window.vala
+++ b/src/main_window.vala
@@ -47,6 +47,10 @@ public class MainWindow : ApplicationWindow
N_("Jump to the associated position in the PDF file. Another shortcut: Ctrl+click, which works
in both directions."),
on_search_forward },
+ // LaTeX and Math
+ { "Latex", null, "_LaTeX" },
+ { "Math", null, N_("_Math") },
+
// Projects
{ "Projects", null, N_("_Projects") },
{ "ProjectsNew", "document-new", N_("_New Project"), "",
@@ -90,7 +94,6 @@ public class MainWindow : ApplicationWindow
private UIManager _ui_manager;
private Gtk.ActionGroup _action_group;
- private Gtk.ActionGroup _latex_action_group;
private MainWindowFile _main_window_file;
private MainWindowEdit _main_window_edit;
@@ -153,6 +156,8 @@ public class MainWindow : ApplicationWindow
Tepl.ApplicationWindow tepl_window =
Tepl.ApplicationWindow.get_from_gtk_application_window (this);
+ Latexila.latex_commands_add_actions (this);
+
/* GtkUIManager */
initialize_ui_manager ();
@@ -180,6 +185,9 @@ public class MainWindow : ApplicationWindow
Gtk.MenuItem latex_menu_item =
_ui_manager.get_widget ("/MainMenu/Latex") as Gtk.MenuItem;
latex_menu_item.set_submenu (Latexila.latex_commands_create_latex_menu (this));
+ Gtk.MenuItem math_menu_item =
+ _ui_manager.get_widget ("/MainMenu/Math") as Gtk.MenuItem;
+ math_menu_item.set_submenu (Latexila.latex_commands_create_math_menu (this));
// Allow the menu to shrink below its minimum width
Paned menu_paned = new Paned (Orientation.HORIZONTAL);
@@ -328,11 +336,8 @@ public class MainWindow : ApplicationWindow
Amtk.utils_create_gtk_action (this, "win.tepl-goto-line",
_action_group, "SearchGoToLine");
- _latex_action_group = new LatexMenu (this);
-
_ui_manager = new UIManager ();
_ui_manager.insert_action_group (_action_group, 0);
- _ui_manager.insert_action_group (_latex_action_group, 0);
try
{
@@ -959,7 +964,9 @@ public class MainWindow : ApplicationWindow
"SearchFind",
"SearchReplace",
"SearchForward",
- "ProjectsConfigCurrent"
+ "ProjectsConfigCurrent",
+ "Latex",
+ "Math"
};
foreach (string file_action in file_actions)
@@ -968,8 +975,6 @@ public class MainWindow : ApplicationWindow
action.set_sensitive (sensitive);
}
- _latex_action_group.set_sensitive (sensitive);
-
_main_window_file.update_sensitivity ();
_main_window_edit.update_sensitivity ();
_main_window_build_tools.update_sensitivity ();
diff --git a/src/ui/ui.xml b/src/ui/ui.xml
index 18aab2c..ee6a282 100644
--- a/src/ui/ui.xml
+++ b/src/ui/ui.xml
@@ -90,116 +90,8 @@ along with GNOME LaTeX. If not, see <http://www.gnu.org/licenses/>.
<menuitem action="BuildToolsPreferences" />
</menu>
- <menu action="Latex">
- </menu>
-
- <menu action="Math">
- <menu action="MathEnvironments">
- <menuitem action="MathEnvNormal" />
- <menuitem action="MathEnvCentered" />
- <menuitem action="MathEnvNumbered" />
- <menuitem action="MathEnvArray" />
- <menuitem action="MathEnvNumberedArray" />
- </menu>
-
- <separator />
- <menuitem action="MathSuperscript" />
- <menuitem action="MathSubscript" />
- <separator />
- <menuitem action="MathFrac" />
- <menuitem action="MathSquareRoot" />
- <menuitem action="MathNthRoot" />
- <separator />
-
- <menu action="MathFunctions">
- <menuitem action="MathFuncArccos" />
- <menuitem action="MathFuncArcsin" />
- <menuitem action="MathFuncArctan" />
- <menuitem action="MathFuncCos" />
- <menuitem action="MathFuncCosh" />
- <menuitem action="MathFuncCot" />
- <menuitem action="MathFuncCoth" />
- <menuitem action="MathFuncCsc" />
- <menuitem action="MathFuncDeg" />
- <menuitem action="MathFuncDet" />
- <menuitem action="MathFuncDim" />
- <menuitem action="MathFuncExp" />
- <menuitem action="MathFuncGcd" />
- <menuitem action="MathFuncHom" />
- <menuitem action="MathFuncInf" />
- <menuitem action="MathFuncKer" />
- <menuitem action="MathFuncLg" />
- <menuitem action="MathFuncLim" />
- <menuitem action="MathFuncLiminf" />
- <menuitem action="MathFuncLimsup" />
- <menuitem action="MathFuncLn" />
- <menuitem action="MathFuncLog" />
- <menuitem action="MathFuncMax" />
- <menuitem action="MathFuncMin" />
- <menuitem action="MathFuncSec" />
- <menuitem action="MathFuncSin" />
- <menuitem action="MathFuncSinh" />
- <menuitem action="MathFuncSup" />
- <menuitem action="MathFuncTan" />
- <menuitem action="MathFuncTanh" />
- </menu>
-
- <menu action="MathFontStyles">
- <menuitem action="MathFSrm" />
- <menuitem action="MathFSit" />
- <menuitem action="MathFSbf" />
- <menuitem action="MathFSsf" />
- <menuitem action="MathFStt" />
- <menuitem action="MathFScal" />
- <menuitem action="MathFSbb" />
- <menuitem action="MathFSfrak" />
- </menu>
-
- <menu action="MathAccents">
- <menuitem action="MathAccentAcute" />
- <menuitem action="MathAccentGrave" />
- <menuitem action="MathAccentTilde" />
- <menuitem action="MathAccentBar" />
- <menuitem action="MathAccentVec" />
- <menuitem action="MathAccentHat" />
- <menuitem action="MathAccentCheck" />
- <menuitem action="MathAccentBreve" />
- <menuitem action="MathAccentDot" />
- <menuitem action="MathAccentDdot" />
- <menuitem action="MathAccentRing" />
- </menu>
-
- <menu action="MathSpaces">
- <menuitem action="MathSpaceSmall" />
- <menuitem action="MathSpaceMedium" />
- <menuitem action="MathSpaceLarge" />
- <menuitem action="MathSpaceQuad" />
- <menuitem action="MathSpaceQquad" />
- </menu>
-
- <menu action="MathLeftDelimiters">
- <menuitem action="MathLeftDelimiter1" />
- <menuitem action="MathLeftDelimiter2" />
- <menuitem action="MathLeftDelimiter3" />
- <menuitem action="MathLeftDelimiter4" />
- <menuitem action="MathLeftDelimiter5" />
- <menuitem action="MathLeftDelimiter6" />
- <menuitem action="MathLeftDelimiter7" />
- <menuitem action="MathLeftDelimiter8" />
- <menuitem action="MathLeftDelimiter9" />
- </menu>
- <menu action="MathRightDelimiters">
- <menuitem action="MathRightDelimiter1" />
- <menuitem action="MathRightDelimiter2" />
- <menuitem action="MathRightDelimiter3" />
- <menuitem action="MathRightDelimiter4" />
- <menuitem action="MathRightDelimiter5" />
- <menuitem action="MathRightDelimiter6" />
- <menuitem action="MathRightDelimiter7" />
- <menuitem action="MathRightDelimiter8" />
- <menuitem action="MathRightDelimiter9" />
- </menu>
- </menu>
+ <menu action="Latex"></menu>
+ <menu action="Math"></menu>
<menu action="Documents" name="DocumentsMenu">
<menuitem action="DocumentsSaveAll" />
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]