2 Copyright (C) 1999-2007 id Software, Inc. and contributors.
3 For a list of contributors, see the accompanying CONTRIBUTORS file.
5 This file is part of GtkRadiant.
7 GtkRadiant is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 GtkRadiant is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GtkRadiant; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23 // Surface Dialog Module
27 // Nurail: Implemented to Module from the main Radiant Surface Dialog code
32 #include <gdk/gdkkeysyms.h>
34 #include "surfdlg_plugin.h"
42 #include "gtkr_vector.h"
44 vector<texdef_to_face_t> g_texdef_face_vector;
46 inline texdef_to_face_t* get_texdef_face_list(){
47 return &( *g_texdef_face_vector.begin() );
50 inline unsigned int texdef_face_list_empty(){
51 return g_texdef_face_vector.empty();
54 inline unsigned int texdef_face_list_size(){
55 return g_texdef_face_vector.size();
58 // For different faces having different values
59 bool is_HShift_conflicting;
60 bool is_VShift_conflicting;
61 bool is_HScale_conflicting;
62 bool is_VScale_conflicting;
63 bool is_Rotate_conflicting;
64 bool is_TextureName_conflicting;
69 void GetTexMods( bool b_SetUndoPoint = FALSE );
72 void InitDefaultIncrement( texdef_t * );
73 void DoSnapTToGrid( float hscale, float vscale );
74 // called to perform a fitting from the outside (shortcut key)
75 void SurfaceDialogFitAll();
77 // Heretic2 Flags Functions
78 void SetFlagButtons_Heretic2( texdef_to_face_t *texdef_face_list, bool b_isListEmpty );
79 void SetChangeInFlags_Face_Heretic2( texdef_to_face_t *texdef_face_list );
80 GtkWidget* Create_Heretic2FlagsDialog( GtkWidget* surfacedialog_widget );
87 // 0 is invalid, otherwise it's the Id of the last 'do' we are responsible for
91 texturewin_t *texturewin;
92 texdef_t *l_pIncrement;
93 texdef_t texdef_offset;
94 texdef_t texdef_SI_values;
96 // For Texture Entry, activate only on entry change
97 char old_texture_entry[128];
99 // the texdef to switch back to when the OnCancel is called
100 texdef_t g_old_texdef;
102 // when TRUE, this thing means the surface inspector is currently being displayed
103 bool g_surfwin = FALSE;
104 // turn on/off processing of the "changed" "value_changed" messages
105 // (need to turn off when we are feeding data in)
106 bool g_bListenChanged = true;
107 // turn on/off listening of the update messages
108 bool g_bListenUpdate = true;
110 GtkWidget* create_SurfaceInspector( void );
111 GtkWidget *SurfaceInspector = NULL;
113 GtkWidget *m_pWidget;
114 GtkWidget *GetWidget() { return SurfaceInspector; }
115 GtkWidget *Get_SI_Module_Widget() { return SurfaceInspector; }
116 void SetWidget( GtkWidget *new_widget ) { m_pWidget = new_widget; }
117 GtkWidget *GetDlgWidget( const char* name )
118 { return GTK_WIDGET( g_object_get_data( G_OBJECT( SurfaceInspector ), name ) ); }
120 // Spins for FitTexture
121 GtkWidget *spin_width;
122 GtkWidget *spin_height;
125 GtkWidget *texture_combo;
126 GtkWidget *texture_combo_entry;
128 GtkWidget *match_grid_button;
129 GtkWidget *lock_valuechange_togglebutton;
131 GtkObject *hshift_value_spinbutton_adj;
132 GtkWidget *hshift_value_spinbutton;
133 GtkObject *vshift_value_spinbutton_adj;
134 GtkWidget *vshift_value_spinbutton;
135 GtkObject *hscale_value_spinbutton_adj;
136 GtkWidget *hscale_value_spinbutton;
137 GtkObject *vscale_value_spinbutton_adj;
138 GtkWidget *vscale_value_spinbutton;
139 GtkObject *rotate_value_spinbutton_adj;
140 GtkWidget *rotate_value_spinbutton;
142 GtkObject *hshift_offset_spinbutton_adj;
143 GtkWidget *hshift_offset_spinbutton;
144 GtkObject *vshift_offset_spinbutton_adj;
145 GtkWidget *vshift_offset_spinbutton;
146 GtkObject *hscale_offset_spinbutton_adj;
147 GtkWidget *hscale_offset_spinbutton;
148 GtkObject *vscale_offset_spinbutton_adj;
149 GtkWidget *vscale_offset_spinbutton;
150 GtkObject *rotate_offset_spinbutton_adj;
151 GtkWidget *rotate_offset_spinbutton;
153 GtkObject *hshift_step_spinbutton_adj;
154 GtkWidget *hshift_step_spinbutton;
155 GtkObject *vshift_step_spinbutton_adj;
156 GtkWidget *vshift_step_spinbutton;
157 GtkObject *hscale_step_spinbutton_adj;
158 GtkWidget *hscale_step_spinbutton;
159 GtkObject *vscale_step_spinbutton_adj;
160 GtkWidget *vscale_step_spinbutton;
161 GtkObject *rotate_step_spinbutton_adj;
162 GtkWidget *rotate_step_spinbutton;
164 GtkObject *fit_width_spinbutton_adj;
165 GtkWidget *fit_width_spinbutton;
166 GtkObject *fit_height_spinbutton_adj;
167 GtkWidget *fit_height_spinbutton;
168 GtkWidget *fit_button;
169 GtkWidget *axial_button;
171 GtkWidget *done_button;
172 GtkWidget *apply_button;
173 GtkWidget *cancel_button;
176 gboolean on_texture_combo_entry_key_press_event( GtkWidget *widget, GdkEventKey *event, gpointer user_data );
177 void on_texture_combo_entry_activate( GtkEntry *entry, gpointer user_data );
179 static void on_match_grid_button_clicked( GtkButton *button, gpointer user_data );
180 static void on_lock_valuechange_togglebutton_toggled( GtkToggleButton *togglebutton, gpointer user_data );
182 static void on_hshift_value_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data );
183 static void on_vshift_value_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data );
184 static void on_hscale_value_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data );
185 static void on_vscale_value_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data );
186 static void on_rotate_value_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data );
188 static void on_hshift_offset_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data );
189 static void on_vshift_offset_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data );
190 static void on_hscale_offset_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data );
191 static void on_vscale_offset_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data );
192 static void on_rotate_offset_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data );
194 static void on_hshift_step_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data );
195 static void on_vshift_step_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data );
196 static void on_hscale_step_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data );
197 static void on_vscale_step_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data );
198 static void on_rotate_step_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data );
200 static void on_fit_width_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data );
201 static void on_fit_height_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data );
202 static void on_fit_button_clicked( GtkButton *button, gpointer user_data );
203 static void on_axial_button_clicked( GtkButton *button, gpointer user_data );
205 static void on_done_button_clicked( GtkButton *button, gpointer user_data );
206 static void on_apply_button_clicked( GtkButton *button, gpointer user_data );
207 static void on_cancel_button_clicked( GtkButton *button, gpointer user_data );
211 ===================================================
215 ===================================================
219 void IsFaceConflicting(){
220 texdef_t* tmp_texdef;
221 texdef_to_face_t* temp_texdef_face_list;
222 char texture_name[128];
224 if ( texdef_face_list_empty() ) {
225 gtk_entry_set_text( GTK_ENTRY( hshift_value_spinbutton ), "" );
226 gtk_entry_set_text( GTK_ENTRY( vshift_value_spinbutton ), "" );
227 gtk_entry_set_text( GTK_ENTRY( hscale_value_spinbutton ), "" );
228 gtk_entry_set_text( GTK_ENTRY( vscale_value_spinbutton ), "" );
229 gtk_entry_set_text( GTK_ENTRY( rotate_value_spinbutton ), "" );
230 gtk_entry_set_text( GTK_ENTRY( texture_combo_entry ), "" );
234 g_bListenChanged = FALSE;
236 tmp_texdef = &get_texdef_face_list()->texdef;
238 strcpy( texture_name, tmp_texdef->GetName() );
240 texdef_SI_values.shift[0] = tmp_texdef->shift[0];
241 texdef_SI_values.shift[1] = tmp_texdef->shift[1];
242 texdef_SI_values.scale[0] = tmp_texdef->scale[0];
243 texdef_SI_values.scale[1] = tmp_texdef->scale[1];
244 texdef_SI_values.rotate = tmp_texdef->rotate;
245 texdef_SI_values.SetName( texture_name );
247 is_HShift_conflicting = FALSE;
248 is_VShift_conflicting = FALSE;
249 is_HScale_conflicting = FALSE;
250 is_VScale_conflicting = FALSE;
251 is_Rotate_conflicting = FALSE;
252 is_TextureName_conflicting = FALSE;
254 if ( texdef_face_list_size() > 1 ) {
255 temp_texdef_face_list = get_texdef_face_list()->next;
257 for (; temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next )
259 tmp_texdef = &temp_texdef_face_list->texdef;
260 if ( texdef_SI_values.shift[0] != tmp_texdef->shift[0] ) {
261 is_HShift_conflicting = TRUE;
264 if ( texdef_SI_values.shift[1] != tmp_texdef->shift[1] ) {
265 is_VShift_conflicting = TRUE;
268 if ( texdef_SI_values.scale[0] != tmp_texdef->scale[0] ) {
269 is_HScale_conflicting = TRUE;
272 if ( texdef_SI_values.scale[1] != tmp_texdef->scale[1] ) {
273 is_VScale_conflicting = TRUE;
276 if ( texdef_SI_values.rotate != tmp_texdef->rotate ) {
277 is_Rotate_conflicting = TRUE;
280 if ( strcmp( texture_name, tmp_texdef->GetName() ) ) {
281 is_TextureName_conflicting = TRUE;
286 if ( is_HShift_conflicting ) {
287 gtk_entry_set_text( GTK_ENTRY( hshift_value_spinbutton ), "" );
290 gtk_spin_button_set_value( GTK_SPIN_BUTTON( hshift_value_spinbutton ), texdef_SI_values.shift[0] );
293 if ( is_VShift_conflicting ) {
294 gtk_entry_set_text( GTK_ENTRY( vshift_value_spinbutton ), "" );
297 gtk_spin_button_set_value( GTK_SPIN_BUTTON( vshift_value_spinbutton ), texdef_SI_values.shift[1] );
300 if ( is_HScale_conflicting ) {
301 gtk_entry_set_text( GTK_ENTRY( hscale_value_spinbutton ), "" );
304 gtk_spin_button_set_value( GTK_SPIN_BUTTON( hscale_value_spinbutton ), texdef_SI_values.scale[0] );
307 if ( is_VScale_conflicting ) {
308 gtk_entry_set_text( GTK_ENTRY( vscale_value_spinbutton ), "" );
311 gtk_spin_button_set_value( GTK_SPIN_BUTTON( vscale_value_spinbutton ), texdef_SI_values.scale[1] );
314 if ( is_Rotate_conflicting ) {
315 gtk_entry_set_text( GTK_ENTRY( rotate_value_spinbutton ), "" );
318 gtk_spin_button_set_value( GTK_SPIN_BUTTON( rotate_value_spinbutton ), texdef_SI_values.rotate );
321 g_bListenChanged = TRUE;
324 #define MAX_NUM_LIST_ITEMS 15
325 static void PopulateTextureComboList(){
326 texdef_t* tmp_texdef;
327 texdef_to_face_t* temp_texdef_face_list;
330 int num_of_list_items = 0;
334 if ( texdef_face_list_empty() ) {
335 items = g_list_append( items, (gpointer) blank );
336 // For Texture Entry, activate only on entry change
337 strcpy( old_texture_entry, blank );
339 else if ( !is_TextureName_conflicting ) {
340 temp_texdef_face_list = get_texdef_face_list();
341 tmp_texdef = (texdef_t *) &get_texdef_face_list()->texdef;
342 items = g_list_append( items, (gpointer) tmp_texdef->GetName() );
343 // For Texture Entry, activate only on entry change
344 strcpy( old_texture_entry, tmp_texdef->GetName() );
348 for ( temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next )
350 tmp_texdef = (texdef_t *) &temp_texdef_face_list->texdef;
351 // Need to do a string compare, hence the custom search
352 if ( !( g_list_find_custom( items, tmp_texdef->GetName(), (GCompareFunc) strcmp ) ) ) {
353 items = g_list_append( items, (gpointer) tmp_texdef->GetName() );
356 // Make sure the combo list isn't too long
357 if ( num_of_list_items >= MAX_NUM_LIST_ITEMS ) {
361 // If this isn't added last (to the top of the list), g_list_find freaks.
362 items = g_list_prepend( items, (gpointer) blank );
363 // For Texture Entry, activate only on entry change
364 strcpy( old_texture_entry, blank );
367 gtk_combo_set_popdown_strings( GTK_COMBO( texture_combo ), items );
368 g_list_free( items );
372 static void ZeroOffsetValues(){
373 texdef_offset.shift[0] = 0.0;
374 texdef_offset.shift[1] = 0.0;
375 texdef_offset.scale[0] = 0.0;
376 texdef_offset.scale[1] = 0.0;
377 texdef_offset.rotate = 0.0;
380 static void GetTexdefInfo_from_Radiant(){
381 g_texdef_face_vector.clear();
383 unsigned int count = GetSelectedFaceCountfromBrushes();
385 count = GetSelectedFaceCount();
388 g_texdef_face_vector.resize( count );
390 if ( !texdef_face_list_empty() ) {
391 GetSelFacesTexdef( get_texdef_face_list() );
395 PopulateTextureComboList();
397 if ( texdef_face_list_empty() ) {
398 SetFlagButtons_Heretic2( get_texdef_face_list(), TRUE );
401 SetFlagButtons_Heretic2( get_texdef_face_list(), FALSE );
406 static gint delete_event_callback( GtkWidget *widget, GdkEvent* event, gpointer data ){
411 // make the shift increments match the grid settings
412 // the objective being that the shift+arrows shortcuts move the texture by the corresponding grid size
413 // this depends on a scale value if you have selected a particular texture on which you want it to work:
414 // we move the textures in pixels, not world units. (i.e. increment values are in pixel)
415 // depending on the texture scale it doesn't take the same amount of pixels to move of g_qeglobals.d_gridsize
416 // increment * scale = gridsize
417 // hscale and vscale are optional parameters, if they are zero they will be set to the default scale
418 // NOTE: the default scale depends if you are using BP mode or regular.
419 // For regular it's 0.5f (128 pixels cover 64 world units), for BP it's simply 1.0f
421 void DoSnapTToGrid( float hscale, float vscale ){
422 l_pIncrement = Get_SI_Inc();
424 if ( hscale == 0.0f ) {
427 if ( vscale == 0.0f ) {
431 Sys_Printf( "DoSnapTToGrid: hscale %g vscale %g\n", hscale, vscale );
433 l_pIncrement->shift[0] = GridSize() / hscale;
434 l_pIncrement->shift[1] = GridSize() / vscale;
435 // now some update work
436 // FIXME: doesn't look good here, seems to be called several times
440 void UpdateSurfaceDialog(){
441 if ( !g_bListenUpdate ) {
445 if ( !SurfaceInspector ) {
449 // avoid long delays on slow computers
450 while ( gtk_events_pending() )
451 gtk_main_iteration();
455 Sys_Printf( "UpdateSurfaceDialog\n" );
457 GetTexdefInfo_from_Radiant();
463 // DoSurface will always try to show the surface inspector
464 // or update it because something new has been selected
465 void DoSurface( void ){
467 Sys_Printf( "DoSurface\n" );
469 if ( !SurfaceInspector ) {
470 create_SurfaceInspector();
477 void ToggleSurface(){
479 Sys_Printf( "ToggleSurface Module\n" );
485 on_cancel_button_clicked( NULL, NULL );
489 // NOTE: will raise and show the Surface inspector and exec fit for patches and brushes
490 void SurfaceDlgFitAll(){
495 // =============================================================================
496 // SurfaceDialog class
500 if ( !SurfaceInspector ) {
501 create_SurfaceInspector();
504 gtk_widget_show( SurfaceInspector );
507 GetTexdefInfo_from_Radiant();
508 GetTexMods( TRUE ); // Set Initial Undo Point
514 gtk_widget_hide( SurfaceInspector );
518 // set default values for increments (shift scale and rot)
519 // this is called by the prefs code if can't find the values
520 void InitDefaultIncrement( texdef_t *tex ){
521 tex->SetName( "foo" );
524 tex->scale[0] = 0.25;
525 tex->scale[1] = 0.25;
530 if ( !SurfaceInspector ) {
531 create_SurfaceInspector();
539 Set the fields to the current texdef (i.e. map/texdef -> dialog widgets)
546 GtkAdjustment *adjust;
548 texturewin = Texturewin();
549 l_pIncrement = Get_SI_Inc();
552 Sys_Printf( "SurfaceDlg SetTexMods\n" );
559 pt = &texturewin->texdef;
561 g_bListenChanged = false;
563 if ( strncmp( pt->GetName(), "textures/", 9 ) != 0 ) {
564 texdef_offset.SetName( SHADER_NOT_FOUND );
568 spin = GTK_SPIN_BUTTON( hshift_offset_spinbutton );
569 gtk_spin_button_set_value( spin, texdef_offset.shift[0] );
570 adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) );
571 adjust->step_increment = l_pIncrement->shift[0];
572 gtk_spin_button_set_value( GTK_SPIN_BUTTON( hshift_step_spinbutton ), l_pIncrement->shift[0] );
574 spin = GTK_SPIN_BUTTON( hshift_value_spinbutton );
575 adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) );
576 adjust->step_increment = l_pIncrement->shift[0];
579 spin = GTK_SPIN_BUTTON( vshift_offset_spinbutton );
580 gtk_spin_button_set_value( spin, texdef_offset.shift[1] );
581 adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) );
582 adjust->step_increment = l_pIncrement->shift[1];
583 gtk_spin_button_set_value( GTK_SPIN_BUTTON( vshift_step_spinbutton ), l_pIncrement->shift[1] );
585 spin = GTK_SPIN_BUTTON( vshift_value_spinbutton );
586 adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) );
587 adjust->step_increment = l_pIncrement->shift[1];
590 spin = GTK_SPIN_BUTTON( hscale_offset_spinbutton );
591 gtk_spin_button_set_value( spin, texdef_offset.scale[0] );
592 adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) );
593 adjust->step_increment = l_pIncrement->scale[0];
594 gtk_spin_button_set_value( GTK_SPIN_BUTTON( hscale_step_spinbutton ), l_pIncrement->scale[0] );
596 spin = GTK_SPIN_BUTTON( hscale_value_spinbutton );
597 adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) );
598 adjust->step_increment = l_pIncrement->scale[0];
601 spin = GTK_SPIN_BUTTON( vscale_offset_spinbutton );
602 gtk_spin_button_set_value( spin, texdef_offset.scale[1] );
603 adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) );
604 adjust->step_increment = l_pIncrement->scale[1];
605 gtk_spin_button_set_value( GTK_SPIN_BUTTON( vscale_step_spinbutton ), l_pIncrement->scale[1] );
607 spin = GTK_SPIN_BUTTON( vscale_value_spinbutton );
608 adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) );
609 adjust->step_increment = l_pIncrement->scale[1];
612 spin = GTK_SPIN_BUTTON( rotate_offset_spinbutton );
613 gtk_spin_button_set_value( spin, texdef_offset.rotate );
614 adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) );
615 adjust->step_increment = l_pIncrement->rotate;
616 gtk_spin_button_set_value( GTK_SPIN_BUTTON( rotate_step_spinbutton ), l_pIncrement->rotate );
618 spin = GTK_SPIN_BUTTON( rotate_value_spinbutton );
619 adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) );
620 adjust->step_increment = l_pIncrement->rotate;
623 g_bListenChanged = true;
625 // store the current texdef as our escape route if user hits OnCancel
626 g_old_texdef = texturewin->texdef;
633 Shows any changes to the main Radiant windows
636 void GetTexMods( bool b_SetUndoPoint ){
639 Sys_Printf( "SurfaceDlg GetTexMods\n" );
642 if ( !texdef_face_list_empty() ) {
643 g_bListenUpdate = FALSE;
644 SetChangeInFlags_Face_Heretic2( get_texdef_face_list() );
645 SetTexdef_FaceList( get_texdef_face_list(), b_SetUndoPoint, false );
646 g_bListenUpdate = TRUE;
648 if ( b_SetUndoPoint ) {
649 m_nUndoId = Undo_GetUndoId();
655 on_fit_button_clicked( NULL, NULL );
659 ////////////////////////////////////////////////////////////////////
663 ////////////////////////////////////////////////////////////////////
665 GtkWidget* create_SurfaceInspector( void ){
668 GtkWidget *hseparator;
671 GtkWidget *viewport8;
672 GtkWidget *viewport9;
673 GtkWidget *viewport2;
674 GtkWidget *viewport7;
675 GtkWidget *viewport5;
676 GtkWidget *viewport6;
677 GtkWidget *viewport10;
684 GtkWidget *alignment1;
685 GtkWidget *alignment2;
686 GtkWidget *alignment3;
699 GtkWidget *hbuttonbox1;
701 SurfaceInspector = gtk_window_new( GTK_WINDOW_TOPLEVEL );
702 gtk_container_set_border_width( GTK_CONTAINER( SurfaceInspector ), 4 );
703 gtk_window_set_title( GTK_WINDOW( SurfaceInspector ), "Surface Inspector" );
705 SetWinPos_from_Prefs( SurfaceInspector );
707 viewport8 = gtk_viewport_new( NULL, NULL );
708 gtk_widget_show( viewport8 );
709 gtk_container_add( GTK_CONTAINER( SurfaceInspector ), viewport8 );
710 gtk_viewport_set_shadow_type( GTK_VIEWPORT( viewport8 ), GTK_SHADOW_NONE );
712 vbox7 = gtk_vbox_new( FALSE, 0 );
713 gtk_widget_show( vbox7 );
714 gtk_container_add( GTK_CONTAINER( viewport8 ), vbox7 );
716 viewport9 = gtk_viewport_new( NULL, NULL );
717 gtk_widget_show( viewport9 );
718 gtk_box_pack_start( GTK_BOX( vbox7 ), viewport9, FALSE, FALSE, 0 );
719 gtk_container_set_border_width( GTK_CONTAINER( viewport9 ), 2 );
720 gtk_viewport_set_shadow_type( GTK_VIEWPORT( viewport9 ), GTK_SHADOW_ETCHED_IN );
722 hbox1 = gtk_hbox_new( FALSE, 0 );
723 gtk_widget_show( hbox1 );
724 gtk_container_add( GTK_CONTAINER( viewport9 ), hbox1 );
725 gtk_container_set_border_width( GTK_CONTAINER( hbox1 ), 4 );
727 label = gtk_label_new( "Texture: " );
728 gtk_widget_show( label );
729 gtk_box_pack_start( GTK_BOX( hbox1 ), label, FALSE, FALSE, 0 );
730 gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 );
732 texture_combo = gtk_combo_new();
733 g_object_set_data( G_OBJECT( GTK_COMBO( texture_combo )->popwin ),
734 "KeepMeAround", texture_combo );
735 gtk_combo_disable_activate( (GtkCombo*) texture_combo );
736 gtk_widget_show( texture_combo );
737 gtk_box_pack_start( GTK_BOX( hbox1 ), texture_combo, TRUE, TRUE, 0 );
739 texture_combo_entry = GTK_COMBO( texture_combo )->entry;
740 gtk_widget_show( texture_combo_entry );
741 gtk_entry_set_max_length( GTK_ENTRY( texture_combo_entry ), 128 );
743 viewport2 = gtk_viewport_new( NULL, NULL );
744 gtk_widget_show( viewport2 );
745 gtk_box_pack_start( GTK_BOX( vbox7 ), viewport2, FALSE, TRUE, 0 );
746 gtk_container_set_border_width( GTK_CONTAINER( viewport2 ), 2 );
747 gtk_viewport_set_shadow_type( GTK_VIEWPORT( viewport2 ), GTK_SHADOW_ETCHED_IN );
749 table1 = gtk_table_new( 13, 4, FALSE );
750 gtk_widget_show( table1 );
751 gtk_container_add( GTK_CONTAINER( viewport2 ), table1 );
753 hseparator = gtk_hseparator_new();
754 gtk_widget_show( hseparator );
755 gtk_table_attach( GTK_TABLE( table1 ), hseparator, 1, 2, 1, 2,
756 (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
757 (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
759 hseparator = gtk_hseparator_new();
760 gtk_widget_show( hseparator );
761 gtk_table_attach( GTK_TABLE( table1 ), hseparator, 2, 3, 1, 2,
762 (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
763 (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
765 hseparator = gtk_hseparator_new();
766 gtk_widget_show( hseparator );
767 gtk_table_attach( GTK_TABLE( table1 ), hseparator, 3, 4, 1, 2,
768 (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
769 (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
771 hseparator = gtk_hseparator_new();
772 gtk_widget_show( hseparator );
773 gtk_table_attach( GTK_TABLE( table1 ), hseparator, 1, 2, 3, 4,
774 (GtkAttachOptions) ( GTK_FILL ),
775 (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
777 hseparator = gtk_hseparator_new();
778 gtk_widget_show( hseparator );
779 gtk_table_attach( GTK_TABLE( table1 ), hseparator, 2, 3, 3, 4,
780 (GtkAttachOptions) ( GTK_FILL ),
781 (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
783 hseparator = gtk_hseparator_new();
784 gtk_widget_show( hseparator );
785 gtk_table_attach( GTK_TABLE( table1 ), hseparator, 3, 4, 3, 4,
786 (GtkAttachOptions) ( GTK_FILL ),
787 (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
789 hseparator = gtk_hseparator_new();
790 gtk_widget_show( hseparator );
791 gtk_table_attach( GTK_TABLE( table1 ), hseparator, 1, 2, 5, 6,
792 (GtkAttachOptions) ( GTK_FILL ),
793 (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
795 hseparator = gtk_hseparator_new();
796 gtk_widget_show( hseparator );
797 gtk_table_attach( GTK_TABLE( table1 ), hseparator, 2, 3, 5, 6,
798 (GtkAttachOptions) ( GTK_FILL ),
799 (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
801 hseparator = gtk_hseparator_new();
802 gtk_widget_show( hseparator );
803 gtk_table_attach( GTK_TABLE( table1 ), hseparator, 3, 4, 5, 6,
804 (GtkAttachOptions) ( GTK_FILL ),
805 (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
807 hseparator = gtk_hseparator_new();
808 gtk_widget_show( hseparator );
809 gtk_table_attach( GTK_TABLE( table1 ), hseparator, 1, 2, 7, 8,
810 (GtkAttachOptions) ( GTK_FILL ),
811 (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
813 hseparator = gtk_hseparator_new();
814 gtk_widget_show( hseparator );
815 gtk_table_attach( GTK_TABLE( table1 ), hseparator, 2, 3, 7, 8,
816 (GtkAttachOptions) ( GTK_FILL ),
817 (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
819 hseparator = gtk_hseparator_new();
820 gtk_widget_show( hseparator );
821 gtk_table_attach( GTK_TABLE( table1 ), hseparator, 3, 4, 7, 8,
822 (GtkAttachOptions) ( GTK_FILL ),
823 (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
825 hseparator = gtk_hseparator_new();
826 gtk_widget_show( hseparator );
827 gtk_table_attach( GTK_TABLE( table1 ), hseparator, 1, 2, 9, 10,
828 (GtkAttachOptions) ( GTK_FILL ),
829 (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
831 hseparator = gtk_hseparator_new();
832 gtk_widget_show( hseparator );
833 gtk_table_attach( GTK_TABLE( table1 ), hseparator, 2, 3, 9, 10,
834 (GtkAttachOptions) ( GTK_FILL ),
835 (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
837 hseparator = gtk_hseparator_new();
838 gtk_widget_show( hseparator );
839 gtk_table_attach( GTK_TABLE( table1 ), hseparator, 3, 4, 9, 10,
840 (GtkAttachOptions) ( GTK_FILL ),
841 (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
843 hseparator = gtk_hseparator_new();
844 gtk_widget_show( hseparator );
845 gtk_table_attach( GTK_TABLE( table1 ), hseparator, 1, 2, 11, 12,
846 (GtkAttachOptions) ( GTK_FILL ),
847 (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
849 hseparator = gtk_hseparator_new();
850 gtk_widget_show( hseparator );
851 gtk_table_attach( GTK_TABLE( table1 ), hseparator, 2, 3, 11, 12,
852 (GtkAttachOptions) ( GTK_FILL ),
853 (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
855 hseparator = gtk_hseparator_new();
856 gtk_widget_show( hseparator );
857 gtk_table_attach( GTK_TABLE( table1 ), hseparator, 3, 4, 11, 12,
858 (GtkAttachOptions) ( GTK_FILL ),
859 (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
861 label = gtk_label_new( "Offset" );
862 gtk_widget_show( label );
863 gtk_table_attach( GTK_TABLE( table1 ), label, 2, 3, 0, 1,
864 (GtkAttachOptions) ( GTK_FILL ),
865 (GtkAttachOptions) ( 0 ), 0, 0 );
867 label = gtk_label_new( "Step" );
868 gtk_widget_show( label );
869 gtk_table_attach( GTK_TABLE( table1 ), label, 3, 4, 0, 1,
870 (GtkAttachOptions) ( GTK_FILL ),
871 (GtkAttachOptions) ( 0 ), 0, 0 );
873 eventbox = gtk_event_box_new();
874 gtk_widget_show( eventbox );
875 gtk_table_attach( GTK_TABLE( table1 ), eventbox, 3, 4, 12, 13,
876 (GtkAttachOptions) ( GTK_FILL ),
877 (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
879 match_grid_button = gtk_button_new_with_mnemonic( "Match Grid" );
880 gtk_widget_show( match_grid_button );
881 gtk_container_add( GTK_CONTAINER( eventbox ), match_grid_button );
883 label = gtk_label_new( "Value" );
884 gtk_widget_show( label );
885 gtk_table_attach( GTK_TABLE( table1 ), label, 1, 2, 0, 1,
886 (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
887 (GtkAttachOptions) ( 0 ), 0, 0 );
888 gtk_misc_set_alignment( GTK_MISC( label ), 0.5, 1 );
890 hseparator = gtk_hseparator_new();
891 gtk_widget_show( hseparator );
892 gtk_table_attach( GTK_TABLE( table1 ), hseparator, 0, 1, 3, 4,
893 (GtkAttachOptions) ( GTK_SHRINK | GTK_FILL ),
894 (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
896 hseparator = gtk_hseparator_new();
897 gtk_widget_show( hseparator );
898 gtk_table_attach( GTK_TABLE( table1 ), hseparator, 0, 1, 5, 6,
899 (GtkAttachOptions) ( GTK_FILL ),
900 (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
902 hseparator = gtk_hseparator_new();
903 gtk_widget_show( hseparator );
904 gtk_table_attach( GTK_TABLE( table1 ), hseparator, 0, 1, 7, 8,
905 (GtkAttachOptions) ( GTK_FILL ),
906 (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
908 hseparator = gtk_hseparator_new();
909 gtk_widget_show( hseparator );
910 gtk_table_attach( GTK_TABLE( table1 ), hseparator, 0, 1, 9, 10,
911 (GtkAttachOptions) ( GTK_FILL ),
912 (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
914 hseparator = gtk_hseparator_new();
915 gtk_widget_show( hseparator );
916 gtk_table_attach( GTK_TABLE( table1 ), hseparator, 0, 1, 11, 12,
917 (GtkAttachOptions) ( GTK_FILL ),
918 (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
920 eventbox = gtk_event_box_new();
921 gtk_widget_show( eventbox );
922 gtk_table_attach( GTK_TABLE( table1 ), eventbox, 0, 1, 4, 5,
923 (GtkAttachOptions) ( GTK_FILL ),
924 (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
926 label = gtk_label_new( "V Shift: " );
927 gtk_widget_show( label );
928 gtk_container_add( GTK_CONTAINER( eventbox ), label );
929 gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT );
930 gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 );
932 eventbox = gtk_event_box_new();
933 gtk_widget_show( eventbox );
934 gtk_table_attach( GTK_TABLE( table1 ), eventbox, 0, 1, 6, 7,
935 (GtkAttachOptions) ( GTK_FILL ),
936 (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
938 label = gtk_label_new( " H Scale: " );
939 gtk_widget_show( label );
940 gtk_container_add( GTK_CONTAINER( eventbox ), label );
941 gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT );
942 gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 );
944 eventbox = gtk_event_box_new();
945 gtk_widget_show( eventbox );
946 gtk_table_attach( GTK_TABLE( table1 ), eventbox, 0, 1, 8, 9,
947 (GtkAttachOptions) ( GTK_FILL ),
948 (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
950 label = gtk_label_new( "V Scale: " );
951 gtk_widget_show( label );
952 gtk_container_add( GTK_CONTAINER( eventbox ), label );
953 gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT );
954 gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 );
956 eventbox = gtk_event_box_new();
957 gtk_widget_show( eventbox );
958 gtk_table_attach( GTK_TABLE( table1 ), eventbox, 0, 1, 10, 11,
959 (GtkAttachOptions) ( GTK_FILL ),
960 (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
962 label = gtk_label_new( "Rotate: " );
963 gtk_widget_show( label );
964 gtk_container_add( GTK_CONTAINER( eventbox ), label );
965 gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT );
966 gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 );
968 eventbox = gtk_event_box_new();
969 gtk_widget_show( eventbox );
970 gtk_table_attach( GTK_TABLE( table1 ), eventbox, 0, 1, 2, 3,
971 (GtkAttachOptions) ( GTK_FILL ),
972 (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
974 label = gtk_label_new( "H Shift: " );
975 gtk_widget_show( label );
976 gtk_container_add( GTK_CONTAINER( eventbox ), label );
977 gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT );
978 gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 );
980 hseparator = gtk_hseparator_new();
981 gtk_widget_show( hseparator );
982 gtk_table_attach( GTK_TABLE( table1 ), hseparator, 0, 1, 1, 2,
983 (GtkAttachOptions) ( GTK_FILL ),
984 (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
986 eventbox = gtk_event_box_new();
987 gtk_widget_show( eventbox );
988 gtk_table_attach( GTK_TABLE( table1 ), eventbox, 1, 2, 12, 13,
989 (GtkAttachOptions) ( GTK_FILL ),
990 (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
992 lock_valuechange_togglebutton = gtk_toggle_button_new_with_mnemonic( "UNLOCK" );
993 gtk_widget_show( lock_valuechange_togglebutton );
994 gtk_container_add( GTK_CONTAINER( eventbox ), lock_valuechange_togglebutton );
997 hshift_value_spinbutton_adj = gtk_adjustment_new( 0.0, -8192.0, 8192.0, 2.0, 8.0, 8.0 );
998 hshift_value_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( hshift_value_spinbutton_adj ), 1, 2 );
999 gtk_widget_show( hshift_value_spinbutton );
1000 gtk_table_attach( GTK_TABLE( table1 ), hshift_value_spinbutton, 1, 2, 2, 3,
1001 (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
1002 (GtkAttachOptions) ( 0 ), 0, 0 );
1003 gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( hshift_value_spinbutton ), GTK_UPDATE_IF_VALID );
1004 gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( hshift_value_spinbutton ), TRUE );
1005 gtk_widget_set_sensitive( GTK_WIDGET( hshift_value_spinbutton ), FALSE );
1007 vshift_value_spinbutton_adj = gtk_adjustment_new( 0.0, -8192.0, 8192.0, 2.0, 8.0, 8.0 );
1008 vshift_value_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( vshift_value_spinbutton_adj ), 1, 2 );
1009 gtk_widget_show( vshift_value_spinbutton );
1010 gtk_table_attach( GTK_TABLE( table1 ), vshift_value_spinbutton, 1, 2, 4, 5,
1011 (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
1012 (GtkAttachOptions) ( 0 ), 0, 0 );
1013 gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( vshift_value_spinbutton ), GTK_UPDATE_IF_VALID );
1014 gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( vshift_value_spinbutton ), TRUE );
1015 gtk_widget_set_sensitive( GTK_WIDGET( vshift_value_spinbutton ), FALSE );
1017 hscale_value_spinbutton_adj = gtk_adjustment_new( 0.0, -1024.0, 1024.0, 1.0, 4.0, 4.0 );
1018 hscale_value_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( hscale_value_spinbutton_adj ), 1, 4 );
1019 gtk_widget_show( hscale_value_spinbutton );
1020 gtk_table_attach( GTK_TABLE( table1 ), hscale_value_spinbutton, 1, 2, 6, 7,
1021 (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
1022 (GtkAttachOptions) ( 0 ), 0, 0 );
1023 gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( hscale_value_spinbutton ), GTK_UPDATE_IF_VALID );
1024 gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( hscale_value_spinbutton ), TRUE );
1025 gtk_widget_set_sensitive( GTK_WIDGET( hscale_value_spinbutton ), FALSE );
1027 vscale_value_spinbutton_adj = gtk_adjustment_new( 0.0, -1024.0, 1024.0, 1.0, 4.0, 4.0 );
1028 vscale_value_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( vscale_value_spinbutton_adj ), 1, 4 );
1029 gtk_widget_show( vscale_value_spinbutton );
1030 gtk_table_attach( GTK_TABLE( table1 ), vscale_value_spinbutton, 1, 2, 8, 9,
1031 (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
1032 (GtkAttachOptions) ( 0 ), 0, 0 );
1033 gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( vscale_value_spinbutton ), GTK_UPDATE_IF_VALID );
1034 gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( vscale_value_spinbutton ), TRUE );
1035 gtk_widget_set_sensitive( GTK_WIDGET( vscale_value_spinbutton ), FALSE );
1037 rotate_value_spinbutton_adj = gtk_adjustment_new( 0.0, -360.0, 360.0, 1.0, 10.0, 10.0 );
1038 rotate_value_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( rotate_value_spinbutton_adj ), 1, 0 );
1039 gtk_widget_show( rotate_value_spinbutton );
1040 gtk_table_attach( GTK_TABLE( table1 ), rotate_value_spinbutton, 1, 2, 10, 11,
1041 (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
1042 (GtkAttachOptions) ( 0 ), 0, 0 );
1043 gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( rotate_value_spinbutton ), GTK_UPDATE_IF_VALID );
1044 gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( rotate_value_spinbutton ), TRUE );
1045 gtk_widget_set_sensitive( GTK_WIDGET( rotate_value_spinbutton ), FALSE );
1048 hshift_offset_spinbutton_adj = gtk_adjustment_new( 0.0, -8192.0, 8192.0, 2.0, 8.0, 8.0 );
1049 hshift_offset_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( hshift_offset_spinbutton_adj ), 0, 2 );
1050 gtk_widget_show( hshift_offset_spinbutton );
1051 gtk_table_attach( GTK_TABLE( table1 ), hshift_offset_spinbutton, 2, 3, 2, 3,
1052 (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
1053 (GtkAttachOptions) ( 0 ), 4, 0 );
1054 gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( hshift_offset_spinbutton ), TRUE );
1055 gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( hshift_offset_spinbutton ), GTK_UPDATE_IF_VALID );
1056 gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( hshift_offset_spinbutton ), TRUE );
1058 vshift_offset_spinbutton_adj = gtk_adjustment_new( 0.0, -8192.0, 8192.0, 2.0, 8.0, 8.0 );
1059 vshift_offset_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( vshift_offset_spinbutton_adj ), 0, 2 );
1060 gtk_widget_show( vshift_offset_spinbutton );
1061 gtk_table_attach( GTK_TABLE( table1 ), vshift_offset_spinbutton, 2, 3, 4, 5,
1062 (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
1063 (GtkAttachOptions) ( 0 ), 4, 0 );
1064 gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( vshift_offset_spinbutton ), TRUE );
1065 gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( vshift_offset_spinbutton ), GTK_UPDATE_IF_VALID );
1066 gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( vshift_offset_spinbutton ), TRUE );
1068 hscale_offset_spinbutton_adj = gtk_adjustment_new( 0.0, -1024.0, 1024.0, 1.0, 4.0, 4.0 );
1069 hscale_offset_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( hscale_offset_spinbutton_adj ), 0, 4 );
1070 gtk_widget_show( hscale_offset_spinbutton );
1071 gtk_table_attach( GTK_TABLE( table1 ), hscale_offset_spinbutton, 2, 3, 6, 7,
1072 (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
1073 (GtkAttachOptions) ( 0 ), 4, 0 );
1074 gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( hscale_offset_spinbutton ), TRUE );
1075 gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( hscale_offset_spinbutton ), GTK_UPDATE_IF_VALID );
1076 gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( hscale_offset_spinbutton ), TRUE );
1078 vscale_offset_spinbutton_adj = gtk_adjustment_new( 0.0, -1024.0, 1024.0, 1.0, 4.0, 4.0 );
1079 vscale_offset_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( vscale_offset_spinbutton_adj ), 0, 4 );
1080 gtk_widget_show( vscale_offset_spinbutton );
1081 gtk_table_attach( GTK_TABLE( table1 ), vscale_offset_spinbutton, 2, 3, 8, 9,
1082 (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
1083 (GtkAttachOptions) ( 0 ), 4, 0 );
1084 gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( vscale_offset_spinbutton ), TRUE );
1085 gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( vscale_offset_spinbutton ), GTK_UPDATE_IF_VALID );
1086 gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( vscale_offset_spinbutton ), TRUE );
1088 rotate_offset_spinbutton_adj = gtk_adjustment_new( 0.0, -360.0, 360.0, 1.0, 10.0, 10.0 );
1089 rotate_offset_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( rotate_offset_spinbutton_adj ), 0, 2 );
1090 gtk_widget_show( rotate_offset_spinbutton );
1091 gtk_table_attach( GTK_TABLE( table1 ), rotate_offset_spinbutton, 2, 3, 10, 11,
1092 (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
1093 (GtkAttachOptions) ( 0 ), 4, 0 );
1094 gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( rotate_offset_spinbutton ), TRUE );
1095 gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( rotate_offset_spinbutton ), GTK_UPDATE_IF_VALID );
1096 gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( rotate_offset_spinbutton ), TRUE );
1099 hshift_step_spinbutton_adj = gtk_adjustment_new( 0.0, -8192.0, 8192.0, 2.0, 8.0, 8.0 );
1100 hshift_step_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( hshift_step_spinbutton_adj ), 1, 2 );
1101 gtk_widget_show( hshift_step_spinbutton );
1102 gtk_table_attach( GTK_TABLE( table1 ), hshift_step_spinbutton, 3, 4, 2, 3,
1103 (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
1104 (GtkAttachOptions) ( 0 ), 0, 0 );
1105 gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( hshift_step_spinbutton ), GTK_UPDATE_IF_VALID );
1107 vshift_step_spinbutton_adj = gtk_adjustment_new( 0.0, -8192.0, 8192.0, 2.0, 8.0, 8.0 );
1108 vshift_step_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( vshift_step_spinbutton_adj ), 1, 2 );
1109 gtk_widget_show( vshift_step_spinbutton );
1110 gtk_table_attach( GTK_TABLE( table1 ), vshift_step_spinbutton, 3, 4, 4, 5,
1111 (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
1112 (GtkAttachOptions) ( 0 ), 0, 0 );
1113 gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( vshift_step_spinbutton ), GTK_UPDATE_IF_VALID );
1115 hscale_step_spinbutton_adj = gtk_adjustment_new( 0.0, -1024.0, 1024.0, 1.0, 4.0, 4.0 );
1116 hscale_step_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( hscale_step_spinbutton_adj ), 1, 4 );
1117 gtk_widget_show( hscale_step_spinbutton );
1118 gtk_table_attach( GTK_TABLE( table1 ), hscale_step_spinbutton, 3, 4, 6, 7,
1119 (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
1120 (GtkAttachOptions) ( 0 ), 0, 0 );
1121 gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( hscale_step_spinbutton ), GTK_UPDATE_IF_VALID );
1123 vscale_step_spinbutton_adj = gtk_adjustment_new( 0.0, -1024.0, 1024.0, 1.0, 4.0, 4.0 );
1124 vscale_step_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( vscale_step_spinbutton_adj ), 1, 4 );
1125 gtk_widget_show( vscale_step_spinbutton );
1126 gtk_table_attach( GTK_TABLE( table1 ), vscale_step_spinbutton, 3, 4, 8, 9,
1127 (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
1128 (GtkAttachOptions) ( 0 ), 0, 0 );
1129 gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( vscale_step_spinbutton ), GTK_UPDATE_IF_VALID );
1131 rotate_step_spinbutton_adj = gtk_adjustment_new( 0.0, -360.0, 360.0, 1.0, 10.0, 10.0 );
1132 rotate_step_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( rotate_step_spinbutton_adj ), 1, 2 );
1133 gtk_widget_show( rotate_step_spinbutton );
1134 gtk_table_attach( GTK_TABLE( table1 ), rotate_step_spinbutton, 3, 4, 10, 11,
1135 (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
1136 (GtkAttachOptions) ( 0 ), 0, 0 );
1137 gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( rotate_step_spinbutton ), GTK_UPDATE_IF_VALID );
1139 eventbox = gtk_event_box_new();
1140 gtk_widget_show( eventbox );
1141 gtk_table_attach( GTK_TABLE( table1 ), eventbox, 2, 3, 12, 13,
1142 (GtkAttachOptions) ( 0 ),
1143 (GtkAttachOptions) ( 0 ), 0, 0 );
1145 eventbox = gtk_event_box_new();
1146 gtk_widget_show( eventbox );
1147 gtk_table_attach( GTK_TABLE( table1 ), eventbox, 0, 1, 12, 13,
1148 (GtkAttachOptions) ( 0 ),
1149 (GtkAttachOptions) ( 0 ), 0, 0 );
1151 eventbox = gtk_event_box_new();
1152 gtk_widget_show( eventbox );
1153 gtk_table_attach( GTK_TABLE( table1 ), eventbox, 0, 1, 0, 1,
1154 (GtkAttachOptions) ( 0 ),
1155 (GtkAttachOptions) ( 0 ), 0, 0 );
1157 viewport7 = gtk_viewport_new( NULL, NULL );
1158 gtk_widget_show( viewport7 );
1159 gtk_box_pack_start( GTK_BOX( vbox7 ), viewport7, FALSE, TRUE, 0 );
1160 gtk_container_set_border_width( GTK_CONTAINER( viewport7 ), 2 );
1161 gtk_viewport_set_shadow_type( GTK_VIEWPORT( viewport7 ), GTK_SHADOW_ETCHED_IN );
1163 table4 = gtk_table_new( 4, 7, FALSE );
1164 gtk_widget_show( table4 );
1165 gtk_container_add( GTK_CONTAINER( viewport7 ), table4 );
1167 viewport5 = gtk_viewport_new( NULL, NULL );
1168 gtk_widget_show( viewport5 );
1169 gtk_table_attach( GTK_TABLE( table4 ), viewport5, 1, 7, 0, 4,
1170 (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
1171 (GtkAttachOptions) ( 0 ), 0, 0 );
1172 gtk_container_set_border_width( GTK_CONTAINER( viewport5 ), 6 );
1173 gtk_viewport_set_shadow_type( GTK_VIEWPORT( viewport5 ), GTK_SHADOW_ETCHED_OUT );
1175 table5 = gtk_table_new( 2, 3, FALSE );
1176 gtk_widget_show( table5 );
1177 gtk_container_add( GTK_CONTAINER( viewport5 ), table5 );
1178 gtk_container_set_border_width( GTK_CONTAINER( table5 ), 5 );
1179 gtk_table_set_col_spacings( GTK_TABLE( table5 ), 2 );
1181 label = gtk_label_new( "Height" );
1182 gtk_widget_show( label );
1183 gtk_table_attach( GTK_TABLE( table5 ), label, 2, 3, 0, 1,
1184 (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
1185 (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
1186 gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT );
1187 gtk_misc_set_alignment( GTK_MISC( label ), 0.5, 1 );
1189 label = gtk_label_new( "Width" );
1190 gtk_widget_show( label );
1191 gtk_table_attach( GTK_TABLE( table5 ), label, 1, 2, 0, 1,
1192 (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
1193 (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
1194 gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT );
1195 gtk_misc_set_alignment( GTK_MISC( label ), 0.5, 1 );
1197 fit_width_spinbutton_adj = gtk_adjustment_new( 1, 1, 32, 1, 10, 10 );
1198 fit_width_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( fit_width_spinbutton_adj ), 1, 0 );
1199 gtk_widget_show( fit_width_spinbutton );
1200 gtk_table_attach( GTK_TABLE( table5 ), fit_width_spinbutton, 1, 2, 1, 2,
1201 (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
1202 (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
1203 gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( fit_width_spinbutton ), TRUE );
1204 gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( fit_width_spinbutton ), GTK_UPDATE_IF_VALID );
1206 fit_height_spinbutton_adj = gtk_adjustment_new( 1, 1, 32, 1, 10, 10 );
1207 fit_height_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( fit_height_spinbutton_adj ), 1, 0 );
1208 gtk_widget_show( fit_height_spinbutton );
1209 gtk_table_attach( GTK_TABLE( table5 ), fit_height_spinbutton, 2, 3, 1, 2,
1210 (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
1211 (GtkAttachOptions) ( GTK_FILL ), 3, 0 );
1212 gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( fit_height_spinbutton ), TRUE );
1213 gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( fit_height_spinbutton ), GTK_UPDATE_IF_VALID );
1215 eventbox = gtk_event_box_new();
1216 gtk_widget_show( eventbox );
1217 gtk_table_attach( GTK_TABLE( table5 ), eventbox, 0, 1, 0, 1,
1218 (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
1219 (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
1221 eventbox = gtk_event_box_new();
1222 gtk_widget_show( eventbox );
1223 gtk_table_attach( GTK_TABLE( table5 ), eventbox, 0, 1, 1, 2,
1224 (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
1225 (GtkAttachOptions) ( GTK_FILL ), 4, 0 );
1227 fit_button = gtk_button_new_with_mnemonic( " Fit " );
1228 gtk_widget_show( fit_button );
1229 gtk_container_add( GTK_CONTAINER( eventbox ), fit_button );
1231 viewport6 = gtk_viewport_new( NULL, NULL );
1232 gtk_widget_show( viewport6 );
1233 gtk_table_attach( GTK_TABLE( table4 ), viewport6, 0, 1, 0, 4,
1234 (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
1235 (GtkAttachOptions) ( 0 ), 0, 0 );
1236 gtk_container_set_border_width( GTK_CONTAINER( viewport6 ), 4 );
1237 gtk_viewport_set_shadow_type( GTK_VIEWPORT( viewport6 ), GTK_SHADOW_NONE );
1239 table7 = gtk_table_new( 2, 1, FALSE );
1240 gtk_widget_show( table7 );
1241 gtk_container_add( GTK_CONTAINER( viewport6 ), table7 );
1243 eventbox = gtk_event_box_new();
1244 gtk_widget_show( eventbox );
1245 gtk_table_attach( GTK_TABLE( table7 ), eventbox, 0, 1, 0, 2,
1246 (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
1247 (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 );
1249 axial_button = gtk_button_new_with_mnemonic( "Axial" );
1250 gtk_widget_show( axial_button );
1251 gtk_container_add( GTK_CONTAINER( eventbox ), axial_button );
1252 gtk_widget_set_size_request( axial_button, 56, 29 );
1253 gtk_container_set_border_width( GTK_CONTAINER( axial_button ), 4 );
1255 // Fit in Flags sub-dialog
1256 Create_Heretic2FlagsDialog( vbox7 );
1258 viewport10 = gtk_viewport_new( NULL, NULL );
1259 gtk_widget_show( viewport10 );
1260 gtk_box_pack_start( GTK_BOX( vbox7 ), viewport10, FALSE, TRUE, 0 );
1261 gtk_container_set_border_width( GTK_CONTAINER( viewport10 ), 2 );
1262 gtk_viewport_set_shadow_type( GTK_VIEWPORT( viewport10 ), GTK_SHADOW_ETCHED_IN );
1264 hbuttonbox1 = gtk_hbutton_box_new();
1265 gtk_widget_show( hbuttonbox1 );
1266 gtk_container_add( GTK_CONTAINER( viewport10 ), hbuttonbox1 );
1267 gtk_container_set_border_width( GTK_CONTAINER( hbuttonbox1 ), 4 );
1268 gtk_button_box_set_layout( GTK_BUTTON_BOX( hbuttonbox1 ), GTK_BUTTONBOX_SPREAD );
1270 done_button = gtk_button_new();
1271 gtk_widget_show( done_button );
1272 gtk_container_add( GTK_CONTAINER( hbuttonbox1 ), done_button );
1273 GTK_WIDGET_SET_FLAGS( done_button, GTK_CAN_DEFAULT );
1275 alignment1 = gtk_alignment_new( 0.5, 0.5, 0, 0 );
1276 gtk_widget_show( alignment1 );
1277 gtk_container_add( GTK_CONTAINER( done_button ), alignment1 );
1279 hbox2 = gtk_hbox_new( FALSE, 2 );
1280 gtk_widget_show( hbox2 );
1281 gtk_container_add( GTK_CONTAINER( alignment1 ), hbox2 );
1283 image1 = gtk_image_new_from_stock( "gtk-yes", GTK_ICON_SIZE_BUTTON );
1284 gtk_widget_show( image1 );
1285 gtk_box_pack_start( GTK_BOX( hbox2 ), image1, FALSE, FALSE, 0 );
1287 label = gtk_label_new_with_mnemonic( "Done" );
1288 gtk_widget_show( label );
1289 gtk_box_pack_start( GTK_BOX( hbox2 ), label, FALSE, FALSE, 0 );
1290 gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT );
1292 apply_button = gtk_button_new();
1293 gtk_widget_show( apply_button );
1294 gtk_container_add( GTK_CONTAINER( hbuttonbox1 ), apply_button );
1295 GTK_WIDGET_SET_FLAGS( apply_button, GTK_CAN_DEFAULT );
1297 alignment3 = gtk_alignment_new( 0.5, 0.5, 0, 0 );
1298 gtk_widget_show( alignment3 );
1299 gtk_container_add( GTK_CONTAINER( apply_button ), alignment3 );
1301 hbox4 = gtk_hbox_new( FALSE, 2 );
1302 gtk_widget_show( hbox4 );
1303 gtk_container_add( GTK_CONTAINER( alignment3 ), hbox4 );
1305 image3 = gtk_image_new_from_stock( "gtk-apply", GTK_ICON_SIZE_BUTTON );
1306 gtk_widget_show( image3 );
1307 gtk_box_pack_start( GTK_BOX( hbox4 ), image3, FALSE, FALSE, 0 );
1309 label = gtk_label_new_with_mnemonic( "Apply" );
1310 gtk_widget_show( label );
1311 gtk_box_pack_start( GTK_BOX( hbox4 ), label, FALSE, FALSE, 0 );
1312 gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT );
1314 cancel_button = gtk_button_new();
1315 gtk_widget_show( cancel_button );
1316 gtk_container_add( GTK_CONTAINER( hbuttonbox1 ), cancel_button );
1317 GTK_WIDGET_SET_FLAGS( cancel_button, GTK_CAN_DEFAULT );
1319 alignment2 = gtk_alignment_new( 0.5, 0.5, 0, 0 );
1320 gtk_widget_show( alignment2 );
1321 gtk_container_add( GTK_CONTAINER( cancel_button ), alignment2 );
1323 hbox3 = gtk_hbox_new( FALSE, 2 );
1324 gtk_widget_show( hbox3 );
1325 gtk_container_add( GTK_CONTAINER( alignment2 ), hbox3 );
1327 image2 = gtk_image_new_from_stock( "gtk-no", GTK_ICON_SIZE_BUTTON );
1328 gtk_widget_show( image2 );
1329 gtk_box_pack_start( GTK_BOX( hbox3 ), image2, FALSE, FALSE, 0 );
1331 label = gtk_label_new_with_mnemonic( "Cancel" );
1332 gtk_widget_show( label );
1333 gtk_box_pack_start( GTK_BOX( hbox3 ), label, FALSE, FALSE, 0 );
1334 gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT );
1337 g_signal_connect( (gpointer) SurfaceInspector,
1339 G_CALLBACK( delete_event_callback ),
1341 g_signal_connect( (gpointer) SurfaceInspector, "destroy",
1342 G_CALLBACK( gtk_widget_destroy ),
1345 g_signal_connect( (gpointer) texture_combo_entry, "key_press_event",
1346 G_CALLBACK( on_texture_combo_entry_key_press_event ),
1348 g_signal_connect( (gpointer) texture_combo_entry, "activate",
1349 G_CALLBACK( on_texture_combo_entry_activate ),
1353 g_signal_connect( (gpointer) hshift_offset_spinbutton, "value_changed",
1354 G_CALLBACK( on_hshift_offset_spinbutton_value_changed ),
1356 g_signal_connect( (gpointer) vshift_offset_spinbutton, "value_changed",
1357 G_CALLBACK( on_vshift_offset_spinbutton_value_changed ),
1359 g_signal_connect( (gpointer) hscale_offset_spinbutton, "value_changed",
1360 G_CALLBACK( on_hscale_offset_spinbutton_value_changed ),
1362 g_signal_connect( (gpointer) vscale_offset_spinbutton, "value_changed",
1363 G_CALLBACK( on_vscale_offset_spinbutton_value_changed ),
1365 g_signal_connect( (gpointer) rotate_offset_spinbutton, "value_changed",
1366 G_CALLBACK( on_rotate_offset_spinbutton_value_changed ),
1369 g_signal_connect( (gpointer) hshift_value_spinbutton, "value_changed",
1370 G_CALLBACK( on_hshift_value_spinbutton_value_changed ),
1372 g_signal_connect( (gpointer) vshift_value_spinbutton, "value_changed",
1373 G_CALLBACK( on_vshift_value_spinbutton_value_changed ),
1375 g_signal_connect( (gpointer) hscale_value_spinbutton, "value_changed",
1376 G_CALLBACK( on_hscale_value_spinbutton_value_changed ),
1378 g_signal_connect( (gpointer) vscale_value_spinbutton, "value_changed",
1379 G_CALLBACK( on_vscale_value_spinbutton_value_changed ),
1381 g_signal_connect( (gpointer) rotate_value_spinbutton, "value_changed",
1382 G_CALLBACK( on_rotate_value_spinbutton_value_changed ),
1385 g_signal_connect( (gpointer) hshift_step_spinbutton, "value_changed",
1386 G_CALLBACK( on_hshift_step_spinbutton_value_changed ),
1388 g_signal_connect( (gpointer) vshift_step_spinbutton, "value_changed",
1389 G_CALLBACK( on_vshift_step_spinbutton_value_changed ),
1391 g_signal_connect( (gpointer) hscale_step_spinbutton, "value_changed",
1392 G_CALLBACK( on_hscale_step_spinbutton_value_changed ),
1394 g_signal_connect( (gpointer) vscale_step_spinbutton, "value_changed",
1395 G_CALLBACK( on_vscale_step_spinbutton_value_changed ),
1397 g_signal_connect( (gpointer) rotate_step_spinbutton, "value_changed",
1398 G_CALLBACK( on_rotate_step_spinbutton_value_changed ),
1401 g_signal_connect( (gpointer) match_grid_button, "clicked",
1402 G_CALLBACK( on_match_grid_button_clicked ),
1404 g_signal_connect( (gpointer) lock_valuechange_togglebutton, "toggled",
1405 G_CALLBACK( on_lock_valuechange_togglebutton_toggled ),
1408 g_signal_connect( (gpointer) fit_width_spinbutton, "value_changed",
1409 G_CALLBACK( on_fit_width_spinbutton_value_changed ),
1411 g_signal_connect( (gpointer) fit_height_spinbutton, "value_changed",
1412 G_CALLBACK( on_fit_height_spinbutton_value_changed ),
1414 g_signal_connect( (gpointer) fit_button, "clicked",
1415 G_CALLBACK( on_fit_button_clicked ),
1418 g_signal_connect( (gpointer) axial_button, "clicked",
1419 G_CALLBACK( on_axial_button_clicked ),
1422 g_signal_connect( (gpointer) done_button, "clicked",
1423 G_CALLBACK( on_done_button_clicked ),
1425 g_signal_connect( (gpointer) apply_button, "clicked",
1426 G_CALLBACK( on_apply_button_clicked ),
1428 g_signal_connect( (gpointer) cancel_button, "clicked",
1429 G_CALLBACK( on_cancel_button_clicked ),
1433 return SurfaceInspector;
1438 gboolean on_texture_combo_entry_key_press_event( GtkWidget *widget, GdkEventKey *event,
1439 gpointer user_data ){
1440 // Have Tab activate selection as well as Return
1441 if ( event->keyval == GDK_Tab ) {
1442 g_signal_emit_by_name( texture_combo_entry, "activate" );
1448 void on_texture_combo_entry_activate( GtkEntry *entry, gpointer user_data ){
1449 texdef_t* tmp_texdef;
1450 texdef_t* tmp_orig_texdef;
1451 texdef_to_face_t* temp_texdef_face_list;
1452 char text[128] = { 0 };
1454 if ( !texdef_face_list_empty() && g_bListenChanged ) {
1455 // activate only on entry change
1456 strcpy( text, gtk_entry_get_text( entry ) );
1457 if ( strcmp( old_texture_entry, text ) ) {
1458 // Check for spaces in shader name
1459 if ( text[0] <= ' ' || strchr( text, ' ' ) ) {
1460 Sys_FPrintf( SYS_WRN, "WARNING: spaces in shader names are not allowed, ignoring '%s'\n", text );
1464 for ( temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next )
1466 tmp_texdef = (texdef_t *) &temp_texdef_face_list->texdef;
1467 tmp_orig_texdef = (texdef_t *) &temp_texdef_face_list->orig_texdef;
1468 strcpy( old_texture_entry, text );
1469 tmp_texdef->SetName( text );
1478 static void on_hshift_offset_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){
1479 texdef_t* tmp_texdef;
1480 texdef_t* tmp_orig_texdef;
1481 texdef_to_face_t* temp_texdef_face_list;
1483 texdef_offset.shift[0] = gtk_spin_button_get_value( GTK_SPIN_BUTTON( hshift_offset_spinbutton ) );
1485 if ( !texdef_face_list_empty() && g_bListenChanged ) {
1486 for ( temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next )
1488 tmp_texdef = (texdef_t *) &temp_texdef_face_list->texdef;
1489 tmp_orig_texdef = (texdef_t *) &temp_texdef_face_list->orig_texdef;
1490 if ( is_HShift_conflicting ) {
1491 tmp_texdef->shift[0] = tmp_orig_texdef->shift[0] + texdef_offset.shift[0];
1494 tmp_texdef->shift[0] = texdef_SI_values.shift[0] + texdef_offset.shift[0];
1501 static void on_vshift_offset_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){
1502 texdef_t* tmp_texdef;
1503 texdef_t* tmp_orig_texdef;
1504 texdef_to_face_t* temp_texdef_face_list;
1506 texdef_offset.shift[1] = gtk_spin_button_get_value( GTK_SPIN_BUTTON( vshift_offset_spinbutton ) );
1508 if ( !texdef_face_list_empty() && g_bListenChanged ) {
1509 for ( temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next )
1511 tmp_texdef = (texdef_t *) &temp_texdef_face_list->texdef;
1512 tmp_orig_texdef = (texdef_t *) &temp_texdef_face_list->orig_texdef;
1513 if ( is_VShift_conflicting ) {
1514 tmp_texdef->shift[1] = tmp_orig_texdef->shift[1] + texdef_offset.shift[1];
1517 tmp_texdef->shift[1] = texdef_SI_values.shift[1] + texdef_offset.shift[1];
1525 static void on_hscale_offset_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){
1526 texdef_t* tmp_texdef;
1527 texdef_t* tmp_orig_texdef;
1528 texdef_to_face_t* temp_texdef_face_list;
1530 texdef_offset.scale[0] = gtk_spin_button_get_value( GTK_SPIN_BUTTON( hscale_offset_spinbutton ) );
1532 if ( !texdef_face_list_empty() && g_bListenChanged ) {
1533 for ( temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next )
1535 tmp_texdef = (texdef_t *) &temp_texdef_face_list->texdef;
1536 tmp_orig_texdef = (texdef_t *) &temp_texdef_face_list->orig_texdef;
1537 if ( is_HScale_conflicting ) {
1538 tmp_texdef->scale[0] = tmp_orig_texdef->scale[0] + texdef_offset.scale[0];
1541 tmp_texdef->scale[0] = texdef_SI_values.scale[0] + texdef_offset.scale[0];
1550 static void on_vscale_offset_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){
1551 texdef_t* tmp_texdef;
1552 texdef_t* tmp_orig_texdef;
1553 texdef_to_face_t* temp_texdef_face_list;
1555 texdef_offset.scale[1] = gtk_spin_button_get_value( GTK_SPIN_BUTTON( vscale_offset_spinbutton ) );
1557 if ( !texdef_face_list_empty() && g_bListenChanged ) {
1558 for ( temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next )
1560 tmp_texdef = (texdef_t *) &temp_texdef_face_list->texdef;
1561 tmp_orig_texdef = (texdef_t *) &temp_texdef_face_list->orig_texdef;
1562 if ( is_VScale_conflicting ) {
1563 tmp_texdef->scale[1] = tmp_orig_texdef->scale[1] + texdef_offset.scale[1];
1566 tmp_texdef->scale[1] = texdef_SI_values.scale[1] + texdef_offset.scale[1];
1574 static void on_rotate_offset_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){
1575 texdef_t* tmp_texdef;
1576 texdef_t* tmp_orig_texdef;
1577 texdef_to_face_t* temp_texdef_face_list;
1579 texdef_offset.rotate = gtk_spin_button_get_value( GTK_SPIN_BUTTON( rotate_offset_spinbutton ) );
1581 if ( !texdef_face_list_empty() && g_bListenChanged ) {
1582 for ( temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next )
1584 tmp_texdef = (texdef_t *) &temp_texdef_face_list->texdef;
1585 tmp_orig_texdef = (texdef_t *) &temp_texdef_face_list->orig_texdef;
1586 if ( is_Rotate_conflicting ) {
1587 tmp_texdef->rotate = tmp_orig_texdef->rotate + texdef_offset.rotate;
1590 tmp_texdef->rotate = texdef_SI_values.rotate + texdef_offset.rotate;
1600 static void on_match_grid_button_clicked( GtkButton *button, gpointer user_data ){
1601 float hscale, vscale;
1603 if ( !strcmp( gtk_entry_get_text( GTK_ENTRY( hscale_value_spinbutton ) ), "" ) ) {
1607 hscale = gtk_spin_button_get_value( GTK_SPIN_BUTTON( hscale_value_spinbutton ) );
1610 if ( !strcmp( gtk_entry_get_text( GTK_ENTRY( vscale_value_spinbutton ) ), "" ) ) {
1614 vscale = gtk_spin_button_get_value( GTK_SPIN_BUTTON( vscale_value_spinbutton ) );
1616 DoSnapTToGrid( hscale, vscale );
1620 // Lock out changes to Value
1621 static void on_lock_valuechange_togglebutton_toggled( GtkToggleButton *togglebutton, gpointer user_data ){
1624 is_Locked = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( lock_valuechange_togglebutton ) );
1626 gtk_widget_set_sensitive( GTK_WIDGET( hscale_value_spinbutton ), is_Locked );
1627 gtk_widget_set_sensitive( GTK_WIDGET( vscale_value_spinbutton ), is_Locked );
1628 gtk_widget_set_sensitive( GTK_WIDGET( hshift_value_spinbutton ), is_Locked );
1629 gtk_widget_set_sensitive( GTK_WIDGET( vshift_value_spinbutton ), is_Locked );
1630 gtk_widget_set_sensitive( GTK_WIDGET( rotate_value_spinbutton ), is_Locked );
1635 static void on_hshift_value_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){
1636 texdef_t* tmp_texdef;
1637 texdef_t* tmp_orig_texdef;
1638 texdef_to_face_t* temp_texdef_face_list;
1640 texdef_SI_values.shift[0] = gtk_spin_button_get_value( GTK_SPIN_BUTTON( hshift_value_spinbutton ) );
1642 if ( !texdef_face_list_empty() && g_bListenChanged ) {
1643 for ( temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next )
1645 tmp_texdef = (texdef_t *) &temp_texdef_face_list->texdef;
1646 tmp_orig_texdef = (texdef_t *) &temp_texdef_face_list->orig_texdef;
1647 tmp_texdef->shift[0] = texdef_SI_values.shift[0] + texdef_offset.shift[0];
1648 is_HShift_conflicting = FALSE;
1654 static void on_vshift_value_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){
1655 texdef_t* tmp_texdef;
1656 texdef_t* tmp_orig_texdef;
1657 texdef_to_face_t* temp_texdef_face_list;
1659 texdef_SI_values.shift[1] = gtk_spin_button_get_value( GTK_SPIN_BUTTON( vshift_value_spinbutton ) );
1661 if ( !texdef_face_list_empty() && g_bListenChanged ) {
1662 for ( temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next )
1664 tmp_texdef = (texdef_t *) &temp_texdef_face_list->texdef;
1665 tmp_orig_texdef = (texdef_t *) &temp_texdef_face_list->orig_texdef;
1666 tmp_texdef->shift[1] = texdef_SI_values.shift[1] + texdef_offset.shift[1];
1667 is_VShift_conflicting = FALSE;
1673 static void on_hscale_value_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){
1674 texdef_t* tmp_texdef;
1675 texdef_t* tmp_orig_texdef;
1676 texdef_to_face_t* temp_texdef_face_list;
1678 texdef_SI_values.scale[0] = gtk_spin_button_get_value( GTK_SPIN_BUTTON( hscale_value_spinbutton ) );
1680 if ( !texdef_face_list_empty() && g_bListenChanged ) {
1681 for ( temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next )
1683 tmp_texdef = (texdef_t *) &temp_texdef_face_list->texdef;
1684 tmp_orig_texdef = (texdef_t *) &temp_texdef_face_list->orig_texdef;
1685 tmp_texdef->scale[0] = texdef_SI_values.scale[0] + texdef_offset.scale[0];
1686 is_HScale_conflicting = FALSE;
1692 static void on_vscale_value_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){
1693 texdef_t* tmp_texdef;
1694 texdef_t* tmp_orig_texdef;
1695 texdef_to_face_t* temp_texdef_face_list;
1697 texdef_SI_values.scale[1] = gtk_spin_button_get_value( GTK_SPIN_BUTTON( vscale_value_spinbutton ) );
1699 if ( !texdef_face_list_empty() && g_bListenChanged ) {
1700 for ( temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next )
1702 tmp_texdef = (texdef_t *) &temp_texdef_face_list->texdef;
1703 tmp_orig_texdef = (texdef_t *) &temp_texdef_face_list->orig_texdef;
1704 tmp_texdef->scale[1] = texdef_SI_values.scale[1] + texdef_offset.scale[1];
1705 is_VScale_conflicting = FALSE;
1711 static void on_rotate_value_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){
1712 texdef_t* tmp_texdef;
1713 texdef_t* tmp_orig_texdef;
1714 texdef_to_face_t* temp_texdef_face_list;
1716 texdef_SI_values.rotate = gtk_spin_button_get_value( GTK_SPIN_BUTTON( rotate_value_spinbutton ) );
1718 if ( !texdef_face_list_empty() && g_bListenChanged ) {
1719 for ( temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next )
1721 tmp_texdef = (texdef_t *) &temp_texdef_face_list->texdef;
1722 tmp_orig_texdef = (texdef_t *) &temp_texdef_face_list->orig_texdef;
1723 tmp_texdef->rotate = texdef_SI_values.rotate + texdef_offset.rotate;
1724 is_Rotate_conflicting = FALSE;
1732 static void on_hshift_step_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){
1734 GtkAdjustment * adjust;
1736 if ( !g_bListenChanged ) {
1740 l_pIncrement = Get_SI_Inc();
1743 Sys_Printf( "OnIncrementChanged HShift\n" );
1746 val = gtk_spin_button_get_value( GTK_SPIN_BUTTON( hshift_step_spinbutton ) ) ;
1747 adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( hshift_offset_spinbutton ) );
1748 adjust->step_increment = val;
1749 adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( hshift_value_spinbutton ) );
1750 adjust->step_increment = val;
1751 l_pIncrement->shift[0] = val;
1754 static void on_vshift_step_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){
1756 GtkAdjustment * adjust;
1758 if ( !g_bListenChanged ) {
1762 l_pIncrement = Get_SI_Inc();
1765 Sys_Printf( "OnIncrementChanged VShift\n" );
1768 val = gtk_spin_button_get_value( GTK_SPIN_BUTTON( vshift_step_spinbutton ) ) ;
1769 adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( vshift_offset_spinbutton ) );
1770 adjust->step_increment = val;
1771 adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( vshift_value_spinbutton ) );
1772 adjust->step_increment = val;
1773 l_pIncrement->shift[1] = val;
1776 static void on_hscale_step_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){
1778 GtkAdjustment * adjust;
1780 if ( !g_bListenChanged ) {
1784 l_pIncrement = Get_SI_Inc();
1787 Sys_Printf( "OnIncrementChanged HShift\n" );
1790 val = gtk_spin_button_get_value( GTK_SPIN_BUTTON( hscale_step_spinbutton ) ) ;
1791 adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( hscale_offset_spinbutton ) );
1792 adjust->step_increment = val;
1793 adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( hscale_value_spinbutton ) );
1794 adjust->step_increment = val;
1795 l_pIncrement->scale[0] = val;
1798 static void on_vscale_step_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){
1800 GtkAdjustment * adjust;
1802 if ( !g_bListenChanged ) {
1806 l_pIncrement = Get_SI_Inc();
1809 Sys_Printf( "OnIncrementChanged HShift\n" );
1812 val = gtk_spin_button_get_value( GTK_SPIN_BUTTON( vscale_step_spinbutton ) ) ;
1813 adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( vscale_offset_spinbutton ) );
1814 adjust->step_increment = val;
1815 adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( vscale_value_spinbutton ) );
1816 adjust->step_increment = val;
1817 l_pIncrement->scale[1] = val;
1820 static void on_rotate_step_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){
1822 GtkAdjustment * adjust;
1824 if ( !g_bListenChanged ) {
1828 l_pIncrement = Get_SI_Inc();
1831 Sys_Printf( "OnIncrementChanged HShift\n" );
1834 val = gtk_spin_button_get_value( GTK_SPIN_BUTTON( rotate_step_spinbutton ) ) ;
1835 adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( rotate_offset_spinbutton ) );
1836 adjust->step_increment = val;
1837 adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( rotate_value_spinbutton ) );
1838 adjust->step_increment = val;
1839 l_pIncrement->rotate = val;
1844 static void on_fit_width_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){
1845 m_nWidth = gtk_spin_button_get_value_as_int( GTK_SPIN_BUTTON( fit_width_spinbutton ) );
1848 static void on_fit_height_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){
1849 m_nHeight = gtk_spin_button_get_value_as_int( GTK_SPIN_BUTTON( fit_height_spinbutton ) );
1852 static void on_fit_button_clicked( GtkButton *button, gpointer user_data ){
1853 FaceList_FitTexture( get_texdef_face_list(), m_nHeight, m_nWidth );
1854 Sys_UpdateWindows( W_ALL );
1859 static void on_axial_button_clicked( GtkButton *button, gpointer user_data ){
1860 texdef_t* tmp_texdef;
1861 texdef_to_face_t* temp_texdef_face_list;
1863 if ( !texdef_face_list_empty() && g_bListenChanged ) {
1864 for ( temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next )
1866 tmp_texdef = (texdef_t *) &temp_texdef_face_list->texdef;
1867 tmp_texdef->shift[0] = 0.0;
1868 tmp_texdef->shift[1] = 0.0;
1869 tmp_texdef->scale[0] = 0.5;
1870 tmp_texdef->scale[1] = 0.5;
1871 tmp_texdef->rotate = 0.0;
1875 SetTexdef_FaceList( get_texdef_face_list(), FALSE, TRUE );
1876 Sys_UpdateWindows( W_ALL );
1881 static void on_done_button_clicked( GtkButton *button, gpointer user_data ){
1882 if ( !texdef_face_list_empty() ) {
1886 Sys_UpdateWindows( W_ALL );
1889 static void on_apply_button_clicked( GtkButton *button, gpointer user_data ){
1890 if ( !g_bListenChanged ) {
1894 if ( !texdef_face_list_empty() ) {
1896 Sys_UpdateWindows( W_CAMERA );
1897 GetTexdefInfo_from_Radiant();
1902 static void on_cancel_button_clicked( GtkButton *button, gpointer user_data ){
1903 texturewin = Texturewin();
1904 texturewin->texdef = g_old_texdef;
1905 // cancel the last do if we own it
1906 if ( ( m_nUndoId == Undo_GetUndoId() ) && ( m_nUndoId != 0 ) ) {
1908 Sys_Printf( "OnCancel calling Undo_Undo\n" );
1910 g_bListenUpdate = false;
1912 g_bListenUpdate = true;