static void table_wizard_ok_lcb(GtkWidget * widget, Thtml_diag *dg) { gint rows, cols; gchar *tablerowstart, *rowdata, *tablerow, *tablecontent, *finalstring; /* gtk forces the value of one if nothing is entered */ rows = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(dg->spin[1])); cols = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(dg->spin[2])); if (GTK_TOGGLE_BUTTON(dg->check[1])->active) { if (GTK_TOGGLE_BUTTON(dg->check[2])->active) { tablerowstart = cap("\t<TR>"); } else { tablerowstart = cap("<TR>"); } rowdata = bf_str_repeat(cap("<TD></TD>"), cols); } else { tablerowstart = cap("<TR>\n"); if (GTK_TOGGLE_BUTTON(dg->check[2])->active) { rowdata = bf_str_repeat(cap("\t<TD></TD>\n"), cols); } else { rowdata = bf_str_repeat(cap("<TD></TD>\n"), cols); } } tablerow = g_strconcat(tablerowstart, rowdata, cap("</TR>\n"), NULL); g_free(rowdata); tablecontent = bf_str_repeat(tablerow, rows); g_free(tablerow); finalstring = g_strconcat(cap("<TABLE>\n"), tablecontent, cap("</TABLE>"), NULL); g_free(tablecontent); doc_insert_two_strings(dg->bfwin->current_document, finalstring, NULL); g_free(finalstring); html_diag_destroy_cb(NULL, dg); }
void html_diag_cancel_clicked_cb(GtkWidget * widget, gpointer data) { html_diag_destroy_cb(NULL, data); }
static void frame_wizard_ok_lcb(GtkWidget * widget, Thtml_diag *dg) { gchar *title, *thestring, *frameset, *frames, *sizes, *dtd, *finalstring; gint i, count; gboolean need_comma=FALSE; if (GTK_TOGGLE_BUTTON(dg->check[0])->active) { dtd = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Frameset//EN\"\n\t\"http://www.w3.org/TR/html4/frameset.dtd\">"; } else { dtd = ""; } title = gtk_editable_get_chars(GTK_EDITABLE(dg->entry[12]), 0, -1); thestring = g_strconcat(dtd , cap("<HTML>\n<HEAD>\n<TITLE>") , title , cap("</TITLE>\n</HEAD>\n"), NULL); g_free(title); count = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(dg->spin[1])); frames = g_strdup(""); sizes = g_strdup(""); for (i = 0; i < count ; i++) { gchar *tmpstr, *size, *name, *source; size = gtk_editable_get_chars(GTK_EDITABLE(dg->entry[i]), 0, -1); name = gtk_editable_get_chars(GTK_EDITABLE(GTK_COMBO(dg->combo[i])->entry), 0, -1); source = gtk_editable_get_chars(GTK_EDITABLE(GTK_COMBO(dg->combo[i+5])->entry), 0, -1); if (main_v->props.xhtml == 1) { tmpstr = g_strconcat(frames, cap("<FRAME NAME=\""), name, cap("\" SRC=\""), source, "\" />\n", NULL); } else { tmpstr = g_strconcat(frames, cap("<FRAME NAME=\""), name, cap("\" SRC=\""), source, "\">\n", NULL); } g_free(frames); frames = tmpstr; if (need_comma) { tmpstr = g_strconcat(sizes, ",", size, NULL); } else { tmpstr = g_strconcat(sizes, size, NULL); } g_free(sizes); sizes = tmpstr; need_comma = TRUE; g_free(size); g_free(name); g_free(source); } if (GTK_TOGGLE_BUTTON(dg->radio[1])->active) { frameset = g_strconcat(cap("<FRAMESET COLS=\""), sizes, "\">\n", NULL); } else { frameset = g_strconcat(cap("<FRAMESET ROWS=\""), sizes, "\">\n", NULL); } finalstring = g_strconcat(thestring, frameset, frames, cap("<NOFRAMES>\n\n</NOFRAMES>\n</FRAMESET>\n</HTML>"), NULL); g_free(sizes); g_free(frameset); g_free(frames); g_free(thestring); doc_insert_two_strings(dg->bfwin->current_document, finalstring, NULL); g_free(finalstring); html_diag_destroy_cb(NULL, dg); }