* fixed a lot of compiler warnings (mostly const char * stuff and use of uninitialized data)

* add support for translating radiant (just marked three strings, more to come)


git-svn-id: svn://svn.icculus.org/gtkradiant/GtkRadiant/trunk@264 8a3a26a2-13c4-0310-b231-cf6edde360e5
This commit is contained in:
mattn
2008-06-26 07:52:02 +00:00
parent 5efe3f31db
commit e4b1c1a55c
47 changed files with 1713 additions and 1685 deletions

View File

@@ -29,6 +29,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include <gtk/gtk.h>
#include <glib/gi18n.h>
#include <gdk/gdkkeysyms.h>
#include "surfdlg_plugin.h"
@@ -318,7 +319,7 @@ static void PopulateTextureComboList()
int num_of_list_items = 0;
blank[0] = 0;
if (texdef_face_list_empty())
{
items = g_list_append (items, (gpointer) blank);
@@ -327,7 +328,7 @@ static void PopulateTextureComboList()
}
else if ( !is_TextureName_conflicting )
{
temp_texdef_face_list = get_texdef_face_list();
temp_texdef_face_list = get_texdef_face_list();
tmp_texdef = (texdef_t *) &get_texdef_face_list()->texdef;
items = g_list_append( items, (gpointer) tmp_texdef->GetName() );
// For Texture Entry, activate only on entry change
@@ -353,7 +354,7 @@ static void PopulateTextureComboList()
// For Texture Entry, activate only on entry change
strcpy (old_texture_entry, blank);
}
gtk_combo_set_popdown_strings (GTK_COMBO (texture_combo), items);
g_list_free(items);
@@ -375,7 +376,7 @@ static void GetTexdefInfo_from_Radiant()
unsigned int count = GetSelectedFaceCountfromBrushes();
if(count == 0)
count = GetSelectedFaceCount();
g_texdef_face_vector.resize(count);
if (!texdef_face_list_empty())
@@ -383,9 +384,9 @@ static void GetTexdefInfo_from_Radiant()
texdef_to_face_t* p = get_texdef_face_list();
GetSelFacesTexdef( get_texdef_face_list() );
}
IsFaceConflicting();
PopulateTextureComboList();
PopulateTextureComboList();
ZeroOffsetValues();
}
@@ -431,14 +432,14 @@ void UpdateSurfaceDialog()
{
if (!g_bListenUpdate)
return;
if (!SurfaceInspector)
return;
// avoid long delays on slow computers
while (gtk_events_pending ())
gtk_main_iteration ();
if (g_surfwin)
{
#ifdef DBG_SI
@@ -459,7 +460,7 @@ void DoSurface (void)
#endif
if (!SurfaceInspector)
create_SurfaceInspector ();
ShowDlg();
SetTexMods ();
}
@@ -546,7 +547,7 @@ void SetTexMods()
if (!g_surfwin)
return;
pt = &texturewin->texdef;
g_bListenChanged = false;
@@ -554,24 +555,24 @@ void SetTexMods()
if(strncmp(pt->GetName(), "textures/", 9) != 0)
texdef_offset.SetName(SHADER_NOT_FOUND);
spin = GTK_SPIN_BUTTON (hshift_offset_spinbutton);
gtk_spin_button_set_value (spin, texdef_offset.shift[0]);
adjust = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spin));
adjust->step_increment = l_pIncrement->shift[0];
gtk_spin_button_set_value (GTK_SPIN_BUTTON(hshift_step_spinbutton), l_pIncrement->shift[0]);
spin = GTK_SPIN_BUTTON (hshift_value_spinbutton);
adjust = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spin));
adjust->step_increment = l_pIncrement->shift[0];
spin = GTK_SPIN_BUTTON (vshift_offset_spinbutton);
gtk_spin_button_set_value (spin, texdef_offset.shift[1]);
adjust = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spin));
adjust->step_increment = l_pIncrement->shift[1];
gtk_spin_button_set_value (GTK_SPIN_BUTTON(vshift_step_spinbutton), l_pIncrement->shift[1]);
spin = GTK_SPIN_BUTTON (vshift_value_spinbutton);
adjust = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spin));
adjust->step_increment = l_pIncrement->shift[1];
@@ -587,29 +588,29 @@ void SetTexMods()
adjust = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spin));
adjust->step_increment = l_pIncrement->scale[0];
spin = GTK_SPIN_BUTTON (vscale_offset_spinbutton);
gtk_spin_button_set_value (spin, texdef_offset.scale[1]);
adjust = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spin));
adjust->step_increment = l_pIncrement->scale[1];
gtk_spin_button_set_value (GTK_SPIN_BUTTON(vscale_step_spinbutton), l_pIncrement->scale[1]);
spin = GTK_SPIN_BUTTON (vscale_value_spinbutton);
adjust = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spin));
adjust->step_increment = l_pIncrement->scale[1];
spin = GTK_SPIN_BUTTON (rotate_offset_spinbutton);
gtk_spin_button_set_value (spin, texdef_offset.rotate);
adjust = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spin));
adjust->step_increment = l_pIncrement->rotate;
gtk_spin_button_set_value (GTK_SPIN_BUTTON(rotate_step_spinbutton), l_pIncrement->rotate);
spin = GTK_SPIN_BUTTON (rotate_value_spinbutton);
adjust = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spin));
adjust->step_increment = l_pIncrement->rotate;
g_bListenChanged = true;
// store the current texdef as our escape route if user hits OnCancel
@@ -655,7 +656,7 @@ void FitAll()
GtkWidget* create_SurfaceInspector (void)
{
GtkWidget *label;
GtkWidget *hseparator;
GtkWidget *eventbox;
@@ -693,7 +694,7 @@ GtkWidget* create_SurfaceInspector (void)
SurfaceInspector = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_container_set_border_width (GTK_CONTAINER (SurfaceInspector), 4);
gtk_window_set_title (GTK_WINDOW (SurfaceInspector), "Surface Inspector");
SetWinPos_from_Prefs(SurfaceInspector);
viewport8 = gtk_viewport_new (NULL, NULL);
@@ -724,7 +725,7 @@ GtkWidget* create_SurfaceInspector (void)
texture_combo = gtk_combo_new ();
g_object_set_data (G_OBJECT (GTK_COMBO (texture_combo)->popwin),
"KeepMeAround", texture_combo);
gtk_combo_disable_activate ( (GtkCombo*) texture_combo);
gtk_combo_disable_activate ( (GtkCombo*) texture_combo);
gtk_widget_show (texture_combo);
gtk_box_pack_start (GTK_BOX (hbox1), texture_combo, TRUE, TRUE, 0);
@@ -1025,7 +1026,7 @@ GtkWidget* create_SurfaceInspector (void)
gtk_spin_button_set_update_policy (GTK_SPIN_BUTTON (vscale_value_spinbutton), GTK_UPDATE_IF_VALID);
gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (vscale_value_spinbutton), TRUE);
gtk_widget_set_sensitive( GTK_WIDGET( vscale_value_spinbutton ), FALSE );
rotate_value_spinbutton_adj = gtk_adjustment_new (0.0, -360.0, 360.0, 1.0, 10.0, 10.0);
rotate_value_spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (rotate_value_spinbutton_adj), 1, 0);
gtk_widget_show (rotate_value_spinbutton);
@@ -1036,7 +1037,7 @@ GtkWidget* create_SurfaceInspector (void)
gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (rotate_value_spinbutton), TRUE);
gtk_widget_set_sensitive( GTK_WIDGET( rotate_value_spinbutton ), FALSE );
// Offset Spins
// Offset Spins
hshift_offset_spinbutton_adj = gtk_adjustment_new (0.0, -8192.0, 8192.0, 2.0, 8.0, 8.0);
hshift_offset_spinbutton = gtk_spin_button_new (GTK_ADJUSTMENT (hshift_offset_spinbutton_adj), 0, 2);
gtk_widget_show (hshift_offset_spinbutton);
@@ -1323,22 +1324,22 @@ GtkWidget* create_SurfaceInspector (void)
gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
g_signal_connect ( (gpointer) SurfaceInspector,
"delete_event",
G_CALLBACK (delete_event_callback),
g_signal_connect ( (gpointer) SurfaceInspector,
"delete_event",
G_CALLBACK (delete_event_callback),
NULL );
g_signal_connect ((gpointer) SurfaceInspector, "destroy",
G_CALLBACK (gtk_widget_destroy),
NULL);
g_signal_connect ((gpointer) texture_combo_entry, "key_press_event",
G_CALLBACK (on_texture_combo_entry_key_press_event),
NULL);
g_signal_connect ((gpointer) texture_combo_entry, "activate",
G_CALLBACK (on_texture_combo_entry_activate),
NULL);
g_signal_connect ((gpointer) hshift_offset_spinbutton, "value_changed",
G_CALLBACK (on_hshift_offset_spinbutton_value_changed),
NULL);
@@ -1354,7 +1355,7 @@ GtkWidget* create_SurfaceInspector (void)
g_signal_connect ((gpointer) rotate_offset_spinbutton, "value_changed",
G_CALLBACK (on_rotate_offset_spinbutton_value_changed),
NULL);
g_signal_connect ((gpointer) hshift_value_spinbutton, "value_changed",
G_CALLBACK (on_hshift_value_spinbutton_value_changed),
NULL);
@@ -1370,7 +1371,7 @@ GtkWidget* create_SurfaceInspector (void)
g_signal_connect ((gpointer) rotate_value_spinbutton, "value_changed",
G_CALLBACK (on_rotate_value_spinbutton_value_changed),
NULL);
g_signal_connect ((gpointer) hshift_step_spinbutton, "value_changed",
G_CALLBACK (on_hshift_step_spinbutton_value_changed),
NULL);
@@ -1386,14 +1387,14 @@ GtkWidget* create_SurfaceInspector (void)
g_signal_connect ((gpointer) rotate_step_spinbutton, "value_changed",
G_CALLBACK (on_rotate_step_spinbutton_value_changed),
NULL);
g_signal_connect ((gpointer) match_grid_button, "clicked",
G_CALLBACK (on_match_grid_button_clicked),
NULL);
g_signal_connect ((gpointer) lock_valuechange_togglebutton, "toggled",
G_CALLBACK (on_lock_valuechange_togglebutton_toggled),
NULL);
g_signal_connect ((gpointer) fit_width_spinbutton, "value_changed",
G_CALLBACK (on_fit_width_spinbutton_value_changed),
NULL);
@@ -1403,11 +1404,11 @@ GtkWidget* create_SurfaceInspector (void)
g_signal_connect ((gpointer) fit_button, "clicked",
G_CALLBACK (on_fit_button_clicked),
NULL);
g_signal_connect ((gpointer) axial_button, "clicked",
G_CALLBACK (on_axial_button_clicked),
NULL);
g_signal_connect ((gpointer) done_button, "clicked",
G_CALLBACK (on_done_button_clicked),
NULL);
@@ -1417,8 +1418,8 @@ GtkWidget* create_SurfaceInspector (void)
g_signal_connect ((gpointer) cancel_button, "clicked",
G_CALLBACK (on_cancel_button_clicked),
NULL);
return SurfaceInspector;
}
@@ -1440,7 +1441,7 @@ void on_texture_combo_entry_activate (GtkEntry *entry, gpointer user_data)
texdef_t* tmp_orig_texdef;
texdef_to_face_t* temp_texdef_face_list;
char text[128] = { 0 };
if (!texdef_face_list_empty() && g_bListenChanged)
{
// activate only on entry change
@@ -1451,7 +1452,7 @@ void on_texture_combo_entry_activate (GtkEntry *entry, gpointer user_data)
if (text[0] <= ' ' || strchr(text, ' '))
Sys_FPrintf(SYS_WRN, "WARNING: spaces in shader names are not allowed, ignoring '%s'\n", text);
else
{
{
for (temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next)
{
tmp_texdef = (texdef_t *) &temp_texdef_face_list->texdef;
@@ -1471,9 +1472,9 @@ static void on_hshift_offset_spinbutton_value_changed (GtkSpinButton *spinbutton
texdef_t* tmp_texdef;
texdef_t* tmp_orig_texdef;
texdef_to_face_t* temp_texdef_face_list;
texdef_offset.shift[0] = gtk_spin_button_get_value ( GTK_SPIN_BUTTON(hshift_offset_spinbutton) );
if (!texdef_face_list_empty() && g_bListenChanged)
{
for (temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next)
@@ -1494,9 +1495,9 @@ static void on_vshift_offset_spinbutton_value_changed (GtkSpinButton *spinbutton
texdef_t* tmp_texdef;
texdef_t* tmp_orig_texdef;
texdef_to_face_t* temp_texdef_face_list;
texdef_offset.shift[1] = gtk_spin_button_get_value ( GTK_SPIN_BUTTON(vshift_offset_spinbutton) );
if (!texdef_face_list_empty() && g_bListenChanged)
{
for (temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next)
@@ -1510,7 +1511,7 @@ static void on_vshift_offset_spinbutton_value_changed (GtkSpinButton *spinbutton
}
GetTexMods();
}
}
static void on_hscale_offset_spinbutton_value_changed (GtkSpinButton *spinbutton, gpointer user_data)
@@ -1518,9 +1519,9 @@ static void on_hscale_offset_spinbutton_value_changed (GtkSpinButton *spinbutton
texdef_t* tmp_texdef;
texdef_t* tmp_orig_texdef;
texdef_to_face_t* temp_texdef_face_list;
texdef_offset.scale[0] = gtk_spin_button_get_value ( GTK_SPIN_BUTTON(hscale_offset_spinbutton) );
if (!texdef_face_list_empty() && g_bListenChanged)
{
for (temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next)
@@ -1534,8 +1535,8 @@ static void on_hscale_offset_spinbutton_value_changed (GtkSpinButton *spinbutton
}
GetTexMods();
}
}
static void on_vscale_offset_spinbutton_value_changed (GtkSpinButton *spinbutton, gpointer user_data)
@@ -1543,9 +1544,9 @@ static void on_vscale_offset_spinbutton_value_changed (GtkSpinButton *spinbutton
texdef_t* tmp_texdef;
texdef_t* tmp_orig_texdef;
texdef_to_face_t* temp_texdef_face_list;
texdef_offset.scale[1] = gtk_spin_button_get_value ( GTK_SPIN_BUTTON(vscale_offset_spinbutton) );
if (!texdef_face_list_empty() && g_bListenChanged)
{
for (temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next)
@@ -1559,7 +1560,7 @@ static void on_vscale_offset_spinbutton_value_changed (GtkSpinButton *spinbutton
}
GetTexMods();
}
}
static void on_rotate_offset_spinbutton_value_changed (GtkSpinButton *spinbutton, gpointer user_data)
@@ -1567,9 +1568,9 @@ static void on_rotate_offset_spinbutton_value_changed (GtkSpinButton *spinbutton
texdef_t* tmp_texdef;
texdef_t* tmp_orig_texdef;
texdef_to_face_t* temp_texdef_face_list;
texdef_offset.rotate = gtk_spin_button_get_value ( GTK_SPIN_BUTTON(rotate_offset_spinbutton) );
if (!texdef_face_list_empty() && g_bListenChanged)
{
for (temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next)
@@ -1583,7 +1584,7 @@ static void on_rotate_offset_spinbutton_value_changed (GtkSpinButton *spinbutton
}
GetTexMods();
}
}
@@ -1647,9 +1648,9 @@ static void on_vshift_value_spinbutton_value_changed (GtkSpinButton *spinbutton,
texdef_t* tmp_texdef;
texdef_t* tmp_orig_texdef;
texdef_to_face_t* temp_texdef_face_list;
texdef_SI_values.shift[1] = gtk_spin_button_get_value ( GTK_SPIN_BUTTON(vshift_value_spinbutton) );
if (!texdef_face_list_empty() && g_bListenChanged)
{
for (temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next)
@@ -1668,9 +1669,9 @@ static void on_hscale_value_spinbutton_value_changed (GtkSpinButton *spinbutton,
texdef_t* tmp_texdef;
texdef_t* tmp_orig_texdef;
texdef_to_face_t* temp_texdef_face_list;
texdef_SI_values.scale[0] = gtk_spin_button_get_value ( GTK_SPIN_BUTTON(hscale_value_spinbutton) );
if (!texdef_face_list_empty() && g_bListenChanged)
{
for (temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next)
@@ -1689,9 +1690,9 @@ static void on_vscale_value_spinbutton_value_changed (GtkSpinButton *spinbutton,
texdef_t* tmp_texdef;
texdef_t* tmp_orig_texdef;
texdef_to_face_t* temp_texdef_face_list;
texdef_SI_values.scale[1] = gtk_spin_button_get_value ( GTK_SPIN_BUTTON(vscale_value_spinbutton) );
if (!texdef_face_list_empty() && g_bListenChanged)
{
for (temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next)
@@ -1710,9 +1711,9 @@ static void on_rotate_value_spinbutton_value_changed (GtkSpinButton *spinbutton,
texdef_t* tmp_texdef;
texdef_t* tmp_orig_texdef;
texdef_to_face_t* temp_texdef_face_list;
texdef_SI_values.rotate = gtk_spin_button_get_value ( GTK_SPIN_BUTTON(rotate_value_spinbutton) );
if (!texdef_face_list_empty() && g_bListenChanged)
{
for (temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next)