Fix SnapToGrid and fix all of those pesky Gtk warnings.

This commit is contained in:
jdolan 2013-07-08 10:01:07 -04:00
parent d7604ab519
commit 4ecd0a3991

View file

@ -124,31 +124,19 @@ GtkWidget *texture_combo_entry;
GtkWidget *match_grid_button;
GtkObject *hshift_value_spinbutton_adj;
GtkWidget *hshift_value_spinbutton;
GtkObject *vshift_value_spinbutton_adj;
GtkWidget *vshift_value_spinbutton;
GtkObject *hscale_value_spinbutton_adj;
GtkWidget *hscale_value_spinbutton;
GtkObject *vscale_value_spinbutton_adj;
GtkWidget *vscale_value_spinbutton;
GtkObject *rotate_value_spinbutton_adj;
GtkWidget *rotate_value_spinbutton;
GtkObject *hshift_step_spinbutton_adj;
GtkWidget *hshift_step_spinbutton;
GtkObject *vshift_step_spinbutton_adj;
GtkWidget *vshift_step_spinbutton;
GtkObject *hscale_step_spinbutton_adj;
GtkWidget *hscale_step_spinbutton;
GtkObject *vscale_step_spinbutton_adj;
GtkWidget *vscale_step_spinbutton;
GtkObject *rotate_step_spinbutton_adj;
GtkWidget *rotate_step_spinbutton;
GtkObject *fit_width_spinbutton_adj;
GtkWidget *fit_width_spinbutton;
GtkObject *fit_height_spinbutton_adj;
GtkWidget *fit_height_spinbutton;
GtkWidget *fit_button;
GtkWidget *axial_button;
@ -382,13 +370,13 @@ void DoSnapTToGrid( float hscale, float vscale ){
l_pIncrement = Get_SI_Inc();
if ( hscale == 0.0f ) {
hscale = 0.5f;
hscale = 0.25f;
}
if ( vscale == 0.0f ) {
vscale = 0.5f;
vscale = 0.25f;
}
#ifdef _DEBUG
Sys_Printf( "DoSnapTToGrid: hscale %g vscale %g\n", hscale, vscale );
Sys_Printf( "DoSnapToGrid: grid %g hscale %g vscale %g\n", GridSize(), hscale, vscale );
#endif
l_pIncrement->shift[0] = GridSize() / hscale;
l_pIncrement->shift[1] = GridSize() / vscale;
@ -505,9 +493,6 @@ void BuildDialog(){
*/
void SetTexMods(){
texdef_t *pt;
GtkSpinButton *spin;
GtkAdjustment *adjust;
texturewin = Texturewin();
l_pIncrement = Get_SI_Inc();
@ -520,33 +505,23 @@ void SetTexMods(){
return;
}
pt = &texturewin->texdef;
g_bListenChanged = FALSE;
if ( strncmp( pt->GetName(), "textures/", 9 ) != 0 ) {
if ( strncmp( texturewin->texdef.GetName(), "textures/", 9 ) != 0 ) {
texdef_SI_values.SetName( SHADER_NOT_FOUND );
}
spin = GTK_SPIN_BUTTON( hshift_value_spinbutton );
adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) );
adjust->step_increment = l_pIncrement->shift[0];
gtk_spin_button_set_increments( GTK_SPIN_BUTTON( hshift_value_spinbutton ), l_pIncrement->shift[0], l_pIncrement->shift[0] );
gtk_spin_button_set_increments( GTK_SPIN_BUTTON( vshift_value_spinbutton ), l_pIncrement->shift[1], l_pIncrement->shift[1] );
gtk_spin_button_set_increments( GTK_SPIN_BUTTON( hscale_value_spinbutton ), l_pIncrement->scale[0], l_pIncrement->scale[0] );
gtk_spin_button_set_increments( GTK_SPIN_BUTTON( vscale_value_spinbutton ), l_pIncrement->scale[1], l_pIncrement->scale[0] );
gtk_spin_button_set_increments( GTK_SPIN_BUTTON( rotate_value_spinbutton ), l_pIncrement->rotate, l_pIncrement->rotate );
spin = GTK_SPIN_BUTTON( vshift_value_spinbutton );
adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) );
adjust->step_increment = l_pIncrement->shift[1];
spin = GTK_SPIN_BUTTON( hscale_value_spinbutton );
adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) );
adjust->step_increment = l_pIncrement->scale[0];
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_value_spinbutton );
adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) );
adjust->step_increment = l_pIncrement->rotate;
gtk_spin_button_set_value( GTK_SPIN_BUTTON( hshift_step_spinbutton ), l_pIncrement->shift[0] );
gtk_spin_button_set_value( GTK_SPIN_BUTTON( vshift_step_spinbutton ), l_pIncrement->shift[1] );
gtk_spin_button_set_value( GTK_SPIN_BUTTON( hscale_step_spinbutton ), l_pIncrement->scale[0] );
gtk_spin_button_set_value( GTK_SPIN_BUTTON( vscale_step_spinbutton ), l_pIncrement->scale[1] );
gtk_spin_button_set_value( GTK_SPIN_BUTTON( rotate_step_spinbutton ), l_pIncrement->rotate );
g_bListenChanged = TRUE;
}
@ -590,6 +565,7 @@ void FitAll(){
GtkWidget* create_SurfaceInspector( void ){
GtkWidget *label;
GtkObject *adjustment;
GtkWidget *table1;
GtkWidget *table2;
@ -632,9 +608,8 @@ GtkWidget* create_SurfaceInspector( void ){
gtk_entry_set_max_length( GTK_ENTRY( texture_combo_entry ), 1024 );
frame1 = gtk_frame_new( "Surface" );
gtk_container_add( GTK_CONTAINER( vbox1 ), frame1 );
gtk_widget_show( frame1 );
gtk_box_pack_start( GTK_BOX( vbox1 ), frame1, FALSE, TRUE, 0 );
gtk_container_add( GTK_CONTAINER( vbox1 ), frame1 );
table1 = gtk_table_new( 7, 3, FALSE );
gtk_widget_show( table1 );
@ -687,8 +662,8 @@ GtkWidget* create_SurfaceInspector( void ){
(GtkAttachOptions) ( GTK_FILL ), 0, 0 );
// Value Spins
hshift_value_spinbutton_adj = gtk_adjustment_new( 0.0, -8192.0, 8192.0, 2.0, 8.0, 8.0 );
hshift_value_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( hshift_value_spinbutton_adj ), 1, 2 );
adjustment = gtk_adjustment_new( 0.0, -8192.0, 8192.0, 2.0, 8.0, 0.0 );
hshift_value_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( adjustment ), 1, 2 );
gtk_widget_show( hshift_value_spinbutton );
gtk_table_attach( GTK_TABLE( table1 ), hshift_value_spinbutton, 1, 2, 1, 2,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
@ -696,8 +671,8 @@ GtkWidget* create_SurfaceInspector( void ){
gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( hshift_value_spinbutton ), GTK_UPDATE_IF_VALID );
gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( hshift_value_spinbutton ), TRUE );
vshift_value_spinbutton_adj = gtk_adjustment_new( 0.0, -8192.0, 8192.0, 2.0, 8.0, 8.0 );
vshift_value_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( vshift_value_spinbutton_adj ), 1, 2 );
adjustment = gtk_adjustment_new( 0.0, -8192.0, 8192.0, 2.0, 8.0, 0.0 );
vshift_value_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( adjustment ), 1, 2 );
gtk_widget_show( vshift_value_spinbutton );
gtk_table_attach( GTK_TABLE( table1 ), vshift_value_spinbutton, 1, 2, 2, 3,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
@ -705,8 +680,8 @@ GtkWidget* create_SurfaceInspector( void ){
gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( vshift_value_spinbutton ), GTK_UPDATE_IF_VALID );
gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( vshift_value_spinbutton ), TRUE );
hscale_value_spinbutton_adj = gtk_adjustment_new( 0.0, -1024.0, 1024.0, 1.0, 4.0, 4.0 );
hscale_value_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( hscale_value_spinbutton_adj ), 1, 4 );
adjustment = gtk_adjustment_new( 0.0, -1024.0, 1024.0, 1.0, 4.0, 0.0 );
hscale_value_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( adjustment ), 1, 4 );
gtk_widget_show( hscale_value_spinbutton );
gtk_table_attach( GTK_TABLE( table1 ), hscale_value_spinbutton, 1, 2, 3, 4,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
@ -714,16 +689,16 @@ GtkWidget* create_SurfaceInspector( void ){
gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( hscale_value_spinbutton ), GTK_UPDATE_IF_VALID );
gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( hscale_value_spinbutton ), TRUE );
vscale_value_spinbutton_adj = gtk_adjustment_new( 0.0, -1024.0, 1024.0, 1.0, 4.0, 4.0 );
vscale_value_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( vscale_value_spinbutton_adj ), 1, 4 );
adjustment = gtk_adjustment_new( 0.0, -1024.0, 1024.0, 1.0, 4.0, 0.0 );
vscale_value_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( adjustment ), 1, 4 );
gtk_widget_show( vscale_value_spinbutton );
gtk_table_attach( GTK_TABLE( table1 ), vscale_value_spinbutton, 1, 2, 4, 5,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( vscale_value_spinbutton ), GTK_UPDATE_IF_VALID );
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 );
adjustment = gtk_adjustment_new( 0.0, -360.0, 360.0, 1.0, 10.0, 0.0 );
rotate_value_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( adjustment ), 1, 0 );
gtk_widget_show( rotate_value_spinbutton );
gtk_table_attach( GTK_TABLE( table1 ), rotate_value_spinbutton, 1, 2, 5, 6,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
@ -732,40 +707,40 @@ GtkWidget* create_SurfaceInspector( void ){
gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( rotate_value_spinbutton ), TRUE );
// Step Spins
hshift_step_spinbutton_adj = gtk_adjustment_new( 0.0, -8192.0, 8192.0, 2.0, 8.0, 8.0 );
hshift_step_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( hshift_step_spinbutton_adj ), 1, 2 );
adjustment = gtk_adjustment_new( 0.0, -8192.0, 8192.0, 2.0, 8.0, 0.0 );
hshift_step_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( adjustment ), 1, 2 );
gtk_widget_show( hshift_step_spinbutton );
gtk_table_attach( GTK_TABLE( table1 ), hshift_step_spinbutton, 2, 3, 1, 2,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( hshift_step_spinbutton ), GTK_UPDATE_IF_VALID );
vshift_step_spinbutton_adj = gtk_adjustment_new( 0.0, -8192.0, 8192.0, 2.0, 8.0, 8.0 );
vshift_step_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( vshift_step_spinbutton_adj ), 1, 2 );
adjustment = gtk_adjustment_new( 0.0, -8192.0, 8192.0, 2.0, 8.0, 0.0 );
vshift_step_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( adjustment ), 1, 2 );
gtk_widget_show( vshift_step_spinbutton );
gtk_table_attach( GTK_TABLE( table1 ), vshift_step_spinbutton, 2, 3, 2, 3,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( vshift_step_spinbutton ), GTK_UPDATE_IF_VALID );
hscale_step_spinbutton_adj = gtk_adjustment_new( 0.0, -1024.0, 1024.0, 1.0, 4.0, 4.0 );
hscale_step_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( hscale_step_spinbutton_adj ), 1, 4 );
adjustment = gtk_adjustment_new( 0.0, -1024.0, 1024.0, 1.0, 4.0, 0.0 );
hscale_step_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( adjustment ), 1, 4 );
gtk_widget_show( hscale_step_spinbutton );
gtk_table_attach( GTK_TABLE( table1 ), hscale_step_spinbutton, 2, 3, 3, 4,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( hscale_step_spinbutton ), GTK_UPDATE_IF_VALID );
vscale_step_spinbutton_adj = gtk_adjustment_new( 0.0, -1024.0, 1024.0, 1.0, 4.0, 4.0 );
vscale_step_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( vscale_step_spinbutton_adj ), 1, 4 );
adjustment = gtk_adjustment_new( 0.0, -1024.0, 1024.0, 1.0, 4.0, 0.0 );
vscale_step_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( adjustment ), 1, 4 );
gtk_widget_show( vscale_step_spinbutton );
gtk_table_attach( GTK_TABLE( table1 ), vscale_step_spinbutton, 2, 3, 4, 5,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( vscale_step_spinbutton ), GTK_UPDATE_IF_VALID );
rotate_step_spinbutton_adj = gtk_adjustment_new( 0.0, -360.0, 360.0, 1.0, 10.0, 10.0 );
rotate_step_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( rotate_step_spinbutton_adj ), 1, 2 );
adjustment = gtk_adjustment_new( 0.0, -360.0, 360.0, 1.0, 10.0, 0.0 );
rotate_step_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( adjustment ), 1, 2 );
gtk_widget_show( rotate_step_spinbutton );
gtk_table_attach( GTK_TABLE( table1 ), rotate_step_spinbutton, 2, 3, 5, 6,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
@ -807,8 +782,8 @@ GtkWidget* create_SurfaceInspector( void ){
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
(GtkAttachOptions) ( 0 ), 0, 0 );
fit_height_spinbutton_adj = gtk_adjustment_new( 1, 1, 32, 1, 10, 10 );
fit_height_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( fit_height_spinbutton_adj ), 1, 0 );
adjustment = gtk_adjustment_new( 1, 1, 32, 1, 10, 0 );
fit_height_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( adjustment ), 1, 0 );
gtk_widget_show( fit_height_spinbutton );
gtk_table_attach( GTK_TABLE( table2 ), fit_height_spinbutton, 3, 4, 1, 2,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
@ -816,8 +791,8 @@ GtkWidget* create_SurfaceInspector( void ){
gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( fit_height_spinbutton ), TRUE );
gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( fit_height_spinbutton ), GTK_UPDATE_IF_VALID );
fit_width_spinbutton_adj = gtk_adjustment_new( 1, 1, 32, 1, 10, 10 );
fit_width_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( fit_width_spinbutton_adj ), 1, 0 );
adjustment = gtk_adjustment_new( 1, 1, 32, 1, 10, 0 );
fit_width_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( adjustment ), 1, 0 );
gtk_widget_show( fit_width_spinbutton );
gtk_table_attach( GTK_TABLE( table2 ), fit_width_spinbutton, 2, 3, 1, 2,
(GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),