-void DoProjectSettings ()
-{
- GtkWidget *project;
- GtkWidget *frame, *label, *vbox, *table1, *table2, *button;
- GtkWidget *brush;
- GtkWidget *scr;
- GtkWidget *base, *game;
- GtkWidget *gamemode_combo;
- GList *combo_list = (GList*)NULL;
-
- int loop = 1, ret = IDCANCEL;
-
- project = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_window_set_title (GTK_WINDOW (project), _("Project Settings"));
- gtk_signal_connect (GTK_OBJECT (project), "delete_event",
- GTK_SIGNAL_FUNC (dialog_delete_callback), NULL);
- gtk_signal_connect (GTK_OBJECT (project), "destroy",
- GTK_SIGNAL_FUNC (gtk_widget_destroy), NULL);
- g_object_set_data (G_OBJECT (project), "loop", &loop);
- g_object_set_data (G_OBJECT (project), "ret", &ret);
- gtk_window_set_default_size (GTK_WINDOW (project), 550, 400);
-
- table1 = gtk_table_new (3, 2, FALSE);
- gtk_widget_show (table1);
- gtk_container_add (GTK_CONTAINER (project), table1);
- gtk_container_set_border_width (GTK_CONTAINER (table1), 5);
- gtk_table_set_row_spacings (GTK_TABLE (table1), 5);
- gtk_table_set_col_spacings (GTK_TABLE (table1), 5);
-
- vbox = gtk_vbox_new (FALSE, 5);
- gtk_widget_show (vbox);
- gtk_table_attach (GTK_TABLE (table1), vbox, 1, 2, 0, 1,
- (GtkAttachOptions) (GTK_FILL),
- (GtkAttachOptions) (GTK_FILL), 0, 0);
-
- button = gtk_button_new_with_label (_("OK"));
- gtk_widget_show (button);
- gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
- gtk_signal_connect (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC (dialog_button_callback), GINT_TO_POINTER (IDOK));
- gtk_widget_set_usize (button, 60, -2);
-
- button = gtk_button_new_with_label (_("Cancel"));
- gtk_widget_show (button);
- gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
- gtk_signal_connect (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC (dialog_button_callback), GINT_TO_POINTER (IDCANCEL));
- gtk_widget_set_usize (button, 60, -2);
-
- vbox = gtk_vbox_new (FALSE, 5);
- gtk_widget_show (vbox);
- gtk_table_attach (GTK_TABLE (table1), vbox, 1, 2, 1, 2,
- (GtkAttachOptions) (GTK_FILL),
- (GtkAttachOptions) (GTK_FILL), 0, 0);
-
- button = gtk_button_new_with_label (_("Add..."));
- gtk_widget_show (button);
- gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
- gtk_signal_connect (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC (project_add), project);
- gtk_widget_set_usize (button, 60, -2);
-
- button = gtk_button_new_with_label (_("Change..."));
- gtk_widget_show (button);
- gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
- gtk_signal_connect (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC (project_change), project);
- gtk_widget_set_usize (button, 60, -2);
-
- button = gtk_button_new_with_label (_("Remove"));
- gtk_widget_show (button);
- gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
- gtk_signal_connect (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC (project_remove), project);
- gtk_widget_set_usize (button, 60, -2);
-
- frame = gtk_frame_new (_("Misc settings"));
- gtk_widget_show (frame);
- gtk_table_attach (GTK_TABLE (table1), frame, 0, 1, 2, 3,
- (GtkAttachOptions) (GTK_FILL),
- (GtkAttachOptions) (GTK_FILL), 0, 0);
-
- brush = gtk_check_button_new_with_label (_("Use brush primitives in MAP files (NOTE: experimental feature,\n"
- "required by the texture tools plugin)"));
- gtk_widget_show (brush);
- gtk_container_add (GTK_CONTAINER (frame), brush);
- gtk_container_set_border_width (GTK_CONTAINER (brush), 5);
-
- frame = gtk_frame_new (_("Menu commands"));
- gtk_widget_show (frame);
- gtk_table_attach (GTK_TABLE (table1), frame, 0, 1, 1, 2,
- (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
- (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
-
- scr = gtk_scrolled_window_new ((GtkAdjustment*)NULL, (GtkAdjustment*)NULL);
- gtk_widget_show (scr);
- gtk_container_add (GTK_CONTAINER (frame), scr);
- gtk_container_set_border_width (GTK_CONTAINER (scr), 5);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scr), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
- gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scr), GTK_SHADOW_IN);
-
-
- {
- GtkListStore* store = gtk_list_store_new(1, G_TYPE_STRING);
-
- GtkWidget* view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
- gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(view), FALSE);
-
- GtkCellRenderer* renderer = gtk_cell_renderer_text_new();
- GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes("", renderer, "text", 0, NULL);
- gtk_tree_view_append_column(GTK_TREE_VIEW(view), column);
-
- GtkTreeSelection* selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(view));
- gtk_tree_selection_set_mode(selection, GTK_SELECTION_BROWSE);
-
- gtk_widget_show(view);
-
- g_object_set_data(G_OBJECT (project), "view", view);
- g_object_set_data(G_OBJECT (project), "bsp_commands", store);
- gtk_container_add(GTK_CONTAINER (scr), view);
-
- g_object_unref(G_OBJECT(store));
- }
-
- frame = gtk_frame_new (_("Project settings"));
- gtk_widget_show (frame);
- gtk_table_attach (GTK_TABLE (table1), frame, 0, 1, 0, 1,
- (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
- (GtkAttachOptions) (GTK_FILL), 0, 0);
-
- // HACK: hardcoded game stuff
- if (g_pGameDescription->mGameFile == "wolf.game" ||
- g_pGameDescription->mGameFile == "et.game" ||
- g_pGameDescription->mGameFile == "jk2.game" ||
- g_pGameDescription->mGameFile == "stvef.game" ||
- g_pGameDescription->mGameFile == "sof2.game" ||
- g_pGameDescription->mGameFile == "ja.game" )
- {
- table2 = gtk_table_new (9, 2, FALSE);
- }
- else
- {
- table2 = gtk_table_new (8, 2, FALSE);
- }
- gtk_widget_show (table2);
- gtk_container_add (GTK_CONTAINER (frame), table2);
- gtk_container_set_border_width (GTK_CONTAINER (table2), 5);
- gtk_table_set_row_spacings (GTK_TABLE (table2), 5);
- gtk_table_set_col_spacings (GTK_TABLE (table2), 5);
-
- /*
- fill in the game selection combo
- HACK: hardcoded Q3/Wolf/HL switch
- \todo that stuff would be faster to write with implementation of property bags and associated code to edit
- */
- if (g_pGameDescription->mGameFile == "wolf.game")
- {
- combo_list = g_list_append (combo_list, (void *)sWolfComboItem);
- combo_list = g_list_append (combo_list, (void *)sWolfModComboItem);
- }
- else if (g_pGameDescription->mGameFile == "et.game")
- {
- combo_list = g_list_append (combo_list, (void *)sETComboItem);
- combo_list = g_list_append (combo_list, (void *)sETModComboItem);
- }
- else if (g_pGameDescription->mGameFile == "hl.game")
- {
- combo_list = g_list_append (combo_list, (void *)sHLComboItem);
- combo_list = g_list_append (combo_list, (void *)sHLModComboItem);
- }
- // RIANT
- // JK2 HACK
- else if (g_pGameDescription->mGameFile == "jk2.game")
- {
- combo_list = g_list_append (combo_list, (void *)sJK2ComboItem);
- combo_list = g_list_append (combo_list, (void *)sJK2ModComboItem);
- }
- // TTimo
- // JA HACK
- else if (g_pGameDescription->mGameFile == "ja.game")
- {
- combo_list = g_list_append (combo_list, (void *)sJAComboItem);
- combo_list = g_list_append (combo_list, (void *)sJAModComboItem);
- }
- // RIANT
- // STVEF HACK
- else if (g_pGameDescription->mGameFile == "stvef.game")
- {
- combo_list = g_list_append (combo_list, (void *)sSTVEFComboItem);
- combo_list = g_list_append (combo_list, (void *)sSTVEFModComboItem);
- }
- // RIANT
- // SOF2 HACK A LA JK2 A LA WOLF
- else if (g_pGameDescription->mGameFile == "sof2.game")
- {
- combo_list = g_list_append (combo_list, (void *)sSOF2ComboItem);
- combo_list = g_list_append (combo_list, (void *)sSOF2ModComboItem);
- }
- else
- {
- // Q3 or default
- combo_list = g_list_append (combo_list, (void *)sQ3ComboItem);
- combo_list = g_list_append (combo_list, (void *)sTAComboItem);
- combo_list = g_list_append (combo_list, (void *)sModComboItem);
- }
-
- game_select = gtk_combo_new ();
- gtk_combo_set_popdown_strings (GTK_COMBO (game_select), combo_list);
- gtk_widget_show (game_select);
- gtk_table_attach (GTK_TABLE (table2), game_select, 1, 2, 6, 7,
- (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
- (GtkAttachOptions) (0), 0, 0);
-
- gtk_signal_connect (GTK_OBJECT(GTK_COMBO (game_select)->entry), "changed",
- GTK_SIGNAL_FUNC (OnSelchangeComboWhatgame), NULL);
-
- g_list_free (combo_list);
- gtk_entry_set_editable (GTK_ENTRY (GTK_COMBO (game_select)->entry), FALSE);
-
- game = gtk_entry_new();
- fsgame_entry = GTK_ENTRY(game);
- gtk_widget_show(game);
- gtk_table_attach(GTK_TABLE(table2), game, 1, 2, 7, 8,
- (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
- (GtkAttachOptions) (0), 0, 0);
-
- /*
- wolf specific: select MP or SP mode
- */
- if (g_pGameDescription->mGameFile == "wolf.game")
- {
- combo_list = NULL;
- combo_list = g_list_append (combo_list, (void *)sWolfSPCombo);
- combo_list = g_list_append (combo_list, (void *)sWolfMPCombo);
-
- gamemode_combo = gtk_combo_new ();
- gtk_combo_set_popdown_strings (GTK_COMBO (gamemode_combo), combo_list);
- gtk_widget_show(gamemode_combo);
- gtk_table_attach (GTK_TABLE (table2), gamemode_combo, 1, 2, 8, 9,
- (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
- (GtkAttachOptions) (0), 0, 0);
-
- g_list_free (combo_list);
- combo_list = NULL;
-
- label = gtk_label_new (_("Mapping mode"));
- gtk_widget_show (label);
- gtk_table_attach (GTK_TABLE (table2), label, 0, 1, 8, 9,
- (GtkAttachOptions) (GTK_FILL),
- (GtkAttachOptions) (0), 0, 0);
- gtk_misc_set_alignment (GTK_MISC (label), 1, 0.5);
- }
-
- // RIANT
- // JK2 HACK
- if (g_pGameDescription->mGameFile == "jk2.game")
- {
- combo_list = NULL;
- combo_list = g_list_append (combo_list, (void *)sJK2SPCombo);
- combo_list = g_list_append (combo_list, (void *)sJK2MPCombo);
-
- gamemode_combo = gtk_combo_new ();
- gtk_combo_set_popdown_strings (GTK_COMBO (gamemode_combo), combo_list);
- gtk_widget_show(gamemode_combo);
- gtk_table_attach (GTK_TABLE (table2), gamemode_combo, 1, 2, 8, 9,
- (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
- (GtkAttachOptions) (0), 0, 0);
-
- g_list_free (combo_list);
- combo_list = NULL;
-
- label = gtk_label_new (_("Mapping mode"));
- gtk_widget_show (label);
- gtk_table_attach (GTK_TABLE (table2), label, 0, 1, 8, 9,
- (GtkAttachOptions) (GTK_FILL),
- (GtkAttachOptions) (0), 0, 0);
- gtk_misc_set_alignment (GTK_MISC (label), 1, 0.5);
- }
- // TTimo
- // JA HACK
- if (g_pGameDescription->mGameFile == "ja.game")
- {
- combo_list = NULL;
- combo_list = g_list_append (combo_list, (void *)sJASPCombo);
- combo_list = g_list_append (combo_list, (void *)sJAMPCombo);
-
- gamemode_combo = gtk_combo_new ();
- gtk_combo_set_popdown_strings (GTK_COMBO (gamemode_combo), combo_list);
- gtk_widget_show(gamemode_combo);
- gtk_table_attach (GTK_TABLE (table2), gamemode_combo, 1, 2, 8, 9,
- (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
- (GtkAttachOptions) (0), 0, 0);
-
- g_list_free (combo_list);
- combo_list = NULL;
-
- label = gtk_label_new (_("Mapping mode"));
- gtk_widget_show (label);
- gtk_table_attach (GTK_TABLE (table2), label, 0, 1, 8, 9,
- (GtkAttachOptions) (GTK_FILL),
- (GtkAttachOptions) (0), 0, 0);
- gtk_misc_set_alignment (GTK_MISC (label), 1, 0.5);
- }
- // RIANT
- // STVEF HACK
- if (g_pGameDescription->mGameFile == "stvef.game")
- {
- combo_list = NULL;
- combo_list = g_list_append (combo_list, (void *)sSTVEFSPCombo);
- combo_list = g_list_append (combo_list, (void *)sSTVEFMPCombo);
-
- gamemode_combo = gtk_combo_new ();
- gtk_combo_set_popdown_strings (GTK_COMBO (gamemode_combo), combo_list);
- gtk_widget_show(gamemode_combo);
- gtk_table_attach (GTK_TABLE (table2), gamemode_combo, 1, 2, 8, 9,
- (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
- (GtkAttachOptions) (0), 0, 0);
-
- g_list_free (combo_list);
- combo_list = NULL;
-
- label = gtk_label_new (_("Mapping mode"));
- gtk_widget_show (label);
- gtk_table_attach (GTK_TABLE (table2), label, 0, 1, 8, 9,
- (GtkAttachOptions) (GTK_FILL),
- (GtkAttachOptions) (0), 0, 0);
- gtk_misc_set_alignment (GTK_MISC (label), 1, 0.5);
- }
- // RIANT
- // SOF2 HACK
- if (g_pGameDescription->mGameFile == "sof2.game")
- {
- combo_list = NULL;
- combo_list = g_list_append (combo_list, (void *)sSOF2SPCombo);
- combo_list = g_list_append (combo_list, (void *)sSOF2MPCombo);
-
- gamemode_combo = gtk_combo_new ();
- gtk_combo_set_popdown_strings (GTK_COMBO (gamemode_combo), combo_list);
- gtk_widget_show(gamemode_combo);
- gtk_table_attach (GTK_TABLE (table2), gamemode_combo, 1, 2, 8, 9,
- (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
- (GtkAttachOptions) (0), 0, 0);
-
- g_list_free (combo_list);
- combo_list = NULL;
-
- label = gtk_label_new (_("Mapping mode"));
- gtk_widget_show (label);
- gtk_table_attach (GTK_TABLE (table2), label, 0, 1, 8, 9,
- (GtkAttachOptions) (GTK_FILL),
- (GtkAttachOptions) (0), 0, 0);
- gtk_misc_set_alignment (GTK_MISC (label), 1, 0.5);
- }
-
- /*
- the usual stuff
- */
-
- base = gtk_entry_new ();
- g_object_set_data (G_OBJECT (project), "base", base);
- gtk_widget_show (base);
- gtk_table_attach (GTK_TABLE (table2), base, 1, 2, 0, 1,
- (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
- (GtkAttachOptions) (0), 0, 0);
-
-
- label = gtk_label_new (_("basepath"));
- gtk_widget_show (label);
- gtk_table_attach (GTK_TABLE (table2), label, 0, 1, 0, 1,
- (GtkAttachOptions) (GTK_FILL),
- (GtkAttachOptions) (0), 0, 0);
- gtk_misc_set_alignment (GTK_MISC (label), 1, 0.5);
-
-
- label = gtk_label_new (_("Select mod"));
- gtk_widget_show (label);
- gtk_table_attach (GTK_TABLE (table2), label, 0, 1, 6, 7,
- (GtkAttachOptions) (GTK_FILL),
- (GtkAttachOptions) (0), 0, 0);
- gtk_misc_set_alignment (GTK_MISC (label), 1, 0.5);
-
- label = gtk_label_new (_("fs_game"));
- gtk_widget_show (label);
- gtk_table_attach (GTK_TABLE (table2), label, 0, 1, 7, 8,
- (GtkAttachOptions) (GTK_FILL),
- (GtkAttachOptions) (0), 0, 0);
- gtk_misc_set_alignment (GTK_MISC (label), 1, 0.5);
-
- // Initialize fields
- gtk_entry_set_text (GTK_ENTRY (base), ValueForKey (g_qeglobals.d_project_entity, "basepath"));
- UpdateBSPCommandList (project);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (brush), (g_qeglobals.m_bBrushPrimitMode) ? TRUE : FALSE);
-
- // initialise the fs_game selection from the project settings into the dialog
- const char *dir = ValueForKey (g_qeglobals.d_project_entity, "gamename");
- // HACK: hardcoded wolf stuff
- if (g_pGameDescription->mGameFile == "wolf.game")
- {
- if ((strlen(dir) == 0) || !stricmp(dir,"main"))
- {
- // no fs_game set, we are running stock Quake III Arena editing
- gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (game_select)->entry), sWolfComboItem);
- gtk_entry_set_text (GTK_ENTRY (game), "");
- gtk_widget_set_sensitive(game, false);
- }
- else
- {
- // this is a custom mod
- gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (game_select)->entry), sWolfModComboItem);
- gtk_entry_set_text (GTK_ENTRY (game), dir);
- gtk_widget_set_sensitive(game, true);
- }
- }
- // HACK: hardcoded et stuff
- if (g_pGameDescription->mGameFile == "et.game")
- {
- if ((strlen(dir) == 0) || !stricmp(dir,"etmain"))
- {
- // no fs_game set, we are running stock Quake III Arena editing
- gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (game_select)->entry), sETComboItem);
- gtk_entry_set_text (GTK_ENTRY (game), "");
- gtk_widget_set_sensitive(game, false);
- }
- else
- {
- // this is a custom mod
- gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (game_select)->entry), sETModComboItem);
- gtk_entry_set_text (GTK_ENTRY (game), dir);
- gtk_widget_set_sensitive(game, true);
- }
- }
- // HACK: hardcoded half-life stuff
- else if (g_pGameDescription->mGameFile == "hl.game")
- {
- if ((strlen(dir) == 0) || !stricmp(dir,"valve"))
- {
- gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (game_select)->entry), sHLComboItem);
- gtk_entry_set_text (GTK_ENTRY (game), "");
- gtk_widget_set_sensitive(game, false);
- }
- else
- {
- // this is a custom mod
- gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (game_select)->entry), sHLModComboItem);
- gtk_entry_set_text (GTK_ENTRY (game), dir);
- gtk_widget_set_sensitive(game, true);
- }
- }
- // RIANT
- // JK2 HACK
- else if (g_pGameDescription->mGameFile == "jk2.game")
- {
- if ((strlen(dir) == 0) || !stricmp(dir,"base"))
- {
- // no fs_game set, we are running stock Quake III Arena editing
- gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (game_select)->entry), sJK2ComboItem);
- gtk_entry_set_text (GTK_ENTRY (game), "");
- gtk_widget_set_sensitive(game, false);
- }
- else
- {
- // this is a custom mod
- gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (game_select)->entry), sJK2ModComboItem);
- gtk_entry_set_text (GTK_ENTRY (game), dir);
- gtk_widget_set_sensitive(game, true);
- }
- }
- // TTimo
- // JA HACK
- else if (g_pGameDescription->mGameFile == "ja.game")
- {
- if ((strlen(dir) == 0) || !stricmp(dir,"base"))
- {
- // no fs_game set, we are running stock editing
- gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (game_select)->entry), sJAComboItem);
- gtk_entry_set_text (GTK_ENTRY (game), "");
- gtk_widget_set_sensitive(game, false);
- }
- else
- {
- // this is a custom mod
- gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (game_select)->entry), sJAModComboItem);
- gtk_entry_set_text (GTK_ENTRY (game), dir);
- gtk_widget_set_sensitive(game, true);
- }
- }
- // RIANT
- // STVEF2 HACK
- else if (g_pGameDescription->mGameFile == "stvef.game")
- {
- if ((strlen(dir) == 0) || !stricmp(dir,"baseEf"))
- {
- // no fs_game set, we are running stock Quake III Arena editing
- gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (game_select)->entry), sSTVEFComboItem);
- gtk_entry_set_text (GTK_ENTRY (game), "");
- gtk_widget_set_sensitive(game, false);
- }
- else
- {
- // this is a custom mod
- gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (game_select)->entry), sSTVEFModComboItem);
- gtk_entry_set_text (GTK_ENTRY (game), dir);
- gtk_widget_set_sensitive(game, true);
- }
- }
- // RIANT
- // SOF2 HACK
- else if (g_pGameDescription->mGameFile == "sof2.game")
- {
- if ((strlen(dir) == 0) || !stricmp(dir,"base"))
- {
- // no fs_game set, we are running stock Quake III Arena editing
- gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (game_select)->entry), sSOF2ComboItem);
- gtk_entry_set_text (GTK_ENTRY (game), "");
- gtk_widget_set_sensitive(game, false);
- }
- else
- {
- // this is a custom mod
- gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (game_select)->entry), sSOF2ModComboItem);
- gtk_entry_set_text (GTK_ENTRY (game), dir);
- gtk_widget_set_sensitive(game, true);
- }
- }
- else
- {
- if ((strlen(dir) == 0) || !strcmp(dir,"baseq3"))
- {
- // no fs_game set, we are running stock Quake III Arena editing
- gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (game_select)->entry), sQ3ComboItem);
- gtk_entry_set_text (GTK_ENTRY (game), "");
- gtk_widget_set_sensitive(game, false);
- }
- else if (!strcmp(dir,"missionpack"))
- {
- gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (game_select)->entry), sTAComboItem);
- gtk_entry_set_text (GTK_ENTRY (game), "missionpack");
- gtk_widget_set_sensitive(game, false);
- }
- else
- {
- // this is a custom mod
- gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (game_select)->entry), sModComboItem);
- gtk_entry_set_text (GTK_ENTRY (game), dir);
- gtk_widget_set_sensitive(game, true);
- }
- }
-
- // HACK: hardcoded wolf stuff
- if (g_pGameDescription->mGameFile == "wolf.game")
- {
- const char *gamemode = ValueForKey (g_qeglobals.d_project_entity, "gamemode");
- if ((strlen(gamemode) == 0) || !strcmp(gamemode,"sp"))
- {
- // nothing set yet, or single player
- gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (gamemode_combo)->entry), sWolfSPCombo);
- }
- else
- {
- gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (gamemode_combo)->entry), sWolfMPCombo);
- }
- }
-
- // JK2 HACK
- else if (g_pGameDescription->mGameFile == "jk2.game")
- {
- const char *gamemode = ValueForKey (g_qeglobals.d_project_entity, "gamemode");
- if ((strlen(gamemode) == 0) || !strcmp(gamemode,"sp"))
- {
- // nothing set yet, or single player
- gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (gamemode_combo)->entry), sJK2SPCombo);
- }
- else
- {
- gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (gamemode_combo)->entry), sJK2MPCombo);
- }
- }
- // JA HACK
- else if (g_pGameDescription->mGameFile == "ja.game")
- {
- const char *gamemode = ValueForKey (g_qeglobals.d_project_entity, "gamemode");
- if ((strlen(gamemode) == 0) || !strcmp(gamemode,"sp"))
- {
- // nothing set yet, or single player
- gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (gamemode_combo)->entry), sJASPCombo);
- }
- else
- {
- gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (gamemode_combo)->entry), sJAMPCombo);
- }
- }
- // STVEF HACK
- else if (g_pGameDescription->mGameFile == "stvef.game")
- {
- const char *gamemode = ValueForKey (g_qeglobals.d_project_entity, "gamemode");
- if ((strlen(gamemode) == 0) || !strcmp(gamemode,"sp"))
- {
- // nothing set yet, or single player
- gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (gamemode_combo)->entry), sSTVEFSPCombo);
- }
- else
- {
- gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (gamemode_combo)->entry), sSTVEFMPCombo);
- }
- }
- // SOF2 HACK
- else if (g_pGameDescription->mGameFile == "sof2.game")
- {
- const char *gamemode = ValueForKey (g_qeglobals.d_project_entity, "gamemode");
- if ((strlen(gamemode) == 0) || !strcmp(gamemode,"sp"))
- {
- // nothing set yet, or single player
- gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (gamemode_combo)->entry), sSOF2SPCombo);
- }
- else
- {
- gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (gamemode_combo)->entry), sSOF2MPCombo);
- }
- }
-
- gtk_grab_add (project);
- gtk_widget_show (project);
-
- g_pGameDescription->Dump();
-
- while (loop)
- gtk_main_iteration ();
-
- if (ret == IDOK)
- {
- char buf[1024];
- const char *r;
- char *w;
-
- // convert path to unix format
- for(r = gtk_entry_get_text (GTK_ENTRY (base)), w=buf; *r != '\0'; r++, w++)
- *w = (*r == '\\') ? '/' : *r;
- // add last slash
- if(w != buf && *(w-1) != '/') *(w++) = '/';
- // terminate string
- *w = '\0';
- SetKeyValue (g_qeglobals.d_project_entity, "basepath", buf);
-
- dir = gtk_entry_get_text (GTK_ENTRY (game));
- // Hack: hard coded wolf stuff
- if (g_pGameDescription->mGameFile == "wolf.game")
- {
- if (!strlen(dir) || !stricmp(dir,"main"))
- {
- DeleteKey (g_qeglobals.d_project_entity, "gamename");
- }
- else
- {
- SetKeyValue (g_qeglobals.d_project_entity, "gamename", dir);
- }
- }
- // Hack: hard coded ET stuff
- else if (g_pGameDescription->mGameFile == "et.game")
- {
- if (!strlen(dir) || !stricmp(dir,"etmain"))
- {
- DeleteKey (g_qeglobals.d_project_entity, "gamename");
- }
- else
- {
- SetKeyValue (g_qeglobals.d_project_entity, "gamename", dir);
- }
- }
- // Hack: hard coded Half-life stuff
- else if (g_pGameDescription->mGameFile == "hl.game")
- {
- if (!strlen(dir) || !stricmp(dir,"valve"))
- {
- DeleteKey (g_qeglobals.d_project_entity, "gamename");
- }
- else
- {
- SetKeyValue (g_qeglobals.d_project_entity, "gamename", dir);
- }
- }
- else if (g_pGameDescription->mGameFile == "jk2.game" || g_pGameDescription->mGameFile == "ja.game")
- {
- if (!strlen(dir) || !stricmp(dir,"base"))
- {
- DeleteKey (g_qeglobals.d_project_entity, "gamename");
- }
- else
- {
- SetKeyValue (g_qeglobals.d_project_entity, "gamename", dir);
- }
- }
- // RIANT
- // STVEF HACK
- else if (g_pGameDescription->mGameFile == "stvef.game")
- {
- if (!strlen(dir) || !stricmp(dir,"baseEf"))
- {
- DeleteKey (g_qeglobals.d_project_entity, "gamename");
- }
- else
- {
- SetKeyValue (g_qeglobals.d_project_entity, "gamename", dir);
- }
- }
- else
- {
- if (!strlen(dir) || !strcmp(dir,"baseq3"))
- {
- DeleteKey (g_qeglobals.d_project_entity, "gamename");
- }
- else
- {
- SetKeyValue (g_qeglobals.d_project_entity, "gamename", dir);
- }
- }
-
- // HACK: hardcoded wolf stuff
- if (g_pGameDescription->mGameFile == "wolf.game")
- {
- // read from gamemode_combo
- const char *gamemode = gtk_entry_get_text (GTK_ENTRY (GTK_COMBO(gamemode_combo)->entry));
- if (!strlen(gamemode) || !strcmp(gamemode, sWolfSPCombo))
- {
- SetKeyValue (g_qeglobals.d_project_entity, "gamemode", "sp");
- }
- else
- {
- SetKeyValue (g_qeglobals.d_project_entity, "gamemode", "mp");
- }
- }
-
- // RIANT
- // JK2 HACK
- if (g_pGameDescription->mGameFile == "jk2.game")
- {
- // read from gamemode_combo
- const char *gamemode = gtk_entry_get_text (GTK_ENTRY (GTK_COMBO(gamemode_combo)->entry));
- if (!strlen(gamemode) || !strcmp(gamemode, sJK2SPCombo))
- {
- SetKeyValue (g_qeglobals.d_project_entity, "gamemode", "sp");
- }
- else
- {
- SetKeyValue (g_qeglobals.d_project_entity, "gamemode", "mp");
- }
- }
- // TTimo
- // JA HACK
- if (g_pGameDescription->mGameFile == "ja.game")
- {
- // read from gamemode_combo
- const char *gamemode = gtk_entry_get_text (GTK_ENTRY (GTK_COMBO(gamemode_combo)->entry));
- if (!strlen(gamemode) || !strcmp(gamemode, sJASPCombo))
- {
- SetKeyValue (g_qeglobals.d_project_entity, "gamemode", "sp");
- }
- else
- {
- SetKeyValue (g_qeglobals.d_project_entity, "gamemode", "mp");
- }
- }
-
- // RIANT
- // STVEF HACK
- if (g_pGameDescription->mGameFile == "stvef.game")
- {
- // read from gamemode_combo
- const char *gamemode = gtk_entry_get_text (GTK_ENTRY (GTK_COMBO(gamemode_combo)->entry));
- if (!strlen(gamemode) || !strcmp(gamemode, sSTVEFSPCombo))
- {
- SetKeyValue (g_qeglobals.d_project_entity, "gamemode", "sp");
- }
- else
- {
- SetKeyValue (g_qeglobals.d_project_entity, "gamemode", "mp");
- }
- }
-
- g_qeglobals.m_strHomeMaps = g_qeglobals.m_strHomeGame;
- const char* str = ValueForKey(g_qeglobals.d_project_entity, "gamename");
- if(str[0] == '\0') str = g_pGameDescription->mBaseGame.GetBuffer();
- g_qeglobals.m_strHomeMaps += str;
- g_qeglobals.m_strHomeMaps += '/';
-
- // RIANT
- // SOF2 HACK
- if (g_pGameDescription->mGameFile == "sof2.game")
- {
- // read from gamemode_combo
- const char *gamemode = gtk_entry_get_text (GTK_ENTRY (GTK_COMBO(gamemode_combo)->entry));
- if (!strlen(gamemode) || !strcmp(gamemode, sSOF2SPCombo))
- {
- SetKeyValue (g_qeglobals.d_project_entity, "gamemode", "sp");
- }
- else
- {
- SetKeyValue (g_qeglobals.d_project_entity, "gamemode", "mp");
- }
- }
-
- if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (brush)))
- g_qeglobals.m_bBrushPrimitMode = TRUE;
- else
- g_qeglobals.m_bBrushPrimitMode = FALSE;
-
- SetKeyValue(g_qeglobals.d_project_entity, "brush_primit", (g_qeglobals.m_bBrushPrimitMode ? "1" : "0" ));
-
- QE_SaveProject( g_PrefsDlg.m_strLastProject.GetBuffer() );
- }
-
- gtk_grab_remove (project);
- gtk_widget_destroy (project);
+void DoProjectSettings(){
+ GtkWidget *project;
+ GtkWidget *frame, *label, *vbox, *table1, *table2, *button;
+ GtkWidget *brush;
+ GtkWidget *scr;
+ GtkWidget *base, *game;
+ GtkWidget *gamemode_combo;
+ GList *combo_list = (GList*)NULL;
+
+ int loop = 1, ret = IDCANCEL;
+
+ project = gtk_window_new( GTK_WINDOW_TOPLEVEL );
+ gtk_window_set_title( GTK_WINDOW( project ), _( "Project Settings" ) );
+ gtk_signal_connect( GTK_OBJECT( project ), "delete_event",
+ GTK_SIGNAL_FUNC( dialog_delete_callback ), NULL );
+ gtk_signal_connect( GTK_OBJECT( project ), "destroy",
+ GTK_SIGNAL_FUNC( gtk_widget_destroy ), NULL );
+ g_object_set_data( G_OBJECT( project ), "loop", &loop );
+ g_object_set_data( G_OBJECT( project ), "ret", &ret );
+ gtk_window_set_default_size( GTK_WINDOW( project ), 550, 400 );
+
+ table1 = gtk_table_new( 3, 2, FALSE );
+ gtk_widget_show( table1 );
+ gtk_container_add( GTK_CONTAINER( project ), table1 );
+ gtk_container_set_border_width( GTK_CONTAINER( table1 ), 5 );
+ gtk_table_set_row_spacings( GTK_TABLE( table1 ), 5 );
+ gtk_table_set_col_spacings( GTK_TABLE( table1 ), 5 );
+
+ vbox = gtk_vbox_new( FALSE, 5 );
+ gtk_widget_show( vbox );
+ gtk_table_attach( GTK_TABLE( table1 ), vbox, 1, 2, 0, 1,
+ (GtkAttachOptions) ( GTK_FILL ),
+ (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
+
+ button = gtk_button_new_with_label( _( "OK" ) );
+ gtk_widget_show( button );
+ gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, FALSE, 0 );
+ gtk_signal_connect( GTK_OBJECT( button ), "clicked",
+ GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( IDOK ) );
+ gtk_widget_set_usize( button, 60, -2 );
+
+ button = gtk_button_new_with_label( _( "Cancel" ) );
+ gtk_widget_show( button );
+ gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, FALSE, 0 );
+ gtk_signal_connect( GTK_OBJECT( button ), "clicked",
+ GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( IDCANCEL ) );
+ gtk_widget_set_usize( button, 60, -2 );
+
+ vbox = gtk_vbox_new( FALSE, 5 );
+ gtk_widget_show( vbox );
+ gtk_table_attach( GTK_TABLE( table1 ), vbox, 1, 2, 1, 2,
+ (GtkAttachOptions) ( GTK_FILL ),
+ (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
+
+ button = gtk_button_new_with_label( _( "Add..." ) );
+ gtk_widget_show( button );
+ gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, FALSE, 0 );
+ gtk_signal_connect( GTK_OBJECT( button ), "clicked",
+ GTK_SIGNAL_FUNC( project_add ), project );
+ gtk_widget_set_usize( button, 60, -2 );
+
+ button = gtk_button_new_with_label( _( "Change..." ) );
+ gtk_widget_show( button );
+ gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, FALSE, 0 );
+ gtk_signal_connect( GTK_OBJECT( button ), "clicked",
+ GTK_SIGNAL_FUNC( project_change ), project );
+ gtk_widget_set_usize( button, 60, -2 );
+
+ button = gtk_button_new_with_label( _( "Remove" ) );
+ gtk_widget_show( button );
+ gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, FALSE, 0 );
+ gtk_signal_connect( GTK_OBJECT( button ), "clicked",
+ GTK_SIGNAL_FUNC( project_remove ), project );
+ gtk_widget_set_usize( button, 60, -2 );
+
+ frame = gtk_frame_new( _( "Misc settings" ) );
+ gtk_widget_show( frame );
+ gtk_table_attach( GTK_TABLE( table1 ), frame, 0, 1, 2, 3,
+ (GtkAttachOptions) ( GTK_FILL ),
+ (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
+
+ brush = gtk_check_button_new_with_label( _( "Use brush primitives in MAP files (NOTE: experimental feature,\n"
+ "required by the texture tools plugin)" ) );
+ gtk_widget_show( brush );
+ gtk_container_add( GTK_CONTAINER( frame ), brush );
+ gtk_container_set_border_width( GTK_CONTAINER( brush ), 5 );
+
+ frame = gtk_frame_new( _( "Menu commands" ) );
+ gtk_widget_show( frame );
+ gtk_table_attach( GTK_TABLE( table1 ), frame, 0, 1, 1, 2,
+ (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
+ (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 );
+
+ scr = gtk_scrolled_window_new( (GtkAdjustment*)NULL, (GtkAdjustment*)NULL );
+ gtk_widget_show( scr );
+ gtk_container_add( GTK_CONTAINER( frame ), scr );
+ gtk_container_set_border_width( GTK_CONTAINER( scr ), 5 );
+ gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scr ), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC );
+ gtk_scrolled_window_set_shadow_type( GTK_SCROLLED_WINDOW( scr ), GTK_SHADOW_IN );
+
+
+ {
+ GtkListStore* store = gtk_list_store_new( 1, G_TYPE_STRING );
+
+ GtkWidget* view = gtk_tree_view_new_with_model( GTK_TREE_MODEL( store ) );
+ gtk_tree_view_set_headers_visible( GTK_TREE_VIEW( view ), FALSE );
+
+ GtkCellRenderer* renderer = gtk_cell_renderer_text_new();
+ GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( "", renderer, "text", 0, NULL );
+ gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column );
+
+ GtkTreeSelection* selection = gtk_tree_view_get_selection( GTK_TREE_VIEW( view ) );
+ gtk_tree_selection_set_mode( selection, GTK_SELECTION_BROWSE );
+
+ gtk_widget_show( view );
+
+ g_object_set_data( G_OBJECT( project ), "view", view );
+ g_object_set_data( G_OBJECT( project ), "bsp_commands", store );
+ gtk_container_add( GTK_CONTAINER( scr ), view );
+
+ g_object_unref( G_OBJECT( store ) );
+ }
+
+ frame = gtk_frame_new( _( "Project settings" ) );
+ gtk_widget_show( frame );
+ gtk_table_attach( GTK_TABLE( table1 ), frame, 0, 1, 0, 1,
+ (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
+ (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
+
+ // HACK: hardcoded game stuff
+ if ( g_pGameDescription->mGameFile == "wolf.game" ||
+ g_pGameDescription->mGameFile == "et.game" ||
+ g_pGameDescription->mGameFile == "jk2.game" ||
+ g_pGameDescription->mGameFile == "stvef.game" ||
+ g_pGameDescription->mGameFile == "sof2.game" ||
+ g_pGameDescription->mGameFile == "ja.game" ) {
+ table2 = gtk_table_new( 9, 2, FALSE );
+ }
+ else
+ {
+ table2 = gtk_table_new( 8, 2, FALSE );
+ }
+ gtk_widget_show( table2 );
+ gtk_container_add( GTK_CONTAINER( frame ), table2 );
+ gtk_container_set_border_width( GTK_CONTAINER( table2 ), 5 );
+ gtk_table_set_row_spacings( GTK_TABLE( table2 ), 5 );
+ gtk_table_set_col_spacings( GTK_TABLE( table2 ), 5 );
+
+ /*
+ fill in the game selection combo
+ HACK: hardcoded Q3/Wolf/HL switch
+ \todo that stuff would be faster to write with implementation of property bags and associated code to edit
+ */
+ if ( g_pGameDescription->mGameFile == "wolf.game" ) {
+ combo_list = g_list_append( combo_list, (void *)sWolfComboItem );
+ combo_list = g_list_append( combo_list, (void *)sWolfModComboItem );
+ }
+ else if ( g_pGameDescription->mGameFile == "et.game" ) {
+ combo_list = g_list_append( combo_list, (void *)sETComboItem );
+ combo_list = g_list_append( combo_list, (void *)sETModComboItem );
+ }
+ else if ( g_pGameDescription->mGameFile == "hl.game" ) {
+ combo_list = g_list_append( combo_list, (void *)sHLComboItem );
+ combo_list = g_list_append( combo_list, (void *)sHLModComboItem );
+ }
+ // RIANT
+ // JK2 HACK
+ else if ( g_pGameDescription->mGameFile == "jk2.game" ) {
+ combo_list = g_list_append( combo_list, (void *)sJK2ComboItem );
+ combo_list = g_list_append( combo_list, (void *)sJK2ModComboItem );
+ }
+ // TTimo
+ // JA HACK
+ else if ( g_pGameDescription->mGameFile == "ja.game" ) {
+ combo_list = g_list_append( combo_list, (void *)sJAComboItem );
+ combo_list = g_list_append( combo_list, (void *)sJAModComboItem );
+ }
+ // RIANT
+ // STVEF HACK
+ else if ( g_pGameDescription->mGameFile == "stvef.game" ) {
+ combo_list = g_list_append( combo_list, (void *)sSTVEFComboItem );
+ combo_list = g_list_append( combo_list, (void *)sSTVEFModComboItem );
+ }
+ // RIANT
+ // SOF2 HACK A LA JK2 A LA WOLF
+ else if ( g_pGameDescription->mGameFile == "sof2.game" ) {
+ combo_list = g_list_append( combo_list, (void *)sSOF2ComboItem );
+ combo_list = g_list_append( combo_list, (void *)sSOF2ModComboItem );
+ }
+ else
+ {
+ // Q3 or default
+ combo_list = g_list_append( combo_list, (void *)sQ3ComboItem );
+ combo_list = g_list_append( combo_list, (void *)sTAComboItem );
+ combo_list = g_list_append( combo_list, (void *)sModComboItem );
+ }
+
+ game_select = gtk_combo_new();
+ gtk_combo_set_popdown_strings( GTK_COMBO( game_select ), combo_list );
+ gtk_widget_show( game_select );
+ gtk_table_attach( GTK_TABLE( table2 ), game_select, 1, 2, 6, 7,
+ (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
+ (GtkAttachOptions) ( 0 ), 0, 0 );
+
+ gtk_signal_connect( GTK_OBJECT( GTK_COMBO( game_select )->entry ), "changed",
+ GTK_SIGNAL_FUNC( OnSelchangeComboWhatgame ), NULL );
+
+ g_list_free( combo_list );
+ gtk_entry_set_editable( GTK_ENTRY( GTK_COMBO( game_select )->entry ), FALSE );
+
+ game = gtk_entry_new();
+ fsgame_entry = GTK_ENTRY( game );
+ gtk_widget_show( game );
+ gtk_table_attach( GTK_TABLE( table2 ), game, 1, 2, 7, 8,
+ (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
+ (GtkAttachOptions) ( 0 ), 0, 0 );
+
+ /*
+ wolf specific: select MP or SP mode
+ */
+ if ( g_pGameDescription->mGameFile == "wolf.game" ) {
+ combo_list = NULL;
+ combo_list = g_list_append( combo_list, (void *)sWolfSPCombo );
+ combo_list = g_list_append( combo_list, (void *)sWolfMPCombo );
+
+ gamemode_combo = gtk_combo_new();
+ gtk_combo_set_popdown_strings( GTK_COMBO( gamemode_combo ), combo_list );
+ gtk_widget_show( gamemode_combo );
+ gtk_table_attach( GTK_TABLE( table2 ), gamemode_combo, 1, 2, 8, 9,
+ (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
+ (GtkAttachOptions) ( 0 ), 0, 0 );
+
+ g_list_free( combo_list );
+ combo_list = NULL;
+
+ label = gtk_label_new( _( "Mapping mode" ) );
+ gtk_widget_show( label );
+ gtk_table_attach( GTK_TABLE( table2 ), label, 0, 1, 8, 9,
+ (GtkAttachOptions) ( GTK_FILL ),
+ (GtkAttachOptions) ( 0 ), 0, 0 );
+ gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 );
+ }
+
+ // RIANT
+ // JK2 HACK
+ if ( g_pGameDescription->mGameFile == "jk2.game" ) {
+ combo_list = NULL;
+ combo_list = g_list_append( combo_list, (void *)sJK2SPCombo );
+ combo_list = g_list_append( combo_list, (void *)sJK2MPCombo );
+
+ gamemode_combo = gtk_combo_new();
+ gtk_combo_set_popdown_strings( GTK_COMBO( gamemode_combo ), combo_list );
+ gtk_widget_show( gamemode_combo );
+ gtk_table_attach( GTK_TABLE( table2 ), gamemode_combo, 1, 2, 8, 9,
+ (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
+ (GtkAttachOptions) ( 0 ), 0, 0 );
+
+ g_list_free( combo_list );
+ combo_list = NULL;
+
+ label = gtk_label_new( _( "Mapping mode" ) );
+ gtk_widget_show( label );
+ gtk_table_attach( GTK_TABLE( table2 ), label, 0, 1, 8, 9,
+ (GtkAttachOptions) ( GTK_FILL ),
+ (GtkAttachOptions) ( 0 ), 0, 0 );
+ gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 );
+ }
+ // TTimo
+ // JA HACK
+ if ( g_pGameDescription->mGameFile == "ja.game" ) {
+ combo_list = NULL;
+ combo_list = g_list_append( combo_list, (void *)sJASPCombo );
+ combo_list = g_list_append( combo_list, (void *)sJAMPCombo );
+
+ gamemode_combo = gtk_combo_new();
+ gtk_combo_set_popdown_strings( GTK_COMBO( gamemode_combo ), combo_list );
+ gtk_widget_show( gamemode_combo );
+ gtk_table_attach( GTK_TABLE( table2 ), gamemode_combo, 1, 2, 8, 9,
+ (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
+ (GtkAttachOptions) ( 0 ), 0, 0 );
+
+ g_list_free( combo_list );
+ combo_list = NULL;
+
+ label = gtk_label_new( _( "Mapping mode" ) );
+ gtk_widget_show( label );
+ gtk_table_attach( GTK_TABLE( table2 ), label, 0, 1, 8, 9,
+ (GtkAttachOptions) ( GTK_FILL ),
+ (GtkAttachOptions) ( 0 ), 0, 0 );
+ gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 );
+ }
+ // RIANT
+ // STVEF HACK
+ if ( g_pGameDescription->mGameFile == "stvef.game" ) {
+ combo_list = NULL;
+ combo_list = g_list_append( combo_list, (void *)sSTVEFSPCombo );
+ combo_list = g_list_append( combo_list, (void *)sSTVEFMPCombo );
+
+ gamemode_combo = gtk_combo_new();
+ gtk_combo_set_popdown_strings( GTK_COMBO( gamemode_combo ), combo_list );
+ gtk_widget_show( gamemode_combo );
+ gtk_table_attach( GTK_TABLE( table2 ), gamemode_combo, 1, 2, 8, 9,
+ (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
+ (GtkAttachOptions) ( 0 ), 0, 0 );
+
+ g_list_free( combo_list );
+ combo_list = NULL;
+
+ label = gtk_label_new( _( "Mapping mode" ) );
+ gtk_widget_show( label );
+ gtk_table_attach( GTK_TABLE( table2 ), label, 0, 1, 8, 9,
+ (GtkAttachOptions) ( GTK_FILL ),
+ (GtkAttachOptions) ( 0 ), 0, 0 );
+ gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 );
+ }
+ // RIANT
+ // SOF2 HACK
+ if ( g_pGameDescription->mGameFile == "sof2.game" ) {
+ combo_list = NULL;
+ combo_list = g_list_append( combo_list, (void *)sSOF2SPCombo );
+ combo_list = g_list_append( combo_list, (void *)sSOF2MPCombo );
+
+ gamemode_combo = gtk_combo_new();
+ gtk_combo_set_popdown_strings( GTK_COMBO( gamemode_combo ), combo_list );
+ gtk_widget_show( gamemode_combo );
+ gtk_table_attach( GTK_TABLE( table2 ), gamemode_combo, 1, 2, 8, 9,
+ (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
+ (GtkAttachOptions) ( 0 ), 0, 0 );
+
+ g_list_free( combo_list );
+ combo_list = NULL;
+
+ label = gtk_label_new( _( "Mapping mode" ) );
+ gtk_widget_show( label );
+ gtk_table_attach( GTK_TABLE( table2 ), label, 0, 1, 8, 9,
+ (GtkAttachOptions) ( GTK_FILL ),
+ (GtkAttachOptions) ( 0 ), 0, 0 );
+ gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 );
+ }
+
+ /*
+ the usual stuff
+ */
+
+ base = gtk_entry_new();
+ g_object_set_data( G_OBJECT( project ), "base", base );
+ gtk_widget_show( base );
+ gtk_table_attach( GTK_TABLE( table2 ), base, 1, 2, 0, 1,
+ (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
+ (GtkAttachOptions) ( 0 ), 0, 0 );
+
+
+ label = gtk_label_new( _( "basepath" ) );
+ gtk_widget_show( label );
+ gtk_table_attach( GTK_TABLE( table2 ), label, 0, 1, 0, 1,
+ (GtkAttachOptions) ( GTK_FILL ),
+ (GtkAttachOptions) ( 0 ), 0, 0 );
+ gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 );
+
+
+ label = gtk_label_new( _( "Select mod" ) );
+ gtk_widget_show( label );
+ gtk_table_attach( GTK_TABLE( table2 ), label, 0, 1, 6, 7,
+ (GtkAttachOptions) ( GTK_FILL ),
+ (GtkAttachOptions) ( 0 ), 0, 0 );
+ gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 );
+
+ label = gtk_label_new( _( "fs_game" ) );
+ gtk_widget_show( label );
+ gtk_table_attach( GTK_TABLE( table2 ), label, 0, 1, 7, 8,
+ (GtkAttachOptions) ( GTK_FILL ),
+ (GtkAttachOptions) ( 0 ), 0, 0 );
+ gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 );
+
+ // Initialize fields
+ gtk_entry_set_text( GTK_ENTRY( base ), ValueForKey( g_qeglobals.d_project_entity, "basepath" ) );
+ UpdateBSPCommandList( project );
+ gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( brush ), ( g_qeglobals.m_bBrushPrimitMode ) ? TRUE : FALSE );
+
+ // initialise the fs_game selection from the project settings into the dialog
+ const char *dir = ValueForKey( g_qeglobals.d_project_entity, "gamename" );
+ // HACK: hardcoded wolf stuff
+ if ( g_pGameDescription->mGameFile == "wolf.game" ) {
+ if ( ( strlen( dir ) == 0 ) || !stricmp( dir,"main" ) ) {
+ // no fs_game set, we are running stock Quake III Arena editing
+ gtk_entry_set_text( GTK_ENTRY( GTK_COMBO( game_select )->entry ), sWolfComboItem );
+ gtk_entry_set_text( GTK_ENTRY( game ), "" );
+ gtk_widget_set_sensitive( game, false );
+ }
+ else
+ {
+ // this is a custom mod
+ gtk_entry_set_text( GTK_ENTRY( GTK_COMBO( game_select )->entry ), sWolfModComboItem );
+ gtk_entry_set_text( GTK_ENTRY( game ), dir );
+ gtk_widget_set_sensitive( game, true );
+ }
+ }
+ // HACK: hardcoded et stuff
+ if ( g_pGameDescription->mGameFile == "et.game" ) {
+ if ( ( strlen( dir ) == 0 ) || !stricmp( dir,"etmain" ) ) {
+ // no fs_game set, we are running stock Quake III Arena editing
+ gtk_entry_set_text( GTK_ENTRY( GTK_COMBO( game_select )->entry ), sETComboItem );
+ gtk_entry_set_text( GTK_ENTRY( game ), "" );
+ gtk_widget_set_sensitive( game, false );
+ }
+ else
+ {
+ // this is a custom mod
+ gtk_entry_set_text( GTK_ENTRY( GTK_COMBO( game_select )->entry ), sETModComboItem );
+ gtk_entry_set_text( GTK_ENTRY( game ), dir );
+ gtk_widget_set_sensitive( game, true );
+ }
+ }
+ // HACK: hardcoded half-life stuff
+ else if ( g_pGameDescription->mGameFile == "hl.game" ) {
+ if ( ( strlen( dir ) == 0 ) || !stricmp( dir,"valve" ) ) {
+ gtk_entry_set_text( GTK_ENTRY( GTK_COMBO( game_select )->entry ), sHLComboItem );
+ gtk_entry_set_text( GTK_ENTRY( game ), "" );
+ gtk_widget_set_sensitive( game, false );
+ }
+ else
+ {
+ // this is a custom mod
+ gtk_entry_set_text( GTK_ENTRY( GTK_COMBO( game_select )->entry ), sHLModComboItem );
+ gtk_entry_set_text( GTK_ENTRY( game ), dir );
+ gtk_widget_set_sensitive( game, true );
+ }
+ }
+ // RIANT
+ // JK2 HACK
+ else if ( g_pGameDescription->mGameFile == "jk2.game" ) {
+ if ( ( strlen( dir ) == 0 ) || !stricmp( dir,"base" ) ) {
+ // no fs_game set, we are running stock Quake III Arena editing
+ gtk_entry_set_text( GTK_ENTRY( GTK_COMBO( game_select )->entry ), sJK2ComboItem );
+ gtk_entry_set_text( GTK_ENTRY( game ), "" );
+ gtk_widget_set_sensitive( game, false );
+ }
+ else
+ {
+ // this is a custom mod
+ gtk_entry_set_text( GTK_ENTRY( GTK_COMBO( game_select )->entry ), sJK2ModComboItem );
+ gtk_entry_set_text( GTK_ENTRY( game ), dir );
+ gtk_widget_set_sensitive( game, true );
+ }
+ }
+ // TTimo
+ // JA HACK
+ else if ( g_pGameDescription->mGameFile == "ja.game" ) {
+ if ( ( strlen( dir ) == 0 ) || !stricmp( dir,"base" ) ) {
+ // no fs_game set, we are running stock editing
+ gtk_entry_set_text( GTK_ENTRY( GTK_COMBO( game_select )->entry ), sJAComboItem );
+ gtk_entry_set_text( GTK_ENTRY( game ), "" );
+ gtk_widget_set_sensitive( game, false );
+ }
+ else
+ {
+ // this is a custom mod
+ gtk_entry_set_text( GTK_ENTRY( GTK_COMBO( game_select )->entry ), sJAModComboItem );
+ gtk_entry_set_text( GTK_ENTRY( game ), dir );
+ gtk_widget_set_sensitive( game, true );
+ }
+ }
+ // RIANT
+ // STVEF2 HACK
+ else if ( g_pGameDescription->mGameFile == "stvef.game" ) {
+ if ( ( strlen( dir ) == 0 ) || !stricmp( dir,"baseEf" ) ) {
+ // no fs_game set, we are running stock Quake III Arena editing
+ gtk_entry_set_text( GTK_ENTRY( GTK_COMBO( game_select )->entry ), sSTVEFComboItem );
+ gtk_entry_set_text( GTK_ENTRY( game ), "" );
+ gtk_widget_set_sensitive( game, false );
+ }
+ else
+ {
+ // this is a custom mod
+ gtk_entry_set_text( GTK_ENTRY( GTK_COMBO( game_select )->entry ), sSTVEFModComboItem );
+ gtk_entry_set_text( GTK_ENTRY( game ), dir );
+ gtk_widget_set_sensitive( game, true );
+ }
+ }
+ // RIANT
+ // SOF2 HACK
+ else if ( g_pGameDescription->mGameFile == "sof2.game" ) {
+ if ( ( strlen( dir ) == 0 ) || !stricmp( dir,"base" ) ) {
+ // no fs_game set, we are running stock Quake III Arena editing
+ gtk_entry_set_text( GTK_ENTRY( GTK_COMBO( game_select )->entry ), sSOF2ComboItem );
+ gtk_entry_set_text( GTK_ENTRY( game ), "" );
+ gtk_widget_set_sensitive( game, false );
+ }
+ else
+ {
+ // this is a custom mod
+ gtk_entry_set_text( GTK_ENTRY( GTK_COMBO( game_select )->entry ), sSOF2ModComboItem );
+ gtk_entry_set_text( GTK_ENTRY( game ), dir );
+ gtk_widget_set_sensitive( game, true );
+ }
+ }
+ else
+ {
+ if ( ( strlen( dir ) == 0 ) || !strcmp( dir,"baseq3" ) ) {
+ // no fs_game set, we are running stock Quake III Arena editing
+ gtk_entry_set_text( GTK_ENTRY( GTK_COMBO( game_select )->entry ), sQ3ComboItem );
+ gtk_entry_set_text( GTK_ENTRY( game ), "" );
+ gtk_widget_set_sensitive( game, false );
+ }
+ else if ( !strcmp( dir,"missionpack" ) ) {
+ gtk_entry_set_text( GTK_ENTRY( GTK_COMBO( game_select )->entry ), sTAComboItem );
+ gtk_entry_set_text( GTK_ENTRY( game ), "missionpack" );
+ gtk_widget_set_sensitive( game, false );
+ }
+ else
+ {
+ // this is a custom mod
+ gtk_entry_set_text( GTK_ENTRY( GTK_COMBO( game_select )->entry ), sModComboItem );
+ gtk_entry_set_text( GTK_ENTRY( game ), dir );
+ gtk_widget_set_sensitive( game, true );
+ }
+ }
+
+ // HACK: hardcoded wolf stuff
+ if ( g_pGameDescription->mGameFile == "wolf.game" ) {
+ const char *gamemode = ValueForKey( g_qeglobals.d_project_entity, "gamemode" );
+ if ( ( strlen( gamemode ) == 0 ) || !strcmp( gamemode,"sp" ) ) {
+ // nothing set yet, or single player
+ gtk_entry_set_text( GTK_ENTRY( GTK_COMBO( gamemode_combo )->entry ), sWolfSPCombo );
+ }
+ else
+ {
+ gtk_entry_set_text( GTK_ENTRY( GTK_COMBO( gamemode_combo )->entry ), sWolfMPCombo );
+ }
+ }
+
+ // JK2 HACK
+ else if ( g_pGameDescription->mGameFile == "jk2.game" ) {
+ const char *gamemode = ValueForKey( g_qeglobals.d_project_entity, "gamemode" );
+ if ( ( strlen( gamemode ) == 0 ) || !strcmp( gamemode,"sp" ) ) {
+ // nothing set yet, or single player
+ gtk_entry_set_text( GTK_ENTRY( GTK_COMBO( gamemode_combo )->entry ), sJK2SPCombo );
+ }
+ else
+ {
+ gtk_entry_set_text( GTK_ENTRY( GTK_COMBO( gamemode_combo )->entry ), sJK2MPCombo );
+ }
+ }
+ // JA HACK
+ else if ( g_pGameDescription->mGameFile == "ja.game" ) {
+ const char *gamemode = ValueForKey( g_qeglobals.d_project_entity, "gamemode" );
+ if ( ( strlen( gamemode ) == 0 ) || !strcmp( gamemode,"sp" ) ) {
+ // nothing set yet, or single player
+ gtk_entry_set_text( GTK_ENTRY( GTK_COMBO( gamemode_combo )->entry ), sJASPCombo );
+ }
+ else
+ {
+ gtk_entry_set_text( GTK_ENTRY( GTK_COMBO( gamemode_combo )->entry ), sJAMPCombo );
+ }
+ }
+ // STVEF HACK
+ else if ( g_pGameDescription->mGameFile == "stvef.game" ) {
+ const char *gamemode = ValueForKey( g_qeglobals.d_project_entity, "gamemode" );
+ if ( ( strlen( gamemode ) == 0 ) || !strcmp( gamemode,"sp" ) ) {
+ // nothing set yet, or single player
+ gtk_entry_set_text( GTK_ENTRY( GTK_COMBO( gamemode_combo )->entry ), sSTVEFSPCombo );
+ }
+ else
+ {
+ gtk_entry_set_text( GTK_ENTRY( GTK_COMBO( gamemode_combo )->entry ), sSTVEFMPCombo );
+ }
+ }
+ // SOF2 HACK
+ else if ( g_pGameDescription->mGameFile == "sof2.game" ) {
+ const char *gamemode = ValueForKey( g_qeglobals.d_project_entity, "gamemode" );
+ if ( ( strlen( gamemode ) == 0 ) || !strcmp( gamemode,"sp" ) ) {
+ // nothing set yet, or single player
+ gtk_entry_set_text( GTK_ENTRY( GTK_COMBO( gamemode_combo )->entry ), sSOF2SPCombo );
+ }
+ else
+ {
+ gtk_entry_set_text( GTK_ENTRY( GTK_COMBO( gamemode_combo )->entry ), sSOF2MPCombo );
+ }
+ }
+
+ gtk_grab_add( project );
+ gtk_widget_show( project );
+
+ g_pGameDescription->Dump();
+
+ while ( loop )
+ gtk_main_iteration();
+
+ if ( ret == IDOK ) {
+ char buf[1024];
+ const char *r;
+ char *w;
+
+ // convert path to unix format
+ for ( r = gtk_entry_get_text( GTK_ENTRY( base ) ), w = buf; *r != '\0'; r++, w++ )
+ *w = ( *r == '\\' ) ? '/' : *r;
+ // add last slash
+ if ( w != buf && *( w - 1 ) != '/' ) {
+ *( w++ ) = '/';
+ }
+ // terminate string
+ *w = '\0';
+ SetKeyValue( g_qeglobals.d_project_entity, "basepath", buf );
+
+ dir = gtk_entry_get_text( GTK_ENTRY( game ) );
+ // Hack: hard coded wolf stuff
+ if ( g_pGameDescription->mGameFile == "wolf.game" ) {
+ if ( !strlen( dir ) || !stricmp( dir,"main" ) ) {
+ DeleteKey( g_qeglobals.d_project_entity, "gamename" );
+ }
+ else
+ {
+ SetKeyValue( g_qeglobals.d_project_entity, "gamename", dir );
+ }
+ }
+ // Hack: hard coded ET stuff
+ else if ( g_pGameDescription->mGameFile == "et.game" ) {
+ if ( !strlen( dir ) || !stricmp( dir,"etmain" ) ) {
+ DeleteKey( g_qeglobals.d_project_entity, "gamename" );
+ }
+ else
+ {
+ SetKeyValue( g_qeglobals.d_project_entity, "gamename", dir );
+ }
+ }
+ // Hack: hard coded Half-life stuff
+ else if ( g_pGameDescription->mGameFile == "hl.game" ) {
+ if ( !strlen( dir ) || !stricmp( dir,"valve" ) ) {
+ DeleteKey( g_qeglobals.d_project_entity, "gamename" );
+ }
+ else
+ {
+ SetKeyValue( g_qeglobals.d_project_entity, "gamename", dir );
+ }
+ }
+ else if ( g_pGameDescription->mGameFile == "jk2.game" || g_pGameDescription->mGameFile == "ja.game" ) {
+ if ( !strlen( dir ) || !stricmp( dir,"base" ) ) {
+ DeleteKey( g_qeglobals.d_project_entity, "gamename" );
+ }
+ else
+ {
+ SetKeyValue( g_qeglobals.d_project_entity, "gamename", dir );
+ }
+ }
+ // RIANT
+ // STVEF HACK
+ else if ( g_pGameDescription->mGameFile == "stvef.game" ) {
+ if ( !strlen( dir ) || !stricmp( dir,"baseEf" ) ) {
+ DeleteKey( g_qeglobals.d_project_entity, "gamename" );
+ }
+ else
+ {
+ SetKeyValue( g_qeglobals.d_project_entity, "gamename", dir );
+ }
+ }
+ else
+ {
+ if ( !strlen( dir ) || !strcmp( dir,"baseq3" ) ) {
+ DeleteKey( g_qeglobals.d_project_entity, "gamename" );
+ }
+ else
+ {
+ SetKeyValue( g_qeglobals.d_project_entity, "gamename", dir );
+ }
+ }
+
+ // HACK: hardcoded wolf stuff
+ if ( g_pGameDescription->mGameFile == "wolf.game" ) {
+ // read from gamemode_combo
+ const char *gamemode = gtk_entry_get_text( GTK_ENTRY( GTK_COMBO( gamemode_combo )->entry ) );
+ if ( !strlen( gamemode ) || !strcmp( gamemode, sWolfSPCombo ) ) {
+ SetKeyValue( g_qeglobals.d_project_entity, "gamemode", "sp" );
+ }
+ else
+ {
+ SetKeyValue( g_qeglobals.d_project_entity, "gamemode", "mp" );
+ }
+ }
+
+ // RIANT
+ // JK2 HACK
+ if ( g_pGameDescription->mGameFile == "jk2.game" ) {
+ // read from gamemode_combo
+ const char *gamemode = gtk_entry_get_text( GTK_ENTRY( GTK_COMBO( gamemode_combo )->entry ) );
+ if ( !strlen( gamemode ) || !strcmp( gamemode, sJK2SPCombo ) ) {
+ SetKeyValue( g_qeglobals.d_project_entity, "gamemode", "sp" );
+ }
+ else
+ {
+ SetKeyValue( g_qeglobals.d_project_entity, "gamemode", "mp" );
+ }
+ }
+ // TTimo
+ // JA HACK
+ if ( g_pGameDescription->mGameFile == "ja.game" ) {
+ // read from gamemode_combo
+ const char *gamemode = gtk_entry_get_text( GTK_ENTRY( GTK_COMBO( gamemode_combo )->entry ) );
+ if ( !strlen( gamemode ) || !strcmp( gamemode, sJASPCombo ) ) {
+ SetKeyValue( g_qeglobals.d_project_entity, "gamemode", "sp" );
+ }
+ else
+ {
+ SetKeyValue( g_qeglobals.d_project_entity, "gamemode", "mp" );
+ }
+ }
+
+ // RIANT
+ // STVEF HACK
+ if ( g_pGameDescription->mGameFile == "stvef.game" ) {
+ // read from gamemode_combo
+ const char *gamemode = gtk_entry_get_text( GTK_ENTRY( GTK_COMBO( gamemode_combo )->entry ) );
+ if ( !strlen( gamemode ) || !strcmp( gamemode, sSTVEFSPCombo ) ) {
+ SetKeyValue( g_qeglobals.d_project_entity, "gamemode", "sp" );
+ }
+ else
+ {
+ SetKeyValue( g_qeglobals.d_project_entity, "gamemode", "mp" );
+ }
+ }
+
+ g_qeglobals.m_strHomeMaps = g_qeglobals.m_strHomeGame;
+ const char* str = ValueForKey( g_qeglobals.d_project_entity, "gamename" );
+ if ( str[0] == '\0' ) {
+ str = g_pGameDescription->mBaseGame.GetBuffer();
+ }
+ g_qeglobals.m_strHomeMaps += str;
+ g_qeglobals.m_strHomeMaps += '/';
+
+ // RIANT
+ // SOF2 HACK
+ if ( g_pGameDescription->mGameFile == "sof2.game" ) {
+ // read from gamemode_combo
+ const char *gamemode = gtk_entry_get_text( GTK_ENTRY( GTK_COMBO( gamemode_combo )->entry ) );
+ if ( !strlen( gamemode ) || !strcmp( gamemode, sSOF2SPCombo ) ) {
+ SetKeyValue( g_qeglobals.d_project_entity, "gamemode", "sp" );
+ }
+ else
+ {
+ SetKeyValue( g_qeglobals.d_project_entity, "gamemode", "mp" );
+ }
+ }
+
+ if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( brush ) ) ) {
+ g_qeglobals.m_bBrushPrimitMode = TRUE;
+ }
+ else{
+ g_qeglobals.m_bBrushPrimitMode = FALSE;
+ }
+
+ SetKeyValue( g_qeglobals.d_project_entity, "brush_primit", ( g_qeglobals.m_bBrushPrimitMode ? "1" : "0" ) );
+
+ QE_SaveProject( g_PrefsDlg.m_strLastProject.GetBuffer() );
+ }
+
+ gtk_grab_remove( project );
+ gtk_widget_destroy( project );