1 #include <gtk/gtk.h>
2 #include "menu_bar.h"
3 #include "window.h"
4 //#include "../devcpp/config.h"
5 
6 
7 
8 /*################### Create item factory entry for menu ################*/
9 GtkItemFactoryEntry kmap_menubar_items[ ]  =
10 {
11 	{"/_File", NULL , 0 , 0 , "<Branch>" },
12 	{"/File/_Close","<control>Q", quit_from_main , 0, "<StockItem>", GTK_STOCK_QUIT },
13 	{"/_Help", NULL , 0 , 0 , "<Branch>" },
14 	{"/Help/_About","<control>A",help_developer, 0, "<StockItem>", GTK_STOCK_ABOUT },
15 };
16 
get_menubar(void)17 GtkWidget *get_menubar(void)
18 {
19 	GtkAccelGroup *kmap_accel_group;
20     GtkItemFactory *kmap_item_factory;
21 	GtkWidget *menubar;
22 
23 	/*create main window's accelgroup*/
24 	kmap_accel_group=gtk_accel_group_new();
25 	gtk_window_add_accel_group(GTK_WINDOW (main_window), kmap_accel_group);
26 	g_object_unref(kmap_accel_group);
27 
28 	/*create the menubar item factory and return menubar widget*/
29 
30 	kmap_item_factory=gtk_item_factory_new(GTK_TYPE_MENU_BAR,
31 											"<main>",kmap_accel_group);
32 	gtk_item_factory_create_items ( kmap_item_factory, G_N_ELEMENTS ( kmap_menubar_items ),
33 									kmap_menubar_items, main_window );
34 	menubar=gtk_item_factory_get_widget (kmap_item_factory, "<main>");
35 
36 	return menubar;
37 }
38 
39 
40 
help_developer(void)41 void help_developer(void)
42 {
43 
44 	GtkWidget *about_dialog,*a_label,*gsim_label,*mean_label,*copy_label,*gsim_image;
45 
46 	about_dialog=gtk_about_dialog_new();
47 	//gtk_widget_set_parent(about_dialog,gsim_appwindow);
48 	gchar *authers[3]={ "Hemant Kumar<hemantkumar1982@gmail.com>","Vinod Kumar Dahiya <dahiyavinod@gmail.com>",NULL};
49 	gchar *documenters[3]={ "Hemant Kumar<hemantkumar1982@gmail.com>","Vinod Kumar Dahiya <dahiyavinod@gmail.com>",NULL};
50 
51 	gchar *label=
52 	"      This program is free software; you can redistribute it "
53 	"and/or modify it under the terms of the GNU General "
54 	"Public License as published by the Free Software "
55 	"Foundation; either version 2 of the License, or "
56 	"(at your option) any later version.\n"
57 	"      This program is distributed in the hope that it will "
58 	"be useful, but WITHOUT ANY WARRANTY; without even the "
59 	"implied warranty of MERCHANTABILITY or FITNESS FOR A "
60 	"PARTICULAR PURPOSE.  See the GNU General Public License "
61 	"for more details.\n"
62 	"      You should have received a copy of the GNU General "
63 	"Public License along with this program; if not, write "
64 	"to the Free Software Foundation, Inc., 675 Mass Ave, "
65 	"Cambridge, MA 02139, USA.";
66 
67     gtk_about_dialog_set_name(GTK_ABOUT_DIALOG(about_dialog),"GKMap");
68     gtk_about_dialog_set_version(GTK_ABOUT_DIALOG(about_dialog),"0.2");
69     gtk_about_dialog_set_comments(GTK_ABOUT_DIALOG(about_dialog),"A Karnaugh map disclosure");
70     gtk_about_dialog_set_copyright(GTK_ABOUT_DIALOG(about_dialog),"Hemant Kumar & Vinod Dahiya ");
71     gtk_about_dialog_set_website(GTK_ABOUT_DIALOG(about_dialog),"http://sourceforge.net/projects/gkmap");
72     gtk_about_dialog_set_website_label(GTK_ABOUT_DIALOG(about_dialog),"http://sourceforge.net/projects/gkmap");
73     gtk_about_dialog_set_license(GTK_ABOUT_DIALOG(about_dialog),label);
74     gtk_about_dialog_set_wrap_license(GTK_ABOUT_DIALOG(about_dialog),TRUE);
75     gtk_about_dialog_set_documenters(GTK_ABOUT_DIALOG(about_dialog),documenters);
76     gtk_about_dialog_set_authors(GTK_ABOUT_DIALOG(about_dialog),authers);
77 
78 
79 	gtk_dialog_run (GTK_DIALOG (about_dialog));
80 	gtk_widget_destroy(about_dialog);
81 }
82 
83 
bugs(void)84 void bugs(void)
85 {
86 	GtkWidget *a_dialog,*a_label;
87 
88 	a_dialog=gtk_dialog_new_with_buttons("BUGS REPORT",GTK_WINDOW(main_window),GTK_DIALOG_DESTROY_WITH_PARENT,GTK_STOCK_OK,GTK_RESPONSE_NONE,NULL);
89 	a_label=gtk_label_new("   \n PLEASE REPORT BUGS AT :\n"
90 							"              e-mail: bugs@sinew.in\n");
91 	gtk_container_add(GTK_CONTAINER(GTK_DIALOG(a_dialog)->vbox),a_label);
92 	g_signal_connect(a_dialog,"response",G_CALLBACK(gtk_widget_destroy),a_dialog);
93 	gtk_widget_show_all(a_dialog);
94 	return;
95 }
96 
help_about(void)97 void help_about(void)
98 {
99 	/*GtkWidget *about_dialog,*about_label,*kmap_image,*kmap_label,*copyright_label,*a_label;
100 
101 	about_dialog=gtk_dialog_new_with_buttons("ABOUT",GTK_WINDOW(main_window),GTK_DIALOG_DESTROY_WITH_PARENT,GTK_STOCK_OK,GTK_RESPONSE_NONE,NULL);
102 	gtk_dialog_set_has_separator(GTK_DIALOG(about_dialog),FALSE);
103 	kmap_image=gtk_image_new_from_file(PACKAGE_PIXMAPS_DIR"/kmap.png");
104 	kmap_label=gtk_label_new("<span foreground=\"red\" font_desc=\"luxi sans bold 15\">Kmap Disclosure</span>");
105 	gtk_label_set_use_markup(GTK_LABEL(kmap_label),TRUE);
106 	//copyright_label=gtk_label_new("<span foreground=\"blue\" font_desc=\"luxi sans bold 8\">Copyright (c)  SINEW SOFTWARE SYSTEMS</span>");
107 	//gtk_label_set_use_markup(GTK_LABEL(copyright_label),TRUE);
108 	a_label=gtk_label_new("     _______________________________________________________     \n");
109 	about_label=gtk_label_new("    This is a simple Kmap Disclosure.    \n"
110 													  "    It is useful in solving the kmap problems very efficiently. You can    \n"
111 													  "    enter various cell element values by just clicking on buttons.  \n"
112 													  "    After setting the kmap cell elements, Click  'Show'  button to get the key.\n"
113 													);
114 
115 	gtk_container_add(GTK_CONTAINER(GTK_DIALOG(about_dialog)->vbox),kmap_image);
116 	gtk_container_add(GTK_CONTAINER(GTK_DIALOG(about_dialog)->vbox),kmap_label);
117 	//gtk_container_add(GTK_CONTAINER(GTK_DIALOG(about_dialog)->vbox),copyright_label);
118 	gtk_container_add(GTK_CONTAINER(GTK_DIALOG(about_dialog)->vbox),a_label);
119 	gtk_container_add(GTK_CONTAINER(GTK_DIALOG(about_dialog)->vbox),about_label);
120 	g_signal_connect(about_dialog,"response",G_CALLBACK(gtk_widget_destroy),about_dialog);
121 	gtk_widget_show_all(about_dialog);*/
122 	return;
123 }
124 
125 
license(void)126 void license(void)
127 {
128 	/*GtkWidget *about_dialog,*about_label,*gsysinfo_image,*gsysinfo_label,*a_label;
129 
130 	about_dialog=gtk_dialog_new_with_buttons("LICENSE",GTK_WINDOW(main_window),GTK_DIALOG_DESTROY_WITH_PARENT,GTK_STOCK_OK,GTK_RESPONSE_NONE,NULL);
131 	gsysinfo_image=gtk_image_new_from_file(PACKAGE_PIXMAPS_DIR"/license_info.png");
132 	gsysinfo_label=gtk_label_new("<span foreground=\"red\" font_desc=\"luxi sans bold 15\">LICENSE</span>");
133 	gtk_label_set_use_markup(GTK_LABEL(gsysinfo_label),TRUE);
134 
135 
136 	a_label=gtk_label_new("     _______________________________________________________     \n");
137 
138 	about_label=gtk_label_new("<span font_desc=\"luxi sans bold 9\" >This program is free software; you can redistribute it and/or  \n"
139 							  "modify it under the termsof the GNU General  Public License \n"
140 							  "as published by the Free Software Foundation; either version  \n"
141 							  "2  of the License, or  (at your option)  any later version. This   \n"
142 							  "program is distributed with the hope that it will be useful, but  \n"
143 							  "WITHOUT  ANY  WARRANTY; without  even  the implied  \n"
144 							  "warranty  of  MERCHANTABILITY  or  FITNESS FOR A  \n"
145 							  "PARTICULAR  PURPOSE. See  the  GNU  General Public     \n"
146 							  "License for more details.You should have received a copy of    \n"
147 							  "the GNU GPL along with this program; if  not, write to  the   \n"
148 							  "Free Software Foundation, Inc.,675 Mass Ave, Cambridge, \n"
149 							  "MA 02139, USA.\n</span>"
150 );
151 	gtk_label_set_use_markup(GTK_LABEL(about_label),TRUE);
152 	gtk_container_add(GTK_CONTAINER(GTK_DIALOG(about_dialog)->vbox),gsysinfo_image);
153 	gtk_container_add(GTK_CONTAINER(GTK_DIALOG(about_dialog)->vbox),gsysinfo_label);
154 	gtk_container_add(GTK_CONTAINER(GTK_DIALOG(about_dialog)->vbox),a_label);
155 	gtk_container_add(GTK_CONTAINER(GTK_DIALOG(about_dialog)->vbox),about_label);
156 	g_signal_connect(about_dialog,"response",G_CALLBACK(gtk_widget_destroy),about_dialog);
157 	gtk_widget_show_all(about_dialog);*/
158 }
159