Copyright (c) 2001, Loki software, inc.
All rights reserved.
-Redistribution and use in source and binary forms, with or without modification,
+Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
-Redistributions of source code must retain the above copyright notice, this list
+Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
-Neither the name of Loki software nor the names of its contributors may be used
-to endorse or promote products derived from this software without specific prior
-written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
-DIRECT,INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+Neither the name of Loki software nor the names of its contributors may be used
+to endorse or promote products derived from this software without specific prior
+written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
+DIRECT,INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
//
#include "stdafx.h"
#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>
+#include <glib/gi18n.h>
#ifdef _WIN32
#include <gdk/gdkwin32.h>
qboolean DoColor (int iIndex)
{
static bool bColorOpen = false;
-
+
if(bColorOpen)
{
Sys_FPrintf(SYS_WRN, "DoColor dialog is already open\n");
return false;
}
- bColorOpen = true;
-
+ bColorOpen = true;
+
if (color_dialog (g_pParentWnd->m_pWidget, g_qeglobals.d_savedinfo.colors[iIndex]))
{
- /*
- ** scale colors so that at least one component is at 1.0F
+ /*
+ ** scale colors so that at least one component is at 1.0F
** if this is meant to select an entity color
*/
if (iIndex == COLOR_ENTITY)
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));
}
// HACK: hardcoded game stuff
if (g_pGameDescription->mGameFile == "wolf.game" ||
g_pGameDescription->mGameFile == "et.game" ||
- g_pGameDescription->mGameFile == "jk2.game" ||
+ g_pGameDescription->mGameFile == "jk2.game" ||
g_pGameDescription->mGameFile == "stvef.game" ||
g_pGameDescription->mGameFile == "sof2.game" ||
g_pGameDescription->mGameFile == "ja.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
*/
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);
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);
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);
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);
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);
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;
SetKeyValue (g_qeglobals.d_project_entity, "gamename", dir);
}
}
-
+
// HACK: hardcoded wolf stuff
if (g_pGameDescription->mGameFile == "wolf.game")
{
SetKeyValue (g_qeglobals.d_project_entity, "gamemode", "mp");
}
}
-
+
// RIANT
// STVEF HACK
if (g_pGameDescription->mGameFile == "stvef.game")
entitymap = g_slist_remove (entitymap, entitymap->data);
}
}
-
+
g_object_unref(G_OBJECT(store));
}
g_object_set_data(G_OBJECT(dlg), "keyvalues", store);
gtk_container_add(GTK_CONTAINER (scr), view);
-
+
g_object_unref(G_OBJECT(store));
}
hbox2 = gtk_hbox_new (FALSE, 5);
gtk_widget_show (hbox2);
gtk_box_pack_start (GTK_BOX (vbox), hbox2, TRUE, TRUE, 0);
-
+
button = gtk_button_new_with_label ("Select");
gtk_widget_show (button);
gtk_box_pack_start (GTK_BOX (hbox2), button, FALSE, FALSE, 0);
if (f != 0.0)
Select_RotateAxis(0,f);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (spin), 0.0f); // reset to 0 on Apply
-
+
spin = GTK_SPIN_BUTTON (g_object_get_data (G_OBJECT (data), "y"));
f = gtk_spin_button_get_value_as_float (spin);
if (f != 0.0)
Select_RotateAxis(1,f);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (spin), 0.0f);
-
+
spin = GTK_SPIN_BUTTON (g_object_get_data (G_OBJECT (data), "z"));
f = gtk_spin_button_get_value_as_float (spin);
if (f != 0.0)
gtk_widget_show (hbox);
gtk_container_add (GTK_CONTAINER (dlg), hbox);
gtk_container_set_border_width (GTK_CONTAINER (hbox), 5);
-
+
table = gtk_table_new (3, 2, FALSE);
gtk_widget_show (table);
gtk_box_pack_start (GTK_BOX (hbox), table, TRUE, TRUE, 0);
gtk_table_set_row_spacings (GTK_TABLE (table), 5);
gtk_table_set_col_spacings (GTK_TABLE (table), 5);
-
+
label = gtk_label_new (" X ");
gtk_widget_show (label);
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2,
(GtkAttachOptions) (0),
(GtkAttachOptions) (0), 0, 0);
-
+
label = gtk_label_new (" Z ");
gtk_widget_show (label);
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 2, 3,
(GtkAttachOptions) (0),
(GtkAttachOptions) (0), 0, 0);
-
+
adj = gtk_adjustment_new (0, -359, 359, 1, 10, 10);
x = gtk_spin_button_new (GTK_ADJUSTMENT (adj), 1, 0);
g_object_set_data (G_OBJECT (dlg), "x", x);
(GtkAttachOptions) (0), 0, 0);
gtk_widget_set_usize (x, 60, -2);
gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (x), TRUE);
-
+
adj = gtk_adjustment_new (0, -359, 359, 1, 10, 10);
y = gtk_spin_button_new (GTK_ADJUSTMENT (adj), 1, 0);
g_object_set_data (G_OBJECT (dlg), "y", y);
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (y), TRUE);
-
+
adj = gtk_adjustment_new (0, -359, 359, 1, 10, 10);
z = gtk_spin_button_new (GTK_ADJUSTMENT (adj), 1, 0);
g_object_set_data (G_OBJECT (dlg), "z", z);
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (z), TRUE);
-
+
vbox = gtk_vbox_new (FALSE, 5);
gtk_widget_show (vbox);
gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 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));
-
+
button = gtk_button_new_with_label ("Apply");
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);
if (b==&active_brushes)
{
// this is a regioned out entity
- e = e->next;
+ e = e->next;
// don't walk past the end either
if (e == &entities)
{
if (g_pParentWnd->GetXZWnd())
g_pParentWnd->GetXZWnd()->GetOrigin()[i] = (b->mins[i] + b->maxs[i])/2;
-
+
if (g_pParentWnd->GetYZWnd())
g_pParentWnd->GetYZWnd()->GetOrigin()[i] = (b->mins[i] + b->maxs[i])/2;
}
gtk_box_pack_start (GTK_BOX (vbox), table, TRUE, TRUE, 0);
gtk_table_set_row_spacings (GTK_TABLE (table), 5);
gtk_table_set_col_spacings (GTK_TABLE (table), 5);
-
+
label = gtk_label_new ("Entity number");
gtk_widget_show (label);
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
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 (hbox), 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_box_pack_start (GTK_BOX (hbox), table, TRUE, TRUE, 0);
gtk_table_set_row_spacings (GTK_TABLE (table), 5);
gtk_table_set_col_spacings (GTK_TABLE (table), 5);
-
+
label = gtk_label_new ("Width:");
gtk_widget_show (label);
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
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_box_pack_start (GTK_BOX (hbox), table, TRUE, TRUE, 0);
gtk_table_set_row_spacings (GTK_TABLE (table), 5);
gtk_table_set_col_spacings (GTK_TABLE (table), 5);
-
+
label = gtk_label_new ("X:");
gtk_widget_show (label);
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
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 (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 (vbox2), button, FALSE, FALSE, 0);
seams = gtk_check_button_new_with_label ("Seams");
gtk_widget_show (seams);
gtk_box_pack_start (GTK_BOX (hbox), seams, FALSE, FALSE, 0);
-
+
// bGroupResult
group = gtk_check_button_new_with_label("Result to func_group");
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(group), bGroupResult);
gtk_box_pack_start(GTK_BOX(vbox), group, FALSE, FALSE, 0);
gtk_widget_show(group);
-
+
// Initialize dialog
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (seams), TRUE);
"you may report your problems at\n"
"http://zerowing.idsoftware.com/bugzilla"
);
-
+
gtk_widget_show (label);
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
gtk_misc_set_alignment (GTK_MISC (label), 1, 0.5);
gtk_table_set_row_spacings (GTK_TABLE (table), 5);
gtk_table_set_col_spacings (GTK_TABLE (table), 5);
gtk_container_set_border_width (GTK_CONTAINER (table), 5);
-
+
label = gtk_label_new ("Vendor:");
gtk_widget_show (label);
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sc_extensions), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sc_extensions), GTK_SHADOW_IN);
gtk_widget_show(sc_extensions);
-
+
text_extensions = gtk_text_view_new();
gtk_text_view_set_editable(GTK_TEXT_VIEW(text_extensions), FALSE);
gtk_container_add (GTK_CONTAINER (sc_extensions), text_extensions);
GtkTextBuffer* buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text_extensions));
gtk_text_buffer_set_text(buffer, (char *)qglGetString(GL_EXTENSIONS), -1);
gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(text_extensions), GTK_WRAP_WORD);;
- gtk_widget_show(text_extensions);
-
+ gtk_widget_show(text_extensions);
+
gtk_grab_add (dlg);
gtk_widget_show (dlg);
}
// =============================================================================
-// Command List dialog
+// Command List dialog
void DoCommandListDlg ()
{
gtk_list_store_append(store, &iter);
gtk_list_store_set(store, &iter, 0, g_Commands[n].m_strCommand, 1, strMod.GetBuffer (), -1);
}
-
+
if (fileout != NULL)
{
strLine.Format("%-25s %s\r\n", g_Commands[n].m_strCommand, strMod.GetBuffer ());
if (fileout != NULL)
fclose (fileout);
}
-
+
g_object_unref(G_OBJECT(store));
}
}
// =============================================================================
-// Texture List dialog
+// Texture List dialog
void DoTextureListDlg ()
{
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);
+ gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(view), FALSE);
{
GtkCellRenderer* renderer = gtk_cell_renderer_text_new();
textures = g_slist_remove (textures, textures->data);
}
}
-
+
g_object_unref(G_OBJECT(store));
texture_list = view;
}
// =============================================================================
-// Cap dialog
+// Cap dialog
int DoCapDlg (int *type, bool *b_GroupResult)
{
GtkWidget *bevel, *endcap, *ibevel, *iendcap;
GSList *group = (GSList*)NULL;
int loop = 1, ret = IDCANCEL;
-
+
dlg = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (dlg), "Cap");
gtk_signal_connect (GTK_OBJECT (dlg), "delete_event",
radio_vbox = gtk_vbox_new(FALSE, 4);
gtk_container_add(GTK_CONTAINER(hbox), radio_vbox);
gtk_widget_show(radio_vbox);
-
+
table = gtk_table_new (4, 2, FALSE);
gtk_widget_show (table);
gtk_box_pack_start (GTK_BOX (radio_vbox), table, TRUE, TRUE, 0);
gtk_table_set_row_spacings (GTK_TABLE (table), 5);
gtk_table_set_col_spacings (GTK_TABLE (table), 5);
-
+
pixmap = new_pixmap (g_pParentWnd->m_pWidget, "cap_bevel.bmp");
gtk_widget_show (pixmap);
gtk_table_attach (GTK_TABLE (table), pixmap, 0, 1, 0, 1,
group_toggle = gtk_check_button_new_with_label("Result to func_group");
gtk_container_add(GTK_CONTAINER(radio_vbox), group_toggle);
gtk_widget_show(group_toggle);
-
+
vbox = gtk_vbox_new (FALSE, 5);
gtk_widget_show (vbox);
gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 0);
// Gef: Set the state of the func_group toggle
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (group_toggle), *b_GroupResult);
-
+
// Initialize dialog
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (bevel), TRUE);
}
// =============================================================================
-// Scripts dialog
+// Scripts dialog
void DoScriptsDlg ()
{
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);
+ gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(view), FALSE);
{
GtkCellRenderer* renderer = gtk_cell_renderer_text_new();
fclose (f);
}
}
-
+
g_object_unref(G_OBJECT(store));
scripts_list = view;
}
// =============================================================================
-// dialog
+// dialog
int DoBSInputDlg (const char *fields[5], float values[5])
{
}
// =============================================================================
-// TextureLayout dialog
+// TextureLayout dialog
int DoTextureLayout (float *fx, float *fy)
{
gtk_box_pack_start (GTK_BOX (vbox), table, TRUE, TRUE, 0);
gtk_table_set_row_spacings (GTK_TABLE (table), 5);
gtk_table_set_col_spacings (GTK_TABLE (table), 5);
-
+
label = gtk_label_new ("Texture x:");
gtk_widget_show (label);
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
}
// =============================================================================
-// Name dialog
+// Name dialog
char* DoNameDlg (const char* title)
{
}
// =============================================================================
-// NewProject dialog
+// NewProject dialog
char* DoNewProjectDlg ()
{
}
// =============================================================================
-// Text Editor dialog
+// Text Editor dialog
// master window widget
static GtkWidget *text_editor = NULL;
strEditCommand += " \"";
strEditCommand += filename;
strEditCommand += "\"";
-
+
Sys_Printf("Launching: %s\n", strEditCommand.GetBuffer());
// note: linux does not return false if the command failed so it will assume success
if (Q_Exec(NULL, (char *)strEditCommand.GetBuffer(), NULL, true) == false)
}
}
#endif
-
+
DoGtkTextEditor (filename, cursorpos);
// old win32 code with EditPad bindings, broken
}
// =============================================================================
-// Light Intensity dialog
+// Light Intensity dialog
int DoLightIntensityDlg (int *intensity)
{