/** * erwin - really simple html editor * Copyright (C) 1999 David Vogler * Copyright (C) 1999-2002 Adrian Reber * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * $Id: erwinnotebook.c,v 1.7 2005/01/19 20:58:51 adrian Exp $ * * $Author: adrian $ * * Description: notebook creation * * $Log: erwinnotebook.c,v $ * Revision 1.7 2005/01/19 20:58:51 adrian * fix compile error * * Revision 1.6 2004/06/21 21:45:19 erwin * big commit * it has been a long time without a checkout * we are close to version 0.7 * * Revision 1.5 2004/03/11 21:05:01 erwin * too many changes without commits * */ #ifndef lint static const char vcid[] = "$Id: erwinnotebook.c,v 1.7 2005/01/19 20:58:51 adrian Exp $"; #endif /* lint */ #include #include #include #include GtkWidget *html_notebook(GtkWidget * main_window, GtkWidget * box) { GtkWidget *notebook; GtkWidget *label; GtkWidget *toolbar; notebook = gtk_notebook_new(); gtk_box_pack_start(GTK_BOX(box), notebook, FALSE, FALSE, 0); gtk_notebook_set_tab_pos(GTK_NOTEBOOK(notebook), GTK_POS_TOP); label = gtk_label_new("HTML"); gtk_widget_show(label); toolbar = html_toolbar(main_window); gtk_widget_show(toolbar); gtk_notebook_append_page(GTK_NOTEBOOK(notebook), toolbar, label); label = gtk_label_new("Fonts"); gtk_widget_show(label); toolbar = font_toolbar(main_window); gtk_widget_show(toolbar); gtk_notebook_append_page(GTK_NOTEBOOK(notebook), toolbar, label); label = gtk_label_new("Tables/Lists"); gtk_widget_show(label); toolbar = table_toolbar(main_window); gtk_widget_show(toolbar); gtk_notebook_append_page(GTK_NOTEBOOK(notebook), toolbar, label); gtk_signal_connect(GTK_OBJECT(notebook), "switch_page", GTK_SIGNAL_FUNC(switch_html_page), NULL); return notebook; } GtkWidget *text_notebook(GtkWidget * target_box, struct document * document) { GtkWidget *notebook; GtkWidget *button; GtkWidget *image; GtkWidget *scrollbar; GtkWidget *text_box; GtkWidget *label_box; notebook = gtk_notebook_new(); gtk_box_pack_start(GTK_BOX(target_box), notebook, TRUE, TRUE, 4); gtk_notebook_set_tab_pos(GTK_NOTEBOOK(notebook), GTK_POS_BOTTOM); label_box = gtk_hbox_new(FALSE, FALSE); text_box = gtk_hbox_new(FALSE, FALSE); scrollbar = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrollbar), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_container_add(GTK_CONTAINER(scrollbar), document->text_view); document->notebook_child = text_box; gtk_box_pack_start(GTK_BOX(document->notebook_child), scrollbar, TRUE, TRUE, 0); gtk_widget_show(scrollbar); gtk_widget_show(text_box); document->notebook_label = gtk_label_new("Untitled"); gtk_widget_show(document->notebook_label); gtk_box_pack_start(GTK_BOX(label_box), document->notebook_label, TRUE, TRUE, 0); button = gtk_button_new(); image = gtk_image_new_from_stock(GTK_STOCK_CLOSE, GTK_ICON_SIZE_MENU); gtk_container_add(GTK_CONTAINER(button), image); gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); gtk_widget_show(image); gtk_widget_show(button); gtk_box_pack_start(GTK_BOX(label_box), button, TRUE, TRUE, 0); gtk_widget_show(label_box); gtk_notebook_append_page(GTK_NOTEBOOK(notebook), text_box, label_box); document->nr_of_notebook_child = nr_of_documents = 0; document->notebook = notebook; document->changed = FALSE; document->saved = FALSE; document->close_file = FALSE; gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(close_file), &document->nr_of_notebook_child); _DEBUG_ fprintf(stderr, "%s:%s:%d\n", PACKAGE, __FILE__, __LINE__); return notebook; }