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;
223 char texture_name[128];
225 if ( texdef_face_list_empty() ) {
226 gtk_entry_set_text( GTK_ENTRY( hshift_value_spinbutton ), "" );
227 gtk_entry_set_text( GTK_ENTRY( vshift_value_spinbutton ), "" );
228 gtk_entry_set_text( GTK_ENTRY( hscale_value_spinbutton ), "" );
229 gtk_entry_set_text( GTK_ENTRY( vscale_value_spinbutton ), "" );
230 gtk_entry_set_text( GTK_ENTRY( rotate_value_spinbutton ), "" );
231 gtk_entry_set_text( GTK_ENTRY( texture_combo_entry ), "" );
235 g_bListenChanged = FALSE;
237 tmp_texdef = &get_texdef_face_list()->texdef;
239 strcpy( texture_name, tmp_texdef->GetName() );
241 texdef_SI_values.shift[0] = tmp_texdef->shift[0];
242 texdef_SI_values.shift[1] = tmp_texdef->shift[1];
243 texdef_SI_values.scale[0] = tmp_texdef->scale[0];
244 texdef_SI_values.scale[1] = tmp_texdef->scale[1];
245 texdef_SI_values.rotate = tmp_texdef->rotate;
246 texdef_SI_values.SetName( texture_name );
248 is_HShift_conflicting = FALSE;
249 is_VShift_conflicting = FALSE;
250 is_HScale_conflicting = FALSE;
251 is_VScale_conflicting = FALSE;
252 is_Rotate_conflicting = FALSE;
253 is_TextureName_conflicting = FALSE;
255 if ( texdef_face_list_size() > 1 ) {
256 temp_texdef_face_list = get_texdef_face_list()->next;
258 for (; temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next )
260 tmp_texdef = &temp_texdef_face_list->texdef;
261 if ( texdef_SI_values.shift[0] != tmp_texdef->shift[0] ) {
262 is_HShift_conflicting = TRUE;
265 if ( texdef_SI_values.shift[1] != tmp_texdef->shift[1] ) {
266 is_VShift_conflicting = TRUE;
269 if ( texdef_SI_values.scale[0] != tmp_texdef->scale[0] ) {
270 is_HScale_conflicting = TRUE;
273 if ( texdef_SI_values.scale[1] != tmp_texdef->scale[1] ) {
274 is_VScale_conflicting = TRUE;
277 if ( texdef_SI_values.rotate != tmp_texdef->rotate ) {
278 is_Rotate_conflicting = TRUE;
281 if ( strcmp( texture_name, tmp_texdef->GetName() ) ) {
282 is_TextureName_conflicting = TRUE;
287 if ( is_HShift_conflicting ) {
288 gtk_entry_set_text( GTK_ENTRY( hshift_value_spinbutton ), "" );
291 gtk_spin_button_set_value( GTK_SPIN_BUTTON( hshift_value_spinbutton ), texdef_SI_values.shift[0] );
294 if ( is_VShift_conflicting ) {
295 gtk_entry_set_text( GTK_ENTRY( vshift_value_spinbutton ), "" );
298 gtk_spin_button_set_value( GTK_SPIN_BUTTON( vshift_value_spinbutton ), texdef_SI_values.shift[1] );
301 if ( is_HScale_conflicting ) {
302 gtk_entry_set_text( GTK_ENTRY( hscale_value_spinbutton ), "" );
305 gtk_spin_button_set_value( GTK_SPIN_BUTTON( hscale_value_spinbutton ), texdef_SI_values.scale[0] );
308 if ( is_VScale_conflicting ) {
309 gtk_entry_set_text( GTK_ENTRY( vscale_value_spinbutton ), "" );
312 gtk_spin_button_set_value( GTK_SPIN_BUTTON( vscale_value_spinbutton ), texdef_SI_values.scale[1] );
315 if ( is_Rotate_conflicting ) {
316 gtk_entry_set_text( GTK_ENTRY( rotate_value_spinbutton ), "" );
319 gtk_spin_button_set_value( GTK_SPIN_BUTTON( rotate_value_spinbutton ), texdef_SI_values.rotate );
322 g_bListenChanged = TRUE;
325 #define MAX_NUM_LIST_ITEMS 15
326 static void PopulateTextureComboList(){
327 texdef_t* tmp_texdef;
328 texdef_to_face_t* temp_texdef_face_list;
332 int num_of_list_items = 0;
336 if ( texdef_face_list_empty() ) {
337 items = g_list_append( items, (gpointer) blank );
338 // For Texture Entry, activate only on entry change
339 strcpy( old_texture_entry, blank );
341 else if ( !is_TextureName_conflicting ) {
342 temp_texdef_face_list = get_texdef_face_list();
343 tmp_texdef = (texdef_t *) &get_texdef_face_list()->texdef;
344 items = g_list_append( items, (gpointer) tmp_texdef->GetName() );
345 // For Texture Entry, activate only on entry change
346 strcpy( old_texture_entry, tmp_texdef->GetName() );
350 for ( temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next )
352 tmp_texdef = (texdef_t *) &temp_texdef_face_list->texdef;
353 // Need to do a string compare, hence the custom search
354 if ( !( g_list_find_custom( items, tmp_texdef->GetName(), (GCompareFunc) strcmp ) ) ) {
355 items = g_list_append( items, (gpointer) tmp_texdef->GetName() );
358 // Make sure the combo list isn't too long
359 if ( num_of_list_items >= MAX_NUM_LIST_ITEMS ) {
363 // If this isn't added last (to the top of the list), g_list_find freaks.
364 items = g_list_prepend( items, (gpointer) blank );
365 // For Texture Entry, activate only on entry change
366 strcpy( old_texture_entry, blank );
369 gtk_combo_set_popdown_strings( GTK_COMBO( texture_combo ), items );
370 g_list_free( items );
374 static void ZeroOffsetValues(){
375 texdef_offset.shift[0] = 0.0;
376 texdef_offset.shift[1] = 0.0;
377 texdef_offset.scale[0] = 0.0;
378 texdef_offset.scale[1] = 0.0;
379 texdef_offset.rotate = 0.0;
382 static void GetTexdefInfo_from_Radiant(){
383 g_texdef_face_vector.clear();
385 unsigned int count = GetSelectedFaceCountfromBrushes();
387 count = GetSelectedFaceCount();
390 g_texdef_face_vector.resize( count );
392 if ( !texdef_face_list_empty() ) {
393 texdef_to_face_t* p = get_texdef_face_list();
394 GetSelFacesTexdef( get_texdef_face_list() );
398 PopulateTextureComboList();
400 if ( texdef_face_list_empty() ) {
401 SetFlagButtons_Heretic2( get_texdef_face_list(), TRUE );
404 SetFlagButtons_Heretic2( get_texdef_face_list(), FALSE );
409 static gint delete_event_callback( GtkWidget *widget, GdkEvent* event, gpointer data ){
414 // make the shift increments match the grid settings
415 // the objective being that the shift+arrows shortcuts move the texture by the corresponding grid size
416 // this depends on a scale value if you have selected a particular texture on which you want it to work:
417 // we move the textures in pixels, not world units. (i.e. increment values are in pixel)
418 // depending on the texture scale it doesn't take the same amount of pixels to move of g_qeglobals.d_gridsize
419 // increment * scale = gridsize
420 // hscale and vscale are optional parameters, if they are zero they will be set to the default scale
421 // NOTE: the default scale depends if you are using BP mode or regular.
422 // For regular it's 0.5f (128 pixels cover 64 world units), for BP it's simply 1.0f
424 void DoSnapTToGrid( float hscale, float vscale ){
425 l_pIncrement = Get_SI_Inc();
427 if ( hscale == 0.0f ) {
430 if ( vscale == 0.0f ) {
434 Sys_Printf( "DoSnapTToGrid: hscale %g vscale %g\n", hscale, vscale );
436 l_pIncrement->shift[0] = GridSize() / hscale;
437 l_pIncrement->shift[1] = GridSize() / vscale;
438 // now some update work
439 // FIXME: doesn't look good here, seems to be called several times
443 void UpdateSurfaceDialog(){
444 if ( !g_bListenUpdate ) {
448 if ( !SurfaceInspector ) {
452 // avoid long delays on slow computers
453 while ( gtk_events_pending() )
454 gtk_main_iteration();
458 Sys_Printf( "UpdateSurfaceDialog\n" );
460 GetTexdefInfo_from_Radiant();
466 // DoSurface will always try to show the surface inspector
467 // or update it because something new has been selected
468 void DoSurface( void ){
470 Sys_Printf( "DoSurface\n" );
472 if ( !SurfaceInspector ) {
473 create_SurfaceInspector();
480 void ToggleSurface(){
482 Sys_Printf( "ToggleSurface Module\n" );
488 on_cancel_button_clicked( NULL, NULL );
492 // NOTE: will raise and show the Surface inspector and exec fit for patches and brushes
493 void SurfaceDlgFitAll(){
498 // =============================================================================
499 // SurfaceDialog class
503 if ( !SurfaceInspector ) {
504 create_SurfaceInspector();
507 gtk_widget_show( SurfaceInspector );
510 GetTexdefInfo_from_Radiant();
511 GetTexMods( TRUE ); // Set Initial Undo Point
517 gtk_widget_hide( SurfaceInspector );
521 // set default values for increments (shift scale and rot)
522 // this is called by the prefs code if can't find the values
523 void InitDefaultIncrement( texdef_t *tex ){
524 tex->SetName( "foo" );
527 tex->scale[0] = 0.25;
528 tex->scale[1] = 0.25;
533 if ( !SurfaceInspector ) {
534 create_SurfaceInspector();
542 Set the fields to the current texdef (i.e. map/texdef -> dialog widgets)
549 GtkAdjustment *adjust;
551 texturewin = Texturewin();
552 l_pIncrement = Get_SI_Inc();
555 Sys_Printf( "SurfaceDlg SetTexMods\n" );
562 pt = &texturewin->texdef;
564 g_bListenChanged = false;
566 if ( strncmp( pt->GetName(), "textures/", 9 ) != 0 ) {
567 texdef_offset.SetName( SHADER_NOT_FOUND );
571 spin = GTK_SPIN_BUTTON( hshift_offset_spinbutton );
572 gtk_spin_button_set_value( spin, texdef_offset.shift[0] );
573 adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) );
574 adjust->step_increment = l_pIncrement->shift[0];
575 gtk_spin_button_set_value( GTK_SPIN_BUTTON( hshift_step_spinbutton ), l_pIncrement->shift[0] );
577 spin = GTK_SPIN_BUTTON( hshift_value_spinbutton );
578 adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) );
579 adjust->step_increment = l_pIncrement->shift[0];
582 spin = GTK_SPIN_BUTTON( vshift_offset_spinbutton );
583 gtk_spin_button_set_value( spin, texdef_offset.shift[1] );
584 adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) );
585 adjust->step_increment = l_pIncrement->shift[1];
586 gtk_spin_button_set_value( GTK_SPIN_BUTTON( vshift_step_spinbutton ), l_pIncrement->shift[1] );
588 spin = GTK_SPIN_BUTTON( vshift_value_spinbutton );
589 adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) );
590 adjust->step_increment = l_pIncrement->shift[1];
593 spin = GTK_SPIN_BUTTON( hscale_offset_spinbutton );
594 gtk_spin_button_set_value( spin, texdef_offset.scale[0] );
595 adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) );
596 adjust->step_increment = l_pIncrement->scale[0];
597 gtk_spin_button_set_value( GTK_SPIN_BUTTON( hscale_step_spinbutton ), l_pIncrement->scale[0] );
599 spin = GTK_SPIN_BUTTON( hscale_value_spinbutton );
600 adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) );
601 adjust->step_increment = l_pIncrement->scale[0];
604 spin = GTK_SPIN_BUTTON( vscale_offset_spinbutton );
605 gtk_spin_button_set_value( spin, texdef_offset.scale[1] );
606 adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) );
607 adjust->step_increment = l_pIncrement->scale[1];
608 gtk_spin_button_set_value( GTK_SPIN_BUTTON( vscale_step_spinbutton ), l_pIncrement->scale[1] );
610 spin = GTK_SPIN_BUTTON( vscale_value_spinbutton );
611 adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) );
612 adjust->step_increment = l_pIncrement->scale[1];
615 spin = GTK_SPIN_BUTTON( rotate_offset_spinbutton );
616 gtk_spin_button_set_value( spin, texdef_offset.rotate );
617 adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) );
618 adjust->step_increment = l_pIncrement->rotate;
619 gtk_spin_button_set_value( GTK_SPIN_BUTTON( rotate_step_spinbutton ), l_pIncrement->rotate );
621 spin = GTK_SPIN_BUTTON( rotate_value_spinbutton );
622 adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) );
623 adjust->step_increment = l_pIncrement->rotate;
626 g_bListenChanged = true;
628 // store the current texdef as our escape route if user hits OnCancel
629 g_old_texdef = texturewin->texdef;
636 Shows any changes to the main Radiant windows
639 void GetTexMods( bool b_SetUndoPoint ){
642 Sys_Printf( "SurfaceDlg GetTexMods\n" );
645 if ( !texdef_face_list_empty() ) {
646 g_bListenUpdate = FALSE;
647 SetChangeInFlags_Face_Heretic2( get_texdef_face_list() );
648 SetTexdef_FaceList( get_texdef_face_list(), b_SetUndoPoint, false );
649 g_bListenUpdate = TRUE;
651 if ( b_SetUndoPoint ) {
652 m_nUndoId = Undo_GetUndoId();
658 on_fit_button_clicked( NULL, NULL );
662 ////////////////////////////////////////////////////////////////////
666 ////////////////////////////////////////////////////////////////////
668 GtkWidget* create_SurfaceInspector( void ){
671 GtkWidget *hseparator;
674 GtkWidget *viewport8;
675 GtkWidget *viewport9;
676 GtkWidget *viewport2;
677 GtkWidget *viewport7;
678 GtkWidget *viewport5;
679 GtkWidget *viewport6;
680 GtkWidget *viewport10;
687 GtkWidget *alignment1;
688 GtkWidget *alignment2;
689 GtkWidget *alignment3;
702 GtkWidget *hbuttonbox1;
704 SurfaceInspector = gtk_window_new( GTK_WINDOW_TOPLEVEL );
705 gtk_container_set_border_width( GTK_CONTAINER( SurfaceInspector ), 4 );
706 gtk_window_set_title( GTK_WINDOW( SurfaceInspector ), "Surface Inspector" );
708 SetWinPos_from_Prefs( SurfaceInspector );
710 viewport8 = gtk_viewport_new( NULL, NULL );
711 gtk_widget_show( viewport8 );
712 gtk_container_add( GTK_CONTAINER( SurfaceInspector ), viewport8 );
713 gtk_viewport_set_shadow_type( GTK_VIEWPORT( viewport8 ), GTK_SHADOW_NONE );
715 vbox7 = gtk_vbox_new( FALSE, 0 );
716 gtk_widget_show( vbox7 );
717 gtk_container_add( GTK_CONTAINER( viewport8 ), vbox7 );
719 viewport9 = gtk_viewport_new( NULL, NULL );
720 gtk_widget_show( viewport9 );
721 gtk_box_pack_start( GTK_BOX( vbox7 ), viewport9, FALSE, FALSE, 0 );
722 gtk_container_set_border_width( GTK_CONTAINER( viewport9 ), 2 );
723 gtk_viewport_set_shadow_type( GTK_VIEWPORT( viewport9 ), GTK_SHADOW_ETCHED_IN );
725 hbox1 = gtk_hbox_new( FALSE, 0 );
726 gtk_widget_show( hbox1 );
727 gtk_container_add( GTK_CONTAINER( viewport9 ), hbox1 );
728 gtk_container_set_border_width( GTK_CONTAINER( hbox1 ), 4 );
730 label = gtk_label_new( "Texture: " );
731 gtk_widget_show( label );
732 gtk_box_pack_start( GTK_BOX( hbox1 ), label, FALSE, FALSE, 0 );
733 gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 );
735 texture_combo = gtk_combo_new();
736 g_object_set_data( G_OBJECT( GTK_COMBO( texture_combo )->popwin ),
737 "KeepMeAround", texture_combo );
738 gtk_combo_disable_activate( (GtkCombo*) texture_combo );
739 gtk_widget_show( texture_combo );
740 gtk_box_pack_start( GTK_BOX( hbox1 ), texture_combo, TRUE, TRUE, 0 );
742 texture_combo_entry = GTK_COMBO( texture_combo )->entry;
743 gtk_widget_show( texture_combo_entry );
744 gtk_entry_set_max_length( GTK_ENTRY( texture_combo_entry ), 128 );
746 viewport2 = gtk_viewport_new( NULL, NULL );
747 gtk_widget_show( viewport2 );
748 gtk_box_pack_start( GTK_BOX( vbox7 ), viewport2, FALSE, TRUE, 0 );
749 gtk_container_set_border_width( GTK_CONTAINER( viewport2 ), 2 );
750 gtk_viewport_set_shadow_type( GTK_VIEWPORT( viewport2 ), GTK_SHADOW_ETCHED_IN );
752 table1 = gtk_table_new( 13, 4, FALSE );
753 gtk_widget_show( table1 );
754 gtk_container_add( GTK_CONTAINER( viewport2 ), table1 );
756 hseparator = gtk_hseparator_new();
757 gtk_widget_show( hseparator );
758 gtk_table_attach( GTK_TABLE( table1 ), hseparator, 1, 2, 1, 2,
759 (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
760 (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
762 hseparator = gtk_hseparator_new();
763 gtk_widget_show( hseparator );
764 gtk_table_attach( GTK_TABLE( table1 ), hseparator, 2, 3, 1, 2,
765 (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
766 (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
768 hseparator = gtk_hseparator_new();
769 gtk_widget_show( hseparator );
770 gtk_table_attach( GTK_TABLE( table1 ), hseparator, 3, 4, 1, 2,
771 (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
772 (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
774 hseparator = gtk_hseparator_new();
775 gtk_widget_show( hseparator );
776 gtk_table_attach( GTK_TABLE( table1 ), hseparator, 1, 2, 3, 4,
777 (GtkAttachOptions) ( GTK_FILL ),
778 (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
780 hseparator = gtk_hseparator_new();
781 gtk_widget_show( hseparator );
782 gtk_table_attach( GTK_TABLE( table1 ), hseparator, 2, 3, 3, 4,
783 (GtkAttachOptions) ( GTK_FILL ),
784 (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
786 hseparator = gtk_hseparator_new();
787 gtk_widget_show( hseparator );
788 gtk_table_attach( GTK_TABLE( table1 ), hseparator, 3, 4, 3, 4,
789 (GtkAttachOptions) ( GTK_FILL ),
790 (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
792 hseparator = gtk_hseparator_new();
793 gtk_widget_show( hseparator );
794 gtk_table_attach( GTK_TABLE( table1 ), hseparator, 1, 2, 5, 6,
795 (GtkAttachOptions) ( GTK_FILL ),
796 (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
798 hseparator = gtk_hseparator_new();
799 gtk_widget_show( hseparator );
800 gtk_table_attach( GTK_TABLE( table1 ), hseparator, 2, 3, 5, 6,
801 (GtkAttachOptions) ( GTK_FILL ),
802 (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
804 hseparator = gtk_hseparator_new();
805 gtk_widget_show( hseparator );
806 gtk_table_attach( GTK_TABLE( table1 ), hseparator, 3, 4, 5, 6,
807 (GtkAttachOptions) ( GTK_FILL ),
808 (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
810 hseparator = gtk_hseparator_new();
811 gtk_widget_show( hseparator );
812 gtk_table_attach( GTK_TABLE( table1 ), hseparator, 1, 2, 7, 8,
813 (GtkAttachOptions) ( GTK_FILL ),
814 (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
816 hseparator = gtk_hseparator_new();
817 gtk_widget_show( hseparator );
818 gtk_table_attach( GTK_TABLE( table1 ), hseparator, 2, 3, 7, 8,
819 (GtkAttachOptions) ( GTK_FILL ),
820 (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
822 hseparator = gtk_hseparator_new();
823 gtk_widget_show( hseparator );
824 gtk_table_attach( GTK_TABLE( table1 ), hseparator, 3, 4, 7, 8,
825 (GtkAttachOptions) ( GTK_FILL ),
826 (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
828 hseparator = gtk_hseparator_new();
829 gtk_widget_show( hseparator );
830 gtk_table_attach( GTK_TABLE( table1 ), hseparator, 1, 2, 9, 10,
831 (GtkAttachOptions) ( GTK_FILL ),
832 (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
834 hseparator = gtk_hseparator_new();
835 gtk_widget_show( hseparator );
836 gtk_table_attach( GTK_TABLE( table1 ), hseparator, 2, 3, 9, 10,
837 (GtkAttachOptions) ( GTK_FILL ),
838 (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
840 hseparator = gtk_hseparator_new();
841 gtk_widget_show( hseparator );
842 gtk_table_attach( GTK_TABLE( table1 ), hseparator, 3, 4, 9, 10,
843 (GtkAttachOptions) ( GTK_FILL ),
844 (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
846 hseparator = gtk_hseparator_new();
847 gtk_widget_show( hseparator );
848 gtk_table_attach( GTK_TABLE( table1 ), hseparator, 1, 2, 11, 12,
849 (GtkAttachOptions) ( GTK_FILL ),
850 (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
852 hseparator = gtk_hseparator_new();
853 gtk_widget_show( hseparator );
854 gtk_table_attach( GTK_TABLE( table1 ), hseparator, 2, 3, 11, 12,
855 (GtkAttachOptions) ( GTK_FILL ),
856 (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
858 hseparator = gtk_hseparator_new();
859 gtk_widget_show( hseparator );
860 gtk_table_attach( GTK_TABLE( table1 ), hseparator, 3, 4, 11, 12,
861 (GtkAttachOptions) ( GTK_FILL ),
862 (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
864 label = gtk_label_new( "Offset" );
865 gtk_widget_show( label );
866 gtk_table_attach( GTK_TABLE( table1 ), label, 2, 3, 0, 1,
867 (GtkAttachOptions) ( GTK_FILL ),
868 (GtkAttachOptions) ( 0 ), 0, 0 );
870 label = gtk_label_new( "Step" );
871 gtk_widget_show( label );
872 gtk_table_attach( GTK_TABLE( table1 ), label, 3, 4, 0, 1,
873 (GtkAttachOptions) ( GTK_FILL ),
874 (GtkAttachOptions) ( 0 ), 0, 0 );
876 eventbox = gtk_event_box_new();
877 gtk_widget_show( eventbox );
878 gtk_table_attach( GTK_TABLE( table1 ), eventbox, 3, 4, 12, 13,
879 (GtkAttachOptions) ( GTK_FILL ),
880 (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
882 match_grid_button = gtk_button_new_with_mnemonic( "Match Grid" );
883 gtk_widget_show( match_grid_button );
884 gtk_container_add( GTK_CONTAINER( eventbox ), match_grid_button );
886 label = gtk_label_new( "Value" );
887 gtk_widget_show( label );
888 gtk_table_attach( GTK_TABLE( table1 ), label, 1, 2, 0, 1,
889 (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
890 (GtkAttachOptions) ( 0 ), 0, 0 );
891 gtk_misc_set_alignment( GTK_MISC( label ), 0.5, 1 );
893 hseparator = gtk_hseparator_new();
894 gtk_widget_show( hseparator );
895 gtk_table_attach( GTK_TABLE( table1 ), hseparator, 0, 1, 3, 4,
896 (GtkAttachOptions) ( GTK_SHRINK | GTK_FILL ),
897 (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
899 hseparator = gtk_hseparator_new();
900 gtk_widget_show( hseparator );
901 gtk_table_attach( GTK_TABLE( table1 ), hseparator, 0, 1, 5, 6,
902 (GtkAttachOptions) ( GTK_FILL ),
903 (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
905 hseparator = gtk_hseparator_new();
906 gtk_widget_show( hseparator );
907 gtk_table_attach( GTK_TABLE( table1 ), hseparator, 0, 1, 7, 8,
908 (GtkAttachOptions) ( GTK_FILL ),
909 (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
911 hseparator = gtk_hseparator_new();
912 gtk_widget_show( hseparator );
913 gtk_table_attach( GTK_TABLE( table1 ), hseparator, 0, 1, 9, 10,
914 (GtkAttachOptions) ( GTK_FILL ),
915 (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
917 hseparator = gtk_hseparator_new();
918 gtk_widget_show( hseparator );
919 gtk_table_attach( GTK_TABLE( table1 ), hseparator, 0, 1, 11, 12,
920 (GtkAttachOptions) ( GTK_FILL ),
921 (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
923 eventbox = gtk_event_box_new();
924 gtk_widget_show( eventbox );
925 gtk_table_attach( GTK_TABLE( table1 ), eventbox, 0, 1, 4, 5,
926 (GtkAttachOptions) ( GTK_FILL ),
927 (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
929 label = gtk_label_new( "V Shift: " );
930 gtk_widget_show( label );
931 gtk_container_add( GTK_CONTAINER( eventbox ), label );
932 gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT );
933 gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 );
935 eventbox = gtk_event_box_new();
936 gtk_widget_show( eventbox );
937 gtk_table_attach( GTK_TABLE( table1 ), eventbox, 0, 1, 6, 7,
938 (GtkAttachOptions) ( GTK_FILL ),
939 (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
941 label = gtk_label_new( " H Scale: " );
942 gtk_widget_show( label );
943 gtk_container_add( GTK_CONTAINER( eventbox ), label );
944 gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT );
945 gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 );
947 eventbox = gtk_event_box_new();
948 gtk_widget_show( eventbox );
949 gtk_table_attach( GTK_TABLE( table1 ), eventbox, 0, 1, 8, 9,
950 (GtkAttachOptions) ( GTK_FILL ),
951 (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
953 label = gtk_label_new( "V Scale: " );
954 gtk_widget_show( label );
955 gtk_container_add( GTK_CONTAINER( eventbox ), label );
956 gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT );
957 gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 );
959 eventbox = gtk_event_box_new();
960 gtk_widget_show( eventbox );
961 gtk_table_attach( GTK_TABLE( table1 ), eventbox, 0, 1, 10, 11,
962 (GtkAttachOptions) ( GTK_FILL ),
963 (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
965 label = gtk_label_new( "Rotate: " );
966 gtk_widget_show( label );
967 gtk_container_add( GTK_CONTAINER( eventbox ), label );
968 gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT );
969 gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 );
971 eventbox = gtk_event_box_new();
972 gtk_widget_show( eventbox );
973 gtk_table_attach( GTK_TABLE( table1 ), eventbox, 0, 1, 2, 3,
974 (GtkAttachOptions) ( GTK_FILL ),
975 (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
977 label = gtk_label_new( "H Shift: " );
978 gtk_widget_show( label );
979 gtk_container_add( GTK_CONTAINER( eventbox ), label );
980 gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT );
981 gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 );
983 hseparator = gtk_hseparator_new();
984 gtk_widget_show( hseparator );
985 gtk_table_attach( GTK_TABLE( table1 ), hseparator, 0, 1, 1, 2,
986 (GtkAttachOptions) ( GTK_FILL ),
987 (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
989 eventbox = gtk_event_box_new();
990 gtk_widget_show( eventbox );
991 gtk_table_attach( GTK_TABLE( table1 ), eventbox, 1, 2, 12, 13,
992 (GtkAttachOptions) ( GTK_FILL ),
993 (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
995 lock_valuechange_togglebutton = gtk_toggle_button_new_with_mnemonic( "UNLOCK" );
996 gtk_widget_show( lock_valuechange_togglebutton );
997 gtk_container_add( GTK_CONTAINER( eventbox ), lock_valuechange_togglebutton );
1000 hshift_value_spinbutton_adj = gtk_adjustment_new( 0.0, -8192.0, 8192.0, 2.0, 8.0, 8.0 );
1001 hshift_value_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( hshift_value_spinbutton_adj ), 1, 2 );
1002 gtk_widget_show( hshift_value_spinbutton );
1003 gtk_table_attach( GTK_TABLE( table1 ), hshift_value_spinbutton, 1, 2, 2, 3,
1004 (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
1005 (GtkAttachOptions) ( 0 ), 0, 0 );
1006 gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( hshift_value_spinbutton ), GTK_UPDATE_IF_VALID );
1007 gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( hshift_value_spinbutton ), TRUE );
1008 gtk_widget_set_sensitive( GTK_WIDGET( hshift_value_spinbutton ), FALSE );
1010 vshift_value_spinbutton_adj = gtk_adjustment_new( 0.0, -8192.0, 8192.0, 2.0, 8.0, 8.0 );
1011 vshift_value_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( vshift_value_spinbutton_adj ), 1, 2 );
1012 gtk_widget_show( vshift_value_spinbutton );
1013 gtk_table_attach( GTK_TABLE( table1 ), vshift_value_spinbutton, 1, 2, 4, 5,
1014 (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
1015 (GtkAttachOptions) ( 0 ), 0, 0 );
1016 gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( vshift_value_spinbutton ), GTK_UPDATE_IF_VALID );
1017 gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( vshift_value_spinbutton ), TRUE );
1018 gtk_widget_set_sensitive( GTK_WIDGET( vshift_value_spinbutton ), FALSE );
1020 hscale_value_spinbutton_adj = gtk_adjustment_new( 0.0, -1024.0, 1024.0, 1.0, 4.0, 4.0 );
1021 hscale_value_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( hscale_value_spinbutton_adj ), 1, 4 );
1022 gtk_widget_show( hscale_value_spinbutton );
1023 gtk_table_attach( GTK_TABLE( table1 ), hscale_value_spinbutton, 1, 2, 6, 7,
1024 (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
1025 (GtkAttachOptions) ( 0 ), 0, 0 );
1026 gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( hscale_value_spinbutton ), GTK_UPDATE_IF_VALID );
1027 gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( hscale_value_spinbutton ), TRUE );
1028 gtk_widget_set_sensitive( GTK_WIDGET( hscale_value_spinbutton ), FALSE );
1030 vscale_value_spinbutton_adj = gtk_adjustment_new( 0.0, -1024.0, 1024.0, 1.0, 4.0, 4.0 );
1031 vscale_value_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( vscale_value_spinbutton_adj ), 1, 4 );
1032 gtk_widget_show( vscale_value_spinbutton );
1033 gtk_table_attach( GTK_TABLE( table1 ), vscale_value_spinbutton, 1, 2, 8, 9,
1034 (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
1035 (GtkAttachOptions) ( 0 ), 0, 0 );
1036 gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( vscale_value_spinbutton ), GTK_UPDATE_IF_VALID );
1037 gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( vscale_value_spinbutton ), TRUE );
1038 gtk_widget_set_sensitive( GTK_WIDGET( vscale_value_spinbutton ), FALSE );
1040 rotate_value_spinbutton_adj = gtk_adjustment_new( 0.0, -360.0, 360.0, 1.0, 10.0, 10.0 );
1041 rotate_value_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( rotate_value_spinbutton_adj ), 1, 0 );
1042 gtk_widget_show( rotate_value_spinbutton );
1043 gtk_table_attach( GTK_TABLE( table1 ), rotate_value_spinbutton, 1, 2, 10, 11,
1044 (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
1045 (GtkAttachOptions) ( 0 ), 0, 0 );
1046 gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( rotate_value_spinbutton ), GTK_UPDATE_IF_VALID );
1047 gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( rotate_value_spinbutton ), TRUE );
1048 gtk_widget_set_sensitive( GTK_WIDGET( rotate_value_spinbutton ), FALSE );
1051 hshift_offset_spinbutton_adj = gtk_adjustment_new( 0.0, -8192.0, 8192.0, 2.0, 8.0, 8.0 );
1052 hshift_offset_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( hshift_offset_spinbutton_adj ), 0, 2 );
1053 gtk_widget_show( hshift_offset_spinbutton );
1054 gtk_table_attach( GTK_TABLE( table1 ), hshift_offset_spinbutton, 2, 3, 2, 3,
1055 (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
1056 (GtkAttachOptions) ( 0 ), 4, 0 );
1057 gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( hshift_offset_spinbutton ), TRUE );
1058 gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( hshift_offset_spinbutton ), GTK_UPDATE_IF_VALID );
1059 gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( hshift_offset_spinbutton ), TRUE );
1061 vshift_offset_spinbutton_adj = gtk_adjustment_new( 0.0, -8192.0, 8192.0, 2.0, 8.0, 8.0 );
1062 vshift_offset_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( vshift_offset_spinbutton_adj ), 0, 2 );
1063 gtk_widget_show( vshift_offset_spinbutton );
1064 gtk_table_attach( GTK_TABLE( table1 ), vshift_offset_spinbutton, 2, 3, 4, 5,
1065 (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
1066 (GtkAttachOptions) ( 0 ), 4, 0 );
1067 gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( vshift_offset_spinbutton ), TRUE );
1068 gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( vshift_offset_spinbutton ), GTK_UPDATE_IF_VALID );
1069 gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( vshift_offset_spinbutton ), TRUE );
1071 hscale_offset_spinbutton_adj = gtk_adjustment_new( 0.0, -1024.0, 1024.0, 1.0, 4.0, 4.0 );
1072 hscale_offset_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( hscale_offset_spinbutton_adj ), 0, 4 );
1073 gtk_widget_show( hscale_offset_spinbutton );
1074 gtk_table_attach( GTK_TABLE( table1 ), hscale_offset_spinbutton, 2, 3, 6, 7,
1075 (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
1076 (GtkAttachOptions) ( 0 ), 4, 0 );
1077 gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( hscale_offset_spinbutton ), TRUE );
1078 gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( hscale_offset_spinbutton ), GTK_UPDATE_IF_VALID );
1079 gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( hscale_offset_spinbutton ), TRUE );
1081 vscale_offset_spinbutton_adj = gtk_adjustment_new( 0.0, -1024.0, 1024.0, 1.0, 4.0, 4.0 );
1082 vscale_offset_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( vscale_offset_spinbutton_adj ), 0, 4 );
1083 gtk_widget_show( vscale_offset_spinbutton );
1084 gtk_table_attach( GTK_TABLE( table1 ), vscale_offset_spinbutton, 2, 3, 8, 9,
1085 (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
1086 (GtkAttachOptions) ( 0 ), 4, 0 );
1087 gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( vscale_offset_spinbutton ), TRUE );
1088 gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( vscale_offset_spinbutton ), GTK_UPDATE_IF_VALID );
1089 gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( vscale_offset_spinbutton ), TRUE );
1091 rotate_offset_spinbutton_adj = gtk_adjustment_new( 0.0, -360.0, 360.0, 1.0, 10.0, 10.0 );
1092 rotate_offset_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( rotate_offset_spinbutton_adj ), 0, 2 );
1093 gtk_widget_show( rotate_offset_spinbutton );
1094 gtk_table_attach( GTK_TABLE( table1 ), rotate_offset_spinbutton, 2, 3, 10, 11,
1095 (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
1096 (GtkAttachOptions) ( 0 ), 4, 0 );
1097 gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( rotate_offset_spinbutton ), TRUE );
1098 gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( rotate_offset_spinbutton ), GTK_UPDATE_IF_VALID );
1099 gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( rotate_offset_spinbutton ), TRUE );
1102 hshift_step_spinbutton_adj = gtk_adjustment_new( 0.0, -8192.0, 8192.0, 2.0, 8.0, 8.0 );
1103 hshift_step_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( hshift_step_spinbutton_adj ), 1, 2 );
1104 gtk_widget_show( hshift_step_spinbutton );
1105 gtk_table_attach( GTK_TABLE( table1 ), hshift_step_spinbutton, 3, 4, 2, 3,
1106 (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
1107 (GtkAttachOptions) ( 0 ), 0, 0 );
1108 gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( hshift_step_spinbutton ), GTK_UPDATE_IF_VALID );
1110 vshift_step_spinbutton_adj = gtk_adjustment_new( 0.0, -8192.0, 8192.0, 2.0, 8.0, 8.0 );
1111 vshift_step_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( vshift_step_spinbutton_adj ), 1, 2 );
1112 gtk_widget_show( vshift_step_spinbutton );
1113 gtk_table_attach( GTK_TABLE( table1 ), vshift_step_spinbutton, 3, 4, 4, 5,
1114 (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
1115 (GtkAttachOptions) ( 0 ), 0, 0 );
1116 gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( vshift_step_spinbutton ), GTK_UPDATE_IF_VALID );
1118 hscale_step_spinbutton_adj = gtk_adjustment_new( 0.0, -1024.0, 1024.0, 1.0, 4.0, 4.0 );
1119 hscale_step_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( hscale_step_spinbutton_adj ), 1, 4 );
1120 gtk_widget_show( hscale_step_spinbutton );
1121 gtk_table_attach( GTK_TABLE( table1 ), hscale_step_spinbutton, 3, 4, 6, 7,
1122 (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
1123 (GtkAttachOptions) ( 0 ), 0, 0 );
1124 gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( hscale_step_spinbutton ), GTK_UPDATE_IF_VALID );
1126 vscale_step_spinbutton_adj = gtk_adjustment_new( 0.0, -1024.0, 1024.0, 1.0, 4.0, 4.0 );
1127 vscale_step_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( vscale_step_spinbutton_adj ), 1, 4 );
1128 gtk_widget_show( vscale_step_spinbutton );
1129 gtk_table_attach( GTK_TABLE( table1 ), vscale_step_spinbutton, 3, 4, 8, 9,
1130 (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
1131 (GtkAttachOptions) ( 0 ), 0, 0 );
1132 gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( vscale_step_spinbutton ), GTK_UPDATE_IF_VALID );
1134 rotate_step_spinbutton_adj = gtk_adjustment_new( 0.0, -360.0, 360.0, 1.0, 10.0, 10.0 );
1135 rotate_step_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( rotate_step_spinbutton_adj ), 1, 2 );
1136 gtk_widget_show( rotate_step_spinbutton );
1137 gtk_table_attach( GTK_TABLE( table1 ), rotate_step_spinbutton, 3, 4, 10, 11,
1138 (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
1139 (GtkAttachOptions) ( 0 ), 0, 0 );
1140 gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( rotate_step_spinbutton ), GTK_UPDATE_IF_VALID );
1142 eventbox = gtk_event_box_new();
1143 gtk_widget_show( eventbox );
1144 gtk_table_attach( GTK_TABLE( table1 ), eventbox, 2, 3, 12, 13,
1145 (GtkAttachOptions) ( 0 ),
1146 (GtkAttachOptions) ( 0 ), 0, 0 );
1148 eventbox = gtk_event_box_new();
1149 gtk_widget_show( eventbox );
1150 gtk_table_attach( GTK_TABLE( table1 ), eventbox, 0, 1, 12, 13,
1151 (GtkAttachOptions) ( 0 ),
1152 (GtkAttachOptions) ( 0 ), 0, 0 );
1154 eventbox = gtk_event_box_new();
1155 gtk_widget_show( eventbox );
1156 gtk_table_attach( GTK_TABLE( table1 ), eventbox, 0, 1, 0, 1,
1157 (GtkAttachOptions) ( 0 ),
1158 (GtkAttachOptions) ( 0 ), 0, 0 );
1160 viewport7 = gtk_viewport_new( NULL, NULL );
1161 gtk_widget_show( viewport7 );
1162 gtk_box_pack_start( GTK_BOX( vbox7 ), viewport7, FALSE, TRUE, 0 );
1163 gtk_container_set_border_width( GTK_CONTAINER( viewport7 ), 2 );
1164 gtk_viewport_set_shadow_type( GTK_VIEWPORT( viewport7 ), GTK_SHADOW_ETCHED_IN );
1166 table4 = gtk_table_new( 4, 7, FALSE );
1167 gtk_widget_show( table4 );
1168 gtk_container_add( GTK_CONTAINER( viewport7 ), table4 );
1170 viewport5 = gtk_viewport_new( NULL, NULL );
1171 gtk_widget_show( viewport5 );
1172 gtk_table_attach( GTK_TABLE( table4 ), viewport5, 1, 7, 0, 4,
1173 (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
1174 (GtkAttachOptions) ( 0 ), 0, 0 );
1175 gtk_container_set_border_width( GTK_CONTAINER( viewport5 ), 6 );
1176 gtk_viewport_set_shadow_type( GTK_VIEWPORT( viewport5 ), GTK_SHADOW_ETCHED_OUT );
1178 table5 = gtk_table_new( 2, 3, FALSE );
1179 gtk_widget_show( table5 );
1180 gtk_container_add( GTK_CONTAINER( viewport5 ), table5 );
1181 gtk_container_set_border_width( GTK_CONTAINER( table5 ), 5 );
1182 gtk_table_set_col_spacings( GTK_TABLE( table5 ), 2 );
1184 label = gtk_label_new( "Height" );
1185 gtk_widget_show( label );
1186 gtk_table_attach( GTK_TABLE( table5 ), label, 2, 3, 0, 1,
1187 (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
1188 (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
1189 gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT );
1190 gtk_misc_set_alignment( GTK_MISC( label ), 0.5, 1 );
1192 label = gtk_label_new( "Width" );
1193 gtk_widget_show( label );
1194 gtk_table_attach( GTK_TABLE( table5 ), label, 1, 2, 0, 1,
1195 (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
1196 (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
1197 gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT );
1198 gtk_misc_set_alignment( GTK_MISC( label ), 0.5, 1 );
1200 fit_width_spinbutton_adj = gtk_adjustment_new( 1, 1, 32, 1, 10, 10 );
1201 fit_width_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( fit_width_spinbutton_adj ), 1, 0 );
1202 gtk_widget_show( fit_width_spinbutton );
1203 gtk_table_attach( GTK_TABLE( table5 ), fit_width_spinbutton, 1, 2, 1, 2,
1204 (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
1205 (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
1206 gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( fit_width_spinbutton ), TRUE );
1207 gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( fit_width_spinbutton ), GTK_UPDATE_IF_VALID );
1209 fit_height_spinbutton_adj = gtk_adjustment_new( 1, 1, 32, 1, 10, 10 );
1210 fit_height_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( fit_height_spinbutton_adj ), 1, 0 );
1211 gtk_widget_show( fit_height_spinbutton );
1212 gtk_table_attach( GTK_TABLE( table5 ), fit_height_spinbutton, 2, 3, 1, 2,
1213 (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
1214 (GtkAttachOptions) ( GTK_FILL ), 3, 0 );
1215 gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( fit_height_spinbutton ), TRUE );
1216 gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( fit_height_spinbutton ), GTK_UPDATE_IF_VALID );
1218 eventbox = gtk_event_box_new();
1219 gtk_widget_show( eventbox );
1220 gtk_table_attach( GTK_TABLE( table5 ), eventbox, 0, 1, 0, 1,
1221 (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
1222 (GtkAttachOptions) ( GTK_FILL ), 0, 0 );
1224 eventbox = gtk_event_box_new();
1225 gtk_widget_show( eventbox );
1226 gtk_table_attach( GTK_TABLE( table5 ), eventbox, 0, 1, 1, 2,
1227 (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
1228 (GtkAttachOptions) ( GTK_FILL ), 4, 0 );
1230 fit_button = gtk_button_new_with_mnemonic( " Fit " );
1231 gtk_widget_show( fit_button );
1232 gtk_container_add( GTK_CONTAINER( eventbox ), fit_button );
1234 viewport6 = gtk_viewport_new( NULL, NULL );
1235 gtk_widget_show( viewport6 );
1236 gtk_table_attach( GTK_TABLE( table4 ), viewport6, 0, 1, 0, 4,
1237 (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
1238 (GtkAttachOptions) ( 0 ), 0, 0 );
1239 gtk_container_set_border_width( GTK_CONTAINER( viewport6 ), 4 );
1240 gtk_viewport_set_shadow_type( GTK_VIEWPORT( viewport6 ), GTK_SHADOW_NONE );
1242 table7 = gtk_table_new( 2, 1, FALSE );
1243 gtk_widget_show( table7 );
1244 gtk_container_add( GTK_CONTAINER( viewport6 ), table7 );
1246 eventbox = gtk_event_box_new();
1247 gtk_widget_show( eventbox );
1248 gtk_table_attach( GTK_TABLE( table7 ), eventbox, 0, 1, 0, 2,
1249 (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ),
1250 (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 );
1252 axial_button = gtk_button_new_with_mnemonic( "Axial" );
1253 gtk_widget_show( axial_button );
1254 gtk_container_add( GTK_CONTAINER( eventbox ), axial_button );
1255 gtk_widget_set_size_request( axial_button, 56, 29 );
1256 gtk_container_set_border_width( GTK_CONTAINER( axial_button ), 4 );
1258 // Fit in Flags sub-dialog
1259 Create_Heretic2FlagsDialog( vbox7 );
1261 viewport10 = gtk_viewport_new( NULL, NULL );
1262 gtk_widget_show( viewport10 );
1263 gtk_box_pack_start( GTK_BOX( vbox7 ), viewport10, FALSE, TRUE, 0 );
1264 gtk_container_set_border_width( GTK_CONTAINER( viewport10 ), 2 );
1265 gtk_viewport_set_shadow_type( GTK_VIEWPORT( viewport10 ), GTK_SHADOW_ETCHED_IN );
1267 hbuttonbox1 = gtk_hbutton_box_new();
1268 gtk_widget_show( hbuttonbox1 );
1269 gtk_container_add( GTK_CONTAINER( viewport10 ), hbuttonbox1 );
1270 gtk_container_set_border_width( GTK_CONTAINER( hbuttonbox1 ), 4 );
1271 gtk_button_box_set_layout( GTK_BUTTON_BOX( hbuttonbox1 ), GTK_BUTTONBOX_SPREAD );
1273 done_button = gtk_button_new();
1274 gtk_widget_show( done_button );
1275 gtk_container_add( GTK_CONTAINER( hbuttonbox1 ), done_button );
1276 GTK_WIDGET_SET_FLAGS( done_button, GTK_CAN_DEFAULT );
1278 alignment1 = gtk_alignment_new( 0.5, 0.5, 0, 0 );
1279 gtk_widget_show( alignment1 );
1280 gtk_container_add( GTK_CONTAINER( done_button ), alignment1 );
1282 hbox2 = gtk_hbox_new( FALSE, 2 );
1283 gtk_widget_show( hbox2 );
1284 gtk_container_add( GTK_CONTAINER( alignment1 ), hbox2 );
1286 image1 = gtk_image_new_from_stock( "gtk-yes", GTK_ICON_SIZE_BUTTON );
1287 gtk_widget_show( image1 );
1288 gtk_box_pack_start( GTK_BOX( hbox2 ), image1, FALSE, FALSE, 0 );
1290 label = gtk_label_new_with_mnemonic( "Done" );
1291 gtk_widget_show( label );
1292 gtk_box_pack_start( GTK_BOX( hbox2 ), label, FALSE, FALSE, 0 );
1293 gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT );
1295 apply_button = gtk_button_new();
1296 gtk_widget_show( apply_button );
1297 gtk_container_add( GTK_CONTAINER( hbuttonbox1 ), apply_button );
1298 GTK_WIDGET_SET_FLAGS( apply_button, GTK_CAN_DEFAULT );
1300 alignment3 = gtk_alignment_new( 0.5, 0.5, 0, 0 );
1301 gtk_widget_show( alignment3 );
1302 gtk_container_add( GTK_CONTAINER( apply_button ), alignment3 );
1304 hbox4 = gtk_hbox_new( FALSE, 2 );
1305 gtk_widget_show( hbox4 );
1306 gtk_container_add( GTK_CONTAINER( alignment3 ), hbox4 );
1308 image3 = gtk_image_new_from_stock( "gtk-apply", GTK_ICON_SIZE_BUTTON );
1309 gtk_widget_show( image3 );
1310 gtk_box_pack_start( GTK_BOX( hbox4 ), image3, FALSE, FALSE, 0 );
1312 label = gtk_label_new_with_mnemonic( "Apply" );
1313 gtk_widget_show( label );
1314 gtk_box_pack_start( GTK_BOX( hbox4 ), label, FALSE, FALSE, 0 );
1315 gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT );
1317 cancel_button = gtk_button_new();
1318 gtk_widget_show( cancel_button );
1319 gtk_container_add( GTK_CONTAINER( hbuttonbox1 ), cancel_button );
1320 GTK_WIDGET_SET_FLAGS( cancel_button, GTK_CAN_DEFAULT );
1322 alignment2 = gtk_alignment_new( 0.5, 0.5, 0, 0 );
1323 gtk_widget_show( alignment2 );
1324 gtk_container_add( GTK_CONTAINER( cancel_button ), alignment2 );
1326 hbox3 = gtk_hbox_new( FALSE, 2 );
1327 gtk_widget_show( hbox3 );
1328 gtk_container_add( GTK_CONTAINER( alignment2 ), hbox3 );
1330 image2 = gtk_image_new_from_stock( "gtk-no", GTK_ICON_SIZE_BUTTON );
1331 gtk_widget_show( image2 );
1332 gtk_box_pack_start( GTK_BOX( hbox3 ), image2, FALSE, FALSE, 0 );
1334 label = gtk_label_new_with_mnemonic( "Cancel" );
1335 gtk_widget_show( label );
1336 gtk_box_pack_start( GTK_BOX( hbox3 ), label, FALSE, FALSE, 0 );
1337 gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT );
1340 g_signal_connect( (gpointer) SurfaceInspector,
1342 G_CALLBACK( delete_event_callback ),
1344 g_signal_connect( (gpointer) SurfaceInspector, "destroy",
1345 G_CALLBACK( gtk_widget_destroy ),
1348 g_signal_connect( (gpointer) texture_combo_entry, "key_press_event",
1349 G_CALLBACK( on_texture_combo_entry_key_press_event ),
1351 g_signal_connect( (gpointer) texture_combo_entry, "activate",
1352 G_CALLBACK( on_texture_combo_entry_activate ),
1356 g_signal_connect( (gpointer) hshift_offset_spinbutton, "value_changed",
1357 G_CALLBACK( on_hshift_offset_spinbutton_value_changed ),
1359 g_signal_connect( (gpointer) vshift_offset_spinbutton, "value_changed",
1360 G_CALLBACK( on_vshift_offset_spinbutton_value_changed ),
1362 g_signal_connect( (gpointer) hscale_offset_spinbutton, "value_changed",
1363 G_CALLBACK( on_hscale_offset_spinbutton_value_changed ),
1365 g_signal_connect( (gpointer) vscale_offset_spinbutton, "value_changed",
1366 G_CALLBACK( on_vscale_offset_spinbutton_value_changed ),
1368 g_signal_connect( (gpointer) rotate_offset_spinbutton, "value_changed",
1369 G_CALLBACK( on_rotate_offset_spinbutton_value_changed ),
1372 g_signal_connect( (gpointer) hshift_value_spinbutton, "value_changed",
1373 G_CALLBACK( on_hshift_value_spinbutton_value_changed ),
1375 g_signal_connect( (gpointer) vshift_value_spinbutton, "value_changed",
1376 G_CALLBACK( on_vshift_value_spinbutton_value_changed ),
1378 g_signal_connect( (gpointer) hscale_value_spinbutton, "value_changed",
1379 G_CALLBACK( on_hscale_value_spinbutton_value_changed ),
1381 g_signal_connect( (gpointer) vscale_value_spinbutton, "value_changed",
1382 G_CALLBACK( on_vscale_value_spinbutton_value_changed ),
1384 g_signal_connect( (gpointer) rotate_value_spinbutton, "value_changed",
1385 G_CALLBACK( on_rotate_value_spinbutton_value_changed ),
1388 g_signal_connect( (gpointer) hshift_step_spinbutton, "value_changed",
1389 G_CALLBACK( on_hshift_step_spinbutton_value_changed ),
1391 g_signal_connect( (gpointer) vshift_step_spinbutton, "value_changed",
1392 G_CALLBACK( on_vshift_step_spinbutton_value_changed ),
1394 g_signal_connect( (gpointer) hscale_step_spinbutton, "value_changed",
1395 G_CALLBACK( on_hscale_step_spinbutton_value_changed ),
1397 g_signal_connect( (gpointer) vscale_step_spinbutton, "value_changed",
1398 G_CALLBACK( on_vscale_step_spinbutton_value_changed ),
1400 g_signal_connect( (gpointer) rotate_step_spinbutton, "value_changed",
1401 G_CALLBACK( on_rotate_step_spinbutton_value_changed ),
1404 g_signal_connect( (gpointer) match_grid_button, "clicked",
1405 G_CALLBACK( on_match_grid_button_clicked ),
1407 g_signal_connect( (gpointer) lock_valuechange_togglebutton, "toggled",
1408 G_CALLBACK( on_lock_valuechange_togglebutton_toggled ),
1411 g_signal_connect( (gpointer) fit_width_spinbutton, "value_changed",
1412 G_CALLBACK( on_fit_width_spinbutton_value_changed ),
1414 g_signal_connect( (gpointer) fit_height_spinbutton, "value_changed",
1415 G_CALLBACK( on_fit_height_spinbutton_value_changed ),
1417 g_signal_connect( (gpointer) fit_button, "clicked",
1418 G_CALLBACK( on_fit_button_clicked ),
1421 g_signal_connect( (gpointer) axial_button, "clicked",
1422 G_CALLBACK( on_axial_button_clicked ),
1425 g_signal_connect( (gpointer) done_button, "clicked",
1426 G_CALLBACK( on_done_button_clicked ),
1428 g_signal_connect( (gpointer) apply_button, "clicked",
1429 G_CALLBACK( on_apply_button_clicked ),
1431 g_signal_connect( (gpointer) cancel_button, "clicked",
1432 G_CALLBACK( on_cancel_button_clicked ),
1436 return SurfaceInspector;
1441 gboolean on_texture_combo_entry_key_press_event( GtkWidget *widget, GdkEventKey *event,
1442 gpointer user_data ){
1443 // Have Tab activate selection as well as Return
1444 if ( event->keyval == GDK_Tab ) {
1445 g_signal_emit_by_name( texture_combo_entry, "activate" );
1451 void on_texture_combo_entry_activate( GtkEntry *entry, gpointer user_data ){
1452 texdef_t* tmp_texdef;
1453 texdef_t* tmp_orig_texdef;
1454 texdef_to_face_t* temp_texdef_face_list;
1455 char text[128] = { 0 };
1457 if ( !texdef_face_list_empty() && g_bListenChanged ) {
1458 // activate only on entry change
1459 strcpy( text, gtk_entry_get_text( entry ) );
1460 if ( strcmp( old_texture_entry, text ) ) {
1461 // Check for spaces in shader name
1462 if ( text[0] <= ' ' || strchr( text, ' ' ) ) {
1463 Sys_FPrintf( SYS_WRN, "WARNING: spaces in shader names are not allowed, ignoring '%s'\n", text );
1467 for ( temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next )
1469 tmp_texdef = (texdef_t *) &temp_texdef_face_list->texdef;
1470 tmp_orig_texdef = (texdef_t *) &temp_texdef_face_list->orig_texdef;
1471 strcpy( old_texture_entry, text );
1472 tmp_texdef->SetName( text );
1481 static void on_hshift_offset_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){
1482 texdef_t* tmp_texdef;
1483 texdef_t* tmp_orig_texdef;
1484 texdef_to_face_t* temp_texdef_face_list;
1486 texdef_offset.shift[0] = gtk_spin_button_get_value( GTK_SPIN_BUTTON( hshift_offset_spinbutton ) );
1488 if ( !texdef_face_list_empty() && g_bListenChanged ) {
1489 for ( temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next )
1491 tmp_texdef = (texdef_t *) &temp_texdef_face_list->texdef;
1492 tmp_orig_texdef = (texdef_t *) &temp_texdef_face_list->orig_texdef;
1493 if ( is_HShift_conflicting ) {
1494 tmp_texdef->shift[0] = tmp_orig_texdef->shift[0] + texdef_offset.shift[0];
1497 tmp_texdef->shift[0] = texdef_SI_values.shift[0] + texdef_offset.shift[0];
1504 static void on_vshift_offset_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){
1505 texdef_t* tmp_texdef;
1506 texdef_t* tmp_orig_texdef;
1507 texdef_to_face_t* temp_texdef_face_list;
1509 texdef_offset.shift[1] = gtk_spin_button_get_value( GTK_SPIN_BUTTON( vshift_offset_spinbutton ) );
1511 if ( !texdef_face_list_empty() && g_bListenChanged ) {
1512 for ( temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next )
1514 tmp_texdef = (texdef_t *) &temp_texdef_face_list->texdef;
1515 tmp_orig_texdef = (texdef_t *) &temp_texdef_face_list->orig_texdef;
1516 if ( is_VShift_conflicting ) {
1517 tmp_texdef->shift[1] = tmp_orig_texdef->shift[1] + texdef_offset.shift[1];
1520 tmp_texdef->shift[1] = texdef_SI_values.shift[1] + texdef_offset.shift[1];
1528 static void on_hscale_offset_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){
1529 texdef_t* tmp_texdef;
1530 texdef_t* tmp_orig_texdef;
1531 texdef_to_face_t* temp_texdef_face_list;
1533 texdef_offset.scale[0] = gtk_spin_button_get_value( GTK_SPIN_BUTTON( hscale_offset_spinbutton ) );
1535 if ( !texdef_face_list_empty() && g_bListenChanged ) {
1536 for ( temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next )
1538 tmp_texdef = (texdef_t *) &temp_texdef_face_list->texdef;
1539 tmp_orig_texdef = (texdef_t *) &temp_texdef_face_list->orig_texdef;
1540 if ( is_HScale_conflicting ) {
1541 tmp_texdef->scale[0] = tmp_orig_texdef->scale[0] + texdef_offset.scale[0];
1544 tmp_texdef->scale[0] = texdef_SI_values.scale[0] + texdef_offset.scale[0];
1553 static void on_vscale_offset_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){
1554 texdef_t* tmp_texdef;
1555 texdef_t* tmp_orig_texdef;
1556 texdef_to_face_t* temp_texdef_face_list;
1558 texdef_offset.scale[1] = gtk_spin_button_get_value( GTK_SPIN_BUTTON( vscale_offset_spinbutton ) );
1560 if ( !texdef_face_list_empty() && g_bListenChanged ) {
1561 for ( temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next )
1563 tmp_texdef = (texdef_t *) &temp_texdef_face_list->texdef;
1564 tmp_orig_texdef = (texdef_t *) &temp_texdef_face_list->orig_texdef;
1565 if ( is_VScale_conflicting ) {
1566 tmp_texdef->scale[1] = tmp_orig_texdef->scale[1] + texdef_offset.scale[1];
1569 tmp_texdef->scale[1] = texdef_SI_values.scale[1] + texdef_offset.scale[1];
1577 static void on_rotate_offset_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){
1578 texdef_t* tmp_texdef;
1579 texdef_t* tmp_orig_texdef;
1580 texdef_to_face_t* temp_texdef_face_list;
1582 texdef_offset.rotate = gtk_spin_button_get_value( GTK_SPIN_BUTTON( rotate_offset_spinbutton ) );
1584 if ( !texdef_face_list_empty() && g_bListenChanged ) {
1585 for ( temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next )
1587 tmp_texdef = (texdef_t *) &temp_texdef_face_list->texdef;
1588 tmp_orig_texdef = (texdef_t *) &temp_texdef_face_list->orig_texdef;
1589 if ( is_Rotate_conflicting ) {
1590 tmp_texdef->rotate = tmp_orig_texdef->rotate + texdef_offset.rotate;
1593 tmp_texdef->rotate = texdef_SI_values.rotate + texdef_offset.rotate;
1603 static void on_match_grid_button_clicked( GtkButton *button, gpointer user_data ){
1604 float hscale, vscale;
1606 if ( !strcmp( gtk_entry_get_text( GTK_ENTRY( hscale_value_spinbutton ) ), "" ) ) {
1610 hscale = gtk_spin_button_get_value( GTK_SPIN_BUTTON( hscale_value_spinbutton ) );
1613 if ( !strcmp( gtk_entry_get_text( GTK_ENTRY( vscale_value_spinbutton ) ), "" ) ) {
1617 vscale = gtk_spin_button_get_value( GTK_SPIN_BUTTON( vscale_value_spinbutton ) );
1619 DoSnapTToGrid( hscale, vscale );
1623 // Lock out changes to Value
1624 static void on_lock_valuechange_togglebutton_toggled( GtkToggleButton *togglebutton, gpointer user_data ){
1627 is_Locked = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( lock_valuechange_togglebutton ) );
1629 gtk_widget_set_sensitive( GTK_WIDGET( hscale_value_spinbutton ), is_Locked );
1630 gtk_widget_set_sensitive( GTK_WIDGET( vscale_value_spinbutton ), is_Locked );
1631 gtk_widget_set_sensitive( GTK_WIDGET( hshift_value_spinbutton ), is_Locked );
1632 gtk_widget_set_sensitive( GTK_WIDGET( vshift_value_spinbutton ), is_Locked );
1633 gtk_widget_set_sensitive( GTK_WIDGET( rotate_value_spinbutton ), is_Locked );
1638 static void on_hshift_value_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){
1639 texdef_t* tmp_texdef;
1640 texdef_t* tmp_orig_texdef;
1641 texdef_to_face_t* temp_texdef_face_list;
1643 texdef_SI_values.shift[0] = gtk_spin_button_get_value( GTK_SPIN_BUTTON( hshift_value_spinbutton ) );
1645 if ( !texdef_face_list_empty() && g_bListenChanged ) {
1646 for ( temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next )
1648 tmp_texdef = (texdef_t *) &temp_texdef_face_list->texdef;
1649 tmp_orig_texdef = (texdef_t *) &temp_texdef_face_list->orig_texdef;
1650 tmp_texdef->shift[0] = texdef_SI_values.shift[0] + texdef_offset.shift[0];
1651 is_HShift_conflicting = FALSE;
1657 static void on_vshift_value_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){
1658 texdef_t* tmp_texdef;
1659 texdef_t* tmp_orig_texdef;
1660 texdef_to_face_t* temp_texdef_face_list;
1662 texdef_SI_values.shift[1] = gtk_spin_button_get_value( GTK_SPIN_BUTTON( vshift_value_spinbutton ) );
1664 if ( !texdef_face_list_empty() && g_bListenChanged ) {
1665 for ( temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next )
1667 tmp_texdef = (texdef_t *) &temp_texdef_face_list->texdef;
1668 tmp_orig_texdef = (texdef_t *) &temp_texdef_face_list->orig_texdef;
1669 tmp_texdef->shift[1] = texdef_SI_values.shift[1] + texdef_offset.shift[1];
1670 is_VShift_conflicting = FALSE;
1676 static void on_hscale_value_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){
1677 texdef_t* tmp_texdef;
1678 texdef_t* tmp_orig_texdef;
1679 texdef_to_face_t* temp_texdef_face_list;
1681 texdef_SI_values.scale[0] = gtk_spin_button_get_value( GTK_SPIN_BUTTON( hscale_value_spinbutton ) );
1683 if ( !texdef_face_list_empty() && g_bListenChanged ) {
1684 for ( temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next )
1686 tmp_texdef = (texdef_t *) &temp_texdef_face_list->texdef;
1687 tmp_orig_texdef = (texdef_t *) &temp_texdef_face_list->orig_texdef;
1688 tmp_texdef->scale[0] = texdef_SI_values.scale[0] + texdef_offset.scale[0];
1689 is_HScale_conflicting = FALSE;
1695 static void on_vscale_value_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){
1696 texdef_t* tmp_texdef;
1697 texdef_t* tmp_orig_texdef;
1698 texdef_to_face_t* temp_texdef_face_list;
1700 texdef_SI_values.scale[1] = gtk_spin_button_get_value( GTK_SPIN_BUTTON( vscale_value_spinbutton ) );
1702 if ( !texdef_face_list_empty() && g_bListenChanged ) {
1703 for ( temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next )
1705 tmp_texdef = (texdef_t *) &temp_texdef_face_list->texdef;
1706 tmp_orig_texdef = (texdef_t *) &temp_texdef_face_list->orig_texdef;
1707 tmp_texdef->scale[1] = texdef_SI_values.scale[1] + texdef_offset.scale[1];
1708 is_VScale_conflicting = FALSE;
1714 static void on_rotate_value_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){
1715 texdef_t* tmp_texdef;
1716 texdef_t* tmp_orig_texdef;
1717 texdef_to_face_t* temp_texdef_face_list;
1719 texdef_SI_values.rotate = gtk_spin_button_get_value( GTK_SPIN_BUTTON( rotate_value_spinbutton ) );
1721 if ( !texdef_face_list_empty() && g_bListenChanged ) {
1722 for ( temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next )
1724 tmp_texdef = (texdef_t *) &temp_texdef_face_list->texdef;
1725 tmp_orig_texdef = (texdef_t *) &temp_texdef_face_list->orig_texdef;
1726 tmp_texdef->rotate = texdef_SI_values.rotate + texdef_offset.rotate;
1727 is_Rotate_conflicting = FALSE;
1735 static void on_hshift_step_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){
1737 GtkAdjustment * adjust;
1739 if ( !g_bListenChanged ) {
1743 l_pIncrement = Get_SI_Inc();
1746 Sys_Printf( "OnIncrementChanged HShift\n" );
1749 val = gtk_spin_button_get_value( GTK_SPIN_BUTTON( hshift_step_spinbutton ) ) ;
1750 adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( hshift_offset_spinbutton ) );
1751 adjust->step_increment = val;
1752 adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( hshift_value_spinbutton ) );
1753 adjust->step_increment = val;
1754 l_pIncrement->shift[0] = val;
1757 static void on_vshift_step_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){
1759 GtkAdjustment * adjust;
1761 if ( !g_bListenChanged ) {
1765 l_pIncrement = Get_SI_Inc();
1768 Sys_Printf( "OnIncrementChanged VShift\n" );
1771 val = gtk_spin_button_get_value( GTK_SPIN_BUTTON( vshift_step_spinbutton ) ) ;
1772 adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( vshift_offset_spinbutton ) );
1773 adjust->step_increment = val;
1774 adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( vshift_value_spinbutton ) );
1775 adjust->step_increment = val;
1776 l_pIncrement->shift[1] = val;
1779 static void on_hscale_step_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){
1781 GtkAdjustment * adjust;
1783 if ( !g_bListenChanged ) {
1787 l_pIncrement = Get_SI_Inc();
1790 Sys_Printf( "OnIncrementChanged HShift\n" );
1793 val = gtk_spin_button_get_value( GTK_SPIN_BUTTON( hscale_step_spinbutton ) ) ;
1794 adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( hscale_offset_spinbutton ) );
1795 adjust->step_increment = val;
1796 adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( hscale_value_spinbutton ) );
1797 adjust->step_increment = val;
1798 l_pIncrement->scale[0] = val;
1801 static void on_vscale_step_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){
1803 GtkAdjustment * adjust;
1805 if ( !g_bListenChanged ) {
1809 l_pIncrement = Get_SI_Inc();
1812 Sys_Printf( "OnIncrementChanged HShift\n" );
1815 val = gtk_spin_button_get_value( GTK_SPIN_BUTTON( vscale_step_spinbutton ) ) ;
1816 adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( vscale_offset_spinbutton ) );
1817 adjust->step_increment = val;
1818 adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( vscale_value_spinbutton ) );
1819 adjust->step_increment = val;
1820 l_pIncrement->scale[1] = val;
1823 static void on_rotate_step_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){
1825 GtkAdjustment * adjust;
1827 if ( !g_bListenChanged ) {
1831 l_pIncrement = Get_SI_Inc();
1834 Sys_Printf( "OnIncrementChanged HShift\n" );
1837 val = gtk_spin_button_get_value( GTK_SPIN_BUTTON( rotate_step_spinbutton ) ) ;
1838 adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( rotate_offset_spinbutton ) );
1839 adjust->step_increment = val;
1840 adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( rotate_value_spinbutton ) );
1841 adjust->step_increment = val;
1842 l_pIncrement->rotate = val;
1847 static void on_fit_width_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){
1848 m_nWidth = gtk_spin_button_get_value_as_int( GTK_SPIN_BUTTON( fit_width_spinbutton ) );
1851 static void on_fit_height_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){
1852 m_nHeight = gtk_spin_button_get_value_as_int( GTK_SPIN_BUTTON( fit_height_spinbutton ) );
1855 static void on_fit_button_clicked( GtkButton *button, gpointer user_data ){
1856 FaceList_FitTexture( get_texdef_face_list(), m_nHeight, m_nWidth );
1857 Sys_UpdateWindows( W_ALL );
1862 static void on_axial_button_clicked( GtkButton *button, gpointer user_data ){
1863 texdef_t* tmp_texdef;
1864 texdef_t* tmp_orig_texdef;
1865 texdef_to_face_t* temp_texdef_face_list;
1867 if ( !texdef_face_list_empty() && g_bListenChanged ) {
1868 for ( temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next )
1870 tmp_texdef = (texdef_t *) &temp_texdef_face_list->texdef;
1871 tmp_texdef->shift[0] = 0.0;
1872 tmp_texdef->shift[1] = 0.0;
1873 tmp_texdef->scale[0] = 0.5;
1874 tmp_texdef->scale[1] = 0.5;
1875 tmp_texdef->rotate = 0.0;
1879 SetTexdef_FaceList( get_texdef_face_list(), FALSE, TRUE );
1880 Sys_UpdateWindows( W_ALL );
1885 static void on_done_button_clicked( GtkButton *button, gpointer user_data ){
1886 if ( !texdef_face_list_empty() ) {
1890 Sys_UpdateWindows( W_ALL );
1893 static void on_apply_button_clicked( GtkButton *button, gpointer user_data ){
1894 if ( !g_bListenChanged ) {
1898 if ( !texdef_face_list_empty() ) {
1900 Sys_UpdateWindows( W_CAMERA );
1901 GetTexdefInfo_from_Radiant();
1906 static void on_cancel_button_clicked( GtkButton *button, gpointer user_data ){
1907 texturewin = Texturewin();
1908 texturewin->texdef = g_old_texdef;
1909 // cancel the last do if we own it
1910 if ( ( m_nUndoId == Undo_GetUndoId() ) && ( m_nUndoId != 0 ) ) {
1912 Sys_Printf( "OnCancel calling Undo_Undo\n" );
1914 g_bListenUpdate = false;
1916 g_bListenUpdate = true;