/** * erwin - really simple html editor * Copyright (C) 1999-2003 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: erwinmenu.c,v 1.17 2005/03/25 18:45:09 adrian Exp $ * * $Author: adrian $ * * Description: creating the menus * * $Log: erwinmenu.c,v $ * Revision 1.17 2005/03/25 18:45:09 adrian * add menu entry to view html pages rendered * * Revision 1.16 2004/09/23 20:22:46 erwin * attempt to clone the searchbar from firefox. so far so good. * * Revision 1.15 2004/07/03 20:14:25 erwin * commit * * Revision 1.14 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.13 2004/03/11 21:05:01 erwin * too many changes without commits * * Revision 1.12 2003/10/30 20:54:06 erwin * syntax highlighting implementation * * Revision 1.11 2003/10/24 13:31:44 erwin * more syntax higlighting related stuff * */ #ifndef lint static const char vcid[] = "$Id: erwinmenu.c,v 1.17 2005/03/25 18:45:09 adrian Exp $"; #endif /* lint */ #include "erwinfunctions.h" #include "erwintags.h" #include "erwindialogs.h" #include "configdialog.h" #include "searchbar.h" #include #include "xpm/inline_logo.h" #include #include void save_file(); GtkWidget *main_menu(GtkWidget ** menubar, GtkWidget ** recent_menu) { GtkAccelGroup *accel_group = NULL; static GtkItemFactoryEntry menu_items[] = { {"/_File", NULL, 0, 0, ""}, {"/File/_New", "N", new_file, 0, "", GTK_STOCK_NEW}, {"/File/_Open", "O", open_file_dlg, 0, "", GTK_STOCK_OPEN}, {"/File/_Save", "S", save_file, 0, "", GTK_STOCK_SAVE}, {"/File/Save _As", NULL, save_file_dlg, 0, "", GTK_STOCK_SAVE_AS}, {"/File/_Recent Files", NULL, 0, 0, ""}, {"/File/_Close", NULL, close_current_file, 0, "", GTK_STOCK_CLOSE}, {"/File/_Quit", "Q", quit_program_from_menu, 0, "", GTK_STOCK_QUIT}, {"/_Edit", NULL, 0, 0, ""}, {"/Edit/Cut", "X", cut_to_clipboard, 0, "", GTK_STOCK_CUT}, {"/Edit/Copy", "C", copy_to_clipboard, 0, "", GTK_STOCK_COPY}, {"/Edit/Paste", "V", paste_from_clipboard, 0, "", GTK_STOCK_PASTE}, {"/Edit/sep", NULL, 0, 0, ""}, {"/Edit/Find", "F", searchbar, 0, "", GTK_STOCK_FIND}, {"/H_tml", NULL, 0, 0, ""}, {"/Html/Fonts", NULL, 0, 0, ""}, {"/Html/Fonts/Underline ", NULL, underline_functions, 0}, {"/Html/Fonts/Italic ", NULL, italic_functions, 0}, {"/Html/Fonts/Bold ", NULL, bold_functions, 0}, {"/Html/Fonts/H1

", NULL, h1_functions, 0}, {"/Html/Fonts/H1

", NULL, h2_functions, 0}, {"/Html/Fonts/H1

", NULL, h3_functions, 0}, {"/Html/Fonts/Center
", NULL, center_functions, 0}, {"/Html/Fonts/Font Options ", NULL, font_dialog, 0}, {"/Html/Table and Lists", NULL, 0, 0, ""}, {"/Html/Table and Lists/Table ", NULL, table_functions, 0}, {"/Html/Table and Lists/Table Header ", NULL, tr_functions, 0}, {"/Html/Table and Lists/Table Data
", NULL, th_functions, 0}, {"/Html/Table and Lists/Table Row
", NULL, td_functions, 0}, {"/Html/Table and Lists/Ordered List
    ", NULL, ol_functions, 0}, {"/Html/Table and Lists/Unordered List
      ", NULL, ul_functions, 0}, {"/Html/Table and Lists/List Item
    • ", NULL, li_functions, 0}, {"/Html/HTML/Insert Link", "L", href_dialog, 0}, {"/Html/HTML/Insert Image Link", "I", img_functions, 0}, {"/Html/HTML/Quick Start", NULL, body_functions, 0}, {"/Html/HTML/Linebreak
      ", "R", br_functions, 0}, {"/Html/HTML/Paragraph

      ", NULL, p_functions, 0}, {"/Html/HTML/Space  ", NULL, nbsp_functions, 0}, {"/Html/HTML/Emphasis ", NULL, em_functions, 0}, {"/Html/HTML/Strong ", NULL, strong_functions, 0}, {"/Html/HTML/Small ", NULL, small_functions, 0}, {"/Html/HTML/Strikeout ", NULL, nbsp_functions, 0}, {"/Html/HTML/Subscript ", NULL, sub_functions, 0}, {"/Html/HTML/Superscript ", NULL, sup_functions, 0}, {"/Html/Table Wizard", "T", table_wizard, 0}, {"/Html/Quickstart", NULL, body_dialog, 0}, {"/Html/Close Tag", "P", close_tag, 0}, {"/Html/View Rendered", NULL, view_html, 0,"",GTK_STOCK_CONNECT}, {"/_Options", NULL, 0, 0, ""}, {"/Options/Syntax Highlighting", NULL, 0, 0, ""}, {"/Options/Syntax Highlighting/Disable", NULL, toggle_syntax_highlighting, 0, ""}, {"/Options/Syntax Highlighting/sep", NULL, 0, 0, ""}, {"/_Options/sep", NULL, 0, 0, ""}, {"/_Options/Settings", NULL, settings, 0, 0}, {"/_Help", NULL, 0, 0, ""}, {"/Help/_Legal & License", NULL, legal, 0, "", GTK_STOCK_DIALOG_INFO}, {"/Help/sep", NULL, 0, 0, ""}, {"/Help/_About", NULL, help_about_menu, 0, "", inline_logo} }; gint nmenu_items = sizeof(menu_items) / sizeof(menu_items[0]); GClosure *closure; accel_group = gtk_accel_group_new(); main_factory = GTK_OBJECT(gtk_item_factory_new(GTK_TYPE_MENU_BAR, "

      ", accel_group)); gtk_item_factory_create_items(GTK_ITEM_FACTORY(main_factory), nmenu_items, menu_items, NULL); gtk_window_add_accel_group(GTK_WINDOW(globals.main_window), accel_group); *recent_menu = gtk_item_factory_get_widget(GTK_ITEM_FACTORY(main_factory), "
      /File/Recent Files"); closure = g_cclosure_new(G_CALLBACK(close_search),globals.main_window, NULL); gtk_accel_group_connect(accel_group, GDK_Escape, 0, 0, closure); globals.accel_group = accel_group; if (menubar) *menubar = gtk_item_factory_get_widget(GTK_ITEM_FACTORY(main_factory), "
      "); return *menubar; }