Development back on the trunk!
[crack-attack.git] / src / gtk-gui / interface.cxx
blob5aeb446629ce7966657f322a3fca89f7c8c0978b
1 /*
2 * interface.cxx
3 * Andrew Sayman - 4/28/05
5 * Copyright (C) 2000 Daniel Nelson
6 * Copyright (C) 2004 Andrew Sayman
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
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.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 * Daniel Nelson - aluminumangel.org
23 * 174 W. 18th Ave.
24 * Columbus, OH 43210
28 #ifdef HAVE_CONFIG_H
29 # include <config.h>
30 #endif
32 #include <sys/types.h>
33 #include <sys/stat.h>
34 #include <unistd.h>
35 #include <string.h>
36 #include <stdio.h>
38 #include <gdk/gdkkeysyms.h>
39 #include <gtk/gtk.h>
41 #include "callbacks.h"
42 #include "interface.h"
43 #include "support.h"
45 #define GLADE_HOOKUP_OBJECT(component,widget,name) \
46 g_object_set_data_full (G_OBJECT (component), name, \
47 gtk_widget_ref (widget), (GDestroyNotify) gtk_widget_unref)
49 #define GLADE_HOOKUP_OBJECT_NO_REF(component,widget,name) \
50 g_object_set_data (G_OBJECT (component), name, widget)
52 GtkWidget*
53 create_winCrackAttackSplash (void)
55 GtkWidget *winCrackAttackSplash;
56 GdkPixbuf *winCrackAttackSplash_icon_pixbuf;
57 GtkWidget *hbox1;
58 GtkWidget *vbox3;
59 GtkWidget *alignment8;
60 GtkWidget *frmGraphicsPreview;
61 GtkWidget *alignment1;
62 GtkWidget *vbox4;
63 GtkWidget *imgLogo;
64 GtkWidget *lblGraphicsPreview;
65 GtkWidget *alignment9;
66 GtkWidget *vbox1;
67 GtkWidget *ntbGameMode;
68 GtkWidget *vbox6;
69 GtkWidget *lblAI;
70 GtkWidget *cmbAI;
71 GtkWidget *lblSolo;
72 GtkWidget *vbox7;
73 /*GtkWidget *lblTmpServerAddress;*/
74 /*GtkWidget *lblServerAddress;*/
75 GtkWidget *hbox8;
76 GtkWidget *lblPort;
77 GtkWidget *entPort;
78 GtkWidget *lblServer;
79 GtkWidget *vbox8;
80 GtkWidget *lblTmpServerAddressClient;
81 GtkWidget *entServerAddressClient;
82 GtkWidget *hbox9;
83 GtkWidget *lblTmpPortClient;
84 GtkWidget *alignment7;
85 GtkWidget *entPortClient;
86 GtkWidget *lblClient;
87 GtkWidget *lblAboutInfo;
88 GtkWidget *lblAbout;
89 GtkWidget *frmGraphicsSettings;
90 GtkWidget *alignment10;
91 GtkWidget *table1;
92 GtkWidget *lblResolution;
93 GtkWidget *lblQuality;
94 GtkWidget *alignment4;
95 GtkWidget *cmbResolution;
96 GtkWidget *alignment5;
97 GtkWidget *cmbQuality;
98 GtkWidget *lblGraphicsSettings;
99 GtkWidget *vbox2;
100 GtkWidget *hbox2;
101 GtkWidget *lblPlayerName;
102 GtkWidget *alignment11;
103 GtkWidget *entPlayerName;
104 GtkWidget *frmGameMode;
105 GtkWidget *alignment3;
106 GtkWidget *vbox5;
107 GtkWidget *hbox7;
108 GtkWidget *hbox5;
109 GtkWidget *rbtnNormal;
110 GSList *rbtnNormal_group = NULL;
111 GtkWidget *rbtnXtreme;
112 GtkWidget *lblGameMode;
113 GtkWidget *hbox10;
114 GtkWidget *alignment12;
115 GtkWidget *hbox3;
116 GtkWidget *btnStart;
117 GtkWidget *alignment2;
118 GtkWidget *hbox4;
119 GtkWidget *image3;
120 GtkWidget *label8;
121 GtkWidget *btnQuit;
123 winCrackAttackSplash = gtk_window_new (GTK_WINDOW_TOPLEVEL);
124 gtk_widget_set_name (winCrackAttackSplash, "winCrackAttackSplash");
125 gtk_window_set_title (GTK_WINDOW (winCrackAttackSplash), "Crack Attack! 1.1.15-cvs");
126 gtk_window_set_destroy_with_parent (GTK_WINDOW (winCrackAttackSplash), TRUE);
127 winCrackAttackSplash_icon_pixbuf = create_pixbuf ("crack-attack.xpm");
128 if (winCrackAttackSplash_icon_pixbuf)
130 gtk_window_set_icon (GTK_WINDOW (winCrackAttackSplash), winCrackAttackSplash_icon_pixbuf);
131 gdk_pixbuf_unref (winCrackAttackSplash_icon_pixbuf);
134 hbox1 = gtk_hbox_new (FALSE, 0);
135 gtk_widget_set_name (hbox1, "hbox1");
136 gtk_widget_show (hbox1);
137 gtk_container_add (GTK_CONTAINER (winCrackAttackSplash), hbox1);
139 vbox3 = gtk_vbox_new (FALSE, 0);
140 gtk_widget_set_name (vbox3, "vbox3");
141 gtk_widget_show (vbox3);
142 gtk_box_pack_start (GTK_BOX (hbox1), vbox3, TRUE, TRUE, 0);
144 alignment8 = gtk_alignment_new (0.5, 0.5, 1, 1);
145 gtk_widget_set_name (alignment8, "alignment8");
146 gtk_widget_show (alignment8);
147 gtk_box_pack_start (GTK_BOX (vbox3), alignment8, TRUE, TRUE, 3);
148 gtk_alignment_set_padding (GTK_ALIGNMENT (alignment8), 0, 0, 3, 3);
150 frmGraphicsPreview = gtk_frame_new (NULL);
151 gtk_widget_set_name (frmGraphicsPreview, "frmGraphicsPreview");
152 gtk_widget_show (frmGraphicsPreview);
153 gtk_container_add (GTK_CONTAINER (alignment8), frmGraphicsPreview);
154 gtk_frame_set_shadow_type (GTK_FRAME (frmGraphicsPreview), GTK_SHADOW_IN);
156 alignment1 = gtk_alignment_new (0.5, 0.5, 1, 1);
157 gtk_widget_set_name (alignment1, "alignment1");
158 gtk_widget_show (alignment1);
159 gtk_container_add (GTK_CONTAINER (frmGraphicsPreview), alignment1);
160 gtk_alignment_set_padding (GTK_ALIGNMENT (alignment1), 3, 0, 6, 6);
162 vbox4 = gtk_vbox_new (FALSE, 0);
163 gtk_widget_set_name (vbox4, "vbox4");
164 gtk_widget_show (vbox4);
165 gtk_container_add (GTK_CONTAINER (alignment1), vbox4);
167 imgLogo = create_pixmap (winCrackAttackSplash, "preview_normal.tga");
168 gtk_widget_set_name (imgLogo, "imgLogo");
169 gtk_widget_show (imgLogo);
170 gtk_box_pack_start (GTK_BOX (vbox4), imgLogo, FALSE, FALSE, 0);
171 gtk_widget_set_size_request (imgLogo, 256, 256);
173 lblGraphicsPreview = gtk_label_new ("<b>Graphics Preview</b>");
174 gtk_widget_set_name (lblGraphicsPreview, "lblGraphicsPreview");
175 gtk_widget_show (lblGraphicsPreview);
176 gtk_frame_set_label_widget (GTK_FRAME (frmGraphicsPreview), lblGraphicsPreview);
177 gtk_label_set_use_markup (GTK_LABEL (lblGraphicsPreview), TRUE);
179 alignment9 = gtk_alignment_new (0.5, 0.5, 1, 1);
180 gtk_widget_set_name (alignment9, "alignment9");
181 gtk_widget_show (alignment9);
182 gtk_box_pack_start (GTK_BOX (hbox1), alignment9, TRUE, TRUE, 3);
183 gtk_alignment_set_padding (GTK_ALIGNMENT (alignment9), 0, 0, 3, 3);
185 vbox1 = gtk_vbox_new (FALSE, 0);
186 gtk_widget_set_name (vbox1, "vbox1");
187 gtk_widget_show (vbox1);
188 gtk_container_add (GTK_CONTAINER (alignment9), vbox1);
190 ntbGameMode = gtk_notebook_new ();
191 gtk_widget_set_name (ntbGameMode, "ntbGameMode");
192 gtk_widget_show (ntbGameMode);
193 gtk_box_pack_start (GTK_BOX (vbox1), ntbGameMode, FALSE, FALSE, 3);
195 vbox6 = gtk_vbox_new (FALSE, 0);
196 gtk_widget_set_name (vbox6, "vbox6");
197 gtk_widget_show (vbox6);
198 gtk_container_add (GTK_CONTAINER (ntbGameMode), vbox6);
200 lblAI = gtk_label_new_with_mnemonic ("Computer _AI");
201 gtk_widget_set_name (lblAI, "lblAI");
202 gtk_widget_show (lblAI);
203 gtk_box_pack_start (GTK_BOX (vbox6), lblAI, FALSE, FALSE, 0);
205 cmbAI = gtk_combo_box_new_text ();
206 gtk_widget_set_name (cmbAI, "cmbAI");
207 gtk_widget_show (cmbAI);
208 gtk_box_pack_start (GTK_BOX (vbox6), cmbAI, FALSE, TRUE, 3);
209 gtk_combo_box_append_text (GTK_COMBO_BOX (cmbAI), "None");
210 gtk_combo_box_append_text (GTK_COMBO_BOX (cmbAI), "Easy");
211 gtk_combo_box_append_text (GTK_COMBO_BOX (cmbAI), "Medium");
212 gtk_combo_box_append_text (GTK_COMBO_BOX (cmbAI), "Hard");
213 gtk_combo_box_set_active (GTK_COMBO_BOX (cmbAI), 0);
215 lblSolo = gtk_label_new_with_mnemonic ("S_olo");
216 gtk_widget_set_name (lblSolo, "lblSolo");
217 gtk_widget_show (lblSolo);
218 gtk_notebook_set_tab_label (GTK_NOTEBOOK (ntbGameMode), gtk_notebook_get_nth_page (GTK_NOTEBOOK (ntbGameMode), 0), lblSolo);
220 vbox7 = gtk_vbox_new (FALSE, 0);
221 gtk_widget_set_name (vbox7, "vbox7");
222 gtk_widget_show (vbox7);
223 gtk_container_add (GTK_CONTAINER (ntbGameMode), vbox7);
226 lblTmpServerAddress = gtk_label_new ("Server Address:");
227 gtk_widget_set_name (lblTmpServerAddress, "lblTmpServerAddress");
228 gtk_widget_show (lblTmpServerAddress);
229 gtk_box_pack_start (GTK_BOX (vbox7), lblTmpServerAddress, FALSE, FALSE, 0);
231 lblServerAddress = gtk_label_new ("INADDR_ANY");
232 gtk_widget_set_name (lblServerAddress, "lblServerAddress");
233 gtk_widget_show (lblServerAddress);
234 gtk_box_pack_start (GTK_BOX (vbox7), lblServerAddress, FALSE, FALSE, 0);
237 hbox8 = gtk_hbox_new (FALSE, 0);
238 gtk_widget_set_name (hbox8, "hbox8");
239 gtk_widget_show (hbox8);
240 gtk_box_pack_start (GTK_BOX (vbox7), hbox8, TRUE, TRUE, 0);
242 lblPort = gtk_label_new_with_mnemonic ("_Port:");
243 gtk_widget_set_name (lblPort, "lblPort");
244 gtk_widget_show (lblPort);
245 gtk_box_pack_start (GTK_BOX (hbox8), lblPort, FALSE, FALSE, 0);
247 entPort = gtk_entry_new ();
248 gtk_widget_set_name (entPort, "entPort");
249 gtk_widget_show (entPort);
250 gtk_box_pack_start (GTK_BOX (hbox8), entPort, FALSE, FALSE, 3);
251 gtk_entry_set_text (GTK_ENTRY (entPort), "8080");
253 lblServer = gtk_label_new_with_mnemonic ("_Server");
254 gtk_widget_set_name (lblServer, "lblServer");
255 gtk_widget_show (lblServer);
256 gtk_notebook_set_tab_label (GTK_NOTEBOOK (ntbGameMode), gtk_notebook_get_nth_page (GTK_NOTEBOOK (ntbGameMode), 1), lblServer);
258 vbox8 = gtk_vbox_new (FALSE, 0);
259 gtk_widget_set_name (vbox8, "vbox8");
260 gtk_widget_show (vbox8);
261 gtk_container_add (GTK_CONTAINER (ntbGameMode), vbox8);
263 lblTmpServerAddressClient = gtk_label_new_with_mnemonic ("Server _Address:");
264 gtk_widget_set_name (lblTmpServerAddressClient, "lblTmpServerAddressClient");
265 gtk_widget_show (lblTmpServerAddressClient);
266 gtk_box_pack_start (GTK_BOX (vbox8), lblTmpServerAddressClient, FALSE, FALSE, 0);
268 entServerAddressClient = gtk_entry_new ();
269 gtk_widget_set_name (entServerAddressClient, "entServerAddressClient");
270 gtk_widget_show (entServerAddressClient);
271 gtk_box_pack_start (GTK_BOX (vbox8), entServerAddressClient, FALSE, FALSE, 0);
273 hbox9 = gtk_hbox_new (FALSE, 0);
274 gtk_widget_set_name (hbox9, "hbox9");
275 gtk_widget_show (hbox9);
276 gtk_box_pack_start (GTK_BOX (vbox8), hbox9, TRUE, TRUE, 0);
278 lblTmpPortClient = gtk_label_new_with_mnemonic ("_Port:");
279 gtk_widget_set_name (lblTmpPortClient, "lblTmpPortClient");
280 gtk_widget_show (lblTmpPortClient);
281 gtk_box_pack_start (GTK_BOX (hbox9), lblTmpPortClient, FALSE, FALSE, 0);
283 alignment7 = gtk_alignment_new (0.5, 0.5, 1, 1);
284 gtk_widget_set_name (alignment7, "alignment7");
285 gtk_widget_show (alignment7);
286 gtk_box_pack_start (GTK_BOX (hbox9), alignment7, TRUE, TRUE, 0);
287 gtk_alignment_set_padding (GTK_ALIGNMENT (alignment7), 3, 3, 3, 0);
289 entPortClient = gtk_entry_new ();
290 gtk_widget_set_name (entPortClient, "entPortClient");
291 gtk_widget_show (entPortClient);
292 gtk_container_add (GTK_CONTAINER (alignment7), entPortClient);
293 gtk_entry_set_text (GTK_ENTRY (entPortClient), "8080");
295 lblClient = gtk_label_new_with_mnemonic ("_Client");
296 gtk_widget_set_name (lblClient, "lblClient");
297 gtk_widget_show (lblClient);
298 gtk_notebook_set_tab_label (GTK_NOTEBOOK (ntbGameMode), gtk_notebook_get_nth_page (GTK_NOTEBOOK (ntbGameMode), 2), lblClient);
299 gtk_misc_set_alignment (GTK_MISC (lblClient), 0.49, 0.5);
301 lblAboutInfo = gtk_label_new (_("Crack-Attack! 1.1.15-cvs-00\nLooking for competition?\nJoin our community channel!\n#crack-attack on irc.freenode.net"));
302 gtk_widget_show (lblAboutInfo);
303 gtk_container_add (GTK_CONTAINER (ntbGameMode), lblAboutInfo);
304 gtk_label_set_justify (GTK_LABEL (lblAboutInfo), GTK_JUSTIFY_CENTER);
306 lblAbout = gtk_label_new_with_mnemonic ("_About");
307 gtk_widget_show (lblAbout);
308 gtk_notebook_set_tab_label (GTK_NOTEBOOK (ntbGameMode), gtk_notebook_get_nth_page (GTK_NOTEBOOK (ntbGameMode), 3), lblAbout);
310 frmGraphicsSettings = gtk_frame_new (NULL);
311 gtk_widget_set_name (frmGraphicsSettings, "frmGraphicsSettings");
312 gtk_widget_show (frmGraphicsSettings);
313 gtk_box_pack_start (GTK_BOX (vbox1), frmGraphicsSettings, FALSE, TRUE, 3);
314 gtk_frame_set_shadow_type (GTK_FRAME (frmGraphicsSettings), GTK_SHADOW_IN);
316 alignment10 = gtk_alignment_new (0.5, 0.5, 1, 1);
317 gtk_widget_set_name (alignment10, "alignment10");
318 gtk_widget_show (alignment10);
319 gtk_container_add (GTK_CONTAINER (frmGraphicsSettings), alignment10);
320 gtk_alignment_set_padding (GTK_ALIGNMENT (alignment10), 0, 0, 12, 0);
322 table1 = gtk_table_new (2, 2, FALSE);
323 gtk_widget_set_name (table1, "table1");
324 gtk_widget_show (table1);
325 gtk_container_add (GTK_CONTAINER (alignment10), table1);
327 lblResolution = gtk_label_new_with_mnemonic ("_Resolution:");
328 gtk_widget_set_name (lblResolution, "lblResolution");
329 gtk_widget_show (lblResolution);
330 gtk_table_attach (GTK_TABLE (table1), lblResolution, 0, 1, 0, 1,
331 (GtkAttachOptions) (GTK_FILL),
332 (GtkAttachOptions) (0), 0, 0);
333 gtk_misc_set_alignment (GTK_MISC (lblResolution), 0, 0.5);
335 lblQuality = gtk_label_new_with_mnemonic ("_Quality:");
336 gtk_widget_set_name (lblQuality, "lblQuality");
337 gtk_widget_show (lblQuality);
338 gtk_table_attach (GTK_TABLE (table1), lblQuality, 0, 1, 1, 2,
339 (GtkAttachOptions) (GTK_FILL),
340 (GtkAttachOptions) (0), 0, 0);
341 gtk_misc_set_alignment (GTK_MISC (lblQuality), 0, 0.5);
343 alignment4 = gtk_alignment_new (0.5, 0.5, 1, 1);
344 gtk_widget_set_name (alignment4, "alignment4");
345 gtk_widget_show (alignment4);
346 gtk_table_attach (GTK_TABLE (table1), alignment4, 1, 2, 0, 1,
347 (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
348 (GtkAttachOptions) (GTK_FILL), 3, 3);
350 cmbResolution = gtk_combo_box_new_text ();
351 gtk_widget_set_name (cmbResolution, "cmbResolution");
352 gtk_widget_show (cmbResolution);
353 gtk_container_add (GTK_CONTAINER (alignment4), cmbResolution);
354 gtk_combo_box_append_text (GTK_COMBO_BOX (cmbResolution), "640x480");
355 gtk_combo_box_append_text (GTK_COMBO_BOX (cmbResolution), "800x600");
356 gtk_combo_box_append_text (GTK_COMBO_BOX (cmbResolution), "1024x768");
357 gtk_combo_box_append_text (GTK_COMBO_BOX (cmbResolution), "1280x1024");
358 gtk_combo_box_append_text (GTK_COMBO_BOX (cmbResolution), "1600x1200");
359 gtk_combo_box_set_active (GTK_COMBO_BOX (cmbResolution), 0);
361 alignment5 = gtk_alignment_new (0.5, 0.5, 1, 1);
362 gtk_widget_set_name (alignment5, "alignment5");
363 gtk_widget_show (alignment5);
364 gtk_table_attach (GTK_TABLE (table1), alignment5, 1, 2, 1, 2,
365 (GtkAttachOptions) (GTK_FILL),
366 (GtkAttachOptions) (GTK_FILL), 3, 3);
368 cmbQuality = gtk_combo_box_new_text ();
369 gtk_widget_set_name (cmbQuality, "cmbQuality");
370 gtk_widget_show (cmbQuality);
371 gtk_container_add (GTK_CONTAINER (alignment5), cmbQuality);
372 gtk_combo_box_append_text (GTK_COMBO_BOX (cmbQuality), "Normal");
373 gtk_combo_box_append_text (GTK_COMBO_BOX (cmbQuality), "Reduced");
374 gtk_combo_box_append_text (GTK_COMBO_BOX (cmbQuality), "Extremely Reduced");
375 gtk_combo_box_set_active (GTK_COMBO_BOX (cmbQuality), 0);
377 lblGraphicsSettings = gtk_label_new ("<b>Graphics Settings</b>");
378 gtk_widget_set_name (lblGraphicsSettings, "lblGraphicsSettings");
379 gtk_widget_show (lblGraphicsSettings);
380 gtk_frame_set_label_widget (GTK_FRAME (frmGraphicsSettings), lblGraphicsSettings);
381 gtk_label_set_use_markup (GTK_LABEL (lblGraphicsSettings), TRUE);
383 vbox2 = gtk_vbox_new (FALSE, 0);
384 gtk_widget_set_name (vbox2, "vbox2");
385 gtk_widget_show (vbox2);
386 gtk_box_pack_start (GTK_BOX (vbox1), vbox2, TRUE, TRUE, 0);
388 hbox2 = gtk_hbox_new (FALSE, 0);
389 gtk_widget_set_name (hbox2, "hbox2");
390 gtk_widget_show (hbox2);
391 gtk_box_pack_start (GTK_BOX (vbox2), hbox2, FALSE, TRUE, 3);
393 lblPlayerName = gtk_label_new_with_mnemonic ("_Player name:");
394 gtk_widget_set_name (lblPlayerName, "lblPlayerName");
395 gtk_widget_show (lblPlayerName);
396 gtk_box_pack_start (GTK_BOX (hbox2), lblPlayerName, FALSE, FALSE, 0);
398 alignment11 = gtk_alignment_new (0.5, 0.5, 1, 1);
399 gtk_widget_set_name (alignment11, "alignment11");
400 gtk_widget_show (alignment11);
401 gtk_box_pack_start (GTK_BOX (hbox2), alignment11, TRUE, TRUE, 0);
403 entPlayerName = gtk_entry_new ();
404 gtk_widget_set_name (entPlayerName, "entPlayerName");
405 gtk_widget_show (entPlayerName);
406 gtk_container_add (GTK_CONTAINER (alignment11), entPlayerName);
407 gtk_entry_set_text (GTK_ENTRY (entPlayerName), g_get_user_name());
409 frmGameMode = gtk_frame_new (NULL);
410 gtk_widget_set_name (frmGameMode, "frmGameMode");
411 gtk_widget_show (frmGameMode);
412 gtk_box_pack_start (GTK_BOX (vbox2), frmGameMode, TRUE, TRUE, 3);
413 gtk_frame_set_shadow_type (GTK_FRAME (frmGameMode), GTK_SHADOW_IN);
415 alignment3 = gtk_alignment_new (0.5, 0.5, 1, 1);
416 gtk_widget_set_name (alignment3, "alignment3");
417 gtk_widget_show (alignment3);
418 gtk_container_add (GTK_CONTAINER (frmGameMode), alignment3);
419 gtk_alignment_set_padding (GTK_ALIGNMENT (alignment3), 0, 0, 12, 0);
421 vbox5 = gtk_vbox_new (FALSE, 0);
422 gtk_widget_set_name (vbox5, "vbox5");
423 gtk_widget_show (vbox5);
424 gtk_container_add (GTK_CONTAINER (alignment3), vbox5);
426 hbox7 = gtk_hbox_new (FALSE, 0);
427 gtk_widget_set_name (hbox7, "hbox7");
428 gtk_widget_show (hbox7);
429 gtk_box_pack_start (GTK_BOX (vbox5), hbox7, TRUE, TRUE, 0);
431 hbox5 = gtk_hbox_new (FALSE, 0);
432 gtk_widget_set_name (hbox5, "hbox5");
433 gtk_widget_show (hbox5);
434 gtk_box_pack_start (GTK_BOX (hbox7), hbox5, TRUE, TRUE, 0);
436 rbtnNormal = gtk_radio_button_new_with_mnemonic (NULL, "_Normal");
437 gtk_widget_set_name (rbtnNormal, "rbtnNormal");
438 gtk_widget_show (rbtnNormal);
439 gtk_box_pack_start (GTK_BOX (hbox5), rbtnNormal, FALSE, FALSE, 0);
440 gtk_radio_button_set_group (GTK_RADIO_BUTTON (rbtnNormal), rbtnNormal_group);
441 rbtnNormal_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (rbtnNormal));
443 rbtnXtreme = gtk_radio_button_new_with_mnemonic (NULL, "_X-treme");
444 gtk_widget_set_name (rbtnXtreme, "rbtnXtreme");
445 gtk_widget_show (rbtnXtreme);
446 gtk_box_pack_start (GTK_BOX (hbox7), rbtnXtreme, FALSE, FALSE, 0);
447 gtk_radio_button_set_group (GTK_RADIO_BUTTON (rbtnXtreme), rbtnNormal_group);
448 rbtnNormal_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (rbtnXtreme));
450 lblGameMode = gtk_label_new ("<b>Game Mode</b>");
451 gtk_widget_set_name (lblGameMode, "lblGameMode");
452 gtk_widget_show (lblGameMode);
453 gtk_frame_set_label_widget (GTK_FRAME (frmGameMode), lblGameMode);
454 gtk_label_set_use_markup (GTK_LABEL (lblGameMode), TRUE);
456 hbox10 = gtk_hbox_new (FALSE, 0);
457 gtk_widget_set_name (hbox10, "hbox10");
458 gtk_widget_show (hbox10);
459 gtk_box_pack_start (GTK_BOX (vbox2), hbox10, FALSE, TRUE, 3);
461 alignment12 = gtk_alignment_new (0, 1, 1, 1);
462 gtk_widget_set_name (alignment12, "alignment12");
463 gtk_widget_show (alignment12);
464 gtk_box_pack_start (GTK_BOX (hbox10), alignment12, TRUE, TRUE, 0);
466 hbox3 = gtk_hbox_new (FALSE, 0);
467 gtk_widget_set_name (hbox3, "hbox3");
468 gtk_widget_show (hbox3);
469 gtk_container_add (GTK_CONTAINER (alignment12), hbox3);
471 btnStart = gtk_button_new ();
472 gtk_widget_set_name (btnStart, "btnStart");
473 gtk_widget_show (btnStart);
474 gtk_box_pack_start (GTK_BOX (hbox3), btnStart, TRUE, TRUE, 3);
476 alignment2 = gtk_alignment_new (0.5, 0.5, 0, 0);
477 gtk_widget_set_name (alignment2, "alignment2");
478 gtk_widget_show (alignment2);
479 gtk_container_add (GTK_CONTAINER (btnStart), alignment2);
481 hbox4 = gtk_hbox_new (FALSE, 2);
482 gtk_widget_set_name (hbox4, "hbox4");
483 gtk_widget_show (hbox4);
484 gtk_container_add (GTK_CONTAINER (alignment2), hbox4);
486 image3 = gtk_image_new_from_stock ("gtk-media-forward", GTK_ICON_SIZE_BUTTON);
487 gtk_widget_set_name (image3, "image3");
488 gtk_widget_show (image3);
489 gtk_box_pack_start (GTK_BOX (hbox4), image3, FALSE, FALSE, 0);
491 label8 = gtk_label_new_with_mnemonic ("Start _Game");
492 gtk_widget_set_name (label8, "label8");
493 gtk_widget_show (label8);
494 gtk_box_pack_start (GTK_BOX (hbox4), label8, TRUE, TRUE, 0);
496 btnQuit = gtk_button_new_from_stock ("gtk-quit");
497 gtk_widget_set_name (btnQuit, "btnQuit");
498 gtk_widget_show (btnQuit);
499 gtk_box_pack_start (GTK_BOX (hbox3), btnQuit, TRUE, TRUE, 3);
501 g_signal_connect ((gpointer) btnStart, "clicked",
502 G_CALLBACK (on_btnStart_clicked),
503 NULL);
504 g_signal_connect ((gpointer) btnQuit, "clicked",
505 G_CALLBACK (gtk_main_quit),
506 NULL);
507 g_signal_connect ((gpointer) cmbQuality, "changed",
508 G_CALLBACK (on_cmbQuality_changed),
509 NULL);
511 gtk_label_set_mnemonic_widget (GTK_LABEL (lblAI), cmbAI);
512 gtk_label_set_mnemonic_widget (GTK_LABEL (lblPort), entPort);
513 gtk_label_set_mnemonic_widget (GTK_LABEL (lblTmpServerAddressClient), entServerAddressClient);
514 gtk_label_set_mnemonic_widget (GTK_LABEL (lblTmpPortClient), entPortClient);
515 gtk_label_set_mnemonic_widget (GTK_LABEL (lblResolution), cmbResolution);
516 gtk_label_set_mnemonic_widget (GTK_LABEL (lblQuality), cmbQuality);
517 gtk_label_set_mnemonic_widget (GTK_LABEL (lblPlayerName), entPlayerName);
519 /* Store pointers to all widgets, for use by lookup_widget(). */
520 GLADE_HOOKUP_OBJECT_NO_REF (winCrackAttackSplash, winCrackAttackSplash, "winCrackAttackSplash");
521 GLADE_HOOKUP_OBJECT (winCrackAttackSplash, hbox1, "hbox1");
522 GLADE_HOOKUP_OBJECT (winCrackAttackSplash, vbox3, "vbox3");
523 GLADE_HOOKUP_OBJECT (winCrackAttackSplash, alignment8, "alignment8");
524 GLADE_HOOKUP_OBJECT (winCrackAttackSplash, frmGraphicsPreview, "frmGraphicsPreview");
525 GLADE_HOOKUP_OBJECT (winCrackAttackSplash, alignment1, "alignment1");
526 GLADE_HOOKUP_OBJECT (winCrackAttackSplash, vbox4, "vbox4");
527 GLADE_HOOKUP_OBJECT (winCrackAttackSplash, imgLogo, "imgLogo");
528 GLADE_HOOKUP_OBJECT (winCrackAttackSplash, lblGraphicsPreview, "lblGraphicsPreview");
529 GLADE_HOOKUP_OBJECT (winCrackAttackSplash, alignment9, "alignment9");
530 GLADE_HOOKUP_OBJECT (winCrackAttackSplash, vbox1, "vbox1");
531 GLADE_HOOKUP_OBJECT (winCrackAttackSplash, ntbGameMode, "ntbGameMode");
532 GLADE_HOOKUP_OBJECT (winCrackAttackSplash, vbox6, "vbox6");
533 GLADE_HOOKUP_OBJECT (winCrackAttackSplash, lblAI, "lblAI");
534 GLADE_HOOKUP_OBJECT (winCrackAttackSplash, cmbAI, "cmbAI");
535 GLADE_HOOKUP_OBJECT (winCrackAttackSplash, lblSolo, "lblSolo");
536 GLADE_HOOKUP_OBJECT (winCrackAttackSplash, vbox7, "vbox7");
537 /*GLADE_HOOKUP_OBJECT (winCrackAttackSplash, lblTmpServerAddress, "lblTmpServerAddress");*/
538 /*GLADE_HOOKUP_OBJECT (winCrackAttackSplash, lblServerAddress, "lblServerAddress");*/
539 GLADE_HOOKUP_OBJECT (winCrackAttackSplash, hbox8, "hbox8");
540 GLADE_HOOKUP_OBJECT (winCrackAttackSplash, lblPort, "lblPort");
541 GLADE_HOOKUP_OBJECT (winCrackAttackSplash, entPort, "entPort");
542 GLADE_HOOKUP_OBJECT (winCrackAttackSplash, lblServer, "lblServer");
543 GLADE_HOOKUP_OBJECT (winCrackAttackSplash, vbox8, "vbox8");
544 GLADE_HOOKUP_OBJECT (winCrackAttackSplash, lblTmpServerAddressClient, "lblTmpServerAddressClient");
545 GLADE_HOOKUP_OBJECT (winCrackAttackSplash, entServerAddressClient, "entServerAddressClient");
546 GLADE_HOOKUP_OBJECT (winCrackAttackSplash, hbox9, "hbox9");
547 GLADE_HOOKUP_OBJECT (winCrackAttackSplash, lblTmpPortClient, "lblTmpPortClient");
548 GLADE_HOOKUP_OBJECT (winCrackAttackSplash, alignment7, "alignment7");
549 GLADE_HOOKUP_OBJECT (winCrackAttackSplash, entPortClient, "entPortClient");
550 GLADE_HOOKUP_OBJECT (winCrackAttackSplash, lblClient, "lblClient");
551 GLADE_HOOKUP_OBJECT (winCrackAttackSplash, lblAboutInfo, "lblAboutInfo");
552 GLADE_HOOKUP_OBJECT (winCrackAttackSplash, lblAbout, "lblAbout");
553 GLADE_HOOKUP_OBJECT (winCrackAttackSplash, frmGraphicsSettings, "frmGraphicsSettings");
554 GLADE_HOOKUP_OBJECT (winCrackAttackSplash, alignment10, "alignment10");
555 GLADE_HOOKUP_OBJECT (winCrackAttackSplash, table1, "table1");
556 GLADE_HOOKUP_OBJECT (winCrackAttackSplash, lblResolution, "lblResolution");
557 GLADE_HOOKUP_OBJECT (winCrackAttackSplash, lblQuality, "lblQuality");
558 GLADE_HOOKUP_OBJECT (winCrackAttackSplash, alignment4, "alignment4");
559 GLADE_HOOKUP_OBJECT (winCrackAttackSplash, cmbResolution, "cmbResolution");
560 GLADE_HOOKUP_OBJECT (winCrackAttackSplash, alignment5, "alignment5");
561 GLADE_HOOKUP_OBJECT (winCrackAttackSplash, cmbQuality, "cmbQuality");
562 GLADE_HOOKUP_OBJECT (winCrackAttackSplash, lblGraphicsSettings, "lblGraphicsSettings");
563 GLADE_HOOKUP_OBJECT (winCrackAttackSplash, vbox2, "vbox2");
564 GLADE_HOOKUP_OBJECT (winCrackAttackSplash, hbox2, "hbox2");
565 GLADE_HOOKUP_OBJECT (winCrackAttackSplash, lblPlayerName, "lblPlayerName");
566 GLADE_HOOKUP_OBJECT (winCrackAttackSplash, alignment11, "alignment11");
567 GLADE_HOOKUP_OBJECT (winCrackAttackSplash, entPlayerName, "entPlayerName");
568 GLADE_HOOKUP_OBJECT (winCrackAttackSplash, frmGameMode, "frmGameMode");
569 GLADE_HOOKUP_OBJECT (winCrackAttackSplash, alignment3, "alignment3");
570 GLADE_HOOKUP_OBJECT (winCrackAttackSplash, vbox5, "vbox5");
571 GLADE_HOOKUP_OBJECT (winCrackAttackSplash, hbox7, "hbox7");
572 GLADE_HOOKUP_OBJECT (winCrackAttackSplash, hbox5, "hbox5");
573 GLADE_HOOKUP_OBJECT (winCrackAttackSplash, rbtnNormal, "rbtnNormal");
574 GLADE_HOOKUP_OBJECT (winCrackAttackSplash, rbtnXtreme, "rbtnXtreme");
575 GLADE_HOOKUP_OBJECT (winCrackAttackSplash, lblGameMode, "lblGameMode");
576 GLADE_HOOKUP_OBJECT (winCrackAttackSplash, hbox10, "hbox10");
577 GLADE_HOOKUP_OBJECT (winCrackAttackSplash, alignment12, "alignment12");
578 GLADE_HOOKUP_OBJECT (winCrackAttackSplash, hbox3, "hbox3");
579 GLADE_HOOKUP_OBJECT (winCrackAttackSplash, btnStart, "btnStart");
580 GLADE_HOOKUP_OBJECT (winCrackAttackSplash, alignment2, "alignment2");
581 GLADE_HOOKUP_OBJECT (winCrackAttackSplash, hbox4, "hbox4");
582 GLADE_HOOKUP_OBJECT (winCrackAttackSplash, image3, "image3");
583 GLADE_HOOKUP_OBJECT (winCrackAttackSplash, label8, "label8");
584 GLADE_HOOKUP_OBJECT (winCrackAttackSplash, btnQuit, "btnQuit");
586 return winCrackAttackSplash;
589 GtkWidget*
590 create_winNetworking (void)
592 GtkWidget *winNetworking;
593 GtkWidget *vbox10;
594 GtkWidget *alignment13;
595 GtkWidget *scrtxtOutput;
596 GtkWidget *txtOutput;
597 GtkWidget *alignment14;
598 GtkWidget *btnCancel;
600 winNetworking = gtk_window_new (GTK_WINDOW_TOPLEVEL);
601 gtk_widget_set_name (winNetworking, "winNetworking");
602 gtk_widget_set_size_request (winNetworking, 310, 195);
603 gtk_window_set_title (GTK_WINDOW (winNetworking), "Crack Attack Server");
604 gtk_window_set_modal (GTK_WINDOW (winNetworking), TRUE);
605 gtk_window_set_destroy_with_parent (GTK_WINDOW (winNetworking), TRUE);
607 vbox10 = gtk_vbox_new (FALSE, 0);
608 gtk_widget_set_name (vbox10, "vbox10");
609 gtk_widget_show (vbox10);
610 gtk_container_add (GTK_CONTAINER (winNetworking), vbox10);
612 alignment13 = gtk_alignment_new (0.5, 0.5, 1, 1);
613 gtk_widget_set_name (alignment13, "alignment13");
614 gtk_widget_show (alignment13);
615 gtk_box_pack_start (GTK_BOX (vbox10), alignment13, TRUE, TRUE, 0);
616 gtk_widget_set_size_request (alignment13, 57, -1);
617 gtk_alignment_set_padding (GTK_ALIGNMENT (alignment13), 5, 5, 5, 5);
619 scrtxtOutput = gtk_scrolled_window_new (NULL, NULL);
620 gtk_widget_set_name (scrtxtOutput, "scrtxtOutput");
621 gtk_widget_show (scrtxtOutput);
622 gtk_container_add (GTK_CONTAINER (alignment13), scrtxtOutput);
623 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrtxtOutput), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
624 gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrtxtOutput), GTK_SHADOW_IN);
626 txtOutput = gtk_text_view_new ();
627 gtk_widget_set_name (txtOutput, "txtOutput");
628 gtk_widget_show (txtOutput);
629 gtk_container_add (GTK_CONTAINER (scrtxtOutput), txtOutput);
630 gtk_text_view_set_editable (GTK_TEXT_VIEW (txtOutput), FALSE);
632 alignment14 = gtk_alignment_new (0.5, 0.5, 0, 1);
633 gtk_widget_set_name (alignment14, "alignment14");
634 gtk_widget_show (alignment14);
635 gtk_box_pack_start (GTK_BOX (vbox10), alignment14, FALSE, FALSE, 0);
636 gtk_alignment_set_padding (GTK_ALIGNMENT (alignment14), 5, 5, 5, 5);
638 btnCancel = gtk_button_new_from_stock ("gtk-cancel");
639 gtk_widget_set_name (btnCancel, "btnCancel");
640 gtk_widget_show (btnCancel);
641 gtk_container_add (GTK_CONTAINER (alignment14), btnCancel);
643 #ifndef _WIN32
644 g_signal_connect ((gpointer) btnCancel, "clicked",
645 G_CALLBACK (on_btnCancel_clicked),
646 GTK_WIDGET(winNetworking));
647 g_signal_connect ((gpointer) winNetworking, "destroy",
648 G_CALLBACK (on_winNetworking_destroy),
649 NULL);
650 #endif
652 /* Store pointers to all widgets, for use by lookup_widget(). */
653 GLADE_HOOKUP_OBJECT_NO_REF (winNetworking, winNetworking, "winNetworking");
654 GLADE_HOOKUP_OBJECT (winNetworking, vbox10, "vbox10");
655 GLADE_HOOKUP_OBJECT (winNetworking, alignment13, "alignment13");
656 GLADE_HOOKUP_OBJECT (winNetworking, scrtxtOutput, "scrtxtOutput");
657 GLADE_HOOKUP_OBJECT (winNetworking, txtOutput, "txtOutput");
658 GLADE_HOOKUP_OBJECT (winNetworking, alignment14, "alignment14");
659 GLADE_HOOKUP_OBJECT (winNetworking, btnCancel, "btnCancel");
661 return winNetworking;