1 /*
2  * Bluefish HTML Editor
3  * htmlbar_uimanager.c
4  *
5  * Copyright (C) 2005-2012 Olivier Sessink
6  * Copyright (C) 2011-2012 James Hayward
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
20  */
21 /*#define DEBUG*/
22 
23 #include "htmlbar_uimanager.h"
24 #include "../bluefish.h"
25 #include "../bfwin_uimanager.h"
26 #include "../document.h"
27 #include "../stringlist.h"
28 #include "cap.h"
29 #include "html.h"
30 #include "html2.h"
31 #include "htmlbar_stock_icons.h"
32 #include "html_form.h"
33 #include "html_table.h"
34 #include "image.h"
35 #include "image_dialog.h"
36 #include "rpopup.h"
37 #include "quickstart.h"
38 #include "wizards.h"
39 
40 
41 #define HTMLBAR_PIXMAP_DIR PKGDATADIR"/plugins/htmlbar/pixmaps/"
42 #define HTMLBAR_MENU_UI	   PKGDATADIR"/plugins/htmlbar/ui/htmlbar_menu_ui.xml"
43 /*#define HTMLBAR_TOOLBAR_UI PKGDATADIR"/plugins/htmlbar/ui/htmlbar_toolbar_ui.xml"*/ /* menu and toolbar are merged into one file now */
44 
45 #include "pixmaps/htmlbar_icons.c"
46 
47 /* For testing purposes */
48 /*#define HTMLBAR_MENU_UI	"src/plugin_htmlbar/ui/htmlbar_menu_ui.xml"
49 */
50 
51 
52 static void
htmlbar_edit_tag_under_cursor(GtkAction * action,gpointer user_data)53 htmlbar_edit_tag_under_cursor(GtkAction * action, gpointer user_data)
54 {
55 	edit_tag_under_cursor_cb(BFWIN(user_data));
56 }
57 
58 static void
htmlbar_dialog_anchor(GtkAction * action,gpointer user_data)59 htmlbar_dialog_anchor(GtkAction * action, gpointer user_data)
60 {
61 	quickanchor_dialog(BFWIN(user_data), NULL);
62 }
63 
64 static void
htmlbar_dialog_basefont(GtkAction * action,gpointer user_data)65 htmlbar_dialog_basefont(GtkAction * action, gpointer user_data)
66 {
67 	basefont_dialog(BFWIN(user_data), NULL);
68 }
69 
70 static void
htmlbar_dialog_body(GtkAction * action,gpointer user_data)71 htmlbar_dialog_body(GtkAction * action, gpointer user_data)
72 {
73 	body_dialog(BFWIN(user_data), NULL);
74 }
75 
76 static void
htmlbar_dialog_script(GtkAction * action,gpointer user_data)77 htmlbar_dialog_script(GtkAction * action, gpointer user_data)
78 {
79 	script_dialog(BFWIN(user_data), NULL);
80 }
81 
82 static void
htmlbar_dialog_color(GtkAction * action,gpointer user_data)83 htmlbar_dialog_color(GtkAction * action, gpointer user_data)
84 {
85 	sel_colour_cb(NULL, BFWIN(user_data));
86 }
87 
88 static void
htmlbar_dialog_div(GtkAction * action,gpointer user_data)89 htmlbar_dialog_div(GtkAction * action, gpointer user_data)
90 {
91 	div_dialog(BFWIN(user_data), NULL);
92 }
93 
94 static void
htmlbar_dialog_columns(GtkAction * action,gpointer user_data)95 htmlbar_dialog_columns(GtkAction * action, gpointer user_data)
96 {
97 	columns_dialog(BFWIN(user_data), NULL);
98 }
99 
100 static void
htmlbar_dialog_email(GtkAction * action,gpointer user_data)101 htmlbar_dialog_email(GtkAction * action, gpointer user_data)
102 {
103 	email_dialog(BFWIN(user_data), NULL);
104 }
105 
106 static void
htmlbar_dialog_embed(GtkAction * action,gpointer user_data)107 htmlbar_dialog_embed(GtkAction * action, gpointer user_data)
108 {
109 	embed_dialog(BFWIN(user_data), NULL);
110 }
111 
112 static void
htmlbar_dialog_font(GtkAction * action,gpointer user_data)113 htmlbar_dialog_font(GtkAction * action, gpointer user_data)
114 {
115 	font_dialog(BFWIN(user_data), NULL);
116 }
117 
118 static void
htmlbar_dialog_form(GtkAction * action,gpointer user_data)119 htmlbar_dialog_form(GtkAction * action, gpointer user_data)
120 {
121 	formdialog_dialog(BFWIN(user_data), NULL);
122 }
123 
124 static void
htmlbar_dialog_form_button(GtkAction * action,gpointer user_data)125 htmlbar_dialog_form_button(GtkAction * action, gpointer user_data)
126 {
127 	buttondialog_dialog(BFWIN(user_data), NULL);
128 }
129 
130 static void
htmlbar_dialog_form_check_box(GtkAction * action,gpointer user_data)131 htmlbar_dialog_form_check_box(GtkAction * action, gpointer user_data)
132 {
133 	inputdialog_dialog(BFWIN(user_data), NULL, "checkbox");
134 }
135 
136 static void
htmlbar_dialog_form_hidden(GtkAction * action,gpointer user_data)137 htmlbar_dialog_form_hidden(GtkAction * action, gpointer user_data)
138 {
139 	inputdialog_dialog(BFWIN(user_data), NULL, "hidden");
140 }
141 
142 static void
htmlbar_dialog_form_input(GtkAction * action,gpointer user_data)143 htmlbar_dialog_form_input(GtkAction * action, gpointer user_data)
144 {
145 	inputdialog_dialog(BFWIN(user_data), NULL, NULL);
146 }
147 
148 static void
htmlbar_dialog_form_input_buttons(GtkAction * action,gpointer user_data)149 htmlbar_dialog_form_input_buttons(GtkAction * action, gpointer user_data)
150 {
151 	inputdialog_dialog(BFWIN(user_data), NULL, "submit");
152 }
153 
154 static void
htmlbar_dialog_form_input_text(GtkAction * action,gpointer user_data)155 htmlbar_dialog_form_input_text(GtkAction * action, gpointer user_data)
156 {
157 	inputdialog_dialog(BFWIN(user_data), NULL, "text");
158 }
159 
160 static void
htmlbar_dialog_form_option(GtkAction * action,gpointer user_data)161 htmlbar_dialog_form_option(GtkAction * action, gpointer user_data)
162 {
163 	optiondialog_dialog(BFWIN(user_data), NULL);
164 }
165 
166 static void
htmlbar_dialog_form_option_group(GtkAction * action,gpointer user_data)167 htmlbar_dialog_form_option_group(GtkAction * action, gpointer user_data)
168 {
169 	optgroupdialog_dialog(BFWIN(user_data), NULL);
170 }
171 
172 static void
htmlbar_dialog_form_radio_button(GtkAction * action,gpointer user_data)173 htmlbar_dialog_form_radio_button(GtkAction * action, gpointer user_data)
174 {
175 	inputdialog_dialog(BFWIN(user_data), NULL, "radio");
176 }
177 
178 static void
htmlbar_dialog_form_select(GtkAction * action,gpointer user_data)179 htmlbar_dialog_form_select(GtkAction * action, gpointer user_data)
180 {
181 	selectdialog_dialog(BFWIN(user_data), NULL);
182 }
183 
184 static void
htmlbar_dialog_form_textarea(GtkAction * action,gpointer user_data)185 htmlbar_dialog_form_textarea(GtkAction * action, gpointer user_data)
186 {
187 	textareadialog_dialog(BFWIN(user_data), NULL);
188 }
189 
190 static void
htmlbar_dialog_frame(GtkAction * action,gpointer user_data)191 htmlbar_dialog_frame(GtkAction * action, gpointer user_data)
192 {
193 	frame_dialog(BFWIN(user_data), NULL);
194 }
195 
196 static void
htmlbar_dialog_frameset(GtkAction * action,gpointer user_data)197 htmlbar_dialog_frameset(GtkAction * action, gpointer user_data)
198 {
199 	frameset_dialog(BFWIN(user_data), NULL);
200 }
201 
202 static void
htmlbar_dialog_frame_wizard(GtkAction * action,gpointer user_data)203 htmlbar_dialog_frame_wizard(GtkAction * action, gpointer user_data)
204 {
205 	framewizard_dialog(BFWIN(user_data));
206 }
207 
208 static void
htmlbar_dialog_image(GtkAction * action,gpointer user_data)209 htmlbar_dialog_image(GtkAction * action, gpointer user_data)
210 {
211 	bluefish_image_dialog_new(BFWIN(user_data));
212 }
213 
214 static void
htmlbar_dialog_link_header(GtkAction * action,gpointer user_data)215 htmlbar_dialog_link_header(GtkAction * action, gpointer user_data)
216 {
217 	linkdialog_dialog(BFWIN(user_data), NULL, linkdialog_mode_default);
218 }
219 
220 static void
htmlbar_dialog_meta(GtkAction * action,gpointer user_data)221 htmlbar_dialog_meta(GtkAction * action, gpointer user_data)
222 {
223 	meta_dialog(BFWIN(user_data), NULL);
224 }
225 
226 static void
htmlbar_dialog_multi_thumbnail(GtkAction * action,gpointer user_data)227 htmlbar_dialog_multi_thumbnail(GtkAction * action, gpointer user_data)
228 {
229 	multi_thumbnail_dialog(BFWIN(user_data));
230 }
231 
232 static void
htmlbar_dialog_rule(GtkAction * action,gpointer user_data)233 htmlbar_dialog_rule(GtkAction * action, gpointer user_data)
234 {
235 	quickrule_dialog(BFWIN(user_data), NULL);
236 }
237 
238 static void
htmlbar_dialog_span(GtkAction * action,gpointer user_data)239 htmlbar_dialog_span(GtkAction * action, gpointer user_data)
240 {
241 	span_dialog(BFWIN(user_data), NULL);
242 }
243 
244 static void
htmlbar_misc_style(GtkAction * action,gpointer user_data)245 htmlbar_misc_style(GtkAction * action, gpointer user_data)
246 {
247 	gchar *tmp = g_strdup_printf("<%s=\"text/css\"><!--\n", cap("STYLE TYPE"));
248 	doc_insert_two_strings(BFWIN(user_data)->current_document, tmp, cap("\n--></STYLE>"));
249 	g_free(tmp);
250 }
251 
252 static void
htmlbar_dialog_style_create(GtkAction * action,gpointer user_data)253 htmlbar_dialog_style_create(GtkAction * action, gpointer user_data)
254 {
255 	new_css_dialog(NULL, BFWIN(user_data));
256 }
257 
258 static void
htmlbar_dialog_style_link_to(GtkAction * action,gpointer user_data)259 htmlbar_dialog_style_link_to(GtkAction * action, gpointer user_data)
260 {
261 	linkdialog_dialog(BFWIN(user_data), NULL, linkdialog_mode_css);
262 }
263 
264 static void
htmlbar_dialog_table(GtkAction * action,gpointer user_data)265 htmlbar_dialog_table(GtkAction * action, gpointer user_data)
266 {
267 	tabledialog_dialog(BFWIN(user_data), NULL);
268 }
269 
270 static void
htmlbar_dialog_table_data(GtkAction * action,gpointer user_data)271 htmlbar_dialog_table_data(GtkAction * action, gpointer user_data)
272 {
273 	tabledatadialog_dialog(BFWIN(user_data), NULL);
274 }
275 
276 static void
htmlbar_dialog_table_head(GtkAction * action,gpointer user_data)277 htmlbar_dialog_table_head(GtkAction * action, gpointer user_data)
278 {
279 	tableheaddialog_dialog(BFWIN(user_data), NULL);
280 }
281 
282 static void
htmlbar_dialog_table_row(GtkAction * action,gpointer user_data)283 htmlbar_dialog_table_row(GtkAction * action, gpointer user_data)
284 {
285 	tablerowdialog_dialog(BFWIN(user_data), NULL);
286 }
287 
288 static void
htmlbar_dialog_table_wizard(GtkAction * action,gpointer user_data)289 htmlbar_dialog_table_wizard(GtkAction * action, gpointer user_data)
290 {
291 	tablewizard_dialog(BFWIN(user_data));
292 }
293 
294 static void
htmlbar_dialog_thumbnail(GtkAction * action,gpointer user_data)295 htmlbar_dialog_thumbnail(GtkAction * action, gpointer user_data)
296 {
297 	thumbnail_insert_dialog(BFWIN(user_data));
298 }
299 
300 static void
htmlbar_dialog_time(GtkAction * action,gpointer user_data)301 htmlbar_dialog_time(GtkAction * action, gpointer user_data)
302 {
303 	insert_time_dialog(BFWIN(user_data));
304 }
305 
306 static void
htmlbar_dialog_quicklist(GtkAction * action,gpointer user_data)307 htmlbar_dialog_quicklist(GtkAction * action, gpointer user_data)
308 {
309 	quicklist_dialog(BFWIN(user_data), NULL);
310 }
311 
312 static void
htmlbar_dialog_quickstart(GtkAction * action,gpointer user_data)313 htmlbar_dialog_quickstart(GtkAction * action, gpointer user_data)
314 {
315 	quickstart_dialog_new(BFWIN(user_data));
316 }
317 
318 static void
htmlbar_insert_html_comment(GtkAction * action,gpointer user_data)319 htmlbar_insert_html_comment(GtkAction * action, gpointer user_data)
320 {
321 	doc_insert_two_strings(BFWIN(user_data)->current_document, "<!-- ", " -->");
322 }
323 
324 static void
htmlbar_insert_abbr_tag(GtkAction * action,gpointer user_data)325 htmlbar_insert_abbr_tag(GtkAction * action, gpointer user_data)
326 {
327 	doc_insert_two_strings(BFWIN(user_data)->current_document, cap("<ABBR>"), cap("</ABBR>"));
328 }
329 
330 static void
htmlbar_insert_acronym_tag(GtkAction * action,gpointer user_data)331 htmlbar_insert_acronym_tag(GtkAction * action, gpointer user_data)
332 {
333 	doc_insert_two_strings(BFWIN(user_data)->current_document, cap("<ACRONYM>"), cap("</ACRONYM>"));
334 }
335 
336 static void
htmlbar_insert_align_right_tag(GtkAction * action,gpointer user_data)337 htmlbar_insert_align_right_tag(GtkAction * action, gpointer user_data)
338 {
339 	doc_insert_two_strings(BFWIN(user_data)->current_document, cap("<DIV STYLE=\"text-align: right;\">"), cap("</DIV>"));
340 }
341 
342 static void
htmlbar_insert_anchor_tag(GtkAction * action,gpointer user_data)343 htmlbar_insert_anchor_tag(GtkAction * action, gpointer user_data)
344 {
345 	doc_insert_two_strings(BFWIN(user_data)->current_document, cap("<A HREF=\""), cap("\"></A>"));
346 }
347 
348 static void
htmlbar_insert_big_tag(GtkAction * action,gpointer user_data)349 htmlbar_insert_big_tag(GtkAction * action, gpointer user_data)
350 {
351 	doc_insert_two_strings(BFWIN(user_data)->current_document, cap("<BIG>"), cap("</BIG>"));
352 }
353 
354 static void
htmlbar_insert_bold_tag(GtkAction * action,gpointer user_data)355 htmlbar_insert_bold_tag(GtkAction * action, gpointer user_data)
356 {
357 	doc_insert_two_strings(BFWIN(user_data)->current_document, cap("<B>"), cap("</B>"));
358 }
359 
360 static void
htmlbar_insert_break_tag(GtkAction * action,gpointer user_data)361 htmlbar_insert_break_tag(GtkAction * action, gpointer user_data)
362 {
363 	doc_insert_two_strings(BFWIN(user_data)->current_document,
364 						   get_curlang_option_value(BFWIN(user_data), self_close_singleton_tags) ? cap("<br />") : cap("<br>"), NULL);
365 }
366 
367 static void
htmlbar_insert_center_tag(GtkAction * action,gpointer user_data)368 htmlbar_insert_center_tag(GtkAction * action, gpointer user_data)
369 {
370 	doc_insert_two_strings(BFWIN(user_data)->current_document, cap("<DIV STYLE=\"text-align: center;\">"), cap("</DIV>"));
371 }
372 
373 static void
htmlbar_insert_citation_tag(GtkAction * action,gpointer user_data)374 htmlbar_insert_citation_tag(GtkAction * action, gpointer user_data)
375 {
376 	doc_insert_two_strings(BFWIN(user_data)->current_document, cap("<CITE>"), cap("</CITE>"));
377 }
378 
379 static void
htmlbar_insert_clearall_tag(GtkAction * action,gpointer user_data)380 htmlbar_insert_clearall_tag(GtkAction * action, gpointer user_data)
381 {
382 	doc_insert_two_strings(BFWIN(user_data)->current_document,
383 						   get_curlang_option_value(BFWIN(user_data), self_close_singleton_tags) ? cap("<BR CLEAR=\"ALL\" />") : cap("<BR CLEAR=\"ALL\">"),
384 						   NULL);
385 }
386 
387 static void
htmlbar_insert_code_tag(GtkAction * action,gpointer user_data)388 htmlbar_insert_code_tag(GtkAction * action, gpointer user_data)
389 {
390 	doc_insert_two_strings(BFWIN(user_data)->current_document, cap("<CODE>"), cap("</CODE>"));
391 }
392 
393 static void
htmlbar_insert_define_tag(GtkAction * action,gpointer user_data)394 htmlbar_insert_define_tag(GtkAction * action, gpointer user_data)
395 {
396 	doc_insert_two_strings(BFWIN(user_data)->current_document, cap("<DFN>"), cap("</DFN>"));
397 }
398 
399 static void
htmlbar_insert_definition_tag(GtkAction * action,gpointer user_data)400 htmlbar_insert_definition_tag(GtkAction * action, gpointer user_data)
401 {
402 	doc_insert_two_strings(BFWIN(user_data)->current_document, cap("<DD>"), cap("</DD>"));
403 }
404 
405 static void
htmlbar_insert_definition_list_tag(GtkAction * action,gpointer user_data)406 htmlbar_insert_definition_list_tag(GtkAction * action, gpointer user_data)
407 {
408 	doc_insert_two_strings(BFWIN(user_data)->current_document, cap("<DL>\n\t<DT></DT>\n\t<DD></DD>\n</DL>"),
409 						   "\n");
410 }
411 
412 static void
htmlbar_insert_definition_term_tag(GtkAction * action,gpointer user_data)413 htmlbar_insert_definition_term_tag(GtkAction * action, gpointer user_data)
414 {
415 	doc_insert_two_strings(BFWIN(user_data)->current_document, cap("<DT>"), cap("</DT>"));
416 }
417 
418 static void
htmlbar_insert_delete_tag(GtkAction * action,gpointer user_data)419 htmlbar_insert_delete_tag(GtkAction * action, gpointer user_data)
420 {
421 	doc_insert_two_strings(BFWIN(user_data)->current_document, cap("<DEL>"), cap("</DEL>"));
422 }
423 
424 static void
htmlbar_insert_div_tag(GtkAction * action,gpointer user_data)425 htmlbar_insert_div_tag(GtkAction * action, gpointer user_data)
426 {
427 	doc_insert_two_strings(BFWIN(user_data)->current_document, cap("<DIV>"), cap("</DIV>"));
428 }
429 
430 static void
htmlbar_insert_emphasis_tag(GtkAction * action,gpointer user_data)431 htmlbar_insert_emphasis_tag(GtkAction * action, gpointer user_data)
432 {
433 	doc_insert_two_strings(BFWIN(user_data)->current_document, cap("<EM>"), cap("</EM>"));
434 }
435 
436 static void
htmlbar_insert_font_minus_tag(GtkAction * action,gpointer user_data)437 htmlbar_insert_font_minus_tag(GtkAction * action, gpointer user_data)
438 {
439 	doc_insert_two_strings(BFWIN(user_data)->current_document, cap("<SPAN STYLE=\"font-size: smaller;\">"), cap("</SPAN>"));
440 }
441 
442 static void
htmlbar_insert_font_plus_tag(GtkAction * action,gpointer user_data)443 htmlbar_insert_font_plus_tag(GtkAction * action, gpointer user_data)
444 {
445 	doc_insert_two_strings(BFWIN(user_data)->current_document, cap("<SPAN STYLE=\"font-size: larger;\">"), cap("</SPAN>"));
446 }
447 
448 static void
htmlbar_insert_form_tag(GtkAction * action,gpointer user_data)449 htmlbar_insert_form_tag(GtkAction * action, gpointer user_data)
450 {
451 	doc_insert_two_strings(BFWIN(user_data)->current_document, cap("<FORM>"), cap("</FORM>"));
452 }
453 
454 static void
htmlbar_insert_form_fieldset_tag(GtkAction * action,gpointer user_data)455 htmlbar_insert_form_fieldset_tag(GtkAction * action, gpointer user_data)
456 {
457 	doc_insert_two_strings(BFWIN(user_data)->current_document, cap("<FIELDSET>"), cap("</FIELDSET>"));
458 }
459 
460 static void
htmlbar_insert_form_legend_tag(GtkAction * action,gpointer user_data)461 htmlbar_insert_form_legend_tag(GtkAction * action, gpointer user_data)
462 {
463 	doc_insert_two_strings(BFWIN(user_data)->current_document, cap("<LEGEND>"), cap("<LEGEND/>"));
464 }
465 
466 static void
htmlbar_insert_form_label_tag(GtkAction * action,gpointer user_data)467 htmlbar_insert_form_label_tag(GtkAction * action, gpointer user_data)
468 {
469 	doc_insert_two_strings(BFWIN(user_data)->current_document, cap("<LABEL>"), cap("</LABEL>"));
470 }
471 
472 static void
htmlbar_insert_form_input_tag(GtkAction * action,gpointer user_data)473 htmlbar_insert_form_input_tag(GtkAction * action, gpointer user_data)
474 {
475 	doc_insert_two_strings(BFWIN(user_data)->current_document,
476 						   get_curlang_option_value(BFWIN(user_data), self_close_singleton_tags) ? cap("<INPUT />") : cap("<INPUT>"), NULL);
477 }
478 
479 static void
htmlbar_insert_form_button_tag(GtkAction * action,gpointer user_data)480 htmlbar_insert_form_button_tag(GtkAction * action, gpointer user_data)
481 {
482 	doc_insert_two_strings(BFWIN(user_data)->current_document, cap("<BUTTON>"), cap("</BUTTON>"));
483 }
484 
485 static void
htmlbar_insert_form_select_tag(GtkAction * action,gpointer user_data)486 htmlbar_insert_form_select_tag(GtkAction * action, gpointer user_data)
487 {
488 	doc_insert_two_strings(BFWIN(user_data)->current_document, cap("<SELECT>"), cap("</SELECT>"));
489 }
490 
491 static void
htmlbar_insert_form_datalist_tag(GtkAction * action,gpointer user_data)492 htmlbar_insert_form_datalist_tag(GtkAction * action, gpointer user_data)
493 {
494 	doc_insert_two_strings(BFWIN(user_data)->current_document, cap("<DATALIST>"), cap("</DATALIST>"));
495 }
496 
497 static void
htmlbar_insert_form_optgroup_tag(GtkAction * action,gpointer user_data)498 htmlbar_insert_form_optgroup_tag(GtkAction * action, gpointer user_data)
499 {
500 	doc_insert_two_strings(BFWIN(user_data)->current_document, cap("<OPTGROUP>"), cap("</OPTGROUP>"));
501 }
502 
503 static void
htmlbar_insert_form_option_tag(GtkAction * action,gpointer user_data)504 htmlbar_insert_form_option_tag(GtkAction * action, gpointer user_data)
505 {
506 	doc_insert_two_strings(BFWIN(user_data)->current_document, cap("<OPTION>"), cap("</OPTION>"));
507 }
508 
509 static void
htmlbar_insert_form_textarea_tag(GtkAction * action,gpointer user_data)510 htmlbar_insert_form_textarea_tag(GtkAction * action, gpointer user_data)
511 {
512 	doc_insert_two_strings(BFWIN(user_data)->current_document, cap("<TEXTAREA>"), cap("</TEXTAREA>"));
513 }
514 
515 static void
htmlbar_insert_form_keygen_tag(GtkAction * action,gpointer user_data)516 htmlbar_insert_form_keygen_tag(GtkAction * action, gpointer user_data)
517 {
518 	doc_insert_two_strings(BFWIN(user_data)->current_document,
519 						   get_curlang_option_value(BFWIN(user_data), self_close_singleton_tags) ? cap("<KEYGEN />") : cap("<KEYGEN>"), NULL);
520 }
521 
522 static void
htmlbar_insert_form_output_tag(GtkAction * action,gpointer user_data)523 htmlbar_insert_form_output_tag(GtkAction * action, gpointer user_data)
524 {
525 	doc_insert_two_strings(BFWIN(user_data)->current_document, cap("<OUTPUT>"), cap("</OUTPUT>"));
526 }
527 
528 static void
htmlbar_insert_form_progress_tag(GtkAction * action,gpointer user_data)529 htmlbar_insert_form_progress_tag(GtkAction * action, gpointer user_data)
530 {
531 	doc_insert_two_strings(BFWIN(user_data)->current_document, cap("<PROGRESS>"), cap("</PROGRESS>"));
532 }
533 
534 static void
htmlbar_insert_form_meter_tag(GtkAction * action,gpointer user_data)535 htmlbar_insert_form_meter_tag(GtkAction * action, gpointer user_data)
536 {
537 	doc_insert_two_strings(BFWIN(user_data)->current_document, cap("<METER>"), cap("</METER>"));
538 }
539 
540 static void
htmlbar_insert_frame_tag(GtkAction * action,gpointer user_data)541 htmlbar_insert_frame_tag(GtkAction * action, gpointer user_data)
542 {
543 	doc_insert_two_strings(BFWIN(user_data)->current_document,
544 						   get_curlang_option_value(BFWIN(user_data), self_close_singleton_tags) ? cap("<FRAME />") : cap("<FRAME>"), NULL);
545 }
546 
547 static void
htmlbar_insert_frameset_tag(GtkAction * action,gpointer user_data)548 htmlbar_insert_frameset_tag(GtkAction * action, gpointer user_data)
549 {
550 	doc_insert_two_strings(BFWIN(user_data)->current_document, cap("<FRAMESET>"), cap("</FRAMESET>"));
551 }
552 
553 static void
htmlbar_insert_generator_meta_tag(GtkAction * action,gpointer user_data)554 htmlbar_insert_generator_meta_tag(GtkAction * action, gpointer user_data)
555 {
556 	gchar *tmp = g_strconcat(cap("<META NAME=\"Generator\" CONTENT=\""), "Bluefish ", VERSION,
557 							 " http://bluefish.openoffice.nl/",
558 							 get_curlang_option_value(BFWIN(user_data), self_close_singleton_tags) ? "\" />\n" : "\">\n", NULL);
559 	doc_insert_two_strings(BFWIN(user_data)->current_document, tmp, NULL);
560 	g_free(tmp);
561 }
562 
563 static void
htmlbar_insert_h1_tag(GtkAction * action,gpointer user_data)564 htmlbar_insert_h1_tag(GtkAction * action, gpointer user_data)
565 {
566 	doc_insert_two_strings(BFWIN(user_data)->current_document, cap("<H1>"), cap("</H1>"));
567 }
568 
569 static void
htmlbar_insert_h2_tag(GtkAction * action,gpointer user_data)570 htmlbar_insert_h2_tag(GtkAction * action, gpointer user_data)
571 {
572 	doc_insert_two_strings(BFWIN(user_data)->current_document, cap("<H2>"), cap("</H2>"));
573 }
574 
575 static void
htmlbar_insert_h3_tag(GtkAction * action,gpointer user_data)576 htmlbar_insert_h3_tag(GtkAction * action, gpointer user_data)
577 {
578 	doc_insert_two_strings(BFWIN(user_data)->current_document, cap("<H3>"), cap("</H3>"));
579 }
580 
581 static void
htmlbar_insert_h4_tag(GtkAction * action,gpointer user_data)582 htmlbar_insert_h4_tag(GtkAction * action, gpointer user_data)
583 {
584 	doc_insert_two_strings(BFWIN(user_data)->current_document, cap("<H4>"), cap("</H4>"));
585 }
586 
587 static void
htmlbar_insert_h5_tag(GtkAction * action,gpointer user_data)588 htmlbar_insert_h5_tag(GtkAction * action, gpointer user_data)
589 {
590 	doc_insert_two_strings(BFWIN(user_data)->current_document, cap("<H5>"), cap("</H5>"));
591 }
592 
593 static void
htmlbar_insert_h6_tag(GtkAction * action,gpointer user_data)594 htmlbar_insert_h6_tag(GtkAction * action, gpointer user_data)
595 {
596 	doc_insert_two_strings(BFWIN(user_data)->current_document, cap("<H6>"), cap("</H6>"));
597 }
598 
599 static void
htmlbar_insert_image_tag(GtkAction * action,gpointer user_data)600 htmlbar_insert_image_tag(GtkAction * action, gpointer user_data)
601 {
602 	doc_insert_two_strings(BFWIN(user_data)->current_document,
603 						   get_curlang_option_value(BFWIN(user_data), self_close_singleton_tags) ? cap("<IMG />") : cap("<IMG>"), NULL);
604 }
605 
606 static void
htmlbar_insert_insert_tag(GtkAction * action,gpointer user_data)607 htmlbar_insert_insert_tag(GtkAction * action, gpointer user_data)
608 {
609 	doc_insert_two_strings(BFWIN(user_data)->current_document, cap("<INS>"), cap("</INS>"));
610 }
611 
612 static void
htmlbar_insert_italic_tag(GtkAction * action,gpointer user_data)613 htmlbar_insert_italic_tag(GtkAction * action, gpointer user_data)
614 {
615 	doc_insert_two_strings(BFWIN(user_data)->current_document, cap("<I>"), cap("</I>"));
616 }
617 
618 static void
htmlbar_insert_keyboard_tag(GtkAction * action,gpointer user_data)619 htmlbar_insert_keyboard_tag(GtkAction * action, gpointer user_data)
620 {
621 	doc_insert_two_strings(BFWIN(user_data)->current_document, cap("<KBD>"), cap("</KBD>"));
622 }
623 
624 static void
htmlbar_insert_link_tag(GtkAction * action,gpointer user_data)625 htmlbar_insert_link_tag(GtkAction * action, gpointer user_data)
626 {
627 	doc_insert_two_strings(BFWIN(user_data)->current_document,
628 						   get_curlang_option_value(BFWIN(user_data), self_close_singleton_tags) ? cap("<LINK />") : cap("<LINK>"), NULL);
629 }
630 
631 static void
htmlbar_insert_list_item_tag(GtkAction * action,gpointer user_data)632 htmlbar_insert_list_item_tag(GtkAction * action, gpointer user_data)
633 {
634 	doc_insert_two_strings(BFWIN(user_data)->current_document, cap("<LI>"), cap("</LI>"));
635 }
636 
637 static void
htmlbar_insert_list_ordered_tag(GtkAction * action,gpointer user_data)638 htmlbar_insert_list_ordered_tag(GtkAction * action, gpointer user_data)
639 {
640 	doc_insert_two_strings(BFWIN(user_data)->current_document, cap("<OL>"), cap("</OL>"));
641 }
642 
643 static void
htmlbar_insert_list_unordered_tag(GtkAction * action,gpointer user_data)644 htmlbar_insert_list_unordered_tag(GtkAction * action, gpointer user_data)
645 {
646 	doc_insert_two_strings(BFWIN(user_data)->current_document, cap("<UL>"), cap("</UL>"));
647 }
648 
649 static void
htmlbar_insert_menu_tag(GtkAction * action,gpointer user_data)650 htmlbar_insert_menu_tag(GtkAction * action, gpointer user_data)
651 {
652 	doc_insert_two_strings(BFWIN(user_data)->current_document, cap("<MENU>"), cap("</MENU>"));
653 }
654 
655 static void
htmlbar_insert_nbsp_tag(GtkAction * action,gpointer user_data)656 htmlbar_insert_nbsp_tag(GtkAction * action, gpointer user_data)
657 {
658 	doc_insert_two_strings(BFWIN(user_data)->current_document, "&nbsp;", NULL);
659 }
660 
661 static void
htmlbar_insert_noframes_tag(GtkAction * action,gpointer user_data)662 htmlbar_insert_noframes_tag(GtkAction * action, gpointer user_data)
663 {
664 	doc_insert_two_strings(BFWIN(user_data)->current_document, cap("<NOFRAMES>"), cap("</NOFRAMES>"));
665 }
666 
667 static void
htmlbar_insert_paragraph_tag(GtkAction * action,gpointer user_data)668 htmlbar_insert_paragraph_tag(GtkAction * action, gpointer user_data)
669 {
670 	doc_insert_two_strings(BFWIN(user_data)->current_document, cap("<P>"), cap("</P>"));
671 }
672 
673 static void
htmlbar_insert_pre_tag(GtkAction * action,gpointer user_data)674 htmlbar_insert_pre_tag(GtkAction * action, gpointer user_data)
675 {
676 	doc_insert_two_strings(BFWIN(user_data)->current_document, cap("<PRE>"), cap("</PRE>"));
677 }
678 
679 static void
htmlbar_insert_sample_tag(GtkAction * action,gpointer user_data)680 htmlbar_insert_sample_tag(GtkAction * action, gpointer user_data)
681 {
682 	doc_insert_two_strings(BFWIN(user_data)->current_document, cap("<SAMP>"), cap("</SAMP>"));
683 }
684 
685 static void
htmlbar_insert_script_tag(GtkAction * action,gpointer user_data)686 htmlbar_insert_script_tag(GtkAction * action, gpointer user_data)
687 {
688 	doc_insert_two_strings(BFWIN(user_data)->current_document, cap("<SCRIPT>"), cap("</SCRIPT>"));
689 }
690 
691 static void
htmlbar_insert_small_tag(GtkAction * action,gpointer user_data)692 htmlbar_insert_small_tag(GtkAction * action, gpointer user_data)
693 {
694 	doc_insert_two_strings(BFWIN(user_data)->current_document, cap("<SMALL>"), cap("</SMALL>"));
695 }
696 
697 static void
htmlbar_insert_span_tag(GtkAction * action,gpointer user_data)698 htmlbar_insert_span_tag(GtkAction * action, gpointer user_data)
699 {
700 	doc_insert_two_strings(BFWIN(user_data)->current_document, cap("<SPAN>"), cap("</SPAN>"));
701 }
702 
703 static void
htmlbar_insert_strikeout_tag(GtkAction * action,gpointer user_data)704 htmlbar_insert_strikeout_tag(GtkAction * action, gpointer user_data)
705 {
706 	doc_insert_two_strings(BFWIN(user_data)->current_document, cap("<STRIKE>"), cap("</STRIKE>"));
707 }
708 
709 static void
htmlbar_insert_strong_tag(GtkAction * action,gpointer user_data)710 htmlbar_insert_strong_tag(GtkAction * action, gpointer user_data)
711 {
712 	doc_insert_two_strings(BFWIN(user_data)->current_document, cap("<STRONG>"), cap("</STRONG>"));
713 }
714 
715 static void
htmlbar_insert_subscript_tag(GtkAction * action,gpointer user_data)716 htmlbar_insert_subscript_tag(GtkAction * action, gpointer user_data)
717 {
718 	doc_insert_two_strings(BFWIN(user_data)->current_document, cap("<SUB>"), cap("</SUB>"));
719 }
720 
721 static void
htmlbar_insert_superscript_tag(GtkAction * action,gpointer user_data)722 htmlbar_insert_superscript_tag(GtkAction * action, gpointer user_data)
723 {
724 	doc_insert_two_strings(BFWIN(user_data)->current_document, cap("<SUP>"), cap("</SUP>"));
725 }
726 
727 static void
htmlbar_insert_table_tag(GtkAction * action,gpointer user_data)728 htmlbar_insert_table_tag(GtkAction * action, gpointer user_data)
729 {
730 	doc_insert_two_strings(BFWIN(user_data)->current_document, cap("<TABLE>"), cap("</TABLE>"));
731 }
732 
733 static void
htmlbar_insert_table_caption_tag(GtkAction * action,gpointer user_data)734 htmlbar_insert_table_caption_tag(GtkAction * action, gpointer user_data)
735 {
736 	doc_insert_two_strings(BFWIN(user_data)->current_document, cap("<CAPTION>"), cap("</CAPTION>"));
737 }
738 
739 static void
htmlbar_insert_table_data_tag(GtkAction * action,gpointer user_data)740 htmlbar_insert_table_data_tag(GtkAction * action, gpointer user_data)
741 {
742 	doc_insert_two_strings(BFWIN(user_data)->current_document, cap("<TD>"), cap("</TD>"));
743 }
744 
745 static void
htmlbar_insert_table_header_tag(GtkAction * action,gpointer user_data)746 htmlbar_insert_table_header_tag(GtkAction * action, gpointer user_data)
747 {
748 	doc_insert_two_strings(BFWIN(user_data)->current_document, cap("<TH>"), cap("</TH>"));
749 }
750 
751 static void
htmlbar_insert_table_row_tag(GtkAction * action,gpointer user_data)752 htmlbar_insert_table_row_tag(GtkAction * action, gpointer user_data)
753 {
754 	doc_insert_two_strings(BFWIN(user_data)->current_document, cap("<TR>"), cap("</TR>"));
755 }
756 
757 static void
htmlbar_insert_target_tag(GtkAction * action,gpointer user_data)758 htmlbar_insert_target_tag(GtkAction * action, gpointer user_data)
759 {
760 	doc_insert_two_strings(BFWIN(user_data)->current_document,
761 						   get_curlang_option_value(BFWIN(user_data), self_close_singleton_tags) ? cap("<BASE TARGET=\"\" />") : cap("<BASE TARGET=\"\">"), NULL);
762 }
763 
764 static void
htmlbar_insert_underline_tag(GtkAction * action,gpointer user_data)765 htmlbar_insert_underline_tag(GtkAction * action, gpointer user_data)
766 {
767 	doc_insert_two_strings(BFWIN(user_data)->current_document, cap("<SPAN STYLE=\"text-decoration: underline;\">"), cap("</SPAN>"));
768 }
769 
770 static void
htmlbar_insert_variable_tag(GtkAction * action,gpointer user_data)771 htmlbar_insert_variable_tag(GtkAction * action, gpointer user_data)
772 {
773 	doc_insert_two_strings(BFWIN(user_data)->current_document, cap("<VAR>"), cap("</VAR>"));
774 }
775 
776 static void
htmlbar_insert_nbsp(GtkAction * action,gpointer user_data)777 htmlbar_insert_nbsp(GtkAction * action, gpointer user_data)
778 {
779 	htmlbar_insert_special_char(BFWIN(user_data), BF_NBSP);
780 }
781 
782 static void
htmlbar_insert_broken_bar(GtkAction * action,gpointer user_data)783 htmlbar_insert_broken_bar(GtkAction * action, gpointer user_data)
784 {
785 	htmlbar_insert_special_char(BFWIN(user_data), BF_BROKEN_BAR);
786 }
787 
788 static void
htmlbar_insert_soft_hyphen(GtkAction * action,gpointer user_data)789 htmlbar_insert_soft_hyphen(GtkAction * action, gpointer user_data)
790 {
791 	htmlbar_insert_special_char(BFWIN(user_data), BF_SOFT_HYPHEN);
792 }
793 
794 void
htmlbar_toolbar_show(Thtmlbarwin * hbw,Thtmlbarsession * hbs,gboolean show)795 htmlbar_toolbar_show(Thtmlbarwin * hbw, Thtmlbarsession *hbs, gboolean show)
796 {
797 	if (htmlbar_v.in_sidepanel) {
798 		DEBUG_MSG("htmlbar_toolbar_show, in_sidepanel=%d, nothing to do (handlebox=%p), return\n",htmlbar_v.in_sidepanel,hbw->handlebox);
799 		return;
800 	}
801 	DEBUG_MSG("htmlbar_toolbar_show, show=%d, handlebox=%p\n",show,hbw->handlebox);
802 	if (show) {
803 		if (hbw->handlebox) {
804 			gtk_widget_show(hbw->handlebox);
805 		} else {
806 			GtkWidget *html_notebook;
807 			html_notebook = htmlbar_toolbar_create(hbw, hbs);
808 #if GTK_CHECK_VERSION(3,2,0)
809 			/*gtk_notebook_set_tab_pos(GTK_NOTEBOOK(html_notebook), GTK_POS_TOP); this is the default, so why set it?*/
810  			gtk_widget_set_hexpand(GTK_WIDGET(html_notebook),TRUE);
811  			hbw->handlebox = gtk_event_box_new();
812  			gtk_widget_set_name(GTK_WIDGET(hbw->handlebox), "html_notebook_event_box");
813 			gtk_container_add(GTK_CONTAINER(hbw->handlebox),html_notebook);
814 			gtk_container_add(GTK_CONTAINER(hbw->bfwin->toolbarbox),hbw->handlebox);
815 			gtk_widget_show_all(hbw->handlebox);
816 #else
817 			hbw->handlebox = gtk_handle_box_new();
818 			gtk_container_add(GTK_CONTAINER(hbw->handlebox), html_notebook);
819 			gtk_notebook_set_tab_pos(GTK_NOTEBOOK(html_notebook), GTK_POS_TOP);
820 			gtk_box_pack_start(GTK_BOX(hbw->bfwin->toolbarbox), hbw->handlebox, FALSE, FALSE, 0);
821 			gtk_widget_show_all(hbw->handlebox);
822 #endif
823 		DEBUG_MSG("htmlbar_toolbar_show, created handlebox=%p\n",hbw->handlebox);
824 		}
825 	} else {
826 		if (hbw->handlebox)
827 			gtk_widget_hide(hbw->handlebox);
828 	}
829 }
830 
831 static void
htmlbar_toolbar_show_toogle(GtkAction * action,gpointer user_data)832 htmlbar_toolbar_show_toogle(GtkAction * action, gpointer user_data)
833 {
834 	Thtmlbarwin *hbw = (Thtmlbarwin *) user_data;
835 	Thtmlbarsession *hbs;
836 
837 	hbs = g_hash_table_lookup(htmlbar_v.lookup, hbw->bfwin->session);
838 	if (!hbs)
839 		return;
840 	hbs->view_htmlbar = gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(action));
841 	htmlbar_toolbar_show(hbw, hbs, gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(action)));
842 }
843 
844 static void
htmlbar_insert_article_tag(GtkAction * action,gpointer user_data)845 htmlbar_insert_article_tag(GtkAction * action, gpointer user_data)
846 {
847 	doc_insert_two_strings(BFWIN(user_data)->current_document, cap("<ARTICLE>"), cap("</ARTICLE>"));
848 }
849 
850 static void
htmlbar_insert_aside_tag(GtkAction * action,gpointer user_data)851 htmlbar_insert_aside_tag(GtkAction * action, gpointer user_data)
852 {
853 	doc_insert_two_strings(BFWIN(user_data)->current_document, cap("<ASIDE>"), cap("</ASIDE>"));
854 }
855 
856 static void
htmlbar_insert_figcaption_tag(GtkAction * action,gpointer user_data)857 htmlbar_insert_figcaption_tag(GtkAction * action, gpointer user_data)
858 {
859 	doc_insert_two_strings(BFWIN(user_data)->current_document, cap("<FIGCAPTION>"), cap("</FIGCAPTION>"));
860 }
861 
862 static void
htmlbar_insert_figure_tag(GtkAction * action,gpointer user_data)863 htmlbar_insert_figure_tag(GtkAction * action, gpointer user_data)
864 {
865 	doc_insert_two_strings(BFWIN(user_data)->current_document, cap("<FIGURE>"), cap("</FIGURE>"));
866 }
867 
868 static void
htmlbar_insert_footer_tag(GtkAction * action,gpointer user_data)869 htmlbar_insert_footer_tag(GtkAction * action, gpointer user_data)
870 {
871 	doc_insert_two_strings(BFWIN(user_data)->current_document, cap("<FOOTER>"), cap("</FOOTER>"));
872 }
873 
874 static void
htmlbar_insert_header_tag(GtkAction * action,gpointer user_data)875 htmlbar_insert_header_tag(GtkAction * action, gpointer user_data)
876 {
877 	doc_insert_two_strings(BFWIN(user_data)->current_document, cap("<HEADER>"), cap("</HEADER>"));
878 }
879 
880 static void
htmlbar_insert_hgroup_tag(GtkAction * action,gpointer user_data)881 htmlbar_insert_hgroup_tag(GtkAction * action, gpointer user_data)
882 {
883 	doc_insert_two_strings(BFWIN(user_data)->current_document, cap("<HGROUP>"), cap("</HGROUP>"));
884 }
885 
886 static void
htmlbar_insert_mark_tag(GtkAction * action,gpointer user_data)887 htmlbar_insert_mark_tag(GtkAction * action, gpointer user_data)
888 {
889 	doc_insert_two_strings(BFWIN(user_data)->current_document, cap("<MARK>"), cap("</MARK>"));
890 }
891 
892 static void
htmlbar_insert_nav_tag(GtkAction * action,gpointer user_data)893 htmlbar_insert_nav_tag(GtkAction * action, gpointer user_data)
894 {
895 	doc_insert_two_strings(BFWIN(user_data)->current_document, cap("<NAV>"), cap("</NAV>"));
896 }
897 
898 static void
htmlbar_insert_rp_tag(GtkAction * action,gpointer user_data)899 htmlbar_insert_rp_tag(GtkAction * action, gpointer user_data)
900 {
901 	doc_insert_two_strings(BFWIN(user_data)->current_document, cap("<RP>"), cap("</RP>"));
902 }
903 
904 static void
htmlbar_insert_rt_tag(GtkAction * action,gpointer user_data)905 htmlbar_insert_rt_tag(GtkAction * action, gpointer user_data)
906 {
907 	doc_insert_two_strings(BFWIN(user_data)->current_document, cap("<RT>"), cap("</RT>"));
908 }
909 
910 static void
htmlbar_insert_ruby_tag(GtkAction * action,gpointer user_data)911 htmlbar_insert_ruby_tag(GtkAction * action, gpointer user_data)
912 {
913 	doc_insert_two_strings(BFWIN(user_data)->current_document, cap("<RUBY>"), cap("</RUBY>"));
914 }
915 
916 static void
htmlbar_insert_section_tag(GtkAction * action,gpointer user_data)917 htmlbar_insert_section_tag(GtkAction * action, gpointer user_data)
918 {
919 	doc_insert_two_strings(BFWIN(user_data)->current_document, cap("<SECTION>"), cap("</SECTION>"));
920 }
921 
922 static void
htmlbar_dialog_audio(GtkAction * action,gpointer user_data)923 htmlbar_dialog_audio(GtkAction * action, gpointer user_data)
924 {
925 	audio_dialog(BFWIN(user_data), NULL);
926 }
927 
928 static void
htmlbar_dialog_canvas(GtkAction * action,gpointer user_data)929 htmlbar_dialog_canvas(GtkAction * action, gpointer user_data)
930 {
931 	canvas_dialog(BFWIN(user_data), NULL);
932 }
933 
934 static void
htmlbar_dialog_video(GtkAction * action,gpointer user_data)935 htmlbar_dialog_video(GtkAction * action, gpointer user_data)
936 {
937 	video_dialog(BFWIN(user_data), NULL);
938 }
939 
940 static void
htmlbar_dialog_html5time(GtkAction * action,gpointer user_data)941 htmlbar_dialog_html5time(GtkAction * action, gpointer user_data)
942 {
943 	html5time_dialog(BFWIN(user_data), NULL);
944 }
945 
946 static void
htmlbar_insert_color(GtkAction * action,gpointer user_data)947 htmlbar_insert_color(GtkAction * action, gpointer user_data)
948 {
949 	gchar *color = return_color(NULL);
950 	doc_insert_two_strings(BFWIN(user_data)->current_document,color, NULL);
951 	g_free(color);
952 }
953 
954 static const GtkActionEntry htmlbar_actions[] = {
955 	{"TagsMenu", NULL, N_("T_ags")},
956 	{"HeadingsMenu", NULL, N_("_Headings")},
957 	{"HeadingsH1", BF_STOCK_FONTH1, N_("H_1"), "<control><alt>1", N_("Insert H1 tag"),
958 	 G_CALLBACK(htmlbar_insert_h1_tag)},
959 	{"HeadingsH2", BF_STOCK_FONTH2, N_("H_2"), "<control><alt>2", N_("Insert H2 tag"),
960 	 G_CALLBACK(htmlbar_insert_h2_tag)},
961 	{"HeadingsH3", BF_STOCK_FONTH3, N_("H_3"), "<control><alt>3", N_("Insert H3 tag"),
962 	 G_CALLBACK(htmlbar_insert_h3_tag)},
963 	{"HeadingsH4", BF_STOCK_FONTH4, N_("H_4"), "<control><alt>4", N_("Insert H4 tag"),
964 	 G_CALLBACK(htmlbar_insert_h4_tag)},
965 	{"HeadingsH5", BF_STOCK_FONTH5, N_("H_5"), "<control><alt>5", N_("Insert H5 tag"),
966 	 G_CALLBACK(htmlbar_insert_h5_tag)},
967 	{"HeadingsH6", BF_STOCK_FONTH6, N_("H_6"), "<control><alt>6", N_("Insert H6 tag"),
968 	 G_CALLBACK(htmlbar_insert_h6_tag)},
969 	{"SpecialMenu", NULL, N_("_Entities")},
970 	{"NBSP", NULL, N_("_Non-breaking space"), NULL, NULL, G_CALLBACK(htmlbar_insert_nbsp)},
971 	{"BrokenBar", NULL, N_("_Broken bar ¦"), NULL, NULL, G_CALLBACK(htmlbar_insert_broken_bar)},
972 	{"SoftHyphen", NULL, N_("Soft _hyphen -"), NULL, NULL, G_CALLBACK(htmlbar_insert_soft_hyphen)},
973 	{"FormatContextMenu", NULL, N_("_Format by Context")},
974 	{"FormatStrong", BF_STOCK_BOLD, N_("_Strong"), "<control><alt>g", N_("Strong"),
975 	 G_CALLBACK(htmlbar_insert_strong_tag)},
976 	{"FormatEmphasis", BF_STOCK_ITALIC, N_("_Emphasis"), "<control><alt>e", N_("Emphasis"),
977 	 G_CALLBACK(htmlbar_insert_emphasis_tag)},
978 	{"FormatDefine", BF_STOCK_DFN, N_("_Definition"), NULL, N_("Definition"),
979 	 G_CALLBACK(htmlbar_insert_define_tag)},
980 	{"FormatCode", BF_STOCK_CODE, N_("_Code"), NULL, N_("Code"), G_CALLBACK(htmlbar_insert_code_tag)},
981 	{"FormatSample", BF_STOCK_SAMP, N_("Sa_mple"), NULL, N_("Sample"), G_CALLBACK(htmlbar_insert_sample_tag)},
982 	{"FormatKeyboard", BF_STOCK_KBD, N_("_Keyboard"), NULL, N_("Keyboard"),
983 	 G_CALLBACK(htmlbar_insert_keyboard_tag)},
984 	{"FormatVariable", BF_STOCK_VAR, N_("_Variable"), NULL, N_("Variable"),
985 	 G_CALLBACK(htmlbar_insert_variable_tag)},
986 	{"FormatCitation", BF_STOCK_CITE, N_("Ci_tation"), NULL, N_("Citation"),
987 	 G_CALLBACK(htmlbar_insert_citation_tag)},
988 	{"FormatAbbr", BF_STOCK_ADDR, N_("_Abbreviation"), NULL, N_("Abbreviation"),
989 	 G_CALLBACK(htmlbar_insert_abbr_tag)},
990 	{"FormatAcronym", BF_STOCK_ACRONYM, N_("Ac_ronym"), NULL, N_("Acronym"),
991 	 G_CALLBACK(htmlbar_insert_acronym_tag)},
992 	{"FormatInsert", BF_STOCK_INS, N_("_Insert"), NULL, N_("Insert"), G_CALLBACK(htmlbar_insert_insert_tag)},
993 	{"FormatDelete", BF_STOCK_DEL, N_("De_lete"), NULL, N_("Delete"), G_CALLBACK(htmlbar_insert_delete_tag)},
994 	{"FormatLayoutMenu", NULL, N_("Format by L_ayout")},
995 	{"FormatBold", BF_STOCK_BOLD, N_("_Bold"), "<control><alt>b", N_("Bold"),
996 	 G_CALLBACK(htmlbar_insert_bold_tag)},
997 	{"FormatItalic", BF_STOCK_ITALIC, N_("_Italic"), "<control><alt>i", N_("Italic"),
998 	 G_CALLBACK(htmlbar_insert_italic_tag)},
999 	{"FormatUnderline", BF_STOCK_UNDERLINE, N_("_Underline"), "<control><alt>u", N_("Underline"),
1000 	 G_CALLBACK(htmlbar_insert_underline_tag)},
1001 	{"FormatStrikeout", BF_STOCK_STRIKEOUT, N_("_Strikeout"), "<control><alt>s", N_("Strikeout"),
1002 	 G_CALLBACK(htmlbar_insert_strikeout_tag)},
1003 	{"FormatSmall", NULL, N_("Sm_all"), NULL, N_("Small"), G_CALLBACK(htmlbar_insert_small_tag)},
1004 	{"FormatBig", NULL, N_("Bi_g"), NULL, N_("Big"), G_CALLBACK(htmlbar_insert_big_tag)},
1005 	{"FormatGeneralMenu", NULL, N_("Format _General")},
1006 	{"FormatParagraph", BF_STOCK_PARAGRAPH, N_("_Paragraph"), "<control><alt>p", N_("Paragraph"),
1007 	 G_CALLBACK(htmlbar_insert_paragraph_tag)},
1008 	{"FormatBreak", BF_STOCK_BRBREAK, N_("_Break"), "<control><alt>k", N_("Break"),
1009 	 G_CALLBACK(htmlbar_insert_break_tag)},
1010 	{"FormatClearAll", BF_STOCK_BREAKALL, N_("Break clear _all"), NULL, N_("Break and clear"),
1011 	 G_CALLBACK(htmlbar_insert_clearall_tag)},
1012 	{"FormatNBSP", BF_STOCK_NBSP, N_("_Non-Breaking Space"), "<control><alt>n", N_("Non-breaking space"),
1013 	 G_CALLBACK(htmlbar_insert_nbsp_tag)},
1014 	{"FormatFontSizePlus", BF_STOCK_FONTP1, N_("Font Si_ze +1"), "<control><alt>equal", N_("Font Size +1"),
1015 	 G_CALLBACK(htmlbar_insert_font_plus_tag)},
1016 	{"FormatFontSizeMinus", BF_STOCK_FONTM1, N_("Font _Size -1"), "<control><alt>minus", N_("Font Size -1"),
1017 	 G_CALLBACK(htmlbar_insert_font_minus_tag)},
1018 	{"FormatPre", BF_STOCK_FONTPRE, N_("Preformatted _Text"), "<Control><Alt>f", N_("Preformatted Text"),
1019 	 G_CALLBACK(htmlbar_insert_pre_tag)},
1020 	{"FormatSubscript", BF_STOCK_FONTSUB, N_("Su_bscript"), NULL, N_("Subscript"),
1021 	 G_CALLBACK(htmlbar_insert_subscript_tag)},
1022 	{"FormatSuperscript", BF_STOCK_FONTSUPER, N_("Su_perscript"), NULL, N_("Superscript"),
1023 	 G_CALLBACK(htmlbar_insert_superscript_tag)},
1024 	{"FormatCenter", BF_STOCK_CENTER, N_("_Center"), NULL, N_("Center"),
1025 	 G_CALLBACK(htmlbar_insert_center_tag)},
1026 	{"FormatAlignRight", BF_STOCK_RIGHT, N_("Align _right"), "<control><Alt>r", N_("Right Justify"),
1027 	 G_CALLBACK(htmlbar_insert_align_right_tag)},
1028 	{"TableMenu", NULL, N_("_Table")},
1029 	{"TableTable", BF_STOCK_TABLE2, N_("_Table"), "<control><alt>t", N_("Table"),
1030 	 G_CALLBACK(htmlbar_insert_table_tag)},
1031 	{"TableRow", BF_STOCK_TABLE_TR2, N_("Table _Row"), NULL, N_("Table Row"),
1032 	 G_CALLBACK(htmlbar_insert_table_row_tag)},
1033 	{"TableHeader", BF_STOCK_TABLE_TH2, N_("Table _Header"), NULL, N_("Table Header"),
1034 	 G_CALLBACK(htmlbar_insert_table_header_tag)},
1035 	{"TableData", BF_STOCK_TABLE_TD2, N_("Table _Data"), NULL, N_("Table Data"),
1036 	 G_CALLBACK(htmlbar_insert_table_data_tag)},
1037 	{"TableCaption", BF_STOCK_TABLE_CAPTION, N_("Table _Caption"), NULL, N_("Table Caption"),
1038 	 G_CALLBACK(htmlbar_insert_table_caption_tag)},
1039 	{"ListMenu", NULL, N_("_List")},
1040 	{"ListUnordered", BF_STOCK_LIST_UL, N_("Unordered _List"), "<control><alt>L", N_("Unordered List"),
1041 	 G_CALLBACK(htmlbar_insert_list_unordered_tag)},
1042 	{"ListOrdered", BF_STOCK_LIST_OL, N_("_Ordered List"), "<control><alt>O", N_("Ordered List"),
1043 	 G_CALLBACK(htmlbar_insert_list_ordered_tag)},
1044 	{"ListItem", BF_STOCK_LIST_LI, N_("List Ite_m"), "<control><alt>M", N_("List Item"),
1045 	 G_CALLBACK(htmlbar_insert_list_item_tag)},
1046 	{"ListDefList", BF_STOCK_LIST_DL, N_("De_finition List"), NULL, N_("Definition List"),
1047 	 G_CALLBACK(htmlbar_insert_definition_list_tag)},
1048 	{"ListDefTerm", BF_STOCK_LIST_DT, N_("Definition _Term"), NULL, N_("Definition Term"),
1049 	 G_CALLBACK(htmlbar_insert_definition_term_tag)},
1050 	{"ListDefinition", BF_STOCK_LIST_DD, N_("_Definition"), NULL, N_("Definition"),
1051 	 G_CALLBACK(htmlbar_insert_definition_tag)},
1052 	{"ListListMenu", NULL, N_("Men_u"), NULL, N_("Menu"), G_CALLBACK(htmlbar_insert_menu_tag)},
1053 	{"FormMenu", NULL, N_("F_orm")},
1054 	{"FormForm", BF_STOCK_FORM, N_("F_orm"), NULL, N_("Form"), G_CALLBACK(htmlbar_insert_form_tag)},
1055 	{"FormFieldset", NULL, N_("_Fieldset"), NULL, NULL, G_CALLBACK(htmlbar_insert_form_fieldset_tag)},
1056 	{"FormLegend", NULL, N_("_Legend"), NULL, NULL, G_CALLBACK(htmlbar_insert_form_legend_tag)},
1057 	{"FormLabel", NULL, N_("L_abel"), NULL, NULL, G_CALLBACK(htmlbar_insert_form_label_tag)},
1058 	{"FormInput", NULL, N_("_Input"), NULL, NULL, G_CALLBACK(htmlbar_insert_form_input_tag)},
1059 	{"FormButton", NULL, N_("_Button"), NULL, NULL, G_CALLBACK(htmlbar_insert_form_button_tag)},
1060 	{"FormSelect", NULL, N_("_Select"), NULL, NULL, G_CALLBACK(htmlbar_insert_form_select_tag)},
1061 	{"FormDatalist", NULL, N_("_Datalist"), NULL, NULL, G_CALLBACK(htmlbar_insert_form_datalist_tag)},
1062 	{"FormOptgroup", NULL, N_("Opt_group"), NULL, NULL, G_CALLBACK(htmlbar_insert_form_optgroup_tag)},
1063 	{"FormOption", NULL, N_("Optio_n"), NULL, NULL, G_CALLBACK(htmlbar_insert_form_option_tag)},
1064 	{"FormTextArea", NULL, N_("_Textarea"), NULL, NULL, G_CALLBACK(htmlbar_insert_form_textarea_tag)},
1065 	{"FormKeygen", NULL, N_("_Keygen"), NULL, NULL, G_CALLBACK(htmlbar_insert_form_keygen_tag)},
1066 	{"FormOutput", NULL, N_("O_utput"), NULL, NULL, G_CALLBACK(htmlbar_insert_form_output_tag)},
1067 	{"FormProgress", NULL, N_("_Progress"), NULL, NULL, G_CALLBACK(htmlbar_insert_form_progress_tag)},
1068 	{"FormMeter", NULL, N_("_Meter"), NULL, NULL, G_CALLBACK(htmlbar_insert_form_meter_tag)},
1069 	{"MiscMenu", NULL, N_("_Misc")},
1070 	{"MiscGenMETATag", NULL, N_("Insert Generator _META-Tag"), NULL, NULL,
1071 	 G_CALLBACK(htmlbar_insert_generator_meta_tag)},
1072 	{"MiscSpan", NULL, N_("_Span"), NULL, NULL, G_CALLBACK(htmlbar_insert_span_tag)},
1073 	{"MiscDiv", NULL, N_("_Div"), NULL, NULL, G_CALLBACK(htmlbar_insert_div_tag)},
1074 	{"MiscLink", NULL, N_("_Link"), NULL, NULL, G_CALLBACK(htmlbar_insert_link_tag)},
1075 	{"MiscScript", NULL, N_("S_cript"), NULL, NULL, G_CALLBACK(htmlbar_insert_script_tag)},
1076 	{"MiscAnchor", BF_STOCK_ANCHOR, N_("_Anchor"), NULL, NULL, G_CALLBACK(htmlbar_insert_anchor_tag)},
1077 	{"MiscImage", BF_STOCK_IMAGE, N_("_Image"), NULL, NULL, G_CALLBACK(htmlbar_insert_image_tag)},
1078 	{"TagsComment", BF_STOCK_COMMENT, N_("_Comment"), "<control><alt>C", N_("HTML Comment"),
1079 	 G_CALLBACK(htmlbar_insert_html_comment)},
1080 	{"DialogsMenu", NULL, N_("Dial_ogs")},
1081 	{"DialogsGeneral", NULL, N_("_General")},
1082 	{"DialogsQuickstart", BF_STOCK_QUICKSTART, N_("_Quickstart..."), "<shift><alt>q", N_("Quickstart..."),
1083 	 G_CALLBACK(htmlbar_dialog_quickstart)},
1084 	{"DialogsLinkHeader", NULL, N_("_Link Header..."), NULL, N_("Link Header..."),
1085 	 G_CALLBACK(htmlbar_dialog_link_header)},
1086 	{"DialogsBody", BF_STOCK_BODY, N_("_Body..."), "<shift><alt>B", N_("Body..."),
1087 	 G_CALLBACK(htmlbar_dialog_body)},
1088 	{"DialogsScript", BF_STOCK_SCRIPT, N_("_Script..."), "<shift><alt>P", N_("Script..."),
1089 	 G_CALLBACK(htmlbar_dialog_script)},
1090 	{"DialogsAnchor", BF_STOCK_ANCHOR, N_("_Anchor..."), "<shift><alt>A", N_("Anchor / Hyperlink..."),
1091 	 G_CALLBACK(htmlbar_dialog_anchor)},
1092 	{"DialogsEmail", BF_STOCK_EMAIL, N_("_E-mail..."), "<shift><alt>E", N_("E-mail..."),
1093 	 G_CALLBACK(htmlbar_dialog_email)},
1094 	{"DialogsRule", BF_STOCK_HRULE, N_("_Rule..."), "<shift><alt>R", N_("Horizontal Rule..."),
1095 	 G_CALLBACK(htmlbar_dialog_rule)},
1096 	{"DialogsFont", BF_STOCK_FONT, N_("_Font..."), "<shift><alt>F", N_("Font..."),
1097 	 G_CALLBACK(htmlbar_dialog_font)},
1098 	{"DialogsFontBase", BF_STOCK_FONT_BASE, N_("Basef_ont..."), NULL, N_("Base font..."),
1099 	 G_CALLBACK(htmlbar_dialog_basefont)},
1100 	{"DialogsQuicklist", BF_STOCK_LIST, N_("Quick_list..."), "<shift><alt>L", N_("Quick List..."),
1101 	 G_CALLBACK(htmlbar_dialog_quicklist)},
1102 	{"DialogsMeta", NULL, N_("_Meta..."), "<shift><alt>M", NULL, G_CALLBACK(htmlbar_dialog_meta)},
1103 	{"DialogsEmbed", NULL, N_("Embe_d..."), NULL, NULL, G_CALLBACK(htmlbar_dialog_embed)},
1104 	{"DialogsColor", NULL, N_("Select _Color..."), NULL, NULL, G_CALLBACK(htmlbar_dialog_color)},
1105 	{"DialogsTime", NULL, N_("Insert _Time..."), NULL, NULL, G_CALLBACK(htmlbar_dialog_time)},
1106 	{"DialogsImage", BF_STOCK_IMAGE, N_("Insert _Image..."), "<shift><alt>I", N_("Insert image..."),
1107 	 G_CALLBACK(htmlbar_dialog_image)},
1108 	{"DialogsThumbnail", BF_STOCK_THUMBNAIL, N_("Insert T_humbnail..."), "<shift><alt>N",
1109 	 N_("Insert thumbnail..."),
1110 	 G_CALLBACK(htmlbar_dialog_thumbnail)},
1111 	{"DialogsTableMenu", NULL, N_("_Table")},
1112 	{"DialogsTableWizard", BF_STOCK_TABLE_WIZARD, N_("Table _Wizard..."), NULL, N_("Table Wizard..."),
1113 	 G_CALLBACK(htmlbar_dialog_table_wizard)},
1114 	{"DialogsTable", BF_STOCK_TABLE, N_("_Table..."), "<shift><alt>T", N_("Table..."),
1115 	 G_CALLBACK(htmlbar_dialog_table)},
1116 	{"DialogsTableRow", BF_STOCK_TABLE_TR, N_("Table _Row..."), NULL, N_("Table Row..."),
1117 	 G_CALLBACK(htmlbar_dialog_table_row)},
1118 	{"DialogsTableHead", BF_STOCK_TABLE_TH, N_("Table _Head..."), NULL, N_("Table Head..."),
1119 	 G_CALLBACK(htmlbar_dialog_table_head)},
1120 	{"DialogsTableData", BF_STOCK_TABLE_TD, N_("Table _Data..."), NULL, N_("Table Data..."),
1121 	 G_CALLBACK(htmlbar_dialog_table_data)},
1122 	{"DialogsCSSMenu", NULL, N_("_CSS")},
1123 	{"DialogsCreateStyle", BF_STOCK_CSSNEWSTYLE, N_("_Create Style..."), "<control><shift><alt>S",
1124 	 N_("Create stylesheet..."),
1125 	 G_CALLBACK(htmlbar_dialog_style_create)},
1126 	{"DialogsSpan", BF_STOCK_CSSSPAN, N_("S_pan..."), NULL, N_("Span..."), G_CALLBACK(htmlbar_dialog_span)},
1127 	{"DialogsDiv", BF_STOCK_CSSDIV, N_("_Div..."), "<shift><alt>D", N_("Div..."),
1128 	 G_CALLBACK(htmlbar_dialog_div)},
1129 	{"MiscStyle", BF_STOCK_CSSSTYLE, N_("_Style"), NULL, N_("Style"),
1130 	 G_CALLBACK(htmlbar_misc_style)},
1131 	{"Dialogscolumns", BF_STOCK_CSS_COLUMNS, N_("C_olumns..."), NULL, N_("Columns..."),
1132 	 G_CALLBACK(htmlbar_dialog_columns)},
1133 	{"DialogsLinkStylesheet", BF_STOCK_LINK_STYLESHEET, N_("_Link to Stylesheet..."), NULL,
1134 	 N_("Link to Stylesheet..."),
1135 	 G_CALLBACK(htmlbar_dialog_style_link_to)},
1136 	{"DialogsFrameMenu", NULL, N_("_Frame")},
1137 	{"DialogsFrameWizard", BF_STOCK_FRAME_WIZARD, N_("Frame _Wizard..."), NULL, N_("Frame Wizard..."),
1138 	 G_CALLBACK(htmlbar_dialog_frame_wizard)},
1139 	{"DialogsFrameset", BF_STOCK_FRAMESET, N_("Frame_set..."), NULL, N_("Frameset..."),
1140 	 G_CALLBACK(htmlbar_dialog_frameset)},
1141 	{"DialogsFrame", BF_STOCK_FRAME, N_("_Frame..."), NULL, N_("Frame..."), G_CALLBACK(htmlbar_dialog_frame)},
1142 	{"DialogsFormMenu", NULL, N_("F_orm")},
1143 	{"DialogsForm", BF_STOCK_FORM, N_("F_orm..."), NULL, N_("Form..."), G_CALLBACK(htmlbar_dialog_form)},
1144 	{"DialogsFormInput", NULL, N_("_Input..."), NULL, NULL, G_CALLBACK(htmlbar_dialog_form_input)},
1145 	{"DialogsFormButtons", BF_STOCK_FORM_SUBMIT, N_("Input B_uttons..."), NULL, N_("Input Button..."),
1146 	 G_CALLBACK(htmlbar_dialog_form_input_buttons)},
1147 	{"DialogsFormText", BF_STOCK_FORM_TEXT, N_("Input T_ext..."), NULL, N_("Input Text..."),
1148 	 G_CALLBACK(htmlbar_dialog_form_input_text)},
1149 	{"DialogsFormTextarea", BF_STOCK_FORM_TEXTAREA, N_("Text_area..."), NULL, N_("Textarea..."),
1150 	 G_CALLBACK(htmlbar_dialog_form_textarea)},
1151 	{"DialogsFormSelect", BF_STOCK_FORM_SELECT, N_("_Select..."), NULL, N_("Select..."),
1152 	 G_CALLBACK(htmlbar_dialog_form_select)},
1153 	{"DialogsFormOption", BF_STOCK_FORM_OPTION, N_("O_ption..."), NULL, N_("Option..."),
1154 	 G_CALLBACK(htmlbar_dialog_form_option)},
1155 	{"DialogsFormOptionGroup", BF_STOCK_FORM_OPTIONGROUP, N_("Option _Group..."), NULL, N_("Option group..."),
1156 	 G_CALLBACK(htmlbar_dialog_form_option_group)},
1157 	{"DialogsFormButton", BF_STOCK_FORM_SUBMIT, N_("_Button..."), NULL, N_("Button..."),
1158 	 G_CALLBACK(htmlbar_dialog_form_button)},
1159 	{"DialogsEditTag", BF_STOCK_EDIT_TAG, N_("_Edit tag under cursor..."), "F3", NULL,
1160 	 G_CALLBACK(htmlbar_edit_tag_under_cursor)},
1161 	{"DialogsMultiThumbnail", BF_STOCK_MULTITHUMBS, N_("_Multi Thumbnail..."), NULL, N_("Multi thumbnail..."),
1162 	 G_CALLBACK(htmlbar_dialog_multi_thumbnail)},
1163 	{"Frame", BF_STOCK_FRAME2, N_("Frame"), NULL, N_("Frame"), G_CALLBACK(htmlbar_insert_frame_tag)},
1164 	{"Frameset", BF_STOCK_FRAMESET2, N_("Frameset"), NULL, N_("Frameset"),
1165 	 G_CALLBACK(htmlbar_insert_frameset_tag)},
1166 	{"NoFrames", BF_STOCK_FRAME_NO, N_("Noframes"), NULL, N_("Noframes"),
1167 	 G_CALLBACK(htmlbar_insert_noframes_tag)},
1168 	{"FrameTarget", BF_STOCK_FRAME_BASE, N_("Target"), NULL, N_("Target"),
1169 	 G_CALLBACK(htmlbar_insert_target_tag)},
1170 	{"DialogsFormHidden", BF_STOCK_FORM_HIDDEN, N_("Input Hidden..."), NULL, N_("Input Hidden..."), G_CALLBACK(htmlbar_dialog_form_hidden)},
1171 	{"DialogsFormRadioButton", BF_STOCK_FORM_RADIO, N_("Input Radio button..."), NULL,
1172 	 N_("Input Radio Button..."), G_CALLBACK(htmlbar_dialog_form_radio_button)},
1173 	{"DialogsFormCheckBox", BF_STOCK_FORM_CHECK, N_("Input Check box..."), NULL,
1174 	 N_("Input Check Box..."), G_CALLBACK(htmlbar_dialog_form_check_box)},
1175 	{"HTML5Menu", NULL, N_("HTML_5")},
1176 	{"FormatArticle", BF_STOCK_ARTICLE, N_("_Article"), NULL, N_("Article"), G_CALLBACK(htmlbar_insert_article_tag)},
1177 	{"FormatAside", BF_STOCK_ASIDE, N_("As_ide"), NULL, N_("Aside"), G_CALLBACK(htmlbar_insert_aside_tag)},
1178 	{"FormatFigcaption", BF_STOCK_FIGCAPTION, N_("Fig_caption"), NULL, N_("Figcaption"), G_CALLBACK(htmlbar_insert_figcaption_tag)},
1179 	{"FormatFigure", BF_STOCK_FIGURE, N_("Fig_ure"), NULL, N_("Figure"), G_CALLBACK(htmlbar_insert_figure_tag)},
1180 	{"FormatFooter", BF_STOCK_FOOTER, N_("_Footer"), NULL, N_("Footer"), G_CALLBACK(htmlbar_insert_footer_tag)},
1181 	{"FormatHeader", BF_STOCK_HEADER, N_("_Header"), NULL, N_("Header"), G_CALLBACK(htmlbar_insert_header_tag)},
1182 	{"FormatHgroup", BF_STOCK_HGROUP, N_("H_group"), NULL, N_("Hgroup"), G_CALLBACK(htmlbar_insert_hgroup_tag)},
1183 	{"FormatMark", BF_STOCK_MARK, N_("_Mark"), NULL, N_("Mark"), G_CALLBACK(htmlbar_insert_mark_tag)},
1184 	{"FormatNav", BF_STOCK_NAV, N_("_Nav"), NULL, N_("Nav"), G_CALLBACK(htmlbar_insert_nav_tag)},
1185 	{"FormatRp", BF_STOCK_RP, N_("R_p"), NULL, N_("Ruby parenthesis"), G_CALLBACK(htmlbar_insert_rp_tag)},
1186 	{"FormatRt", BF_STOCK_RT, N_("R_t"), NULL, N_("Ruby text"), G_CALLBACK(htmlbar_insert_rt_tag)},
1187 	{"FormatRuby", BF_STOCK_RUBY, N_("_Ruby"), NULL, N_("Ruby"), G_CALLBACK(htmlbar_insert_ruby_tag)},
1188 	{"FormatSection", BF_STOCK_SECTION, N_("_Section"), NULL, N_("Section"), G_CALLBACK(htmlbar_insert_section_tag)},
1189 	{"DialogsHTML5Menu", NULL, N_("HTML_5")},
1190 	{"DialogsAudio", BF_STOCK_AUDIO, N_("Au_dio..."), NULL, N_("Audio..."), G_CALLBACK(htmlbar_dialog_audio)},
1191 	{"DialogsVideo", BF_STOCK_VIDEO, N_("_Video..."), NULL, N_("Video..."), G_CALLBACK(htmlbar_dialog_video)},
1192 	{"DialogsCanvas", BF_STOCK_CANVAS, N_("_Canvas..."), NULL, N_("Canvas..."), G_CALLBACK(htmlbar_dialog_canvas)},
1193 	{"DialogsHtml5Time", BF_STOCK_HTML5TIME, N_("_Time..."), NULL, N_("Time..."), G_CALLBACK(htmlbar_dialog_html5time)},
1194 	{"InsertColor", GTK_STOCK_SELECT_COLOR, N_("Insert _Color"), NULL, N_("Insert Color"), G_CALLBACK(htmlbar_insert_color)},
1195 };
1196 
1197 void
htmlbar_menu_create(Thtmlbarwin * hbw)1198 htmlbar_menu_create(Thtmlbarwin * hbw)
1199 {
1200 	Tbfwin *bfwin = hbw->bfwin;
1201 	Thtmlbarsession *hbs;
1202 
1203 	static const GtkToggleActionEntry htmlbar_toggle_actions[] = {
1204 		{"ViewHTMLToolbar", NULL, N_("_HTML Toolbar"), NULL, NULL, G_CALLBACK(htmlbar_toolbar_show_toogle),
1205 		 TRUE},
1206 	};
1207 
1208 	hbw->actiongroup = gtk_action_group_new("htmlbarActions");
1209 	gtk_action_group_set_translation_domain(hbw->actiongroup, GETTEXT_PACKAGE "_plugin_htmlbar");
1210 	gtk_action_group_add_actions(hbw->actiongroup, htmlbar_actions, G_N_ELEMENTS(htmlbar_actions), bfwin);
1211 	gtk_action_group_add_toggle_actions(hbw->actiongroup, htmlbar_toggle_actions,
1212 										G_N_ELEMENTS(htmlbar_toggle_actions), hbw);
1213 	gtk_ui_manager_insert_action_group(bfwin->uimanager, hbw->actiongroup, 0);
1214 	g_object_unref(hbw->actiongroup);
1215 	hbs = g_hash_table_lookup(htmlbar_v.lookup, bfwin->session);
1216 	if (hbs)
1217 		bfwin_set_menu_toggle_item(hbw->actiongroup, "ViewHTMLToolbar", hbs->view_htmlbar);
1218 
1219 }
1220 
1221 
1222 static GtkWidget *quickbar_create_popup_menu(gboolean add, const gchar *actionname);
1223 
1224 static gboolean
quickbar_button_press_event_lcb(GtkWidget * widget,GdkEvent * event,gpointer user_data)1225 quickbar_button_press_event_lcb(GtkWidget *widget,GdkEvent  *event,gpointer   user_data)
1226 {
1227 	if (event->button.button == 3) {
1228 		GtkWidget *p, *menu;
1229 		GtkAction *action;
1230 		p = gtk_widget_get_parent(widget);
1231 		if (!p)
1232 			return FALSE;
1233 		action = gtk_activatable_get_related_action(GTK_ACTIVATABLE(p));
1234 		if (!action)
1235 			return FALSE;
1236 		menu = quickbar_create_popup_menu(FALSE, gtk_action_get_name(action));
1237 #if GTK_CHECK_VERSION(3,22,0)
1238 		gtk_menu_popup_at_pointer(GTK_MENU(menu), NULL);
1239 #else
1240 		gtk_menu_popup(GTK_MENU(menu),NULL,NULL,NULL,NULL,3,event->button.time);
1241 #endif
1242 		return TRUE;
1243 	}
1244 	return FALSE;
1245 }
1246 
1247 
1248 static void
htmlbar_quickbar_add_item(Thtmlbarwin * hbw,const gchar * actionname)1249 htmlbar_quickbar_add_item(Thtmlbarwin * hbw, const gchar *actionname)
1250 {
1251 	GtkWidget *toolitem;
1252 	GtkAction *action;
1253 	GList *children2, *tmplist2;
1254 	action = gtk_action_group_get_action(hbw->actiongroup, actionname);
1255 	if (!action)
1256 		return;
1257 	toolitem = gtk_action_create_tool_item(action);
1258 	if (!toolitem)
1259 		return;
1260 	children2 = gtk_container_get_children(GTK_CONTAINER(toolitem));
1261 	for (tmplist2=g_list_first(children2);tmplist2;tmplist2=g_list_next(tmplist2)) {
1262 		/*g_print("have child-child %p of type %s\n", tmplist2->data, G_OBJECT_TYPE_NAME(tmplist2->data));*/
1263 		g_signal_connect(tmplist2->data, "button-press-event", G_CALLBACK(quickbar_button_press_event_lcb), hbw);
1264 	}
1265 	g_list_free(children2);
1266 
1267 	gtk_toolbar_insert(GTK_TOOLBAR(hbw->quickbar_toolbar), GTK_TOOL_ITEM(toolitem), -1);
1268 }
1269 
1270 static void
add_to_quickbar_activate_lcb(GtkMenuItem * m,gpointer data)1271 add_to_quickbar_activate_lcb(GtkMenuItem *m, gpointer data)
1272 {
1273 	GList *tmplist;
1274 	gboolean firstitem;
1275 	/* first check if it is not a duplicate */
1276 	if (find_in_stringlist(htmlbar_v.quickbar_items, (gchar *)data)) {
1277 		DEBUG_MSG("add_to_quickbar_activate_lcb, duplicate entry for %s\n",(gchar *)data);
1278 		return;
1279 	}
1280 	firstitem = (htmlbar_v.quickbar_items==NULL);
1281 
1282 	DEBUG_MSG("add_to_quickbar_activate_lcb, adding %s to quickbar_items\n", (gchar *)data);
1283 	htmlbar_v.quickbar_items = g_list_append(htmlbar_v.quickbar_items, g_strdup(data));
1284 	/* now loop over all the windows that have a htmlbar, and add the item */
1285 	for (tmplist=g_list_first(main_v->bfwinlist);tmplist;tmplist=g_list_next(tmplist)) {
1286 		Thtmlbarwin * hbw;
1287 		hbw = g_hash_table_lookup(htmlbar_v.lookup, tmplist->data);
1288 		if (hbw) {
1289 			if (firstitem) {
1290 				GList *children = gtk_container_get_children(GTK_CONTAINER(hbw->quickbar_toolbar));
1291 				if (children)
1292 					gtk_container_remove(GTK_CONTAINER(hbw->quickbar_toolbar), children->data);
1293 			}
1294 
1295 			htmlbar_quickbar_add_item(hbw, (gchar *)data);
1296 		}
1297 	}
1298 }
1299 
1300 static void
htmlbar_quickbar_remove_item(Thtmlbarwin * hbw,const gchar * actionname)1301 htmlbar_quickbar_remove_item(Thtmlbarwin * hbw, const gchar *actionname)
1302 {
1303 	GList *children, *tmplist;
1304 	children = gtk_container_get_children(GTK_CONTAINER(hbw->quickbar_toolbar));
1305 	for (tmplist=g_list_first(children);tmplist;tmplist=g_list_next(tmplist)) {
1306 /*		g_print("have child %p of type %s\n", tmplist->data, G_OBJECT_TYPE_NAME(tmplist->data));*/
1307 		GtkAction *action = gtk_activatable_get_related_action(tmplist->data);
1308 		if (action && strcmp(gtk_action_get_name(action), actionname)==0) {
1309 			gtk_container_remove(GTK_CONTAINER(hbw->quickbar_toolbar), tmplist->data);
1310 			return;
1311 		}
1312 		/*g_print("action=%p %s\n", action, action? gtk_action_get_name(action): "NULL");*/
1313 	}
1314 	g_list_free(children);
1315 }
1316 
1317 static void
remove_from_quickbar_activate_lcb(GtkMenuItem * m,gpointer data)1318 remove_from_quickbar_activate_lcb(GtkMenuItem *m, gpointer data)
1319 {
1320 	GList *tmplist;
1321 
1322 	/* now loop over all the windows that have a htmlbar, and remove the item */
1323 	for (tmplist=g_list_first(main_v->bfwinlist);tmplist;tmplist=g_list_next(tmplist)) {
1324 		Thtmlbarwin * hbw;
1325 		hbw = g_hash_table_lookup(htmlbar_v.lookup, tmplist->data);
1326 		if (hbw) {
1327 			htmlbar_quickbar_remove_item(hbw, (const gchar *)data);
1328 		}
1329 	}
1330 	DEBUG_MSG("remove_from_quickbar_activate_lcb, removing %s from quickbar_items\n", (gchar *)data);
1331 	htmlbar_v.quickbar_items = remove_from_stringlist(htmlbar_v.quickbar_items, data);
1332 }
1333 
1334 static GtkWidget *
quickbar_create_popup_menu(gboolean add,const gchar * actionname)1335 quickbar_create_popup_menu(gboolean add, const gchar *actionname)
1336 {
1337 	GtkWidget *menu, *menuitem;
1338 	menu = gtk_menu_new();
1339 	menuitem = gtk_menu_item_new_with_label(add ? _("Add to Quickbar") : _("Remove from Quickbar"));
1340 	g_signal_connect(G_OBJECT(menuitem), "activate", add ? G_CALLBACK(add_to_quickbar_activate_lcb) : G_CALLBACK(remove_from_quickbar_activate_lcb), (gpointer)actionname);
1341 	gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
1342 	gtk_widget_show_all(menu);
1343 	return menu;
1344 }
1345 
1346 static gboolean
toolbar_button_press_event_lcb(GtkWidget * widget,GdkEvent * event,gpointer user_data)1347 toolbar_button_press_event_lcb(GtkWidget *widget,GdkEvent  *event,gpointer   user_data)
1348 {
1349 	/*Thtmlbarwin * hbw=user_data;*/
1350 	DEBUG_MSG("toolbar_button_press_event_lcb, called for widget %p\n",widget);
1351 	if (event->button.button == 3) {
1352 		GtkWidget *p, *menu;
1353 		GtkAction *action;
1354 		p = gtk_widget_get_parent(widget);
1355 		if (!p)
1356 			return FALSE;
1357 		action = gtk_activatable_get_related_action(GTK_ACTIVATABLE(p));
1358 		if (!action)
1359 			return FALSE;
1360 		DEBUG_MSG("toolbar_button_press_event_lcb, add action %s \n", gtk_action_get_name(action));
1361 
1362 		menu = quickbar_create_popup_menu(TRUE, gtk_action_get_name(action));
1363 #if GTK_CHECK_VERSION(3,22,0)
1364 		gtk_menu_popup_at_pointer(GTK_MENU(menu), NULL);
1365 #else
1366 		gtk_menu_popup(GTK_MENU(menu),NULL,NULL,NULL,NULL,3,event->button.time);
1367 #endif
1368 /*		htmlbar_v.quickbar_items = g_list_prepend(htmlbar_v.quickbar_items, g_strdup(gtk_action_get_name(action)));*/
1369 		return TRUE;
1370 	}
1371 	return FALSE;
1372 }
1373 
1374 static void
htmlbar_load_quickbar(Thtmlbarwin * hbw,GtkWidget * toolbar)1375 htmlbar_load_quickbar(Thtmlbarwin * hbw, GtkWidget *toolbar)
1376 {
1377 	GList *tmplist;
1378 	if (htmlbar_v.quickbar_items == NULL) {
1379 		GtkWidget *label;
1380 		GtkToolItem *ti = gtk_tool_item_new();
1381 		label = gtk_label_new(_("Right click any html toolbar button to add it to the Quickbar."));
1382 		if (htmlbar_v.in_sidepanel) {
1383 			gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
1384 		}
1385 		gtk_container_add(GTK_CONTAINER(ti), label);
1386 		gtk_toolbar_insert(GTK_TOOLBAR(toolbar),ti,0);
1387 	}
1388 	for (tmplist=g_list_first(htmlbar_v.quickbar_items);tmplist;tmplist=g_list_next(tmplist)) {
1389 		htmlbar_quickbar_add_item(hbw, tmplist->data);
1390 	}
1391 }
1392 
1393 static void
setup_items_for_quickbar(Thtmlbarwin * hbw,GtkWidget * toolbar)1394 setup_items_for_quickbar(Thtmlbarwin * hbw, GtkWidget *toolbar)
1395 {
1396 	GList *children, *tmplist, *children2, *tmplist2;
1397 	DEBUG_MSG("setup_items_for_quickbar, about to connect signals to toolbar buttons\n");
1398 	children = gtk_container_get_children(GTK_CONTAINER(toolbar));
1399 	for (tmplist=g_list_first(children);tmplist;tmplist=g_list_next(tmplist)) {
1400 		/*g_print("have child %p of type %s\n", tmplist->data, G_OBJECT_TYPE_NAME(tmplist->data));*/
1401 		GtkAction *action = gtk_activatable_get_related_action(tmplist->data);
1402 		if (action) {
1403 			children2 = gtk_container_get_children(GTK_CONTAINER(tmplist->data));
1404 			for (tmplist2=g_list_first(children2);tmplist2;tmplist2=g_list_next(tmplist2)) {
1405 				/*g_print("have child-child %p of type %s\n", tmplist2->data, G_OBJECT_TYPE_NAME(tmplist2->data));*/
1406 				g_signal_connect(tmplist2->data, "button-press-event", G_CALLBACK(toolbar_button_press_event_lcb), hbw);
1407 			}
1408 			g_list_free(children2);
1409 		}
1410 		/*g_print("action=%p %s\n", action, action? gtk_action_get_name(action): "NULL");*/
1411 	}
1412 	g_list_free(children);
1413 }
1414 
1415 static void
notebook_switch_page_lcb(GtkNotebook * notebook,GtkWidget * page,guint page_num,gpointer user_data)1416 notebook_switch_page_lcb(GtkNotebook *notebook,GtkWidget   *page,guint        page_num,gpointer     user_data)
1417 {
1418 	Thtmlbarwin * hbw = user_data;
1419 	Thtmlbarsession *hbs;
1420 	hbs = g_hash_table_lookup(htmlbar_v.lookup, hbw->bfwin->session);
1421 	if (hbs) {
1422 		DEBUG_MSG("htmlbar notebook_switch_page_lcb, set page %d\n", page_num);
1423 		hbs->notebooktab = page_num;
1424 	}
1425 }
1426 
new_html_subtoolbar(Thtmlbarwin * hbw,GtkWidget * html_notebook,GtkWidget * toolbar,const gchar * labeltext)1427 static GtkWidget *new_html_subtoolbar(Thtmlbarwin * hbw, GtkWidget *html_notebook, GtkWidget *toolbar, const gchar *labeltext)
1428 {
1429 	GtkWidget *label;
1430 	GtkWidget *parent;
1431 	parent = gtk_widget_get_parent(toolbar);
1432 	DEBUG_MSG("new_html_subtoolbar, setup toolbar(parent=%p) %p for %s\n",parent, toolbar,labeltext);
1433 	if (parent) {
1434 		g_object_ref(toolbar);
1435 		gtk_container_remove(GTK_CONTAINER(parent), toolbar);
1436 	}
1437 
1438 
1439 	gtk_toolbar_set_style(GTK_TOOLBAR(toolbar), GTK_TOOLBAR_ICONS);
1440 #ifdef MAC_INTEGRATION
1441 #if GTK_CHECK_VERSION(3,4,0)
1442 	gtk_toolbar_set_icon_size (GTK_TOOLBAR(toolbar), GTK_ICON_SIZE_SMALL_TOOLBAR);
1443 #endif
1444 #endif
1445 	DEBUG_MSG("new_html_subtoolbar, setup orientation need_vertical=%d,need_horizontal=%d\n",htmlbar_v.in_sidepanel,!htmlbar_v.in_sidepanel);
1446 	gtk_orientable_set_orientation(GTK_ORIENTABLE(toolbar), htmlbar_v.in_sidepanel?GTK_ORIENTATION_VERTICAL:GTK_ORIENTATION_HORIZONTAL);
1447 	label = gtk_label_new(labeltext);
1448 	DEBUG_MSG("new_html_subtoolbar, append toolbar to html_notebook\n");
1449 	gtk_notebook_append_page(GTK_NOTEBOOK(html_notebook), toolbar, label);
1450 	gtk_container_child_set(GTK_CONTAINER(html_notebook), label, "tab-fill", TRUE, "tab-expand", TRUE, NULL);
1451 	DEBUG_MSG("new_html_subtoolbar, return toolbar=%p for %s\n", toolbar, labeltext);
1452 	if (parent) {
1453 		g_object_unref(toolbar);
1454 	}
1455 	return toolbar;
1456 }
1457 
1458 GtkWidget *
htmlbar_toolbar_create(Thtmlbarwin * hbw,Thtmlbarsession * hbs)1459 htmlbar_toolbar_create(Thtmlbarwin * hbw, Thtmlbarsession *hbs)
1460 {
1461 	Tbfwin *bfwin = hbw->bfwin;
1462 
1463 	GtkWidget *html_notebook;
1464 	GtkWidget *toolbar;
1465 
1466 	html_notebook = gtk_notebook_new();
1467 	DEBUG_MSG("htmlbar_toolbar_create, created notebook %p\n",html_notebook);
1468 	gtk_notebook_set_show_tabs(GTK_NOTEBOOK(html_notebook), TRUE);
1469 	gtk_notebook_set_show_border(GTK_NOTEBOOK(html_notebook), TRUE);
1470 	gtk_notebook_set_scrollable(GTK_NOTEBOOK(html_notebook), TRUE);
1471 
1472 	hbw->quickbar_toolbar = new_html_subtoolbar(hbw, html_notebook, gtk_toolbar_new(), _("Quickbar"));
1473 	htmlbar_load_quickbar(hbw, hbw->quickbar_toolbar);
1474 	DEBUG_MSG("quickbar done\n");
1475 	toolbar = new_html_subtoolbar(hbw, html_notebook, gtk_ui_manager_get_widget(bfwin->uimanager, "/HTMLStandardToolbar"), _("Standard"));
1476 
1477 	if (main_v->props.format_by_context) {
1478 		gtk_widget_destroy(gtk_ui_manager_get_widget(bfwin->uimanager, "/HTMLStandardToolbar/FormatStrong"));
1479 		gtk_widget_destroy(gtk_ui_manager_get_widget(bfwin->uimanager, "/HTMLStandardToolbar/FormatEmphasis"));
1480 	} else {
1481 		gtk_widget_destroy(gtk_ui_manager_get_widget(bfwin->uimanager, "/HTMLStandardToolbar/FormatBold"));
1482 		gtk_widget_destroy(gtk_ui_manager_get_widget(bfwin->uimanager, "/HTMLStandardToolbar/FormatItalic"));
1483 	}
1484 
1485 	DEBUG_MSG("standard created\n");
1486 	setup_items_for_quickbar(hbw, toolbar);
1487 	DEBUG_MSG("quickbar setup done\n");
1488 
1489 	toolbar = new_html_subtoolbar(hbw, html_notebook, gtk_ui_manager_get_widget(bfwin->uimanager, "/HTMLHTML5Toolbar"), _("HTML 5"));
1490 	setup_items_for_quickbar(hbw, toolbar);
1491 
1492 	toolbar = new_html_subtoolbar(hbw, html_notebook, gtk_ui_manager_get_widget(bfwin->uimanager, "/HTMLFormattingToolbar"), _("Formatting"));
1493 	setup_items_for_quickbar(hbw, toolbar);
1494 
1495 	toolbar = new_html_subtoolbar(hbw, html_notebook, gtk_ui_manager_get_widget(bfwin->uimanager, "/HTMLTablesToolbar"), _("Tables"));
1496 	setup_items_for_quickbar(hbw, toolbar);
1497 
1498 	toolbar = new_html_subtoolbar(hbw, html_notebook, gtk_ui_manager_get_widget(bfwin->uimanager, "/HTMLListToolbar"), _("List"));
1499 	setup_items_for_quickbar(hbw, toolbar);
1500 
1501 	toolbar = new_html_subtoolbar(hbw, html_notebook, gtk_ui_manager_get_widget(bfwin->uimanager, "/HTMLCSSToolbar"), _("CSS"));
1502 	setup_items_for_quickbar(hbw, toolbar);
1503 
1504 	toolbar = new_html_subtoolbar(hbw, html_notebook, gtk_ui_manager_get_widget(bfwin->uimanager, "/HTMLFormsToolbar"), _("Forms"));
1505 	setup_items_for_quickbar(hbw, toolbar);
1506 
1507 	toolbar = new_html_subtoolbar(hbw, html_notebook, gtk_ui_manager_get_widget(bfwin->uimanager, "/HTMLFontsToolbar"), _("Fonts"));
1508 	setup_items_for_quickbar(hbw, toolbar);
1509 
1510 	toolbar = new_html_subtoolbar(hbw, html_notebook, gtk_ui_manager_get_widget(bfwin->uimanager, "/HTMLFramesToolbar"), _("Frames"));
1511 	setup_items_for_quickbar(hbw, toolbar);
1512 
1513 	gtk_notebook_set_current_page(GTK_NOTEBOOK(html_notebook), hbs->notebooktab);
1514 	DEBUG_MSG("htmlbar htmlbar_toolbar_create, make page %d active\n", hbs->notebooktab);
1515 	g_signal_connect(G_OBJECT(html_notebook), "switch-page", G_CALLBACK(notebook_switch_page_lcb), hbw);
1516 
1517 	return html_notebook;
1518 }
1519 
htmlbar_load_ui(Thtmlbarwin * hbw)1520 void htmlbar_load_ui(Thtmlbarwin * hbw)
1521 {
1522 	GError *gerror=NULL;
1523 	const gchar *htmlbar_menu_ui = HTMLBAR_MENU_UI;
1524 	gtk_ui_manager_add_ui_from_file(hbw->bfwin->uimanager, htmlbar_menu_ui, &gerror);
1525 	if (gerror != NULL) {
1526 		g_warning("loading htmlbar UI from file %s failed: %s", htmlbar_menu_ui, gerror->message);
1527 		g_error_free(gerror);
1528 	}
1529 }
1530 
1531 void
htmlbar_register_stock_icons(void)1532 htmlbar_register_stock_icons(void)
1533 {
1534 	static struct {
1535 		const guint8 *data;
1536 		gchar *stock_id;
1537 	} htmlbar_stock_icons[] = {
1538 			{pixmap_abbr, BF_STOCK_ADDR},
1539 			{pixmap_acronym, BF_STOCK_ACRONYM},
1540 			{pixmap_anchor, BF_STOCK_ANCHOR},
1541 			{pixmap_body, BF_STOCK_BODY},
1542 			{pixmap_bold, BF_STOCK_BOLD},
1543 			{pixmap_brbreak, BF_STOCK_BRBREAK},
1544 			{pixmap_breakall, BF_STOCK_BREAKALL},
1545 			{pixmap_center, BF_STOCK_CENTER},
1546 			{pixmap_cite, BF_STOCK_CITE},
1547 			{pixmap_code, BF_STOCK_CODE},
1548 			{pixmap_comment, BF_STOCK_COMMENT},
1549 			{pixmap_context, BF_STOCK_CONTEXT},
1550 			{pixmap_css_small, BF_STOCK_CSS_SMALL},
1551 			{pixmap_cssdiv, BF_STOCK_CSSDIV},
1552 			{pixmap_cssnewstyle, BF_STOCK_CSSNEWSTYLE},
1553 			{pixmap_cssspan, BF_STOCK_CSSSPAN},
1554 			{pixmap_cssstyle, BF_STOCK_CSSSTYLE},
1555 			{pixmap_css_columns, BF_STOCK_CSS_COLUMNS},
1556 			{pixmap_del, BF_STOCK_DEL},
1557 			{pixmap_dfn, BF_STOCK_DFN},
1558 			{pixmap_edit_tag, BF_STOCK_EDIT_TAG},
1559 			{pixmap_email, BF_STOCK_EMAIL},
1560 			{pixmap_font_base, BF_STOCK_FONT_BASE},
1561 			{pixmap_font, BF_STOCK_FONT},
1562 			{pixmap_fonth1, BF_STOCK_FONTH1},
1563 			{pixmap_fonth2, BF_STOCK_FONTH2},
1564 			{pixmap_fonth3, BF_STOCK_FONTH3},
1565 			{pixmap_fonth4, BF_STOCK_FONTH4},
1566 			{pixmap_fonth5, BF_STOCK_FONTH5},
1567 			{pixmap_fonth6, BF_STOCK_FONTH6},
1568 			{pixmap_fontm1, BF_STOCK_FONTM1},
1569 			{pixmap_fontp1, BF_STOCK_FONTP1},
1570 			{pixmap_fontpre, BF_STOCK_FONTPRE},
1571 			{pixmap_fontsub, BF_STOCK_FONTSUB},
1572 			{pixmap_fontsuper, BF_STOCK_FONTSUPER},
1573 			{pixmap_form_check, BF_STOCK_FORM_CHECK},
1574 			{pixmap_form_hidden, BF_STOCK_FORM_HIDDEN},
1575 			{pixmap_form_option, BF_STOCK_FORM_OPTION},
1576 			{pixmap_form_optiongroup, BF_STOCK_FORM_OPTIONGROUP},
1577 			{pixmap_form_radio, BF_STOCK_FORM_RADIO},
1578 			{pixmap_form_select, BF_STOCK_FORM_SELECT},
1579 			{pixmap_form_submit, BF_STOCK_FORM_SUBMIT},
1580 			{pixmap_form_text, BF_STOCK_FORM_TEXT},
1581 			{pixmap_form_textarea, BF_STOCK_FORM_TEXTAREA},
1582 			{pixmap_form, BF_STOCK_FORM},
1583 			{pixmap_frame_base, BF_STOCK_FRAME_BASE},
1584 			{pixmap_frame_no, BF_STOCK_FRAME_NO},
1585 			{pixmap_frame, BF_STOCK_FRAME},
1586 			{pixmap_frame2, BF_STOCK_FRAME2},
1587 			{pixmap_frameset, BF_STOCK_FRAMESET},
1588 			{pixmap_frameset, BF_STOCK_FRAMESET2},
1589 			{pixmap_framewhiz, BF_STOCK_FRAME_WIZARD},
1590 			{pixmap_headings, BF_STOCK_HEADINGS},
1591 			{pixmap_hrule, BF_STOCK_HRULE},
1592 			{pixmap_image, BF_STOCK_IMAGE},
1593 			{pixmap_ins, BF_STOCK_INS},
1594 			{pixmap_italic, BF_STOCK_ITALIC},
1595 			{pixmap_kbd, BF_STOCK_KBD},
1596 			{pixmap_linkstylesheet, BF_STOCK_LINK_STYLESHEET},
1597 			{pixmap_list_dd, BF_STOCK_LIST_DD},
1598 			{pixmap_list_dl, BF_STOCK_LIST_DL},
1599 			{pixmap_list_dt, BF_STOCK_LIST_DT},
1600 			{pixmap_list_li, BF_STOCK_LIST_LI},
1601 			{pixmap_list_ol, BF_STOCK_LIST_OL},
1602 			{pixmap_list_ul, BF_STOCK_LIST_UL},
1603 			{pixmap_list, BF_STOCK_LIST},
1604 			{pixmap_multithumbs, BF_STOCK_MULTITHUMBS},
1605 			{pixmap_nbsp, BF_STOCK_NBSP},
1606 			{pixmap_paragraph, BF_STOCK_PARAGRAPH},
1607 			{pixmap_php3, BF_STOCK_PHP3},
1608 			{pixmap_quick_start, BF_STOCK_QUICKSTART},
1609 			{pixmap_right, BF_STOCK_RIGHT},
1610 			{pixmap_samp, BF_STOCK_SAMP},
1611 			{pixmap_script, BF_STOCK_SCRIPT},
1612 			{pixmap_strikeout, BF_STOCK_STRIKEOUT},
1613 			{pixmap_table_capt, BF_STOCK_TABLE_CAPTION},
1614 			{pixmap_table_td, BF_STOCK_TABLE_TD},
1615 			{pixmap_table_td2, BF_STOCK_TABLE_TD2},
1616 			{pixmap_table_th, BF_STOCK_TABLE_TH},
1617 			{pixmap_table_th2, BF_STOCK_TABLE_TH2},
1618 			{pixmap_table_tr, BF_STOCK_TABLE_TR},
1619 			{pixmap_table_tr2, BF_STOCK_TABLE_TR2},
1620 			{pixmap_table, BF_STOCK_TABLE},
1621 			{pixmap_table2, BF_STOCK_TABLE2},
1622 			{pixmap_tablewhiz, BF_STOCK_TABLE_WIZARD},
1623 			{pixmap_thumbnail, BF_STOCK_THUMBNAIL},
1624 			{pixmap_underline, BF_STOCK_UNDERLINE},
1625 			{pixmap_var, BF_STOCK_VAR},
1626 			{pixmap_article, BF_STOCK_ARTICLE},
1627 			{pixmap_aside, BF_STOCK_ASIDE},
1628 			{pixmap_figcaption, BF_STOCK_FIGCAPTION},
1629 			{pixmap_figure, BF_STOCK_FIGURE},
1630 			{pixmap_footer, BF_STOCK_FOOTER},
1631 			{pixmap_header, BF_STOCK_HEADER},
1632 			{pixmap_hgroup, BF_STOCK_HGROUP},
1633 			{pixmap_mark, BF_STOCK_MARK},
1634 			{pixmap_nav, BF_STOCK_NAV},
1635 			{pixmap_rp, BF_STOCK_RP},
1636 			{pixmap_rt, BF_STOCK_RT},
1637 			{pixmap_ruby, BF_STOCK_RUBY},
1638 			{pixmap_section, BF_STOCK_SECTION},
1639 			{pixmap_audio, BF_STOCK_AUDIO},
1640 			{pixmap_video, BF_STOCK_VIDEO},
1641 			{pixmap_canvas, BF_STOCK_CANVAS},
1642 			{pixmap_html5time, BF_STOCK_HTML5TIME},
1643 	};
1644 
1645 	GtkIconFactory *icon_factory;
1646 	GtkIconSet *icon_set;
1647 	gint i;
1648 
1649 	icon_factory = gtk_icon_factory_new();
1650 
1651 	for (i = 0; i < G_N_ELEMENTS(htmlbar_stock_icons); i++) {
1652 		GdkPixbuf *pixbuf;
1653 
1654 		pixbuf = gdk_pixbuf_new_from_inline(-1,htmlbar_stock_icons[i].data,FALSE,NULL);
1655 		icon_set = gtk_icon_set_new_from_pixbuf(pixbuf);
1656 		g_object_unref(pixbuf);
1657 
1658 		gtk_icon_factory_add(icon_factory, htmlbar_stock_icons[i].stock_id, icon_set);
1659 		gtk_icon_set_unref(icon_set);
1660 	}
1661 
1662 	gtk_icon_factory_add_default(icon_factory);
1663 
1664 	g_object_unref(icon_factory);
1665 }
1666