1 /*
2  *      latexkeybindings.c
3  *
4  *      Copyright 2009-2012 Frank Lanitz <frank(at)frank(dot)uvena(dot)de>
5  *
6  *      This program is free software; you can redistribute it and/or modify
7  *      it under the terms of the GNU General Public License as published by
8  *      the Free Software Foundation; either version 2 of the License, or
9  *      (at your option) any later version.
10  *
11  *      This program is distributed in the hope that it will be useful,
12  *      but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  *      GNU General Public License for more details.
15  *
16  *      You should have received a copy of the GNU General Public License
17  *      along with this program; if not, write to the Free Software
18  *      Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19  *      MA 02110-1301, USA.
20  */
21 
22 #include "latexkeybindings.h"
23 
glatex_kblabel_insert(G_GNUC_UNUSED guint key_id)24 void glatex_kblabel_insert(G_GNUC_UNUSED guint key_id)
25 {
26 	g_return_if_fail(document_get_current() != NULL);
27 	glatex_insert_label_activated(NULL, NULL);
28 }
29 
30 
glatex_kbref_insert(G_GNUC_UNUSED guint key_id)31 void glatex_kbref_insert(G_GNUC_UNUSED guint key_id)
32 {
33 	g_return_if_fail(document_get_current() != NULL);
34 	glatex_insert_ref_activated(NULL, NULL);
35 }
36 
37 
glatex_kbref_insert_environment(G_GNUC_UNUSED guint key_id)38 void glatex_kbref_insert_environment(G_GNUC_UNUSED guint key_id)
39 {
40 	g_return_if_fail(document_get_current() != NULL);
41 	glatex_insert_environment_dialog(NULL, NULL);
42 }
43 
44 
glatex_kbwizard(G_GNUC_UNUSED guint key_id)45 void glatex_kbwizard(G_GNUC_UNUSED guint key_id)
46 {
47 	glatex_wizard_activated(NULL, NULL);
48 }
49 
50 
glatex_kb_insert_newline(G_GNUC_UNUSED guint key_id)51 void glatex_kb_insert_newline(G_GNUC_UNUSED guint key_id)
52 {
53 	g_return_if_fail(document_get_current() != NULL);
54 	glatex_insert_string("\\\\\n", TRUE);
55 }
56 
57 
glatex_kb_insert_newitem(G_GNUC_UNUSED guint key_id)58 void glatex_kb_insert_newitem(G_GNUC_UNUSED guint key_id)
59 {
60 	g_return_if_fail(document_get_current() != NULL);
61 	glatex_insert_string("\\item ", TRUE);
62 }
63 
64 
glatex_kb_replace_special_chars(G_GNUC_UNUSED guint key_id)65 void glatex_kb_replace_special_chars(G_GNUC_UNUSED guint key_id)
66 {
67 	g_return_if_fail(document_get_current() != NULL);
68 	glatex_replace_special_character();
69 }
70 
71 
glatex_kb_format_bold(G_GNUC_UNUSED guint key_id)72 void glatex_kb_format_bold(G_GNUC_UNUSED guint key_id)
73 {
74 	g_return_if_fail(document_get_current() != NULL);
75 	glatex_insert_latex_format(NULL, GINT_TO_POINTER(LATEX_BOLD));
76 }
77 
78 
glatex_kb_format_italic(G_GNUC_UNUSED guint key_id)79 void glatex_kb_format_italic(G_GNUC_UNUSED guint key_id)
80 {
81 	g_return_if_fail(document_get_current() != NULL);
82 	glatex_insert_latex_format(NULL, GINT_TO_POINTER(LATEX_ITALIC));
83 }
84 
85 
glatex_kb_format_typewriter(G_GNUC_UNUSED guint key_id)86 void glatex_kb_format_typewriter(G_GNUC_UNUSED guint key_id)
87 {
88 	g_return_if_fail(document_get_current() != NULL);
89 	glatex_insert_latex_format(NULL, GINT_TO_POINTER(LATEX_TYPEWRITER));
90 }
91 
92 
glatex_kb_format_centering(G_GNUC_UNUSED guint key_id)93 void glatex_kb_format_centering(G_GNUC_UNUSED guint key_id)
94 {
95 	g_return_if_fail(document_get_current() != NULL);
96 	glatex_insert_latex_format(NULL, GINT_TO_POINTER(LATEX_CENTER));
97 }
98 
99 
glatex_kb_format_left(G_GNUC_UNUSED guint key_id)100 void glatex_kb_format_left(G_GNUC_UNUSED guint key_id)
101 {
102 	g_return_if_fail(document_get_current() != NULL);
103 	glatex_insert_latex_format(NULL, GINT_TO_POINTER(LATEX_LEFT));
104 }
105 
106 
glatex_kb_format_right(G_GNUC_UNUSED guint key_id)107 void glatex_kb_format_right(G_GNUC_UNUSED guint key_id)
108 {
109 	g_return_if_fail(document_get_current() != NULL);
110 	glatex_insert_latex_format(NULL, GINT_TO_POINTER(LATEX_RIGHT));
111 }
112 
113 
glatex_kb_insert_description_list(G_GNUC_UNUSED guint key_id)114 void glatex_kb_insert_description_list(G_GNUC_UNUSED guint key_id)
115 {
116 	g_return_if_fail(document_get_current() != NULL);
117 	glatex_insert_list_environment(GLATEX_LIST_DESCRIPTION);
118 }
119 
120 
glatex_kb_insert_itemize_list(G_GNUC_UNUSED guint key_id)121 void glatex_kb_insert_itemize_list(G_GNUC_UNUSED guint key_id)
122 {
123 	g_return_if_fail(document_get_current() != NULL);
124 	glatex_insert_list_environment(GLATEX_LIST_ITEMIZE);
125 }
126 
127 
glatex_kb_insert_enumerate_list(G_GNUC_UNUSED guint key_id)128 void glatex_kb_insert_enumerate_list(G_GNUC_UNUSED guint key_id)
129 {
130 	g_return_if_fail(document_get_current() != NULL);
131 	glatex_insert_list_environment(GLATEX_LIST_ENUMERATE);
132 }
133 
134 
glatex_kb_structure_lvlup(G_GNUC_UNUSED guint key_id)135 void glatex_kb_structure_lvlup(G_GNUC_UNUSED guint key_id)
136 {
137 	g_return_if_fail(document_get_current() != NULL);
138 	glatex_structure_lvlup();
139 }
140 
141 
glatex_kb_structure_lvldown(G_GNUC_UNUSED guint key_id)142 void glatex_kb_structure_lvldown(G_GNUC_UNUSED guint key_id)
143 {
144 	g_return_if_fail(document_get_current() != NULL);
145 	glatex_structure_lvldown();
146 }
147 
148 
glatex_kb_usepackage_dialog(G_GNUC_UNUSED guint key_id)149 void glatex_kb_usepackage_dialog(G_GNUC_UNUSED guint key_id)
150 {
151 	g_return_if_fail(document_get_current() != NULL);
152 	glatex_insert_usepackage_dialog(NULL, NULL);
153 }
154 
glatex_kb_insert_command_dialog(G_GNUC_UNUSED guint key_id)155 void glatex_kb_insert_command_dialog(G_GNUC_UNUSED guint key_id)
156 {
157 	g_return_if_fail(document_get_current() != NULL);
158 	glatex_insert_command_activated(NULL, NULL);
159 }
160 
glatex_kb_insert_bibtex_cite(G_GNUC_UNUSED guint key_id)161 void glatex_kb_insert_bibtex_cite(G_GNUC_UNUSED guint key_id)
162 {
163 	g_return_if_fail(document_get_current() != NULL);
164 	on_insert_bibtex_dialog_activate(NULL, NULL);
165 }
166 
167 
glatex_kb_toggle_underscore_autobraces(G_GNUC_UNUSED guint key_id)168 void glatex_kb_toggle_underscore_autobraces(G_GNUC_UNUSED guint key_id)
169 {
170 	if (glatex_autobraces_active == TRUE)
171 	{
172 		glatex_autobraces_active = FALSE;
173 	}
174 	else
175 	{
176 		glatex_autobraces_active = TRUE;
177 	}
178 }
179