1 /* Bluefish HTML Editor
2 * html_table.c - table dialoges
3 *
4 * Copyright (C) 1998 Olivier Sessink and Chris Mazuc
5 * Copyright (C) 1999-2010 Olivier Sessink
6 * Copyright (C) 2011 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
22 #include <string.h>
23
24 #include "html_table.h"
25 #include "htmlbar.h"
26 #include "cap.h"
27 #include "html2.h" /* style_but_new */
28 #include "html_diag.h"
29 #include "../dialog_utils.h"
30 #include "../document.h"
31 #include "../gtk_easy.h"
32 #include "../stringlist.h"
33
34 static void
table_border_clicked_lcb(GtkWidget * checkbutton,Thtml_diag * dg)35 table_border_clicked_lcb(GtkWidget * checkbutton, Thtml_diag * dg)
36 {
37 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(checkbutton))){
38 gtk_widget_set_sensitive(dg->spin[4], FALSE);
39 gtk_widget_set_sensitive(dg->check[2], FALSE);
40 } else {
41 gtk_widget_set_sensitive(dg->spin[4], TRUE);
42 gtk_widget_set_sensitive(dg->check[2], TRUE);
43 }
44 }
45
46 static void
tabledialogok_lcb(GtkWidget * widget,Thtml_diag * dg)47 tabledialogok_lcb(GtkWidget * widget, Thtml_diag * dg)
48 {
49 gchar *thestring, *finalstring;
50
51 thestring = g_strdup(cap("<TABLE"));
52 thestring = insert_if_spin(dg->spin[1], cap("CELLPADDING"), thestring,
53 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dg->check[4])));
54 thestring = insert_if_spin(dg->spin[3], cap("CELLSPACING"), thestring,
55 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dg->check[5])));
56 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dg->check[3]))) {
57 thestring = insert_attr_if_checkbox(dg->check[3],
58 get_curlang_option_value(dg->bfwin, lang_is_XHTML) ? cap("BORDER=\"border\"") : cap("BORDER"), thestring);
59 } else { thestring = insert_if_spin(dg->spin[4], cap("BORDER"), thestring,
60 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dg->check[2])));
61 }
62 thestring = insert_string_if_combobox(GTK_COMBO_BOX(dg->combo[1]), cap("ALIGN"), thestring, NULL);
63 thestring = insert_string_if_combobox(GTK_COMBO_BOX(dg->combo[3]), cap("BGCOLOR"), thestring, NULL);
64 thestring = insert_if_spin(dg->spin[2], cap("WIDTH"), thestring,
65 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dg->check[1])));
66 thestring = insert_string_if_entry(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(dg->combo[4]))), cap("CLASS"),
67 thestring, NULL);
68 thestring = insert_string_if_entry(GTK_ENTRY(dg->entry[3]), cap("ID"), thestring, NULL);
69 thestring = insert_string_if_entry(GTK_ENTRY(dg->entry[2]), cap("STYLE"), thestring, NULL);
70 thestring = insert_string_if_combobox(GTK_COMBO_BOX(dg->combo[5]), cap("FRAME"), thestring, NULL);
71 thestring = insert_string_if_combobox(GTK_COMBO_BOX(dg->combo[6]), cap("RULES"), thestring, NULL);
72 thestring = insert_string_if_entry(GTK_ENTRY(dg->entry[1]), NULL, thestring, NULL);
73 finalstring = g_strconcat(thestring, ">", NULL);
74 g_free(thestring);
75
76 if (dg->range.end == -1) {
77 doc_insert_two_strings(dg->doc, finalstring, cap("</TABLE>"));
78 } else {
79 doc_replace_text(dg->doc, finalstring, dg->range.pos, dg->range.end);
80 }
81
82 g_free(finalstring);
83 html_diag_destroy_cb(NULL, dg);
84 }
85
86
87 void
tabledialog_dialog(Tbfwin * bfwin,Ttagpopup * data)88 tabledialog_dialog(Tbfwin * bfwin, Ttagpopup * data)
89 {
90 GList *alignlist = NULL, *popuplist = NULL;
91 GtkWidget *var_but, *dgtable;
92
93 static gchar *tagitems[] =
94 { "cellpadding", "cellspacing", "border", "align", "bgcolor", "width", "class", "style",
95 "rules", "frame", "id", NULL
96 };
97 gchar *tagvalues[13];
98 gchar *custom = NULL;
99 Thtml_diag *dg;
100
101 dg = html_diag_new(bfwin, _("Table"));
102 fill_dialogvalues(tagitems, tagvalues, &custom, (Ttagpopup *) data, dg);
103
104 dgtable = html_diag_table_in_vbox(dg, 5, 8);
105
106 dg->spin[1] = spinbut_with_value(NULL, 0, 100, 1.0, 5.0);
107 dg->check[4] = gtk_check_button_new_with_label("%");
108 dialog_mnemonic_label_in_table(_("<span color=\"#006000\">Cell _Padding:</span>"),
109 dg->spin[1], dgtable, 0, 1, 0, 1);
110 gtk_table_attach_defaults(GTK_TABLE(dgtable), dg->spin[1], 1, 2, 0, 1);
111 gtk_table_attach_defaults(GTK_TABLE(dgtable), dg->check[4], 2, 3, 0, 1);
112 /*g_print("cell padding='%s'\n",tagvalues[0]);*/
113 parse_integer_for_dialog(tagvalues[0], dg->spin[1], NULL, dg->check[4]);
114
115 dg->spin[3] = spinbut_with_value(NULL, 0, 100, 1.0, 5.0);
116 dg->check[5] = gtk_check_button_new_with_label("%");
117 dialog_mnemonic_label_in_table(_("<span color=\"#006000\">C_ell Spacing:</span>"),
118 dg->spin[3], dgtable, 0, 1, 1, 2);
119 gtk_table_attach_defaults(GTK_TABLE(dgtable), dg->spin[3], 1, 2, 1, 2);
120 gtk_table_attach_defaults(GTK_TABLE(dgtable), dg->check[5], 2, 3, 1, 2);
121 parse_integer_for_dialog(tagvalues[1], dg->spin[3], NULL, dg->check[5]);
122
123 dg->entry[3] = dialog_entry_in_table(tagvalues[10], dgtable, 4, 5, 1, 2);
124 dialog_mnemonic_label_in_table(_("_Id:"), dg->entry[3], dgtable, 3, 4, 1, 2);
125
126 dg->combo[4] = html_diag_combobox_with_popdown_sized(tagvalues[6], bfwin->session->classlist, 1, 90);
127 dialog_mnemonic_label_in_table(_("Cl_ass:"), dg->combo[4], dgtable, 0, 1, 2, 3);
128 gtk_table_attach_defaults(GTK_TABLE(dgtable), dg->combo[4], 1, 2, 2, 3);
129
130 dg->entry[2] = dialog_entry_in_table(tagvalues[7], dgtable, 1, 4, 3, 4);
131 dialog_mnemonic_label_in_table(_("St_yle:"), dg->entry[2], dgtable, 0, 1, 3, 4);
132 var_but = style_but_new(dg->entry[2], dg->dialog);
133 gtk_table_attach_defaults(GTK_TABLE(dgtable), var_but, 4, 5, 3, 4);
134
135 dg->entry[1] = dialog_entry_in_table(custom, dgtable, 1, 5, 4, 5);
136 dialog_mnemonic_label_in_table(_("Custo_m:"), dg->entry[1], dgtable, 0, 1, 4, 5);
137
138 alignlist = g_list_append(NULL, "");
139 alignlist = g_list_append(alignlist, "left");
140 alignlist = g_list_append(alignlist, "right");
141 alignlist = g_list_append(alignlist, "center");
142 dg->combo[1] = html_diag_combobox_with_popdown_sized(tagvalues[3], alignlist, 0, 90);
143 g_list_free(alignlist);
144 dialog_mnemonic_label_in_table(_("<span color=\"#006000\">_Align:</span>"), dg->combo[1], dgtable, 3, 4, 0, 1);
145 gtk_table_attach_defaults(GTK_TABLE(dgtable), dg->combo[1], 4, 5, 0, 1);
146
147 dg->combo[3] = html_diag_combobox_with_popdown_sized(tagvalues[4], bfwin->session->colorlist, 1, 90);
148 var_but = color_but_new(gtk_bin_get_child(GTK_BIN(dg->combo[3])), dg->dialog);
149 dialog_mnemonic_label_in_table(_("<span color=\"red\">_bgcolor:</span>"), dg->combo[3], dgtable, 2, 3, 2, 3);
150 gtk_table_attach_defaults(GTK_TABLE(dgtable), dg->combo[3], 3, 4, 2, 3);
151 gtk_table_attach_defaults(GTK_TABLE(dgtable), var_but, 4, 5, 2, 3);
152
153 dg->spin[2] = spinbut_with_value(NULL, 0, 10000, 1.0, 5.0);
154 dg->check[1] = gtk_check_button_new_with_label("%");
155 dialog_mnemonic_label_in_table(_("<span color=\"#006000\">_Width:</span>"), dg->spin[2], dgtable, 5, 6, 0, 1);
156 gtk_table_attach_defaults(GTK_TABLE(dgtable), dg->spin[2], 6, 7, 0, 1);
157 gtk_table_attach_defaults(GTK_TABLE(dgtable), dg->check[1], 7, 8, 0, 1);
158 parse_integer_for_dialog(tagvalues[5], dg->spin[2], NULL, dg->check[1]);
159
160 dg->spin[4] = spinbut_with_value(NULL, 0, 100, 1.0, 5.0);
161 dg->check[2] = gtk_check_button_new_with_label("%");
162 dialog_mnemonic_label_in_table(_("<span color=\"#006000\">Bo_rder:</span>"), dg->spin[4], dgtable, 5, 6, 1, 2);
163 gtk_table_attach_defaults(GTK_TABLE(dgtable), dg->spin[4], 6, 7, 1, 2);
164 gtk_table_attach_defaults(GTK_TABLE(dgtable), dg->check[2], 7, 8, 1, 2);
165 parse_integer_for_dialog(tagvalues[2], dg->spin[4], NULL, dg->check[2]);
166
167 dg->check[3] = gtk_check_button_new();
168 dialog_mnemonic_label_in_table(_("<span color=\"#A36A00\">_Border:</span>"), dg->check[3], dgtable, 5,6, 2,3);
169 g_signal_connect(dg->check[3], "clicked", G_CALLBACK(table_border_clicked_lcb), dg);
170 gtk_table_attach_defaults(GTK_TABLE(dgtable), dg->check[3], 6,7, 2,3);
171
172 popuplist = g_list_append(NULL, "");
173 popuplist = g_list_append(popuplist, "void");
174 popuplist = g_list_append(popuplist, "above");
175 popuplist = g_list_append(popuplist, "below");
176 popuplist = g_list_append(popuplist, "hsides");
177 popuplist = g_list_append(popuplist, "vsides");
178 popuplist = g_list_append(popuplist, "lhs");
179 popuplist = g_list_append(popuplist, "rhs");
180 popuplist = g_list_append(popuplist, "box");
181 popuplist = g_list_append(popuplist, "border");
182 dg->combo[5] = html_diag_combobox_with_popdown_sized(tagvalues[9], popuplist, 0, 90);
183 dialog_mnemonic_label_in_table(_("<span color=\"#006000\">_Frame:</span>"), dg->combo[5], dgtable, 5, 6, 3, 4);
184 gtk_table_attach_defaults(GTK_TABLE(dgtable), dg->combo[5], 6, 8, 3, 4);
185 g_list_free(popuplist);
186
187 popuplist = g_list_append(NULL, "");
188 popuplist = g_list_append(popuplist, "none");
189 popuplist = g_list_append(popuplist, "groups");
190 popuplist = g_list_append(popuplist, "rows");
191 popuplist = g_list_append(popuplist, "cols");
192 popuplist = g_list_append(popuplist, "all");
193 dg->combo[6] = html_diag_combobox_with_popdown_sized(tagvalues[8], popuplist, 0, 90);
194 dialog_mnemonic_label_in_table(_("<span color=\"#006000\">R_ules:</span>"), dg->combo[6], dgtable, 5, 6, 4, 5);
195 gtk_table_attach_defaults(GTK_TABLE(dgtable), dg->combo[6], 6, 8, 4, 5);
196 g_list_free(popuplist);
197
198 html_diag_finish(dg, G_CALLBACK(tabledialogok_lcb));
199
200 if (custom)
201 g_free(custom);
202 }
203
204 static void
tablerowdialogok_lcb(GtkWidget * widget,Thtml_diag * dg)205 tablerowdialogok_lcb(GtkWidget * widget, Thtml_diag * dg)
206 {
207 gchar *thestring, *finalstring;
208
209 thestring = g_strdup(cap("<TR"));
210 thestring = insert_string_if_combobox(GTK_COMBO_BOX(dg->combo[1]), cap("ALIGN"), thestring, NULL);
211 thestring = insert_string_if_combobox(GTK_COMBO_BOX(dg->combo[2]), cap("VALIGN"), thestring, NULL);
212 thestring = insert_string_if_combobox(GTK_COMBO_BOX(dg->combo[3]), cap("BGCOLOR"), thestring, NULL);
213 thestring = insert_string_if_combobox(GTK_COMBO_BOX(dg->combo[4]), cap("CLASS"), thestring, NULL);
214 thestring = insert_string_if_entry(GTK_ENTRY(dg->entry[2]), cap("STYLE"), thestring, NULL);
215 thestring = insert_string_if_entry(GTK_ENTRY(dg->entry[1]), NULL, thestring, NULL);
216
217 finalstring = g_strconcat(thestring, ">", NULL);
218 g_free(thestring);
219
220 if (dg->range.end == -1) {
221 doc_insert_two_strings(dg->doc, finalstring, cap("</TR>"));
222 } else {
223 doc_replace_text(dg->doc, finalstring, dg->range.pos, dg->range.end);
224 }
225 g_free(finalstring);
226 html_diag_destroy_cb(NULL, dg);
227 }
228
229
230 void
tablerowdialog_dialog(Tbfwin * bfwin,Ttagpopup * data)231 tablerowdialog_dialog(Tbfwin * bfwin, Ttagpopup * data)
232 {
233 GList *alignlist = NULL;
234 GtkWidget *color_but, *var_but;
235
236 static gchar *tagitems[] = { "align", "valign", "bgcolor", "class", "style", NULL };
237 gchar *tagvalues[6];
238 gchar *custom = NULL;
239 Thtml_diag *dg;
240 GtkWidget *dgtable;
241
242 dg = html_diag_new(bfwin, _("Table Row"));
243 fill_dialogvalues(tagitems, tagvalues, &custom, (Ttagpopup *) data, dg);
244
245 dgtable = html_diag_table_in_vbox(dg, 4, 5);
246
247 alignlist = g_list_append(NULL, "");
248 alignlist = g_list_insert(alignlist, "left", 0);
249 alignlist = g_list_insert(alignlist, "right", 1);
250 alignlist = g_list_insert(alignlist, "center", 2);
251 dg->combo[1] = html_diag_combobox_with_popdown_sized(tagvalues[0], alignlist, 0, 90);
252 g_list_free(alignlist);
253 dialog_mnemonic_label_in_table(_("<span color=\"#006000\">_Align:</span>"), dg->combo[1], dgtable, 0, 1, 0, 1);
254 gtk_table_attach_defaults(GTK_TABLE(dgtable), GTK_WIDGET(dg->combo[1]), 1, 2, 0, 1);
255
256 alignlist = g_list_append(NULL, "");
257 alignlist = g_list_insert(alignlist, "top", 0);
258 alignlist = g_list_insert(alignlist, "middle", 1);
259 alignlist = g_list_insert(alignlist, "bottom", 2);
260 alignlist = g_list_insert(alignlist, "baseline", 3);
261 dg->combo[2] = html_diag_combobox_with_popdown_sized(tagvalues[1], alignlist, 0, 90);
262 g_list_free(alignlist);
263
264 dialog_mnemonic_label_in_table(_("<span color=\"#006000\">_Valign:</span>"), dg->combo[2], dgtable, 0, 1, 1, 2);
265 gtk_table_attach_defaults(GTK_TABLE(dgtable), GTK_WIDGET(GTK_BIN(dg->combo[2])), 1, 2, 1, 2);
266
267 dg->combo[4] = html_diag_combobox_with_popdown_sized(tagvalues[3], bfwin->session->classlist, 1, 90);
268 dialog_mnemonic_label_in_table(_("Cl_ass:"), dg->combo[4], dgtable, 2, 3, 0, 1);
269 gtk_table_attach_defaults(GTK_TABLE(dgtable), dg->combo[4], 3, 5, 0, 1);
270
271 dg->combo[3] = html_diag_combobox_with_popdown_sized(tagvalues[2], bfwin->session->colorlist, 1, 90);
272 color_but = color_but_new(gtk_bin_get_child(GTK_BIN(dg->combo[3])), dg->dialog);
273 dialog_mnemonic_label_in_table(_("<span color=\"red\">_bgcolor:</span>"), dg->combo[3], dgtable, 2, 3, 1, 2);
274 gtk_table_attach_defaults(GTK_TABLE(dgtable), GTK_WIDGET(GTK_BIN(dg->combo[3])), 3, 4, 1, 2);
275 gtk_table_attach_defaults(GTK_TABLE(dgtable), GTK_WIDGET(color_but), 4, 5, 1, 2);
276
277 dg->entry[2] = dialog_entry_in_table(tagvalues[4], dgtable, 1, 4, 2, 3);
278 dialog_mnemonic_label_in_table(_("St_yle:"), dg->entry[2], dgtable, 0, 1, 2, 3);
279 var_but = style_but_new(dg->entry[2], dg->dialog);
280 gtk_table_attach_defaults(GTK_TABLE(dgtable), var_but, 4, 5, 2, 3);
281
282 dg->entry[1] = dialog_entry_in_table(custom, dgtable, 1, 5, 3, 4);
283 dialog_mnemonic_label_in_table(_("Custo_m:"), dg->entry[1], dgtable, 0, 1, 3, 4);
284
285 html_diag_finish(dg, G_CALLBACK(tablerowdialogok_lcb));
286
287 if (custom)
288 g_free(custom);
289 }
290
291 static void
table_head_and_data_dialogok_lcb(gint type,GtkWidget * widget,Thtml_diag * dg)292 table_head_and_data_dialogok_lcb(gint type, GtkWidget * widget, Thtml_diag * dg)
293 {
294
295 gchar *thestring, *finalstring;
296
297 if (type == 1) {
298 thestring = g_strdup(cap("<TD"));
299 } else {
300 thestring = g_strdup(cap("<TH"));
301 thestring = insert_string_if_combobox(GTK_COMBO_BOX(dg->combo[5]), cap("SCOPE"), thestring, NULL);
302 }
303 thestring = insert_string_if_entry(GTK_ENTRY(dg->entry[3]), cap("HEADERS"), thestring, NULL);
304 thestring = insert_integer_if_spin(dg->spin[5], cap("COLSPAN"), thestring, FALSE, 0);
305 thestring = insert_integer_if_spin(dg->spin[4], cap("ROWSPAN"), thestring, FALSE, 0);
306 thestring = insert_string_if_combobox(GTK_COMBO_BOX(dg->combo[4]), cap("CLASS"), thestring, NULL);
307 thestring = insert_string_if_entry(GTK_ENTRY(dg->entry[2]), cap("STYLE"), thestring, NULL);
308 thestring = insert_integer_if_spin(dg->spin[1], cap("WIDTH"), thestring,
309 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dg->check[2])), 0);
310 thestring = insert_integer_if_spin(dg->spin[3], cap("HEIGHT"), thestring,
311 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dg->check[3])), 0);
312 thestring = insert_string_if_combobox(GTK_COMBO_BOX(dg->combo[1]), cap("ALIGN"), thestring, NULL);
313 thestring = insert_string_if_combobox(GTK_COMBO_BOX(dg->combo[2]), cap("VALIGN"), thestring, NULL);
314 thestring = insert_string_if_combobox(GTK_COMBO_BOX(dg->combo[3]), cap("BGCOLOR"), thestring, NULL);
315 thestring = insert_attr_if_checkbox(dg->check[1],
316 get_curlang_option_value(dg->bfwin, lang_is_XHTML) ? cap("NOWRAP=\"nowrap\"") : cap("NOWRAP"), thestring);
317 thestring = insert_string_if_entry(GTK_ENTRY(dg->entry[1]), NULL, thestring, NULL);
318 finalstring = g_strconcat(thestring, ">", NULL);
319 g_free(thestring);
320
321 if (dg->range.end == -1) {
322 if (type == 1) {
323 doc_insert_two_strings(dg->doc, finalstring, cap("</TD>"));
324 } else {
325 doc_insert_two_strings(dg->doc, finalstring, cap("</TH>"));
326 }
327 } else {
328 doc_replace_text(dg->doc, finalstring, dg->range.pos, dg->range.end);
329 }
330 g_free(finalstring);
331 html_diag_destroy_cb(NULL, dg);
332 }
333
334 static void
tabledatadialogok_lcb(GtkWidget * widget,Thtml_diag * dg)335 tabledatadialogok_lcb(GtkWidget * widget, Thtml_diag * dg)
336 {
337 table_head_and_data_dialogok_lcb(1, widget, dg);
338 }
339
340 static void
tableheaddialogok_lcb(GtkWidget * widget,Thtml_diag * dg)341 tableheaddialogok_lcb(GtkWidget * widget, Thtml_diag * dg)
342 {
343 table_head_and_data_dialogok_lcb(0, widget, dg);
344 }
345
346 static void
table_head_and_data_dialog_cb(gint type,Tbfwin * bfwin,Ttagpopup * data)347 table_head_and_data_dialog_cb(gint type, Tbfwin * bfwin, Ttagpopup * data)
348 {
349 GList *alignlist = NULL;
350
351 static gchar *tagitems[] =
352 { "width", "align", "colspan", "height", "valign", "rowspan", "bgcolor", "nowrap", "class", "style",
353 "headers", "scope", NULL
354 };
355 gchar *tagvalues[12];
356 gchar *custom = NULL;
357 Thtml_diag *dg;
358 GtkWidget *dgtable, *var_but;
359
360 if (type == 1) {
361 dg = html_diag_new(bfwin, _("Table Data"));
362 } else {
363 dg = html_diag_new(bfwin, _("Table Header"));
364 }
365
366 fill_dialogvalues(tagitems, tagvalues, &custom, (Ttagpopup *) data, dg);
367
368 dgtable = html_diag_table_in_vbox(dg, 6, 7);
369
370 alignlist = g_list_append(NULL, "");
371 alignlist = g_list_insert(alignlist, "left", 0);
372 alignlist = g_list_insert(alignlist, "right", 1);
373 alignlist = g_list_insert(alignlist, "center", 2);
374 alignlist = g_list_insert(alignlist, "justify", 3);
375 dg->combo[1] = html_diag_combobox_with_popdown_sized(tagvalues[1], alignlist, 0, 90);
376 g_list_free(alignlist);
377 dialog_mnemonic_label_in_table(_("<span color=\"#006000\">_Align:</span>"), dg->combo[1], dgtable, 2, 3, 0, 1);
378 gtk_table_attach_defaults(GTK_TABLE(dgtable), GTK_WIDGET(GTK_BIN(dg->combo[1])), 3, 4, 0, 1);
379
380 alignlist = g_list_append(NULL, "");
381 alignlist = g_list_insert(alignlist, "top", 0);
382 alignlist = g_list_insert(alignlist, "middle", 1);
383 alignlist = g_list_insert(alignlist, "bottom", 2);
384 alignlist = g_list_insert(alignlist, "baseline", 3);
385 dg->combo[2] = html_diag_combobox_with_popdown_sized(tagvalues[4], alignlist, 0, 90);
386 g_list_free(alignlist);
387
388 dialog_mnemonic_label_in_table(_("<span color=\"#006000\">_Valign:</span>"), dg->combo[2], dgtable, 2, 3, 1, 2);
389 gtk_table_attach_defaults(GTK_TABLE(dgtable), GTK_WIDGET(GTK_BIN(dg->combo[2])), 3, 4, 1, 2);
390
391 dg->combo[4] = html_diag_combobox_with_popdown_sized(tagvalues[8], bfwin->session->classlist, 1, 90);
392 dialog_mnemonic_label_in_table(_("Cl_ass:"), dg->combo[4], dgtable, 0, 1, 2, 3);
393 gtk_table_attach_defaults(GTK_TABLE(dgtable), GTK_WIDGET(GTK_BIN(dg->combo[4])), 1, 2, 2, 3);
394
395 dg->entry[3] = dialog_entry_in_table(tagvalues[10], dgtable, 1, 4, 3, 4);
396 dialog_mnemonic_label_in_table(_("<span color=\"#A36A00\">_Headers:</span>"), dg->entry[3], dgtable, 0, 1, 3, 4);
397 gtk_widget_set_tooltip_text(dg->entry[3],_("Set of space-separated IDs of th elements."));
398
399 if (type == 0) {
400 alignlist = g_list_append(NULL, "");
401 alignlist = g_list_insert(alignlist, "row", 0);
402 alignlist = g_list_insert(alignlist, "col", 1);
403 alignlist = g_list_insert(alignlist, "rowgroup", 2);
404 alignlist = g_list_insert(alignlist, "colgroup", 3);
405 alignlist = g_list_insert(alignlist, "auto", 4);
406 dg->combo[5] = html_diag_combobox_with_popdown_sized(tagvalues[11], alignlist, 0, 90);
407 g_list_free(alignlist);
408 dialog_mnemonic_label_in_table(_("<span color=\"#A36A00\">_Scope:</span>"), dg->combo[5], dgtable, 4, 5, 3, 4);
409 gtk_table_attach_defaults(GTK_TABLE(dgtable), GTK_WIDGET(GTK_BIN(dg->combo[5])), 5, 6, 3, 4);
410 gtk_widget_set_tooltip_text(dg->combo[5],_("the header cell applies to cells in the same:"));
411 }
412
413 dg->entry[2] = dialog_entry_in_table(tagvalues[9], dgtable, 1, 6, 4, 5);
414 dialog_mnemonic_label_in_table(_("St_yle:"), dg->entry[2], dgtable, 0, 1, 4, 5);
415 var_but = style_but_new(dg->entry[2], dg->dialog);
416 gtk_table_attach_defaults(GTK_TABLE(dgtable), var_but, 6, 7, 4, 5);
417
418 dg->entry[1] = dialog_entry_in_table(custom, dgtable, 1, 7, 5,6);
419 dialog_mnemonic_label_in_table(_("Custo_m:"), dg->entry[1], dgtable, 0, 1, 5, 6);
420
421 dg->spin[5] = spinbut_with_value(tagvalues[2], 0, 100, 1.0, 2.0);
422 dialog_mnemonic_label_in_table(_("Co_l Span:"), dg->spin[5], dgtable, 0, 1, 0, 1);
423 gtk_table_attach_defaults(GTK_TABLE(dgtable), dg->spin[5], 1, 2, 0, 1);
424
425 dg->spin[4] = spinbut_with_value(tagvalues[5], 0, 100, 1.0, 5.0);
426 dialog_mnemonic_label_in_table(_("_Row Span:"), dg->spin[4], dgtable, 0, 1, 1, 2);
427 gtk_table_attach_defaults(GTK_TABLE(dgtable), dg->spin[4], 1, 2, 1, 2);
428
429 dg->check[1] = gtk_check_button_new();
430 parse_existence_for_dialog(tagvalues[7], dg->check[1]);
431 dialog_mnemonic_label_in_table(_("<span color=\"red\">No _Wrap:</span>"), dg->check[1], dgtable, 2, 3, 2, 3);
432 gtk_table_attach_defaults(GTK_TABLE(dgtable), dg->check[1], 3, 4, 2, 3);
433
434 dg->spin[1] = spinbut_with_value(NULL, 0, 10000, 1.0, 5.0);
435 dg->check[2] = gtk_check_button_new_with_label("%");
436 parse_integer_for_dialog(tagvalues[0], dg->spin[1], NULL, dg->check[2]);
437 dialog_mnemonic_label_in_table(_("<span color=\"red\">_Width:</span>"), dg->spin[1], dgtable, 4, 5, 0, 1);
438 gtk_table_attach_defaults(GTK_TABLE(dgtable), dg->spin[1], 5, 6, 0, 1);
439 gtk_table_attach_defaults(GTK_TABLE(dgtable), dg->check[2], 6, 7, 0, 1);
440
441 dg->spin[3] = spinbut_with_value(NULL, 0, 10000, 1.0, 5.0);
442 dg->check[3] = gtk_check_button_new_with_label("%");
443 parse_integer_for_dialog(tagvalues[3], dg->spin[3], NULL, dg->check[3]);
444 dialog_mnemonic_label_in_table(_("<span color=\"red\">_Height:</span>"), dg->spin[3], dgtable, 4, 5, 1, 2);
445 gtk_table_attach_defaults(GTK_TABLE(dgtable), dg->spin[3], 5, 6, 1, 2);
446 gtk_table_attach_defaults(GTK_TABLE(dgtable), dg->check[3], 6, 7, 1, 2);
447
448 dg->combo[3] = html_diag_combobox_with_popdown_sized(tagvalues[6], bfwin->session->colorlist, 1, 90);
449 dialog_mnemonic_label_in_table(_("<span color=\"red\">_bgcolor:</span>"), dg->combo[3], dgtable, 4, 5, 2, 3);
450 gtk_table_attach_defaults(GTK_TABLE(dgtable), GTK_WIDGET(GTK_BIN(dg->combo[3])), 5, 6, 2, 3);
451 gtk_table_attach_defaults(GTK_TABLE(dgtable),
452 GTK_WIDGET(color_but_new(gtk_bin_get_child(GTK_BIN(dg->combo[3])), dg->dialog)),
453 6, 7, 2, 3);
454
455 if (type == 1) {
456 html_diag_finish(dg, G_CALLBACK(tabledatadialogok_lcb));
457 } else {
458 html_diag_finish(dg, G_CALLBACK(tableheaddialogok_lcb));
459 }
460
461 if (custom)
462 g_free(custom);
463 }
464
465 void
tabledatadialog_dialog(Tbfwin * bfwin,Ttagpopup * data)466 tabledatadialog_dialog(Tbfwin * bfwin, Ttagpopup * data)
467 {
468 table_head_and_data_dialog_cb(1, bfwin, data);
469 }
470
471 void
tableheaddialog_dialog(Tbfwin * bfwin,Ttagpopup * data)472 tableheaddialog_dialog(Tbfwin * bfwin, Ttagpopup * data)
473 {
474 table_head_and_data_dialog_cb(0, bfwin, data);
475 }
476