diff --git a/config.py b/config.py index ff2c4298..88fb8000 100644 --- a/config.py +++ b/config.py @@ -113,9 +113,7 @@ class Config: 'plugins/mapxml/mapxml.vcproj', 'plugins/shaders/shaders.vcproj', 'plugins/surface/surface.vcproj', - 'plugins/surface_ufoai/surface_ufoai.vcproj', - 'plugins/surface_quake2/surface_quake2.vcproj', - 'plugins/surface_heretic2/surface_heretic2.vcproj', + 'plugins/surface_idtech2/surface_idtech2.vcproj', 'contrib/camera/camera.vcproj', 'contrib/prtview/prtview.vcproj', 'contrib/hydratoolz/hydratoolz.vcproj', diff --git a/install/modules/bitmaps/ufoai_actorclip.bmp b/install/modules/bitmaps/ufoai_actorclip.bmp deleted file mode 100644 index 4a2887c6..00000000 Binary files a/install/modules/bitmaps/ufoai_actorclip.bmp and /dev/null differ diff --git a/install/modules/bitmaps/ufoai_level1.bmp b/install/modules/bitmaps/ufoai_level1.bmp deleted file mode 100644 index 80a4b299..00000000 Binary files a/install/modules/bitmaps/ufoai_level1.bmp and /dev/null differ diff --git a/install/modules/bitmaps/ufoai_level2.bmp b/install/modules/bitmaps/ufoai_level2.bmp deleted file mode 100644 index e84e2544..00000000 Binary files a/install/modules/bitmaps/ufoai_level2.bmp and /dev/null differ diff --git a/install/modules/bitmaps/ufoai_level3.bmp b/install/modules/bitmaps/ufoai_level3.bmp deleted file mode 100644 index 141c3245..00000000 Binary files a/install/modules/bitmaps/ufoai_level3.bmp and /dev/null differ diff --git a/install/modules/bitmaps/ufoai_level4.bmp b/install/modules/bitmaps/ufoai_level4.bmp deleted file mode 100644 index 3783a803..00000000 Binary files a/install/modules/bitmaps/ufoai_level4.bmp and /dev/null differ diff --git a/install/modules/bitmaps/ufoai_level5.bmp b/install/modules/bitmaps/ufoai_level5.bmp deleted file mode 100644 index 8f62851c..00000000 Binary files a/install/modules/bitmaps/ufoai_level5.bmp and /dev/null differ diff --git a/install/modules/bitmaps/ufoai_level6.bmp b/install/modules/bitmaps/ufoai_level6.bmp deleted file mode 100644 index 418fdd28..00000000 Binary files a/install/modules/bitmaps/ufoai_level6.bmp and /dev/null differ diff --git a/install/modules/bitmaps/ufoai_level7.bmp b/install/modules/bitmaps/ufoai_level7.bmp deleted file mode 100644 index d82dab61..00000000 Binary files a/install/modules/bitmaps/ufoai_level7.bmp and /dev/null differ diff --git a/install/modules/bitmaps/ufoai_level8.bmp b/install/modules/bitmaps/ufoai_level8.bmp deleted file mode 100644 index c3809538..00000000 Binary files a/install/modules/bitmaps/ufoai_level8.bmp and /dev/null differ diff --git a/install/modules/bitmaps/ufoai_nodraw.bmp b/install/modules/bitmaps/ufoai_nodraw.bmp deleted file mode 100644 index 3eaa529c..00000000 Binary files a/install/modules/bitmaps/ufoai_nodraw.bmp and /dev/null differ diff --git a/install/modules/bitmaps/ufoai_stepon.bmp b/install/modules/bitmaps/ufoai_stepon.bmp deleted file mode 100644 index b73896fb..00000000 Binary files a/install/modules/bitmaps/ufoai_stepon.bmp and /dev/null differ diff --git a/install/modules/bitmaps/ufoai_weaponclip.bmp b/install/modules/bitmaps/ufoai_weaponclip.bmp deleted file mode 100644 index 799468ba..00000000 Binary files a/install/modules/bitmaps/ufoai_weaponclip.bmp and /dev/null differ diff --git a/plugins/surface_heretic2/surface_heretic2.def b/plugins/surface_heretic2/surface_heretic2.def deleted file mode 100644 index 0924a861..00000000 --- a/plugins/surface_heretic2/surface_heretic2.def +++ /dev/null @@ -1,7 +0,0 @@ -; surface_heretic2.def : Declares the module parameters for the DLL. - -LIBRARY "Surface_Heretic2" - -EXPORTS - ; Explicit exports can go here - Synapse_EnumerateInterfaces @1 diff --git a/plugins/surface_heretic2/surface_heretic2.vcproj b/plugins/surface_heretic2/surface_heretic2.vcproj deleted file mode 100644 index 39145d1d..00000000 --- a/plugins/surface_heretic2/surface_heretic2.vcproj +++ /dev/null @@ -1,195 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/plugins/surface_heretic2/surface_heretic2.vcxproj b/plugins/surface_heretic2/surface_heretic2.vcxproj deleted file mode 100644 index 5a417fb5..00000000 --- a/plugins/surface_heretic2/surface_heretic2.vcxproj +++ /dev/null @@ -1,177 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {12932084-E212-45AB-B3BE-A2A5AEEBA581} - Win32Proj - - - - DynamicLibrary - v110 - - - DynamicLibrary - v110 - - - DynamicLibrary - v110 - - - DynamicLibrary - v110 - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>11.0.60315.1 - - - $(SolutionDir)\install\modules\ - $(SolutionDir)\build\intermediate\$(Configuration)\$(ProjectName)\ - - - - $(SolutionDir)\install\modules\ - $(SolutionDir)\build\intermediate\$(Configuration)\$(ProjectName)\ - - - - - Disabled - $(SolutionDir)\libs;$(SolutionDir)\include;$(SolutionDir)\..\STLport-5.2.1\stlport;$(SolutionDir)\..\gtk-2.24.10\include\glib-2.0;$(SolutionDir)\..\gtk-2.24.10\include\gdk-pixbuf-2.0;$(SolutionDir)\..\gtk-2.24.10\lib\glib-2.0\include;$(SolutionDir)\..\gtk-2.24.10\include;$(SolutionDir)\..\gtk-2.24.10\include\gtk-2.0;$(SolutionDir)\..\gtk-2.24.10\lib\gtk-2.0\include;$(SolutionDir)\..\gtk-2.24.10\include\cairo;$(SolutionDir)\..\gtk-2.24.10\include\pango-1.0;$(SolutionDir)\..\gtk-2.24.10\include\atk-1.0;$(SolutionDir)\..\libxml2-2.9.1\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_WINDOWS;_USRDLL;SURFACE_HERETIC2_EXPORTS;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebugDLL - - Level3 - EditAndContinue - 4996;4244;4800;4101;%(DisableSpecificWarnings) - - - /STACK:8388608 %(AdditionalOptions) - ws2_32.lib;glib-2.0.lib;gobject-2.0.lib;intl.lib;gtk-win32-2.0.lib;libxml2.lib;synapse.lib;%(AdditionalDependencies) - $(SolutionDir)\..\gtk-2.24.10\lib;$(SolutionDir)\..\libxml2-2.9.1\lib\$(Configuration)\$(Platform);$(SolutionDir)\build\$(Configuration)\libs;%(AdditionalLibraryDirectories) - surface_heretic2.def - true - Windows - MachineX86 - - - - - Disabled - $(SolutionDir)\libs;$(SolutionDir)\include;$(SolutionDir)\..\STLport-5.2.1\stlport;$(SolutionDir)\..\gtk-2.24.10\include\glib-2.0;$(SolutionDir)\..\gtk-2.24.10\include\gdk-pixbuf-2.0;$(SolutionDir)\..\gtk-2.24.10\lib\glib-2.0\include;$(SolutionDir)\..\gtk-2.24.10\include;$(SolutionDir)\..\gtk-2.24.10\include\gtk-2.0;$(SolutionDir)\..\gtk-2.24.10\lib\gtk-2.0\include;$(SolutionDir)\..\gtk-2.24.10\include\cairo;$(SolutionDir)\..\gtk-2.24.10\include\pango-1.0;$(SolutionDir)\..\gtk-2.24.10\include\atk-1.0;$(SolutionDir)\..\libxml2-2.9.1\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_WINDOWS;_USRDLL;SURFACE_HERETIC2_EXPORTS;%(PreprocessorDefinitions) - EnableFastChecks - MultiThreadedDebugDLL - - - Level3 - ProgramDatabase - 4996;4244;4800;4101;%(DisableSpecificWarnings) - - - /STACK:8388608 %(AdditionalOptions) - ws2_32.lib;glib-2.0.lib;gobject-2.0.lib;intl.lib;gtk-win32-2.0.lib;libxml2.lib;synapse.lib;%(AdditionalDependencies) - $(SolutionDir)\..\gtk-2.24.10\lib;$(SolutionDir)\..\libxml2-2.9.1\lib\$(Configuration)\$(Platform);$(SolutionDir)\build\$(Configuration)\libs;%(AdditionalLibraryDirectories) - surface_heretic2.def - true - Windows - - - - - $(SolutionDir)\libs;$(SolutionDir)\include;$(SolutionDir)\..\STLport-5.2.1\stlport;$(SolutionDir)\..\gtk-2.24.10\include\glib-2.0;$(SolutionDir)\..\gtk-2.24.10\include\gdk-pixbuf-2.0;$(SolutionDir)\..\gtk-2.24.10\lib\glib-2.0\include;$(SolutionDir)\..\gtk-2.24.10\include;$(SolutionDir)\..\gtk-2.24.10\include\gtk-2.0;$(SolutionDir)\..\gtk-2.24.10\lib\gtk-2.0\include;$(SolutionDir)\..\gtk-2.24.10\include\cairo;$(SolutionDir)\..\gtk-2.24.10\include\pango-1.0;$(SolutionDir)\..\gtk-2.24.10\include\atk-1.0;$(SolutionDir)\..\libxml2-2.9.1\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_WINDOWS;_USRDLL;SURFACE_HERETIC2_EXPORTS;%(PreprocessorDefinitions) - MultiThreadedDLL - - Level3 - ProgramDatabase - 4996;4244;4800;4101;%(DisableSpecificWarnings) - - - /STACK:8388608 %(AdditionalOptions) - ws2_32.lib;glib-2.0.lib;gobject-2.0.lib;intl.lib;gtk-win32-2.0.lib;libxml2.lib;synapse.lib;%(AdditionalDependencies) - $(SolutionDir)\..\gtk-2.24.10\lib;$(SolutionDir)\..\libxml2-2.9.1\lib\$(Configuration)\$(Platform);$(SolutionDir)\build\$(Configuration)\libs;%(AdditionalLibraryDirectories) - surface_heretic2.def - true - Windows - true - true - MachineX86 - - - - - $(SolutionDir)\libs;$(SolutionDir)\include;$(SolutionDir)\..\STLport-5.2.1\stlport;$(SolutionDir)\..\gtk-2.24.10\include\glib-2.0;$(SolutionDir)\..\gtk-2.24.10\include\gdk-pixbuf-2.0;$(SolutionDir)\..\gtk-2.24.10\lib\glib-2.0\include;$(SolutionDir)\..\gtk-2.24.10\include;$(SolutionDir)\..\gtk-2.24.10\include\gtk-2.0;$(SolutionDir)\..\gtk-2.24.10\lib\gtk-2.0\include;$(SolutionDir)\..\gtk-2.24.10\include\cairo;$(SolutionDir)\..\gtk-2.24.10\include\pango-1.0;$(SolutionDir)\..\gtk-2.24.10\include\atk-1.0;$(SolutionDir)\..\libxml2-2.9.1\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_WINDOWS;_USRDLL;SURFACE_HERETIC2_EXPORTS;%(PreprocessorDefinitions) - MultiThreadedDLL - - - Level3 - ProgramDatabase - 4996;4244;4800;4101;%(DisableSpecificWarnings) - - - /STACK:8388608 %(AdditionalOptions) - ws2_32.lib;glib-2.0.lib;gobject-2.0.lib;intl.lib;gtk-win32-2.0.lib;libxml2.lib;synapse.lib;%(AdditionalDependencies) - $(SolutionDir)\..\gtk-2.24.10\lib;$(SolutionDir)\..\libxml2-2.9.1\lib\$(Configuration)\$(Platform);$(SolutionDir)\build\$(Configuration)\libs;%(AdditionalLibraryDirectories) - surface_heretic2.def - true - Windows - true - true - - - - - - - - - - - - - {e13ccfb0-a366-4ef3-a66f-c374b563e4df} - false - - - - - - \ No newline at end of file diff --git a/plugins/surface_heretic2/surface_heretic2.vcxproj.filters b/plugins/surface_heretic2/surface_heretic2.vcxproj.filters deleted file mode 100644 index 9749ce0c..00000000 --- a/plugins/surface_heretic2/surface_heretic2.vcxproj.filters +++ /dev/null @@ -1,25 +0,0 @@ - - - - - {333dba10-f4a3-4d91-a36e-f56a4a79e75c} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - - - src - - - - - src - - - src - - - src - - - \ No newline at end of file diff --git a/plugins/surface_heretic2/surfacedialog.cpp b/plugins/surface_heretic2/surfacedialog.cpp deleted file mode 100644 index fd06da6d..00000000 --- a/plugins/surface_heretic2/surfacedialog.cpp +++ /dev/null @@ -1,1916 +0,0 @@ -/* - Copyright (C) 1999-2007 id Software, Inc. and contributors. - For a list of contributors, see the accompanying CONTRIBUTORS file. - - This file is part of GtkRadiant. - - GtkRadiant is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - GtkRadiant is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with GtkRadiant; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -// -// Surface Dialog Module -// - -// -// Nurail: Implemented to Module from the main Radiant Surface Dialog code -// - - -#include -#include - -#include "surfdlg_plugin.h" - - - -#ifdef _DEBUG -//#define DBG_SI 1 -#endif - -#include "gtkr_vector.h" - -vector g_texdef_face_vector; - -inline texdef_to_face_t* get_texdef_face_list(){ - return &( *g_texdef_face_vector.begin() ); -} - -inline unsigned int texdef_face_list_empty(){ - return g_texdef_face_vector.empty(); -} - -inline unsigned int texdef_face_list_size(){ - return g_texdef_face_vector.size(); -} - -// For different faces having different values -bool is_HShift_conflicting; -bool is_VShift_conflicting; -bool is_HScale_conflicting; -bool is_VScale_conflicting; -bool is_Rotate_conflicting; -bool is_TextureName_conflicting; - -void ShowDlg(); -void HideDlg(); -void SetTexMods(); -void GetTexMods( bool b_SetUndoPoint = FALSE ); -void BuildDialog(); -void FitAll(); -void InitDefaultIncrement( texdef_t * ); -void DoSnapTToGrid( float hscale, float vscale ); -// called to perform a fitting from the outside (shortcut key) -void SurfaceDialogFitAll(); - -// Heretic2 Flags Functions -void SetFlagButtons_Heretic2( texdef_to_face_t *texdef_face_list, bool b_isListEmpty ); -void SetChangeInFlags_Face_Heretic2( texdef_to_face_t *texdef_face_list ); -GtkWidget* Create_Heretic2FlagsDialog( GtkWidget* surfacedialog_widget ); - - -// Dialog Data -int m_nHeight; -int m_nWidth; - -// 0 is invalid, otherwise it's the Id of the last 'do' we are responsible for -int m_nUndoId; - - -texturewin_t *texturewin; -texdef_t *l_pIncrement; -texdef_t texdef_offset; -texdef_t texdef_SI_values; - -// For Texture Entry, activate only on entry change -char old_texture_entry[128]; - -// the texdef to switch back to when the OnCancel is called -texdef_t g_old_texdef; - -// when TRUE, this thing means the surface inspector is currently being displayed -bool g_surfwin = FALSE; -// turn on/off processing of the "changed" "value_changed" messages -// (need to turn off when we are feeding data in) -bool g_bListenChanged = true; -// turn on/off listening of the update messages -bool g_bListenUpdate = true; - -GtkWidget* create_SurfaceInspector( void ); -GtkWidget *SurfaceInspector = NULL; - -GtkWidget *m_pWidget; -GtkWidget *GetWidget() { return SurfaceInspector; } -GtkWidget *Get_SI_Module_Widget() { return SurfaceInspector; } -void SetWidget( GtkWidget *new_widget ) { m_pWidget = new_widget; } -GtkWidget *GetDlgWidget( const char* name ) -{ return GTK_WIDGET( g_object_get_data( G_OBJECT( SurfaceInspector ), name ) ); } - -// Spins for FitTexture -GtkWidget *spin_width; -GtkWidget *spin_height; - - -GtkWidget *texture_combo; -GtkWidget *texture_combo_entry; - -GtkWidget *match_grid_button; -GtkWidget *lock_valuechange_togglebutton; - -GtkObject *hshift_value_spinbutton_adj; -GtkWidget *hshift_value_spinbutton; -GtkObject *vshift_value_spinbutton_adj; -GtkWidget *vshift_value_spinbutton; -GtkObject *hscale_value_spinbutton_adj; -GtkWidget *hscale_value_spinbutton; -GtkObject *vscale_value_spinbutton_adj; -GtkWidget *vscale_value_spinbutton; -GtkObject *rotate_value_spinbutton_adj; -GtkWidget *rotate_value_spinbutton; - -GtkObject *hshift_offset_spinbutton_adj; -GtkWidget *hshift_offset_spinbutton; -GtkObject *vshift_offset_spinbutton_adj; -GtkWidget *vshift_offset_spinbutton; -GtkObject *hscale_offset_spinbutton_adj; -GtkWidget *hscale_offset_spinbutton; -GtkObject *vscale_offset_spinbutton_adj; -GtkWidget *vscale_offset_spinbutton; -GtkObject *rotate_offset_spinbutton_adj; -GtkWidget *rotate_offset_spinbutton; - -GtkObject *hshift_step_spinbutton_adj; -GtkWidget *hshift_step_spinbutton; -GtkObject *vshift_step_spinbutton_adj; -GtkWidget *vshift_step_spinbutton; -GtkObject *hscale_step_spinbutton_adj; -GtkWidget *hscale_step_spinbutton; -GtkObject *vscale_step_spinbutton_adj; -GtkWidget *vscale_step_spinbutton; -GtkObject *rotate_step_spinbutton_adj; -GtkWidget *rotate_step_spinbutton; - -GtkObject *fit_width_spinbutton_adj; -GtkWidget *fit_width_spinbutton; -GtkObject *fit_height_spinbutton_adj; -GtkWidget *fit_height_spinbutton; -GtkWidget *fit_button; -GtkWidget *axial_button; - -GtkWidget *done_button; -GtkWidget *apply_button; -GtkWidget *cancel_button; - -// Callbacks -gboolean on_texture_combo_entry_key_press_event( GtkWidget *widget, GdkEventKey *event, gpointer user_data ); -void on_texture_combo_entry_activate( GtkEntry *entry, gpointer user_data ); - -static void on_match_grid_button_clicked( GtkButton *button, gpointer user_data ); -static void on_lock_valuechange_togglebutton_toggled( GtkToggleButton *togglebutton, gpointer user_data ); - -static void on_hshift_value_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ); -static void on_vshift_value_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ); -static void on_hscale_value_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ); -static void on_vscale_value_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ); -static void on_rotate_value_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ); - -static void on_hshift_offset_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ); -static void on_vshift_offset_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ); -static void on_hscale_offset_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ); -static void on_vscale_offset_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ); -static void on_rotate_offset_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ); - -static void on_hshift_step_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ); -static void on_vshift_step_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ); -static void on_hscale_step_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ); -static void on_vscale_step_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ); -static void on_rotate_step_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ); - -static void on_fit_width_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ); -static void on_fit_height_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ); -static void on_fit_button_clicked( GtkButton *button, gpointer user_data ); -static void on_axial_button_clicked( GtkButton *button, gpointer user_data ); - -static void on_done_button_clicked( GtkButton *button, gpointer user_data ); -static void on_apply_button_clicked( GtkButton *button, gpointer user_data ); -static void on_cancel_button_clicked( GtkButton *button, gpointer user_data ); - - -/* - =================================================== - - SURFACE INSPECTOR - - =================================================== - */ - - -void IsFaceConflicting(){ - texdef_t* tmp_texdef; - texdef_to_face_t* temp_texdef_face_list; - char texture_name[128]; - - if ( texdef_face_list_empty() ) { - gtk_entry_set_text( GTK_ENTRY( hshift_value_spinbutton ), "" ); - gtk_entry_set_text( GTK_ENTRY( vshift_value_spinbutton ), "" ); - gtk_entry_set_text( GTK_ENTRY( hscale_value_spinbutton ), "" ); - gtk_entry_set_text( GTK_ENTRY( vscale_value_spinbutton ), "" ); - gtk_entry_set_text( GTK_ENTRY( rotate_value_spinbutton ), "" ); - gtk_entry_set_text( GTK_ENTRY( texture_combo_entry ), "" ); - return; - } - - g_bListenChanged = FALSE; - - tmp_texdef = &get_texdef_face_list()->texdef; - - strcpy( texture_name, tmp_texdef->GetName() ); - - texdef_SI_values.shift[0] = tmp_texdef->shift[0]; - texdef_SI_values.shift[1] = tmp_texdef->shift[1]; - texdef_SI_values.scale[0] = tmp_texdef->scale[0]; - texdef_SI_values.scale[1] = tmp_texdef->scale[1]; - texdef_SI_values.rotate = tmp_texdef->rotate; - texdef_SI_values.SetName( texture_name ); - - is_HShift_conflicting = FALSE; - is_VShift_conflicting = FALSE; - is_HScale_conflicting = FALSE; - is_VScale_conflicting = FALSE; - is_Rotate_conflicting = FALSE; - is_TextureName_conflicting = FALSE; - - if ( texdef_face_list_size() > 1 ) { - temp_texdef_face_list = get_texdef_face_list()->next; - - for (; temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next ) - { - tmp_texdef = &temp_texdef_face_list->texdef; - if ( texdef_SI_values.shift[0] != tmp_texdef->shift[0] ) { - is_HShift_conflicting = TRUE; - } - - if ( texdef_SI_values.shift[1] != tmp_texdef->shift[1] ) { - is_VShift_conflicting = TRUE; - } - - if ( texdef_SI_values.scale[0] != tmp_texdef->scale[0] ) { - is_HScale_conflicting = TRUE; - } - - if ( texdef_SI_values.scale[1] != tmp_texdef->scale[1] ) { - is_VScale_conflicting = TRUE; - } - - if ( texdef_SI_values.rotate != tmp_texdef->rotate ) { - is_Rotate_conflicting = TRUE; - } - - if ( strcmp( texture_name, tmp_texdef->GetName() ) ) { - is_TextureName_conflicting = TRUE; - } - } - } - - if ( is_HShift_conflicting ) { - gtk_entry_set_text( GTK_ENTRY( hshift_value_spinbutton ), "" ); - } - else{ - gtk_spin_button_set_value( GTK_SPIN_BUTTON( hshift_value_spinbutton ), texdef_SI_values.shift[0] ); - } - - if ( is_VShift_conflicting ) { - gtk_entry_set_text( GTK_ENTRY( vshift_value_spinbutton ), "" ); - } - else{ - gtk_spin_button_set_value( GTK_SPIN_BUTTON( vshift_value_spinbutton ), texdef_SI_values.shift[1] ); - } - - if ( is_HScale_conflicting ) { - gtk_entry_set_text( GTK_ENTRY( hscale_value_spinbutton ), "" ); - } - else{ - gtk_spin_button_set_value( GTK_SPIN_BUTTON( hscale_value_spinbutton ), texdef_SI_values.scale[0] ); - } - - if ( is_VScale_conflicting ) { - gtk_entry_set_text( GTK_ENTRY( vscale_value_spinbutton ), "" ); - } - else{ - gtk_spin_button_set_value( GTK_SPIN_BUTTON( vscale_value_spinbutton ), texdef_SI_values.scale[1] ); - } - - if ( is_Rotate_conflicting ) { - gtk_entry_set_text( GTK_ENTRY( rotate_value_spinbutton ), "" ); - } - else{ - gtk_spin_button_set_value( GTK_SPIN_BUTTON( rotate_value_spinbutton ), texdef_SI_values.rotate ); - } - - g_bListenChanged = TRUE; -} - -#define MAX_NUM_LIST_ITEMS 15 -static void PopulateTextureComboList(){ - texdef_t* tmp_texdef; - texdef_to_face_t* temp_texdef_face_list; - char blank[1]; - GList *items = NULL; - int num_of_list_items = 0; - - blank[0] = 0; - - if ( texdef_face_list_empty() ) { - items = g_list_append( items, (gpointer) blank ); - // For Texture Entry, activate only on entry change - strcpy( old_texture_entry, blank ); - } - else if ( !is_TextureName_conflicting ) { - temp_texdef_face_list = get_texdef_face_list(); - tmp_texdef = (texdef_t *) &get_texdef_face_list()->texdef; - items = g_list_append( items, (gpointer) tmp_texdef->GetName() ); - // For Texture Entry, activate only on entry change - strcpy( old_texture_entry, tmp_texdef->GetName() ); - } - else - { - for ( temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next ) - { - tmp_texdef = (texdef_t *) &temp_texdef_face_list->texdef; - // Need to do a string compare, hence the custom search - if ( !( g_list_find_custom( items, tmp_texdef->GetName(), (GCompareFunc) strcmp ) ) ) { - items = g_list_append( items, (gpointer) tmp_texdef->GetName() ); - num_of_list_items++; - } - // Make sure the combo list isn't too long - if ( num_of_list_items >= MAX_NUM_LIST_ITEMS ) { - break; - } - } - // If this isn't added last (to the top of the list), g_list_find freaks. - items = g_list_prepend( items, (gpointer) blank ); - // For Texture Entry, activate only on entry change - strcpy( old_texture_entry, blank ); - } - - gtk_combo_set_popdown_strings( GTK_COMBO( texture_combo ), items ); - g_list_free( items ); - -} - -static void ZeroOffsetValues(){ - texdef_offset.shift[0] = 0.0; - texdef_offset.shift[1] = 0.0; - texdef_offset.scale[0] = 0.0; - texdef_offset.scale[1] = 0.0; - texdef_offset.rotate = 0.0; -} - -static void GetTexdefInfo_from_Radiant(){ - g_texdef_face_vector.clear(); - - unsigned int count = GetSelectedFaceCountfromBrushes(); - if ( count == 0 ) { - count = GetSelectedFaceCount(); - } - - g_texdef_face_vector.resize( count ); - - if ( !texdef_face_list_empty() ) { - GetSelFacesTexdef( get_texdef_face_list() ); - } - - IsFaceConflicting(); - PopulateTextureComboList(); - ZeroOffsetValues(); - if ( texdef_face_list_empty() ) { - SetFlagButtons_Heretic2( get_texdef_face_list(), TRUE ); - } - else{ - SetFlagButtons_Heretic2( get_texdef_face_list(), FALSE ); - } - -} - -static gint delete_event_callback( GtkWidget *widget, GdkEvent* event, gpointer data ){ - HideDlg(); - return TRUE; -} - -// make the shift increments match the grid settings -// the objective being that the shift+arrows shortcuts move the texture by the corresponding grid size -// this depends on a scale value if you have selected a particular texture on which you want it to work: -// we move the textures in pixels, not world units. (i.e. increment values are in pixel) -// depending on the texture scale it doesn't take the same amount of pixels to move of g_qeglobals.d_gridsize -// increment * scale = gridsize -// hscale and vscale are optional parameters, if they are zero they will be set to the default scale -// NOTE: the default scale depends if you are using BP mode or regular. -// For regular it's 0.5f (128 pixels cover 64 world units), for BP it's simply 1.0f -// see fenris #2810 -void DoSnapTToGrid( float hscale, float vscale ){ - l_pIncrement = Get_SI_Inc(); - - if ( hscale == 0.0f ) { - hscale = 0.5f; - } - if ( vscale == 0.0f ) { - vscale = 0.5f; - } -#ifdef _DEBUG - Sys_Printf( "DoSnapTToGrid: hscale %g vscale %g\n", hscale, vscale ); -#endif - l_pIncrement->shift[0] = GridSize() / hscale; - l_pIncrement->shift[1] = GridSize() / vscale; - // now some update work - // FIXME: doesn't look good here, seems to be called several times - SetTexMods(); -} - -void UpdateSurfaceDialog(){ - if ( !g_bListenUpdate ) { - return; - } - - if ( !SurfaceInspector ) { - return; - } - - // avoid long delays on slow computers - while ( gtk_events_pending() ) - gtk_main_iteration(); - - if ( g_surfwin ) { -#ifdef DBG_SI - Sys_Printf( "UpdateSurfaceDialog\n" ); -#endif - GetTexdefInfo_from_Radiant(); - SetTexMods(); - } - -} - -// DoSurface will always try to show the surface inspector -// or update it because something new has been selected -void DoSurface( void ){ -#ifdef DBG_SI - Sys_Printf( "DoSurface\n" ); -#endif - if ( !SurfaceInspector ) { - create_SurfaceInspector(); - } - - ShowDlg(); - SetTexMods(); -} - -void ToggleSurface(){ -#ifdef DBG_SI - Sys_Printf( "ToggleSurface Module\n" ); -#endif - if ( !g_surfwin ) { - DoSurface(); - } - else{ - on_cancel_button_clicked( NULL, NULL ); - } -} - -// NOTE: will raise and show the Surface inspector and exec fit for patches and brushes -void SurfaceDlgFitAll(){ - DoSurface(); - FitAll(); -} - -// ============================================================================= -// SurfaceDialog class - -void ShowDlg(){ - - if ( !SurfaceInspector ) { - create_SurfaceInspector(); - } - else{ - gtk_widget_show( SurfaceInspector ); - } - - GetTexdefInfo_from_Radiant(); - GetTexMods( TRUE ); // Set Initial Undo Point - g_surfwin = TRUE; -} - -void HideDlg(){ - g_surfwin = FALSE; - gtk_widget_hide( SurfaceInspector ); -} - - -// set default values for increments (shift scale and rot) -// this is called by the prefs code if can't find the values -void InitDefaultIncrement( texdef_t *tex ){ - tex->SetName( "foo" ); - tex->shift[0] = 8; - tex->shift[1] = 8; - tex->scale[0] = 0.25; - tex->scale[1] = 0.25; - tex->rotate = 10; -} - -void BuildDialog(){ - if ( !SurfaceInspector ) { - create_SurfaceInspector(); - } -} - -/* - ============== - SetTexMods - - Set the fields to the current texdef (i.e. map/texdef -> dialog widgets) - =============== - */ - -void SetTexMods(){ - texdef_t *pt; - GtkSpinButton *spin; - GtkAdjustment *adjust; - - texturewin = Texturewin(); - l_pIncrement = Get_SI_Inc(); - -#ifdef DBG_SI - Sys_Printf( "SurfaceDlg SetTexMods\n" ); -#endif - - if ( !g_surfwin ) { - return; - } - - pt = &texturewin->texdef; - - g_bListenChanged = false; - - if ( strncmp( pt->GetName(), "textures/", 9 ) != 0 ) { - texdef_offset.SetName( SHADER_NOT_FOUND ); - } - - - spin = GTK_SPIN_BUTTON( hshift_offset_spinbutton ); - gtk_spin_button_set_value( spin, texdef_offset.shift[0] ); - adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) ); - adjust->step_increment = l_pIncrement->shift[0]; - gtk_spin_button_set_value( GTK_SPIN_BUTTON( hshift_step_spinbutton ), l_pIncrement->shift[0] ); - - spin = GTK_SPIN_BUTTON( hshift_value_spinbutton ); - adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) ); - adjust->step_increment = l_pIncrement->shift[0]; - - - spin = GTK_SPIN_BUTTON( vshift_offset_spinbutton ); - gtk_spin_button_set_value( spin, texdef_offset.shift[1] ); - adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) ); - adjust->step_increment = l_pIncrement->shift[1]; - gtk_spin_button_set_value( GTK_SPIN_BUTTON( vshift_step_spinbutton ), l_pIncrement->shift[1] ); - - spin = GTK_SPIN_BUTTON( vshift_value_spinbutton ); - adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) ); - adjust->step_increment = l_pIncrement->shift[1]; - - - spin = GTK_SPIN_BUTTON( hscale_offset_spinbutton ); - gtk_spin_button_set_value( spin, texdef_offset.scale[0] ); - adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) ); - adjust->step_increment = l_pIncrement->scale[0]; - gtk_spin_button_set_value( GTK_SPIN_BUTTON( hscale_step_spinbutton ), l_pIncrement->scale[0] ); - - spin = GTK_SPIN_BUTTON( hscale_value_spinbutton ); - adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) ); - adjust->step_increment = l_pIncrement->scale[0]; - - - spin = GTK_SPIN_BUTTON( vscale_offset_spinbutton ); - gtk_spin_button_set_value( spin, texdef_offset.scale[1] ); - adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) ); - adjust->step_increment = l_pIncrement->scale[1]; - gtk_spin_button_set_value( GTK_SPIN_BUTTON( vscale_step_spinbutton ), l_pIncrement->scale[1] ); - - spin = GTK_SPIN_BUTTON( vscale_value_spinbutton ); - adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) ); - adjust->step_increment = l_pIncrement->scale[1]; - - - spin = GTK_SPIN_BUTTON( rotate_offset_spinbutton ); - gtk_spin_button_set_value( spin, texdef_offset.rotate ); - adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) ); - adjust->step_increment = l_pIncrement->rotate; - gtk_spin_button_set_value( GTK_SPIN_BUTTON( rotate_step_spinbutton ), l_pIncrement->rotate ); - - spin = GTK_SPIN_BUTTON( rotate_value_spinbutton ); - adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) ); - adjust->step_increment = l_pIncrement->rotate; - - - g_bListenChanged = true; - - // store the current texdef as our escape route if user hits OnCancel - g_old_texdef = texturewin->texdef; -} - -/* - ============== - GetTexMods - - Shows any changes to the main Radiant windows - =============== - */ -void GetTexMods( bool b_SetUndoPoint ){ - -#ifdef DBG_SI - Sys_Printf( "SurfaceDlg GetTexMods\n" ); -#endif - - if ( !texdef_face_list_empty() ) { - g_bListenUpdate = FALSE; - SetChangeInFlags_Face_Heretic2( get_texdef_face_list() ); - SetTexdef_FaceList( get_texdef_face_list(), b_SetUndoPoint, false ); - g_bListenUpdate = TRUE; - - if ( b_SetUndoPoint ) { - m_nUndoId = Undo_GetUndoId(); - } - } -} - -void FitAll(){ - on_fit_button_clicked( NULL, NULL ); -} - - -//////////////////////////////////////////////////////////////////// -// -// GUI Section -// -//////////////////////////////////////////////////////////////////// - -GtkWidget* create_SurfaceInspector( void ){ - - GtkWidget *label; - GtkWidget *hseparator; - GtkWidget *eventbox; - - GtkWidget *viewport8; - GtkWidget *viewport9; - GtkWidget *viewport2; - GtkWidget *viewport7; - GtkWidget *viewport5; - GtkWidget *viewport6; - GtkWidget *viewport10; - - GtkWidget *table1; - GtkWidget *table4; - GtkWidget *table5; - GtkWidget *table7; - - GtkWidget *alignment1; - GtkWidget *alignment2; - GtkWidget *alignment3; - - GtkWidget *vbox7; - - GtkWidget *hbox1; - GtkWidget *hbox2; - GtkWidget *hbox3; - GtkWidget *hbox4; - - GtkWidget *image1; - GtkWidget *image2; - GtkWidget *image3; - - GtkWidget *hbuttonbox1; - - SurfaceInspector = gtk_window_new( GTK_WINDOW_TOPLEVEL ); - gtk_container_set_border_width( GTK_CONTAINER( SurfaceInspector ), 4 ); - gtk_window_set_title( GTK_WINDOW( SurfaceInspector ), "Surface Inspector" ); - - SetWinPos_from_Prefs( SurfaceInspector ); - - viewport8 = gtk_viewport_new( NULL, NULL ); - gtk_widget_show( viewport8 ); - gtk_container_add( GTK_CONTAINER( SurfaceInspector ), viewport8 ); - gtk_viewport_set_shadow_type( GTK_VIEWPORT( viewport8 ), GTK_SHADOW_NONE ); - - vbox7 = gtk_vbox_new( FALSE, 0 ); - gtk_widget_show( vbox7 ); - gtk_container_add( GTK_CONTAINER( viewport8 ), vbox7 ); - - viewport9 = gtk_viewport_new( NULL, NULL ); - gtk_widget_show( viewport9 ); - gtk_box_pack_start( GTK_BOX( vbox7 ), viewport9, FALSE, FALSE, 0 ); - gtk_container_set_border_width( GTK_CONTAINER( viewport9 ), 2 ); - gtk_viewport_set_shadow_type( GTK_VIEWPORT( viewport9 ), GTK_SHADOW_ETCHED_IN ); - - hbox1 = gtk_hbox_new( FALSE, 0 ); - gtk_widget_show( hbox1 ); - gtk_container_add( GTK_CONTAINER( viewport9 ), hbox1 ); - gtk_container_set_border_width( GTK_CONTAINER( hbox1 ), 4 ); - - label = gtk_label_new( "Texture: " ); - gtk_widget_show( label ); - gtk_box_pack_start( GTK_BOX( hbox1 ), label, FALSE, FALSE, 0 ); - gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 ); - - texture_combo = gtk_combo_new(); - g_object_set_data( G_OBJECT( GTK_COMBO( texture_combo )->popwin ), - "KeepMeAround", texture_combo ); - gtk_combo_disable_activate( (GtkCombo*) texture_combo ); - gtk_widget_show( texture_combo ); - gtk_box_pack_start( GTK_BOX( hbox1 ), texture_combo, TRUE, TRUE, 0 ); - - texture_combo_entry = GTK_COMBO( texture_combo )->entry; - gtk_widget_show( texture_combo_entry ); - gtk_entry_set_max_length( GTK_ENTRY( texture_combo_entry ), 128 ); - - viewport2 = gtk_viewport_new( NULL, NULL ); - gtk_widget_show( viewport2 ); - gtk_box_pack_start( GTK_BOX( vbox7 ), viewport2, FALSE, TRUE, 0 ); - gtk_container_set_border_width( GTK_CONTAINER( viewport2 ), 2 ); - gtk_viewport_set_shadow_type( GTK_VIEWPORT( viewport2 ), GTK_SHADOW_ETCHED_IN ); - - table1 = gtk_table_new( 13, 4, FALSE ); - gtk_widget_show( table1 ); - gtk_container_add( GTK_CONTAINER( viewport2 ), table1 ); - - hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); - gtk_table_attach( GTK_TABLE( table1 ), hseparator, 1, 2, 1, 2, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); - gtk_table_attach( GTK_TABLE( table1 ), hseparator, 2, 3, 1, 2, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); - gtk_table_attach( GTK_TABLE( table1 ), hseparator, 3, 4, 1, 2, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); - gtk_table_attach( GTK_TABLE( table1 ), hseparator, 1, 2, 3, 4, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); - gtk_table_attach( GTK_TABLE( table1 ), hseparator, 2, 3, 3, 4, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); - gtk_table_attach( GTK_TABLE( table1 ), hseparator, 3, 4, 3, 4, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); - gtk_table_attach( GTK_TABLE( table1 ), hseparator, 1, 2, 5, 6, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); - gtk_table_attach( GTK_TABLE( table1 ), hseparator, 2, 3, 5, 6, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); - gtk_table_attach( GTK_TABLE( table1 ), hseparator, 3, 4, 5, 6, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); - gtk_table_attach( GTK_TABLE( table1 ), hseparator, 1, 2, 7, 8, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); - gtk_table_attach( GTK_TABLE( table1 ), hseparator, 2, 3, 7, 8, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); - gtk_table_attach( GTK_TABLE( table1 ), hseparator, 3, 4, 7, 8, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); - gtk_table_attach( GTK_TABLE( table1 ), hseparator, 1, 2, 9, 10, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); - gtk_table_attach( GTK_TABLE( table1 ), hseparator, 2, 3, 9, 10, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); - gtk_table_attach( GTK_TABLE( table1 ), hseparator, 3, 4, 9, 10, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); - gtk_table_attach( GTK_TABLE( table1 ), hseparator, 1, 2, 11, 12, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); - gtk_table_attach( GTK_TABLE( table1 ), hseparator, 2, 3, 11, 12, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); - gtk_table_attach( GTK_TABLE( table1 ), hseparator, 3, 4, 11, 12, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - label = gtk_label_new( "Offset" ); - gtk_widget_show( label ); - gtk_table_attach( GTK_TABLE( table1 ), label, 2, 3, 0, 1, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); - - label = gtk_label_new( "Step" ); - gtk_widget_show( label ); - gtk_table_attach( GTK_TABLE( table1 ), label, 3, 4, 0, 1, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); - - eventbox = gtk_event_box_new(); - gtk_widget_show( eventbox ); - gtk_table_attach( GTK_TABLE( table1 ), eventbox, 3, 4, 12, 13, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - match_grid_button = gtk_button_new_with_mnemonic( "Match Grid" ); - gtk_widget_show( match_grid_button ); - gtk_container_add( GTK_CONTAINER( eventbox ), match_grid_button ); - - label = gtk_label_new( "Value" ); - gtk_widget_show( label ); - gtk_table_attach( GTK_TABLE( table1 ), label, 1, 2, 0, 1, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_misc_set_alignment( GTK_MISC( label ), 0.5, 1 ); - - hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); - gtk_table_attach( GTK_TABLE( table1 ), hseparator, 0, 1, 3, 4, - (GtkAttachOptions) ( GTK_SHRINK | GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); - gtk_table_attach( GTK_TABLE( table1 ), hseparator, 0, 1, 5, 6, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); - gtk_table_attach( GTK_TABLE( table1 ), hseparator, 0, 1, 7, 8, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); - gtk_table_attach( GTK_TABLE( table1 ), hseparator, 0, 1, 9, 10, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); - gtk_table_attach( GTK_TABLE( table1 ), hseparator, 0, 1, 11, 12, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - eventbox = gtk_event_box_new(); - gtk_widget_show( eventbox ); - gtk_table_attach( GTK_TABLE( table1 ), eventbox, 0, 1, 4, 5, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - label = gtk_label_new( "V Shift: " ); - gtk_widget_show( label ); - gtk_container_add( GTK_CONTAINER( eventbox ), label ); - gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT ); - gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 ); - - eventbox = gtk_event_box_new(); - gtk_widget_show( eventbox ); - gtk_table_attach( GTK_TABLE( table1 ), eventbox, 0, 1, 6, 7, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - label = gtk_label_new( " H Scale: " ); - gtk_widget_show( label ); - gtk_container_add( GTK_CONTAINER( eventbox ), label ); - gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT ); - gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 ); - - eventbox = gtk_event_box_new(); - gtk_widget_show( eventbox ); - gtk_table_attach( GTK_TABLE( table1 ), eventbox, 0, 1, 8, 9, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - label = gtk_label_new( "V Scale: " ); - gtk_widget_show( label ); - gtk_container_add( GTK_CONTAINER( eventbox ), label ); - gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT ); - gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 ); - - eventbox = gtk_event_box_new(); - gtk_widget_show( eventbox ); - gtk_table_attach( GTK_TABLE( table1 ), eventbox, 0, 1, 10, 11, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - label = gtk_label_new( "Rotate: " ); - gtk_widget_show( label ); - gtk_container_add( GTK_CONTAINER( eventbox ), label ); - gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT ); - gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 ); - - eventbox = gtk_event_box_new(); - gtk_widget_show( eventbox ); - gtk_table_attach( GTK_TABLE( table1 ), eventbox, 0, 1, 2, 3, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - label = gtk_label_new( "H Shift: " ); - gtk_widget_show( label ); - gtk_container_add( GTK_CONTAINER( eventbox ), label ); - gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT ); - gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 ); - - hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); - gtk_table_attach( GTK_TABLE( table1 ), hseparator, 0, 1, 1, 2, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - eventbox = gtk_event_box_new(); - gtk_widget_show( eventbox ); - gtk_table_attach( GTK_TABLE( table1 ), eventbox, 1, 2, 12, 13, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - lock_valuechange_togglebutton = gtk_toggle_button_new_with_mnemonic( "UNLOCK" ); - gtk_widget_show( lock_valuechange_togglebutton ); - gtk_container_add( GTK_CONTAINER( eventbox ), lock_valuechange_togglebutton ); - - // Value Spins - hshift_value_spinbutton_adj = gtk_adjustment_new( 0.0, -8192.0, 8192.0, 2.0, 8.0, 8.0 ); - hshift_value_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( hshift_value_spinbutton_adj ), 1, 2 ); - gtk_widget_show( hshift_value_spinbutton ); - gtk_table_attach( GTK_TABLE( table1 ), hshift_value_spinbutton, 1, 2, 2, 3, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( hshift_value_spinbutton ), GTK_UPDATE_IF_VALID ); - gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( hshift_value_spinbutton ), TRUE ); - gtk_widget_set_sensitive( GTK_WIDGET( hshift_value_spinbutton ), FALSE ); - - vshift_value_spinbutton_adj = gtk_adjustment_new( 0.0, -8192.0, 8192.0, 2.0, 8.0, 8.0 ); - vshift_value_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( vshift_value_spinbutton_adj ), 1, 2 ); - gtk_widget_show( vshift_value_spinbutton ); - gtk_table_attach( GTK_TABLE( table1 ), vshift_value_spinbutton, 1, 2, 4, 5, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( vshift_value_spinbutton ), GTK_UPDATE_IF_VALID ); - gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( vshift_value_spinbutton ), TRUE ); - gtk_widget_set_sensitive( GTK_WIDGET( vshift_value_spinbutton ), FALSE ); - - hscale_value_spinbutton_adj = gtk_adjustment_new( 0.0, -1024.0, 1024.0, 1.0, 4.0, 4.0 ); - hscale_value_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( hscale_value_spinbutton_adj ), 1, 4 ); - gtk_widget_show( hscale_value_spinbutton ); - gtk_table_attach( GTK_TABLE( table1 ), hscale_value_spinbutton, 1, 2, 6, 7, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( hscale_value_spinbutton ), GTK_UPDATE_IF_VALID ); - gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( hscale_value_spinbutton ), TRUE ); - gtk_widget_set_sensitive( GTK_WIDGET( hscale_value_spinbutton ), FALSE ); - - vscale_value_spinbutton_adj = gtk_adjustment_new( 0.0, -1024.0, 1024.0, 1.0, 4.0, 4.0 ); - vscale_value_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( vscale_value_spinbutton_adj ), 1, 4 ); - gtk_widget_show( vscale_value_spinbutton ); - gtk_table_attach( GTK_TABLE( table1 ), vscale_value_spinbutton, 1, 2, 8, 9, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( vscale_value_spinbutton ), GTK_UPDATE_IF_VALID ); - gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( vscale_value_spinbutton ), TRUE ); - gtk_widget_set_sensitive( GTK_WIDGET( vscale_value_spinbutton ), FALSE ); - - rotate_value_spinbutton_adj = gtk_adjustment_new( 0.0, -360.0, 360.0, 1.0, 10.0, 10.0 ); - rotate_value_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( rotate_value_spinbutton_adj ), 1, 0 ); - gtk_widget_show( rotate_value_spinbutton ); - gtk_table_attach( GTK_TABLE( table1 ), rotate_value_spinbutton, 1, 2, 10, 11, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( rotate_value_spinbutton ), GTK_UPDATE_IF_VALID ); - gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( rotate_value_spinbutton ), TRUE ); - gtk_widget_set_sensitive( GTK_WIDGET( rotate_value_spinbutton ), FALSE ); - - // Offset Spins - hshift_offset_spinbutton_adj = gtk_adjustment_new( 0.0, -8192.0, 8192.0, 2.0, 8.0, 8.0 ); - hshift_offset_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( hshift_offset_spinbutton_adj ), 0, 2 ); - gtk_widget_show( hshift_offset_spinbutton ); - gtk_table_attach( GTK_TABLE( table1 ), hshift_offset_spinbutton, 2, 3, 2, 3, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 4, 0 ); - gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( hshift_offset_spinbutton ), TRUE ); - gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( hshift_offset_spinbutton ), GTK_UPDATE_IF_VALID ); - gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( hshift_offset_spinbutton ), TRUE ); - - vshift_offset_spinbutton_adj = gtk_adjustment_new( 0.0, -8192.0, 8192.0, 2.0, 8.0, 8.0 ); - vshift_offset_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( vshift_offset_spinbutton_adj ), 0, 2 ); - gtk_widget_show( vshift_offset_spinbutton ); - gtk_table_attach( GTK_TABLE( table1 ), vshift_offset_spinbutton, 2, 3, 4, 5, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 4, 0 ); - gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( vshift_offset_spinbutton ), TRUE ); - gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( vshift_offset_spinbutton ), GTK_UPDATE_IF_VALID ); - gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( vshift_offset_spinbutton ), TRUE ); - - hscale_offset_spinbutton_adj = gtk_adjustment_new( 0.0, -1024.0, 1024.0, 1.0, 4.0, 4.0 ); - hscale_offset_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( hscale_offset_spinbutton_adj ), 0, 4 ); - gtk_widget_show( hscale_offset_spinbutton ); - gtk_table_attach( GTK_TABLE( table1 ), hscale_offset_spinbutton, 2, 3, 6, 7, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 4, 0 ); - gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( hscale_offset_spinbutton ), TRUE ); - gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( hscale_offset_spinbutton ), GTK_UPDATE_IF_VALID ); - gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( hscale_offset_spinbutton ), TRUE ); - - vscale_offset_spinbutton_adj = gtk_adjustment_new( 0.0, -1024.0, 1024.0, 1.0, 4.0, 4.0 ); - vscale_offset_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( vscale_offset_spinbutton_adj ), 0, 4 ); - gtk_widget_show( vscale_offset_spinbutton ); - gtk_table_attach( GTK_TABLE( table1 ), vscale_offset_spinbutton, 2, 3, 8, 9, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 4, 0 ); - gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( vscale_offset_spinbutton ), TRUE ); - gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( vscale_offset_spinbutton ), GTK_UPDATE_IF_VALID ); - gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( vscale_offset_spinbutton ), TRUE ); - - rotate_offset_spinbutton_adj = gtk_adjustment_new( 0.0, -360.0, 360.0, 1.0, 10.0, 10.0 ); - rotate_offset_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( rotate_offset_spinbutton_adj ), 0, 2 ); - gtk_widget_show( rotate_offset_spinbutton ); - gtk_table_attach( GTK_TABLE( table1 ), rotate_offset_spinbutton, 2, 3, 10, 11, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 4, 0 ); - gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( rotate_offset_spinbutton ), TRUE ); - gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( rotate_offset_spinbutton ), GTK_UPDATE_IF_VALID ); - gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( rotate_offset_spinbutton ), TRUE ); - - // Step Spins - hshift_step_spinbutton_adj = gtk_adjustment_new( 0.0, -8192.0, 8192.0, 2.0, 8.0, 8.0 ); - hshift_step_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( hshift_step_spinbutton_adj ), 1, 2 ); - gtk_widget_show( hshift_step_spinbutton ); - gtk_table_attach( GTK_TABLE( table1 ), hshift_step_spinbutton, 3, 4, 2, 3, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( hshift_step_spinbutton ), GTK_UPDATE_IF_VALID ); - - vshift_step_spinbutton_adj = gtk_adjustment_new( 0.0, -8192.0, 8192.0, 2.0, 8.0, 8.0 ); - vshift_step_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( vshift_step_spinbutton_adj ), 1, 2 ); - gtk_widget_show( vshift_step_spinbutton ); - gtk_table_attach( GTK_TABLE( table1 ), vshift_step_spinbutton, 3, 4, 4, 5, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( vshift_step_spinbutton ), GTK_UPDATE_IF_VALID ); - - hscale_step_spinbutton_adj = gtk_adjustment_new( 0.0, -1024.0, 1024.0, 1.0, 4.0, 4.0 ); - hscale_step_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( hscale_step_spinbutton_adj ), 1, 4 ); - gtk_widget_show( hscale_step_spinbutton ); - gtk_table_attach( GTK_TABLE( table1 ), hscale_step_spinbutton, 3, 4, 6, 7, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( hscale_step_spinbutton ), GTK_UPDATE_IF_VALID ); - - vscale_step_spinbutton_adj = gtk_adjustment_new( 0.0, -1024.0, 1024.0, 1.0, 4.0, 4.0 ); - vscale_step_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( vscale_step_spinbutton_adj ), 1, 4 ); - gtk_widget_show( vscale_step_spinbutton ); - gtk_table_attach( GTK_TABLE( table1 ), vscale_step_spinbutton, 3, 4, 8, 9, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( vscale_step_spinbutton ), GTK_UPDATE_IF_VALID ); - - rotate_step_spinbutton_adj = gtk_adjustment_new( 0.0, -360.0, 360.0, 1.0, 10.0, 10.0 ); - rotate_step_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( rotate_step_spinbutton_adj ), 1, 2 ); - gtk_widget_show( rotate_step_spinbutton ); - gtk_table_attach( GTK_TABLE( table1 ), rotate_step_spinbutton, 3, 4, 10, 11, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( rotate_step_spinbutton ), GTK_UPDATE_IF_VALID ); - - eventbox = gtk_event_box_new(); - gtk_widget_show( eventbox ); - gtk_table_attach( GTK_TABLE( table1 ), eventbox, 2, 3, 12, 13, - (GtkAttachOptions) ( 0 ), - (GtkAttachOptions) ( 0 ), 0, 0 ); - - eventbox = gtk_event_box_new(); - gtk_widget_show( eventbox ); - gtk_table_attach( GTK_TABLE( table1 ), eventbox, 0, 1, 12, 13, - (GtkAttachOptions) ( 0 ), - (GtkAttachOptions) ( 0 ), 0, 0 ); - - eventbox = gtk_event_box_new(); - gtk_widget_show( eventbox ); - gtk_table_attach( GTK_TABLE( table1 ), eventbox, 0, 1, 0, 1, - (GtkAttachOptions) ( 0 ), - (GtkAttachOptions) ( 0 ), 0, 0 ); - - viewport7 = gtk_viewport_new( NULL, NULL ); - gtk_widget_show( viewport7 ); - gtk_box_pack_start( GTK_BOX( vbox7 ), viewport7, FALSE, TRUE, 0 ); - gtk_container_set_border_width( GTK_CONTAINER( viewport7 ), 2 ); - gtk_viewport_set_shadow_type( GTK_VIEWPORT( viewport7 ), GTK_SHADOW_ETCHED_IN ); - - table4 = gtk_table_new( 4, 7, FALSE ); - gtk_widget_show( table4 ); - gtk_container_add( GTK_CONTAINER( viewport7 ), table4 ); - - viewport5 = gtk_viewport_new( NULL, NULL ); - gtk_widget_show( viewport5 ); - gtk_table_attach( GTK_TABLE( table4 ), viewport5, 1, 7, 0, 4, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_container_set_border_width( GTK_CONTAINER( viewport5 ), 6 ); - gtk_viewport_set_shadow_type( GTK_VIEWPORT( viewport5 ), GTK_SHADOW_ETCHED_OUT ); - - table5 = gtk_table_new( 2, 3, FALSE ); - gtk_widget_show( table5 ); - gtk_container_add( GTK_CONTAINER( viewport5 ), table5 ); - gtk_container_set_border_width( GTK_CONTAINER( table5 ), 5 ); - gtk_table_set_col_spacings( GTK_TABLE( table5 ), 2 ); - - label = gtk_label_new( "Height" ); - gtk_widget_show( label ); - gtk_table_attach( GTK_TABLE( table5 ), label, 2, 3, 0, 1, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT ); - gtk_misc_set_alignment( GTK_MISC( label ), 0.5, 1 ); - - label = gtk_label_new( "Width" ); - gtk_widget_show( label ); - gtk_table_attach( GTK_TABLE( table5 ), label, 1, 2, 0, 1, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT ); - gtk_misc_set_alignment( GTK_MISC( label ), 0.5, 1 ); - - fit_width_spinbutton_adj = gtk_adjustment_new( 1, 1, 32, 1, 10, 10 ); - fit_width_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( fit_width_spinbutton_adj ), 1, 0 ); - gtk_widget_show( fit_width_spinbutton ); - gtk_table_attach( GTK_TABLE( table5 ), fit_width_spinbutton, 1, 2, 1, 2, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( fit_width_spinbutton ), TRUE ); - gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( fit_width_spinbutton ), GTK_UPDATE_IF_VALID ); - - fit_height_spinbutton_adj = gtk_adjustment_new( 1, 1, 32, 1, 10, 10 ); - fit_height_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( fit_height_spinbutton_adj ), 1, 0 ); - gtk_widget_show( fit_height_spinbutton ); - gtk_table_attach( GTK_TABLE( table5 ), fit_height_spinbutton, 2, 3, 1, 2, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 3, 0 ); - gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( fit_height_spinbutton ), TRUE ); - gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( fit_height_spinbutton ), GTK_UPDATE_IF_VALID ); - - eventbox = gtk_event_box_new(); - gtk_widget_show( eventbox ); - gtk_table_attach( GTK_TABLE( table5 ), eventbox, 0, 1, 0, 1, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - eventbox = gtk_event_box_new(); - gtk_widget_show( eventbox ); - gtk_table_attach( GTK_TABLE( table5 ), eventbox, 0, 1, 1, 2, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 4, 0 ); - - fit_button = gtk_button_new_with_mnemonic( " Fit " ); - gtk_widget_show( fit_button ); - gtk_container_add( GTK_CONTAINER( eventbox ), fit_button ); - - viewport6 = gtk_viewport_new( NULL, NULL ); - gtk_widget_show( viewport6 ); - gtk_table_attach( GTK_TABLE( table4 ), viewport6, 0, 1, 0, 4, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_container_set_border_width( GTK_CONTAINER( viewport6 ), 4 ); - gtk_viewport_set_shadow_type( GTK_VIEWPORT( viewport6 ), GTK_SHADOW_NONE ); - - table7 = gtk_table_new( 2, 1, FALSE ); - gtk_widget_show( table7 ); - gtk_container_add( GTK_CONTAINER( viewport6 ), table7 ); - - eventbox = gtk_event_box_new(); - gtk_widget_show( eventbox ); - gtk_table_attach( GTK_TABLE( table7 ), eventbox, 0, 1, 0, 2, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); - - axial_button = gtk_button_new_with_mnemonic( "Axial" ); - gtk_widget_show( axial_button ); - gtk_container_add( GTK_CONTAINER( eventbox ), axial_button ); - gtk_widget_set_size_request( axial_button, 56, 29 ); - gtk_container_set_border_width( GTK_CONTAINER( axial_button ), 4 ); - - // Fit in Flags sub-dialog - Create_Heretic2FlagsDialog( vbox7 ); - - viewport10 = gtk_viewport_new( NULL, NULL ); - gtk_widget_show( viewport10 ); - gtk_box_pack_start( GTK_BOX( vbox7 ), viewport10, FALSE, TRUE, 0 ); - gtk_container_set_border_width( GTK_CONTAINER( viewport10 ), 2 ); - gtk_viewport_set_shadow_type( GTK_VIEWPORT( viewport10 ), GTK_SHADOW_ETCHED_IN ); - - hbuttonbox1 = gtk_hbutton_box_new(); - gtk_widget_show( hbuttonbox1 ); - gtk_container_add( GTK_CONTAINER( viewport10 ), hbuttonbox1 ); - gtk_container_set_border_width( GTK_CONTAINER( hbuttonbox1 ), 4 ); - gtk_button_box_set_layout( GTK_BUTTON_BOX( hbuttonbox1 ), GTK_BUTTONBOX_SPREAD ); - - done_button = gtk_button_new(); - gtk_widget_show( done_button ); - gtk_container_add( GTK_CONTAINER( hbuttonbox1 ), done_button ); - GTK_WIDGET_SET_FLAGS( done_button, GTK_CAN_DEFAULT ); - - alignment1 = gtk_alignment_new( 0.5, 0.5, 0, 0 ); - gtk_widget_show( alignment1 ); - gtk_container_add( GTK_CONTAINER( done_button ), alignment1 ); - - hbox2 = gtk_hbox_new( FALSE, 2 ); - gtk_widget_show( hbox2 ); - gtk_container_add( GTK_CONTAINER( alignment1 ), hbox2 ); - - image1 = gtk_image_new_from_stock( "gtk-yes", GTK_ICON_SIZE_BUTTON ); - gtk_widget_show( image1 ); - gtk_box_pack_start( GTK_BOX( hbox2 ), image1, FALSE, FALSE, 0 ); - - label = gtk_label_new_with_mnemonic( "Done" ); - gtk_widget_show( label ); - gtk_box_pack_start( GTK_BOX( hbox2 ), label, FALSE, FALSE, 0 ); - gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT ); - - apply_button = gtk_button_new(); - gtk_widget_show( apply_button ); - gtk_container_add( GTK_CONTAINER( hbuttonbox1 ), apply_button ); - GTK_WIDGET_SET_FLAGS( apply_button, GTK_CAN_DEFAULT ); - - alignment3 = gtk_alignment_new( 0.5, 0.5, 0, 0 ); - gtk_widget_show( alignment3 ); - gtk_container_add( GTK_CONTAINER( apply_button ), alignment3 ); - - hbox4 = gtk_hbox_new( FALSE, 2 ); - gtk_widget_show( hbox4 ); - gtk_container_add( GTK_CONTAINER( alignment3 ), hbox4 ); - - image3 = gtk_image_new_from_stock( "gtk-apply", GTK_ICON_SIZE_BUTTON ); - gtk_widget_show( image3 ); - gtk_box_pack_start( GTK_BOX( hbox4 ), image3, FALSE, FALSE, 0 ); - - label = gtk_label_new_with_mnemonic( "Apply" ); - gtk_widget_show( label ); - gtk_box_pack_start( GTK_BOX( hbox4 ), label, FALSE, FALSE, 0 ); - gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT ); - - cancel_button = gtk_button_new(); - gtk_widget_show( cancel_button ); - gtk_container_add( GTK_CONTAINER( hbuttonbox1 ), cancel_button ); - GTK_WIDGET_SET_FLAGS( cancel_button, GTK_CAN_DEFAULT ); - - alignment2 = gtk_alignment_new( 0.5, 0.5, 0, 0 ); - gtk_widget_show( alignment2 ); - gtk_container_add( GTK_CONTAINER( cancel_button ), alignment2 ); - - hbox3 = gtk_hbox_new( FALSE, 2 ); - gtk_widget_show( hbox3 ); - gtk_container_add( GTK_CONTAINER( alignment2 ), hbox3 ); - - image2 = gtk_image_new_from_stock( "gtk-no", GTK_ICON_SIZE_BUTTON ); - gtk_widget_show( image2 ); - gtk_box_pack_start( GTK_BOX( hbox3 ), image2, FALSE, FALSE, 0 ); - - label = gtk_label_new_with_mnemonic( "Cancel" ); - gtk_widget_show( label ); - gtk_box_pack_start( GTK_BOX( hbox3 ), label, FALSE, FALSE, 0 ); - gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT ); - - - g_signal_connect( (gpointer) SurfaceInspector, - "delete_event", - G_CALLBACK( delete_event_callback ), - NULL ); - g_signal_connect( (gpointer) SurfaceInspector, "destroy", - G_CALLBACK( gtk_widget_destroy ), - NULL ); - - g_signal_connect( (gpointer) texture_combo_entry, "key_press_event", - G_CALLBACK( on_texture_combo_entry_key_press_event ), - NULL ); - g_signal_connect( (gpointer) texture_combo_entry, "activate", - G_CALLBACK( on_texture_combo_entry_activate ), - NULL ); - - - g_signal_connect( (gpointer) hshift_offset_spinbutton, "value_changed", - G_CALLBACK( on_hshift_offset_spinbutton_value_changed ), - NULL ); - g_signal_connect( (gpointer) vshift_offset_spinbutton, "value_changed", - G_CALLBACK( on_vshift_offset_spinbutton_value_changed ), - NULL ); - g_signal_connect( (gpointer) hscale_offset_spinbutton, "value_changed", - G_CALLBACK( on_hscale_offset_spinbutton_value_changed ), - NULL ); - g_signal_connect( (gpointer) vscale_offset_spinbutton, "value_changed", - G_CALLBACK( on_vscale_offset_spinbutton_value_changed ), - NULL ); - g_signal_connect( (gpointer) rotate_offset_spinbutton, "value_changed", - G_CALLBACK( on_rotate_offset_spinbutton_value_changed ), - NULL ); - - g_signal_connect( (gpointer) hshift_value_spinbutton, "value_changed", - G_CALLBACK( on_hshift_value_spinbutton_value_changed ), - NULL ); - g_signal_connect( (gpointer) vshift_value_spinbutton, "value_changed", - G_CALLBACK( on_vshift_value_spinbutton_value_changed ), - NULL ); - g_signal_connect( (gpointer) hscale_value_spinbutton, "value_changed", - G_CALLBACK( on_hscale_value_spinbutton_value_changed ), - NULL ); - g_signal_connect( (gpointer) vscale_value_spinbutton, "value_changed", - G_CALLBACK( on_vscale_value_spinbutton_value_changed ), - NULL ); - g_signal_connect( (gpointer) rotate_value_spinbutton, "value_changed", - G_CALLBACK( on_rotate_value_spinbutton_value_changed ), - NULL ); - - g_signal_connect( (gpointer) hshift_step_spinbutton, "value_changed", - G_CALLBACK( on_hshift_step_spinbutton_value_changed ), - NULL ); - g_signal_connect( (gpointer) vshift_step_spinbutton, "value_changed", - G_CALLBACK( on_vshift_step_spinbutton_value_changed ), - NULL ); - g_signal_connect( (gpointer) hscale_step_spinbutton, "value_changed", - G_CALLBACK( on_hscale_step_spinbutton_value_changed ), - NULL ); - g_signal_connect( (gpointer) vscale_step_spinbutton, "value_changed", - G_CALLBACK( on_vscale_step_spinbutton_value_changed ), - NULL ); - g_signal_connect( (gpointer) rotate_step_spinbutton, "value_changed", - G_CALLBACK( on_rotate_step_spinbutton_value_changed ), - NULL ); - - g_signal_connect( (gpointer) match_grid_button, "clicked", - G_CALLBACK( on_match_grid_button_clicked ), - NULL ); - g_signal_connect( (gpointer) lock_valuechange_togglebutton, "toggled", - G_CALLBACK( on_lock_valuechange_togglebutton_toggled ), - NULL ); - - g_signal_connect( (gpointer) fit_width_spinbutton, "value_changed", - G_CALLBACK( on_fit_width_spinbutton_value_changed ), - NULL ); - g_signal_connect( (gpointer) fit_height_spinbutton, "value_changed", - G_CALLBACK( on_fit_height_spinbutton_value_changed ), - NULL ); - g_signal_connect( (gpointer) fit_button, "clicked", - G_CALLBACK( on_fit_button_clicked ), - NULL ); - - g_signal_connect( (gpointer) axial_button, "clicked", - G_CALLBACK( on_axial_button_clicked ), - NULL ); - - g_signal_connect( (gpointer) done_button, "clicked", - G_CALLBACK( on_done_button_clicked ), - NULL ); - g_signal_connect( (gpointer) apply_button, "clicked", - G_CALLBACK( on_apply_button_clicked ), - NULL ); - g_signal_connect( (gpointer) cancel_button, "clicked", - G_CALLBACK( on_cancel_button_clicked ), - NULL ); - - - return SurfaceInspector; -} - - -// Texture Combo -gboolean on_texture_combo_entry_key_press_event( GtkWidget *widget, GdkEventKey *event, - gpointer user_data ){ - // Have Tab activate selection as well as Return - if ( event->keyval == GDK_Tab ) { - g_signal_emit_by_name( texture_combo_entry, "activate" ); - } - - return FALSE; -} - -void on_texture_combo_entry_activate( GtkEntry *entry, gpointer user_data ){ - texdef_t* tmp_texdef; - texdef_t* tmp_orig_texdef; - texdef_to_face_t* temp_texdef_face_list; - char text[128] = { 0 }; - - if ( !texdef_face_list_empty() && g_bListenChanged ) { - // activate only on entry change - strcpy( text, gtk_entry_get_text( entry ) ); - if ( strcmp( old_texture_entry, text ) ) { - // Check for spaces in shader name - if ( text[0] <= ' ' || strchr( text, ' ' ) ) { - Sys_FPrintf( SYS_WRN, "WARNING: spaces in shader names are not allowed, ignoring '%s'\n", text ); - } - else - { - for ( temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next ) - { - tmp_texdef = (texdef_t *) &temp_texdef_face_list->texdef; - tmp_orig_texdef = (texdef_t *) &temp_texdef_face_list->orig_texdef; - strcpy( old_texture_entry, text ); - tmp_texdef->SetName( text ); - } - GetTexMods(); - } - } - } -} - -// Offset Spins -static void on_hshift_offset_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){ - texdef_t* tmp_texdef; - texdef_t* tmp_orig_texdef; - texdef_to_face_t* temp_texdef_face_list; - - texdef_offset.shift[0] = gtk_spin_button_get_value( GTK_SPIN_BUTTON( hshift_offset_spinbutton ) ); - - if ( !texdef_face_list_empty() && g_bListenChanged ) { - for ( temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next ) - { - tmp_texdef = (texdef_t *) &temp_texdef_face_list->texdef; - tmp_orig_texdef = (texdef_t *) &temp_texdef_face_list->orig_texdef; - if ( is_HShift_conflicting ) { - tmp_texdef->shift[0] = tmp_orig_texdef->shift[0] + texdef_offset.shift[0]; - } - else{ - tmp_texdef->shift[0] = texdef_SI_values.shift[0] + texdef_offset.shift[0]; - } - } - GetTexMods(); - } -} - -static void on_vshift_offset_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){ - texdef_t* tmp_texdef; - texdef_t* tmp_orig_texdef; - texdef_to_face_t* temp_texdef_face_list; - - texdef_offset.shift[1] = gtk_spin_button_get_value( GTK_SPIN_BUTTON( vshift_offset_spinbutton ) ); - - if ( !texdef_face_list_empty() && g_bListenChanged ) { - for ( temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next ) - { - tmp_texdef = (texdef_t *) &temp_texdef_face_list->texdef; - tmp_orig_texdef = (texdef_t *) &temp_texdef_face_list->orig_texdef; - if ( is_VShift_conflicting ) { - tmp_texdef->shift[1] = tmp_orig_texdef->shift[1] + texdef_offset.shift[1]; - } - else{ - tmp_texdef->shift[1] = texdef_SI_values.shift[1] + texdef_offset.shift[1]; - } - } - GetTexMods(); - } - -} - -static void on_hscale_offset_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){ - texdef_t* tmp_texdef; - texdef_t* tmp_orig_texdef; - texdef_to_face_t* temp_texdef_face_list; - - texdef_offset.scale[0] = gtk_spin_button_get_value( GTK_SPIN_BUTTON( hscale_offset_spinbutton ) ); - - if ( !texdef_face_list_empty() && g_bListenChanged ) { - for ( temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next ) - { - tmp_texdef = (texdef_t *) &temp_texdef_face_list->texdef; - tmp_orig_texdef = (texdef_t *) &temp_texdef_face_list->orig_texdef; - if ( is_HScale_conflicting ) { - tmp_texdef->scale[0] = tmp_orig_texdef->scale[0] + texdef_offset.scale[0]; - } - else{ - tmp_texdef->scale[0] = texdef_SI_values.scale[0] + texdef_offset.scale[0]; - } - } - GetTexMods(); - } - - -} - -static void on_vscale_offset_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){ - texdef_t* tmp_texdef; - texdef_t* tmp_orig_texdef; - texdef_to_face_t* temp_texdef_face_list; - - texdef_offset.scale[1] = gtk_spin_button_get_value( GTK_SPIN_BUTTON( vscale_offset_spinbutton ) ); - - if ( !texdef_face_list_empty() && g_bListenChanged ) { - for ( temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next ) - { - tmp_texdef = (texdef_t *) &temp_texdef_face_list->texdef; - tmp_orig_texdef = (texdef_t *) &temp_texdef_face_list->orig_texdef; - if ( is_VScale_conflicting ) { - tmp_texdef->scale[1] = tmp_orig_texdef->scale[1] + texdef_offset.scale[1]; - } - else{ - tmp_texdef->scale[1] = texdef_SI_values.scale[1] + texdef_offset.scale[1]; - } - } - GetTexMods(); - } - -} - -static void on_rotate_offset_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){ - texdef_t* tmp_texdef; - texdef_t* tmp_orig_texdef; - texdef_to_face_t* temp_texdef_face_list; - - texdef_offset.rotate = gtk_spin_button_get_value( GTK_SPIN_BUTTON( rotate_offset_spinbutton ) ); - - if ( !texdef_face_list_empty() && g_bListenChanged ) { - for ( temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next ) - { - tmp_texdef = (texdef_t *) &temp_texdef_face_list->texdef; - tmp_orig_texdef = (texdef_t *) &temp_texdef_face_list->orig_texdef; - if ( is_Rotate_conflicting ) { - tmp_texdef->rotate = tmp_orig_texdef->rotate + texdef_offset.rotate; - } - else{ - tmp_texdef->rotate = texdef_SI_values.rotate + texdef_offset.rotate; - } - } - GetTexMods(); - } - -} - - -// Match Grid -static void on_match_grid_button_clicked( GtkButton *button, gpointer user_data ){ - float hscale, vscale; - - if ( !strcmp( gtk_entry_get_text( GTK_ENTRY( hscale_value_spinbutton ) ), "" ) ) { - hscale = 0.0; - } - else{ - hscale = gtk_spin_button_get_value( GTK_SPIN_BUTTON( hscale_value_spinbutton ) ); - } - - if ( !strcmp( gtk_entry_get_text( GTK_ENTRY( vscale_value_spinbutton ) ), "" ) ) { - vscale = 0.0; - } - else{ - vscale = gtk_spin_button_get_value( GTK_SPIN_BUTTON( vscale_value_spinbutton ) ); - } - DoSnapTToGrid( hscale, vscale ); -} - - -// Lock out changes to Value -static void on_lock_valuechange_togglebutton_toggled( GtkToggleButton *togglebutton, gpointer user_data ){ - bool is_Locked; - - is_Locked = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( lock_valuechange_togglebutton ) ); - - gtk_widget_set_sensitive( GTK_WIDGET( hscale_value_spinbutton ), is_Locked ); - gtk_widget_set_sensitive( GTK_WIDGET( vscale_value_spinbutton ), is_Locked ); - gtk_widget_set_sensitive( GTK_WIDGET( hshift_value_spinbutton ), is_Locked ); - gtk_widget_set_sensitive( GTK_WIDGET( vshift_value_spinbutton ), is_Locked ); - gtk_widget_set_sensitive( GTK_WIDGET( rotate_value_spinbutton ), is_Locked ); -} - - -// Value Spins -static void on_hshift_value_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){ - texdef_t* tmp_texdef; - texdef_t* tmp_orig_texdef; - texdef_to_face_t* temp_texdef_face_list; - - texdef_SI_values.shift[0] = gtk_spin_button_get_value( GTK_SPIN_BUTTON( hshift_value_spinbutton ) ); - - if ( !texdef_face_list_empty() && g_bListenChanged ) { - for ( temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next ) - { - tmp_texdef = (texdef_t *) &temp_texdef_face_list->texdef; - tmp_orig_texdef = (texdef_t *) &temp_texdef_face_list->orig_texdef; - tmp_texdef->shift[0] = texdef_SI_values.shift[0] + texdef_offset.shift[0]; - is_HShift_conflicting = FALSE; - } - GetTexMods(); - } -} - -static void on_vshift_value_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){ - texdef_t* tmp_texdef; - texdef_t* tmp_orig_texdef; - texdef_to_face_t* temp_texdef_face_list; - - texdef_SI_values.shift[1] = gtk_spin_button_get_value( GTK_SPIN_BUTTON( vshift_value_spinbutton ) ); - - if ( !texdef_face_list_empty() && g_bListenChanged ) { - for ( temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next ) - { - tmp_texdef = (texdef_t *) &temp_texdef_face_list->texdef; - tmp_orig_texdef = (texdef_t *) &temp_texdef_face_list->orig_texdef; - tmp_texdef->shift[1] = texdef_SI_values.shift[1] + texdef_offset.shift[1]; - is_VShift_conflicting = FALSE; - } - GetTexMods(); - } -} - -static void on_hscale_value_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){ - texdef_t* tmp_texdef; - texdef_t* tmp_orig_texdef; - texdef_to_face_t* temp_texdef_face_list; - - texdef_SI_values.scale[0] = gtk_spin_button_get_value( GTK_SPIN_BUTTON( hscale_value_spinbutton ) ); - - if ( !texdef_face_list_empty() && g_bListenChanged ) { - for ( temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next ) - { - tmp_texdef = (texdef_t *) &temp_texdef_face_list->texdef; - tmp_orig_texdef = (texdef_t *) &temp_texdef_face_list->orig_texdef; - tmp_texdef->scale[0] = texdef_SI_values.scale[0] + texdef_offset.scale[0]; - is_HScale_conflicting = FALSE; - } - GetTexMods(); - } -} - -static void on_vscale_value_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){ - texdef_t* tmp_texdef; - texdef_t* tmp_orig_texdef; - texdef_to_face_t* temp_texdef_face_list; - - texdef_SI_values.scale[1] = gtk_spin_button_get_value( GTK_SPIN_BUTTON( vscale_value_spinbutton ) ); - - if ( !texdef_face_list_empty() && g_bListenChanged ) { - for ( temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next ) - { - tmp_texdef = (texdef_t *) &temp_texdef_face_list->texdef; - tmp_orig_texdef = (texdef_t *) &temp_texdef_face_list->orig_texdef; - tmp_texdef->scale[1] = texdef_SI_values.scale[1] + texdef_offset.scale[1]; - is_VScale_conflicting = FALSE; - } - GetTexMods(); - } -} - -static void on_rotate_value_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){ - texdef_t* tmp_texdef; - texdef_t* tmp_orig_texdef; - texdef_to_face_t* temp_texdef_face_list; - - texdef_SI_values.rotate = gtk_spin_button_get_value( GTK_SPIN_BUTTON( rotate_value_spinbutton ) ); - - if ( !texdef_face_list_empty() && g_bListenChanged ) { - for ( temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next ) - { - tmp_texdef = (texdef_t *) &temp_texdef_face_list->texdef; - tmp_orig_texdef = (texdef_t *) &temp_texdef_face_list->orig_texdef; - tmp_texdef->rotate = texdef_SI_values.rotate + texdef_offset.rotate; - is_Rotate_conflicting = FALSE; - } - GetTexMods(); - } -} - - -// Step Spins -static void on_hshift_step_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){ - gfloat val; - GtkAdjustment * adjust; - - if ( !g_bListenChanged ) { - return; - } - - l_pIncrement = Get_SI_Inc(); - -#ifdef DBG_SI - Sys_Printf( "OnIncrementChanged HShift\n" ); -#endif - - val = gtk_spin_button_get_value( GTK_SPIN_BUTTON( hshift_step_spinbutton ) ) ; - adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( hshift_offset_spinbutton ) ); - adjust->step_increment = val; - adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( hshift_value_spinbutton ) ); - adjust->step_increment = val; - l_pIncrement->shift[0] = val; -} - -static void on_vshift_step_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){ - gfloat val; - GtkAdjustment * adjust; - - if ( !g_bListenChanged ) { - return; - } - - l_pIncrement = Get_SI_Inc(); - -#ifdef DBG_SI - Sys_Printf( "OnIncrementChanged VShift\n" ); -#endif - - val = gtk_spin_button_get_value( GTK_SPIN_BUTTON( vshift_step_spinbutton ) ) ; - adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( vshift_offset_spinbutton ) ); - adjust->step_increment = val; - adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( vshift_value_spinbutton ) ); - adjust->step_increment = val; - l_pIncrement->shift[1] = val; -} - -static void on_hscale_step_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){ - gfloat val; - GtkAdjustment * adjust; - - if ( !g_bListenChanged ) { - return; - } - - l_pIncrement = Get_SI_Inc(); - -#ifdef DBG_SI - Sys_Printf( "OnIncrementChanged HShift\n" ); -#endif - - val = gtk_spin_button_get_value( GTK_SPIN_BUTTON( hscale_step_spinbutton ) ) ; - adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( hscale_offset_spinbutton ) ); - adjust->step_increment = val; - adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( hscale_value_spinbutton ) ); - adjust->step_increment = val; - l_pIncrement->scale[0] = val; -} - -static void on_vscale_step_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){ - gfloat val; - GtkAdjustment * adjust; - - if ( !g_bListenChanged ) { - return; - } - - l_pIncrement = Get_SI_Inc(); - -#ifdef DBG_SI - Sys_Printf( "OnIncrementChanged HShift\n" ); -#endif - - val = gtk_spin_button_get_value( GTK_SPIN_BUTTON( vscale_step_spinbutton ) ) ; - adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( vscale_offset_spinbutton ) ); - adjust->step_increment = val; - adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( vscale_value_spinbutton ) ); - adjust->step_increment = val; - l_pIncrement->scale[1] = val; -} - -static void on_rotate_step_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){ - gfloat val; - GtkAdjustment * adjust; - - if ( !g_bListenChanged ) { - return; - } - - l_pIncrement = Get_SI_Inc(); - -#ifdef DBG_SI - Sys_Printf( "OnIncrementChanged HShift\n" ); -#endif - - val = gtk_spin_button_get_value( GTK_SPIN_BUTTON( rotate_step_spinbutton ) ) ; - adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( rotate_offset_spinbutton ) ); - adjust->step_increment = val; - adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( rotate_value_spinbutton ) ); - adjust->step_increment = val; - l_pIncrement->rotate = val; -} - - -// Fit Texture -static void on_fit_width_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){ - m_nWidth = gtk_spin_button_get_value_as_int( GTK_SPIN_BUTTON( fit_width_spinbutton ) ); -} - -static void on_fit_height_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){ - m_nHeight = gtk_spin_button_get_value_as_int( GTK_SPIN_BUTTON( fit_height_spinbutton ) ); -} - -static void on_fit_button_clicked( GtkButton *button, gpointer user_data ){ - FaceList_FitTexture( get_texdef_face_list(), m_nHeight, m_nWidth ); - Sys_UpdateWindows( W_ALL ); -} - - -// Axial Button -static void on_axial_button_clicked( GtkButton *button, gpointer user_data ){ - texdef_t* tmp_texdef; - texdef_to_face_t* temp_texdef_face_list; - - if ( !texdef_face_list_empty() && g_bListenChanged ) { - for ( temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next ) - { - tmp_texdef = (texdef_t *) &temp_texdef_face_list->texdef; - tmp_texdef->shift[0] = 0.0; - tmp_texdef->shift[1] = 0.0; - tmp_texdef->scale[0] = 0.5; - tmp_texdef->scale[1] = 0.5; - tmp_texdef->rotate = 0.0; - } - } - - SetTexdef_FaceList( get_texdef_face_list(), FALSE, TRUE ); - Sys_UpdateWindows( W_ALL ); -} - - -// Action Buttons -static void on_done_button_clicked( GtkButton *button, gpointer user_data ){ - if ( !texdef_face_list_empty() ) { - GetTexMods( TRUE ); - } - HideDlg(); - Sys_UpdateWindows( W_ALL ); -} - -static void on_apply_button_clicked( GtkButton *button, gpointer user_data ){ - if ( !g_bListenChanged ) { - return; - } - - if ( !texdef_face_list_empty() ) { - GetTexMods( TRUE ); - Sys_UpdateWindows( W_CAMERA ); - GetTexdefInfo_from_Radiant(); - SetTexMods(); - } -} - -static void on_cancel_button_clicked( GtkButton *button, gpointer user_data ){ - texturewin = Texturewin(); - texturewin->texdef = g_old_texdef; - // cancel the last do if we own it - if ( ( m_nUndoId == Undo_GetUndoId() ) && ( m_nUndoId != 0 ) ) { -#ifdef DBG_SI - Sys_Printf( "OnCancel calling Undo_Undo\n" ); -#endif - g_bListenUpdate = false; - Undo_Undo( TRUE ); - g_bListenUpdate = true; - m_nUndoId = 0; - } - HideDlg(); -} diff --git a/plugins/surface_heretic2/surfaceflagsdialog_heretic2.cpp b/plugins/surface_heretic2/surfaceflagsdialog_heretic2.cpp deleted file mode 100644 index f18b43e8..00000000 --- a/plugins/surface_heretic2/surfaceflagsdialog_heretic2.cpp +++ /dev/null @@ -1,1459 +0,0 @@ -/* - Copyright (C) 1999-2007 id Software, Inc. and contributors. - For a list of contributors, see the accompanying CONTRIBUTORS file. - - This file is part of GtkRadiant. - - GtkRadiant is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - GtkRadiant is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with GtkRadiant; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include -#include -#include - -#include "surfdlg_plugin.h" - -#include "surfaceflagsdialog_heretic2.h" - -GtkWidget *surface_lightbutton; -GtkWidget *surface_slickbutton; -GtkWidget *surface_skybutton; -GtkWidget *surface_warpbutton; -GtkWidget *surface_trans33button; -GtkWidget *surface_trans66button; -GtkWidget *surface_flowingbutton; -GtkWidget *surface_nodrawbutton; -GtkWidget *surface_tallwallbutton; -GtkWidget *surface_alphatexbutton; -GtkWidget *surface_animspeedbutton; -GtkWidget *surface_undulatebutton; - -GtkWidget *surf_gravel_radiobutton; -GSList *surf_gravel_radiobutton_group = NULL; -GtkWidget *surf_metal_radiobutton; -GtkWidget *surf_stone_radiobutton; -GtkWidget *surf_wood_radiobutton; - -GtkWidget *surf_value_entry; - -GtkWidget *notebook1; - -GtkWidget *content_solidbutton; -GtkWidget *content_windowbutton; -GtkWidget *content_illusbutton; -GtkWidget *content_lavabutton; -GtkWidget *content_slimebutton; -GtkWidget *content_waterbutton; -GtkWidget *content_mistbutton; -GtkWidget *content_areaportalbutton; -GtkWidget *content_playerclipbutton; -GtkWidget *content_monsterclipbutton; -GtkWidget *content_current0button; -GtkWidget *content_current90button; -GtkWidget *content_current180button; -GtkWidget *content_current270button; -GtkWidget *content_currentUPbutton; -GtkWidget *content_currentDOWNbutton; -GtkWidget *content_originbutton; -GtkWidget *content_detailbutton; -GtkWidget *content_ladderbutton; -GtkWidget *content_camnoblockbutton; - - -gboolean setup_buttons = TRUE; - -int working_surface_flags; -int surface_mask; -int working_content_flags; -int content_mask; -int working_value; -gboolean surface_material_inconsistant = FALSE; - -inline void set_inconsistent( GtkWidget *toggle_button ){ - gtk_toggle_button_set_inconsistent( GTK_TOGGLE_BUTTON( toggle_button ), TRUE ); -} - -inline void clear_inconsistent( GtkWidget *toggle_button ){ - if ( gtk_toggle_button_get_inconsistent( GTK_TOGGLE_BUTTON( toggle_button ) ) ) { - gtk_toggle_button_set_inconsistent( GTK_TOGGLE_BUTTON( toggle_button ), FALSE ); - } - -} - -void clear_all_inconsistent( void ){ - clear_inconsistent( surface_lightbutton ); - clear_inconsistent( surface_slickbutton ); - clear_inconsistent( surface_skybutton ); - clear_inconsistent( surface_warpbutton ); - clear_inconsistent( surface_trans33button ); - clear_inconsistent( surface_trans66button ); - clear_inconsistent( surface_flowingbutton ); - clear_inconsistent( surface_nodrawbutton ); - clear_inconsistent( surface_tallwallbutton ); - clear_inconsistent( surface_alphatexbutton ); - clear_inconsistent( surface_animspeedbutton ); - clear_inconsistent( surface_undulatebutton ); - - clear_inconsistent( surf_gravel_radiobutton ); - clear_inconsistent( surf_metal_radiobutton ); - clear_inconsistent( surf_stone_radiobutton ); - clear_inconsistent( surf_wood_radiobutton ); - - clear_inconsistent( content_solidbutton ); - clear_inconsistent( content_windowbutton ); - clear_inconsistent( content_illusbutton ); - clear_inconsistent( content_lavabutton ); - clear_inconsistent( content_slimebutton ); - clear_inconsistent( content_waterbutton ); - clear_inconsistent( content_mistbutton ); - clear_inconsistent( content_areaportalbutton ); - clear_inconsistent( content_playerclipbutton ); - clear_inconsistent( content_monsterclipbutton ); - clear_inconsistent( content_current0button ); - clear_inconsistent( content_current90button ); - clear_inconsistent( content_current180button ); - clear_inconsistent( content_current270button ); - clear_inconsistent( content_currentUPbutton ); - clear_inconsistent( content_currentDOWNbutton ); - clear_inconsistent( content_originbutton ); - clear_inconsistent( content_detailbutton ); - clear_inconsistent( content_ladderbutton ); - clear_inconsistent( content_camnoblockbutton ); -} - -void clear_all_buttons_and_values(){ - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( surface_lightbutton ), FALSE ); - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( surface_slickbutton ), FALSE ); - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( surface_skybutton ), FALSE ); - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( surface_warpbutton ), FALSE ); - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( surface_trans33button ), FALSE ); - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( surface_trans66button ), FALSE ); - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( surface_flowingbutton ), FALSE ); - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( surface_nodrawbutton ), FALSE ); - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( surface_tallwallbutton ), FALSE ); - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( surface_alphatexbutton ), FALSE ); - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( surface_animspeedbutton ), FALSE ); - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( surface_undulatebutton ), FALSE ); - -// surface_material_inconsistant = TRUE; - - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( surf_gravel_radiobutton ), FALSE ); - set_inconsistent( surf_gravel_radiobutton ); - - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( surf_metal_radiobutton ), FALSE ); - set_inconsistent( surf_metal_radiobutton ); - - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( surf_stone_radiobutton ), FALSE ); - set_inconsistent( surf_stone_radiobutton ); - - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( surf_wood_radiobutton ), FALSE ); - set_inconsistent( surf_wood_radiobutton ); - - gtk_entry_set_text( (GtkEntry *)surf_value_entry, "" ); - - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_solidbutton ), FALSE ); - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_windowbutton ), FALSE ); - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_illusbutton ), FALSE ); - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_lavabutton ), FALSE ); - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_slimebutton ), FALSE ); - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_waterbutton ), FALSE ); - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_mistbutton ), FALSE ); - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_areaportalbutton ), FALSE ); - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_playerclipbutton ), FALSE ); - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_monsterclipbutton ), FALSE ); - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_current0button ), FALSE ); - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_current90button ), FALSE ); - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_current180button ), FALSE ); - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_current270button ), FALSE ); - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_currentUPbutton ), FALSE ); - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_currentDOWNbutton ), FALSE ); - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_originbutton ), FALSE ); - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_detailbutton ), FALSE ); - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_ladderbutton ), FALSE ); - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_camnoblockbutton ), FALSE ); - -} - -void SetFlagButtons_Heretic2( texdef_to_face_t *texdef_face_list, bool b_isListEmpty ){ - int contents = 0; - int flags = 0; - int value = 0; - int diff_contents = 0; - int diff_flags = 0; - gboolean diff_value = FALSE; - char tex_buff[11]; - texdef_t* tmp_texdef; - texdef_to_face_t* temp_texdef_face_list; - gboolean surface_which_material_inconsistant[4]; - int surface_iterator; - - setup_buttons = TRUE; - working_surface_flags = 0; - surface_mask = 0; - working_content_flags = 0; - content_mask = 0; - working_value = 0; - surface_material_inconsistant = FALSE; - surface_which_material_inconsistant[0] = FALSE; - surface_which_material_inconsistant[1] = FALSE; - surface_which_material_inconsistant[2] = FALSE; - surface_which_material_inconsistant[3] = FALSE; - - if ( !b_isListEmpty ) { - tmp_texdef = &texdef_face_list->texdef; - contents = tmp_texdef->contents; - flags = tmp_texdef->flags; - value = tmp_texdef->value; - - surface_iterator = ( tmp_texdef->flags & ~HERETIC2_SURF_MATERIAL_MASK ) >> 24; // Inconsistant Material? - surface_which_material_inconsistant[surface_iterator] = TRUE; - - for ( temp_texdef_face_list = texdef_face_list->next; temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next ) - { - tmp_texdef = &temp_texdef_face_list->texdef; - diff_contents |= contents ^ tmp_texdef->contents; // Figure out which buttons are inconsistent - diff_flags |= flags ^ tmp_texdef->flags; - if ( tmp_texdef->value != value ) { - diff_value = TRUE; - } - - surface_iterator = ( tmp_texdef->flags & ~HERETIC2_SURF_MATERIAL_MASK ) >> 24; // Inconsistant Material? - surface_which_material_inconsistant[surface_iterator] = TRUE; - - Sys_Printf( "Diff_Flags: %d\t Surf_Iter: %d\n",diff_flags, surface_iterator ); - - } - } - - - clear_all_inconsistent(); - - // If no faces/brushes are selected, clear everything and bail - if ( b_isListEmpty ) { - clear_all_buttons_and_values(); - setup_buttons = FALSE; - return; - } - - // Set surface buttons to reflect brush/face flags, contents, and values - if ( diff_flags & HERETIC2_SURF_LIGHT ) { - set_inconsistent( surface_lightbutton ); - } - else{ - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( surface_lightbutton ), ( flags & HERETIC2_SURF_LIGHT ) ); - } - - if ( diff_flags & HERETIC2_SURF_SLICK ) { - set_inconsistent( surface_slickbutton ); - } - else if ( flags & HERETIC2_SURF_SLICK ) { - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( surface_slickbutton ), TRUE ); - } - else{ - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( surface_slickbutton ), FALSE ); - } - - if ( diff_flags & HERETIC2_SURF_SKY ) { - set_inconsistent( surface_skybutton ); - } - else if ( flags & HERETIC2_SURF_SKY ) { - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( surface_skybutton ), TRUE ); - } - else{ - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( surface_skybutton ), FALSE ); - } - - if ( diff_flags & HERETIC2_SURF_WARP ) { - set_inconsistent( surface_warpbutton ); - } - else if ( flags & HERETIC2_SURF_WARP ) { - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( surface_warpbutton ), TRUE ); - } - else{ - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( surface_warpbutton ), FALSE ); - } - - if ( diff_flags & HERETIC2_SURF_TRANS33 ) { - set_inconsistent( surface_trans33button ); - } - else if ( flags & HERETIC2_SURF_TRANS33 ) { - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( surface_trans33button ), TRUE ); - } - else{ - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( surface_trans33button ), FALSE ); - } - - if ( diff_flags & HERETIC2_SURF_TRANS66 ) { - set_inconsistent( surface_trans66button ); - } - else if ( flags & HERETIC2_SURF_TRANS66 ) { - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( surface_trans66button ), TRUE ); - } - else{ - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( surface_trans66button ), FALSE ); - } - - if ( diff_flags & HERETIC2_SURF_FLOWING ) { - set_inconsistent( surface_flowingbutton ); - } - else if ( flags & HERETIC2_SURF_FLOWING ) { - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( surface_flowingbutton ), TRUE ); - } - else{ - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( surface_flowingbutton ), FALSE ); - } - - if ( diff_flags & HERETIC2_SURF_NODRAW ) { - set_inconsistent( surface_nodrawbutton ); - } - else if ( flags & HERETIC2_SURF_NODRAW ) { - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( surface_nodrawbutton ), TRUE ); - } - else{ - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( surface_nodrawbutton ), FALSE ); - } - - if ( diff_flags & HERETIC2_SURF_TALL_WALL ) { - set_inconsistent( surface_tallwallbutton ); - } - else if ( flags & HERETIC2_SURF_TALL_WALL ) { - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( surface_tallwallbutton ), TRUE ); - } - else{ - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( surface_tallwallbutton ), FALSE ); - } - - if ( diff_flags & HERETIC2_SURF_ALPHA_TEXTURE ) { - set_inconsistent( surface_alphatexbutton ); - } - else if ( flags & HERETIC2_SURF_ALPHA_TEXTURE ) { - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( surface_alphatexbutton ), TRUE ); - } - else{ - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( surface_alphatexbutton ), FALSE ); - } - - if ( diff_flags & HERETIC2_SURF_ANIMSPEED ) { - set_inconsistent( surface_animspeedbutton ); - } - else if ( flags & HERETIC2_SURF_ANIMSPEED ) { - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( surface_animspeedbutton ), TRUE ); - } - else{ - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( surface_animspeedbutton ), FALSE ); - } - - if ( diff_flags & HERETIC2_SURF_UNDULATE ) { - set_inconsistent( surface_undulatebutton ); - } - else if ( flags & HERETIC2_SURF_UNDULATE ) { - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( surface_undulatebutton ), TRUE ); - } - else{ - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( surface_undulatebutton ), FALSE ); - } - - if ( diff_flags & ~HERETIC2_SURF_MATERIAL_MASK ) { - Sys_Printf( "--> %d\n", ( diff_flags & ~HERETIC2_SURF_MATERIAL_MASK ) ); - Sys_Printf( "%d\t%d\t%d\t%d\n", surface_which_material_inconsistant[0], surface_which_material_inconsistant[1], surface_which_material_inconsistant[2], surface_which_material_inconsistant[3] ); - - if ( surface_which_material_inconsistant[0] ) { - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( surf_gravel_radiobutton ), FALSE ); - surface_material_inconsistant = TRUE; - set_inconsistent( surf_gravel_radiobutton ); - } - if ( surface_which_material_inconsistant[1] ) { - //if (!surface_material_inconsistant) - //{ - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( surf_metal_radiobutton ), FALSE ); - surface_material_inconsistant = TRUE; - //} - set_inconsistent( surf_metal_radiobutton ); - } - if ( surface_which_material_inconsistant[2] ) { - //if (!surface_material_inconsistant) - //{ - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( surf_stone_radiobutton ), FALSE ); - surface_material_inconsistant = TRUE; - //} - set_inconsistent( surf_stone_radiobutton ); - } - if ( surface_which_material_inconsistant[3] ) { - //if (!surface_material_inconsistant) - //{ - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( surf_wood_radiobutton ), FALSE ); - surface_material_inconsistant = TRUE; - //} - set_inconsistent( surf_wood_radiobutton ); - } - } - else - { - if ( flags & ~HERETIC2_SURF_MATERIAL_MASK ) { - surface_iterator = ( flags & ~HERETIC2_SURF_MATERIAL_MASK ) >> 24; - if ( surface_iterator == 1 ) { - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( surf_metal_radiobutton ), TRUE ); - } - else if ( surface_iterator == 2 ) { - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( surf_stone_radiobutton ), TRUE ); - } - else if ( surface_iterator == 3 ) { - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( surf_wood_radiobutton ), TRUE ); - } - } - else - { - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( surf_gravel_radiobutton ), TRUE ); - } - } - - // Set content buttons to reflect brush values - if ( diff_contents & HERETIC2_CONTENTS_SOLID ) { - set_inconsistent( content_solidbutton ); - } - else if ( contents & HERETIC2_CONTENTS_SOLID ) { - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_solidbutton ), TRUE ); - } - else{ - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_solidbutton ), FALSE ); - } - - if ( diff_contents & HERETIC2_CONTENTS_WINDOW ) { - set_inconsistent( content_windowbutton ); - } - else if ( contents & HERETIC2_CONTENTS_WINDOW ) { - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_windowbutton ), TRUE ); - } - else{ - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_windowbutton ), FALSE ); - } - - if ( diff_contents & HERETIC2_CONTENTS_ILLUSIONARY ) { - set_inconsistent( content_illusbutton ); - } - else if ( contents & HERETIC2_CONTENTS_ILLUSIONARY ) { - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_illusbutton ), TRUE ); - } - else{ - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_illusbutton ), FALSE ); - } - - if ( diff_contents & HERETIC2_CONTENTS_LAVA ) { - set_inconsistent( content_lavabutton ); - } - else if ( contents & HERETIC2_CONTENTS_LAVA ) { - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_lavabutton ), TRUE ); - } - else{ - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_lavabutton ), FALSE ); - } - - if ( diff_contents & HERETIC2_CONTENTS_SLIME ) { - set_inconsistent( content_slimebutton ); - } - else if ( contents & HERETIC2_CONTENTS_SLIME ) { - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_slimebutton ), TRUE ); - } - else{ - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_slimebutton ), FALSE ); - } - - if ( diff_contents & HERETIC2_CONTENTS_WATER ) { - set_inconsistent( content_waterbutton ); - } - else if ( contents & HERETIC2_CONTENTS_WATER ) { - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_waterbutton ), TRUE ); - } - else{ - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_waterbutton ), FALSE ); - } - - if ( diff_contents & HERETIC2_CONTENTS_MIST ) { - set_inconsistent( content_mistbutton ); - } - else if ( contents & HERETIC2_CONTENTS_MIST ) { - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_mistbutton ), TRUE ); - } - else{ - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_mistbutton ), FALSE ); - } - - if ( diff_contents & HERETIC2_CONTENTS_AREAPORTAL ) { - set_inconsistent( content_areaportalbutton ); - } - else if ( contents & HERETIC2_CONTENTS_AREAPORTAL ) { - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_areaportalbutton ), TRUE ); - } - else{ - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_areaportalbutton ), FALSE ); - } - - if ( diff_contents & HERETIC2_CONTENTS_PLAYERCLIP ) { - set_inconsistent( content_playerclipbutton ); - } - else if ( contents & HERETIC2_CONTENTS_PLAYERCLIP ) { - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_playerclipbutton ), TRUE ); - } - else{ - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_playerclipbutton ), FALSE ); - } - - if ( diff_contents & HERETIC2_CONTENTS_MONSTERCLIP ) { - set_inconsistent( content_monsterclipbutton ); - } - else if ( contents & HERETIC2_CONTENTS_MONSTERCLIP ) { - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_monsterclipbutton ), TRUE ); - } - else{ - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_monsterclipbutton ), FALSE ); - } - - if ( diff_contents & HERETIC2_CONTENTS_CURRENT_0 ) { - set_inconsistent( content_current0button ); - } - else if ( contents & HERETIC2_CONTENTS_CURRENT_0 ) { - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_current0button ), TRUE ); - } - else{ - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_current0button ), FALSE ); - } - - if ( diff_contents & HERETIC2_CONTENTS_CURRENT_90 ) { - set_inconsistent( content_current90button ); - } - else if ( contents & HERETIC2_CONTENTS_CURRENT_90 ) { - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_current90button ), TRUE ); - } - else{ - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_current90button ), FALSE ); - } - - if ( diff_contents & HERETIC2_CONTENTS_CURRENT_180 ) { - set_inconsistent( content_current180button ); - } - else if ( contents & HERETIC2_CONTENTS_CURRENT_180 ) { - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_current180button ), TRUE ); - } - else{ - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_current180button ), FALSE ); - } - - if ( diff_contents & HERETIC2_CONTENTS_CURRENT_270 ) { - set_inconsistent( content_current270button ); - } - else if ( contents & HERETIC2_CONTENTS_CURRENT_270 ) { - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_current270button ), TRUE ); - } - else{ - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_current270button ), FALSE ); - } - - if ( diff_contents & HERETIC2_CONTENTS_CURRENT_UP ) { - set_inconsistent( content_currentUPbutton ); - } - else if ( contents & HERETIC2_CONTENTS_CURRENT_UP ) { - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_currentUPbutton ), TRUE ); - } - else{ - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_currentUPbutton ), FALSE ); - } - - if ( diff_contents & HERETIC2_CONTENTS_CURRENT_DOWN ) { - set_inconsistent( content_currentDOWNbutton ); - } - else if ( contents & HERETIC2_CONTENTS_CURRENT_DOWN ) { - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_currentDOWNbutton ), TRUE ); - } - else{ - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_currentDOWNbutton ), FALSE ); - } - - if ( diff_contents & HERETIC2_CONTENTS_ORIGIN ) { - set_inconsistent( content_originbutton ); - } - else if ( contents & HERETIC2_CONTENTS_ORIGIN ) { - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_originbutton ), TRUE ); - } - else{ - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_originbutton ), FALSE ); - } - - if ( diff_contents & HERETIC2_CONTENTS_DETAIL ) { - set_inconsistent( content_detailbutton ); - } - else if ( contents & HERETIC2_CONTENTS_DETAIL ) { - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_detailbutton ), TRUE ); - } - else{ - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_detailbutton ), FALSE ); - } - - if ( diff_contents & HERETIC2_CONTENTS_LADDER ) { - set_inconsistent( content_ladderbutton ); - } - else if ( contents & HERETIC2_CONTENTS_LADDER ) { - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_ladderbutton ), TRUE ); - } - else{ - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_ladderbutton ), FALSE ); - } - - if ( diff_contents & HERETIC2_CONTENTS_CAMERANOBLOCK ) { - set_inconsistent( content_camnoblockbutton ); - } - else if ( contents & HERETIC2_CONTENTS_CAMERANOBLOCK ) { - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_camnoblockbutton ), TRUE ); - } - else{ - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_camnoblockbutton ), FALSE ); - } - - // Set Value - if ( diff_value ) { - gtk_entry_set_text( (GtkEntry *)surf_value_entry, "" ); - } - else - { - working_value = value; - sprintf( tex_buff, "%d", value ); - gtk_entry_set_text( (GtkEntry *)surf_value_entry, tex_buff ); - } - - setup_buttons = FALSE; -} - -void SetChangeInFlags_Face_Heretic2( texdef_to_face_t *texdef_face_list ){ - texdef_to_face_t *temp_texdef_face_list; - texdef_t *tmp_texdef; - - for ( temp_texdef_face_list = texdef_face_list; temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next ) - { - tmp_texdef = &temp_texdef_face_list->texdef; - tmp_texdef->flags = ( tmp_texdef->flags & ~surface_mask ) | working_surface_flags; - tmp_texdef->contents = ( tmp_texdef->contents & ~content_mask ) | working_content_flags; - tmp_texdef->value = working_value; - Sys_Printf( "content_flag: %d content_mask: %d\n",working_content_flags,content_mask ); - Sys_Printf( "content: %d\n",tmp_texdef->contents ); - } -} - -inline void change_surfaceflag( GtkWidget *togglebutton, int sur_flag ){ // For Material - if ( !setup_buttons ) { // If we're setting up the buttons, we really don't need to - // set flags that are already set - if ( surface_material_inconsistant ) { - clear_inconsistent( surf_gravel_radiobutton ); - clear_inconsistent( surf_metal_radiobutton ); - clear_inconsistent( surf_stone_radiobutton ); - clear_inconsistent( surf_wood_radiobutton ); - } - surface_mask |= ~HERETIC2_SURF_MATERIAL_MASK; - working_surface_flags = ( working_surface_flags & HERETIC2_SURF_MATERIAL_MASK ) | sur_flag; - } -} - -inline void change_material( GtkWidget *togglebutton ){ - if ( !setup_buttons ) { // If we're setting up the buttons, we really don't need to - // set flags that are already set - if ( surface_material_inconsistant ) { - clear_inconsistent( surf_gravel_radiobutton ); - clear_inconsistent( surf_metal_radiobutton ); - clear_inconsistent( surf_stone_radiobutton ); - clear_inconsistent( surf_wood_radiobutton ); - } - if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( surf_gravel_radiobutton ) ) ) { - surface_mask |= ~HERETIC2_SURF_MATERIAL_MASK; - working_surface_flags = ( working_surface_flags & HERETIC2_SURF_MATERIAL_MASK ) | HERETIC2_SURF_TYPE_GRAVEL; - } - else if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( surf_metal_radiobutton ) ) ) { - surface_mask |= ~HERETIC2_SURF_MATERIAL_MASK; - working_surface_flags = ( working_surface_flags & HERETIC2_SURF_MATERIAL_MASK ) | HERETIC2_SURF_TYPE_METAL; - } - else if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( surf_stone_radiobutton ) ) ) { - surface_mask |= ~HERETIC2_SURF_MATERIAL_MASK; - working_surface_flags = ( working_surface_flags & HERETIC2_SURF_MATERIAL_MASK ) | HERETIC2_SURF_TYPE_STONE; - } - else if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( surf_wood_radiobutton ) ) ) { - surface_mask |= ~HERETIC2_SURF_MATERIAL_MASK; - working_surface_flags = ( working_surface_flags & HERETIC2_SURF_MATERIAL_MASK ) | HERETIC2_SURF_TYPE_WOOD; - } - } -} - -inline void change_surfaceflag( GtkWidget *togglebutton, int sur_flag, gboolean change_flag_to ){ - - if ( !setup_buttons ) { // If we're setting up the buttons, we really don't need to - // set flags that are already set - if ( gtk_toggle_button_get_inconsistent( GTK_TOGGLE_BUTTON( togglebutton ) ) ) { // Clear out inconsistent, if set - clear_inconsistent( GTK_WIDGET( togglebutton ) ); - } - - surface_mask |= sur_flag; - - if ( change_flag_to ) { - working_surface_flags |= sur_flag; - } - else{ - working_surface_flags &= ~sur_flag; - } - } -} - -inline void change_contentflag( GtkWidget *togglebutton, int content_flag, gboolean change_flag_to ){ - - if ( ( !setup_buttons ) ) { // If we're setting up the buttons, we really don't need to - // set flags that are already set - - if ( gtk_toggle_button_get_inconsistent( GTK_TOGGLE_BUTTON( togglebutton ) ) ) { - clear_inconsistent( togglebutton ); - } - //if (g_ptrSelectedFaces.GetSize() == 0) // Only changing content flags on whole brushes, not faces. - //{ - content_mask |= content_flag; - - if ( change_flag_to ) { - working_content_flags |= content_flag; - } - else{ - working_content_flags &= ~content_flag; - } - //} - } -} - -// Surface Flags Callbacks -void -on_surface_lightbutton_toggled( GtkToggleButton *togglebutton, - gpointer user_data ){ - change_surfaceflag( surface_lightbutton, HERETIC2_SURF_LIGHT, ( GTK_TOGGLE_BUTTON( surface_lightbutton )->active ) ); -} - - -void -on_surface_slickbutton_toggled( GtkToggleButton *togglebutton, - gpointer user_data ){ - change_surfaceflag( surface_slickbutton, HERETIC2_SURF_SLICK, ( GTK_TOGGLE_BUTTON( surface_slickbutton )->active ) ); -} - - -void -on_surface_skybutton_toggled( GtkToggleButton *togglebutton, - gpointer user_data ){ - change_surfaceflag( surface_skybutton, HERETIC2_SURF_SKY, ( GTK_TOGGLE_BUTTON( surface_skybutton )->active ) ); -} - - -void -on_surface_warpbutton_toggled( GtkToggleButton *togglebutton, - gpointer user_data ){ - change_surfaceflag( surface_warpbutton, HERETIC2_SURF_WARP, ( GTK_TOGGLE_BUTTON( surface_warpbutton )->active ) ); -} - - -void -on_surface_trans33button_toggled( GtkToggleButton *togglebutton, - gpointer user_data ){ - change_surfaceflag( surface_trans33button, HERETIC2_SURF_TRANS33, ( GTK_TOGGLE_BUTTON( surface_trans33button )->active ) ); -} - - -void -on_surface_trans66button_toggled( GtkToggleButton *togglebutton, - gpointer user_data ){ - change_surfaceflag( surface_trans66button, HERETIC2_SURF_TRANS66, ( GTK_TOGGLE_BUTTON( surface_trans66button )->active ) ); -} - - -void -on_surface_flowingbutton_toggled( GtkToggleButton *togglebutton, - gpointer user_data ){ - change_surfaceflag( surface_flowingbutton, HERETIC2_SURF_FLOWING, ( GTK_TOGGLE_BUTTON( surface_flowingbutton )->active ) ); -} - - -void -on_surface_nodrawbutton_toggled( GtkToggleButton *togglebutton, - gpointer user_data ){ - change_surfaceflag( surface_nodrawbutton, HERETIC2_SURF_NODRAW, ( GTK_TOGGLE_BUTTON( surface_nodrawbutton )->active ) ); -} - - -void -on_surface_tallwallbutton_toggled( GtkToggleButton *togglebutton, - gpointer user_data ){ - change_surfaceflag( surface_tallwallbutton, HERETIC2_SURF_TALL_WALL, ( GTK_TOGGLE_BUTTON( surface_tallwallbutton )->active ) ); -} - - -void -on_surface_alphatexbutton_toggled( GtkToggleButton *togglebutton, - gpointer user_data ){ - change_surfaceflag( surface_alphatexbutton, HERETIC2_SURF_ALPHA_TEXTURE, ( GTK_TOGGLE_BUTTON( surface_alphatexbutton )->active ) ); -} - - -void -on_surface_animspeedbutton_toggled( GtkToggleButton *togglebutton, - gpointer user_data ){ - change_surfaceflag( surface_animspeedbutton, HERETIC2_SURF_ANIMSPEED, ( GTK_TOGGLE_BUTTON( surface_animspeedbutton )->active ) ); -} - - -void -on_surface_undulatebutton_toggled( GtkToggleButton *togglebutton, - gpointer user_data ){ - change_surfaceflag( surface_undulatebutton, HERETIC2_SURF_UNDULATE, ( GTK_TOGGLE_BUTTON( surface_undulatebutton )->active ) ); -} - - -void -on_surf_gravel_radiobutton_toggled( GtkToggleButton *togglebutton, - gpointer user_data ){ - if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( surf_gravel_radiobutton ) ) ) { - change_material( GTK_WIDGET( togglebutton ) ); - } -} - -void -on_surf_metal_radiobutton_toggled( GtkToggleButton *togglebutton, - gpointer user_data ){ - if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( surf_metal_radiobutton ) ) ) { - change_material( GTK_WIDGET( togglebutton ) ); - } -} - -void -on_surf_stone_radiobutton_toggled( GtkToggleButton *togglebutton, - gpointer user_data ){ - if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( surf_stone_radiobutton ) ) ) { - change_material( GTK_WIDGET( togglebutton ) ); - } -} - -void -on_surf_wood_radiobutton_toggled( GtkToggleButton *togglebutton, - gpointer user_data ){ - if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( surf_wood_radiobutton ) ) ) { - change_material( GTK_WIDGET( togglebutton ) ); - } -} - -// Content Flags Callbacks -void -on_content_solidbutton_toggled( GtkToggleButton *togglebutton, - gpointer user_data ){ - change_contentflag( content_solidbutton, HERETIC2_CONTENTS_SOLID, ( GTK_TOGGLE_BUTTON( content_solidbutton )->active ) ); -} - - -void -on_content_windowbutton_toggled( GtkToggleButton *togglebutton, - gpointer user_data ){ - change_contentflag( content_windowbutton, HERETIC2_CONTENTS_WINDOW, ( GTK_TOGGLE_BUTTON( content_windowbutton )->active ) ); -} - - -void -on_content_illusbutton_toggled( GtkToggleButton *togglebutton, - gpointer user_data ){ - change_contentflag( content_illusbutton, HERETIC2_CONTENTS_ILLUSIONARY, ( GTK_TOGGLE_BUTTON( content_illusbutton )->active ) ); -} - - -void -on_content_lavabutton_toggled( GtkToggleButton *togglebutton, - gpointer user_data ){ - change_contentflag( content_lavabutton, HERETIC2_CONTENTS_LAVA, ( GTK_TOGGLE_BUTTON( content_lavabutton )->active ) ); -} - - -void -on_content_slimebutton_toggled( GtkToggleButton *togglebutton, - gpointer user_data ){ - change_contentflag( content_slimebutton, HERETIC2_CONTENTS_SLIME, ( GTK_TOGGLE_BUTTON( content_slimebutton )->active ) ); -} - - -void -on_content_waterbutton_toggled( GtkToggleButton *togglebutton, - gpointer user_data ){ - change_contentflag( content_waterbutton, HERETIC2_CONTENTS_WATER, ( GTK_TOGGLE_BUTTON( content_waterbutton )->active ) ); -} - - -void -on_content_mistbutton_toggled( GtkToggleButton *togglebutton, - gpointer user_data ){ - change_contentflag( content_mistbutton, HERETIC2_CONTENTS_MIST, ( GTK_TOGGLE_BUTTON( content_mistbutton )->active ) ); -} - - -void -on_content_areaportalbutton_toggled( GtkToggleButton *togglebutton, - gpointer user_data ){ - change_contentflag( content_areaportalbutton, HERETIC2_CONTENTS_AREAPORTAL, ( GTK_TOGGLE_BUTTON( content_areaportalbutton )->active ) ); -} - - -void -on_content_playerclipbutton_toggled( GtkToggleButton *togglebutton, - gpointer user_data ){ - change_contentflag( content_playerclipbutton, HERETIC2_CONTENTS_PLAYERCLIP, ( GTK_TOGGLE_BUTTON( content_playerclipbutton )->active ) ); -} - - -void -on_content_monsterclipbutton_toggled( GtkToggleButton *togglebutton, - gpointer user_data ){ - change_contentflag( content_monsterclipbutton, HERETIC2_CONTENTS_MONSTERCLIP, ( GTK_TOGGLE_BUTTON( content_monsterclipbutton )->active ) ); -} - - -void -on_content_current0button_toggled( GtkToggleButton *togglebutton, - gpointer user_data ){ - change_contentflag( content_current0button, HERETIC2_CONTENTS_CURRENT_0, ( GTK_TOGGLE_BUTTON( content_current0button )->active ) ); -} - - -void -on_content_current90button_toggled( GtkToggleButton *togglebutton, - gpointer user_data ){ - change_contentflag( content_current90button, HERETIC2_CONTENTS_CURRENT_90, ( GTK_TOGGLE_BUTTON( content_current90button )->active ) ); -} - - -void -on_content_current180button_toggled( GtkToggleButton *togglebutton, - gpointer user_data ){ - change_contentflag( content_current180button, HERETIC2_CONTENTS_CURRENT_180, ( GTK_TOGGLE_BUTTON( content_current180button )->active ) ); -} - - -void -on_content_current270button_toggled( GtkToggleButton *togglebutton, - gpointer user_data ){ - change_contentflag( content_current270button, HERETIC2_CONTENTS_CURRENT_270, ( GTK_TOGGLE_BUTTON( content_current270button )->active ) ); -} - - -void -on_content_currentUPbutton_toggled( GtkToggleButton *togglebutton, - gpointer user_data ){ - change_contentflag( content_currentUPbutton, HERETIC2_CONTENTS_CURRENT_UP, ( GTK_TOGGLE_BUTTON( content_currentUPbutton )->active ) ); -} - - -void -on_content_currentDOWNbutton_toggled( GtkToggleButton *togglebutton, - gpointer user_data ){ - change_contentflag( content_currentDOWNbutton, HERETIC2_CONTENTS_CURRENT_DOWN, ( GTK_TOGGLE_BUTTON( content_currentDOWNbutton )->active ) ); -} - - -void -on_content_originbutton_toggled( GtkToggleButton *togglebutton, - gpointer user_data ){ - change_contentflag( content_originbutton, HERETIC2_CONTENTS_ORIGIN, ( GTK_TOGGLE_BUTTON( content_originbutton )->active ) ); -} - - -void -on_content_detailbutton_toggled( GtkToggleButton *togglebutton, - gpointer user_data ){ - change_contentflag( content_detailbutton, HERETIC2_CONTENTS_DETAIL, ( GTK_TOGGLE_BUTTON( content_detailbutton )->active ) ); -} - - -void -on_content_ladderbutton_toggled( GtkToggleButton *togglebutton, - gpointer user_data ){ - change_contentflag( content_ladderbutton, HERETIC2_CONTENTS_LADDER, ( GTK_TOGGLE_BUTTON( content_ladderbutton )->active ) ); -} - - -void -on_content_camnoblockbutton_toggled( GtkToggleButton *togglebutton, - gpointer user_data ){ - change_contentflag( content_camnoblockbutton, HERETIC2_CONTENTS_CAMERANOBLOCK, ( GTK_TOGGLE_BUTTON( content_camnoblockbutton )->active ) ); -} - -// Value Entry Callback -void -on_surf_value_entry_changed( GtkEditable *editable, - gpointer user_data ){ - if ( ( !setup_buttons ) ) { // If we're setting up the buttons, don't change value - working_value = atoi( gtk_entry_get_text( (GtkEntry*)editable ) ); - } -} - -void -on_surf_value_entry_insert_text( GtkEditable *editable, - gchar *new_text, - gint new_text_length, - gint *position, - gpointer user_data ){ - int i, count = 0; - gchar *result; - - // Limit input to digits, throwing out anything else - // Modified from Gtk FAQ for text filtering of GtkEntry - result = g_new( gchar, new_text_length ); - - for ( i = 0; i < new_text_length; i++ ) { - if ( !isdigit( new_text[i] ) ) { - continue; - } - result[count++] = new_text[i]; - } - - if ( count > 0 ) { - gtk_signal_handler_block_by_func( GTK_OBJECT( editable ), - GTK_SIGNAL_FUNC( on_surf_value_entry_insert_text ), - user_data ); - gtk_editable_insert_text( editable, result, count, position ); - gtk_signal_handler_unblock_by_func( GTK_OBJECT( editable ), - GTK_SIGNAL_FUNC( on_surf_value_entry_insert_text ), - user_data ); - } - gtk_signal_emit_stop_by_name( GTK_OBJECT( editable ), "insert_text" ); - - g_free( result ); -} - -#define HERETIC2_FLAG_BUTTON_BORDER 3 - -GtkWidget* Create_Heretic2FlagsDialog( GtkWidget* surfacedialog_widget ){ - GtkWidget *frame1; - GtkWidget *notebook1; - GtkWidget *vbox3; - GtkWidget *table1; - GtkWidget *frame2; - GtkWidget *hbox4; - GtkWidget *label4; - GtkWidget *table3; - GtkWidget *label5; - - GtkWidget *hbox1; - GtkWidget *hbox2; - GtkWidget *label2; - GtkWidget *table2; - GtkWidget *label3; - - - frame1 = gtk_frame_new( _( "Brush/Face Flags" ) ); - gtk_widget_show( frame1 ); - gtk_container_add( GTK_CONTAINER( surfacedialog_widget ), frame1 ); - - notebook1 = gtk_notebook_new(); - gtk_widget_show( notebook1 ); - gtk_container_add( GTK_CONTAINER( frame1 ), notebook1 ); - - vbox3 = gtk_vbox_new( FALSE, 0 ); - gtk_widget_show( vbox3 ); - gtk_container_add( GTK_CONTAINER( notebook1 ), vbox3 ); - - table1 = gtk_table_new( 3, 4, TRUE ); - gtk_widget_show( table1 ); - gtk_box_pack_start( GTK_BOX( vbox3 ), table1, TRUE, TRUE, 0 ); - - surface_lightbutton = gtk_toggle_button_new_with_mnemonic( _( "Light" ) ); - gtk_widget_show( surface_lightbutton ); - gtk_table_attach( GTK_TABLE( table1 ), surface_lightbutton, 0, 1, 0, 1, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); - - surface_slickbutton = gtk_toggle_button_new_with_mnemonic( _( "Slick" ) ); - gtk_widget_show( surface_slickbutton ); - gtk_table_attach( GTK_TABLE( table1 ), surface_slickbutton, 1, 2, 0, 1, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); - - surface_skybutton = gtk_toggle_button_new_with_mnemonic( _( "Sky" ) ); - gtk_widget_show( surface_skybutton ); - gtk_table_attach( GTK_TABLE( table1 ), surface_skybutton, 2, 3, 0, 1, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); - - surface_warpbutton = gtk_toggle_button_new_with_mnemonic( _( "Warp" ) ); - gtk_widget_show( surface_warpbutton ); - gtk_table_attach( GTK_TABLE( table1 ), surface_warpbutton, 3, 4, 0, 1, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); - - surface_trans33button = gtk_toggle_button_new_with_mnemonic( _( "Trans33" ) ); - gtk_widget_show( surface_trans33button ); - gtk_table_attach( GTK_TABLE( table1 ), surface_trans33button, 0, 1, 1, 2, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); - - surface_trans66button = gtk_toggle_button_new_with_mnemonic( _( "Trans66" ) ); - gtk_widget_show( surface_trans66button ); - gtk_table_attach( GTK_TABLE( table1 ), surface_trans66button, 1, 2, 1, 2, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); - - surface_flowingbutton = gtk_toggle_button_new_with_mnemonic( _( "Flowing" ) ); - gtk_widget_show( surface_flowingbutton ); - gtk_table_attach( GTK_TABLE( table1 ), surface_flowingbutton, 2, 3, 1, 2, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); - - surface_nodrawbutton = gtk_toggle_button_new_with_mnemonic( _( "NoDraw" ) ); - gtk_widget_show( surface_nodrawbutton ); - gtk_table_attach( GTK_TABLE( table1 ), surface_nodrawbutton, 3, 4, 1, 2, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); - - surface_tallwallbutton = gtk_toggle_button_new_with_mnemonic( _( "TallWall" ) ); - gtk_widget_show( surface_tallwallbutton ); - gtk_table_attach( GTK_TABLE( table1 ), surface_tallwallbutton, 0, 1, 2, 3, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); - - surface_alphatexbutton = gtk_toggle_button_new_with_mnemonic( _( "AlphaTex" ) ); - gtk_widget_show( surface_alphatexbutton ); - gtk_table_attach( GTK_TABLE( table1 ), surface_alphatexbutton, 1, 2, 2, 3, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); - - surface_animspeedbutton = gtk_toggle_button_new_with_mnemonic( _( "AnimSpeed" ) ); - gtk_widget_show( surface_animspeedbutton ); - gtk_table_attach( GTK_TABLE( table1 ), surface_animspeedbutton, 2, 3, 2, 3, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); - - surface_undulatebutton = gtk_toggle_button_new_with_mnemonic( _( "Undulate" ) ); - gtk_widget_show( surface_undulatebutton ); - gtk_table_attach( GTK_TABLE( table1 ), surface_undulatebutton, 3, 4, 2, 3, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); - - frame2 = gtk_frame_new( NULL ); - gtk_widget_show( frame2 ); - gtk_box_pack_start( GTK_BOX( vbox3 ), frame2, FALSE, FALSE, 0 ); - gtk_frame_set_shadow_type( GTK_FRAME( frame2 ), GTK_SHADOW_ETCHED_OUT ); - gtk_container_set_border_width( GTK_CONTAINER( frame2 ), 4 ); - - hbox4 = gtk_hbox_new( FALSE, 0 ); - gtk_widget_show( hbox4 ); - gtk_container_add( GTK_CONTAINER( frame2 ), hbox4 ); - - surf_gravel_radiobutton = gtk_radio_button_new_with_mnemonic( NULL, _( "Gravel" ) ); - gtk_widget_show( surf_gravel_radiobutton ); - gtk_box_pack_start( GTK_BOX( hbox4 ), surf_gravel_radiobutton, TRUE, FALSE, 0 ); - - surf_metal_radiobutton = gtk_radio_button_new_with_mnemonic_from_widget( GTK_RADIO_BUTTON( surf_gravel_radiobutton ), _( "Metal" ) ); - gtk_widget_show( surf_metal_radiobutton ); - gtk_box_pack_start( GTK_BOX( hbox4 ), surf_metal_radiobutton, TRUE, FALSE, 0 ); - - surf_stone_radiobutton = gtk_radio_button_new_with_mnemonic_from_widget( GTK_RADIO_BUTTON( surf_metal_radiobutton ), _( "Stone" ) ); - gtk_widget_show( surf_stone_radiobutton ); - gtk_box_pack_start( GTK_BOX( hbox4 ), surf_stone_radiobutton, TRUE, FALSE, 0 ); - - surf_wood_radiobutton = gtk_radio_button_new_with_mnemonic_from_widget( GTK_RADIO_BUTTON( surf_stone_radiobutton ), _( "Wood" ) ); - gtk_widget_show( surf_wood_radiobutton ); - gtk_box_pack_start( GTK_BOX( hbox4 ), surf_wood_radiobutton, TRUE, FALSE, 0 ); - - label4 = gtk_label_new( _( "Material" ) ); - gtk_widget_show( label4 ); - gtk_frame_set_label_widget( GTK_FRAME( frame2 ), label4 ); - gtk_label_set_justify( GTK_LABEL( label4 ), GTK_JUSTIFY_LEFT ); - - table3 = gtk_table_new( 1, 4, FALSE ); - gtk_widget_show( table3 ); - gtk_box_pack_start( GTK_BOX( vbox3 ), table3, FALSE, FALSE, 0 ); - gtk_container_set_border_width( GTK_CONTAINER( table3 ), 3 ); - - hbox1 = gtk_hbox_new( FALSE, 0 ); - gtk_widget_show( hbox1 ); - gtk_table_attach( GTK_TABLE( table3 ), hbox1, 0, 1, 0, 1, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - label5 = gtk_label_new( _( "Value: " ) ); - gtk_widget_show( label5 ); - gtk_table_attach( GTK_TABLE( table3 ), label5, 1, 2, 0, 1, - (GtkAttachOptions) ( 0 ), - (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_misc_set_alignment( GTK_MISC( label5 ), 0, 0 ); - gtk_label_set_justify( GTK_LABEL( label5 ), GTK_JUSTIFY_RIGHT ); - - surf_value_entry = gtk_entry_new(); - gtk_widget_show( surf_value_entry ); - gtk_table_attach( GTK_TABLE( table3 ), surf_value_entry, 2, 3, 0, 1, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); - - hbox2 = gtk_hbox_new( FALSE, 0 ); - gtk_widget_show( hbox2 ); - gtk_table_attach( GTK_TABLE( table3 ), hbox2, 3, 4, 0, 1, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - label2 = gtk_label_new( _( "Surface Flags" ) ); - gtk_widget_show( label2 ); - gtk_notebook_set_tab_label( GTK_NOTEBOOK( notebook1 ), gtk_notebook_get_nth_page( GTK_NOTEBOOK( notebook1 ), 0 ), label2 ); - gtk_label_set_justify( GTK_LABEL( label2 ), GTK_JUSTIFY_LEFT ); - - table2 = gtk_table_new( 5, 4, TRUE ); - gtk_widget_show( table2 ); - gtk_container_add( GTK_CONTAINER( notebook1 ), table2 ); - - content_solidbutton = gtk_toggle_button_new_with_mnemonic( _( "Solid" ) ); - gtk_widget_show( content_solidbutton ); - gtk_table_attach( GTK_TABLE( table2 ), content_solidbutton, 0, 1, 0, 1, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); - - content_windowbutton = gtk_toggle_button_new_with_mnemonic( _( "Window" ) ); - gtk_widget_show( content_windowbutton ); - gtk_table_attach( GTK_TABLE( table2 ), content_windowbutton, 1, 2, 0, 1, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); - - content_illusbutton = gtk_toggle_button_new_with_mnemonic( _( "Illusion" ) ); - gtk_widget_show( content_illusbutton ); - gtk_table_attach( GTK_TABLE( table2 ), content_illusbutton, 2, 3, 0, 1, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); - - content_lavabutton = gtk_toggle_button_new_with_mnemonic( _( "Lava" ) ); - gtk_widget_show( content_lavabutton ); - gtk_table_attach( GTK_TABLE( table2 ), content_lavabutton, 3, 4, 0, 1, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); - - content_slimebutton = gtk_toggle_button_new_with_mnemonic( _( "Slime" ) ); - gtk_widget_show( content_slimebutton ); - gtk_table_attach( GTK_TABLE( table2 ), content_slimebutton, 0, 1, 1, 2, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); - - content_waterbutton = gtk_toggle_button_new_with_mnemonic( _( "Water" ) ); - gtk_widget_show( content_waterbutton ); - gtk_table_attach( GTK_TABLE( table2 ), content_waterbutton, 1, 2, 1, 2, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); - - content_mistbutton = gtk_toggle_button_new_with_mnemonic( _( "Mist" ) ); - gtk_widget_show( content_mistbutton ); - gtk_table_attach( GTK_TABLE( table2 ), content_mistbutton, 2, 3, 1, 2, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); - - content_areaportalbutton = gtk_toggle_button_new_with_mnemonic( _( "AreaPortal" ) ); - gtk_widget_show( content_areaportalbutton ); - gtk_table_attach( GTK_TABLE( table2 ), content_areaportalbutton, 3, 4, 1, 2, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); - - content_playerclipbutton = gtk_toggle_button_new_with_mnemonic( _( "PlayerClip" ) ); - gtk_widget_show( content_playerclipbutton ); - gtk_table_attach( GTK_TABLE( table2 ), content_playerclipbutton, 0, 1, 2, 3, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); - - content_monsterclipbutton = gtk_toggle_button_new_with_mnemonic( _( "MonsterClip" ) ); - gtk_widget_show( content_monsterclipbutton ); - gtk_table_attach( GTK_TABLE( table2 ), content_monsterclipbutton, 1, 2, 2, 3, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); - - content_current0button = gtk_toggle_button_new_with_mnemonic( _( "Current 0" ) ); - gtk_widget_show( content_current0button ); - gtk_table_attach( GTK_TABLE( table2 ), content_current0button, 2, 3, 2, 3, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); - - content_current90button = gtk_toggle_button_new_with_mnemonic( _( "Current 90" ) ); - gtk_widget_show( content_current90button ); - gtk_table_attach( GTK_TABLE( table2 ), content_current90button, 3, 4, 2, 3, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); - - content_current180button = gtk_toggle_button_new_with_mnemonic( _( "Current 180" ) ); - gtk_widget_show( content_current180button ); - gtk_table_attach( GTK_TABLE( table2 ), content_current180button, 0, 1, 3, 4, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); - - content_current270button = gtk_toggle_button_new_with_mnemonic( _( "Current 270" ) ); - gtk_widget_show( content_current270button ); - gtk_table_attach( GTK_TABLE( table2 ), content_current270button, 1, 2, 3, 4, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); - - content_currentUPbutton = gtk_toggle_button_new_with_mnemonic( _( "Current UP" ) ); - gtk_widget_show( content_currentUPbutton ); - gtk_table_attach( GTK_TABLE( table2 ), content_currentUPbutton, 2, 3, 3, 4, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); - - content_currentDOWNbutton = gtk_toggle_button_new_with_mnemonic( _( "Current DOWN" ) ); - gtk_widget_show( content_currentDOWNbutton ); - gtk_table_attach( GTK_TABLE( table2 ), content_currentDOWNbutton, 3, 4, 3, 4, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); - - content_originbutton = gtk_toggle_button_new_with_mnemonic( _( "Origin" ) ); - gtk_widget_show( content_originbutton ); - gtk_table_attach( GTK_TABLE( table2 ), content_originbutton, 0, 1, 4, 5, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); - - content_detailbutton = gtk_toggle_button_new_with_mnemonic( _( "Detail" ) ); - gtk_widget_show( content_detailbutton ); - gtk_table_attach( GTK_TABLE( table2 ), content_detailbutton, 1, 2, 4, 5, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); - - content_ladderbutton = gtk_toggle_button_new_with_mnemonic( _( "Ladder" ) ); - gtk_widget_show( content_ladderbutton ); - gtk_table_attach( GTK_TABLE( table2 ), content_ladderbutton, 2, 3, 4, 5, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); - - content_camnoblockbutton = gtk_toggle_button_new_with_mnemonic( _( "Cam No Block" ) ); - gtk_widget_show( content_camnoblockbutton ); - gtk_table_attach( GTK_TABLE( table2 ), content_camnoblockbutton, 3, 4, 4, 5, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); - - label3 = gtk_label_new( _( "Content Flags" ) ); - gtk_widget_show( label3 ); - gtk_notebook_set_tab_label( GTK_NOTEBOOK( notebook1 ), gtk_notebook_get_nth_page( GTK_NOTEBOOK( notebook1 ), 1 ), label3 ); - gtk_label_set_justify( GTK_LABEL( label3 ), GTK_JUSTIFY_LEFT ); - - // Signal Connects - g_signal_connect( (gpointer) surface_lightbutton, "toggled", - G_CALLBACK( on_surface_lightbutton_toggled ), - NULL ); - g_signal_connect( (gpointer) surface_slickbutton, "toggled", - G_CALLBACK( on_surface_slickbutton_toggled ), - NULL ); - g_signal_connect( (gpointer) surface_skybutton, "toggled", - G_CALLBACK( on_surface_skybutton_toggled ), - NULL ); - g_signal_connect( (gpointer) surface_warpbutton, "toggled", - G_CALLBACK( on_surface_warpbutton_toggled ), - NULL ); - g_signal_connect( (gpointer) surface_trans33button, "toggled", - G_CALLBACK( on_surface_trans33button_toggled ), - NULL ); - g_signal_connect( (gpointer) surface_trans66button, "toggled", - G_CALLBACK( on_surface_trans66button_toggled ), - NULL ); - g_signal_connect( (gpointer) surface_flowingbutton, "toggled", - G_CALLBACK( on_surface_flowingbutton_toggled ), - NULL ); - g_signal_connect( (gpointer) surface_nodrawbutton, "toggled", - G_CALLBACK( on_surface_nodrawbutton_toggled ), - NULL ); - g_signal_connect( (gpointer) surface_tallwallbutton, "toggled", - G_CALLBACK( on_surface_tallwallbutton_toggled ), - NULL ); - g_signal_connect( (gpointer) surface_alphatexbutton, "toggled", - G_CALLBACK( on_surface_alphatexbutton_toggled ), - NULL ); - g_signal_connect( (gpointer) surface_animspeedbutton, "toggled", - G_CALLBACK( on_surface_animspeedbutton_toggled ), - NULL ); - g_signal_connect( (gpointer) surface_undulatebutton, "toggled", - G_CALLBACK( on_surface_undulatebutton_toggled ), - NULL ); - - g_signal_connect( (gpointer) surf_gravel_radiobutton, "toggled", - G_CALLBACK( on_surf_gravel_radiobutton_toggled ), - NULL ); - g_signal_connect( (gpointer) surf_metal_radiobutton, "toggled", - G_CALLBACK( on_surf_metal_radiobutton_toggled ), - NULL ); - g_signal_connect( (gpointer) surf_stone_radiobutton, "toggled", - G_CALLBACK( on_surf_stone_radiobutton_toggled ), - NULL ); - g_signal_connect( (gpointer) surf_wood_radiobutton, "toggled", - G_CALLBACK( on_surf_wood_radiobutton_toggled ), - NULL ); - - g_signal_connect( (gpointer) surf_value_entry, "changed", - G_CALLBACK( on_surf_value_entry_changed ), - NULL ); - g_signal_connect( (gpointer) surf_value_entry, "insert_text", - G_CALLBACK( on_surf_value_entry_insert_text ), - NULL ); - g_signal_connect( (gpointer) content_solidbutton, "toggled", - G_CALLBACK( on_content_solidbutton_toggled ), - NULL ); - g_signal_connect( (gpointer) content_windowbutton, "toggled", - G_CALLBACK( on_content_windowbutton_toggled ), - NULL ); - g_signal_connect( (gpointer) content_illusbutton, "toggled", - G_CALLBACK( on_content_illusbutton_toggled ), - NULL ); - g_signal_connect( (gpointer) content_lavabutton, "toggled", - G_CALLBACK( on_content_lavabutton_toggled ), - NULL ); - g_signal_connect( (gpointer) content_slimebutton, "toggled", - G_CALLBACK( on_content_slimebutton_toggled ), - NULL ); - g_signal_connect( (gpointer) content_waterbutton, "toggled", - G_CALLBACK( on_content_waterbutton_toggled ), - NULL ); - g_signal_connect( (gpointer) content_mistbutton, "toggled", - G_CALLBACK( on_content_mistbutton_toggled ), - NULL ); - g_signal_connect( (gpointer) content_areaportalbutton, "toggled", - G_CALLBACK( on_content_areaportalbutton_toggled ), - NULL ); - g_signal_connect( (gpointer) content_playerclipbutton, "toggled", - G_CALLBACK( on_content_playerclipbutton_toggled ), - NULL ); - g_signal_connect( (gpointer) content_monsterclipbutton, "toggled", - G_CALLBACK( on_content_monsterclipbutton_toggled ), - NULL ); - g_signal_connect( (gpointer) content_current0button, "toggled", - G_CALLBACK( on_content_current0button_toggled ), - NULL ); - g_signal_connect( (gpointer) content_current90button, "toggled", - G_CALLBACK( on_content_current90button_toggled ), - NULL ); - g_signal_connect( (gpointer) content_current180button, "toggled", - G_CALLBACK( on_content_current180button_toggled ), - NULL ); - g_signal_connect( (gpointer) content_current270button, "toggled", - G_CALLBACK( on_content_current270button_toggled ), - NULL ); - g_signal_connect( (gpointer) content_currentUPbutton, "toggled", - G_CALLBACK( on_content_currentUPbutton_toggled ), - NULL ); - g_signal_connect( (gpointer) content_currentDOWNbutton, "toggled", - G_CALLBACK( on_content_currentDOWNbutton_toggled ), - NULL ); - g_signal_connect( (gpointer) content_originbutton, "toggled", - G_CALLBACK( on_content_originbutton_toggled ), - NULL ); - g_signal_connect( (gpointer) content_detailbutton, "toggled", - G_CALLBACK( on_content_detailbutton_toggled ), - NULL ); - g_signal_connect( (gpointer) content_ladderbutton, "toggled", - G_CALLBACK( on_content_ladderbutton_toggled ), - NULL ); - g_signal_connect( (gpointer) content_camnoblockbutton, "toggled", - G_CALLBACK( on_content_camnoblockbutton_toggled ), - NULL ); - - - return frame1; -} diff --git a/plugins/surface_heretic2/surfaceflagsdialog_heretic2.h b/plugins/surface_heretic2/surfaceflagsdialog_heretic2.h deleted file mode 100644 index 886f7ebe..00000000 --- a/plugins/surface_heretic2/surfaceflagsdialog_heretic2.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - Copyright (C) 1999-2007 id Software, Inc. and contributors. - For a list of contributors, see the accompanying CONTRIBUTORS file. - - This file is part of GtkRadiant. - - GtkRadiant is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - GtkRadiant is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with GtkRadiant; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef _SURFACEFLAGSDIALOG_HERETIC2_H - #define _SURFACEFLAGSDIALOG_HERETIC2_H - -// 12 -#define HERETIC2_SURF_LIGHT 0x1 -#define HERETIC2_SURF_SLICK 0x2 -#define HERETIC2_SURF_SKY 0x4 -#define HERETIC2_SURF_WARP 0x8 -#define HERETIC2_SURF_TRANS33 0x10 -#define HERETIC2_SURF_TRANS66 0x20 -#define HERETIC2_SURF_FLOWING 0x40 -#define HERETIC2_SURF_NODRAW 0x80 - -#define HERETIC2_SURF_TALL_WALL 0x400 -#define HERETIC2_SURF_ALPHA_TEXTURE 0x800 -#define HERETIC2_SURF_ANIMSPEED 0x1000 -#define HERETIC2_SURF_UNDULATE 0x2000 - -#define HERETIC2_SURF_TYPE_GRAVEL 0x00000000 -#define HERETIC2_SURF_TYPE_METAL 0x01000000 -#define HERETIC2_SURF_TYPE_STONE 0x02000000 -#define HERETIC2_SURF_TYPE_WOOD 0x03000000 - -#define HERETIC2_SURF_MATERIAL_MASK 0xFCFFFFFF - - -// 20 -#define HERETIC2_CONTENTS_SOLID 0x1 -#define HERETIC2_CONTENTS_WINDOW 0x2 -#define HERETIC2_CONTENTS_ILLUSIONARY 0x4 -#define HERETIC2_CONTENTS_LAVA 0x8 -#define HERETIC2_CONTENTS_SLIME 0x10 -#define HERETIC2_CONTENTS_WATER 0x20 -#define HERETIC2_CONTENTS_MIST 0x40 - -#define HERETIC2_CONTENTS_AREAPORTAL 0x8000 -#define HERETIC2_CONTENTS_PLAYERCLIP 0x10000 -#define HERETIC2_CONTENTS_MONSTERCLIP 0x20000 -#define HERETIC2_CONTENTS_CURRENT_0 0x40000 -#define HERETIC2_CONTENTS_CURRENT_90 0x80000 -#define HERETIC2_CONTENTS_CURRENT_180 0x100000 -#define HERETIC2_CONTENTS_CURRENT_270 0x200000 -#define HERETIC2_CONTENTS_CURRENT_UP 0x400000 -#define HERETIC2_CONTENTS_CURRENT_DOWN 0x800000 -#define HERETIC2_CONTENTS_ORIGIN 0x1000000 - -#define HERETIC2_CONTENTS_DETAIL 0x8000000 - -#define HERETIC2_CONTENTS_LADDER 0x20000000 - -#define HERETIC2_CONTENTS_CAMERANOBLOCK 0x40000000 - - - -#endif // _SURFACEFLAGSDIALOG_HERETIC2_H diff --git a/plugins/surface_heretic2/surfdlg_plugin.cpp b/plugins/surface_heretic2/surfdlg_plugin.cpp deleted file mode 100644 index 60b0736b..00000000 --- a/plugins/surface_heretic2/surfdlg_plugin.cpp +++ /dev/null @@ -1,120 +0,0 @@ -/* - Copyright (c) 2001, Loki software, inc. - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this list - of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, this - list of conditions and the following disclaimer in the documentation and/or - other materials provided with the distribution. - - Neither the name of Loki software nor the names of its contributors may be used - to endorse or promote products derived from this software without specific prior - written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY - DIRECT,INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include -#include "surfdlg_plugin.h" -#include "surfacedialog.h" - -#include "synapse.h" - -class CSynapseClient_SurfDLG : public CSynapseClient -{ -public: -// CSynapseClient API -bool RequestAPI( APIDescriptor_t *pAPI ); -const char* GetInfo(); -const char* GetName(); -bool OnActivate(); - -CSynapseClient_SurfDLG() { } -virtual ~CSynapseClient_SurfDLG() { } -}; - -// ============================================================================= -// SYNAPSE - -_QERFuncTable_1 g_FuncTable; -_QERUndoTable g_UndoTable; -_QERAppSurfaceTable g_AppSurfaceTable; -_QERSelectedFaceTable g_SelectedFaceTable; -_QERShadersTable g_ShadersTable; -_QERAppShadersTable g_AppShadersTable; -_QERAppDataTable g_AppDataTable; - -CSynapseServer* g_pSynapseServer = NULL; -CSynapseClient_SurfDLG g_SynapseClient; - -#if __GNUC__ >= 4 -#pragma GCC visibility push(default) -#endif -extern "C" CSynapseClient * SYNAPSE_DLL_EXPORT Synapse_EnumerateInterfaces( const char *version, CSynapseServer *pServer ) { -#if __GNUC__ >= 4 -#pragma GCC visibility pop -#endif - if ( strcmp( version, SYNAPSE_VERSION ) ) { - Syn_Printf( "ERROR: synapse API version mismatch: should be '" SYNAPSE_VERSION "', got '%s'\n", version ); - return NULL; - } - g_pSynapseServer = pServer; - g_pSynapseServer->IncRef(); - Set_Syn_Printf( g_pSynapseServer->Get_Syn_Printf() ); - - g_SynapseClient.AddAPI( SURFACEDIALOG_MAJOR, "heretic2", sizeof( _QERPlugSurfaceTable ) ); - g_SynapseClient.AddAPI( RADIANT_MAJOR, NULL, sizeof( _QERFuncTable_1 ), SYN_REQUIRE, &g_FuncTable ); - g_SynapseClient.AddAPI( UNDO_MAJOR, NULL, sizeof( _QERUndoTable ), SYN_REQUIRE, &g_UndoTable ); - g_SynapseClient.AddAPI( APPSURFACEDIALOG_MAJOR, NULL, sizeof( _QERAppSurfaceTable ), SYN_REQUIRE, &g_AppSurfaceTable ); - g_SynapseClient.AddAPI( SELECTEDFACE_MAJOR, NULL, sizeof( _QERSelectedFaceTable ), SYN_REQUIRE, &g_SelectedFaceTable ); - g_SynapseClient.AddAPI( SHADERS_MAJOR, "quake2", sizeof( _QERShadersTable ), SYN_REQUIRE, &g_ShadersTable ); - g_SynapseClient.AddAPI( APPSHADERS_MAJOR, NULL, sizeof( _QERAppShadersTable ), SYN_REQUIRE, &g_AppShadersTable ); - g_SynapseClient.AddAPI( DATA_MAJOR, NULL, sizeof( _QERAppDataTable ), SYN_REQUIRE, &g_AppDataTable ); - - return &g_SynapseClient; -} - -bool CSynapseClient_SurfDLG::RequestAPI( APIDescriptor_t *pAPI ){ - if ( !strcmp( pAPI->major_name, SURFACEDIALOG_MAJOR ) ) { - _QERPlugSurfaceTable* pSurfDialogTable = static_cast<_QERPlugSurfaceTable*>( pAPI->mpTable ); - if ( !strcmp( pAPI->minor_name, "heretic2" ) ) { - pSurfDialogTable->m_pfnToggleSurface = &ToggleSurface; - pSurfDialogTable->m_pfnDoSurface = &DoSurface; - pSurfDialogTable->m_pfnUpdateSurfaceDialog = &UpdateSurfaceDialog; - pSurfDialogTable->m_pfnSurfaceDlgFitAll = &SurfaceDlgFitAll; - pSurfDialogTable->m_pfnGet_SI_Module_Widget = &Get_SI_Module_Widget; - return true; - } - } - - Syn_Printf( "ERROR: RequestAPI( '%s' ) not found in '%s'\n", pAPI->major_name, GetInfo() ); - return false; -} - -#include "version.h" - -const char* CSynapseClient_SurfDLG::GetInfo(){ - return "Surface Dialog (Heretic 2) module built " __DATE__ " " RADIANT_VERSION; -} - -const char* CSynapseClient_SurfDLG::GetName(){ - return "surface"; -} - -bool CSynapseClient_SurfDLG::OnActivate(){ - return true; -} diff --git a/plugins/surface_heretic2/surfdlg_plugin.h b/plugins/surface_heretic2/surfdlg_plugin.h deleted file mode 100644 index b90020d5..00000000 --- a/plugins/surface_heretic2/surfdlg_plugin.h +++ /dev/null @@ -1,97 +0,0 @@ -/* - Copyright (c) 2001, Loki software, inc. - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this list - of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, this - list of conditions and the following disclaimer in the documentation and/or - other materials provided with the distribution. - - Neither the name of Loki software nor the names of its contributors may be used - to endorse or promote products derived from this software without specific prior - written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY - DIRECT,INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _SURFDLG_PLUGIN_H_ -#define _SURFDLG_PLUGIN_H_ - -#ifdef __linux__ - -typedef void* HMODULE; -typedef void* LPVOID; -typedef char* LPCSTR; - -#endif // __linux__ - -#include "qerplugin.h" -#include "synapse.h" -#include "iselectedface.h" -#include "iundo.h" -#include "ishaders.h" -#include "mathlib.h" -#include "missing.h" -#include "idata.h" - -#include "isurfaceplugin.h" - -class SurfaceDialog : public IPluginTexdef -{ -int refCount; -public: -// Increment the number of references to this object -void IncRef() { refCount++; } -// Decrement the reference count -void DecRef() { - if ( --refCount <= 0 ) { - delete this; - } -} -}; - -extern _QERFuncTable_1 g_FuncTable; -extern _QERUndoTable g_UndoTable; -extern _QERAppSurfaceTable g_AppSurfaceTable; -extern _QERSelectedFaceTable g_SelectedFaceTable; -extern _QERShadersTable g_ShadersTable; -extern _QERAppShadersTable g_AppShadersTable; -extern _QERAppDataTable g_AppDataTable; - -#define GetSelectedFaceCount g_SelectedFaceTable.m_pfnGetSelectedFaceCount - -#define Undo_Undo g_UndoTable.m_pfnUndo_Undo -#define Undo_GetUndoId g_UndoTable.m_pfnUndo_GetUndoId - -#define Sys_Printf g_FuncTable.m_pfnSysPrintf -#define Sys_FPrintf g_FuncTable.m_pfnSysFPrintf -#define Sys_UpdateWindows g_FuncTable.m_pfnSysUpdateWindows - - -#define Select_FitTexture g_AppSurfaceTable.m_pfnSelect_FitTexture -#define Get_SI_Inc g_AppSurfaceTable.m_pfnQERApp_QeglobalsSavedinfo_SIInc -#define GridSize g_AppSurfaceTable.m_pfnQeglobalsGetGridSize -#define FaceList_FitTexture g_AppSurfaceTable.m_pfnFaceList_FitTexture -#define GetMainWindow g_AppSurfaceTable.m_pfnGetMainWindow -#define GetSelectedFaceCountfromBrushes g_AppSurfaceTable.m_pfnGetSelectedFaceCountfromBrushes -#define GetSelFacesTexdef g_AppSurfaceTable.m_pfnGetSelFacesTexdef -#define SetTexdef_FaceList g_AppSurfaceTable.m_pfnSetTexdef_FaceList -#define SetWinPos_from_Prefs g_AppSurfaceTable.m_pfnSetWinPos_From_Prefs - -#define Texturewin g_AppShadersTable.m_pfnQeglobalsTexturewin - -#endif // _SURFDLG_PLUGIN_H_ diff --git a/plugins/surface_idtech2/surface_idtech2.def b/plugins/surface_idtech2/surface_idtech2.def new file mode 100644 index 00000000..d5343f09 --- /dev/null +++ b/plugins/surface_idtech2/surface_idtech2.def @@ -0,0 +1,7 @@ +; surface_idtech2.def : Declares the module parameters for the DLL. + +LIBRARY "SURFACE_IDTECH2" + +EXPORTS + ; Explicit exports can go here + Synapse_EnumerateInterfaces @1 diff --git a/plugins/surface_ufoai/surface_ufoai.vcproj b/plugins/surface_idtech2/surface_idtech2.vcproj similarity index 92% rename from plugins/surface_ufoai/surface_ufoai.vcproj rename to plugins/surface_idtech2/surface_idtech2.vcproj index 49269385..f5d9e256 100644 --- a/plugins/surface_ufoai/surface_ufoai.vcproj +++ b/plugins/surface_idtech2/surface_idtech2.vcproj @@ -2,7 +2,7 @@ Disabled $(SolutionDir)\libs;$(SolutionDir)\include;$(SolutionDir)\..\STLport-5.2.1\stlport;$(SolutionDir)\..\gtk-2.24.10\include\glib-2.0;$(SolutionDir)\..\gtk-2.24.10\include\gdk-pixbuf-2.0;$(SolutionDir)\..\gtk-2.24.10\lib\glib-2.0\include;$(SolutionDir)\..\gtk-2.24.10\include;$(SolutionDir)\..\gtk-2.24.10\include\gtk-2.0;$(SolutionDir)\..\gtk-2.24.10\lib\gtk-2.0\include;$(SolutionDir)\..\gtk-2.24.10\include\cairo;$(SolutionDir)\..\gtk-2.24.10\include\pango-1.0;$(SolutionDir)\..\gtk-2.24.10\include\atk-1.0;$(SolutionDir)\..\libxml2-2.9.1\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_WINDOWS;_USRDLL;SURFACE_UFOAI_EXPORTS;%(PreprocessorDefinitions) + WIN32;_DEBUG;_WINDOWS;_USRDLL;SURFACE_IDTECH2_EXPORTS;%(PreprocessorDefinitions) true EnableFastChecks MultiThreadedDebugDLL @@ -85,7 +85,7 @@ /STACK:8388608 %(AdditionalOptions) ws2_32.lib;glib-2.0.lib;gobject-2.0.lib;intl.lib;gtk-win32-2.0.lib;libxml2.lib;synapse.lib;%(AdditionalDependencies) $(SolutionDir)\..\gtk-2.24.10\lib;$(SolutionDir)\..\libxml2-2.9.1\lib\$(Configuration)\$(Platform);$(SolutionDir)\build\$(Configuration)\libs;%(AdditionalLibraryDirectories) - surface_ufoai.def + surface_idtech2.def true Windows MachineX86 @@ -95,7 +95,7 @@ Disabled $(SolutionDir)\libs;$(SolutionDir)\include;$(SolutionDir)\..\STLport-5.2.1\stlport;$(SolutionDir)\..\gtk-2.24.10\include\glib-2.0;$(SolutionDir)\..\gtk-2.24.10\include\gdk-pixbuf-2.0;$(SolutionDir)\..\gtk-2.24.10\lib\glib-2.0\include;$(SolutionDir)\..\gtk-2.24.10\include;$(SolutionDir)\..\gtk-2.24.10\include\gtk-2.0;$(SolutionDir)\..\gtk-2.24.10\lib\gtk-2.0\include;$(SolutionDir)\..\gtk-2.24.10\include\cairo;$(SolutionDir)\..\gtk-2.24.10\include\pango-1.0;$(SolutionDir)\..\gtk-2.24.10\include\atk-1.0;$(SolutionDir)\..\libxml2-2.9.1\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_WINDOWS;_USRDLL;SURFACE_UFOAI_EXPORTS;%(PreprocessorDefinitions) + WIN32;_DEBUG;_WINDOWS;_USRDLL;SURFACE_IDTECH2_EXPORTS;%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebugDLL @@ -108,7 +108,7 @@ /STACK:8388608 %(AdditionalOptions) ws2_32.lib;glib-2.0.lib;gobject-2.0.lib;intl.lib;gtk-win32-2.0.lib;libxml2.lib;synapse.lib;%(AdditionalDependencies) $(SolutionDir)\..\gtk-2.24.10\lib;$(SolutionDir)\..\libxml2-2.9.1\lib\$(Configuration)\$(Platform);$(SolutionDir)\build\$(Configuration)\libs;%(AdditionalLibraryDirectories) - surface_ufoai.def + surface_idtech2.def true Windows @@ -116,7 +116,7 @@ $(SolutionDir)\libs;$(SolutionDir)\include;$(SolutionDir)\..\STLport-5.2.1\stlport;$(SolutionDir)\..\gtk-2.24.10\include\glib-2.0;$(SolutionDir)\..\gtk-2.24.10\include\gdk-pixbuf-2.0;$(SolutionDir)\..\gtk-2.24.10\lib\glib-2.0\include;$(SolutionDir)\..\gtk-2.24.10\include;$(SolutionDir)\..\gtk-2.24.10\include\gtk-2.0;$(SolutionDir)\..\gtk-2.24.10\lib\gtk-2.0\include;$(SolutionDir)\..\gtk-2.24.10\include\cairo;$(SolutionDir)\..\gtk-2.24.10\include\pango-1.0;$(SolutionDir)\..\gtk-2.24.10\include\atk-1.0;$(SolutionDir)\..\libxml2-2.9.1\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_WINDOWS;_USRDLL;SURFACE_UFOAI_EXPORTS;%(PreprocessorDefinitions) + WIN32;NDEBUG;_WINDOWS;_USRDLL;SURFACE_IDTECH2_EXPORTS;%(PreprocessorDefinitions) MultiThreadedDLL Level3 @@ -127,7 +127,7 @@ /STACK:8388608 %(AdditionalOptions) ws2_32.lib;glib-2.0.lib;gobject-2.0.lib;intl.lib;gtk-win32-2.0.lib;libxml2.lib;synapse.lib;%(AdditionalDependencies) $(SolutionDir)\..\gtk-2.24.10\lib;$(SolutionDir)\..\libxml2-2.9.1\lib\$(Configuration)\$(Platform);$(SolutionDir)\build\$(Configuration)\libs;%(AdditionalLibraryDirectories) - surface_ufoai.def + surface_idtech2.def true Windows true @@ -138,7 +138,7 @@ $(SolutionDir)\libs;$(SolutionDir)\include;$(SolutionDir)\..\STLport-5.2.1\stlport;$(SolutionDir)\..\gtk-2.24.10\include\glib-2.0;$(SolutionDir)\..\gtk-2.24.10\include\gdk-pixbuf-2.0;$(SolutionDir)\..\gtk-2.24.10\lib\glib-2.0\include;$(SolutionDir)\..\gtk-2.24.10\include;$(SolutionDir)\..\gtk-2.24.10\include\gtk-2.0;$(SolutionDir)\..\gtk-2.24.10\lib\gtk-2.0\include;$(SolutionDir)\..\gtk-2.24.10\include\cairo;$(SolutionDir)\..\gtk-2.24.10\include\pango-1.0;$(SolutionDir)\..\gtk-2.24.10\include\atk-1.0;$(SolutionDir)\..\libxml2-2.9.1\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_WINDOWS;_USRDLL;SURFACE_UFOAI_EXPORTS;%(PreprocessorDefinitions) + WIN32;NDEBUG;_WINDOWS;_USRDLL;SURFACE_IDTECH2_EXPORTS;%(PreprocessorDefinitions) MultiThreadedDLL @@ -150,7 +150,7 @@ /STACK:8388608 %(AdditionalOptions) ws2_32.lib;glib-2.0.lib;gobject-2.0.lib;intl.lib;gtk-win32-2.0.lib;libxml2.lib;synapse.lib;%(AdditionalDependencies) $(SolutionDir)\..\gtk-2.24.10\lib;$(SolutionDir)\..\libxml2-2.9.1\lib\$(Configuration)\$(Platform);$(SolutionDir)\build\$(Configuration)\libs;%(AdditionalLibraryDirectories) - surface_ufoai.def + surface_idtech2.def true Windows true @@ -158,11 +158,11 @@ - + - + diff --git a/plugins/surface_ufoai/surface_ufoai.vcxproj.filters b/plugins/surface_idtech2/surface_idtech2.vcxproj.filters similarity index 87% rename from plugins/surface_ufoai/surface_ufoai.vcxproj.filters rename to plugins/surface_idtech2/surface_idtech2.vcxproj.filters index 862974d9..29507511 100644 --- a/plugins/surface_ufoai/surface_ufoai.vcxproj.filters +++ b/plugins/surface_idtech2/surface_idtech2.vcxproj.filters @@ -7,7 +7,7 @@ - + src @@ -15,7 +15,7 @@ src - + src diff --git a/plugins/surface_idtech2/surfacedialog.cpp b/plugins/surface_idtech2/surfacedialog.cpp new file mode 100644 index 00000000..cbba4574 --- /dev/null +++ b/plugins/surface_idtech2/surfacedialog.cpp @@ -0,0 +1,1148 @@ +/* + Copyright (C) 1999-2007 id Software, Inc. and contributors. + For a list of contributors, see the accompanying CONTRIBUTORS file. + + This file is part of GtkRadiant. + + GtkRadiant is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + GtkRadiant is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GtkRadiant; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +// +// Surface Dialog Module +// + +#include +#include +#include + +#include "surfacedialog.h" +#include "surfaceflags.h" + +#ifdef _DEBUG +//#define DBG_SI 1 +#endif + +#include "gtkr_vector.h" + +vector g_texdef_face_vector; + +inline texdef_to_face_t* get_texdef_face_list(){ + return &( *g_texdef_face_vector.begin() ); +} + +inline unsigned int texdef_face_list_empty(){ + return g_texdef_face_vector.empty(); +} + +inline unsigned int texdef_face_list_size(){ + return g_texdef_face_vector.size(); +} + +// For different faces having different values +bool is_HShift_conflicting; +bool is_VShift_conflicting; +bool is_HScale_conflicting; +bool is_VScale_conflicting; +bool is_Rotate_conflicting; +bool is_TextureName_conflicting; + +// Dialog Data +int m_nHeight; +int m_nWidth; + +// 0 is invalid, otherwise it's the ID of the last 'do' we are responsible for +int m_nUndoId; + +texturewin_t *texturewin; +texdef_t *l_pIncrement; +texdef_t texdef_SI_values; + +// For Texture Entry, activate only on entry change +char old_texture_entry[128]; + +// when TRUE, this thing means the surface inspector is currently being displayed +bool g_surfwin = FALSE; +// turn on/off processing of the "changed" "value_changed" messages +// (need to turn off when we are feeding data in) +bool g_bListenChanged = TRUE; +// turn on/off listening of the update messages +bool g_bListenUpdate = TRUE; + +GtkWidget* create_SurfaceInspector( void ); +GtkWidget *SurfaceInspector = NULL; + +GtkWidget *GetWidget() { return SurfaceInspector; } +GtkWidget *Get_SI_Module_Widget() { return SurfaceInspector; } +void SetWidget( GtkWidget *new_widget ) { } +GtkWidget *GetDlgWidget( const char* name ) { return GTK_WIDGET( g_object_get_data( G_OBJECT( SurfaceInspector ), name ) ); } + +GtkWidget *texture_combo; +GtkWidget *texture_combo_entry; + +GtkWidget *match_grid_button; + +GtkWidget *hshift_value_spinbutton; +GtkWidget *vshift_value_spinbutton; +GtkWidget *hscale_value_spinbutton; +GtkWidget *vscale_value_spinbutton; +GtkWidget *rotate_value_spinbutton; + +GtkWidget *hshift_step_spinbutton; +GtkWidget *vshift_step_spinbutton; +GtkWidget *hscale_step_spinbutton; +GtkWidget *vscale_step_spinbutton; +GtkWidget *rotate_step_spinbutton; + +GtkWidget *fit_width_spinbutton; +GtkWidget *fit_height_spinbutton; +GtkWidget *fit_button; +GtkWidget *axial_button; + +// Callbacks +gboolean on_texture_combo_entry_key_press_event( GtkWidget *widget, GdkEventKey *event, gpointer user_data ); +void on_texture_combo_entry_activate( GtkEntry *entry, gpointer user_data ); + +static void on_match_grid_button_clicked( GtkButton *button, gpointer user_data ); + +static void on_hshift_value_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ); +static void on_vshift_value_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ); +static void on_hscale_value_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ); +static void on_vscale_value_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ); +static void on_rotate_value_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ); + +static void on_hshift_step_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ); +static void on_vshift_step_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ); +static void on_hscale_step_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ); +static void on_vscale_step_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ); +static void on_rotate_step_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ); + +static void on_fit_width_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ); +static void on_fit_height_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ); +static void on_fit_button_clicked( GtkButton *button, gpointer user_data ); +static void on_axial_button_clicked( GtkButton *button, gpointer user_data ); + + +/* + =================================================== + + SURFACE INSPECTOR + + =================================================== + */ + + +void IsFaceConflicting(){ + texdef_t* tmp_texdef; + texdef_to_face_t* temp_texdef_face_list; + char texture_name[128]; + + if ( texdef_face_list_empty() ) { + gtk_entry_set_text( GTK_ENTRY( hshift_value_spinbutton ), "" ); + gtk_entry_set_text( GTK_ENTRY( vshift_value_spinbutton ), "" ); + gtk_entry_set_text( GTK_ENTRY( hscale_value_spinbutton ), "" ); + gtk_entry_set_text( GTK_ENTRY( vscale_value_spinbutton ), "" ); + gtk_entry_set_text( GTK_ENTRY( rotate_value_spinbutton ), "" ); + gtk_entry_set_text( GTK_ENTRY( texture_combo_entry ), "" ); + return; + } + + g_bListenChanged = FALSE; + + tmp_texdef = &get_texdef_face_list()->texdef; + + strcpy( texture_name, tmp_texdef->GetName() ); + + texdef_SI_values.shift[0] = tmp_texdef->shift[0]; + texdef_SI_values.shift[1] = tmp_texdef->shift[1]; + texdef_SI_values.scale[0] = tmp_texdef->scale[0]; + texdef_SI_values.scale[1] = tmp_texdef->scale[1]; + texdef_SI_values.rotate = tmp_texdef->rotate; + texdef_SI_values.SetName( texture_name ); + + is_HShift_conflicting = FALSE; + is_VShift_conflicting = FALSE; + is_HScale_conflicting = FALSE; + is_VScale_conflicting = FALSE; + is_Rotate_conflicting = FALSE; + is_TextureName_conflicting = FALSE; + + if ( texdef_face_list_size() > 1 ) { + temp_texdef_face_list = get_texdef_face_list()->next; + + for (; temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next ) + { + tmp_texdef = &temp_texdef_face_list->texdef; + if ( texdef_SI_values.shift[0] != tmp_texdef->shift[0] ) { + is_HShift_conflicting = TRUE; + } + + if ( texdef_SI_values.shift[1] != tmp_texdef->shift[1] ) { + is_VShift_conflicting = TRUE; + } + + if ( texdef_SI_values.scale[0] != tmp_texdef->scale[0] ) { + is_HScale_conflicting = TRUE; + } + + if ( texdef_SI_values.scale[1] != tmp_texdef->scale[1] ) { + is_VScale_conflicting = TRUE; + } + + if ( texdef_SI_values.rotate != tmp_texdef->rotate ) { + is_Rotate_conflicting = TRUE; + } + + if ( strcmp( texture_name, tmp_texdef->GetName() ) ) { + is_TextureName_conflicting = TRUE; + } + } + } + + if ( is_HShift_conflicting ) { + gtk_entry_set_text( GTK_ENTRY( hshift_value_spinbutton ), "" ); + } + else{ + gtk_spin_button_set_value( GTK_SPIN_BUTTON( hshift_value_spinbutton ), texdef_SI_values.shift[0] ); + } + + if ( is_VShift_conflicting ) { + gtk_entry_set_text( GTK_ENTRY( vshift_value_spinbutton ), "" ); + } + else{ + gtk_spin_button_set_value( GTK_SPIN_BUTTON( vshift_value_spinbutton ), texdef_SI_values.shift[1] ); + } + + if ( is_HScale_conflicting ) { + gtk_entry_set_text( GTK_ENTRY( hscale_value_spinbutton ), "" ); + } + else{ + gtk_spin_button_set_value( GTK_SPIN_BUTTON( hscale_value_spinbutton ), texdef_SI_values.scale[0] ); + } + + if ( is_VScale_conflicting ) { + gtk_entry_set_text( GTK_ENTRY( vscale_value_spinbutton ), "" ); + } + else{ + gtk_spin_button_set_value( GTK_SPIN_BUTTON( vscale_value_spinbutton ), texdef_SI_values.scale[1] ); + } + + if ( is_Rotate_conflicting ) { + gtk_entry_set_text( GTK_ENTRY( rotate_value_spinbutton ), "" ); + } + else{ + gtk_spin_button_set_value( GTK_SPIN_BUTTON( rotate_value_spinbutton ), texdef_SI_values.rotate ); + } + + g_bListenChanged = TRUE; +} + +#define MAX_NUM_LIST_ITEMS 15 +static void PopulateTextureComboList(){ + texdef_t* tmp_texdef; + texdef_to_face_t* temp_texdef_face_list; + char blank[1]; + GList *items = NULL; + int num_of_list_items = 0; + + blank[0] = 0; + + if ( texdef_face_list_empty() ) { + items = g_list_append( items, (gpointer) blank ); + // For Texture Entry, activate only on entry change + strcpy( old_texture_entry, blank ); + } + else if ( !is_TextureName_conflicting ) { + temp_texdef_face_list = get_texdef_face_list(); + tmp_texdef = (texdef_t *) &get_texdef_face_list()->texdef; + items = g_list_append( items, (gpointer) tmp_texdef->GetName() ); + // For Texture Entry, activate only on entry change + strcpy( old_texture_entry, tmp_texdef->GetName() ); + } + else + { + for ( temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next ) + { + tmp_texdef = (texdef_t *) &temp_texdef_face_list->texdef; + // Need to do a string compare, hence the custom search + if ( !( g_list_find_custom( items, tmp_texdef->GetName(), (GCompareFunc) strcmp ) ) ) { + items = g_list_append( items, (gpointer) tmp_texdef->GetName() ); + num_of_list_items++; + } + // Make sure the combo list isn't too long + if ( num_of_list_items >= MAX_NUM_LIST_ITEMS ) { + break; + } + } + // If this isn't added last (to the top of the list), g_list_find freaks. + items = g_list_prepend( items, (gpointer) blank ); + // For Texture Entry, activate only on entry change + strcpy( old_texture_entry, blank ); + } + + gtk_combo_set_popdown_strings( GTK_COMBO( texture_combo ), items ); + g_list_free( items ); + +} + +static void GetTexdefInfo_from_Radiant(){ + g_texdef_face_vector.clear(); + + unsigned int count = GetSelectedFaceCountfromBrushes(); + if ( count == 0 ) { + count = GetSelectedFaceCount(); + } + + g_texdef_face_vector.resize( count ); + + if ( !texdef_face_list_empty() ) { + GetSelFacesTexdef( get_texdef_face_list() ); + } + + IsFaceConflicting(); + PopulateTextureComboList(); + if ( texdef_face_list_empty() ) { + set_surface_flags_button_state( get_texdef_face_list(), TRUE ); + } + else{ + set_surface_flags_button_state( get_texdef_face_list(), FALSE ); + } +} + +static gint delete_event_callback( GtkWidget *widget, GdkEvent* event, gpointer data ){ + HideDlg(); + return TRUE; +} + +// make the shift increments match the grid settings +// the objective being that the shift+arrows shortcuts move the texture by the corresponding grid size +// this depends on a scale value if you have selected a particular texture on which you want it to work: +// we move the textures in pixels, not world units. (i.e. increment values are in pixel) +// depending on the texture scale it doesn't take the same amount of pixels to move of g_qeglobals.d_gridsize +// increment * scale = gridsize +// hscale and vscale are optional parameters, if they are zero they will be set to the default scale +// NOTE: the default scale depends if you are using BP mode or regular. +// For regular it's 0.5f (128 pixels cover 64 world units), for BP it's simply 1.0f +// see fenris #2810 +void DoSnapTToGrid( float hscale, float vscale ){ + l_pIncrement = Get_SI_Inc(); + + if ( hscale == 0.0f ) { + hscale = 0.25f; + } + if ( vscale == 0.0f ) { + vscale = 0.25f; + } +#ifdef _DEBUG + Sys_Printf( "DoSnapToGrid: grid %g hscale %g vscale %g\n", GridSize(), hscale, vscale ); +#endif + l_pIncrement->shift[0] = GridSize() / hscale; + l_pIncrement->shift[1] = GridSize() / vscale; + // now some update work + // FIXME: doesn't look good here, seems to be called several times + SetTexMods(); +} + +void UpdateSurfaceDialog(){ + if ( !g_bListenUpdate ) { + return; + } + + if ( !SurfaceInspector ) { + return; + } + + // avoid long delays on slow computers + while ( gtk_events_pending() ) + gtk_main_iteration(); + + if ( g_surfwin ) { +#ifdef DBG_SI + Sys_Printf( "UpdateSurfaceDialog\n" ); +#endif + GetTexdefInfo_from_Radiant(); + SetTexMods(); + } + +} + +// DoSurface will always try to show the surface inspector +// or update it because something new has been selected +void DoSurface( void ){ +#ifdef DBG_SI + Sys_Printf( "DoSurface\n" ); +#endif + if ( !SurfaceInspector ) { + create_SurfaceInspector(); + } + + ShowDlg(); + SetTexMods(); +} + +void ToggleSurface(){ +#ifdef DBG_SI + Sys_Printf( "ToggleSurface Module\n" ); +#endif + if ( !g_surfwin ) { + DoSurface(); + } + else { + HideDlg(); + } +} + +// NOTE: will raise and show the Surface inspector and exec fit for patches and brushes +void SurfaceDlgFitAll(){ + DoSurface(); + FitAll(); +} + +// ============================================================================= +// SurfaceDialog class + +void ShowDlg(){ + + if ( !SurfaceInspector ) { + create_SurfaceInspector(); + } + else{ + gtk_widget_show( SurfaceInspector ); + } + + GetTexdefInfo_from_Radiant(); + GetTexMods( TRUE ); // Set Initial Undo Point + g_surfwin = TRUE; +} + +void HideDlg(){ + g_bListenUpdate = FALSE; + g_bListenChanged = FALSE; + g_surfwin = FALSE; + m_nUndoId = 0; + + gtk_widget_hide( SurfaceInspector ); +} + + +// set default values for increments (shift scale and rot) +// this is called by the prefs code if can't find the values +void InitDefaultIncrement( texdef_t *tex ){ + tex->SetName( "foo" ); + tex->shift[0] = 8; + tex->shift[1] = 8; + tex->scale[0] = 0.25; + tex->scale[1] = 0.25; + tex->rotate = 10; +} + +void BuildDialog(){ + if ( !SurfaceInspector ) { + create_SurfaceInspector(); + } +} + +/* + ============== + SetTexMods + + Set the fields to the current texdef (i.e. map/texdef -> dialog widgets) + =============== + */ + +void SetTexMods(){ + + texturewin = Texturewin(); + l_pIncrement = Get_SI_Inc(); + +#ifdef DBG_SI + Sys_Printf( "SurfaceDlg SetTexMods\n" ); +#endif + + if ( !g_surfwin ) { + return; + } + + g_bListenChanged = FALSE; + + if ( strncmp( texturewin->texdef.GetName(), "textures/", 9 ) != 0 ) { + texdef_SI_values.SetName( SHADER_NOT_FOUND ); + } + + gtk_spin_button_set_increments( GTK_SPIN_BUTTON( hshift_value_spinbutton ), l_pIncrement->shift[0], l_pIncrement->shift[0] ); + gtk_spin_button_set_increments( GTK_SPIN_BUTTON( vshift_value_spinbutton ), l_pIncrement->shift[1], l_pIncrement->shift[1] ); + gtk_spin_button_set_increments( GTK_SPIN_BUTTON( hscale_value_spinbutton ), l_pIncrement->scale[0], l_pIncrement->scale[0] ); + gtk_spin_button_set_increments( GTK_SPIN_BUTTON( vscale_value_spinbutton ), l_pIncrement->scale[1], l_pIncrement->scale[0] ); + gtk_spin_button_set_increments( GTK_SPIN_BUTTON( rotate_value_spinbutton ), l_pIncrement->rotate, l_pIncrement->rotate ); + + gtk_spin_button_set_value( GTK_SPIN_BUTTON( hshift_step_spinbutton ), l_pIncrement->shift[0] ); + gtk_spin_button_set_value( GTK_SPIN_BUTTON( vshift_step_spinbutton ), l_pIncrement->shift[1] ); + gtk_spin_button_set_value( GTK_SPIN_BUTTON( hscale_step_spinbutton ), l_pIncrement->scale[0] ); + gtk_spin_button_set_value( GTK_SPIN_BUTTON( vscale_step_spinbutton ), l_pIncrement->scale[1] ); + gtk_spin_button_set_value( GTK_SPIN_BUTTON( rotate_step_spinbutton ), l_pIncrement->rotate ); + + g_bListenChanged = TRUE; +} + +/* + ============== + GetTexMods + + Shows any changes to the main Radiant windows + =============== + */ +void GetTexMods( bool b_SetUndoPoint ){ + +#ifdef DBG_SI + Sys_Printf( "SurfaceDlg GetTexMods\n" ); +#endif + + if ( !texdef_face_list_empty() ) { + g_bListenUpdate = FALSE; + apply_surface_flags( get_texdef_face_list() ); + SetTexdef_FaceList( get_texdef_face_list(), b_SetUndoPoint, FALSE ); + g_bListenUpdate = TRUE; + + if ( b_SetUndoPoint ) { + m_nUndoId = Undo_GetUndoId(); + } + } +} + +void FitAll(){ + on_fit_button_clicked( NULL, NULL ); +} + +//////////////////////////////////////////////////////////////////// +// +// GUI Section +// +//////////////////////////////////////////////////////////////////// + +GtkWidget* create_SurfaceInspector( void ){ + + GtkWidget *label; + GtkObject *adjustment; + + GtkWidget *table1; + GtkWidget *table2; + + GtkWidget *frame1; + GtkWidget *frame2; + + GtkWidget *vbox1; + GtkWidget *hbox1; + + SurfaceInspector = gtk_window_new( GTK_WINDOW_TOPLEVEL ); + gtk_container_set_border_width( GTK_CONTAINER( SurfaceInspector ), 4 ); + gtk_window_set_title( GTK_WINDOW( SurfaceInspector ), "Surface Inspector" ); + + SetWinPos_from_Prefs( SurfaceInspector ); + + vbox1 = gtk_vbox_new( FALSE, 5 ); + gtk_widget_show( vbox1 ); + gtk_container_add( GTK_CONTAINER( SurfaceInspector ), vbox1 ); + + hbox1 = gtk_hbox_new( FALSE, 5 ); + gtk_widget_show( hbox1 ); + gtk_container_add( GTK_CONTAINER( vbox1 ), hbox1 ); + gtk_container_set_border_width( GTK_CONTAINER( hbox1 ), 4 ); + + label = gtk_label_new( "Texture: " ); + gtk_widget_show( label ); + gtk_box_pack_start( GTK_BOX( hbox1 ), label, FALSE, FALSE, 0 ); + gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 ); + + texture_combo = gtk_combo_new(); + g_object_set_data( G_OBJECT( GTK_COMBO( texture_combo )->popwin ), + "KeepMeAround", texture_combo ); + gtk_combo_disable_activate( (GtkCombo*) texture_combo ); + gtk_widget_show( texture_combo ); + gtk_box_pack_start( GTK_BOX( hbox1 ), texture_combo, TRUE, TRUE, 0 ); + + texture_combo_entry = GTK_COMBO( texture_combo )->entry; + gtk_widget_show( texture_combo_entry ); + gtk_entry_set_max_length( GTK_ENTRY( texture_combo_entry ), 1024 ); + + frame1 = gtk_frame_new( "Surface" ); + gtk_widget_show( frame1 ); + gtk_container_add( GTK_CONTAINER( vbox1 ), frame1 ); + + table1 = gtk_table_new( 7, 3, FALSE ); + gtk_widget_show( table1 ); + gtk_table_set_col_spacings( GTK_TABLE( table1 ), 5 ); + gtk_table_set_row_spacings( GTK_TABLE( table1 ), 5 ); + gtk_container_set_border_width( GTK_CONTAINER( table1 ), 5 ); + gtk_container_add( GTK_CONTAINER( frame1 ), table1 ); + + label = gtk_label_new( "Step" ); + gtk_widget_show( label ); + gtk_table_attach( GTK_TABLE( table1 ), label, 2, 3, 0, 1, + (GtkAttachOptions) ( GTK_FILL ), + (GtkAttachOptions) ( 0 ), 0, 0 ); + + label = gtk_label_new( "Value" ); + gtk_widget_show( label ); + gtk_table_attach( GTK_TABLE( table1 ), label, 1, 2, 0, 1, + (GtkAttachOptions) ( GTK_FILL ), + (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_misc_set_alignment( GTK_MISC( label ), 0.5, 1 ); + + label = gtk_label_new( "Horizontal shift: " ); + gtk_widget_show( label ); + gtk_table_attach( GTK_TABLE( table1 ), label, 0, 1, 1, 2, + (GtkAttachOptions) ( GTK_FILL ), + (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + + label = gtk_label_new( "Vertical shift: " ); + gtk_widget_show( label ); + gtk_table_attach( GTK_TABLE( table1 ), label, 0, 1, 2, 3, + (GtkAttachOptions) ( GTK_FILL ), + (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + + label = gtk_label_new( "Horizontal scale: " ); + gtk_widget_show( label ); + gtk_table_attach( GTK_TABLE( table1 ), label, 0, 1, 3, 4, + (GtkAttachOptions) ( GTK_FILL ), + (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + + label = gtk_label_new( "Vertical scale: " ); + gtk_widget_show( label ); + gtk_table_attach( GTK_TABLE( table1 ), label, 0, 1, 4, 5, + (GtkAttachOptions) ( GTK_FILL ), + (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + + label = gtk_label_new( "Rotate: " ); + gtk_widget_show( label ); + gtk_table_attach( GTK_TABLE( table1 ), label, 0, 1, 5, 6, + (GtkAttachOptions) ( GTK_FILL ), + (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); + + // Value Spins + adjustment = gtk_adjustment_new( 0.0, -8192.0, 8192.0, 2.0, 8.0, 0.0 ); + hshift_value_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( adjustment ), 1, 2 ); + gtk_widget_show( hshift_value_spinbutton ); + gtk_table_attach( GTK_TABLE( table1 ), hshift_value_spinbutton, 1, 2, 1, 2, + (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), + (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( hshift_value_spinbutton ), GTK_UPDATE_IF_VALID ); + gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( hshift_value_spinbutton ), TRUE ); + + adjustment = gtk_adjustment_new( 0.0, -8192.0, 8192.0, 2.0, 8.0, 0.0 ); + vshift_value_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( adjustment ), 1, 2 ); + gtk_widget_show( vshift_value_spinbutton ); + gtk_table_attach( GTK_TABLE( table1 ), vshift_value_spinbutton, 1, 2, 2, 3, + (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), + (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( vshift_value_spinbutton ), GTK_UPDATE_IF_VALID ); + gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( vshift_value_spinbutton ), TRUE ); + + adjustment = gtk_adjustment_new( 0.0, -1024.0, 1024.0, 1.0, 4.0, 0.0 ); + hscale_value_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( adjustment ), 1, 4 ); + gtk_widget_show( hscale_value_spinbutton ); + gtk_table_attach( GTK_TABLE( table1 ), hscale_value_spinbutton, 1, 2, 3, 4, + (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), + (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( hscale_value_spinbutton ), GTK_UPDATE_IF_VALID ); + gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( hscale_value_spinbutton ), TRUE ); + + adjustment = gtk_adjustment_new( 0.0, -1024.0, 1024.0, 1.0, 4.0, 0.0 ); + vscale_value_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( adjustment ), 1, 4 ); + gtk_widget_show( vscale_value_spinbutton ); + gtk_table_attach( GTK_TABLE( table1 ), vscale_value_spinbutton, 1, 2, 4, 5, + (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), + (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( vscale_value_spinbutton ), GTK_UPDATE_IF_VALID ); + + adjustment = gtk_adjustment_new( 0.0, -360.0, 360.0, 1.0, 10.0, 0.0 ); + rotate_value_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( adjustment ), 1, 0 ); + gtk_widget_show( rotate_value_spinbutton ); + gtk_table_attach( GTK_TABLE( table1 ), rotate_value_spinbutton, 1, 2, 5, 6, + (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), + (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( rotate_value_spinbutton ), GTK_UPDATE_IF_VALID ); + gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( rotate_value_spinbutton ), TRUE ); + + // Step Spins + adjustment = gtk_adjustment_new( 0.0, -8192.0, 8192.0, 2.0, 8.0, 0.0 ); + hshift_step_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( adjustment ), 1, 2 ); + gtk_widget_show( hshift_step_spinbutton ); + gtk_table_attach( GTK_TABLE( table1 ), hshift_step_spinbutton, 2, 3, 1, 2, + (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), + (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( hshift_step_spinbutton ), GTK_UPDATE_IF_VALID ); + + adjustment = gtk_adjustment_new( 0.0, -8192.0, 8192.0, 2.0, 8.0, 0.0 ); + vshift_step_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( adjustment ), 1, 2 ); + gtk_widget_show( vshift_step_spinbutton ); + gtk_table_attach( GTK_TABLE( table1 ), vshift_step_spinbutton, 2, 3, 2, 3, + (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), + (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( vshift_step_spinbutton ), GTK_UPDATE_IF_VALID ); + + adjustment = gtk_adjustment_new( 0.0, -1024.0, 1024.0, 1.0, 4.0, 0.0 ); + hscale_step_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( adjustment ), 1, 4 ); + gtk_widget_show( hscale_step_spinbutton ); + gtk_table_attach( GTK_TABLE( table1 ), hscale_step_spinbutton, 2, 3, 3, 4, + (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), + (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( hscale_step_spinbutton ), GTK_UPDATE_IF_VALID ); + + adjustment = gtk_adjustment_new( 0.0, -1024.0, 1024.0, 1.0, 4.0, 0.0 ); + vscale_step_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( adjustment ), 1, 4 ); + gtk_widget_show( vscale_step_spinbutton ); + gtk_table_attach( GTK_TABLE( table1 ), vscale_step_spinbutton, 2, 3, 4, 5, + (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), + (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( vscale_step_spinbutton ), GTK_UPDATE_IF_VALID ); + + adjustment = gtk_adjustment_new( 0.0, -360.0, 360.0, 1.0, 10.0, 0.0 ); + rotate_step_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( adjustment ), 1, 2 ); + gtk_widget_show( rotate_step_spinbutton ); + gtk_table_attach( GTK_TABLE( table1 ), rotate_step_spinbutton, 2, 3, 5, 6, + (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), + (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( rotate_step_spinbutton ), GTK_UPDATE_IF_VALID ); + + match_grid_button = gtk_button_new_with_mnemonic( "Match Grid" ); + gtk_widget_show( match_grid_button ); + gtk_table_attach( GTK_TABLE( table1 ), match_grid_button, 2, 3, 6, 7, + (GtkAttachOptions) ( GTK_FILL ), + (GtkAttachOptions) ( 0 ), 0, 0 ); + + frame2 = gtk_frame_new( "Tools" ); + gtk_widget_show( frame2 ); + gtk_container_add( GTK_CONTAINER( vbox1 ), frame2 ); + + table2 = gtk_table_new( 2, 4, TRUE ); + gtk_widget_show( table2 ); + gtk_table_set_col_spacings( GTK_TABLE( table2), 5 ); + gtk_table_set_row_spacings( GTK_TABLE( table2 ), 0 ); + gtk_container_set_border_width( GTK_CONTAINER( table2 ), 5 ); + gtk_container_add( GTK_CONTAINER( frame2 ), table2 ); + + label = gtk_label_new( "Height" ); + gtk_widget_show( label ); + gtk_table_attach( GTK_TABLE( table2 ), label, 3, 4, 0, 1, + (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), + (GtkAttachOptions) ( 0 ), 0, 0 ); + + label = gtk_label_new( "Width" ); + gtk_widget_show( label ); + gtk_table_attach( GTK_TABLE( table2 ), label, 2, 3, 0, 1, + (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), + (GtkAttachOptions) ( 0 ), 0, 0 ); + + label = gtk_label_new( "Brush" ); + gtk_widget_show( label ); + gtk_table_attach( GTK_TABLE( table2 ), label, 0, 2, 0, 1, + (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), + (GtkAttachOptions) ( 0 ), 0, 0 ); + + adjustment = gtk_adjustment_new( 1, 1, 32, 1, 10, 0 ); + fit_height_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( adjustment ), 1, 0 ); + gtk_widget_show( fit_height_spinbutton ); + gtk_table_attach( GTK_TABLE( table2 ), fit_height_spinbutton, 3, 4, 1, 2, + (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), + (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( fit_height_spinbutton ), TRUE ); + gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( fit_height_spinbutton ), GTK_UPDATE_IF_VALID ); + + adjustment = gtk_adjustment_new( 1, 1, 32, 1, 10, 0 ); + fit_width_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( adjustment ), 1, 0 ); + gtk_widget_show( fit_width_spinbutton ); + gtk_table_attach( GTK_TABLE( table2 ), fit_width_spinbutton, 2, 3, 1, 2, + (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), + (GtkAttachOptions) ( 0 ), 0, 0 ); + gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( fit_width_spinbutton ), TRUE ); + gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( fit_width_spinbutton ), GTK_UPDATE_IF_VALID ); + + fit_button = gtk_button_new_with_mnemonic( "Fit" ); + gtk_widget_show( fit_button ); + gtk_table_attach( GTK_TABLE( table2 ), fit_button, 1, 2, 1, 2, + (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), + (GtkAttachOptions) ( 0 ), 0, 0 ); + + axial_button = gtk_button_new_with_mnemonic( "Axial" ); + gtk_widget_show( axial_button ); + gtk_table_attach( GTK_TABLE( table2 ), axial_button, 0, 1, 1, 2, + (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), + (GtkAttachOptions) ( 0 ), 0, 0 ); + + // Add the SURF_ and CONTENTS_ flags frame + create_SurfaceFlagsFrame( vbox1 ); + + g_signal_connect( (gpointer) SurfaceInspector, + "delete_event", + G_CALLBACK( delete_event_callback ), + NULL ); + g_signal_connect( (gpointer) SurfaceInspector, "destroy", + G_CALLBACK( gtk_widget_destroy ), + NULL ); + + g_signal_connect( (gpointer) texture_combo_entry, "key_press_event", + G_CALLBACK( on_texture_combo_entry_key_press_event ), + NULL ); + g_signal_connect( (gpointer) texture_combo_entry, "activate", + G_CALLBACK( on_texture_combo_entry_activate ), + NULL ); + + g_signal_connect( (gpointer) hshift_value_spinbutton, "value_changed", + G_CALLBACK( on_hshift_value_spinbutton_value_changed ), + NULL ); + g_signal_connect( (gpointer) vshift_value_spinbutton, "value_changed", + G_CALLBACK( on_vshift_value_spinbutton_value_changed ), + NULL ); + g_signal_connect( (gpointer) hscale_value_spinbutton, "value_changed", + G_CALLBACK( on_hscale_value_spinbutton_value_changed ), + NULL ); + g_signal_connect( (gpointer) vscale_value_spinbutton, "value_changed", + G_CALLBACK( on_vscale_value_spinbutton_value_changed ), + NULL ); + g_signal_connect( (gpointer) rotate_value_spinbutton, "value_changed", + G_CALLBACK( on_rotate_value_spinbutton_value_changed ), + NULL ); + + g_signal_connect( (gpointer) hshift_step_spinbutton, "value_changed", + G_CALLBACK( on_hshift_step_spinbutton_value_changed ), + NULL ); + g_signal_connect( (gpointer) vshift_step_spinbutton, "value_changed", + G_CALLBACK( on_vshift_step_spinbutton_value_changed ), + NULL ); + g_signal_connect( (gpointer) hscale_step_spinbutton, "value_changed", + G_CALLBACK( on_hscale_step_spinbutton_value_changed ), + NULL ); + g_signal_connect( (gpointer) vscale_step_spinbutton, "value_changed", + G_CALLBACK( on_vscale_step_spinbutton_value_changed ), + NULL ); + g_signal_connect( (gpointer) rotate_step_spinbutton, "value_changed", + G_CALLBACK( on_rotate_step_spinbutton_value_changed ), + NULL ); + + g_signal_connect( (gpointer) match_grid_button, "clicked", + G_CALLBACK( on_match_grid_button_clicked ), + NULL ); + + g_signal_connect( (gpointer) fit_width_spinbutton, "value_changed", + G_CALLBACK( on_fit_width_spinbutton_value_changed ), + NULL ); + g_signal_connect( (gpointer) fit_height_spinbutton, "value_changed", + G_CALLBACK( on_fit_height_spinbutton_value_changed ), + NULL ); + g_signal_connect( (gpointer) fit_button, "clicked", + G_CALLBACK( on_fit_button_clicked ), + NULL ); + + g_signal_connect( (gpointer) axial_button, "clicked", + G_CALLBACK( on_axial_button_clicked ), + NULL ); + + return SurfaceInspector; +} + + +// Texture Combo +gboolean on_texture_combo_entry_key_press_event( GtkWidget *widget, GdkEventKey *event, + gpointer user_data ){ + // Have Tab activate selection as well as Return + if ( event->keyval == GDK_Tab ) { + g_signal_emit_by_name( texture_combo_entry, "activate" ); + } + + return FALSE; +} + +void on_texture_combo_entry_activate( GtkEntry *entry, gpointer user_data ){ + texdef_t* tmp_texdef; + texdef_t* tmp_orig_texdef; + texdef_to_face_t* temp_texdef_face_list; + char text[128] = { 0 }; + + if ( !texdef_face_list_empty() && g_bListenChanged ) { + // activate only on entry change + strcpy( text, gtk_entry_get_text( entry ) ); + if ( strcmp( old_texture_entry, text ) ) { + // Check for spaces in shader name + if ( text[0] <= ' ' || strchr( text, ' ' ) ) { + Sys_FPrintf( SYS_WRN, "WARNING: spaces in shader names are not allowed, ignoring '%s'\n", text ); + } + else + { + for ( temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next ) + { + tmp_texdef = (texdef_t *) &temp_texdef_face_list->texdef; + tmp_orig_texdef = (texdef_t *) &temp_texdef_face_list->orig_texdef; + strcpy( old_texture_entry, text ); + tmp_texdef->SetName( text ); + } + GetTexMods(); + } + } + } +} + + +// Match Grid +static void on_match_grid_button_clicked( GtkButton *button, gpointer user_data ){ + float hscale, vscale; + + if ( !strcmp( gtk_entry_get_text( GTK_ENTRY( hscale_value_spinbutton ) ), "" ) ) { + hscale = 0.0; + } + else{ + hscale = gtk_spin_button_get_value( GTK_SPIN_BUTTON( hscale_value_spinbutton ) ); + } + + if ( !strcmp( gtk_entry_get_text( GTK_ENTRY( vscale_value_spinbutton ) ), "" ) ) { + vscale = 0.0; + } + else{ + vscale = gtk_spin_button_get_value( GTK_SPIN_BUTTON( vscale_value_spinbutton ) ); + } + DoSnapTToGrid( hscale, vscale ); +} + +// Value Spins +static void on_hshift_value_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){ + texdef_t* tmp_texdef; + texdef_t* tmp_orig_texdef; + texdef_to_face_t* temp_texdef_face_list; + + texdef_SI_values.shift[0] = gtk_spin_button_get_value( GTK_SPIN_BUTTON( hshift_value_spinbutton ) ); + + if ( !texdef_face_list_empty() && g_bListenChanged ) { + for ( temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next ) + { + tmp_texdef = (texdef_t *) &temp_texdef_face_list->texdef; + tmp_orig_texdef = (texdef_t *) &temp_texdef_face_list->orig_texdef; + tmp_texdef->shift[0] = texdef_SI_values.shift[0]; + is_HShift_conflicting = FALSE; + } + GetTexMods(); + } +} + +static void on_vshift_value_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){ + texdef_t* tmp_texdef; + texdef_t* tmp_orig_texdef; + texdef_to_face_t* temp_texdef_face_list; + + texdef_SI_values.shift[1] = gtk_spin_button_get_value( GTK_SPIN_BUTTON( vshift_value_spinbutton ) ); + + if ( !texdef_face_list_empty() && g_bListenChanged ) { + for ( temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next ) + { + tmp_texdef = (texdef_t *) &temp_texdef_face_list->texdef; + tmp_orig_texdef = (texdef_t *) &temp_texdef_face_list->orig_texdef; + tmp_texdef->shift[1] = texdef_SI_values.shift[1]; + is_VShift_conflicting = FALSE; + } + GetTexMods(); + } +} + +static void on_hscale_value_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){ + texdef_t* tmp_texdef; + texdef_t* tmp_orig_texdef; + texdef_to_face_t* temp_texdef_face_list; + + texdef_SI_values.scale[0] = gtk_spin_button_get_value( GTK_SPIN_BUTTON( hscale_value_spinbutton ) ); + + if ( !texdef_face_list_empty() && g_bListenChanged ) { + for ( temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next ) + { + tmp_texdef = (texdef_t *) &temp_texdef_face_list->texdef; + tmp_orig_texdef = (texdef_t *) &temp_texdef_face_list->orig_texdef; + tmp_texdef->scale[0] = texdef_SI_values.scale[0]; + is_HScale_conflicting = FALSE; + } + GetTexMods(); + } +} + +static void on_vscale_value_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){ + texdef_t* tmp_texdef; + texdef_t* tmp_orig_texdef; + texdef_to_face_t* temp_texdef_face_list; + + texdef_SI_values.scale[1] = gtk_spin_button_get_value( GTK_SPIN_BUTTON( vscale_value_spinbutton ) ); + + if ( !texdef_face_list_empty() && g_bListenChanged ) { + for ( temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next ) + { + tmp_texdef = (texdef_t *) &temp_texdef_face_list->texdef; + tmp_orig_texdef = (texdef_t *) &temp_texdef_face_list->orig_texdef; + tmp_texdef->scale[1] = texdef_SI_values.scale[1]; + is_VScale_conflicting = FALSE; + } + GetTexMods(); + } +} + +static void on_rotate_value_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){ + texdef_t* tmp_texdef; + texdef_t* tmp_orig_texdef; + texdef_to_face_t* temp_texdef_face_list; + + texdef_SI_values.rotate = gtk_spin_button_get_value( GTK_SPIN_BUTTON( rotate_value_spinbutton ) ); + + if ( !texdef_face_list_empty() && g_bListenChanged ) { + for ( temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next ) + { + tmp_texdef = (texdef_t *) &temp_texdef_face_list->texdef; + tmp_orig_texdef = (texdef_t *) &temp_texdef_face_list->orig_texdef; + tmp_texdef->rotate = texdef_SI_values.rotate; + is_Rotate_conflicting = FALSE; + } + GetTexMods(); + } +} + + +// Step Spins +static void on_hshift_step_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){ + gfloat val; + GtkAdjustment * adjust; + + if ( !g_bListenChanged ) { + return; + } + + l_pIncrement = Get_SI_Inc(); + +#ifdef DBG_SI + Sys_Printf( "OnIncrementChanged HShift\n" ); +#endif + + val = gtk_spin_button_get_value( GTK_SPIN_BUTTON( hshift_step_spinbutton ) ) ; + adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( hshift_value_spinbutton ) ); + adjust->step_increment = val; + l_pIncrement->shift[0] = val; +} + +static void on_vshift_step_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){ + gfloat val; + GtkAdjustment * adjust; + + if ( !g_bListenChanged ) { + return; + } + + l_pIncrement = Get_SI_Inc(); + +#ifdef DBG_SI + Sys_Printf( "OnIncrementChanged VShift\n" ); +#endif + + val = gtk_spin_button_get_value( GTK_SPIN_BUTTON( vshift_step_spinbutton ) ) ; + adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( vshift_value_spinbutton ) ); + adjust->step_increment = val; + l_pIncrement->shift[1] = val; +} + +static void on_hscale_step_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){ + gfloat val; + GtkAdjustment * adjust; + + if ( !g_bListenChanged ) { + return; + } + + l_pIncrement = Get_SI_Inc(); + +#ifdef DBG_SI + Sys_Printf( "OnIncrementChanged HShift\n" ); +#endif + + val = gtk_spin_button_get_value( GTK_SPIN_BUTTON( hscale_step_spinbutton ) ) ; + adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( hscale_value_spinbutton ) ); + adjust->step_increment = val; + l_pIncrement->scale[0] = val; +} + +static void on_vscale_step_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){ + gfloat val; + GtkAdjustment * adjust; + + if ( !g_bListenChanged ) { + return; + } + + l_pIncrement = Get_SI_Inc(); + +#ifdef DBG_SI + Sys_Printf( "OnIncrementChanged HShift\n" ); +#endif + + val = gtk_spin_button_get_value( GTK_SPIN_BUTTON( vscale_step_spinbutton ) ) ; + adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( vscale_value_spinbutton ) ); + adjust->step_increment = val; + l_pIncrement->scale[1] = val; +} + +static void on_rotate_step_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){ + gfloat val; + GtkAdjustment * adjust; + + if ( !g_bListenChanged ) { + return; + } + + l_pIncrement = Get_SI_Inc(); + +#ifdef DBG_SI + Sys_Printf( "OnIncrementChanged HShift\n" ); +#endif + + val = gtk_spin_button_get_value( GTK_SPIN_BUTTON( rotate_step_spinbutton ) ) ; + adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( rotate_value_spinbutton ) ); + adjust->step_increment = val; + l_pIncrement->rotate = val; +} + + +// Fit Texture +static void on_fit_width_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){ + m_nWidth = gtk_spin_button_get_value_as_int( GTK_SPIN_BUTTON( fit_width_spinbutton ) ); +} + +static void on_fit_height_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){ + m_nHeight = gtk_spin_button_get_value_as_int( GTK_SPIN_BUTTON( fit_height_spinbutton ) ); +} + +static void on_fit_button_clicked( GtkButton *button, gpointer user_data ){ + FaceList_FitTexture( get_texdef_face_list(), m_nHeight, m_nWidth ); + Sys_UpdateWindows( W_ALL ); +} + +// Axial Button +static void on_axial_button_clicked( GtkButton *button, gpointer user_data ){ + texdef_t* tmp_texdef; + texdef_to_face_t* temp_texdef_face_list; + + if ( !texdef_face_list_empty() && g_bListenChanged ) { + for ( temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next ) + { + tmp_texdef = (texdef_t *) &temp_texdef_face_list->texdef; + tmp_texdef->shift[0] = 0.0; + tmp_texdef->shift[1] = 0.0; + tmp_texdef->scale[0] = 0.5; + tmp_texdef->scale[1] = 0.5; + tmp_texdef->rotate = 0.0; + } + } + + SetTexdef_FaceList( get_texdef_face_list(), FALSE, TRUE ); + Sys_UpdateWindows( W_ALL ); +} diff --git a/plugins/surface_heretic2/surfacedialog.h b/plugins/surface_idtech2/surfacedialog.h similarity index 76% rename from plugins/surface_heretic2/surfacedialog.h rename to plugins/surface_idtech2/surfacedialog.h index 23b7ec9d..8d51fc94 100644 --- a/plugins/surface_heretic2/surfacedialog.h +++ b/plugins/surface_idtech2/surfacedialog.h @@ -22,6 +22,18 @@ #ifndef _SURFACEDIALOG_H_ #define _SURFACEDIALOG_H_ +#include "surfdlg_plugin.h" + +void ShowDlg(); +void HideDlg(); +void SetTexMods(); +void GetTexMods( bool b_SetUndoPoint = FALSE ); +void BuildDialog(); +void FitAll(); +void InitDefaultIncrement( texdef_t * ); +void DoSnapTToGrid( float hscale, float vscale ); +// called to perform a fitting from the outside (shortcut key) +void SurfaceDialogFitAll(); void UpdateSurfaceDialog(); void DoSurface(); void ToggleSurface(); diff --git a/plugins/surface_ufoai/surfaceflagsdialog_ufoai.cpp b/plugins/surface_idtech2/surfaceflags.cpp similarity index 87% rename from plugins/surface_ufoai/surfaceflagsdialog_ufoai.cpp rename to plugins/surface_idtech2/surfaceflags.cpp index cbfad923..16a3b522 100644 --- a/plugins/surface_ufoai/surfaceflagsdialog_ufoai.cpp +++ b/plugins/surface_idtech2/surfaceflags.cpp @@ -25,8 +25,8 @@ #include #include "surfdlg_plugin.h" - -#include "surfaceflagsdialog_ufoai.h" +#include "surfacedialog.h" +#include "surfaceflags.h" GtkWidget *notebook1; @@ -80,7 +80,7 @@ void clear_all_buttons_and_values(){ gtk_entry_set_text( (GtkEntry *)value_entry, "" ); } -void SetFlagButtons_UFOAI( texdef_to_face_t *texdef_face_list, bool b_isListEmpty ){ +void set_surface_flags_button_state( texdef_to_face_t *texdef_face_list, bool b_isListEmpty ){ int contents = 0; int flags = 0; int value = 0; @@ -105,8 +105,10 @@ void SetFlagButtons_UFOAI( texdef_to_face_t *texdef_face_list, bool b_isListEmpt flags = tmp_texdef->flags; value = tmp_texdef->value; +#if _DEBUG Sys_Printf( "Surface: %d\tContents: %d\tValue: %d\ttmp_texdef\n",tmp_texdef->flags,tmp_texdef->contents,tmp_texdef->value ); Sys_Printf( "Surface: %d\tContents: %d\tValue: %d\n",flags,contents,value ); +#endif for ( temp_texdef_face_list = texdef_face_list->next; temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next ) { @@ -117,8 +119,10 @@ void SetFlagButtons_UFOAI( texdef_to_face_t *texdef_face_list, bool b_isListEmpt diff_value = TRUE; } +#if _DEBUG Sys_Printf( "Surface: %d\tContents: %d\tValue: %d\ttmp_texdef\n",tmp_texdef->flags,tmp_texdef->contents,tmp_texdef->value ); Sys_Printf( "Surface: %d\tContents: %d\tValue: %d\n",flags,contents,value ); +#endif } } @@ -167,18 +171,18 @@ void SetFlagButtons_UFOAI( texdef_to_face_t *texdef_face_list, bool b_isListEmpt setup_buttons = FALSE; } -void SetChangeInFlags_Face_UFOAI( texdef_to_face_t *texdef_face_list ){ - texdef_to_face_t *temp_texdef_face_list; - texdef_t *tmp_texdef; +void apply_surface_flags( texdef_to_face_t *faces ){ + texdef_to_face_t *face; + texdef_t *tex; - for ( temp_texdef_face_list = texdef_face_list; temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next ) + for ( face = faces; face; face = face->next ) { - tmp_texdef = &temp_texdef_face_list->texdef; - tmp_texdef->flags = ( tmp_texdef->flags & ~surface_mask ) | working_surface_flags; - tmp_texdef->contents = ( tmp_texdef->contents & ~content_mask ) | working_content_flags; - tmp_texdef->value = working_value; - Sys_Printf( "content_flag: %d content_mask: %d\n",working_content_flags,content_mask ); - Sys_Printf( "content: %d\n",tmp_texdef->contents ); + tex = &face->texdef; + tex->flags = ( tex->flags & ~surface_mask ) | working_surface_flags; + tex->contents = ( tex->contents & ~content_mask ) | working_content_flags; + tex->value = working_value; + + Sys_Printf( "Surface: %d\tContents: %d\tValue: %d\n", tex->flags, tex->contents, tex->value ); } } @@ -197,6 +201,8 @@ inline void change_surfaceflag( GtkWidget *togglebutton, int sur_flag, gboolean else{ working_surface_flags &= ~sur_flag; } + + GetTexMods( false ); } } @@ -206,8 +212,7 @@ inline void change_contentflag( GtkWidget *togglebutton, int content_flag, gbool if ( gtk_toggle_button_get_inconsistent( GTK_TOGGLE_BUTTON( togglebutton ) ) ) { clear_inconsistent( togglebutton ); } - //if (g_ptrSelectedFaces.GetSize() == 0) // Only changing content flags on whole brushes, not faces. - //{ + content_mask |= content_flag; if ( change_flag_to ) { @@ -216,8 +221,8 @@ inline void change_contentflag( GtkWidget *togglebutton, int content_flag, gbool else{ working_content_flags &= ~content_flag; } - //} - Sys_Printf( "content_flag: %d content_mask: %d\n",content_flag,content_mask ); + + GetTexMods( false ); } } @@ -237,6 +242,7 @@ void on_content_button_toggled( GtkToggleButton *togglebutton, gpointer user_dat void on_value_entry_changed( GtkEditable *editable, gpointer user_data ){ if ( ( !setup_buttons ) ) { // If we're setting up the buttons, don't change value working_value = atoi( gtk_entry_get_text( (GtkEntry*)editable ) ); + GetTexMods( false ); } } @@ -277,9 +283,9 @@ void on_contentbutton_clicked( GtkButton *button, gpointer user_data ){ gtk_notebook_set_page( GTK_NOTEBOOK( notebook1 ), 1 ); } -#define UFOAI_FLAG_BUTTON_BORDER 3 +#define IDTECH2_FLAG_BUTTON_BORDER 3 -GtkWidget* Create_UFOAIFlagsDialog( GtkWidget* surfacedialog_widget ){ +GtkWidget* create_SurfaceFlagsFrame( GtkWidget* surfacedialog_widget ){ GtkWidget *frame1; GtkWidget *vbox1; GtkWidget *vbox2; @@ -288,7 +294,6 @@ GtkWidget* Create_UFOAIFlagsDialog( GtkWidget* surfacedialog_widget ){ GtkWidget *table4; GtkWidget *hbox2; GtkWidget *hbox3; - GtkWidget *hseparator1; GtkWidget *value_label; GtkWidget *label5; GtkWidget *table3; @@ -311,12 +316,14 @@ GtkWidget* Create_UFOAIFlagsDialog( GtkWidget* surfacedialog_widget ){ gtk_notebook_set_show_tabs( GTK_NOTEBOOK( notebook1 ), TRUE ); gtk_container_set_border_width( GTK_CONTAINER( notebook1 ), 5 ); - vbox2 = gtk_vbox_new( FALSE, 0 ); + vbox2 = gtk_vbox_new( FALSE, 5 ); gtk_widget_show( vbox2 ); gtk_container_add( GTK_CONTAINER( notebook1 ), vbox2 ); - table4 = gtk_table_new( 8, 4, FALSE ); + table4 = gtk_table_new( 8, 4, TRUE ); gtk_widget_show( table4 ); + gtk_table_set_col_spacings( GTK_TABLE( table4 ), 5 ); + gtk_table_set_row_spacings( GTK_TABLE( table4 ), 5 ); gtk_box_pack_start( GTK_BOX( vbox2 ), table4, TRUE, TRUE, 0 ); y = -1; @@ -334,14 +341,8 @@ GtkWidget* Create_UFOAIFlagsDialog( GtkWidget* surfacedialog_widget ){ gtk_table_attach( GTK_TABLE( table4 ), surface_buttons[i], 0 + x, 1 + x, ( 0 + y ), ( 1 + y ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); - gtk_container_set_border_width( GTK_CONTAINER( surface_buttons[i] ), UFOAI_FLAG_BUTTON_BORDER ); } - hseparator1 = gtk_hseparator_new(); - gtk_widget_show( hseparator1 ); - gtk_box_pack_start( GTK_BOX( vbox2 ), hseparator1, FALSE, FALSE, 0 ); - gtk_widget_set_usize( hseparator1, -2, 5 ); - hbox2 = gtk_hbox_new( FALSE, 0 ); gtk_widget_show( hbox2 ); gtk_box_pack_start( GTK_BOX( vbox2 ), hbox2, FALSE, FALSE, 0 ); @@ -377,8 +378,10 @@ GtkWidget* Create_UFOAIFlagsDialog( GtkWidget* surfacedialog_widget ){ gtk_widget_show( label5 ); gtk_notebook_set_tab_label( GTK_NOTEBOOK( notebook1 ), gtk_notebook_get_nth_page( GTK_NOTEBOOK( notebook1 ), 0 ), label5 ); - table3 = gtk_table_new( 8, 4, FALSE ); + table3 = gtk_table_new( 8, 4, TRUE ); gtk_widget_show( table3 ); + gtk_table_set_col_spacings( GTK_TABLE( table3 ), 5 ); + gtk_table_set_row_spacings( GTK_TABLE( table3 ), 5 ); gtk_container_add( GTK_CONTAINER( notebook1 ), table3 ); y = -1; @@ -395,7 +398,6 @@ GtkWidget* Create_UFOAIFlagsDialog( GtkWidget* surfacedialog_widget ){ gtk_table_attach( GTK_TABLE( table3 ), content_buttons[i], 0 + x, 1 + x, ( 0 + y ), ( 1 + y ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); - gtk_container_set_border_width( GTK_CONTAINER( content_buttons[i] ), UFOAI_FLAG_BUTTON_BORDER ); } label6 = gtk_label_new( "Content Flags" ); diff --git a/plugins/surface_quake2/surfacedialog.h b/plugins/surface_idtech2/surfaceflags.h similarity index 72% rename from plugins/surface_quake2/surfacedialog.h rename to plugins/surface_idtech2/surfaceflags.h index 23b7ec9d..6c761e73 100644 --- a/plugins/surface_quake2/surfacedialog.h +++ b/plugins/surface_idtech2/surfaceflags.h @@ -19,13 +19,13 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef _SURFACEDIALOG_H_ -#define _SURFACEDIALOG_H_ +#ifndef _SURFACEFLAGS_H +#define _SURFACEFLAGS_H -void UpdateSurfaceDialog(); -void DoSurface(); -void ToggleSurface(); -void SurfaceDlgFitAll(); -GtkWidget *Get_SI_Module_Widget(); +#include "surfdlg_plugin.h" -#endif // _SURFACEDIALOG_H_ +void set_surface_flags_button_state( texdef_to_face_t *texdef_face_list, bool b_isListEmpty ); +void apply_surface_flags( texdef_to_face_t *texdef_face_list ); +GtkWidget* create_SurfaceFlagsFrame( GtkWidget* surfacedialog_widget ); + +#endif // _SURFACEFLAGS_H diff --git a/plugins/surface_quake2/surfdlg_plugin.cpp b/plugins/surface_idtech2/surfdlg_plugin.cpp similarity index 93% rename from plugins/surface_quake2/surfdlg_plugin.cpp rename to plugins/surface_idtech2/surfdlg_plugin.cpp index ba9de460..52b1c4f2 100644 --- a/plugins/surface_quake2/surfdlg_plugin.cpp +++ b/plugins/surface_idtech2/surfdlg_plugin.cpp @@ -76,12 +76,12 @@ extern "C" CSynapseClient * SYNAPSE_DLL_EXPORT Synapse_EnumerateInterfaces( cons g_pSynapseServer->IncRef(); Set_Syn_Printf( g_pSynapseServer->Get_Syn_Printf() ); - g_SynapseClient.AddAPI( SURFACEDIALOG_MAJOR, "quake2", sizeof( _QERPlugSurfaceTable ) ); + g_SynapseClient.AddAPI( SURFACEDIALOG_MAJOR, "idtech2", sizeof( _QERPlugSurfaceTable ) ); g_SynapseClient.AddAPI( RADIANT_MAJOR, NULL, sizeof( _QERFuncTable_1 ), SYN_REQUIRE, &g_FuncTable ); g_SynapseClient.AddAPI( UNDO_MAJOR, NULL, sizeof( _QERUndoTable ), SYN_REQUIRE, &g_UndoTable ); g_SynapseClient.AddAPI( APPSURFACEDIALOG_MAJOR, NULL, sizeof( _QERAppSurfaceTable ), SYN_REQUIRE, &g_AppSurfaceTable ); g_SynapseClient.AddAPI( SELECTEDFACE_MAJOR, NULL, sizeof( _QERSelectedFaceTable ), SYN_REQUIRE, &g_SelectedFaceTable ); - g_SynapseClient.AddAPI( SHADERS_MAJOR, "quake2", sizeof( _QERShadersTable ), SYN_REQUIRE, &g_ShadersTable ); + g_SynapseClient.AddAPI( SHADERS_MAJOR, "idtech2", sizeof( _QERShadersTable ), SYN_REQUIRE, &g_ShadersTable ); g_SynapseClient.AddAPI( APPSHADERS_MAJOR, NULL, sizeof( _QERAppShadersTable ), SYN_REQUIRE, &g_AppShadersTable ); g_SynapseClient.AddAPI( DATA_MAJOR, NULL, sizeof( _QERAppDataTable ), SYN_REQUIRE, &g_AppDataTable ); @@ -91,7 +91,7 @@ extern "C" CSynapseClient * SYNAPSE_DLL_EXPORT Synapse_EnumerateInterfaces( cons bool CSynapseClient_SurfDLG::RequestAPI( APIDescriptor_t *pAPI ){ if ( !strcmp( pAPI->major_name, SURFACEDIALOG_MAJOR ) ) { _QERPlugSurfaceTable* pSurfDialogTable = static_cast<_QERPlugSurfaceTable*>( pAPI->mpTable ); - if ( !strcmp( pAPI->minor_name, "quake2" ) ) { + if ( !strcmp( pAPI->minor_name, "idtech2" ) ) { pSurfDialogTable->m_pfnToggleSurface = &ToggleSurface; pSurfDialogTable->m_pfnDoSurface = &DoSurface; pSurfDialogTable->m_pfnUpdateSurfaceDialog = &UpdateSurfaceDialog; @@ -108,7 +108,7 @@ bool CSynapseClient_SurfDLG::RequestAPI( APIDescriptor_t *pAPI ){ #include "version.h" const char* CSynapseClient_SurfDLG::GetInfo(){ - return "Surface Dialog (Quake 2) module built " __DATE__ " " RADIANT_VERSION; + return "Surface Dialog (idTech2) module built " __DATE__ " " RADIANT_VERSION; } const char* CSynapseClient_SurfDLG::GetName(){ diff --git a/plugins/surface_quake2/surfdlg_plugin.h b/plugins/surface_idtech2/surfdlg_plugin.h similarity index 99% rename from plugins/surface_quake2/surfdlg_plugin.h rename to plugins/surface_idtech2/surfdlg_plugin.h index b90020d5..6f65af77 100644 --- a/plugins/surface_quake2/surfdlg_plugin.h +++ b/plugins/surface_idtech2/surfdlg_plugin.h @@ -81,7 +81,6 @@ extern _QERAppDataTable g_AppDataTable; #define Sys_FPrintf g_FuncTable.m_pfnSysFPrintf #define Sys_UpdateWindows g_FuncTable.m_pfnSysUpdateWindows - #define Select_FitTexture g_AppSurfaceTable.m_pfnSelect_FitTexture #define Get_SI_Inc g_AppSurfaceTable.m_pfnQERApp_QeglobalsSavedinfo_SIInc #define GridSize g_AppSurfaceTable.m_pfnQeglobalsGetGridSize diff --git a/plugins/surface_quake2/surface_quake2.def b/plugins/surface_quake2/surface_quake2.def deleted file mode 100644 index 8f1435ac..00000000 --- a/plugins/surface_quake2/surface_quake2.def +++ /dev/null @@ -1,7 +0,0 @@ -; surface_quake2.def : Declares the module parameters for the DLL. - -LIBRARY "SURFACE_QUAKE2" - -EXPORTS - ; Explicit exports can go here - Synapse_EnumerateInterfaces @1 diff --git a/plugins/surface_quake2/surface_quake2.vcproj b/plugins/surface_quake2/surface_quake2.vcproj deleted file mode 100644 index 28ec69db..00000000 --- a/plugins/surface_quake2/surface_quake2.vcproj +++ /dev/null @@ -1,195 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/plugins/surface_quake2/surface_quake2.vcxproj b/plugins/surface_quake2/surface_quake2.vcxproj deleted file mode 100644 index 0c5f67e4..00000000 --- a/plugins/surface_quake2/surface_quake2.vcxproj +++ /dev/null @@ -1,177 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {32AB82AA-C781-4E5E-83A0-A164D371306F} - Win32Proj - - - - DynamicLibrary - v110 - - - DynamicLibrary - v110 - - - DynamicLibrary - v110 - - - DynamicLibrary - v110 - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>11.0.60315.1 - - - $(SolutionDir)\install\modules\ - $(SolutionDir)\build\intermediate\$(Configuration)\$(ProjectName)\ - - - - $(SolutionDir)\install\modules\ - $(SolutionDir)\build\intermediate\$(Configuration)\$(ProjectName)\ - - - - - Disabled - $(SolutionDir)\libs;$(SolutionDir)\include;$(SolutionDir)\..\STLport-5.2.1\stlport;$(SolutionDir)\..\gtk-2.24.10\include\glib-2.0;$(SolutionDir)\..\gtk-2.24.10\include\gdk-pixbuf-2.0;$(SolutionDir)\..\gtk-2.24.10\lib\glib-2.0\include;$(SolutionDir)\..\gtk-2.24.10\include;$(SolutionDir)\..\gtk-2.24.10\include\gtk-2.0;$(SolutionDir)\..\gtk-2.24.10\lib\gtk-2.0\include;$(SolutionDir)\..\gtk-2.24.10\include\cairo;$(SolutionDir)\..\gtk-2.24.10\include\pango-1.0;$(SolutionDir)\..\gtk-2.24.10\include\atk-1.0;$(SolutionDir)\..\libxml2-2.9.1\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_WINDOWS;_USRDLL;SURFACE_QUAKE2_EXPORTS;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebugDLL - - Level3 - EditAndContinue - 4996;4244;4800;%(DisableSpecificWarnings) - - - /STACK:8388608 %(AdditionalOptions) - ws2_32.lib;glib-2.0.lib;gobject-2.0.lib;intl.lib;gtk-win32-2.0.lib;libxml2.lib;synapse.lib;%(AdditionalDependencies) - $(SolutionDir)\..\gtk-2.24.10\lib;$(SolutionDir)\..\libxml2-2.9.1\lib\$(Configuration)\$(Platform);$(SolutionDir)\build\$(Configuration)\libs;%(AdditionalLibraryDirectories) - surface_quake2.def - true - Windows - MachineX86 - - - - - Disabled - $(SolutionDir)\libs;$(SolutionDir)\include;$(SolutionDir)\..\STLport-5.2.1\stlport;$(SolutionDir)\..\gtk-2.24.10\include\glib-2.0;$(SolutionDir)\..\gtk-2.24.10\include\gdk-pixbuf-2.0;$(SolutionDir)\..\gtk-2.24.10\lib\glib-2.0\include;$(SolutionDir)\..\gtk-2.24.10\include;$(SolutionDir)\..\gtk-2.24.10\include\gtk-2.0;$(SolutionDir)\..\gtk-2.24.10\lib\gtk-2.0\include;$(SolutionDir)\..\gtk-2.24.10\include\cairo;$(SolutionDir)\..\gtk-2.24.10\include\pango-1.0;$(SolutionDir)\..\gtk-2.24.10\include\atk-1.0;$(SolutionDir)\..\libxml2-2.9.1\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_WINDOWS;_USRDLL;SURFACE_QUAKE2_EXPORTS;%(PreprocessorDefinitions) - EnableFastChecks - MultiThreadedDebugDLL - - - Level3 - ProgramDatabase - 4996;4244;4800;%(DisableSpecificWarnings) - - - /STACK:8388608 %(AdditionalOptions) - ws2_32.lib;glib-2.0.lib;gobject-2.0.lib;intl.lib;gtk-win32-2.0.lib;libxml2.lib;synapse.lib;%(AdditionalDependencies) - $(SolutionDir)\..\gtk-2.24.10\lib;$(SolutionDir)\..\libxml2-2.9.1\lib\$(Configuration)\$(Platform);$(SolutionDir)\build\$(Configuration)\libs;%(AdditionalLibraryDirectories) - surface_quake2.def - true - Windows - - - - - $(SolutionDir)\libs;$(SolutionDir)\include;$(SolutionDir)\..\STLport-5.2.1\stlport;$(SolutionDir)\..\gtk-2.24.10\include\glib-2.0;$(SolutionDir)\..\gtk-2.24.10\include\gdk-pixbuf-2.0;$(SolutionDir)\..\gtk-2.24.10\lib\glib-2.0\include;$(SolutionDir)\..\gtk-2.24.10\include;$(SolutionDir)\..\gtk-2.24.10\include\gtk-2.0;$(SolutionDir)\..\gtk-2.24.10\lib\gtk-2.0\include;$(SolutionDir)\..\gtk-2.24.10\include\cairo;$(SolutionDir)\..\gtk-2.24.10\include\pango-1.0;$(SolutionDir)\..\gtk-2.24.10\include\atk-1.0;$(SolutionDir)\..\libxml2-2.9.1\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_WINDOWS;_USRDLL;SURFACE_QUAKE2_EXPORTS;%(PreprocessorDefinitions) - MultiThreadedDLL - - Level3 - ProgramDatabase - 4996;4244;4800;%(DisableSpecificWarnings) - - - /STACK:8388608 %(AdditionalOptions) - ws2_32.lib;glib-2.0.lib;gobject-2.0.lib;intl.lib;gtk-win32-2.0.lib;libxml2.lib;synapse.lib;%(AdditionalDependencies) - $(SolutionDir)\..\gtk-2.24.10\lib;$(SolutionDir)\..\libxml2-2.9.1\lib\$(Configuration)\$(Platform);$(SolutionDir)\build\$(Configuration)\libs;%(AdditionalLibraryDirectories) - surface_quake2.def - true - Windows - true - true - MachineX86 - - - - - $(SolutionDir)\libs;$(SolutionDir)\include;$(SolutionDir)\..\STLport-5.2.1\stlport;$(SolutionDir)\..\gtk-2.24.10\include\glib-2.0;$(SolutionDir)\..\gtk-2.24.10\include\gdk-pixbuf-2.0;$(SolutionDir)\..\gtk-2.24.10\lib\glib-2.0\include;$(SolutionDir)\..\gtk-2.24.10\include;$(SolutionDir)\..\gtk-2.24.10\include\gtk-2.0;$(SolutionDir)\..\gtk-2.24.10\lib\gtk-2.0\include;$(SolutionDir)\..\gtk-2.24.10\include\cairo;$(SolutionDir)\..\gtk-2.24.10\include\pango-1.0;$(SolutionDir)\..\gtk-2.24.10\include\atk-1.0;$(SolutionDir)\..\libxml2-2.9.1\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_WINDOWS;_USRDLL;SURFACE_QUAKE2_EXPORTS;%(PreprocessorDefinitions) - MultiThreadedDLL - - - Level3 - ProgramDatabase - 4996;4244;4800;%(DisableSpecificWarnings) - - - /STACK:8388608 %(AdditionalOptions) - ws2_32.lib;glib-2.0.lib;gobject-2.0.lib;intl.lib;gtk-win32-2.0.lib;libxml2.lib;synapse.lib;%(AdditionalDependencies) - $(SolutionDir)\..\gtk-2.24.10\lib;$(SolutionDir)\..\libxml2-2.9.1\lib\$(Configuration)\$(Platform);$(SolutionDir)\build\$(Configuration)\libs;%(AdditionalLibraryDirectories) - surface_quake2.def - true - Windows - true - true - - - - - - - - - - - - - {e13ccfb0-a366-4ef3-a66f-c374b563e4df} - false - - - - - - \ No newline at end of file diff --git a/plugins/surface_quake2/surface_quake2.vcxproj.filters b/plugins/surface_quake2/surface_quake2.vcxproj.filters deleted file mode 100644 index 3d80fd49..00000000 --- a/plugins/surface_quake2/surface_quake2.vcxproj.filters +++ /dev/null @@ -1,25 +0,0 @@ - - - - - {019e22cb-7bf6-4cc9-9724-b123d36cea79} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - - - src - - - - - src - - - src - - - src - - - \ No newline at end of file diff --git a/plugins/surface_quake2/surfacedialog.cpp b/plugins/surface_quake2/surfacedialog.cpp deleted file mode 100644 index 01385a2b..00000000 --- a/plugins/surface_quake2/surfacedialog.cpp +++ /dev/null @@ -1,1919 +0,0 @@ -/* - Copyright (C) 1999-2007 id Software, Inc. and contributors. - For a list of contributors, see the accompanying CONTRIBUTORS file. - - This file is part of GtkRadiant. - - GtkRadiant is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - GtkRadiant is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with GtkRadiant; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -// -// Surface Dialog Module -// - -// -// Nurail: Implemented to Module from the main Radiant Surface Dialog code -// - - -#include -#include - -#include "surfdlg_plugin.h" - - - -#ifdef _DEBUG -//#define DBG_SI 1 -#endif - -#include "gtkr_vector.h" - -vector g_texdef_face_vector; - -inline texdef_to_face_t* get_texdef_face_list(){ - return &( *g_texdef_face_vector.begin() ); -} - -inline unsigned int texdef_face_list_empty(){ - return g_texdef_face_vector.empty(); -} - -inline unsigned int texdef_face_list_size(){ - return g_texdef_face_vector.size(); -} - -// For different faces having different values -bool is_HShift_conflicting; -bool is_VShift_conflicting; -bool is_HScale_conflicting; -bool is_VScale_conflicting; -bool is_Rotate_conflicting; -bool is_TextureName_conflicting; - -void ShowDlg(); -void HideDlg(); -void SetTexMods(); -void GetTexMods( bool b_SetUndoPoint = FALSE ); -void BuildDialog(); -void FitAll(); -void InitDefaultIncrement( texdef_t * ); -void DoSnapTToGrid( float hscale, float vscale ); -// called to perform a fitting from the outside (shortcut key) -void SurfaceDialogFitAll(); - -// Quake2 Flags Functions -void SetFlagButtons_Quake2( texdef_to_face_t *texdef_face_list, bool b_isListEmpty ); -void SetChangeInFlags_Face_Quake2( texdef_to_face_t *texdef_face_list ); -GtkWidget* Create_Quake2FlagsDialog( GtkWidget* surfacedialog_widget ); - - -// Dialog Data -int m_nHeight; -int m_nWidth; - -// 0 is invalid, otherwise it's the Id of the last 'do' we are responsible for -int m_nUndoId; - - -texturewin_t *texturewin; -texdef_t *l_pIncrement; -texdef_t texdef_offset; -texdef_t texdef_SI_values; - -// For Texture Entry, activate only on entry change -char old_texture_entry[128]; - -// the texdef to switch back to when the OnCancel is called -texdef_t g_old_texdef; - -// when TRUE, this thing means the surface inspector is currently being displayed -bool g_surfwin = FALSE; -// turn on/off processing of the "changed" "value_changed" messages -// (need to turn off when we are feeding data in) -bool g_bListenChanged = true; -// turn on/off listening of the update messages -bool g_bListenUpdate = true; - -GtkWidget* create_SurfaceInspector( void ); -GtkWidget *SurfaceInspector = NULL; - -GtkWidget *m_pWidget; -GtkWidget *GetWidget() { return SurfaceInspector; } -GtkWidget *Get_SI_Module_Widget() { return SurfaceInspector; } -void SetWidget( GtkWidget *new_widget ) { m_pWidget = new_widget; } -GtkWidget *GetDlgWidget( const char* name ) -{ return GTK_WIDGET( g_object_get_data( G_OBJECT( SurfaceInspector ), name ) ); } - -// Spins for FitTexture -GtkWidget *spin_width; -GtkWidget *spin_height; - - -GtkWidget *texture_combo; -GtkWidget *texture_combo_entry; - -GtkWidget *match_grid_button; -GtkWidget *lock_valuechange_togglebutton; - -GtkObject *hshift_value_spinbutton_adj; -GtkWidget *hshift_value_spinbutton; -GtkObject *vshift_value_spinbutton_adj; -GtkWidget *vshift_value_spinbutton; -GtkObject *hscale_value_spinbutton_adj; -GtkWidget *hscale_value_spinbutton; -GtkObject *vscale_value_spinbutton_adj; -GtkWidget *vscale_value_spinbutton; -GtkObject *rotate_value_spinbutton_adj; -GtkWidget *rotate_value_spinbutton; - -GtkObject *hshift_offset_spinbutton_adj; -GtkWidget *hshift_offset_spinbutton; -GtkObject *vshift_offset_spinbutton_adj; -GtkWidget *vshift_offset_spinbutton; -GtkObject *hscale_offset_spinbutton_adj; -GtkWidget *hscale_offset_spinbutton; -GtkObject *vscale_offset_spinbutton_adj; -GtkWidget *vscale_offset_spinbutton; -GtkObject *rotate_offset_spinbutton_adj; -GtkWidget *rotate_offset_spinbutton; - -GtkObject *hshift_step_spinbutton_adj; -GtkWidget *hshift_step_spinbutton; -GtkObject *vshift_step_spinbutton_adj; -GtkWidget *vshift_step_spinbutton; -GtkObject *hscale_step_spinbutton_adj; -GtkWidget *hscale_step_spinbutton; -GtkObject *vscale_step_spinbutton_adj; -GtkWidget *vscale_step_spinbutton; -GtkObject *rotate_step_spinbutton_adj; -GtkWidget *rotate_step_spinbutton; - -GtkObject *fit_width_spinbutton_adj; -GtkWidget *fit_width_spinbutton; -GtkObject *fit_height_spinbutton_adj; -GtkWidget *fit_height_spinbutton; -GtkWidget *fit_button; -GtkWidget *axial_button; - -GtkWidget *done_button; -GtkWidget *apply_button; -GtkWidget *cancel_button; - -// Callbacks -gboolean on_texture_combo_entry_key_press_event( GtkWidget *widget, GdkEventKey *event, gpointer user_data ); -void on_texture_combo_entry_activate( GtkEntry *entry, gpointer user_data ); - -static void on_match_grid_button_clicked( GtkButton *button, gpointer user_data ); -static void on_lock_valuechange_togglebutton_toggled( GtkToggleButton *togglebutton, gpointer user_data ); - -static void on_hshift_value_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ); -static void on_vshift_value_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ); -static void on_hscale_value_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ); -static void on_vscale_value_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ); -static void on_rotate_value_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ); - -static void on_hshift_offset_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ); -static void on_vshift_offset_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ); -static void on_hscale_offset_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ); -static void on_vscale_offset_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ); -static void on_rotate_offset_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ); - -static void on_hshift_step_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ); -static void on_vshift_step_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ); -static void on_hscale_step_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ); -static void on_vscale_step_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ); -static void on_rotate_step_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ); - -static void on_fit_width_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ); -static void on_fit_height_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ); -static void on_fit_button_clicked( GtkButton *button, gpointer user_data ); -static void on_axial_button_clicked( GtkButton *button, gpointer user_data ); - -static void on_done_button_clicked( GtkButton *button, gpointer user_data ); -static void on_apply_button_clicked( GtkButton *button, gpointer user_data ); -static void on_cancel_button_clicked( GtkButton *button, gpointer user_data ); - - -/* - =================================================== - - SURFACE INSPECTOR - - =================================================== - */ - - -void IsFaceConflicting(){ - texdef_t* tmp_texdef; - texdef_to_face_t* temp_texdef_face_list; -// char buf[12]; - char texture_name[128]; - - if ( texdef_face_list_empty() ) { - gtk_entry_set_text( GTK_ENTRY( hshift_value_spinbutton ), "" ); - gtk_entry_set_text( GTK_ENTRY( vshift_value_spinbutton ), "" ); - gtk_entry_set_text( GTK_ENTRY( hscale_value_spinbutton ), "" ); - gtk_entry_set_text( GTK_ENTRY( vscale_value_spinbutton ), "" ); - gtk_entry_set_text( GTK_ENTRY( rotate_value_spinbutton ), "" ); - gtk_entry_set_text( GTK_ENTRY( texture_combo_entry ), "" ); - return; - } - - g_bListenChanged = FALSE; - - tmp_texdef = &get_texdef_face_list()->texdef; - - strcpy( texture_name, tmp_texdef->GetName() ); - - texdef_SI_values.shift[0] = tmp_texdef->shift[0]; - texdef_SI_values.shift[1] = tmp_texdef->shift[1]; - texdef_SI_values.scale[0] = tmp_texdef->scale[0]; - texdef_SI_values.scale[1] = tmp_texdef->scale[1]; - texdef_SI_values.rotate = tmp_texdef->rotate; - texdef_SI_values.SetName( texture_name ); - - is_HShift_conflicting = FALSE; - is_VShift_conflicting = FALSE; - is_HScale_conflicting = FALSE; - is_VScale_conflicting = FALSE; - is_Rotate_conflicting = FALSE; - is_TextureName_conflicting = FALSE; - - if ( texdef_face_list_size() > 1 ) { - temp_texdef_face_list = get_texdef_face_list()->next; - - for (; temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next ) - { - tmp_texdef = &temp_texdef_face_list->texdef; - if ( texdef_SI_values.shift[0] != tmp_texdef->shift[0] ) { - is_HShift_conflicting = TRUE; - } - - if ( texdef_SI_values.shift[1] != tmp_texdef->shift[1] ) { - is_VShift_conflicting = TRUE; - } - - if ( texdef_SI_values.scale[0] != tmp_texdef->scale[0] ) { - is_HScale_conflicting = TRUE; - } - - if ( texdef_SI_values.scale[1] != tmp_texdef->scale[1] ) { - is_VScale_conflicting = TRUE; - } - - if ( texdef_SI_values.rotate != tmp_texdef->rotate ) { - is_Rotate_conflicting = TRUE; - } - - if ( strcmp( texture_name, tmp_texdef->GetName() ) ) { - is_TextureName_conflicting = TRUE; - } - } - } - - if ( is_HShift_conflicting ) { - gtk_entry_set_text( GTK_ENTRY( hshift_value_spinbutton ), "" ); - } - else{ - gtk_spin_button_set_value( GTK_SPIN_BUTTON( hshift_value_spinbutton ), texdef_SI_values.shift[0] ); - } - - if ( is_VShift_conflicting ) { - gtk_entry_set_text( GTK_ENTRY( vshift_value_spinbutton ), "" ); - } - else{ - gtk_spin_button_set_value( GTK_SPIN_BUTTON( vshift_value_spinbutton ), texdef_SI_values.shift[1] ); - } - - if ( is_HScale_conflicting ) { - gtk_entry_set_text( GTK_ENTRY( hscale_value_spinbutton ), "" ); - } - else{ - gtk_spin_button_set_value( GTK_SPIN_BUTTON( hscale_value_spinbutton ), texdef_SI_values.scale[0] ); - } - - if ( is_VScale_conflicting ) { - gtk_entry_set_text( GTK_ENTRY( vscale_value_spinbutton ), "" ); - } - else{ - gtk_spin_button_set_value( GTK_SPIN_BUTTON( vscale_value_spinbutton ), texdef_SI_values.scale[1] ); - } - - if ( is_Rotate_conflicting ) { - gtk_entry_set_text( GTK_ENTRY( rotate_value_spinbutton ), "" ); - } - else{ - gtk_spin_button_set_value( GTK_SPIN_BUTTON( rotate_value_spinbutton ), texdef_SI_values.rotate ); - } - - g_bListenChanged = TRUE; -} - -#define MAX_NUM_LIST_ITEMS 15 -static void PopulateTextureComboList(){ - texdef_t* tmp_texdef; - texdef_to_face_t* temp_texdef_face_list; - char blank[1]; - GList *items = NULL; -// GList *tmp_item; - int num_of_list_items = 0; - - blank[0] = 0; - - if ( texdef_face_list_empty() ) { - items = g_list_append( items, (gpointer) blank ); - // For Texture Entry, activate only on entry change - strcpy( old_texture_entry, blank ); - } - else if ( !is_TextureName_conflicting ) { - temp_texdef_face_list = get_texdef_face_list(); - tmp_texdef = (texdef_t *) &get_texdef_face_list()->texdef; - items = g_list_append( items, (gpointer) tmp_texdef->GetName() ); - // For Texture Entry, activate only on entry change - strcpy( old_texture_entry, tmp_texdef->GetName() ); - } - else - { - for ( temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next ) - { - tmp_texdef = (texdef_t *) &temp_texdef_face_list->texdef; - // Need to do a string compare, hence the custom search - if ( !( g_list_find_custom( items, tmp_texdef->GetName(), (GCompareFunc) strcmp ) ) ) { - items = g_list_append( items, (gpointer) tmp_texdef->GetName() ); - num_of_list_items++; - } - // Make sure the combo list isn't too long - if ( num_of_list_items >= MAX_NUM_LIST_ITEMS ) { - break; - } - } - // If this isn't added last (to the top of the list), g_list_find freaks. - items = g_list_prepend( items, (gpointer) blank ); - // For Texture Entry, activate only on entry change - strcpy( old_texture_entry, blank ); - } - - gtk_combo_set_popdown_strings( GTK_COMBO( texture_combo ), items ); - g_list_free( items ); - -} - -static void ZeroOffsetValues(){ - texdef_offset.shift[0] = 0.0; - texdef_offset.shift[1] = 0.0; - texdef_offset.scale[0] = 0.0; - texdef_offset.scale[1] = 0.0; - texdef_offset.rotate = 0.0; -} - -static void GetTexdefInfo_from_Radiant(){ - g_texdef_face_vector.clear(); - - unsigned int count = GetSelectedFaceCountfromBrushes(); - if ( count == 0 ) { - count = GetSelectedFaceCount(); - } - - g_texdef_face_vector.resize( count ); - - if ( !texdef_face_list_empty() ) { -// texdef_to_face_t* p = get_texdef_face_list(); - GetSelFacesTexdef( get_texdef_face_list() ); - } - - IsFaceConflicting(); - PopulateTextureComboList(); - ZeroOffsetValues(); - if ( texdef_face_list_empty() ) { - SetFlagButtons_Quake2( get_texdef_face_list(), TRUE ); - } - else{ - SetFlagButtons_Quake2( get_texdef_face_list(), FALSE ); - } -} - -static gint delete_event_callback( GtkWidget *widget, GdkEvent* event, gpointer data ){ - HideDlg(); - return TRUE; -} - -// make the shift increments match the grid settings -// the objective being that the shift+arrows shortcuts move the texture by the corresponding grid size -// this depends on a scale value if you have selected a particular texture on which you want it to work: -// we move the textures in pixels, not world units. (i.e. increment values are in pixel) -// depending on the texture scale it doesn't take the same amount of pixels to move of g_qeglobals.d_gridsize -// increment * scale = gridsize -// hscale and vscale are optional parameters, if they are zero they will be set to the default scale -// NOTE: the default scale depends if you are using BP mode or regular. -// For regular it's 0.5f (128 pixels cover 64 world units), for BP it's simply 1.0f -// see fenris #2810 -void DoSnapTToGrid( float hscale, float vscale ){ - l_pIncrement = Get_SI_Inc(); - - if ( hscale == 0.0f ) { - hscale = 0.5f; - } - if ( vscale == 0.0f ) { - vscale = 0.5f; - } -#ifdef _DEBUG - Sys_Printf( "DoSnapTToGrid: hscale %g vscale %g\n", hscale, vscale ); -#endif - l_pIncrement->shift[0] = GridSize() / hscale; - l_pIncrement->shift[1] = GridSize() / vscale; - // now some update work - // FIXME: doesn't look good here, seems to be called several times - SetTexMods(); -} - -void UpdateSurfaceDialog(){ - if ( !g_bListenUpdate ) { - return; - } - - if ( !SurfaceInspector ) { - return; - } - - // avoid long delays on slow computers - while ( gtk_events_pending() ) - gtk_main_iteration(); - - if ( g_surfwin ) { -#ifdef DBG_SI - Sys_Printf( "UpdateSurfaceDialog\n" ); -#endif - GetTexdefInfo_from_Radiant(); - SetTexMods(); - } - -} - -// DoSurface will always try to show the surface inspector -// or update it because something new has been selected -void DoSurface( void ){ -#ifdef DBG_SI - Sys_Printf( "DoSurface\n" ); -#endif - if ( !SurfaceInspector ) { - create_SurfaceInspector(); - } - - ShowDlg(); - SetTexMods(); -} - -void ToggleSurface(){ -#ifdef DBG_SI - Sys_Printf( "ToggleSurface Module\n" ); -#endif - if ( !g_surfwin ) { - DoSurface(); - } - else{ - on_cancel_button_clicked( NULL, NULL ); - } -} - -// NOTE: will raise and show the Surface inspector and exec fit for patches and brushes -void SurfaceDlgFitAll(){ - DoSurface(); - FitAll(); -} - -// ============================================================================= -// SurfaceDialog class - -void ShowDlg(){ - - if ( !SurfaceInspector ) { - create_SurfaceInspector(); - } - else{ - gtk_widget_show( SurfaceInspector ); - } - - GetTexdefInfo_from_Radiant(); - GetTexMods( TRUE ); // Set Initial Undo Point - g_surfwin = TRUE; -} - -void HideDlg(){ - g_surfwin = FALSE; - gtk_widget_hide( SurfaceInspector ); -} - - -// set default values for increments (shift scale and rot) -// this is called by the prefs code if can't find the values -void InitDefaultIncrement( texdef_t *tex ){ - tex->SetName( "foo" ); - tex->shift[0] = 8; - tex->shift[1] = 8; - tex->scale[0] = 0.25; - tex->scale[1] = 0.25; - tex->rotate = 10; -} - -void BuildDialog(){ - if ( !SurfaceInspector ) { - create_SurfaceInspector(); - } -} - -/* - ============== - SetTexMods - - Set the fields to the current texdef (i.e. map/texdef -> dialog widgets) - =============== - */ - -void SetTexMods(){ - texdef_t *pt; - GtkSpinButton *spin; - GtkAdjustment *adjust; - - texturewin = Texturewin(); - l_pIncrement = Get_SI_Inc(); - -#ifdef DBG_SI - Sys_Printf( "SurfaceDlg SetTexMods\n" ); -#endif - - if ( !g_surfwin ) { - return; - } - - pt = &texturewin->texdef; - - g_bListenChanged = false; - - if ( strncmp( pt->GetName(), "textures/", 9 ) != 0 ) { - texdef_offset.SetName( SHADER_NOT_FOUND ); - } - - - spin = GTK_SPIN_BUTTON( hshift_offset_spinbutton ); - gtk_spin_button_set_value( spin, texdef_offset.shift[0] ); - adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) ); - adjust->step_increment = l_pIncrement->shift[0]; - gtk_spin_button_set_value( GTK_SPIN_BUTTON( hshift_step_spinbutton ), l_pIncrement->shift[0] ); - - spin = GTK_SPIN_BUTTON( hshift_value_spinbutton ); - adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) ); - adjust->step_increment = l_pIncrement->shift[0]; - - - spin = GTK_SPIN_BUTTON( vshift_offset_spinbutton ); - gtk_spin_button_set_value( spin, texdef_offset.shift[1] ); - adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) ); - adjust->step_increment = l_pIncrement->shift[1]; - gtk_spin_button_set_value( GTK_SPIN_BUTTON( vshift_step_spinbutton ), l_pIncrement->shift[1] ); - - spin = GTK_SPIN_BUTTON( vshift_value_spinbutton ); - adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) ); - adjust->step_increment = l_pIncrement->shift[1]; - - - spin = GTK_SPIN_BUTTON( hscale_offset_spinbutton ); - gtk_spin_button_set_value( spin, texdef_offset.scale[0] ); - adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) ); - adjust->step_increment = l_pIncrement->scale[0]; - gtk_spin_button_set_value( GTK_SPIN_BUTTON( hscale_step_spinbutton ), l_pIncrement->scale[0] ); - - spin = GTK_SPIN_BUTTON( hscale_value_spinbutton ); - adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) ); - adjust->step_increment = l_pIncrement->scale[0]; - - - spin = GTK_SPIN_BUTTON( vscale_offset_spinbutton ); - gtk_spin_button_set_value( spin, texdef_offset.scale[1] ); - adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) ); - adjust->step_increment = l_pIncrement->scale[1]; - gtk_spin_button_set_value( GTK_SPIN_BUTTON( vscale_step_spinbutton ), l_pIncrement->scale[1] ); - - spin = GTK_SPIN_BUTTON( vscale_value_spinbutton ); - adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) ); - adjust->step_increment = l_pIncrement->scale[1]; - - - spin = GTK_SPIN_BUTTON( rotate_offset_spinbutton ); - gtk_spin_button_set_value( spin, texdef_offset.rotate ); - adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) ); - adjust->step_increment = l_pIncrement->rotate; - gtk_spin_button_set_value( GTK_SPIN_BUTTON( rotate_step_spinbutton ), l_pIncrement->rotate ); - - spin = GTK_SPIN_BUTTON( rotate_value_spinbutton ); - adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) ); - adjust->step_increment = l_pIncrement->rotate; - - - g_bListenChanged = true; - - // store the current texdef as our escape route if user hits OnCancel - g_old_texdef = texturewin->texdef; -} - -/* - ============== - GetTexMods - - Shows any changes to the main Radiant windows - =============== - */ -void GetTexMods( bool b_SetUndoPoint ){ - -#ifdef DBG_SI - Sys_Printf( "SurfaceDlg GetTexMods\n" ); -#endif - - if ( !texdef_face_list_empty() ) { - g_bListenUpdate = FALSE; - SetChangeInFlags_Face_Quake2( get_texdef_face_list() ); - SetTexdef_FaceList( get_texdef_face_list(), b_SetUndoPoint, false ); - g_bListenUpdate = TRUE; - - if ( b_SetUndoPoint ) { - m_nUndoId = Undo_GetUndoId(); - } - } -} - -void FitAll(){ - on_fit_button_clicked( NULL, NULL ); -} - - -//////////////////////////////////////////////////////////////////// -// -// GUI Section -// -//////////////////////////////////////////////////////////////////// - -GtkWidget* create_SurfaceInspector( void ){ - - GtkWidget *label; - GtkWidget *hseparator; - GtkWidget *eventbox; - - GtkWidget *viewport8; - GtkWidget *viewport9; - GtkWidget *viewport2; - GtkWidget *viewport7; - GtkWidget *viewport5; - GtkWidget *viewport6; - GtkWidget *viewport10; - - GtkWidget *table1; - GtkWidget *table4; - GtkWidget *table5; - GtkWidget *table7; - - GtkWidget *alignment1; - GtkWidget *alignment2; - GtkWidget *alignment3; - - GtkWidget *vbox7; - - GtkWidget *hbox1; - GtkWidget *hbox2; - GtkWidget *hbox3; - GtkWidget *hbox4; - - GtkWidget *image1; - GtkWidget *image2; - GtkWidget *image3; - - GtkWidget *hbuttonbox1; - - SurfaceInspector = gtk_window_new( GTK_WINDOW_TOPLEVEL ); - gtk_container_set_border_width( GTK_CONTAINER( SurfaceInspector ), 4 ); - gtk_window_set_title( GTK_WINDOW( SurfaceInspector ), "Surface Inspector" ); - - SetWinPos_from_Prefs( SurfaceInspector ); - - viewport8 = gtk_viewport_new( NULL, NULL ); - gtk_widget_show( viewport8 ); - gtk_container_add( GTK_CONTAINER( SurfaceInspector ), viewport8 ); - gtk_viewport_set_shadow_type( GTK_VIEWPORT( viewport8 ), GTK_SHADOW_NONE ); - - vbox7 = gtk_vbox_new( FALSE, 0 ); - gtk_widget_show( vbox7 ); - gtk_container_add( GTK_CONTAINER( viewport8 ), vbox7 ); - - viewport9 = gtk_viewport_new( NULL, NULL ); - gtk_widget_show( viewport9 ); - gtk_box_pack_start( GTK_BOX( vbox7 ), viewport9, FALSE, FALSE, 0 ); - gtk_container_set_border_width( GTK_CONTAINER( viewport9 ), 2 ); - gtk_viewport_set_shadow_type( GTK_VIEWPORT( viewport9 ), GTK_SHADOW_ETCHED_IN ); - - hbox1 = gtk_hbox_new( FALSE, 0 ); - gtk_widget_show( hbox1 ); - gtk_container_add( GTK_CONTAINER( viewport9 ), hbox1 ); - gtk_container_set_border_width( GTK_CONTAINER( hbox1 ), 4 ); - - label = gtk_label_new( "Texture: " ); - gtk_widget_show( label ); - gtk_box_pack_start( GTK_BOX( hbox1 ), label, FALSE, FALSE, 0 ); - gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 ); - - texture_combo = gtk_combo_new(); - g_object_set_data( G_OBJECT( GTK_COMBO( texture_combo )->popwin ), - "KeepMeAround", texture_combo ); - gtk_combo_disable_activate( (GtkCombo*) texture_combo ); - gtk_widget_show( texture_combo ); - gtk_box_pack_start( GTK_BOX( hbox1 ), texture_combo, TRUE, TRUE, 0 ); - - texture_combo_entry = GTK_COMBO( texture_combo )->entry; - gtk_widget_show( texture_combo_entry ); - gtk_entry_set_max_length( GTK_ENTRY( texture_combo_entry ), 128 ); - - viewport2 = gtk_viewport_new( NULL, NULL ); - gtk_widget_show( viewport2 ); - gtk_box_pack_start( GTK_BOX( vbox7 ), viewport2, FALSE, TRUE, 0 ); - gtk_container_set_border_width( GTK_CONTAINER( viewport2 ), 2 ); - gtk_viewport_set_shadow_type( GTK_VIEWPORT( viewport2 ), GTK_SHADOW_ETCHED_IN ); - - table1 = gtk_table_new( 13, 4, FALSE ); - gtk_widget_show( table1 ); - gtk_container_add( GTK_CONTAINER( viewport2 ), table1 ); - - hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); - gtk_table_attach( GTK_TABLE( table1 ), hseparator, 1, 2, 1, 2, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); - gtk_table_attach( GTK_TABLE( table1 ), hseparator, 2, 3, 1, 2, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); - gtk_table_attach( GTK_TABLE( table1 ), hseparator, 3, 4, 1, 2, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); - gtk_table_attach( GTK_TABLE( table1 ), hseparator, 1, 2, 3, 4, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); - gtk_table_attach( GTK_TABLE( table1 ), hseparator, 2, 3, 3, 4, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); - gtk_table_attach( GTK_TABLE( table1 ), hseparator, 3, 4, 3, 4, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); - gtk_table_attach( GTK_TABLE( table1 ), hseparator, 1, 2, 5, 6, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); - gtk_table_attach( GTK_TABLE( table1 ), hseparator, 2, 3, 5, 6, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); - gtk_table_attach( GTK_TABLE( table1 ), hseparator, 3, 4, 5, 6, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); - gtk_table_attach( GTK_TABLE( table1 ), hseparator, 1, 2, 7, 8, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); - gtk_table_attach( GTK_TABLE( table1 ), hseparator, 2, 3, 7, 8, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); - gtk_table_attach( GTK_TABLE( table1 ), hseparator, 3, 4, 7, 8, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); - gtk_table_attach( GTK_TABLE( table1 ), hseparator, 1, 2, 9, 10, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); - gtk_table_attach( GTK_TABLE( table1 ), hseparator, 2, 3, 9, 10, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); - gtk_table_attach( GTK_TABLE( table1 ), hseparator, 3, 4, 9, 10, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); - gtk_table_attach( GTK_TABLE( table1 ), hseparator, 1, 2, 11, 12, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); - gtk_table_attach( GTK_TABLE( table1 ), hseparator, 2, 3, 11, 12, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); - gtk_table_attach( GTK_TABLE( table1 ), hseparator, 3, 4, 11, 12, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - label = gtk_label_new( "Offset" ); - gtk_widget_show( label ); - gtk_table_attach( GTK_TABLE( table1 ), label, 2, 3, 0, 1, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); - - label = gtk_label_new( "Step" ); - gtk_widget_show( label ); - gtk_table_attach( GTK_TABLE( table1 ), label, 3, 4, 0, 1, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); - - eventbox = gtk_event_box_new(); - gtk_widget_show( eventbox ); - gtk_table_attach( GTK_TABLE( table1 ), eventbox, 3, 4, 12, 13, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - match_grid_button = gtk_button_new_with_mnemonic( "Match Grid" ); - gtk_widget_show( match_grid_button ); - gtk_container_add( GTK_CONTAINER( eventbox ), match_grid_button ); - - label = gtk_label_new( "Value" ); - gtk_widget_show( label ); - gtk_table_attach( GTK_TABLE( table1 ), label, 1, 2, 0, 1, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_misc_set_alignment( GTK_MISC( label ), 0.5, 1 ); - - hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); - gtk_table_attach( GTK_TABLE( table1 ), hseparator, 0, 1, 3, 4, - (GtkAttachOptions) ( GTK_SHRINK | GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); - gtk_table_attach( GTK_TABLE( table1 ), hseparator, 0, 1, 5, 6, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); - gtk_table_attach( GTK_TABLE( table1 ), hseparator, 0, 1, 7, 8, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); - gtk_table_attach( GTK_TABLE( table1 ), hseparator, 0, 1, 9, 10, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); - gtk_table_attach( GTK_TABLE( table1 ), hseparator, 0, 1, 11, 12, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - eventbox = gtk_event_box_new(); - gtk_widget_show( eventbox ); - gtk_table_attach( GTK_TABLE( table1 ), eventbox, 0, 1, 4, 5, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - label = gtk_label_new( "V Shift: " ); - gtk_widget_show( label ); - gtk_container_add( GTK_CONTAINER( eventbox ), label ); - gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT ); - gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 ); - - eventbox = gtk_event_box_new(); - gtk_widget_show( eventbox ); - gtk_table_attach( GTK_TABLE( table1 ), eventbox, 0, 1, 6, 7, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - label = gtk_label_new( " H Scale: " ); - gtk_widget_show( label ); - gtk_container_add( GTK_CONTAINER( eventbox ), label ); - gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT ); - gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 ); - - eventbox = gtk_event_box_new(); - gtk_widget_show( eventbox ); - gtk_table_attach( GTK_TABLE( table1 ), eventbox, 0, 1, 8, 9, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - label = gtk_label_new( "V Scale: " ); - gtk_widget_show( label ); - gtk_container_add( GTK_CONTAINER( eventbox ), label ); - gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT ); - gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 ); - - eventbox = gtk_event_box_new(); - gtk_widget_show( eventbox ); - gtk_table_attach( GTK_TABLE( table1 ), eventbox, 0, 1, 10, 11, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - label = gtk_label_new( "Rotate: " ); - gtk_widget_show( label ); - gtk_container_add( GTK_CONTAINER( eventbox ), label ); - gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT ); - gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 ); - - eventbox = gtk_event_box_new(); - gtk_widget_show( eventbox ); - gtk_table_attach( GTK_TABLE( table1 ), eventbox, 0, 1, 2, 3, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - label = gtk_label_new( "H Shift: " ); - gtk_widget_show( label ); - gtk_container_add( GTK_CONTAINER( eventbox ), label ); - gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT ); - gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 ); - - hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); - gtk_table_attach( GTK_TABLE( table1 ), hseparator, 0, 1, 1, 2, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - eventbox = gtk_event_box_new(); - gtk_widget_show( eventbox ); - gtk_table_attach( GTK_TABLE( table1 ), eventbox, 1, 2, 12, 13, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - lock_valuechange_togglebutton = gtk_toggle_button_new_with_mnemonic( "UNLOCK" ); - gtk_widget_show( lock_valuechange_togglebutton ); - gtk_container_add( GTK_CONTAINER( eventbox ), lock_valuechange_togglebutton ); - - // Value Spins - hshift_value_spinbutton_adj = gtk_adjustment_new( 0.0, -8192.0, 8192.0, 2.0, 8.0, 8.0 ); - hshift_value_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( hshift_value_spinbutton_adj ), 1, 2 ); - gtk_widget_show( hshift_value_spinbutton ); - gtk_table_attach( GTK_TABLE( table1 ), hshift_value_spinbutton, 1, 2, 2, 3, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( hshift_value_spinbutton ), GTK_UPDATE_IF_VALID ); - gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( hshift_value_spinbutton ), TRUE ); - gtk_widget_set_sensitive( GTK_WIDGET( hshift_value_spinbutton ), FALSE ); - - vshift_value_spinbutton_adj = gtk_adjustment_new( 0.0, -8192.0, 8192.0, 2.0, 8.0, 8.0 ); - vshift_value_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( vshift_value_spinbutton_adj ), 1, 2 ); - gtk_widget_show( vshift_value_spinbutton ); - gtk_table_attach( GTK_TABLE( table1 ), vshift_value_spinbutton, 1, 2, 4, 5, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( vshift_value_spinbutton ), GTK_UPDATE_IF_VALID ); - gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( vshift_value_spinbutton ), TRUE ); - gtk_widget_set_sensitive( GTK_WIDGET( vshift_value_spinbutton ), FALSE ); - - hscale_value_spinbutton_adj = gtk_adjustment_new( 0.0, -1024.0, 1024.0, 1.0, 4.0, 4.0 ); - hscale_value_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( hscale_value_spinbutton_adj ), 1, 4 ); - gtk_widget_show( hscale_value_spinbutton ); - gtk_table_attach( GTK_TABLE( table1 ), hscale_value_spinbutton, 1, 2, 6, 7, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( hscale_value_spinbutton ), GTK_UPDATE_IF_VALID ); - gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( hscale_value_spinbutton ), TRUE ); - gtk_widget_set_sensitive( GTK_WIDGET( hscale_value_spinbutton ), FALSE ); - - vscale_value_spinbutton_adj = gtk_adjustment_new( 0.0, -1024.0, 1024.0, 1.0, 4.0, 4.0 ); - vscale_value_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( vscale_value_spinbutton_adj ), 1, 4 ); - gtk_widget_show( vscale_value_spinbutton ); - gtk_table_attach( GTK_TABLE( table1 ), vscale_value_spinbutton, 1, 2, 8, 9, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( vscale_value_spinbutton ), GTK_UPDATE_IF_VALID ); - gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( vscale_value_spinbutton ), TRUE ); - gtk_widget_set_sensitive( GTK_WIDGET( vscale_value_spinbutton ), FALSE ); - - rotate_value_spinbutton_adj = gtk_adjustment_new( 0.0, -360.0, 360.0, 1.0, 10.0, 10.0 ); - rotate_value_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( rotate_value_spinbutton_adj ), 1, 0 ); - gtk_widget_show( rotate_value_spinbutton ); - gtk_table_attach( GTK_TABLE( table1 ), rotate_value_spinbutton, 1, 2, 10, 11, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( rotate_value_spinbutton ), GTK_UPDATE_IF_VALID ); - gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( rotate_value_spinbutton ), TRUE ); - gtk_widget_set_sensitive( GTK_WIDGET( rotate_value_spinbutton ), FALSE ); - - // Offset Spins - hshift_offset_spinbutton_adj = gtk_adjustment_new( 0.0, -8192.0, 8192.0, 2.0, 8.0, 8.0 ); - hshift_offset_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( hshift_offset_spinbutton_adj ), 0, 2 ); - gtk_widget_show( hshift_offset_spinbutton ); - gtk_table_attach( GTK_TABLE( table1 ), hshift_offset_spinbutton, 2, 3, 2, 3, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 4, 0 ); - gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( hshift_offset_spinbutton ), TRUE ); - gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( hshift_offset_spinbutton ), GTK_UPDATE_IF_VALID ); - gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( hshift_offset_spinbutton ), TRUE ); - - vshift_offset_spinbutton_adj = gtk_adjustment_new( 0.0, -8192.0, 8192.0, 2.0, 8.0, 8.0 ); - vshift_offset_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( vshift_offset_spinbutton_adj ), 0, 2 ); - gtk_widget_show( vshift_offset_spinbutton ); - gtk_table_attach( GTK_TABLE( table1 ), vshift_offset_spinbutton, 2, 3, 4, 5, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 4, 0 ); - gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( vshift_offset_spinbutton ), TRUE ); - gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( vshift_offset_spinbutton ), GTK_UPDATE_IF_VALID ); - gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( vshift_offset_spinbutton ), TRUE ); - - hscale_offset_spinbutton_adj = gtk_adjustment_new( 0.0, -1024.0, 1024.0, 1.0, 4.0, 4.0 ); - hscale_offset_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( hscale_offset_spinbutton_adj ), 0, 4 ); - gtk_widget_show( hscale_offset_spinbutton ); - gtk_table_attach( GTK_TABLE( table1 ), hscale_offset_spinbutton, 2, 3, 6, 7, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 4, 0 ); - gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( hscale_offset_spinbutton ), TRUE ); - gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( hscale_offset_spinbutton ), GTK_UPDATE_IF_VALID ); - gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( hscale_offset_spinbutton ), TRUE ); - - vscale_offset_spinbutton_adj = gtk_adjustment_new( 0.0, -1024.0, 1024.0, 1.0, 4.0, 4.0 ); - vscale_offset_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( vscale_offset_spinbutton_adj ), 0, 4 ); - gtk_widget_show( vscale_offset_spinbutton ); - gtk_table_attach( GTK_TABLE( table1 ), vscale_offset_spinbutton, 2, 3, 8, 9, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 4, 0 ); - gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( vscale_offset_spinbutton ), TRUE ); - gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( vscale_offset_spinbutton ), GTK_UPDATE_IF_VALID ); - gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( vscale_offset_spinbutton ), TRUE ); - - rotate_offset_spinbutton_adj = gtk_adjustment_new( 0.0, -360.0, 360.0, 1.0, 10.0, 10.0 ); - rotate_offset_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( rotate_offset_spinbutton_adj ), 0, 2 ); - gtk_widget_show( rotate_offset_spinbutton ); - gtk_table_attach( GTK_TABLE( table1 ), rotate_offset_spinbutton, 2, 3, 10, 11, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 4, 0 ); - gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( rotate_offset_spinbutton ), TRUE ); - gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( rotate_offset_spinbutton ), GTK_UPDATE_IF_VALID ); - gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( rotate_offset_spinbutton ), TRUE ); - - // Step Spins - hshift_step_spinbutton_adj = gtk_adjustment_new( 0.0, -8192.0, 8192.0, 2.0, 8.0, 8.0 ); - hshift_step_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( hshift_step_spinbutton_adj ), 1, 2 ); - gtk_widget_show( hshift_step_spinbutton ); - gtk_table_attach( GTK_TABLE( table1 ), hshift_step_spinbutton, 3, 4, 2, 3, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( hshift_step_spinbutton ), GTK_UPDATE_IF_VALID ); - - vshift_step_spinbutton_adj = gtk_adjustment_new( 0.0, -8192.0, 8192.0, 2.0, 8.0, 8.0 ); - vshift_step_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( vshift_step_spinbutton_adj ), 1, 2 ); - gtk_widget_show( vshift_step_spinbutton ); - gtk_table_attach( GTK_TABLE( table1 ), vshift_step_spinbutton, 3, 4, 4, 5, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( vshift_step_spinbutton ), GTK_UPDATE_IF_VALID ); - - hscale_step_spinbutton_adj = gtk_adjustment_new( 0.0, -1024.0, 1024.0, 1.0, 4.0, 4.0 ); - hscale_step_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( hscale_step_spinbutton_adj ), 1, 4 ); - gtk_widget_show( hscale_step_spinbutton ); - gtk_table_attach( GTK_TABLE( table1 ), hscale_step_spinbutton, 3, 4, 6, 7, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( hscale_step_spinbutton ), GTK_UPDATE_IF_VALID ); - - vscale_step_spinbutton_adj = gtk_adjustment_new( 0.0, -1024.0, 1024.0, 1.0, 4.0, 4.0 ); - vscale_step_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( vscale_step_spinbutton_adj ), 1, 4 ); - gtk_widget_show( vscale_step_spinbutton ); - gtk_table_attach( GTK_TABLE( table1 ), vscale_step_spinbutton, 3, 4, 8, 9, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( vscale_step_spinbutton ), GTK_UPDATE_IF_VALID ); - - rotate_step_spinbutton_adj = gtk_adjustment_new( 0.0, -360.0, 360.0, 1.0, 10.0, 10.0 ); - rotate_step_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( rotate_step_spinbutton_adj ), 1, 2 ); - gtk_widget_show( rotate_step_spinbutton ); - gtk_table_attach( GTK_TABLE( table1 ), rotate_step_spinbutton, 3, 4, 10, 11, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( rotate_step_spinbutton ), GTK_UPDATE_IF_VALID ); - - eventbox = gtk_event_box_new(); - gtk_widget_show( eventbox ); - gtk_table_attach( GTK_TABLE( table1 ), eventbox, 2, 3, 12, 13, - (GtkAttachOptions) ( 0 ), - (GtkAttachOptions) ( 0 ), 0, 0 ); - - eventbox = gtk_event_box_new(); - gtk_widget_show( eventbox ); - gtk_table_attach( GTK_TABLE( table1 ), eventbox, 0, 1, 12, 13, - (GtkAttachOptions) ( 0 ), - (GtkAttachOptions) ( 0 ), 0, 0 ); - - eventbox = gtk_event_box_new(); - gtk_widget_show( eventbox ); - gtk_table_attach( GTK_TABLE( table1 ), eventbox, 0, 1, 0, 1, - (GtkAttachOptions) ( 0 ), - (GtkAttachOptions) ( 0 ), 0, 0 ); - - viewport7 = gtk_viewport_new( NULL, NULL ); - gtk_widget_show( viewport7 ); - gtk_box_pack_start( GTK_BOX( vbox7 ), viewport7, FALSE, TRUE, 0 ); - gtk_container_set_border_width( GTK_CONTAINER( viewport7 ), 2 ); - gtk_viewport_set_shadow_type( GTK_VIEWPORT( viewport7 ), GTK_SHADOW_ETCHED_IN ); - - table4 = gtk_table_new( 4, 7, FALSE ); - gtk_widget_show( table4 ); - gtk_container_add( GTK_CONTAINER( viewport7 ), table4 ); - - viewport5 = gtk_viewport_new( NULL, NULL ); - gtk_widget_show( viewport5 ); - gtk_table_attach( GTK_TABLE( table4 ), viewport5, 1, 7, 0, 4, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_container_set_border_width( GTK_CONTAINER( viewport5 ), 6 ); - gtk_viewport_set_shadow_type( GTK_VIEWPORT( viewport5 ), GTK_SHADOW_ETCHED_OUT ); - - table5 = gtk_table_new( 2, 3, FALSE ); - gtk_widget_show( table5 ); - gtk_container_add( GTK_CONTAINER( viewport5 ), table5 ); - gtk_container_set_border_width( GTK_CONTAINER( table5 ), 5 ); - gtk_table_set_col_spacings( GTK_TABLE( table5 ), 2 ); - - label = gtk_label_new( "Height" ); - gtk_widget_show( label ); - gtk_table_attach( GTK_TABLE( table5 ), label, 2, 3, 0, 1, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT ); - gtk_misc_set_alignment( GTK_MISC( label ), 0.5, 1 ); - - label = gtk_label_new( "Width" ); - gtk_widget_show( label ); - gtk_table_attach( GTK_TABLE( table5 ), label, 1, 2, 0, 1, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT ); - gtk_misc_set_alignment( GTK_MISC( label ), 0.5, 1 ); - - fit_width_spinbutton_adj = gtk_adjustment_new( 1, 1, 32, 1, 10, 10 ); - fit_width_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( fit_width_spinbutton_adj ), 1, 0 ); - gtk_widget_show( fit_width_spinbutton ); - gtk_table_attach( GTK_TABLE( table5 ), fit_width_spinbutton, 1, 2, 1, 2, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( fit_width_spinbutton ), TRUE ); - gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( fit_width_spinbutton ), GTK_UPDATE_IF_VALID ); - - fit_height_spinbutton_adj = gtk_adjustment_new( 1, 1, 32, 1, 10, 10 ); - fit_height_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( fit_height_spinbutton_adj ), 1, 0 ); - gtk_widget_show( fit_height_spinbutton ); - gtk_table_attach( GTK_TABLE( table5 ), fit_height_spinbutton, 2, 3, 1, 2, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 3, 0 ); - gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( fit_height_spinbutton ), TRUE ); - gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( fit_height_spinbutton ), GTK_UPDATE_IF_VALID ); - - eventbox = gtk_event_box_new(); - gtk_widget_show( eventbox ); - gtk_table_attach( GTK_TABLE( table5 ), eventbox, 0, 1, 0, 1, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - eventbox = gtk_event_box_new(); - gtk_widget_show( eventbox ); - gtk_table_attach( GTK_TABLE( table5 ), eventbox, 0, 1, 1, 2, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 4, 0 ); - - fit_button = gtk_button_new_with_mnemonic( " Fit " ); - gtk_widget_show( fit_button ); - gtk_container_add( GTK_CONTAINER( eventbox ), fit_button ); - - viewport6 = gtk_viewport_new( NULL, NULL ); - gtk_widget_show( viewport6 ); - gtk_table_attach( GTK_TABLE( table4 ), viewport6, 0, 1, 0, 4, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_container_set_border_width( GTK_CONTAINER( viewport6 ), 4 ); - gtk_viewport_set_shadow_type( GTK_VIEWPORT( viewport6 ), GTK_SHADOW_NONE ); - - table7 = gtk_table_new( 2, 1, FALSE ); - gtk_widget_show( table7 ); - gtk_container_add( GTK_CONTAINER( viewport6 ), table7 ); - - eventbox = gtk_event_box_new(); - gtk_widget_show( eventbox ); - gtk_table_attach( GTK_TABLE( table7 ), eventbox, 0, 1, 0, 2, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); - - axial_button = gtk_button_new_with_mnemonic( "Axial" ); - gtk_widget_show( axial_button ); - gtk_container_add( GTK_CONTAINER( eventbox ), axial_button ); - gtk_widget_set_size_request( axial_button, 56, 29 ); - gtk_container_set_border_width( GTK_CONTAINER( axial_button ), 4 ); - - // Fit in Flags sub-dialog - Create_Quake2FlagsDialog( vbox7 ); - - viewport10 = gtk_viewport_new( NULL, NULL ); - gtk_widget_show( viewport10 ); - gtk_box_pack_start( GTK_BOX( vbox7 ), viewport10, FALSE, TRUE, 0 ); - gtk_container_set_border_width( GTK_CONTAINER( viewport10 ), 2 ); - gtk_viewport_set_shadow_type( GTK_VIEWPORT( viewport10 ), GTK_SHADOW_ETCHED_IN ); - - hbuttonbox1 = gtk_hbutton_box_new(); - gtk_widget_show( hbuttonbox1 ); - gtk_container_add( GTK_CONTAINER( viewport10 ), hbuttonbox1 ); - gtk_container_set_border_width( GTK_CONTAINER( hbuttonbox1 ), 4 ); - gtk_button_box_set_layout( GTK_BUTTON_BOX( hbuttonbox1 ), GTK_BUTTONBOX_SPREAD ); - - done_button = gtk_button_new(); - gtk_widget_show( done_button ); - gtk_container_add( GTK_CONTAINER( hbuttonbox1 ), done_button ); - GTK_WIDGET_SET_FLAGS( done_button, GTK_CAN_DEFAULT ); - - alignment1 = gtk_alignment_new( 0.5, 0.5, 0, 0 ); - gtk_widget_show( alignment1 ); - gtk_container_add( GTK_CONTAINER( done_button ), alignment1 ); - - hbox2 = gtk_hbox_new( FALSE, 2 ); - gtk_widget_show( hbox2 ); - gtk_container_add( GTK_CONTAINER( alignment1 ), hbox2 ); - - image1 = gtk_image_new_from_stock( "gtk-yes", GTK_ICON_SIZE_BUTTON ); - gtk_widget_show( image1 ); - gtk_box_pack_start( GTK_BOX( hbox2 ), image1, FALSE, FALSE, 0 ); - - label = gtk_label_new_with_mnemonic( "Done" ); - gtk_widget_show( label ); - gtk_box_pack_start( GTK_BOX( hbox2 ), label, FALSE, FALSE, 0 ); - gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT ); - - apply_button = gtk_button_new(); - gtk_widget_show( apply_button ); - gtk_container_add( GTK_CONTAINER( hbuttonbox1 ), apply_button ); - GTK_WIDGET_SET_FLAGS( apply_button, GTK_CAN_DEFAULT ); - - alignment3 = gtk_alignment_new( 0.5, 0.5, 0, 0 ); - gtk_widget_show( alignment3 ); - gtk_container_add( GTK_CONTAINER( apply_button ), alignment3 ); - - hbox4 = gtk_hbox_new( FALSE, 2 ); - gtk_widget_show( hbox4 ); - gtk_container_add( GTK_CONTAINER( alignment3 ), hbox4 ); - - image3 = gtk_image_new_from_stock( "gtk-apply", GTK_ICON_SIZE_BUTTON ); - gtk_widget_show( image3 ); - gtk_box_pack_start( GTK_BOX( hbox4 ), image3, FALSE, FALSE, 0 ); - - label = gtk_label_new_with_mnemonic( "Apply" ); - gtk_widget_show( label ); - gtk_box_pack_start( GTK_BOX( hbox4 ), label, FALSE, FALSE, 0 ); - gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT ); - - cancel_button = gtk_button_new(); - gtk_widget_show( cancel_button ); - gtk_container_add( GTK_CONTAINER( hbuttonbox1 ), cancel_button ); - GTK_WIDGET_SET_FLAGS( cancel_button, GTK_CAN_DEFAULT ); - - alignment2 = gtk_alignment_new( 0.5, 0.5, 0, 0 ); - gtk_widget_show( alignment2 ); - gtk_container_add( GTK_CONTAINER( cancel_button ), alignment2 ); - - hbox3 = gtk_hbox_new( FALSE, 2 ); - gtk_widget_show( hbox3 ); - gtk_container_add( GTK_CONTAINER( alignment2 ), hbox3 ); - - image2 = gtk_image_new_from_stock( "gtk-no", GTK_ICON_SIZE_BUTTON ); - gtk_widget_show( image2 ); - gtk_box_pack_start( GTK_BOX( hbox3 ), image2, FALSE, FALSE, 0 ); - - label = gtk_label_new_with_mnemonic( "Cancel" ); - gtk_widget_show( label ); - gtk_box_pack_start( GTK_BOX( hbox3 ), label, FALSE, FALSE, 0 ); - gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT ); - - - g_signal_connect( (gpointer) SurfaceInspector, - "delete_event", - G_CALLBACK( delete_event_callback ), - NULL ); - g_signal_connect( (gpointer) SurfaceInspector, "destroy", - G_CALLBACK( gtk_widget_destroy ), - NULL ); - - g_signal_connect( (gpointer) texture_combo_entry, "key_press_event", - G_CALLBACK( on_texture_combo_entry_key_press_event ), - NULL ); - g_signal_connect( (gpointer) texture_combo_entry, "activate", - G_CALLBACK( on_texture_combo_entry_activate ), - NULL ); - - - g_signal_connect( (gpointer) hshift_offset_spinbutton, "value_changed", - G_CALLBACK( on_hshift_offset_spinbutton_value_changed ), - NULL ); - g_signal_connect( (gpointer) vshift_offset_spinbutton, "value_changed", - G_CALLBACK( on_vshift_offset_spinbutton_value_changed ), - NULL ); - g_signal_connect( (gpointer) hscale_offset_spinbutton, "value_changed", - G_CALLBACK( on_hscale_offset_spinbutton_value_changed ), - NULL ); - g_signal_connect( (gpointer) vscale_offset_spinbutton, "value_changed", - G_CALLBACK( on_vscale_offset_spinbutton_value_changed ), - NULL ); - g_signal_connect( (gpointer) rotate_offset_spinbutton, "value_changed", - G_CALLBACK( on_rotate_offset_spinbutton_value_changed ), - NULL ); - - g_signal_connect( (gpointer) hshift_value_spinbutton, "value_changed", - G_CALLBACK( on_hshift_value_spinbutton_value_changed ), - NULL ); - g_signal_connect( (gpointer) vshift_value_spinbutton, "value_changed", - G_CALLBACK( on_vshift_value_spinbutton_value_changed ), - NULL ); - g_signal_connect( (gpointer) hscale_value_spinbutton, "value_changed", - G_CALLBACK( on_hscale_value_spinbutton_value_changed ), - NULL ); - g_signal_connect( (gpointer) vscale_value_spinbutton, "value_changed", - G_CALLBACK( on_vscale_value_spinbutton_value_changed ), - NULL ); - g_signal_connect( (gpointer) rotate_value_spinbutton, "value_changed", - G_CALLBACK( on_rotate_value_spinbutton_value_changed ), - NULL ); - - g_signal_connect( (gpointer) hshift_step_spinbutton, "value_changed", - G_CALLBACK( on_hshift_step_spinbutton_value_changed ), - NULL ); - g_signal_connect( (gpointer) vshift_step_spinbutton, "value_changed", - G_CALLBACK( on_vshift_step_spinbutton_value_changed ), - NULL ); - g_signal_connect( (gpointer) hscale_step_spinbutton, "value_changed", - G_CALLBACK( on_hscale_step_spinbutton_value_changed ), - NULL ); - g_signal_connect( (gpointer) vscale_step_spinbutton, "value_changed", - G_CALLBACK( on_vscale_step_spinbutton_value_changed ), - NULL ); - g_signal_connect( (gpointer) rotate_step_spinbutton, "value_changed", - G_CALLBACK( on_rotate_step_spinbutton_value_changed ), - NULL ); - - g_signal_connect( (gpointer) match_grid_button, "clicked", - G_CALLBACK( on_match_grid_button_clicked ), - NULL ); - g_signal_connect( (gpointer) lock_valuechange_togglebutton, "toggled", - G_CALLBACK( on_lock_valuechange_togglebutton_toggled ), - NULL ); - - g_signal_connect( (gpointer) fit_width_spinbutton, "value_changed", - G_CALLBACK( on_fit_width_spinbutton_value_changed ), - NULL ); - g_signal_connect( (gpointer) fit_height_spinbutton, "value_changed", - G_CALLBACK( on_fit_height_spinbutton_value_changed ), - NULL ); - g_signal_connect( (gpointer) fit_button, "clicked", - G_CALLBACK( on_fit_button_clicked ), - NULL ); - - g_signal_connect( (gpointer) axial_button, "clicked", - G_CALLBACK( on_axial_button_clicked ), - NULL ); - - g_signal_connect( (gpointer) done_button, "clicked", - G_CALLBACK( on_done_button_clicked ), - NULL ); - g_signal_connect( (gpointer) apply_button, "clicked", - G_CALLBACK( on_apply_button_clicked ), - NULL ); - g_signal_connect( (gpointer) cancel_button, "clicked", - G_CALLBACK( on_cancel_button_clicked ), - NULL ); - - - return SurfaceInspector; -} - - -// Texture Combo -gboolean on_texture_combo_entry_key_press_event( GtkWidget *widget, GdkEventKey *event, - gpointer user_data ){ - // Have Tab activate selection as well as Return - if ( event->keyval == GDK_Tab ) { - g_signal_emit_by_name( texture_combo_entry, "activate" ); - } - - return FALSE; -} - -void on_texture_combo_entry_activate( GtkEntry *entry, gpointer user_data ){ - texdef_t* tmp_texdef; - texdef_t* tmp_orig_texdef; - texdef_to_face_t* temp_texdef_face_list; - char text[128] = { 0 }; - - if ( !texdef_face_list_empty() && g_bListenChanged ) { - // activate only on entry change - strcpy( text, gtk_entry_get_text( entry ) ); - if ( strcmp( old_texture_entry, text ) ) { - // Check for spaces in shader name - if ( text[0] <= ' ' || strchr( text, ' ' ) ) { - Sys_FPrintf( SYS_WRN, "WARNING: spaces in shader names are not allowed, ignoring '%s'\n", text ); - } - else - { - for ( temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next ) - { - tmp_texdef = (texdef_t *) &temp_texdef_face_list->texdef; - tmp_orig_texdef = (texdef_t *) &temp_texdef_face_list->orig_texdef; - strcpy( old_texture_entry, text ); - tmp_texdef->SetName( text ); - } - GetTexMods(); - } - } - } -} - -// Offset Spins -static void on_hshift_offset_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){ - texdef_t* tmp_texdef; - texdef_t* tmp_orig_texdef; - texdef_to_face_t* temp_texdef_face_list; - - texdef_offset.shift[0] = gtk_spin_button_get_value( GTK_SPIN_BUTTON( hshift_offset_spinbutton ) ); - - if ( !texdef_face_list_empty() && g_bListenChanged ) { - for ( temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next ) - { - tmp_texdef = (texdef_t *) &temp_texdef_face_list->texdef; - tmp_orig_texdef = (texdef_t *) &temp_texdef_face_list->orig_texdef; - if ( is_HShift_conflicting ) { - tmp_texdef->shift[0] = tmp_orig_texdef->shift[0] + texdef_offset.shift[0]; - } - else{ - tmp_texdef->shift[0] = texdef_SI_values.shift[0] + texdef_offset.shift[0]; - } - } - GetTexMods(); - } -} - -static void on_vshift_offset_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){ - texdef_t* tmp_texdef; - texdef_t* tmp_orig_texdef; - texdef_to_face_t* temp_texdef_face_list; - - texdef_offset.shift[1] = gtk_spin_button_get_value( GTK_SPIN_BUTTON( vshift_offset_spinbutton ) ); - - if ( !texdef_face_list_empty() && g_bListenChanged ) { - for ( temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next ) - { - tmp_texdef = (texdef_t *) &temp_texdef_face_list->texdef; - tmp_orig_texdef = (texdef_t *) &temp_texdef_face_list->orig_texdef; - if ( is_VShift_conflicting ) { - tmp_texdef->shift[1] = tmp_orig_texdef->shift[1] + texdef_offset.shift[1]; - } - else{ - tmp_texdef->shift[1] = texdef_SI_values.shift[1] + texdef_offset.shift[1]; - } - } - GetTexMods(); - } - -} - -static void on_hscale_offset_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){ - texdef_t* tmp_texdef; - texdef_t* tmp_orig_texdef; - texdef_to_face_t* temp_texdef_face_list; - - texdef_offset.scale[0] = gtk_spin_button_get_value( GTK_SPIN_BUTTON( hscale_offset_spinbutton ) ); - - if ( !texdef_face_list_empty() && g_bListenChanged ) { - for ( temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next ) - { - tmp_texdef = (texdef_t *) &temp_texdef_face_list->texdef; - tmp_orig_texdef = (texdef_t *) &temp_texdef_face_list->orig_texdef; - if ( is_HScale_conflicting ) { - tmp_texdef->scale[0] = tmp_orig_texdef->scale[0] + texdef_offset.scale[0]; - } - else{ - tmp_texdef->scale[0] = texdef_SI_values.scale[0] + texdef_offset.scale[0]; - } - } - GetTexMods(); - } - - -} - -static void on_vscale_offset_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){ - texdef_t* tmp_texdef; - texdef_t* tmp_orig_texdef; - texdef_to_face_t* temp_texdef_face_list; - - texdef_offset.scale[1] = gtk_spin_button_get_value( GTK_SPIN_BUTTON( vscale_offset_spinbutton ) ); - - if ( !texdef_face_list_empty() && g_bListenChanged ) { - for ( temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next ) - { - tmp_texdef = (texdef_t *) &temp_texdef_face_list->texdef; - tmp_orig_texdef = (texdef_t *) &temp_texdef_face_list->orig_texdef; - if ( is_VScale_conflicting ) { - tmp_texdef->scale[1] = tmp_orig_texdef->scale[1] + texdef_offset.scale[1]; - } - else{ - tmp_texdef->scale[1] = texdef_SI_values.scale[1] + texdef_offset.scale[1]; - } - } - GetTexMods(); - } - -} - -static void on_rotate_offset_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){ - texdef_t* tmp_texdef; - texdef_t* tmp_orig_texdef; - texdef_to_face_t* temp_texdef_face_list; - - texdef_offset.rotate = gtk_spin_button_get_value( GTK_SPIN_BUTTON( rotate_offset_spinbutton ) ); - - if ( !texdef_face_list_empty() && g_bListenChanged ) { - for ( temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next ) - { - tmp_texdef = (texdef_t *) &temp_texdef_face_list->texdef; - tmp_orig_texdef = (texdef_t *) &temp_texdef_face_list->orig_texdef; - if ( is_Rotate_conflicting ) { - tmp_texdef->rotate = tmp_orig_texdef->rotate + texdef_offset.rotate; - } - else{ - tmp_texdef->rotate = texdef_SI_values.rotate + texdef_offset.rotate; - } - } - GetTexMods(); - } - -} - - -// Match Grid -static void on_match_grid_button_clicked( GtkButton *button, gpointer user_data ){ - float hscale, vscale; - - if ( !strcmp( gtk_entry_get_text( GTK_ENTRY( hscale_value_spinbutton ) ), "" ) ) { - hscale = 0.0; - } - else{ - hscale = gtk_spin_button_get_value( GTK_SPIN_BUTTON( hscale_value_spinbutton ) ); - } - - if ( !strcmp( gtk_entry_get_text( GTK_ENTRY( vscale_value_spinbutton ) ), "" ) ) { - vscale = 0.0; - } - else{ - vscale = gtk_spin_button_get_value( GTK_SPIN_BUTTON( vscale_value_spinbutton ) ); - } - DoSnapTToGrid( hscale, vscale ); -} - - -// Lock out changes to Value -static void on_lock_valuechange_togglebutton_toggled( GtkToggleButton *togglebutton, gpointer user_data ){ - bool is_Locked; - - is_Locked = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( lock_valuechange_togglebutton ) ); - - gtk_widget_set_sensitive( GTK_WIDGET( hscale_value_spinbutton ), is_Locked ); - gtk_widget_set_sensitive( GTK_WIDGET( vscale_value_spinbutton ), is_Locked ); - gtk_widget_set_sensitive( GTK_WIDGET( hshift_value_spinbutton ), is_Locked ); - gtk_widget_set_sensitive( GTK_WIDGET( vshift_value_spinbutton ), is_Locked ); - gtk_widget_set_sensitive( GTK_WIDGET( rotate_value_spinbutton ), is_Locked ); -} - - -// Value Spins -static void on_hshift_value_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){ - texdef_t* tmp_texdef; - texdef_t* tmp_orig_texdef; - texdef_to_face_t* temp_texdef_face_list; - - texdef_SI_values.shift[0] = gtk_spin_button_get_value( GTK_SPIN_BUTTON( hshift_value_spinbutton ) ); - - if ( !texdef_face_list_empty() && g_bListenChanged ) { - for ( temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next ) - { - tmp_texdef = (texdef_t *) &temp_texdef_face_list->texdef; - tmp_orig_texdef = (texdef_t *) &temp_texdef_face_list->orig_texdef; - tmp_texdef->shift[0] = texdef_SI_values.shift[0] + texdef_offset.shift[0]; - is_HShift_conflicting = FALSE; - } - GetTexMods(); - } -} - -static void on_vshift_value_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){ - texdef_t* tmp_texdef; - texdef_t* tmp_orig_texdef; - texdef_to_face_t* temp_texdef_face_list; - - texdef_SI_values.shift[1] = gtk_spin_button_get_value( GTK_SPIN_BUTTON( vshift_value_spinbutton ) ); - - if ( !texdef_face_list_empty() && g_bListenChanged ) { - for ( temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next ) - { - tmp_texdef = (texdef_t *) &temp_texdef_face_list->texdef; - tmp_orig_texdef = (texdef_t *) &temp_texdef_face_list->orig_texdef; - tmp_texdef->shift[1] = texdef_SI_values.shift[1] + texdef_offset.shift[1]; - is_VShift_conflicting = FALSE; - } - GetTexMods(); - } -} - -static void on_hscale_value_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){ - texdef_t* tmp_texdef; - texdef_t* tmp_orig_texdef; - texdef_to_face_t* temp_texdef_face_list; - - texdef_SI_values.scale[0] = gtk_spin_button_get_value( GTK_SPIN_BUTTON( hscale_value_spinbutton ) ); - - if ( !texdef_face_list_empty() && g_bListenChanged ) { - for ( temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next ) - { - tmp_texdef = (texdef_t *) &temp_texdef_face_list->texdef; - tmp_orig_texdef = (texdef_t *) &temp_texdef_face_list->orig_texdef; - tmp_texdef->scale[0] = texdef_SI_values.scale[0] + texdef_offset.scale[0]; - is_HScale_conflicting = FALSE; - } - GetTexMods(); - } -} - -static void on_vscale_value_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){ - texdef_t* tmp_texdef; - texdef_t* tmp_orig_texdef; - texdef_to_face_t* temp_texdef_face_list; - - texdef_SI_values.scale[1] = gtk_spin_button_get_value( GTK_SPIN_BUTTON( vscale_value_spinbutton ) ); - - if ( !texdef_face_list_empty() && g_bListenChanged ) { - for ( temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next ) - { - tmp_texdef = (texdef_t *) &temp_texdef_face_list->texdef; - tmp_orig_texdef = (texdef_t *) &temp_texdef_face_list->orig_texdef; - tmp_texdef->scale[1] = texdef_SI_values.scale[1] + texdef_offset.scale[1]; - is_VScale_conflicting = FALSE; - } - GetTexMods(); - } -} - -static void on_rotate_value_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){ - texdef_t* tmp_texdef; - texdef_t* tmp_orig_texdef; - texdef_to_face_t* temp_texdef_face_list; - - texdef_SI_values.rotate = gtk_spin_button_get_value( GTK_SPIN_BUTTON( rotate_value_spinbutton ) ); - - if ( !texdef_face_list_empty() && g_bListenChanged ) { - for ( temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next ) - { - tmp_texdef = (texdef_t *) &temp_texdef_face_list->texdef; - tmp_orig_texdef = (texdef_t *) &temp_texdef_face_list->orig_texdef; - tmp_texdef->rotate = texdef_SI_values.rotate + texdef_offset.rotate; - is_Rotate_conflicting = FALSE; - } - GetTexMods(); - } -} - - -// Step Spins -static void on_hshift_step_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){ - gfloat val; - GtkAdjustment * adjust; - - if ( !g_bListenChanged ) { - return; - } - - l_pIncrement = Get_SI_Inc(); - -#ifdef DBG_SI - Sys_Printf( "OnIncrementChanged HShift\n" ); -#endif - - val = gtk_spin_button_get_value( GTK_SPIN_BUTTON( hshift_step_spinbutton ) ) ; - adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( hshift_offset_spinbutton ) ); - adjust->step_increment = val; - adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( hshift_value_spinbutton ) ); - adjust->step_increment = val; - l_pIncrement->shift[0] = val; -} - -static void on_vshift_step_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){ - gfloat val; - GtkAdjustment * adjust; - - if ( !g_bListenChanged ) { - return; - } - - l_pIncrement = Get_SI_Inc(); - -#ifdef DBG_SI - Sys_Printf( "OnIncrementChanged VShift\n" ); -#endif - - val = gtk_spin_button_get_value( GTK_SPIN_BUTTON( vshift_step_spinbutton ) ) ; - adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( vshift_offset_spinbutton ) ); - adjust->step_increment = val; - adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( vshift_value_spinbutton ) ); - adjust->step_increment = val; - l_pIncrement->shift[1] = val; -} - -static void on_hscale_step_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){ - gfloat val; - GtkAdjustment * adjust; - - if ( !g_bListenChanged ) { - return; - } - - l_pIncrement = Get_SI_Inc(); - -#ifdef DBG_SI - Sys_Printf( "OnIncrementChanged HShift\n" ); -#endif - - val = gtk_spin_button_get_value( GTK_SPIN_BUTTON( hscale_step_spinbutton ) ) ; - adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( hscale_offset_spinbutton ) ); - adjust->step_increment = val; - adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( hscale_value_spinbutton ) ); - adjust->step_increment = val; - l_pIncrement->scale[0] = val; -} - -static void on_vscale_step_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){ - gfloat val; - GtkAdjustment * adjust; - - if ( !g_bListenChanged ) { - return; - } - - l_pIncrement = Get_SI_Inc(); - -#ifdef DBG_SI - Sys_Printf( "OnIncrementChanged HShift\n" ); -#endif - - val = gtk_spin_button_get_value( GTK_SPIN_BUTTON( vscale_step_spinbutton ) ) ; - adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( vscale_offset_spinbutton ) ); - adjust->step_increment = val; - adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( vscale_value_spinbutton ) ); - adjust->step_increment = val; - l_pIncrement->scale[1] = val; -} - -static void on_rotate_step_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){ - gfloat val; - GtkAdjustment * adjust; - - if ( !g_bListenChanged ) { - return; - } - - l_pIncrement = Get_SI_Inc(); - -#ifdef DBG_SI - Sys_Printf( "OnIncrementChanged HShift\n" ); -#endif - - val = gtk_spin_button_get_value( GTK_SPIN_BUTTON( rotate_step_spinbutton ) ) ; - adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( rotate_offset_spinbutton ) ); - adjust->step_increment = val; - adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( rotate_value_spinbutton ) ); - adjust->step_increment = val; - l_pIncrement->rotate = val; -} - - -// Fit Texture -static void on_fit_width_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){ - m_nWidth = gtk_spin_button_get_value_as_int( GTK_SPIN_BUTTON( fit_width_spinbutton ) ); -} - -static void on_fit_height_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){ - m_nHeight = gtk_spin_button_get_value_as_int( GTK_SPIN_BUTTON( fit_height_spinbutton ) ); -} - -static void on_fit_button_clicked( GtkButton *button, gpointer user_data ){ - FaceList_FitTexture( get_texdef_face_list(), m_nHeight, m_nWidth ); - Sys_UpdateWindows( W_ALL ); -} - - -// Axial Button -static void on_axial_button_clicked( GtkButton *button, gpointer user_data ){ - texdef_t* tmp_texdef; -// texdef_t* tmp_orig_texdef; - texdef_to_face_t* temp_texdef_face_list; - - if ( !texdef_face_list_empty() && g_bListenChanged ) { - for ( temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next ) - { - tmp_texdef = (texdef_t *) &temp_texdef_face_list->texdef; - tmp_texdef->shift[0] = 0.0; - tmp_texdef->shift[1] = 0.0; - tmp_texdef->scale[0] = 0.5; - tmp_texdef->scale[1] = 0.5; - tmp_texdef->rotate = 0.0; - } - } - - SetTexdef_FaceList( get_texdef_face_list(), FALSE, TRUE ); - Sys_UpdateWindows( W_ALL ); -} - - -// Action Buttons -static void on_done_button_clicked( GtkButton *button, gpointer user_data ){ - if ( !texdef_face_list_empty() ) { - GetTexMods( TRUE ); - } - HideDlg(); - Sys_UpdateWindows( W_ALL ); -} - -static void on_apply_button_clicked( GtkButton *button, gpointer user_data ){ - if ( !g_bListenChanged ) { - return; - } - - if ( !texdef_face_list_empty() ) { - GetTexMods( TRUE ); - Sys_UpdateWindows( W_CAMERA ); - GetTexdefInfo_from_Radiant(); - SetTexMods(); - } -} - -static void on_cancel_button_clicked( GtkButton *button, gpointer user_data ){ - texturewin = Texturewin(); - texturewin->texdef = g_old_texdef; - // cancel the last do if we own it - if ( ( m_nUndoId == Undo_GetUndoId() ) && ( m_nUndoId != 0 ) ) { -#ifdef DBG_SI - Sys_Printf( "OnCancel calling Undo_Undo\n" ); -#endif - g_bListenUpdate = false; - Undo_Undo( TRUE ); - g_bListenUpdate = true; - m_nUndoId = 0; - } - HideDlg(); -} diff --git a/plugins/surface_quake2/surfaceflagsdialog_quake2.cpp b/plugins/surface_quake2/surfaceflagsdialog_quake2.cpp deleted file mode 100644 index 72e9ff97..00000000 --- a/plugins/surface_quake2/surfaceflagsdialog_quake2.cpp +++ /dev/null @@ -1,1212 +0,0 @@ -/* - Copyright (C) 1999-2007 id Software, Inc. and contributors. - For a list of contributors, see the accompanying CONTRIBUTORS file. - - This file is part of GtkRadiant. - - GtkRadiant is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - GtkRadiant is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with GtkRadiant; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include -#include -#include - -#include "surfdlg_plugin.h" - -#include "surfaceflagsdialog_quake2.h" - -GtkWidget *notebook1; - -GtkWidget *surface_lightbutton; -GtkWidget *surface_slickbutton; -GtkWidget *surface_skybutton; -GtkWidget *surface_warpbutton; -GtkWidget *surface_trans33button; -GtkWidget *surface_trans66button; -GtkWidget *surface_flowingbutton; -GtkWidget *surface_nodrawbutton; -GtkWidget *surface_hintbutton; -GtkWidget *surface_skipbutton; - -GtkWidget *content_solidbutton; -GtkWidget *content_windowbutton; -GtkWidget *content_auxbutton; -GtkWidget *content_lavabutton; -GtkWidget *content_slimebutton; -GtkWidget *content_waterbutton; -GtkWidget *content_mistbutton; -GtkWidget *content_areaportalbutton; -GtkWidget *content_playerclipbutton; -GtkWidget *content_monsterclipbutton; -GtkWidget *content_current0button; -GtkWidget *content_current90button; -GtkWidget *content_current180button; -GtkWidget *content_current270button; -GtkWidget *content_currentUPbutton; -GtkWidget *content_currentDOWNbutton; -GtkWidget *content_originbutton; -GtkWidget *content_detailbutton; -GtkWidget *content_translucentbutton; -GtkWidget *content_ladderbutton; - -GtkWidget *surfacebutton; -GtkWidget *contentbutton; - -GtkWidget *value_entry; -gboolean setup_buttons = TRUE; - -int working_surface_flags; -int surface_mask; -int working_content_flags; -int content_mask; -int working_value; - -inline void set_inconsistent( GtkWidget *toggle_button ){ - gtk_toggle_button_set_inconsistent( GTK_TOGGLE_BUTTON( toggle_button ), TRUE ); -} - -inline void clear_inconsistent( GtkWidget *toggle_button ){ - if ( gtk_toggle_button_get_inconsistent( GTK_TOGGLE_BUTTON( toggle_button ) ) ) { - gtk_toggle_button_set_inconsistent( GTK_TOGGLE_BUTTON( toggle_button ), FALSE ); - } -} - -void clear_all_inconsistent( void ){ - clear_inconsistent( surface_lightbutton ); - clear_inconsistent( surface_slickbutton ); - clear_inconsistent( surface_skybutton ); - clear_inconsistent( surface_warpbutton ); - clear_inconsistent( surface_trans33button ); - clear_inconsistent( surface_trans66button ); - clear_inconsistent( surface_flowingbutton ); - clear_inconsistent( surface_nodrawbutton ); - clear_inconsistent( surface_hintbutton ); - clear_inconsistent( surface_skipbutton ); - - clear_inconsistent( content_solidbutton ); - clear_inconsistent( content_windowbutton ); - clear_inconsistent( content_auxbutton ); - clear_inconsistent( content_lavabutton ); - clear_inconsistent( content_slimebutton ); - clear_inconsistent( content_waterbutton ); - clear_inconsistent( content_mistbutton ); - clear_inconsistent( content_areaportalbutton ); - clear_inconsistent( content_playerclipbutton ); - clear_inconsistent( content_monsterclipbutton ); - clear_inconsistent( content_current0button ); - clear_inconsistent( content_current90button ); - clear_inconsistent( content_current180button ); - clear_inconsistent( content_current270button ); - clear_inconsistent( content_currentUPbutton ); - clear_inconsistent( content_currentDOWNbutton ); - clear_inconsistent( content_originbutton ); - clear_inconsistent( content_detailbutton ); - clear_inconsistent( content_translucentbutton ); - clear_inconsistent( content_ladderbutton ); -} - -void clear_all_buttons_and_values(){ - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( surface_lightbutton ), FALSE ); - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( surface_slickbutton ), FALSE ); - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( surface_skybutton ), FALSE ); - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( surface_warpbutton ), FALSE ); - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( surface_trans33button ), FALSE ); - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( surface_trans66button ), FALSE ); - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( surface_flowingbutton ), FALSE ); - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( surface_nodrawbutton ), FALSE ); - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( surface_hintbutton ), FALSE ); - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( surface_skipbutton ), FALSE ); - - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_solidbutton ), FALSE ); - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_windowbutton ), FALSE ); - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_auxbutton ), FALSE ); - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_lavabutton ), FALSE ); - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_slimebutton ), FALSE ); - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_waterbutton ), FALSE ); - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_mistbutton ), FALSE ); - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_areaportalbutton ), FALSE ); - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_playerclipbutton ), FALSE ); - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_monsterclipbutton ), FALSE ); - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_current0button ), FALSE ); - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_current90button ), FALSE ); - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_current180button ), FALSE ); - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_current270button ), FALSE ); - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_currentUPbutton ), FALSE ); - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_currentDOWNbutton ), FALSE ); - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_originbutton ), FALSE ); - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_detailbutton ), FALSE ); - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_translucentbutton ), FALSE ); - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_ladderbutton ), FALSE ); - - gtk_entry_set_text( (GtkEntry *)value_entry, "" ); -} - -void SetFlagButtons_Quake2( texdef_to_face_t *texdef_face_list, bool b_isListEmpty ){ - int contents = 0; - int flags = 0; - int value = 0; - int diff_contents = 0; - int diff_flags = 0; - gboolean diff_value = FALSE; - char tex_buff[11]; - texdef_t* tmp_texdef; - texdef_to_face_t* temp_texdef_face_list; - - - setup_buttons = TRUE; - working_surface_flags = 0; - surface_mask = 0; - working_content_flags = 0; - content_mask = 0; - working_value = 0; - - if ( !b_isListEmpty ) { - tmp_texdef = &texdef_face_list->texdef; - contents = tmp_texdef->contents; - flags = tmp_texdef->flags; - value = tmp_texdef->value; - - Sys_Printf( "Surface: %d\tContents: %d\tValue: %d\ttmp_texdef\n",tmp_texdef->flags,tmp_texdef->contents,tmp_texdef->value ); - Sys_Printf( "Surface: %d\tContents: %d\tValue: %d\n",flags,contents,value ); - - for ( temp_texdef_face_list = texdef_face_list->next; temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next ) - { - tmp_texdef = &temp_texdef_face_list->texdef; - diff_contents |= contents ^ tmp_texdef->contents; // Figure out which buttons are inconsistent - diff_flags |= flags ^ tmp_texdef->flags; - if ( tmp_texdef->value != value ) { - diff_value = TRUE; - } - - Sys_Printf( "Surface: %d\tContents: %d\tValue: %d\ttmp_texdef\n",tmp_texdef->flags,tmp_texdef->contents,tmp_texdef->value ); - Sys_Printf( "Surface: %d\tContents: %d\tValue: %d\n",flags,contents,value ); - - } - } - - - - clear_all_inconsistent(); - - // If no faces/brushes are selected, clear everything and bail - if ( b_isListEmpty ) { - clear_all_buttons_and_values(); - setup_buttons = FALSE; - return; - } - - // Set surface buttons to reflect brush/face flags, contents, and values - if ( diff_flags & QUAKE2_SURF_LIGHT ) { - set_inconsistent( surface_lightbutton ); - } - else if ( flags & QUAKE2_SURF_LIGHT ) { - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( surface_lightbutton ), TRUE ); - } - else{ - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( surface_lightbutton ), FALSE ); - } - - if ( diff_flags & QUAKE2_SURF_SLICK ) { - set_inconsistent( surface_slickbutton ); - } - else if ( flags & QUAKE2_SURF_SLICK ) { - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( surface_slickbutton ), TRUE ); - } - else{ - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( surface_slickbutton ), FALSE ); - } - - if ( diff_flags & QUAKE2_SURF_SKY ) { - set_inconsistent( surface_skybutton ); - } - else if ( flags & QUAKE2_SURF_SKY ) { - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( surface_skybutton ), TRUE ); - } - else{ - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( surface_skybutton ), FALSE ); - } - - if ( diff_flags & QUAKE2_SURF_WARP ) { - set_inconsistent( surface_warpbutton ); - } - else if ( flags & QUAKE2_SURF_WARP ) { - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( surface_warpbutton ), TRUE ); - } - else{ - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( surface_warpbutton ), FALSE ); - } - - if ( diff_flags & QUAKE2_SURF_TRANS33 ) { - set_inconsistent( surface_trans33button ); - } - else if ( flags & QUAKE2_SURF_TRANS33 ) { - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( surface_trans33button ), TRUE ); - } - else{ - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( surface_trans33button ), FALSE ); - } - - if ( diff_flags & QUAKE2_SURF_TRANS66 ) { - set_inconsistent( surface_trans66button ); - } - else if ( flags & QUAKE2_SURF_TRANS66 ) { - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( surface_trans66button ), TRUE ); - } - else{ - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( surface_trans66button ), FALSE ); - } - - if ( diff_flags & QUAKE2_SURF_FLOWING ) { - set_inconsistent( surface_flowingbutton ); - } - else if ( flags & QUAKE2_SURF_FLOWING ) { - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( surface_flowingbutton ), TRUE ); - } - else{ - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( surface_flowingbutton ), FALSE ); - } - - if ( diff_flags & QUAKE2_SURF_NODRAW ) { - set_inconsistent( surface_nodrawbutton ); - } - else if ( flags & QUAKE2_SURF_NODRAW ) { - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( surface_nodrawbutton ), TRUE ); - } - else{ - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( surface_nodrawbutton ), FALSE ); - } - - if ( diff_flags & QUAKE2_SURF_HINT ) { - set_inconsistent( surface_hintbutton ); - } - else if ( flags & QUAKE2_SURF_HINT ) { - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( surface_hintbutton ), TRUE ); - } - else{ - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( surface_hintbutton ), FALSE ); - } - - if ( diff_flags & QUAKE2_SURF_SKIP ) { - set_inconsistent( surface_skipbutton ); - } - else if ( flags & QUAKE2_SURF_SKIP ) { - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( surface_skipbutton ), TRUE ); - } - else{ - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( surface_skipbutton ), FALSE ); - } - - // Set content buttons to reflect brush values - if ( diff_contents & QUAKE2_CONTENTS_SOLID ) { - set_inconsistent( content_solidbutton ); - } - else if ( contents & QUAKE2_CONTENTS_SOLID ) { - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_solidbutton ), TRUE ); - } - else{ - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_solidbutton ), FALSE ); - } - - if ( diff_contents & QUAKE2_CONTENTS_WINDOW ) { - set_inconsistent( content_windowbutton ); - } - else if ( contents & QUAKE2_CONTENTS_WINDOW ) { - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_windowbutton ), TRUE ); - } - else{ - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_windowbutton ), FALSE ); - } - - if ( diff_contents & QUAKE2_CONTENTS_AUX ) { - set_inconsistent( content_auxbutton ); - } - else if ( contents & QUAKE2_CONTENTS_AUX ) { - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_auxbutton ), TRUE ); - } - else{ - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_auxbutton ), FALSE ); - } - - if ( diff_contents & QUAKE2_CONTENTS_LAVA ) { - set_inconsistent( content_lavabutton ); - } - else if ( contents & QUAKE2_CONTENTS_LAVA ) { - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_lavabutton ), TRUE ); - } - else{ - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_lavabutton ), FALSE ); - } - - if ( diff_contents & QUAKE2_CONTENTS_SLIME ) { - set_inconsistent( content_slimebutton ); - } - else if ( contents & QUAKE2_CONTENTS_SLIME ) { - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_slimebutton ), TRUE ); - } - else{ - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_slimebutton ), FALSE ); - } - - if ( diff_contents & QUAKE2_CONTENTS_WATER ) { - set_inconsistent( content_waterbutton ); - } - else if ( contents & QUAKE2_CONTENTS_WATER ) { - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_waterbutton ), TRUE ); - } - else{ - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_waterbutton ), FALSE ); - } - - if ( diff_contents & QUAKE2_CONTENTS_MIST ) { - set_inconsistent( content_mistbutton ); - } - else if ( contents & QUAKE2_CONTENTS_MIST ) { - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_mistbutton ), TRUE ); - } - else{ - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_mistbutton ), FALSE ); - } - - if ( diff_contents & QUAKE2_CONTENTS_AREAPORTAL ) { - set_inconsistent( content_areaportalbutton ); - } - else if ( contents & QUAKE2_CONTENTS_AREAPORTAL ) { - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_areaportalbutton ), TRUE ); - } - else{ - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_areaportalbutton ), FALSE ); - } - - if ( diff_contents & QUAKE2_CONTENTS_PLAYERCLIP ) { - set_inconsistent( content_playerclipbutton ); - } - else if ( contents & QUAKE2_CONTENTS_PLAYERCLIP ) { - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_playerclipbutton ), TRUE ); - } - else{ - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_playerclipbutton ), FALSE ); - } - - if ( diff_contents & QUAKE2_CONTENTS_MONSTERCLIP ) { - set_inconsistent( content_monsterclipbutton ); - } - else if ( contents & QUAKE2_CONTENTS_MONSTERCLIP ) { - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_monsterclipbutton ), TRUE ); - } - else{ - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_monsterclipbutton ), FALSE ); - } - - if ( diff_contents & QUAKE2_CONTENTS_CURRENT_0 ) { - set_inconsistent( content_current0button ); - } - else if ( contents & QUAKE2_CONTENTS_CURRENT_0 ) { - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_current0button ), TRUE ); - } - else{ - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_current0button ), FALSE ); - } - - if ( diff_contents & QUAKE2_CONTENTS_CURRENT_90 ) { - set_inconsistent( content_current90button ); - } - else if ( contents & QUAKE2_CONTENTS_CURRENT_90 ) { - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_current90button ), TRUE ); - } - else{ - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_current90button ), FALSE ); - } - - if ( diff_contents & QUAKE2_CONTENTS_CURRENT_180 ) { - set_inconsistent( content_current180button ); - } - else if ( contents & QUAKE2_CONTENTS_CURRENT_180 ) { - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_current180button ), TRUE ); - } - else{ - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_current180button ), FALSE ); - } - - if ( diff_contents & QUAKE2_CONTENTS_CURRENT_270 ) { - set_inconsistent( content_current270button ); - } - else if ( contents & QUAKE2_CONTENTS_CURRENT_270 ) { - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_current270button ), TRUE ); - } - else{ - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_current270button ), FALSE ); - } - - if ( diff_contents & QUAKE2_CONTENTS_CURRENT_UP ) { - set_inconsistent( content_currentUPbutton ); - } - else if ( contents & QUAKE2_CONTENTS_CURRENT_UP ) { - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_currentUPbutton ), TRUE ); - } - else{ - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_currentUPbutton ), FALSE ); - } - - if ( diff_contents & QUAKE2_CONTENTS_CURRENT_DOWN ) { - set_inconsistent( content_currentDOWNbutton ); - } - else if ( contents & QUAKE2_CONTENTS_CURRENT_DOWN ) { - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_currentDOWNbutton ), TRUE ); - } - else{ - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_currentDOWNbutton ), FALSE ); - } - - if ( diff_contents & QUAKE2_CONTENTS_ORIGIN ) { - set_inconsistent( content_originbutton ); - } - else if ( contents & QUAKE2_CONTENTS_ORIGIN ) { - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_originbutton ), TRUE ); - } - else{ - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_originbutton ), FALSE ); - } - - if ( diff_contents & QUAKE2_CONTENTS_DETAIL ) { - set_inconsistent( content_detailbutton ); - } - else if ( contents & QUAKE2_CONTENTS_DETAIL ) { - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_detailbutton ), TRUE ); - } - else{ - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_detailbutton ), FALSE ); - } - - if ( diff_contents & QUAKE2_CONTENTS_TRANSLUCENT ) { - set_inconsistent( content_translucentbutton ); - } - else if ( contents & QUAKE2_CONTENTS_TRANSLUCENT ) { - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_translucentbutton ), TRUE ); - } - else{ - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_translucentbutton ), FALSE ); - } - - if ( diff_contents & QUAKE2_CONTENTS_LADDER ) { - set_inconsistent( content_ladderbutton ); - } - else if ( contents & QUAKE2_CONTENTS_LADDER ) { - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_ladderbutton ), TRUE ); - } - else{ - gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( content_ladderbutton ), FALSE ); - } - - // Set Value - if ( diff_value ) { - gtk_entry_set_text( (GtkEntry *)value_entry, "" ); - } - else - { - working_value = value; - sprintf( tex_buff, "%d", value ); - gtk_entry_set_text( (GtkEntry *)value_entry, tex_buff ); - } - - setup_buttons = FALSE; -} - -void SetChangeInFlags_Face_Quake2( texdef_to_face_t *texdef_face_list ){ - texdef_to_face_t *temp_texdef_face_list; - texdef_t *tmp_texdef; - - for ( temp_texdef_face_list = texdef_face_list; temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next ) - { - tmp_texdef = &temp_texdef_face_list->texdef; - tmp_texdef->flags = ( tmp_texdef->flags & ~surface_mask ) | working_surface_flags; - tmp_texdef->contents = ( tmp_texdef->contents & ~content_mask ) | working_content_flags; - tmp_texdef->value = working_value; - Sys_Printf( "content_flag: %d content_mask: %d\n",working_content_flags,content_mask ); - Sys_Printf( "content: %d\n",tmp_texdef->contents ); - } -} - -inline void change_surfaceflag( GtkWidget *togglebutton, int sur_flag, gboolean change_flag_to ){ - - if ( !setup_buttons ) { // If we're setting up the buttons, we really don't need to - // set flags that are already set - - if ( gtk_toggle_button_get_inconsistent( GTK_TOGGLE_BUTTON( togglebutton ) ) ) { // Clear out inconsistent, if set - clear_inconsistent( GTK_WIDGET( togglebutton ) ); - } - - surface_mask |= sur_flag; - - if ( change_flag_to ) { - working_surface_flags |= sur_flag; - } - else{ - working_surface_flags &= ~sur_flag; - } - } -} - -inline void change_contentflag( GtkWidget *togglebutton, int content_flag, gboolean change_flag_to ){ - - if ( ( !setup_buttons ) ) { // If we're setting up the buttons, we really don't need to - // set flags that are already set - - if ( gtk_toggle_button_get_inconsistent( GTK_TOGGLE_BUTTON( togglebutton ) ) ) { - clear_inconsistent( togglebutton ); - } - //if (g_ptrSelectedFaces.GetSize() == 0) // Only changing content flags on whole brushes, not faces. - //{ - content_mask |= content_flag; - - if ( change_flag_to ) { - working_content_flags |= content_flag; - } - else{ - working_content_flags &= ~content_flag; - } - //} - Sys_Printf( "content_flag: %d content_mask: %d\n",content_flag,content_mask ); - } -} - -// Surface Flags Callbacks -void -on_surface_lightbutton_toggled( GtkToggleButton *togglebutton, - gpointer user_data ){ - change_surfaceflag( surface_lightbutton, QUAKE2_SURF_LIGHT, ( GTK_TOGGLE_BUTTON( surface_lightbutton )->active ) ); - -} - -void -on_surface_slickbutton_toggled( GtkToggleButton *togglebutton, - gpointer user_data ){ - change_surfaceflag( surface_slickbutton, QUAKE2_SURF_SLICK, ( GTK_TOGGLE_BUTTON( surface_slickbutton )->active ) ); - -} - -void -on_surface_skybutton_toggled( GtkToggleButton *togglebutton, - gpointer user_data ){ - change_surfaceflag( surface_skybutton, QUAKE2_SURF_SKY, ( GTK_TOGGLE_BUTTON( surface_skybutton )->active ) ); -} - -void -on_surface_warpbutton_toggled( GtkToggleButton *togglebutton, - gpointer user_data ){ - change_surfaceflag( surface_warpbutton, QUAKE2_SURF_WARP, ( GTK_TOGGLE_BUTTON( surface_warpbutton )->active ) ); -} - -void -on_surface_trans33button_toggled( GtkToggleButton *togglebutton, - gpointer user_data ){ - change_surfaceflag( surface_trans33button, QUAKE2_SURF_TRANS33, ( GTK_TOGGLE_BUTTON( surface_trans33button )->active ) ); -} - -void -on_surface_trans66button_toggled( GtkToggleButton *togglebutton, - gpointer user_data ){ - change_surfaceflag( surface_trans66button, QUAKE2_SURF_TRANS66, ( GTK_TOGGLE_BUTTON( surface_trans66button )->active ) ); -} - -void -on_surface_flowingbutton_toggled( GtkToggleButton *togglebutton, - gpointer user_data ){ - change_surfaceflag( surface_flowingbutton, QUAKE2_SURF_FLOWING, ( GTK_TOGGLE_BUTTON( surface_flowingbutton )->active ) ); -} - -void -on_surface_nodrawbutton_toggled( GtkToggleButton *togglebutton, - gpointer user_data ){ - change_surfaceflag( surface_nodrawbutton, QUAKE2_SURF_NODRAW, ( GTK_TOGGLE_BUTTON( surface_nodrawbutton )->active ) ); -} - -void -on_surface_hintbutton_toggled( GtkToggleButton *togglebutton, - gpointer user_data ){ - change_surfaceflag( surface_hintbutton, QUAKE2_SURF_HINT, ( GTK_TOGGLE_BUTTON( surface_hintbutton )->active ) ); -} - -void -on_surface_skipbutton_toggled( GtkToggleButton *togglebutton, - gpointer user_data ){ - change_surfaceflag( surface_skipbutton, QUAKE2_SURF_SKIP, ( GTK_TOGGLE_BUTTON( surface_skipbutton )->active ) ); -} - -// Content Flags Callbacks -void -on_content_solidbutton_toggled( GtkToggleButton *togglebutton, - gpointer user_data ){ - change_contentflag( content_solidbutton, QUAKE2_CONTENTS_SOLID, ( GTK_TOGGLE_BUTTON( content_solidbutton )->active ) ); -} - -void -on_content_windowbutton_toggled( GtkToggleButton *togglebutton, - gpointer user_data ){ - change_contentflag( content_windowbutton, QUAKE2_CONTENTS_WINDOW, ( GTK_TOGGLE_BUTTON( content_windowbutton )->active ) ); -} - -void -on_content_auxbutton_toggled( GtkToggleButton *togglebutton, - gpointer user_data ){ - change_contentflag( content_auxbutton, QUAKE2_CONTENTS_AUX, ( GTK_TOGGLE_BUTTON( content_auxbutton )->active ) ); -} - -void -on_content_lavabutton_toggled( GtkToggleButton *togglebutton, - gpointer user_data ){ - change_contentflag( content_lavabutton, QUAKE2_CONTENTS_LAVA, ( GTK_TOGGLE_BUTTON( content_lavabutton )->active ) ); -} - -void -on_content_slimebutton_toggled( GtkToggleButton *togglebutton, - gpointer user_data ){ - change_contentflag( content_slimebutton, QUAKE2_CONTENTS_SLIME, ( GTK_TOGGLE_BUTTON( content_slimebutton )->active ) ); -} - -void -on_content_waterbutton_toggled( GtkToggleButton *togglebutton, - gpointer user_data ){ - change_contentflag( content_waterbutton, QUAKE2_CONTENTS_WATER, ( GTK_TOGGLE_BUTTON( content_waterbutton )->active ) ); -} - -void -on_content_mistbutton_toggled( GtkToggleButton *togglebutton, - gpointer user_data ){ - change_contentflag( content_mistbutton, QUAKE2_CONTENTS_MIST, ( GTK_TOGGLE_BUTTON( content_mistbutton )->active ) ); -} - -void -on_content_areaportalbutton_toggled( GtkToggleButton *togglebutton, - gpointer user_data ){ - change_contentflag( content_areaportalbutton, QUAKE2_CONTENTS_AREAPORTAL, ( GTK_TOGGLE_BUTTON( content_areaportalbutton )->active ) ); -} - -void -on_content_playerclipbutton_toggled( GtkToggleButton *togglebutton, - gpointer user_data ){ - change_contentflag( content_playerclipbutton, QUAKE2_CONTENTS_PLAYERCLIP, ( GTK_TOGGLE_BUTTON( content_playerclipbutton )->active ) ); -} - -void -on_content_monsterclipbutton_toggled( GtkToggleButton *togglebutton, - gpointer user_data ){ - change_contentflag( content_monsterclipbutton, QUAKE2_CONTENTS_MONSTERCLIP, ( GTK_TOGGLE_BUTTON( content_monsterclipbutton )->active ) ); -} - -void -on_content_current0button_toggled( GtkToggleButton *togglebutton, - gpointer user_data ){ - change_contentflag( content_current0button, QUAKE2_CONTENTS_CURRENT_0, ( GTK_TOGGLE_BUTTON( content_current0button )->active ) ); -} - -void -on_content_current90button_toggled( GtkToggleButton *togglebutton, - gpointer user_data ){ - change_contentflag( content_current90button, QUAKE2_CONTENTS_CURRENT_90, ( GTK_TOGGLE_BUTTON( content_current90button )->active ) ); -} - -void -on_content_current180button_toggled( GtkToggleButton *togglebutton, - gpointer user_data ){ - change_contentflag( content_current180button, QUAKE2_CONTENTS_CURRENT_180, ( GTK_TOGGLE_BUTTON( content_current180button )->active ) ); -} - -void -on_content_current270button_toggled( GtkToggleButton *togglebutton, - gpointer user_data ){ - change_contentflag( content_current270button, QUAKE2_CONTENTS_CURRENT_270, ( GTK_TOGGLE_BUTTON( content_current270button )->active ) ); -} - -void -on_content_currentUPbutton_toggled( GtkToggleButton *togglebutton, - gpointer user_data ){ - change_contentflag( content_currentUPbutton, QUAKE2_CONTENTS_CURRENT_UP, ( GTK_TOGGLE_BUTTON( content_currentUPbutton )->active ) ); -} - -void -on_content_currentDOWNbutton_toggled( GtkToggleButton *togglebutton, - gpointer user_data ){ - change_contentflag( content_currentDOWNbutton, QUAKE2_CONTENTS_CURRENT_DOWN, ( GTK_TOGGLE_BUTTON( content_currentDOWNbutton )->active ) ); -} - -void -on_content_originbutton_toggled( GtkToggleButton *togglebutton, - gpointer user_data ){ - change_contentflag( content_originbutton, QUAKE2_CONTENTS_ORIGIN, ( GTK_TOGGLE_BUTTON( content_originbutton )->active ) ); -} - -void -on_content_detailbutton_toggled( GtkToggleButton *togglebutton, - gpointer user_data ){ - change_contentflag( content_detailbutton, QUAKE2_CONTENTS_DETAIL, ( GTK_TOGGLE_BUTTON( content_detailbutton )->active ) ); -} - -void -on_content_translucentbutton_toggled( GtkToggleButton *togglebutton, - gpointer user_data ){ - change_contentflag( content_translucentbutton, QUAKE2_CONTENTS_TRANSLUCENT, ( GTK_TOGGLE_BUTTON( content_translucentbutton )->active ) ); -} - -void -on_content_ladderbutton_toggled( GtkToggleButton *togglebutton, - gpointer user_data ){ - change_contentflag( content_ladderbutton, QUAKE2_CONTENTS_LADDER, ( GTK_TOGGLE_BUTTON( content_ladderbutton )->active ) ); -} - -// Value Entry Callback -void -on_value_entry_changed( GtkEditable *editable, - gpointer user_data ){ - if ( ( !setup_buttons ) ) { // If we're setting up the buttons, don't change value - working_value = atoi( gtk_entry_get_text( (GtkEntry*)editable ) ); - } -} - -void -on_value_entry_insert_text( GtkEditable *editable, - gchar *new_text, - gint new_text_length, - gint *position, - gpointer user_data ){ - int i, count = 0; - gchar *result; - - // Limit input to digits, throwing out anything else - // Modified from Gtk FAQ for text filtering of GtkEntry - result = g_new( gchar, new_text_length ); - - for ( i = 0; i < new_text_length; i++ ) { - if ( !isdigit( new_text[i] ) ) { - continue; - } - result[count++] = new_text[i]; - } - - if ( count > 0 ) { - gtk_signal_handler_block_by_func( GTK_OBJECT( editable ), - GTK_SIGNAL_FUNC( on_value_entry_insert_text ), - user_data ); - gtk_editable_insert_text( editable, result, count, position ); - gtk_signal_handler_unblock_by_func( GTK_OBJECT( editable ), - GTK_SIGNAL_FUNC( on_value_entry_insert_text ), - user_data ); - } - gtk_signal_emit_stop_by_name( GTK_OBJECT( editable ), "insert_text" ); - - g_free( result ); -} - -void -on_surfacebutton_clicked( GtkButton *button, - gpointer user_data ){ - gtk_notebook_set_page( GTK_NOTEBOOK( notebook1 ), 0 ); -} - -void -on_contentbutton_clicked( GtkButton *button, - gpointer user_data ){ - gtk_notebook_set_page( GTK_NOTEBOOK( notebook1 ), 1 ); -} - - -#define QUAKE2_FLAG_BUTTON_BORDER 3 - -GtkWidget* Create_Quake2FlagsDialog( GtkWidget* surfacedialog_widget ){ - GtkWidget *frame1; - GtkWidget *vbox1; - GtkWidget *vbox2; - GtkWidget *vbox3; - GtkWidget *vbox4; - GtkWidget *table4; - GtkWidget *hbox2; - GtkWidget *hbox3; - GtkWidget *hseparator1; - GtkWidget *value_label; - GtkWidget *label5; - GtkWidget *table3; - GtkWidget *label6; - - frame1 = gtk_frame_new( _( "Flags" ) ); - gtk_widget_show( frame1 ); - gtk_container_add( GTK_CONTAINER( surfacedialog_widget ), frame1 ); - - vbox1 = gtk_vbox_new( FALSE, 0 ); - gtk_widget_show( vbox1 ); - gtk_container_add( GTK_CONTAINER( frame1 ), vbox1 ); - - notebook1 = gtk_notebook_new(); - gtk_widget_show( notebook1 ); - gtk_box_pack_start( GTK_BOX( vbox1 ), notebook1, TRUE, TRUE, 0 ); - gtk_notebook_set_show_tabs( GTK_NOTEBOOK( notebook1 ), TRUE ); - gtk_container_set_border_width( GTK_CONTAINER( notebook1 ), 5 ); - - vbox2 = gtk_vbox_new( FALSE, 0 ); - gtk_widget_show( vbox2 ); - gtk_container_add( GTK_CONTAINER( notebook1 ), vbox2 ); - - table4 = gtk_table_new( 3, 4, FALSE ); - gtk_widget_show( table4 ); - gtk_box_pack_start( GTK_BOX( vbox2 ), table4, TRUE, TRUE, 0 ); - - surface_lightbutton = gtk_toggle_button_new_with_label( _( "Light" ) ); - gtk_signal_connect( GTK_OBJECT( surface_lightbutton ), "toggled", - GTK_SIGNAL_FUNC( on_surface_lightbutton_toggled ), - NULL ); - gtk_widget_show( surface_lightbutton ); - gtk_table_attach( GTK_TABLE( table4 ), surface_lightbutton, 0, 1, 0, 1, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); - gtk_container_set_border_width( GTK_CONTAINER( surface_lightbutton ), QUAKE2_FLAG_BUTTON_BORDER ); - - surface_slickbutton = gtk_toggle_button_new_with_label( _( "Slick" ) ); - gtk_signal_connect( GTK_OBJECT( surface_slickbutton ), "toggled", - GTK_SIGNAL_FUNC( on_surface_slickbutton_toggled ), - NULL ); - gtk_widget_show( surface_slickbutton ); - gtk_table_attach( GTK_TABLE( table4 ), surface_slickbutton, 1, 2, 0, 1, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); - gtk_container_set_border_width( GTK_CONTAINER( surface_slickbutton ), QUAKE2_FLAG_BUTTON_BORDER ); - - surface_skybutton = gtk_toggle_button_new_with_label( _( "Sky" ) ); - gtk_signal_connect( GTK_OBJECT( surface_skybutton ), "toggled", - GTK_SIGNAL_FUNC( on_surface_skybutton_toggled ), - NULL ); - gtk_widget_show( surface_skybutton ); - gtk_table_attach( GTK_TABLE( table4 ), surface_skybutton, 2, 3, 0, 1, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); - gtk_container_set_border_width( GTK_CONTAINER( surface_skybutton ), QUAKE2_FLAG_BUTTON_BORDER ); - - surface_warpbutton = gtk_toggle_button_new_with_label( _( "Warp" ) ); - gtk_signal_connect( GTK_OBJECT( surface_warpbutton ), "toggled", - GTK_SIGNAL_FUNC( on_surface_warpbutton_toggled ), - NULL ); - gtk_widget_show( surface_warpbutton ); - gtk_table_attach( GTK_TABLE( table4 ), surface_warpbutton, 3, 4, 0, 1, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); - gtk_container_set_border_width( GTK_CONTAINER( surface_warpbutton ), QUAKE2_FLAG_BUTTON_BORDER ); - - surface_trans33button = gtk_toggle_button_new_with_label( _( "Trans 33" ) ); - gtk_signal_connect( GTK_OBJECT( surface_trans33button ), "toggled", - GTK_SIGNAL_FUNC( on_surface_trans33button_toggled ), - NULL ); - gtk_widget_show( surface_trans33button ); - gtk_table_attach( GTK_TABLE( table4 ), surface_trans33button, 0, 1, 1, 2, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); - gtk_container_set_border_width( GTK_CONTAINER( surface_trans33button ), QUAKE2_FLAG_BUTTON_BORDER ); - - surface_trans66button = gtk_toggle_button_new_with_label( _( "Trans 66" ) ); - gtk_signal_connect( GTK_OBJECT( surface_trans66button ), "toggled", - GTK_SIGNAL_FUNC( on_surface_trans66button_toggled ), - NULL ); - gtk_widget_show( surface_trans66button ); - gtk_table_attach( GTK_TABLE( table4 ), surface_trans66button, 1, 2, 1, 2, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); - gtk_container_set_border_width( GTK_CONTAINER( surface_trans66button ), QUAKE2_FLAG_BUTTON_BORDER ); - - surface_flowingbutton = gtk_toggle_button_new_with_label( _( "Flowing" ) ); - gtk_signal_connect( GTK_OBJECT( surface_flowingbutton ), "toggled", - GTK_SIGNAL_FUNC( on_surface_flowingbutton_toggled ), - NULL ); - gtk_widget_show( surface_flowingbutton ); - gtk_table_attach( GTK_TABLE( table4 ), surface_flowingbutton, 2, 3, 1, 2, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); - gtk_container_set_border_width( GTK_CONTAINER( surface_flowingbutton ), QUAKE2_FLAG_BUTTON_BORDER ); - - surface_nodrawbutton = gtk_toggle_button_new_with_label( _( "NoDraw" ) ); - gtk_signal_connect( GTK_OBJECT( surface_nodrawbutton ), "toggled", - GTK_SIGNAL_FUNC( on_surface_nodrawbutton_toggled ), - NULL ); - gtk_widget_show( surface_nodrawbutton ); - gtk_table_attach( GTK_TABLE( table4 ), surface_nodrawbutton, 3, 4, 1, 2, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); - gtk_container_set_border_width( GTK_CONTAINER( surface_nodrawbutton ), QUAKE2_FLAG_BUTTON_BORDER ); - - surface_hintbutton = gtk_toggle_button_new_with_label( _( "Hint" ) ); - gtk_signal_connect( GTK_OBJECT( surface_hintbutton ), "toggled", - GTK_SIGNAL_FUNC( on_surface_hintbutton_toggled ), - NULL ); - gtk_widget_show( surface_hintbutton ); - gtk_table_attach( GTK_TABLE( table4 ), surface_hintbutton, 0, 1, 2, 3, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); - gtk_container_set_border_width( GTK_CONTAINER( surface_hintbutton ), QUAKE2_FLAG_BUTTON_BORDER ); - - surface_skipbutton = gtk_toggle_button_new_with_label( _( "Skip" ) ); - gtk_signal_connect( GTK_OBJECT( surface_skipbutton ), "toggled", - GTK_SIGNAL_FUNC( on_surface_skipbutton_toggled ), - NULL ); - gtk_widget_show( surface_skipbutton ); - gtk_table_attach( GTK_TABLE( table4 ), surface_skipbutton, 3, 4, 2, 3, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); - gtk_container_set_border_width( GTK_CONTAINER( surface_skipbutton ), QUAKE2_FLAG_BUTTON_BORDER ); - - hseparator1 = gtk_hseparator_new(); - gtk_widget_show( hseparator1 ); - gtk_box_pack_start( GTK_BOX( vbox2 ), hseparator1, FALSE, FALSE, 0 ); - gtk_widget_set_usize( hseparator1, -2, 5 ); - - hbox2 = gtk_hbox_new( FALSE, 0 ); - gtk_widget_show( hbox2 ); - gtk_box_pack_start( GTK_BOX( vbox2 ), hbox2, FALSE, FALSE, 0 ); - - hbox3 = gtk_hbox_new( FALSE, 0 ); - gtk_widget_show( hbox3 ); - gtk_box_pack_start( GTK_BOX( hbox2 ), hbox3, TRUE, TRUE, 0 ); - - vbox4 = gtk_vbox_new( FALSE, 0 ); - gtk_widget_show( vbox4 ); - gtk_box_pack_start( GTK_BOX( hbox3 ), vbox4, TRUE, TRUE, 0 ); - - value_label = gtk_label_new( _( "Value: " ) ); - gtk_widget_show( value_label ); - gtk_box_pack_start( GTK_BOX( hbox3 ), value_label, FALSE, FALSE, 0 ); - - value_entry = gtk_entry_new(); - gtk_signal_connect( GTK_OBJECT( value_entry ), "changed", - GTK_SIGNAL_FUNC( on_value_entry_changed ), - NULL ); - gtk_signal_connect( GTK_OBJECT( value_entry ), "insert_text", - GTK_SIGNAL_FUNC( on_value_entry_insert_text ), - NULL ); - gtk_entry_set_max_length( (GtkEntry *)value_entry, 11 ); - gtk_widget_show( value_entry ); - gtk_box_pack_start( GTK_BOX( hbox3 ), value_entry, TRUE, TRUE, 0 ); - - vbox3 = gtk_vbox_new( FALSE, 0 ); - gtk_widget_show( vbox3 ); - gtk_box_pack_start( GTK_BOX( hbox3 ), vbox3, TRUE, TRUE, 0 ); - - label5 = gtk_label_new( _( "Surface Flags" ) ); - gtk_widget_show( label5 ); - gtk_notebook_set_tab_label( GTK_NOTEBOOK( notebook1 ), gtk_notebook_get_nth_page( GTK_NOTEBOOK( notebook1 ), 0 ), label5 ); - - table3 = gtk_table_new( 5, 4, FALSE ); - gtk_widget_show( table3 ); - gtk_container_add( GTK_CONTAINER( notebook1 ), table3 ); - - content_solidbutton = gtk_toggle_button_new_with_label( _( "Solid" ) ); - gtk_signal_connect( GTK_OBJECT( content_solidbutton ), "toggled", - GTK_SIGNAL_FUNC( on_content_solidbutton_toggled ), - NULL ); - gtk_widget_show( content_solidbutton ); - gtk_table_attach( GTK_TABLE( table3 ), content_solidbutton, 0, 1, 0, 1, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); - gtk_container_set_border_width( GTK_CONTAINER( content_solidbutton ), QUAKE2_FLAG_BUTTON_BORDER ); - - content_windowbutton = gtk_toggle_button_new_with_label( _( "Window" ) ); - gtk_signal_connect( GTK_OBJECT( content_windowbutton ), "toggled", - GTK_SIGNAL_FUNC( on_content_windowbutton_toggled ), - NULL ); - gtk_widget_show( content_windowbutton ); - gtk_table_attach( GTK_TABLE( table3 ), content_windowbutton, 1, 2, 0, 1, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); - gtk_container_set_border_width( GTK_CONTAINER( content_windowbutton ), QUAKE2_FLAG_BUTTON_BORDER ); - - content_auxbutton = gtk_toggle_button_new_with_label( _( "Aux" ) ); - gtk_signal_connect( GTK_OBJECT( content_auxbutton ), "toggled", - GTK_SIGNAL_FUNC( on_content_auxbutton_toggled ), - NULL ); - gtk_widget_show( content_auxbutton ); - gtk_table_attach( GTK_TABLE( table3 ), content_auxbutton, 2, 3, 0, 1, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); - gtk_container_set_border_width( GTK_CONTAINER( content_auxbutton ), QUAKE2_FLAG_BUTTON_BORDER ); - - content_lavabutton = gtk_toggle_button_new_with_label( _( "Lava" ) ); - gtk_signal_connect( GTK_OBJECT( content_lavabutton ), "toggled", - GTK_SIGNAL_FUNC( on_content_lavabutton_toggled ), - NULL ); - gtk_widget_show( content_lavabutton ); - gtk_table_attach( GTK_TABLE( table3 ), content_lavabutton, 3, 4, 0, 1, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); - gtk_container_set_border_width( GTK_CONTAINER( content_lavabutton ), QUAKE2_FLAG_BUTTON_BORDER ); - - content_slimebutton = gtk_toggle_button_new_with_label( _( "Slime" ) ); - gtk_signal_connect( GTK_OBJECT( content_slimebutton ), "toggled", - GTK_SIGNAL_FUNC( on_content_slimebutton_toggled ), - NULL ); - gtk_widget_show( content_slimebutton ); - gtk_table_attach( GTK_TABLE( table3 ), content_slimebutton, 0, 1, 1, 2, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); - gtk_container_set_border_width( GTK_CONTAINER( content_slimebutton ), QUAKE2_FLAG_BUTTON_BORDER ); - - content_waterbutton = gtk_toggle_button_new_with_label( _( "Water" ) ); - gtk_signal_connect( GTK_OBJECT( content_waterbutton ), "toggled", - GTK_SIGNAL_FUNC( on_content_waterbutton_toggled ), - NULL ); - gtk_widget_show( content_waterbutton ); - gtk_table_attach( GTK_TABLE( table3 ), content_waterbutton, 1, 2, 1, 2, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); - gtk_container_set_border_width( GTK_CONTAINER( content_waterbutton ), QUAKE2_FLAG_BUTTON_BORDER ); - - content_mistbutton = gtk_toggle_button_new_with_label( _( "Mist" ) ); - gtk_signal_connect( GTK_OBJECT( content_mistbutton ), "toggled", - GTK_SIGNAL_FUNC( on_content_mistbutton_toggled ), - NULL ); - gtk_widget_show( content_mistbutton ); - gtk_table_attach( GTK_TABLE( table3 ), content_mistbutton, 2, 3, 1, 2, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); - gtk_container_set_border_width( GTK_CONTAINER( content_mistbutton ), QUAKE2_FLAG_BUTTON_BORDER ); - - content_areaportalbutton = gtk_toggle_button_new_with_label( _( "AreaPortal" ) ); - gtk_signal_connect( GTK_OBJECT( content_areaportalbutton ), "toggled", - GTK_SIGNAL_FUNC( on_content_areaportalbutton_toggled ), - NULL ); - gtk_widget_show( content_areaportalbutton ); - gtk_table_attach( GTK_TABLE( table3 ), content_areaportalbutton, 3, 4, 1, 2, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); - gtk_container_set_border_width( GTK_CONTAINER( content_areaportalbutton ), QUAKE2_FLAG_BUTTON_BORDER ); - - content_playerclipbutton = gtk_toggle_button_new_with_label( _( "PlayerClip" ) ); - gtk_signal_connect( GTK_OBJECT( content_playerclipbutton ), "toggled", - GTK_SIGNAL_FUNC( on_content_playerclipbutton_toggled ), - NULL ); - gtk_widget_show( content_playerclipbutton ); - gtk_table_attach( GTK_TABLE( table3 ), content_playerclipbutton, 0, 1, 2, 3, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); - gtk_container_set_border_width( GTK_CONTAINER( content_playerclipbutton ), QUAKE2_FLAG_BUTTON_BORDER ); - - content_monsterclipbutton = gtk_toggle_button_new_with_label( _( "MonsterClip" ) ); - gtk_signal_connect( GTK_OBJECT( content_monsterclipbutton ), "toggled", - GTK_SIGNAL_FUNC( on_content_monsterclipbutton_toggled ), - NULL ); - gtk_widget_show( content_monsterclipbutton ); - gtk_table_attach( GTK_TABLE( table3 ), content_monsterclipbutton, 1, 2, 2, 3, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); - gtk_container_set_border_width( GTK_CONTAINER( content_monsterclipbutton ), QUAKE2_FLAG_BUTTON_BORDER ); - - content_current0button = gtk_toggle_button_new_with_label( _( "Current 0" ) ); - gtk_signal_connect( GTK_OBJECT( content_current0button ), "toggled", - GTK_SIGNAL_FUNC( on_content_current0button_toggled ), - NULL ); - gtk_widget_show( content_current0button ); - gtk_table_attach( GTK_TABLE( table3 ), content_current0button, 2, 3, 2, 3, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); - gtk_container_set_border_width( GTK_CONTAINER( content_current0button ), QUAKE2_FLAG_BUTTON_BORDER ); - - content_current90button = gtk_toggle_button_new_with_label( _( "Current 90" ) ); - gtk_signal_connect( GTK_OBJECT( content_current90button ), "toggled", - GTK_SIGNAL_FUNC( on_content_current90button_toggled ), - NULL ); - gtk_widget_show( content_current90button ); - gtk_table_attach( GTK_TABLE( table3 ), content_current90button, 3, 4, 2, 3, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); - gtk_container_set_border_width( GTK_CONTAINER( content_current90button ), QUAKE2_FLAG_BUTTON_BORDER ); - - content_current180button = gtk_toggle_button_new_with_label( _( "Current 180" ) ); - gtk_signal_connect( GTK_OBJECT( content_current180button ), "toggled", - GTK_SIGNAL_FUNC( on_content_current180button_toggled ), - NULL ); - gtk_widget_show( content_current180button ); - gtk_table_attach( GTK_TABLE( table3 ), content_current180button, 0, 1, 3, 4, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); - gtk_container_set_border_width( GTK_CONTAINER( content_current180button ), QUAKE2_FLAG_BUTTON_BORDER ); - - content_current270button = gtk_toggle_button_new_with_label( _( "Current 270" ) ); - gtk_signal_connect( GTK_OBJECT( content_current270button ), "toggled", - GTK_SIGNAL_FUNC( on_content_current270button_toggled ), - NULL ); - gtk_widget_show( content_current270button ); - gtk_table_attach( GTK_TABLE( table3 ), content_current270button, 1, 2, 3, 4, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); - gtk_container_set_border_width( GTK_CONTAINER( content_current270button ), QUAKE2_FLAG_BUTTON_BORDER ); - - content_currentUPbutton = gtk_toggle_button_new_with_label( _( "Current UP" ) ); - gtk_signal_connect( GTK_OBJECT( content_currentUPbutton ), "toggled", - GTK_SIGNAL_FUNC( on_content_currentUPbutton_toggled ), - NULL ); - gtk_widget_show( content_currentUPbutton ); - gtk_table_attach( GTK_TABLE( table3 ), content_currentUPbutton, 2, 3, 3, 4, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); - gtk_container_set_border_width( GTK_CONTAINER( content_currentUPbutton ), QUAKE2_FLAG_BUTTON_BORDER ); - - content_currentDOWNbutton = gtk_toggle_button_new_with_label( _( "Current DOWN" ) ); - gtk_signal_connect( GTK_OBJECT( content_currentDOWNbutton ), "toggled", - GTK_SIGNAL_FUNC( on_content_currentDOWNbutton_toggled ), - NULL ); - gtk_widget_show( content_currentDOWNbutton ); - gtk_table_attach( GTK_TABLE( table3 ), content_currentDOWNbutton, 3, 4, 3, 4, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); - gtk_container_set_border_width( GTK_CONTAINER( content_currentDOWNbutton ), QUAKE2_FLAG_BUTTON_BORDER ); - - content_originbutton = gtk_toggle_button_new_with_label( _( "Origin" ) ); - gtk_signal_connect( GTK_OBJECT( content_originbutton ), "toggled", - GTK_SIGNAL_FUNC( on_content_originbutton_toggled ), - NULL ); - gtk_widget_show( content_originbutton ); - gtk_table_attach( GTK_TABLE( table3 ), content_originbutton, 0, 1, 4, 5, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); - gtk_container_set_border_width( GTK_CONTAINER( content_originbutton ), QUAKE2_FLAG_BUTTON_BORDER ); - - content_detailbutton = gtk_toggle_button_new_with_label( _( "Detail" ) ); - gtk_signal_connect( GTK_OBJECT( content_detailbutton ), "toggled", - GTK_SIGNAL_FUNC( on_content_detailbutton_toggled ), - NULL ); - gtk_widget_show( content_detailbutton ); - gtk_table_attach( GTK_TABLE( table3 ), content_detailbutton, 1, 2, 4, 5, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); - gtk_container_set_border_width( GTK_CONTAINER( content_detailbutton ), QUAKE2_FLAG_BUTTON_BORDER ); - - content_translucentbutton = gtk_toggle_button_new_with_label( _( "Translucent" ) ); - gtk_signal_connect( GTK_OBJECT( content_translucentbutton ), "toggled", - GTK_SIGNAL_FUNC( on_content_translucentbutton_toggled ), - NULL ); - gtk_widget_show( content_translucentbutton ); - gtk_table_attach( GTK_TABLE( table3 ), content_translucentbutton, 2, 3, 4, 5, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); - gtk_container_set_border_width( GTK_CONTAINER( content_translucentbutton ), QUAKE2_FLAG_BUTTON_BORDER ); - - content_ladderbutton = gtk_toggle_button_new_with_label( _( "Ladder" ) ); - gtk_signal_connect( GTK_OBJECT( content_ladderbutton ), "toggled", - GTK_SIGNAL_FUNC( on_content_ladderbutton_toggled ), - NULL ); - gtk_widget_show( content_ladderbutton ); - gtk_table_attach( GTK_TABLE( table3 ), content_ladderbutton, 3, 4, 4, 5, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); - gtk_container_set_border_width( GTK_CONTAINER( content_ladderbutton ), QUAKE2_FLAG_BUTTON_BORDER ); - - label6 = gtk_label_new( _( "Content Flags" ) ); - gtk_widget_show( label6 ); - gtk_notebook_set_tab_label( GTK_NOTEBOOK( notebook1 ), gtk_notebook_get_nth_page( GTK_NOTEBOOK( notebook1 ), 1 ), label6 ); - - return frame1; -} diff --git a/plugins/surface_quake2/surfaceflagsdialog_quake2.h b/plugins/surface_quake2/surfaceflagsdialog_quake2.h deleted file mode 100644 index a448be2c..00000000 --- a/plugins/surface_quake2/surfaceflagsdialog_quake2.h +++ /dev/null @@ -1,108 +0,0 @@ -/* - Copyright (C) 1999-2007 id Software, Inc. and contributors. - For a list of contributors, see the accompanying CONTRIBUTORS file. - - This file is part of GtkRadiant. - - GtkRadiant is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - GtkRadiant is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with GtkRadiant; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef _SURFACEFLAGSDIALOG_QUAKE2_H - #define _SURFACEFLAGSDIALOG_QUAKE2_H - - -#define QUAKE2_SURF_LIGHT 0x1 -#define QUAKE2_SURF_SLICK 0x2 -#define QUAKE2_SURF_SKY 0x4 -#define QUAKE2_SURF_WARP 0x8 -#define QUAKE2_SURF_TRANS33 0x10 -#define QUAKE2_SURF_TRANS66 0x20 -#define QUAKE2_SURF_FLOWING 0x40 -#define QUAKE2_SURF_NODRAW 0x80 -#define QUAKE2_SURF_HINT 0x100 -#define QUAKE2_SURF_SKIP 0x200 - - -#define QUAKE2_CONTENTS_SOLID 0x1 -#define QUAKE2_CONTENTS_WINDOW 0x2 -#define QUAKE2_CONTENTS_AUX 0x4 -#define QUAKE2_CONTENTS_LAVA 0x8 -#define QUAKE2_CONTENTS_SLIME 0x10 -#define QUAKE2_CONTENTS_WATER 0x20 -#define QUAKE2_CONTENTS_MIST 0x40 - -#define QUAKE2_CONTENTS_AREAPORTAL 0x8000 -#define QUAKE2_CONTENTS_PLAYERCLIP 0x10000 -#define QUAKE2_CONTENTS_MONSTERCLIP 0x20000 -#define QUAKE2_CONTENTS_CURRENT_0 0x40000 -#define QUAKE2_CONTENTS_CURRENT_90 0x80000 -#define QUAKE2_CONTENTS_CURRENT_180 0x100000 -#define QUAKE2_CONTENTS_CURRENT_270 0x200000 -#define QUAKE2_CONTENTS_CURRENT_UP 0x400000 -#define QUAKE2_CONTENTS_CURRENT_DOWN 0x800000 -#define QUAKE2_CONTENTS_ORIGIN 0x1000000 - -#define QUAKE2_CONTENTS_DETAIL 0x8000000 -#define QUAKE2_CONTENTS_TRANSLUCENT 0x10000000 -#define QUAKE2_CONTENTS_LADDER 0x20000000 -/* - extern GtkWidget *notebook1; - - extern GtkWidget *surface_lightbutton; - extern GtkWidget *surface_slickbutton; - extern GtkWidget *surface_skybutton; - extern GtkWidget *surface_warpbutton; - extern GtkWidget *surface_trans33button; - extern GtkWidget *surface_trans66button; - extern GtkWidget *surface_flowingbutton; - extern GtkWidget *surface_nodrawbutton; - extern GtkWidget *surface_hintbutton; - extern GtkWidget *surface_skipbutton; - - extern GtkWidget *content_solidbutton; - extern GtkWidget *content_windowbutton; - extern GtkWidget *content_auxbutton; - extern GtkWidget *content_lavabutton; - extern GtkWidget *content_slimebutton; - extern GtkWidget *content_waterbutton; - extern GtkWidget *content_mistbutton; - extern GtkWidget *content_areaportalbutton; - extern GtkWidget *content_playerclipbutton; - extern GtkWidget *content_monsterclipbutton; - extern GtkWidget *content_current0button; - extern GtkWidget *content_current90button; - extern GtkWidget *content_current180button; - extern GtkWidget *content_current270button; - extern GtkWidget *content_currentUPbutton; - extern GtkWidget *content_currentDOWNbutton; - extern GtkWidget *content_originbutton; - extern GtkWidget *content_detailbutton; - extern GtkWidget *content_translucentbutton; - extern GtkWidget *content_ladderbutton; - - extern GtkWidget *surfacebutton; - extern GtkWidget *contentbutton; - - extern GtkWidget *value_entry; - extern gboolean setup_buttons; - - extern int working_surface_flags; - extern int surface_mask; - extern int working_content_flags; - extern int content_mask; - extern int working_value; - */ - -#endif // _SURFACEFLAGSDIALOG_QUAKE2_H diff --git a/plugins/surface_ufoai/surface_ufoai.def b/plugins/surface_ufoai/surface_ufoai.def deleted file mode 100644 index 588ea289..00000000 --- a/plugins/surface_ufoai/surface_ufoai.def +++ /dev/null @@ -1,7 +0,0 @@ -; surface_ufoai.def : Declares the module parameters for the DLL. - -LIBRARY "SURFACE_UFOAI" - -EXPORTS - ; Explicit exports can go here - Synapse_EnumerateInterfaces @1 diff --git a/plugins/surface_ufoai/surfacedialog.cpp b/plugins/surface_ufoai/surfacedialog.cpp deleted file mode 100644 index 5e0eebc2..00000000 --- a/plugins/surface_ufoai/surfacedialog.cpp +++ /dev/null @@ -1,1916 +0,0 @@ -/* - Copyright (C) 1999-2007 id Software, Inc. and contributors. - For a list of contributors, see the accompanying CONTRIBUTORS file. - - This file is part of GtkRadiant. - - GtkRadiant is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - GtkRadiant is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with GtkRadiant; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -// -// Surface Dialog Module -// - -// -// Nurail: Implemented to Module from the main Radiant Surface Dialog code -// - - -#include -#include -#include - -#include "surfdlg_plugin.h" - - - -#ifdef _DEBUG -//#define DBG_SI 1 -#endif - -#include "gtkr_vector.h" - -vector g_texdef_face_vector; - -inline texdef_to_face_t* get_texdef_face_list(){ - return &( *g_texdef_face_vector.begin() ); -} - -inline unsigned int texdef_face_list_empty(){ - return g_texdef_face_vector.empty(); -} - -inline unsigned int texdef_face_list_size(){ - return g_texdef_face_vector.size(); -} - -// For different faces having different values -bool is_HShift_conflicting; -bool is_VShift_conflicting; -bool is_HScale_conflicting; -bool is_VScale_conflicting; -bool is_Rotate_conflicting; -bool is_TextureName_conflicting; - -void ShowDlg(); -void HideDlg(); -void SetTexMods(); -void GetTexMods( bool b_SetUndoPoint = FALSE ); -void BuildDialog(); -void FitAll(); -void InitDefaultIncrement( texdef_t * ); -void DoSnapTToGrid( float hscale, float vscale ); -// called to perform a fitting from the outside (shortcut key) -void SurfaceDialogFitAll(); - -// UFOAI Flags Functions -void SetFlagButtons_UFOAI( texdef_to_face_t *texdef_face_list, bool b_isListEmpty ); -void SetChangeInFlags_Face_UFOAI( texdef_to_face_t *texdef_face_list ); -GtkWidget* Create_UFOAIFlagsDialog( GtkWidget* surfacedialog_widget ); - - -// Dialog Data -int m_nHeight; -int m_nWidth; - -// 0 is invalid, otherwise it's the Id of the last 'do' we are responsible for -int m_nUndoId; - - -texturewin_t *texturewin; -texdef_t *l_pIncrement; -texdef_t texdef_offset; -texdef_t texdef_SI_values; - -// For Texture Entry, activate only on entry change -char old_texture_entry[128]; - -// the texdef to switch back to when the OnCancel is called -texdef_t g_old_texdef; - -// when TRUE, this thing means the surface inspector is currently being displayed -bool g_surfwin = FALSE; -// turn on/off processing of the "changed" "value_changed" messages -// (need to turn off when we are feeding data in) -bool g_bListenChanged = true; -// turn on/off listening of the update messages -bool g_bListenUpdate = true; - -GtkWidget* create_SurfaceInspector( void ); -GtkWidget *SurfaceInspector = NULL; - -GtkWidget *m_pWidget; -GtkWidget *GetWidget() { return SurfaceInspector; } -GtkWidget *Get_SI_Module_Widget() { return SurfaceInspector; } -void SetWidget( GtkWidget *new_widget ) { m_pWidget = new_widget; } -GtkWidget *GetDlgWidget( const char* name ) -{ return GTK_WIDGET( g_object_get_data( G_OBJECT( SurfaceInspector ), name ) ); } - -// Spins for FitTexture -GtkWidget *spin_width; -GtkWidget *spin_height; - - -GtkWidget *texture_combo; -GtkWidget *texture_combo_entry; - -GtkWidget *match_grid_button; -GtkWidget *lock_valuechange_togglebutton; - -GtkObject *hshift_value_spinbutton_adj; -GtkWidget *hshift_value_spinbutton; -GtkObject *vshift_value_spinbutton_adj; -GtkWidget *vshift_value_spinbutton; -GtkObject *hscale_value_spinbutton_adj; -GtkWidget *hscale_value_spinbutton; -GtkObject *vscale_value_spinbutton_adj; -GtkWidget *vscale_value_spinbutton; -GtkObject *rotate_value_spinbutton_adj; -GtkWidget *rotate_value_spinbutton; - -GtkObject *hshift_offset_spinbutton_adj; -GtkWidget *hshift_offset_spinbutton; -GtkObject *vshift_offset_spinbutton_adj; -GtkWidget *vshift_offset_spinbutton; -GtkObject *hscale_offset_spinbutton_adj; -GtkWidget *hscale_offset_spinbutton; -GtkObject *vscale_offset_spinbutton_adj; -GtkWidget *vscale_offset_spinbutton; -GtkObject *rotate_offset_spinbutton_adj; -GtkWidget *rotate_offset_spinbutton; - -GtkObject *hshift_step_spinbutton_adj; -GtkWidget *hshift_step_spinbutton; -GtkObject *vshift_step_spinbutton_adj; -GtkWidget *vshift_step_spinbutton; -GtkObject *hscale_step_spinbutton_adj; -GtkWidget *hscale_step_spinbutton; -GtkObject *vscale_step_spinbutton_adj; -GtkWidget *vscale_step_spinbutton; -GtkObject *rotate_step_spinbutton_adj; -GtkWidget *rotate_step_spinbutton; - -GtkObject *fit_width_spinbutton_adj; -GtkWidget *fit_width_spinbutton; -GtkObject *fit_height_spinbutton_adj; -GtkWidget *fit_height_spinbutton; -GtkWidget *fit_button; -GtkWidget *axial_button; - -GtkWidget *done_button; -GtkWidget *apply_button; -GtkWidget *cancel_button; - -// Callbacks -gboolean on_texture_combo_entry_key_press_event( GtkWidget *widget, GdkEventKey *event, gpointer user_data ); -void on_texture_combo_entry_activate( GtkEntry *entry, gpointer user_data ); - -static void on_match_grid_button_clicked( GtkButton *button, gpointer user_data ); -static void on_lock_valuechange_togglebutton_toggled( GtkToggleButton *togglebutton, gpointer user_data ); - -static void on_hshift_value_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ); -static void on_vshift_value_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ); -static void on_hscale_value_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ); -static void on_vscale_value_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ); -static void on_rotate_value_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ); - -static void on_hshift_offset_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ); -static void on_vshift_offset_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ); -static void on_hscale_offset_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ); -static void on_vscale_offset_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ); -static void on_rotate_offset_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ); - -static void on_hshift_step_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ); -static void on_vshift_step_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ); -static void on_hscale_step_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ); -static void on_vscale_step_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ); -static void on_rotate_step_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ); - -static void on_fit_width_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ); -static void on_fit_height_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ); -static void on_fit_button_clicked( GtkButton *button, gpointer user_data ); -static void on_axial_button_clicked( GtkButton *button, gpointer user_data ); - -static void on_done_button_clicked( GtkButton *button, gpointer user_data ); -static void on_apply_button_clicked( GtkButton *button, gpointer user_data ); -static void on_cancel_button_clicked( GtkButton *button, gpointer user_data ); - - -/* - =================================================== - - SURFACE INSPECTOR - - =================================================== - */ - - -void IsFaceConflicting(){ - texdef_t* tmp_texdef; - texdef_to_face_t* temp_texdef_face_list; - char texture_name[128]; - - if ( texdef_face_list_empty() ) { - gtk_entry_set_text( GTK_ENTRY( hshift_value_spinbutton ), "" ); - gtk_entry_set_text( GTK_ENTRY( vshift_value_spinbutton ), "" ); - gtk_entry_set_text( GTK_ENTRY( hscale_value_spinbutton ), "" ); - gtk_entry_set_text( GTK_ENTRY( vscale_value_spinbutton ), "" ); - gtk_entry_set_text( GTK_ENTRY( rotate_value_spinbutton ), "" ); - gtk_entry_set_text( GTK_ENTRY( texture_combo_entry ), "" ); - return; - } - - g_bListenChanged = FALSE; - - tmp_texdef = &get_texdef_face_list()->texdef; - - strcpy( texture_name, tmp_texdef->GetName() ); - - texdef_SI_values.shift[0] = tmp_texdef->shift[0]; - texdef_SI_values.shift[1] = tmp_texdef->shift[1]; - texdef_SI_values.scale[0] = tmp_texdef->scale[0]; - texdef_SI_values.scale[1] = tmp_texdef->scale[1]; - texdef_SI_values.rotate = tmp_texdef->rotate; - texdef_SI_values.SetName( texture_name ); - - is_HShift_conflicting = FALSE; - is_VShift_conflicting = FALSE; - is_HScale_conflicting = FALSE; - is_VScale_conflicting = FALSE; - is_Rotate_conflicting = FALSE; - is_TextureName_conflicting = FALSE; - - if ( texdef_face_list_size() > 1 ) { - temp_texdef_face_list = get_texdef_face_list()->next; - - for (; temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next ) - { - tmp_texdef = &temp_texdef_face_list->texdef; - if ( texdef_SI_values.shift[0] != tmp_texdef->shift[0] ) { - is_HShift_conflicting = TRUE; - } - - if ( texdef_SI_values.shift[1] != tmp_texdef->shift[1] ) { - is_VShift_conflicting = TRUE; - } - - if ( texdef_SI_values.scale[0] != tmp_texdef->scale[0] ) { - is_HScale_conflicting = TRUE; - } - - if ( texdef_SI_values.scale[1] != tmp_texdef->scale[1] ) { - is_VScale_conflicting = TRUE; - } - - if ( texdef_SI_values.rotate != tmp_texdef->rotate ) { - is_Rotate_conflicting = TRUE; - } - - if ( strcmp( texture_name, tmp_texdef->GetName() ) ) { - is_TextureName_conflicting = TRUE; - } - } - } - - if ( is_HShift_conflicting ) { - gtk_entry_set_text( GTK_ENTRY( hshift_value_spinbutton ), "" ); - } - else{ - gtk_spin_button_set_value( GTK_SPIN_BUTTON( hshift_value_spinbutton ), texdef_SI_values.shift[0] ); - } - - if ( is_VShift_conflicting ) { - gtk_entry_set_text( GTK_ENTRY( vshift_value_spinbutton ), "" ); - } - else{ - gtk_spin_button_set_value( GTK_SPIN_BUTTON( vshift_value_spinbutton ), texdef_SI_values.shift[1] ); - } - - if ( is_HScale_conflicting ) { - gtk_entry_set_text( GTK_ENTRY( hscale_value_spinbutton ), "" ); - } - else{ - gtk_spin_button_set_value( GTK_SPIN_BUTTON( hscale_value_spinbutton ), texdef_SI_values.scale[0] ); - } - - if ( is_VScale_conflicting ) { - gtk_entry_set_text( GTK_ENTRY( vscale_value_spinbutton ), "" ); - } - else{ - gtk_spin_button_set_value( GTK_SPIN_BUTTON( vscale_value_spinbutton ), texdef_SI_values.scale[1] ); - } - - if ( is_Rotate_conflicting ) { - gtk_entry_set_text( GTK_ENTRY( rotate_value_spinbutton ), "" ); - } - else{ - gtk_spin_button_set_value( GTK_SPIN_BUTTON( rotate_value_spinbutton ), texdef_SI_values.rotate ); - } - - g_bListenChanged = TRUE; -} - -#define MAX_NUM_LIST_ITEMS 15 -static void PopulateTextureComboList(){ - texdef_t* tmp_texdef; - texdef_to_face_t* temp_texdef_face_list; - char blank[1]; - GList *items = NULL; - int num_of_list_items = 0; - - blank[0] = 0; - - if ( texdef_face_list_empty() ) { - items = g_list_append( items, (gpointer) blank ); - // For Texture Entry, activate only on entry change - strcpy( old_texture_entry, blank ); - } - else if ( !is_TextureName_conflicting ) { - temp_texdef_face_list = get_texdef_face_list(); - tmp_texdef = (texdef_t *) &get_texdef_face_list()->texdef; - items = g_list_append( items, (gpointer) tmp_texdef->GetName() ); - // For Texture Entry, activate only on entry change - strcpy( old_texture_entry, tmp_texdef->GetName() ); - } - else - { - for ( temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next ) - { - tmp_texdef = (texdef_t *) &temp_texdef_face_list->texdef; - // Need to do a string compare, hence the custom search - if ( !( g_list_find_custom( items, tmp_texdef->GetName(), (GCompareFunc) strcmp ) ) ) { - items = g_list_append( items, (gpointer) tmp_texdef->GetName() ); - num_of_list_items++; - } - // Make sure the combo list isn't too long - if ( num_of_list_items >= MAX_NUM_LIST_ITEMS ) { - break; - } - } - // If this isn't added last (to the top of the list), g_list_find freaks. - items = g_list_prepend( items, (gpointer) blank ); - // For Texture Entry, activate only on entry change - strcpy( old_texture_entry, blank ); - } - - gtk_combo_set_popdown_strings( GTK_COMBO( texture_combo ), items ); - g_list_free( items ); - -} - -static void ZeroOffsetValues(){ - texdef_offset.shift[0] = 0.0; - texdef_offset.shift[1] = 0.0; - texdef_offset.scale[0] = 0.0; - texdef_offset.scale[1] = 0.0; - texdef_offset.rotate = 0.0; -} - -static void GetTexdefInfo_from_Radiant(){ - g_texdef_face_vector.clear(); - - unsigned int count = GetSelectedFaceCountfromBrushes(); - if ( count == 0 ) { - count = GetSelectedFaceCount(); - } - - g_texdef_face_vector.resize( count ); - - if ( !texdef_face_list_empty() ) { - GetSelFacesTexdef( get_texdef_face_list() ); - } - - IsFaceConflicting(); - PopulateTextureComboList(); - ZeroOffsetValues(); - if ( texdef_face_list_empty() ) { - SetFlagButtons_UFOAI( get_texdef_face_list(), TRUE ); - } - else{ - SetFlagButtons_UFOAI( get_texdef_face_list(), FALSE ); - } -} - -static gint delete_event_callback( GtkWidget *widget, GdkEvent* event, gpointer data ){ - HideDlg(); - return TRUE; -} - -// make the shift increments match the grid settings -// the objective being that the shift+arrows shortcuts move the texture by the corresponding grid size -// this depends on a scale value if you have selected a particular texture on which you want it to work: -// we move the textures in pixels, not world units. (i.e. increment values are in pixel) -// depending on the texture scale it doesn't take the same amount of pixels to move of g_qeglobals.d_gridsize -// increment * scale = gridsize -// hscale and vscale are optional parameters, if they are zero they will be set to the default scale -// NOTE: the default scale depends if you are using BP mode or regular. -// For regular it's 0.5f (128 pixels cover 64 world units), for BP it's simply 1.0f -// see fenris #2810 -void DoSnapTToGrid( float hscale, float vscale ){ - l_pIncrement = Get_SI_Inc(); - - if ( hscale == 0.0f ) { - hscale = 0.5f; - } - if ( vscale == 0.0f ) { - vscale = 0.5f; - } -#ifdef _DEBUG - Sys_Printf( "DoSnapTToGrid: hscale %g vscale %g\n", hscale, vscale ); -#endif - l_pIncrement->shift[0] = GridSize() / hscale; - l_pIncrement->shift[1] = GridSize() / vscale; - // now some update work - // FIXME: doesn't look good here, seems to be called several times - SetTexMods(); -} - -void UpdateSurfaceDialog(){ - if ( !g_bListenUpdate ) { - return; - } - - if ( !SurfaceInspector ) { - return; - } - - // avoid long delays on slow computers - while ( gtk_events_pending() ) - gtk_main_iteration(); - - if ( g_surfwin ) { -#ifdef DBG_SI - Sys_Printf( "UpdateSurfaceDialog\n" ); -#endif - GetTexdefInfo_from_Radiant(); - SetTexMods(); - } - -} - -// DoSurface will always try to show the surface inspector -// or update it because something new has been selected -void DoSurface( void ){ -#ifdef DBG_SI - Sys_Printf( "DoSurface\n" ); -#endif - if ( !SurfaceInspector ) { - create_SurfaceInspector(); - } - - ShowDlg(); - SetTexMods(); -} - -void ToggleSurface(){ -#ifdef DBG_SI - Sys_Printf( "ToggleSurface Module\n" ); -#endif - if ( !g_surfwin ) { - DoSurface(); - } - else{ - on_cancel_button_clicked( NULL, NULL ); - } -} - -// NOTE: will raise and show the Surface inspector and exec fit for patches and brushes -void SurfaceDlgFitAll(){ - DoSurface(); - FitAll(); -} - -// ============================================================================= -// SurfaceDialog class - -void ShowDlg(){ - - if ( !SurfaceInspector ) { - create_SurfaceInspector(); - } - else{ - gtk_widget_show( SurfaceInspector ); - } - - GetTexdefInfo_from_Radiant(); - GetTexMods( TRUE ); // Set Initial Undo Point - g_surfwin = TRUE; -} - -void HideDlg(){ - g_surfwin = FALSE; - gtk_widget_hide( SurfaceInspector ); -} - - -// set default values for increments (shift scale and rot) -// this is called by the prefs code if can't find the values -void InitDefaultIncrement( texdef_t *tex ){ - tex->SetName( "foo" ); - tex->shift[0] = 8; - tex->shift[1] = 8; - tex->scale[0] = 0.25; - tex->scale[1] = 0.25; - tex->rotate = 10; -} - -void BuildDialog(){ - if ( !SurfaceInspector ) { - create_SurfaceInspector(); - } -} - -/* - ============== - SetTexMods - - Set the fields to the current texdef (i.e. map/texdef -> dialog widgets) - =============== - */ - -void SetTexMods(){ - texdef_t *pt; - GtkSpinButton *spin; - GtkAdjustment *adjust; - - texturewin = Texturewin(); - l_pIncrement = Get_SI_Inc(); - -#ifdef DBG_SI - Sys_Printf( "SurfaceDlg SetTexMods\n" ); -#endif - - if ( !g_surfwin ) { - return; - } - - pt = &texturewin->texdef; - - g_bListenChanged = false; - - if ( strncmp( pt->GetName(), "textures/", 9 ) != 0 ) { - texdef_offset.SetName( SHADER_NOT_FOUND ); - } - - - spin = GTK_SPIN_BUTTON( hshift_offset_spinbutton ); - gtk_spin_button_set_value( spin, texdef_offset.shift[0] ); - adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) ); - adjust->step_increment = l_pIncrement->shift[0]; - gtk_spin_button_set_value( GTK_SPIN_BUTTON( hshift_step_spinbutton ), l_pIncrement->shift[0] ); - - spin = GTK_SPIN_BUTTON( hshift_value_spinbutton ); - adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) ); - adjust->step_increment = l_pIncrement->shift[0]; - - - spin = GTK_SPIN_BUTTON( vshift_offset_spinbutton ); - gtk_spin_button_set_value( spin, texdef_offset.shift[1] ); - adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) ); - adjust->step_increment = l_pIncrement->shift[1]; - gtk_spin_button_set_value( GTK_SPIN_BUTTON( vshift_step_spinbutton ), l_pIncrement->shift[1] ); - - spin = GTK_SPIN_BUTTON( vshift_value_spinbutton ); - adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) ); - adjust->step_increment = l_pIncrement->shift[1]; - - - spin = GTK_SPIN_BUTTON( hscale_offset_spinbutton ); - gtk_spin_button_set_value( spin, texdef_offset.scale[0] ); - adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) ); - adjust->step_increment = l_pIncrement->scale[0]; - gtk_spin_button_set_value( GTK_SPIN_BUTTON( hscale_step_spinbutton ), l_pIncrement->scale[0] ); - - spin = GTK_SPIN_BUTTON( hscale_value_spinbutton ); - adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) ); - adjust->step_increment = l_pIncrement->scale[0]; - - - spin = GTK_SPIN_BUTTON( vscale_offset_spinbutton ); - gtk_spin_button_set_value( spin, texdef_offset.scale[1] ); - adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) ); - adjust->step_increment = l_pIncrement->scale[1]; - gtk_spin_button_set_value( GTK_SPIN_BUTTON( vscale_step_spinbutton ), l_pIncrement->scale[1] ); - - spin = GTK_SPIN_BUTTON( vscale_value_spinbutton ); - adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) ); - adjust->step_increment = l_pIncrement->scale[1]; - - - spin = GTK_SPIN_BUTTON( rotate_offset_spinbutton ); - gtk_spin_button_set_value( spin, texdef_offset.rotate ); - adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) ); - adjust->step_increment = l_pIncrement->rotate; - gtk_spin_button_set_value( GTK_SPIN_BUTTON( rotate_step_spinbutton ), l_pIncrement->rotate ); - - spin = GTK_SPIN_BUTTON( rotate_value_spinbutton ); - adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( spin ) ); - adjust->step_increment = l_pIncrement->rotate; - - - g_bListenChanged = true; - - // store the current texdef as our escape route if user hits OnCancel - g_old_texdef = texturewin->texdef; -} - -/* - ============== - GetTexMods - - Shows any changes to the main Radiant windows - =============== - */ -void GetTexMods( bool b_SetUndoPoint ){ - -#ifdef DBG_SI - Sys_Printf( "SurfaceDlg GetTexMods\n" ); -#endif - - if ( !texdef_face_list_empty() ) { - g_bListenUpdate = FALSE; - SetChangeInFlags_Face_UFOAI( get_texdef_face_list() ); - SetTexdef_FaceList( get_texdef_face_list(), b_SetUndoPoint, false ); - g_bListenUpdate = TRUE; - - if ( b_SetUndoPoint ) { - m_nUndoId = Undo_GetUndoId(); - } - } -} - -void FitAll(){ - on_fit_button_clicked( NULL, NULL ); -} - - -//////////////////////////////////////////////////////////////////// -// -// GUI Section -// -//////////////////////////////////////////////////////////////////// - -GtkWidget* create_SurfaceInspector( void ){ - - GtkWidget *label; - GtkWidget *hseparator; - GtkWidget *eventbox; - - GtkWidget *viewport8; - GtkWidget *viewport9; - GtkWidget *viewport2; - GtkWidget *viewport7; - GtkWidget *viewport5; - GtkWidget *viewport6; - GtkWidget *viewport10; - - GtkWidget *table1; - GtkWidget *table4; - GtkWidget *table5; - GtkWidget *table7; - - GtkWidget *alignment1; - GtkWidget *alignment2; - GtkWidget *alignment3; - - GtkWidget *vbox7; - - GtkWidget *hbox1; - GtkWidget *hbox2; - GtkWidget *hbox3; - GtkWidget *hbox4; - - GtkWidget *image1; - GtkWidget *image2; - GtkWidget *image3; - - GtkWidget *hbuttonbox1; - - SurfaceInspector = gtk_window_new( GTK_WINDOW_TOPLEVEL ); - gtk_container_set_border_width( GTK_CONTAINER( SurfaceInspector ), 4 ); - gtk_window_set_title( GTK_WINDOW( SurfaceInspector ), "Surface Inspector" ); - - SetWinPos_from_Prefs( SurfaceInspector ); - - viewport8 = gtk_viewport_new( NULL, NULL ); - gtk_widget_show( viewport8 ); - gtk_container_add( GTK_CONTAINER( SurfaceInspector ), viewport8 ); - gtk_viewport_set_shadow_type( GTK_VIEWPORT( viewport8 ), GTK_SHADOW_NONE ); - - vbox7 = gtk_vbox_new( FALSE, 0 ); - gtk_widget_show( vbox7 ); - gtk_container_add( GTK_CONTAINER( viewport8 ), vbox7 ); - - viewport9 = gtk_viewport_new( NULL, NULL ); - gtk_widget_show( viewport9 ); - gtk_box_pack_start( GTK_BOX( vbox7 ), viewport9, FALSE, FALSE, 0 ); - gtk_container_set_border_width( GTK_CONTAINER( viewport9 ), 2 ); - gtk_viewport_set_shadow_type( GTK_VIEWPORT( viewport9 ), GTK_SHADOW_ETCHED_IN ); - - hbox1 = gtk_hbox_new( FALSE, 0 ); - gtk_widget_show( hbox1 ); - gtk_container_add( GTK_CONTAINER( viewport9 ), hbox1 ); - gtk_container_set_border_width( GTK_CONTAINER( hbox1 ), 4 ); - - label = gtk_label_new( "Texture: " ); - gtk_widget_show( label ); - gtk_box_pack_start( GTK_BOX( hbox1 ), label, FALSE, FALSE, 0 ); - gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 ); - - texture_combo = gtk_combo_new(); - g_object_set_data( G_OBJECT( GTK_COMBO( texture_combo )->popwin ), - "KeepMeAround", texture_combo ); - gtk_combo_disable_activate( (GtkCombo*) texture_combo ); - gtk_widget_show( texture_combo ); - gtk_box_pack_start( GTK_BOX( hbox1 ), texture_combo, TRUE, TRUE, 0 ); - - texture_combo_entry = GTK_COMBO( texture_combo )->entry; - gtk_widget_show( texture_combo_entry ); - gtk_entry_set_max_length( GTK_ENTRY( texture_combo_entry ), 128 ); - - viewport2 = gtk_viewport_new( NULL, NULL ); - gtk_widget_show( viewport2 ); - gtk_box_pack_start( GTK_BOX( vbox7 ), viewport2, FALSE, TRUE, 0 ); - gtk_container_set_border_width( GTK_CONTAINER( viewport2 ), 2 ); - gtk_viewport_set_shadow_type( GTK_VIEWPORT( viewport2 ), GTK_SHADOW_ETCHED_IN ); - - table1 = gtk_table_new( 13, 4, FALSE ); - gtk_widget_show( table1 ); - gtk_container_add( GTK_CONTAINER( viewport2 ), table1 ); - - hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); - gtk_table_attach( GTK_TABLE( table1 ), hseparator, 1, 2, 1, 2, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); - gtk_table_attach( GTK_TABLE( table1 ), hseparator, 2, 3, 1, 2, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); - gtk_table_attach( GTK_TABLE( table1 ), hseparator, 3, 4, 1, 2, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); - gtk_table_attach( GTK_TABLE( table1 ), hseparator, 1, 2, 3, 4, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); - gtk_table_attach( GTK_TABLE( table1 ), hseparator, 2, 3, 3, 4, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); - gtk_table_attach( GTK_TABLE( table1 ), hseparator, 3, 4, 3, 4, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); - gtk_table_attach( GTK_TABLE( table1 ), hseparator, 1, 2, 5, 6, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); - gtk_table_attach( GTK_TABLE( table1 ), hseparator, 2, 3, 5, 6, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); - gtk_table_attach( GTK_TABLE( table1 ), hseparator, 3, 4, 5, 6, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); - gtk_table_attach( GTK_TABLE( table1 ), hseparator, 1, 2, 7, 8, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); - gtk_table_attach( GTK_TABLE( table1 ), hseparator, 2, 3, 7, 8, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); - gtk_table_attach( GTK_TABLE( table1 ), hseparator, 3, 4, 7, 8, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); - gtk_table_attach( GTK_TABLE( table1 ), hseparator, 1, 2, 9, 10, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); - gtk_table_attach( GTK_TABLE( table1 ), hseparator, 2, 3, 9, 10, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); - gtk_table_attach( GTK_TABLE( table1 ), hseparator, 3, 4, 9, 10, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); - gtk_table_attach( GTK_TABLE( table1 ), hseparator, 1, 2, 11, 12, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); - gtk_table_attach( GTK_TABLE( table1 ), hseparator, 2, 3, 11, 12, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); - gtk_table_attach( GTK_TABLE( table1 ), hseparator, 3, 4, 11, 12, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - label = gtk_label_new( "Offset" ); - gtk_widget_show( label ); - gtk_table_attach( GTK_TABLE( table1 ), label, 2, 3, 0, 1, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); - - label = gtk_label_new( "Step" ); - gtk_widget_show( label ); - gtk_table_attach( GTK_TABLE( table1 ), label, 3, 4, 0, 1, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); - - eventbox = gtk_event_box_new(); - gtk_widget_show( eventbox ); - gtk_table_attach( GTK_TABLE( table1 ), eventbox, 3, 4, 12, 13, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - match_grid_button = gtk_button_new_with_mnemonic( "Match Grid" ); - gtk_widget_show( match_grid_button ); - gtk_container_add( GTK_CONTAINER( eventbox ), match_grid_button ); - - label = gtk_label_new( "Value" ); - gtk_widget_show( label ); - gtk_table_attach( GTK_TABLE( table1 ), label, 1, 2, 0, 1, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_misc_set_alignment( GTK_MISC( label ), 0.5, 1 ); - - hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); - gtk_table_attach( GTK_TABLE( table1 ), hseparator, 0, 1, 3, 4, - (GtkAttachOptions) ( GTK_SHRINK | GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); - gtk_table_attach( GTK_TABLE( table1 ), hseparator, 0, 1, 5, 6, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); - gtk_table_attach( GTK_TABLE( table1 ), hseparator, 0, 1, 7, 8, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); - gtk_table_attach( GTK_TABLE( table1 ), hseparator, 0, 1, 9, 10, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); - gtk_table_attach( GTK_TABLE( table1 ), hseparator, 0, 1, 11, 12, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - eventbox = gtk_event_box_new(); - gtk_widget_show( eventbox ); - gtk_table_attach( GTK_TABLE( table1 ), eventbox, 0, 1, 4, 5, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - label = gtk_label_new( "V Shift: " ); - gtk_widget_show( label ); - gtk_container_add( GTK_CONTAINER( eventbox ), label ); - gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT ); - gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 ); - - eventbox = gtk_event_box_new(); - gtk_widget_show( eventbox ); - gtk_table_attach( GTK_TABLE( table1 ), eventbox, 0, 1, 6, 7, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - label = gtk_label_new( " H Scale: " ); - gtk_widget_show( label ); - gtk_container_add( GTK_CONTAINER( eventbox ), label ); - gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT ); - gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 ); - - eventbox = gtk_event_box_new(); - gtk_widget_show( eventbox ); - gtk_table_attach( GTK_TABLE( table1 ), eventbox, 0, 1, 8, 9, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - label = gtk_label_new( "V Scale: " ); - gtk_widget_show( label ); - gtk_container_add( GTK_CONTAINER( eventbox ), label ); - gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT ); - gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 ); - - eventbox = gtk_event_box_new(); - gtk_widget_show( eventbox ); - gtk_table_attach( GTK_TABLE( table1 ), eventbox, 0, 1, 10, 11, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - label = gtk_label_new( "Rotate: " ); - gtk_widget_show( label ); - gtk_container_add( GTK_CONTAINER( eventbox ), label ); - gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT ); - gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 ); - - eventbox = gtk_event_box_new(); - gtk_widget_show( eventbox ); - gtk_table_attach( GTK_TABLE( table1 ), eventbox, 0, 1, 2, 3, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - label = gtk_label_new( "H Shift: " ); - gtk_widget_show( label ); - gtk_container_add( GTK_CONTAINER( eventbox ), label ); - gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT ); - gtk_misc_set_alignment( GTK_MISC( label ), 1, 0.5 ); - - hseparator = gtk_hseparator_new(); - gtk_widget_show( hseparator ); - gtk_table_attach( GTK_TABLE( table1 ), hseparator, 0, 1, 1, 2, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - eventbox = gtk_event_box_new(); - gtk_widget_show( eventbox ); - gtk_table_attach( GTK_TABLE( table1 ), eventbox, 1, 2, 12, 13, - (GtkAttachOptions) ( GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - lock_valuechange_togglebutton = gtk_toggle_button_new_with_mnemonic( "UNLOCK" ); - gtk_widget_show( lock_valuechange_togglebutton ); - gtk_container_add( GTK_CONTAINER( eventbox ), lock_valuechange_togglebutton ); - - // Value Spins - hshift_value_spinbutton_adj = gtk_adjustment_new( 0.0, -8192.0, 8192.0, 2.0, 8.0, 8.0 ); - hshift_value_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( hshift_value_spinbutton_adj ), 1, 2 ); - gtk_widget_show( hshift_value_spinbutton ); - gtk_table_attach( GTK_TABLE( table1 ), hshift_value_spinbutton, 1, 2, 2, 3, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( hshift_value_spinbutton ), GTK_UPDATE_IF_VALID ); - gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( hshift_value_spinbutton ), TRUE ); - gtk_widget_set_sensitive( GTK_WIDGET( hshift_value_spinbutton ), FALSE ); - - vshift_value_spinbutton_adj = gtk_adjustment_new( 0.0, -8192.0, 8192.0, 2.0, 8.0, 8.0 ); - vshift_value_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( vshift_value_spinbutton_adj ), 1, 2 ); - gtk_widget_show( vshift_value_spinbutton ); - gtk_table_attach( GTK_TABLE( table1 ), vshift_value_spinbutton, 1, 2, 4, 5, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( vshift_value_spinbutton ), GTK_UPDATE_IF_VALID ); - gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( vshift_value_spinbutton ), TRUE ); - gtk_widget_set_sensitive( GTK_WIDGET( vshift_value_spinbutton ), FALSE ); - - hscale_value_spinbutton_adj = gtk_adjustment_new( 0.0, -1024.0, 1024.0, 1.0, 4.0, 4.0 ); - hscale_value_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( hscale_value_spinbutton_adj ), 1, 4 ); - gtk_widget_show( hscale_value_spinbutton ); - gtk_table_attach( GTK_TABLE( table1 ), hscale_value_spinbutton, 1, 2, 6, 7, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( hscale_value_spinbutton ), GTK_UPDATE_IF_VALID ); - gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( hscale_value_spinbutton ), TRUE ); - gtk_widget_set_sensitive( GTK_WIDGET( hscale_value_spinbutton ), FALSE ); - - vscale_value_spinbutton_adj = gtk_adjustment_new( 0.0, -1024.0, 1024.0, 1.0, 4.0, 4.0 ); - vscale_value_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( vscale_value_spinbutton_adj ), 1, 4 ); - gtk_widget_show( vscale_value_spinbutton ); - gtk_table_attach( GTK_TABLE( table1 ), vscale_value_spinbutton, 1, 2, 8, 9, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( vscale_value_spinbutton ), GTK_UPDATE_IF_VALID ); - gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( vscale_value_spinbutton ), TRUE ); - gtk_widget_set_sensitive( GTK_WIDGET( vscale_value_spinbutton ), FALSE ); - - rotate_value_spinbutton_adj = gtk_adjustment_new( 0.0, -360.0, 360.0, 1.0, 10.0, 10.0 ); - rotate_value_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( rotate_value_spinbutton_adj ), 1, 0 ); - gtk_widget_show( rotate_value_spinbutton ); - gtk_table_attach( GTK_TABLE( table1 ), rotate_value_spinbutton, 1, 2, 10, 11, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( rotate_value_spinbutton ), GTK_UPDATE_IF_VALID ); - gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( rotate_value_spinbutton ), TRUE ); - gtk_widget_set_sensitive( GTK_WIDGET( rotate_value_spinbutton ), FALSE ); - - // Offset Spins - hshift_offset_spinbutton_adj = gtk_adjustment_new( 0.0, -8192.0, 8192.0, 2.0, 8.0, 8.0 ); - hshift_offset_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( hshift_offset_spinbutton_adj ), 0, 2 ); - gtk_widget_show( hshift_offset_spinbutton ); - gtk_table_attach( GTK_TABLE( table1 ), hshift_offset_spinbutton, 2, 3, 2, 3, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 4, 0 ); - gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( hshift_offset_spinbutton ), TRUE ); - gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( hshift_offset_spinbutton ), GTK_UPDATE_IF_VALID ); - gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( hshift_offset_spinbutton ), TRUE ); - - vshift_offset_spinbutton_adj = gtk_adjustment_new( 0.0, -8192.0, 8192.0, 2.0, 8.0, 8.0 ); - vshift_offset_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( vshift_offset_spinbutton_adj ), 0, 2 ); - gtk_widget_show( vshift_offset_spinbutton ); - gtk_table_attach( GTK_TABLE( table1 ), vshift_offset_spinbutton, 2, 3, 4, 5, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 4, 0 ); - gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( vshift_offset_spinbutton ), TRUE ); - gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( vshift_offset_spinbutton ), GTK_UPDATE_IF_VALID ); - gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( vshift_offset_spinbutton ), TRUE ); - - hscale_offset_spinbutton_adj = gtk_adjustment_new( 0.0, -1024.0, 1024.0, 1.0, 4.0, 4.0 ); - hscale_offset_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( hscale_offset_spinbutton_adj ), 0, 4 ); - gtk_widget_show( hscale_offset_spinbutton ); - gtk_table_attach( GTK_TABLE( table1 ), hscale_offset_spinbutton, 2, 3, 6, 7, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 4, 0 ); - gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( hscale_offset_spinbutton ), TRUE ); - gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( hscale_offset_spinbutton ), GTK_UPDATE_IF_VALID ); - gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( hscale_offset_spinbutton ), TRUE ); - - vscale_offset_spinbutton_adj = gtk_adjustment_new( 0.0, -1024.0, 1024.0, 1.0, 4.0, 4.0 ); - vscale_offset_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( vscale_offset_spinbutton_adj ), 0, 4 ); - gtk_widget_show( vscale_offset_spinbutton ); - gtk_table_attach( GTK_TABLE( table1 ), vscale_offset_spinbutton, 2, 3, 8, 9, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 4, 0 ); - gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( vscale_offset_spinbutton ), TRUE ); - gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( vscale_offset_spinbutton ), GTK_UPDATE_IF_VALID ); - gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( vscale_offset_spinbutton ), TRUE ); - - rotate_offset_spinbutton_adj = gtk_adjustment_new( 0.0, -360.0, 360.0, 1.0, 10.0, 10.0 ); - rotate_offset_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( rotate_offset_spinbutton_adj ), 0, 2 ); - gtk_widget_show( rotate_offset_spinbutton ); - gtk_table_attach( GTK_TABLE( table1 ), rotate_offset_spinbutton, 2, 3, 10, 11, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 4, 0 ); - gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( rotate_offset_spinbutton ), TRUE ); - gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( rotate_offset_spinbutton ), GTK_UPDATE_IF_VALID ); - gtk_spin_button_set_wrap( GTK_SPIN_BUTTON( rotate_offset_spinbutton ), TRUE ); - - // Step Spins - hshift_step_spinbutton_adj = gtk_adjustment_new( 0.0, -8192.0, 8192.0, 2.0, 8.0, 8.0 ); - hshift_step_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( hshift_step_spinbutton_adj ), 1, 2 ); - gtk_widget_show( hshift_step_spinbutton ); - gtk_table_attach( GTK_TABLE( table1 ), hshift_step_spinbutton, 3, 4, 2, 3, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( hshift_step_spinbutton ), GTK_UPDATE_IF_VALID ); - - vshift_step_spinbutton_adj = gtk_adjustment_new( 0.0, -8192.0, 8192.0, 2.0, 8.0, 8.0 ); - vshift_step_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( vshift_step_spinbutton_adj ), 1, 2 ); - gtk_widget_show( vshift_step_spinbutton ); - gtk_table_attach( GTK_TABLE( table1 ), vshift_step_spinbutton, 3, 4, 4, 5, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( vshift_step_spinbutton ), GTK_UPDATE_IF_VALID ); - - hscale_step_spinbutton_adj = gtk_adjustment_new( 0.0, -1024.0, 1024.0, 1.0, 4.0, 4.0 ); - hscale_step_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( hscale_step_spinbutton_adj ), 1, 4 ); - gtk_widget_show( hscale_step_spinbutton ); - gtk_table_attach( GTK_TABLE( table1 ), hscale_step_spinbutton, 3, 4, 6, 7, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( hscale_step_spinbutton ), GTK_UPDATE_IF_VALID ); - - vscale_step_spinbutton_adj = gtk_adjustment_new( 0.0, -1024.0, 1024.0, 1.0, 4.0, 4.0 ); - vscale_step_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( vscale_step_spinbutton_adj ), 1, 4 ); - gtk_widget_show( vscale_step_spinbutton ); - gtk_table_attach( GTK_TABLE( table1 ), vscale_step_spinbutton, 3, 4, 8, 9, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( vscale_step_spinbutton ), GTK_UPDATE_IF_VALID ); - - rotate_step_spinbutton_adj = gtk_adjustment_new( 0.0, -360.0, 360.0, 1.0, 10.0, 10.0 ); - rotate_step_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( rotate_step_spinbutton_adj ), 1, 2 ); - gtk_widget_show( rotate_step_spinbutton ); - gtk_table_attach( GTK_TABLE( table1 ), rotate_step_spinbutton, 3, 4, 10, 11, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( rotate_step_spinbutton ), GTK_UPDATE_IF_VALID ); - - eventbox = gtk_event_box_new(); - gtk_widget_show( eventbox ); - gtk_table_attach( GTK_TABLE( table1 ), eventbox, 2, 3, 12, 13, - (GtkAttachOptions) ( 0 ), - (GtkAttachOptions) ( 0 ), 0, 0 ); - - eventbox = gtk_event_box_new(); - gtk_widget_show( eventbox ); - gtk_table_attach( GTK_TABLE( table1 ), eventbox, 0, 1, 12, 13, - (GtkAttachOptions) ( 0 ), - (GtkAttachOptions) ( 0 ), 0, 0 ); - - eventbox = gtk_event_box_new(); - gtk_widget_show( eventbox ); - gtk_table_attach( GTK_TABLE( table1 ), eventbox, 0, 1, 0, 1, - (GtkAttachOptions) ( 0 ), - (GtkAttachOptions) ( 0 ), 0, 0 ); - - viewport7 = gtk_viewport_new( NULL, NULL ); - gtk_widget_show( viewport7 ); - gtk_box_pack_start( GTK_BOX( vbox7 ), viewport7, FALSE, TRUE, 0 ); - gtk_container_set_border_width( GTK_CONTAINER( viewport7 ), 2 ); - gtk_viewport_set_shadow_type( GTK_VIEWPORT( viewport7 ), GTK_SHADOW_ETCHED_IN ); - - table4 = gtk_table_new( 4, 7, FALSE ); - gtk_widget_show( table4 ); - gtk_container_add( GTK_CONTAINER( viewport7 ), table4 ); - - viewport5 = gtk_viewport_new( NULL, NULL ); - gtk_widget_show( viewport5 ); - gtk_table_attach( GTK_TABLE( table4 ), viewport5, 1, 7, 0, 4, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_container_set_border_width( GTK_CONTAINER( viewport5 ), 6 ); - gtk_viewport_set_shadow_type( GTK_VIEWPORT( viewport5 ), GTK_SHADOW_ETCHED_OUT ); - - table5 = gtk_table_new( 2, 3, FALSE ); - gtk_widget_show( table5 ); - gtk_container_add( GTK_CONTAINER( viewport5 ), table5 ); - gtk_container_set_border_width( GTK_CONTAINER( table5 ), 5 ); - gtk_table_set_col_spacings( GTK_TABLE( table5 ), 2 ); - - label = gtk_label_new( "Height" ); - gtk_widget_show( label ); - gtk_table_attach( GTK_TABLE( table5 ), label, 2, 3, 0, 1, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT ); - gtk_misc_set_alignment( GTK_MISC( label ), 0.5, 1 ); - - label = gtk_label_new( "Width" ); - gtk_widget_show( label ); - gtk_table_attach( GTK_TABLE( table5 ), label, 1, 2, 0, 1, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT ); - gtk_misc_set_alignment( GTK_MISC( label ), 0.5, 1 ); - - fit_width_spinbutton_adj = gtk_adjustment_new( 1, 1, 32, 1, 10, 10 ); - fit_width_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( fit_width_spinbutton_adj ), 1, 0 ); - gtk_widget_show( fit_width_spinbutton ); - gtk_table_attach( GTK_TABLE( table5 ), fit_width_spinbutton, 1, 2, 1, 2, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( fit_width_spinbutton ), TRUE ); - gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( fit_width_spinbutton ), GTK_UPDATE_IF_VALID ); - - fit_height_spinbutton_adj = gtk_adjustment_new( 1, 1, 32, 1, 10, 10 ); - fit_height_spinbutton = gtk_spin_button_new( GTK_ADJUSTMENT( fit_height_spinbutton_adj ), 1, 0 ); - gtk_widget_show( fit_height_spinbutton ); - gtk_table_attach( GTK_TABLE( table5 ), fit_height_spinbutton, 2, 3, 1, 2, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 3, 0 ); - gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( fit_height_spinbutton ), TRUE ); - gtk_spin_button_set_update_policy( GTK_SPIN_BUTTON( fit_height_spinbutton ), GTK_UPDATE_IF_VALID ); - - eventbox = gtk_event_box_new(); - gtk_widget_show( eventbox ); - gtk_table_attach( GTK_TABLE( table5 ), eventbox, 0, 1, 0, 1, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 0, 0 ); - - eventbox = gtk_event_box_new(); - gtk_widget_show( eventbox ); - gtk_table_attach( GTK_TABLE( table5 ), eventbox, 0, 1, 1, 2, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_FILL ), 4, 0 ); - - fit_button = gtk_button_new_with_mnemonic( " Fit " ); - gtk_widget_show( fit_button ); - gtk_container_add( GTK_CONTAINER( eventbox ), fit_button ); - - viewport6 = gtk_viewport_new( NULL, NULL ); - gtk_widget_show( viewport6 ); - gtk_table_attach( GTK_TABLE( table4 ), viewport6, 0, 1, 0, 4, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( 0 ), 0, 0 ); - gtk_container_set_border_width( GTK_CONTAINER( viewport6 ), 4 ); - gtk_viewport_set_shadow_type( GTK_VIEWPORT( viewport6 ), GTK_SHADOW_NONE ); - - table7 = gtk_table_new( 2, 1, FALSE ); - gtk_widget_show( table7 ); - gtk_container_add( GTK_CONTAINER( viewport6 ), table7 ); - - eventbox = gtk_event_box_new(); - gtk_widget_show( eventbox ); - gtk_table_attach( GTK_TABLE( table7 ), eventbox, 0, 1, 0, 2, - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), - (GtkAttachOptions) ( GTK_EXPAND | GTK_FILL ), 0, 0 ); - - axial_button = gtk_button_new_with_mnemonic( "Axial" ); - gtk_widget_show( axial_button ); - gtk_container_add( GTK_CONTAINER( eventbox ), axial_button ); - gtk_widget_set_size_request( axial_button, 56, 29 ); - gtk_container_set_border_width( GTK_CONTAINER( axial_button ), 4 ); - - // Fit in Flags sub-dialog - Create_UFOAIFlagsDialog( vbox7 ); - - viewport10 = gtk_viewport_new( NULL, NULL ); - gtk_widget_show( viewport10 ); - gtk_box_pack_start( GTK_BOX( vbox7 ), viewport10, FALSE, TRUE, 0 ); - gtk_container_set_border_width( GTK_CONTAINER( viewport10 ), 2 ); - gtk_viewport_set_shadow_type( GTK_VIEWPORT( viewport10 ), GTK_SHADOW_ETCHED_IN ); - - hbuttonbox1 = gtk_hbutton_box_new(); - gtk_widget_show( hbuttonbox1 ); - gtk_container_add( GTK_CONTAINER( viewport10 ), hbuttonbox1 ); - gtk_container_set_border_width( GTK_CONTAINER( hbuttonbox1 ), 4 ); - gtk_button_box_set_layout( GTK_BUTTON_BOX( hbuttonbox1 ), GTK_BUTTONBOX_SPREAD ); - - done_button = gtk_button_new(); - gtk_widget_show( done_button ); - gtk_container_add( GTK_CONTAINER( hbuttonbox1 ), done_button ); - GTK_WIDGET_SET_FLAGS( done_button, GTK_CAN_DEFAULT ); - - alignment1 = gtk_alignment_new( 0.5, 0.5, 0, 0 ); - gtk_widget_show( alignment1 ); - gtk_container_add( GTK_CONTAINER( done_button ), alignment1 ); - - hbox2 = gtk_hbox_new( FALSE, 2 ); - gtk_widget_show( hbox2 ); - gtk_container_add( GTK_CONTAINER( alignment1 ), hbox2 ); - - image1 = gtk_image_new_from_stock( "gtk-yes", GTK_ICON_SIZE_BUTTON ); - gtk_widget_show( image1 ); - gtk_box_pack_start( GTK_BOX( hbox2 ), image1, FALSE, FALSE, 0 ); - - label = gtk_label_new_with_mnemonic( "Done" ); - gtk_widget_show( label ); - gtk_box_pack_start( GTK_BOX( hbox2 ), label, FALSE, FALSE, 0 ); - gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT ); - - apply_button = gtk_button_new(); - gtk_widget_show( apply_button ); - gtk_container_add( GTK_CONTAINER( hbuttonbox1 ), apply_button ); - GTK_WIDGET_SET_FLAGS( apply_button, GTK_CAN_DEFAULT ); - - alignment3 = gtk_alignment_new( 0.5, 0.5, 0, 0 ); - gtk_widget_show( alignment3 ); - gtk_container_add( GTK_CONTAINER( apply_button ), alignment3 ); - - hbox4 = gtk_hbox_new( FALSE, 2 ); - gtk_widget_show( hbox4 ); - gtk_container_add( GTK_CONTAINER( alignment3 ), hbox4 ); - - image3 = gtk_image_new_from_stock( "gtk-apply", GTK_ICON_SIZE_BUTTON ); - gtk_widget_show( image3 ); - gtk_box_pack_start( GTK_BOX( hbox4 ), image3, FALSE, FALSE, 0 ); - - label = gtk_label_new_with_mnemonic( "Apply" ); - gtk_widget_show( label ); - gtk_box_pack_start( GTK_BOX( hbox4 ), label, FALSE, FALSE, 0 ); - gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT ); - - cancel_button = gtk_button_new(); - gtk_widget_show( cancel_button ); - gtk_container_add( GTK_CONTAINER( hbuttonbox1 ), cancel_button ); - GTK_WIDGET_SET_FLAGS( cancel_button, GTK_CAN_DEFAULT ); - - alignment2 = gtk_alignment_new( 0.5, 0.5, 0, 0 ); - gtk_widget_show( alignment2 ); - gtk_container_add( GTK_CONTAINER( cancel_button ), alignment2 ); - - hbox3 = gtk_hbox_new( FALSE, 2 ); - gtk_widget_show( hbox3 ); - gtk_container_add( GTK_CONTAINER( alignment2 ), hbox3 ); - - image2 = gtk_image_new_from_stock( "gtk-no", GTK_ICON_SIZE_BUTTON ); - gtk_widget_show( image2 ); - gtk_box_pack_start( GTK_BOX( hbox3 ), image2, FALSE, FALSE, 0 ); - - label = gtk_label_new_with_mnemonic( "Cancel" ); - gtk_widget_show( label ); - gtk_box_pack_start( GTK_BOX( hbox3 ), label, FALSE, FALSE, 0 ); - gtk_label_set_justify( GTK_LABEL( label ), GTK_JUSTIFY_LEFT ); - - - g_signal_connect( (gpointer) SurfaceInspector, - "delete_event", - G_CALLBACK( delete_event_callback ), - NULL ); - g_signal_connect( (gpointer) SurfaceInspector, "destroy", - G_CALLBACK( gtk_widget_destroy ), - NULL ); - - g_signal_connect( (gpointer) texture_combo_entry, "key_press_event", - G_CALLBACK( on_texture_combo_entry_key_press_event ), - NULL ); - g_signal_connect( (gpointer) texture_combo_entry, "activate", - G_CALLBACK( on_texture_combo_entry_activate ), - NULL ); - - - g_signal_connect( (gpointer) hshift_offset_spinbutton, "value_changed", - G_CALLBACK( on_hshift_offset_spinbutton_value_changed ), - NULL ); - g_signal_connect( (gpointer) vshift_offset_spinbutton, "value_changed", - G_CALLBACK( on_vshift_offset_spinbutton_value_changed ), - NULL ); - g_signal_connect( (gpointer) hscale_offset_spinbutton, "value_changed", - G_CALLBACK( on_hscale_offset_spinbutton_value_changed ), - NULL ); - g_signal_connect( (gpointer) vscale_offset_spinbutton, "value_changed", - G_CALLBACK( on_vscale_offset_spinbutton_value_changed ), - NULL ); - g_signal_connect( (gpointer) rotate_offset_spinbutton, "value_changed", - G_CALLBACK( on_rotate_offset_spinbutton_value_changed ), - NULL ); - - g_signal_connect( (gpointer) hshift_value_spinbutton, "value_changed", - G_CALLBACK( on_hshift_value_spinbutton_value_changed ), - NULL ); - g_signal_connect( (gpointer) vshift_value_spinbutton, "value_changed", - G_CALLBACK( on_vshift_value_spinbutton_value_changed ), - NULL ); - g_signal_connect( (gpointer) hscale_value_spinbutton, "value_changed", - G_CALLBACK( on_hscale_value_spinbutton_value_changed ), - NULL ); - g_signal_connect( (gpointer) vscale_value_spinbutton, "value_changed", - G_CALLBACK( on_vscale_value_spinbutton_value_changed ), - NULL ); - g_signal_connect( (gpointer) rotate_value_spinbutton, "value_changed", - G_CALLBACK( on_rotate_value_spinbutton_value_changed ), - NULL ); - - g_signal_connect( (gpointer) hshift_step_spinbutton, "value_changed", - G_CALLBACK( on_hshift_step_spinbutton_value_changed ), - NULL ); - g_signal_connect( (gpointer) vshift_step_spinbutton, "value_changed", - G_CALLBACK( on_vshift_step_spinbutton_value_changed ), - NULL ); - g_signal_connect( (gpointer) hscale_step_spinbutton, "value_changed", - G_CALLBACK( on_hscale_step_spinbutton_value_changed ), - NULL ); - g_signal_connect( (gpointer) vscale_step_spinbutton, "value_changed", - G_CALLBACK( on_vscale_step_spinbutton_value_changed ), - NULL ); - g_signal_connect( (gpointer) rotate_step_spinbutton, "value_changed", - G_CALLBACK( on_rotate_step_spinbutton_value_changed ), - NULL ); - - g_signal_connect( (gpointer) match_grid_button, "clicked", - G_CALLBACK( on_match_grid_button_clicked ), - NULL ); - g_signal_connect( (gpointer) lock_valuechange_togglebutton, "toggled", - G_CALLBACK( on_lock_valuechange_togglebutton_toggled ), - NULL ); - - g_signal_connect( (gpointer) fit_width_spinbutton, "value_changed", - G_CALLBACK( on_fit_width_spinbutton_value_changed ), - NULL ); - g_signal_connect( (gpointer) fit_height_spinbutton, "value_changed", - G_CALLBACK( on_fit_height_spinbutton_value_changed ), - NULL ); - g_signal_connect( (gpointer) fit_button, "clicked", - G_CALLBACK( on_fit_button_clicked ), - NULL ); - - g_signal_connect( (gpointer) axial_button, "clicked", - G_CALLBACK( on_axial_button_clicked ), - NULL ); - - g_signal_connect( (gpointer) done_button, "clicked", - G_CALLBACK( on_done_button_clicked ), - NULL ); - g_signal_connect( (gpointer) apply_button, "clicked", - G_CALLBACK( on_apply_button_clicked ), - NULL ); - g_signal_connect( (gpointer) cancel_button, "clicked", - G_CALLBACK( on_cancel_button_clicked ), - NULL ); - - - return SurfaceInspector; -} - - -// Texture Combo -gboolean on_texture_combo_entry_key_press_event( GtkWidget *widget, GdkEventKey *event, - gpointer user_data ){ - // Have Tab activate selection as well as Return - if ( event->keyval == GDK_Tab ) { - g_signal_emit_by_name( texture_combo_entry, "activate" ); - } - - return FALSE; -} - -void on_texture_combo_entry_activate( GtkEntry *entry, gpointer user_data ){ - texdef_t* tmp_texdef; - texdef_t* tmp_orig_texdef; - texdef_to_face_t* temp_texdef_face_list; - char text[128] = { 0 }; - - if ( !texdef_face_list_empty() && g_bListenChanged ) { - // activate only on entry change - strcpy( text, gtk_entry_get_text( entry ) ); - if ( strcmp( old_texture_entry, text ) ) { - // Check for spaces in shader name - if ( text[0] <= ' ' || strchr( text, ' ' ) ) { - Sys_FPrintf( SYS_WRN, "WARNING: spaces in shader names are not allowed, ignoring '%s'\n", text ); - } - else - { - for ( temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next ) - { - tmp_texdef = (texdef_t *) &temp_texdef_face_list->texdef; - tmp_orig_texdef = (texdef_t *) &temp_texdef_face_list->orig_texdef; - strcpy( old_texture_entry, text ); - tmp_texdef->SetName( text ); - } - GetTexMods(); - } - } - } -} - -// Offset Spins -static void on_hshift_offset_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){ - texdef_t* tmp_texdef; - texdef_t* tmp_orig_texdef; - texdef_to_face_t* temp_texdef_face_list; - - texdef_offset.shift[0] = gtk_spin_button_get_value( GTK_SPIN_BUTTON( hshift_offset_spinbutton ) ); - - if ( !texdef_face_list_empty() && g_bListenChanged ) { - for ( temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next ) - { - tmp_texdef = (texdef_t *) &temp_texdef_face_list->texdef; - tmp_orig_texdef = (texdef_t *) &temp_texdef_face_list->orig_texdef; - if ( is_HShift_conflicting ) { - tmp_texdef->shift[0] = tmp_orig_texdef->shift[0] + texdef_offset.shift[0]; - } - else{ - tmp_texdef->shift[0] = texdef_SI_values.shift[0] + texdef_offset.shift[0]; - } - } - GetTexMods(); - } -} - -static void on_vshift_offset_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){ - texdef_t* tmp_texdef; - texdef_t* tmp_orig_texdef; - texdef_to_face_t* temp_texdef_face_list; - - texdef_offset.shift[1] = gtk_spin_button_get_value( GTK_SPIN_BUTTON( vshift_offset_spinbutton ) ); - - if ( !texdef_face_list_empty() && g_bListenChanged ) { - for ( temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next ) - { - tmp_texdef = (texdef_t *) &temp_texdef_face_list->texdef; - tmp_orig_texdef = (texdef_t *) &temp_texdef_face_list->orig_texdef; - if ( is_VShift_conflicting ) { - tmp_texdef->shift[1] = tmp_orig_texdef->shift[1] + texdef_offset.shift[1]; - } - else{ - tmp_texdef->shift[1] = texdef_SI_values.shift[1] + texdef_offset.shift[1]; - } - } - GetTexMods(); - } - -} - -static void on_hscale_offset_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){ - texdef_t* tmp_texdef; - texdef_t* tmp_orig_texdef; - texdef_to_face_t* temp_texdef_face_list; - - texdef_offset.scale[0] = gtk_spin_button_get_value( GTK_SPIN_BUTTON( hscale_offset_spinbutton ) ); - - if ( !texdef_face_list_empty() && g_bListenChanged ) { - for ( temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next ) - { - tmp_texdef = (texdef_t *) &temp_texdef_face_list->texdef; - tmp_orig_texdef = (texdef_t *) &temp_texdef_face_list->orig_texdef; - if ( is_HScale_conflicting ) { - tmp_texdef->scale[0] = tmp_orig_texdef->scale[0] + texdef_offset.scale[0]; - } - else{ - tmp_texdef->scale[0] = texdef_SI_values.scale[0] + texdef_offset.scale[0]; - } - } - GetTexMods(); - } - - -} - -static void on_vscale_offset_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){ - texdef_t* tmp_texdef; - texdef_t* tmp_orig_texdef; - texdef_to_face_t* temp_texdef_face_list; - - texdef_offset.scale[1] = gtk_spin_button_get_value( GTK_SPIN_BUTTON( vscale_offset_spinbutton ) ); - - if ( !texdef_face_list_empty() && g_bListenChanged ) { - for ( temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next ) - { - tmp_texdef = (texdef_t *) &temp_texdef_face_list->texdef; - tmp_orig_texdef = (texdef_t *) &temp_texdef_face_list->orig_texdef; - if ( is_VScale_conflicting ) { - tmp_texdef->scale[1] = tmp_orig_texdef->scale[1] + texdef_offset.scale[1]; - } - else{ - tmp_texdef->scale[1] = texdef_SI_values.scale[1] + texdef_offset.scale[1]; - } - } - GetTexMods(); - } - -} - -static void on_rotate_offset_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){ - texdef_t* tmp_texdef; - texdef_t* tmp_orig_texdef; - texdef_to_face_t* temp_texdef_face_list; - - texdef_offset.rotate = gtk_spin_button_get_value( GTK_SPIN_BUTTON( rotate_offset_spinbutton ) ); - - if ( !texdef_face_list_empty() && g_bListenChanged ) { - for ( temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next ) - { - tmp_texdef = (texdef_t *) &temp_texdef_face_list->texdef; - tmp_orig_texdef = (texdef_t *) &temp_texdef_face_list->orig_texdef; - if ( is_Rotate_conflicting ) { - tmp_texdef->rotate = tmp_orig_texdef->rotate + texdef_offset.rotate; - } - else{ - tmp_texdef->rotate = texdef_SI_values.rotate + texdef_offset.rotate; - } - } - GetTexMods(); - } - -} - - -// Match Grid -static void on_match_grid_button_clicked( GtkButton *button, gpointer user_data ){ - float hscale, vscale; - - if ( !strcmp( gtk_entry_get_text( GTK_ENTRY( hscale_value_spinbutton ) ), "" ) ) { - hscale = 0.0; - } - else{ - hscale = gtk_spin_button_get_value( GTK_SPIN_BUTTON( hscale_value_spinbutton ) ); - } - - if ( !strcmp( gtk_entry_get_text( GTK_ENTRY( vscale_value_spinbutton ) ), "" ) ) { - vscale = 0.0; - } - else{ - vscale = gtk_spin_button_get_value( GTK_SPIN_BUTTON( vscale_value_spinbutton ) ); - } - DoSnapTToGrid( hscale, vscale ); -} - - -// Lock out changes to Value -static void on_lock_valuechange_togglebutton_toggled( GtkToggleButton *togglebutton, gpointer user_data ){ - bool is_Locked; - - is_Locked = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( lock_valuechange_togglebutton ) ); - - gtk_widget_set_sensitive( GTK_WIDGET( hscale_value_spinbutton ), is_Locked ); - gtk_widget_set_sensitive( GTK_WIDGET( vscale_value_spinbutton ), is_Locked ); - gtk_widget_set_sensitive( GTK_WIDGET( hshift_value_spinbutton ), is_Locked ); - gtk_widget_set_sensitive( GTK_WIDGET( vshift_value_spinbutton ), is_Locked ); - gtk_widget_set_sensitive( GTK_WIDGET( rotate_value_spinbutton ), is_Locked ); -} - - -// Value Spins -static void on_hshift_value_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){ - texdef_t* tmp_texdef; - texdef_t* tmp_orig_texdef; - texdef_to_face_t* temp_texdef_face_list; - - texdef_SI_values.shift[0] = gtk_spin_button_get_value( GTK_SPIN_BUTTON( hshift_value_spinbutton ) ); - - if ( !texdef_face_list_empty() && g_bListenChanged ) { - for ( temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next ) - { - tmp_texdef = (texdef_t *) &temp_texdef_face_list->texdef; - tmp_orig_texdef = (texdef_t *) &temp_texdef_face_list->orig_texdef; - tmp_texdef->shift[0] = texdef_SI_values.shift[0] + texdef_offset.shift[0]; - is_HShift_conflicting = FALSE; - } - GetTexMods(); - } -} - -static void on_vshift_value_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){ - texdef_t* tmp_texdef; - texdef_t* tmp_orig_texdef; - texdef_to_face_t* temp_texdef_face_list; - - texdef_SI_values.shift[1] = gtk_spin_button_get_value( GTK_SPIN_BUTTON( vshift_value_spinbutton ) ); - - if ( !texdef_face_list_empty() && g_bListenChanged ) { - for ( temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next ) - { - tmp_texdef = (texdef_t *) &temp_texdef_face_list->texdef; - tmp_orig_texdef = (texdef_t *) &temp_texdef_face_list->orig_texdef; - tmp_texdef->shift[1] = texdef_SI_values.shift[1] + texdef_offset.shift[1]; - is_VShift_conflicting = FALSE; - } - GetTexMods(); - } -} - -static void on_hscale_value_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){ - texdef_t* tmp_texdef; - texdef_t* tmp_orig_texdef; - texdef_to_face_t* temp_texdef_face_list; - - texdef_SI_values.scale[0] = gtk_spin_button_get_value( GTK_SPIN_BUTTON( hscale_value_spinbutton ) ); - - if ( !texdef_face_list_empty() && g_bListenChanged ) { - for ( temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next ) - { - tmp_texdef = (texdef_t *) &temp_texdef_face_list->texdef; - tmp_orig_texdef = (texdef_t *) &temp_texdef_face_list->orig_texdef; - tmp_texdef->scale[0] = texdef_SI_values.scale[0] + texdef_offset.scale[0]; - is_HScale_conflicting = FALSE; - } - GetTexMods(); - } -} - -static void on_vscale_value_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){ - texdef_t* tmp_texdef; - texdef_t* tmp_orig_texdef; - texdef_to_face_t* temp_texdef_face_list; - - texdef_SI_values.scale[1] = gtk_spin_button_get_value( GTK_SPIN_BUTTON( vscale_value_spinbutton ) ); - - if ( !texdef_face_list_empty() && g_bListenChanged ) { - for ( temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next ) - { - tmp_texdef = (texdef_t *) &temp_texdef_face_list->texdef; - tmp_orig_texdef = (texdef_t *) &temp_texdef_face_list->orig_texdef; - tmp_texdef->scale[1] = texdef_SI_values.scale[1] + texdef_offset.scale[1]; - is_VScale_conflicting = FALSE; - } - GetTexMods(); - } -} - -static void on_rotate_value_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){ - texdef_t* tmp_texdef; - texdef_t* tmp_orig_texdef; - texdef_to_face_t* temp_texdef_face_list; - - texdef_SI_values.rotate = gtk_spin_button_get_value( GTK_SPIN_BUTTON( rotate_value_spinbutton ) ); - - if ( !texdef_face_list_empty() && g_bListenChanged ) { - for ( temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next ) - { - tmp_texdef = (texdef_t *) &temp_texdef_face_list->texdef; - tmp_orig_texdef = (texdef_t *) &temp_texdef_face_list->orig_texdef; - tmp_texdef->rotate = texdef_SI_values.rotate + texdef_offset.rotate; - is_Rotate_conflicting = FALSE; - } - GetTexMods(); - } -} - - -// Step Spins -static void on_hshift_step_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){ - gfloat val; - GtkAdjustment * adjust; - - if ( !g_bListenChanged ) { - return; - } - - l_pIncrement = Get_SI_Inc(); - -#ifdef DBG_SI - Sys_Printf( "OnIncrementChanged HShift\n" ); -#endif - - val = gtk_spin_button_get_value( GTK_SPIN_BUTTON( hshift_step_spinbutton ) ) ; - adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( hshift_offset_spinbutton ) ); - adjust->step_increment = val; - adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( hshift_value_spinbutton ) ); - adjust->step_increment = val; - l_pIncrement->shift[0] = val; -} - -static void on_vshift_step_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){ - gfloat val; - GtkAdjustment * adjust; - - if ( !g_bListenChanged ) { - return; - } - - l_pIncrement = Get_SI_Inc(); - -#ifdef DBG_SI - Sys_Printf( "OnIncrementChanged VShift\n" ); -#endif - - val = gtk_spin_button_get_value( GTK_SPIN_BUTTON( vshift_step_spinbutton ) ) ; - adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( vshift_offset_spinbutton ) ); - adjust->step_increment = val; - adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( vshift_value_spinbutton ) ); - adjust->step_increment = val; - l_pIncrement->shift[1] = val; -} - -static void on_hscale_step_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){ - gfloat val; - GtkAdjustment * adjust; - - if ( !g_bListenChanged ) { - return; - } - - l_pIncrement = Get_SI_Inc(); - -#ifdef DBG_SI - Sys_Printf( "OnIncrementChanged HShift\n" ); -#endif - - val = gtk_spin_button_get_value( GTK_SPIN_BUTTON( hscale_step_spinbutton ) ) ; - adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( hscale_offset_spinbutton ) ); - adjust->step_increment = val; - adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( hscale_value_spinbutton ) ); - adjust->step_increment = val; - l_pIncrement->scale[0] = val; -} - -static void on_vscale_step_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){ - gfloat val; - GtkAdjustment * adjust; - - if ( !g_bListenChanged ) { - return; - } - - l_pIncrement = Get_SI_Inc(); - -#ifdef DBG_SI - Sys_Printf( "OnIncrementChanged HShift\n" ); -#endif - - val = gtk_spin_button_get_value( GTK_SPIN_BUTTON( vscale_step_spinbutton ) ) ; - adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( vscale_offset_spinbutton ) ); - adjust->step_increment = val; - adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( vscale_value_spinbutton ) ); - adjust->step_increment = val; - l_pIncrement->scale[1] = val; -} - -static void on_rotate_step_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){ - gfloat val; - GtkAdjustment * adjust; - - if ( !g_bListenChanged ) { - return; - } - - l_pIncrement = Get_SI_Inc(); - -#ifdef DBG_SI - Sys_Printf( "OnIncrementChanged HShift\n" ); -#endif - - val = gtk_spin_button_get_value( GTK_SPIN_BUTTON( rotate_step_spinbutton ) ) ; - adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( rotate_offset_spinbutton ) ); - adjust->step_increment = val; - adjust = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON( rotate_value_spinbutton ) ); - adjust->step_increment = val; - l_pIncrement->rotate = val; -} - - -// Fit Texture -static void on_fit_width_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){ - m_nWidth = gtk_spin_button_get_value_as_int( GTK_SPIN_BUTTON( fit_width_spinbutton ) ); -} - -static void on_fit_height_spinbutton_value_changed( GtkSpinButton *spinbutton, gpointer user_data ){ - m_nHeight = gtk_spin_button_get_value_as_int( GTK_SPIN_BUTTON( fit_height_spinbutton ) ); -} - -static void on_fit_button_clicked( GtkButton *button, gpointer user_data ){ - FaceList_FitTexture( get_texdef_face_list(), m_nHeight, m_nWidth ); - Sys_UpdateWindows( W_ALL ); -} - - -// Axial Button -static void on_axial_button_clicked( GtkButton *button, gpointer user_data ){ - texdef_t* tmp_texdef; - texdef_to_face_t* temp_texdef_face_list; - - if ( !texdef_face_list_empty() && g_bListenChanged ) { - for ( temp_texdef_face_list = get_texdef_face_list(); temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next ) - { - tmp_texdef = (texdef_t *) &temp_texdef_face_list->texdef; - tmp_texdef->shift[0] = 0.0; - tmp_texdef->shift[1] = 0.0; - tmp_texdef->scale[0] = 0.5; - tmp_texdef->scale[1] = 0.5; - tmp_texdef->rotate = 0.0; - } - } - - SetTexdef_FaceList( get_texdef_face_list(), FALSE, TRUE ); - Sys_UpdateWindows( W_ALL ); -} - - -// Action Buttons -static void on_done_button_clicked( GtkButton *button, gpointer user_data ){ - if ( !texdef_face_list_empty() ) { - GetTexMods( TRUE ); - } - HideDlg(); - Sys_UpdateWindows( W_ALL ); -} - -static void on_apply_button_clicked( GtkButton *button, gpointer user_data ){ - if ( !g_bListenChanged ) { - return; - } - - if ( !texdef_face_list_empty() ) { - GetTexMods( TRUE ); - Sys_UpdateWindows( W_CAMERA ); - GetTexdefInfo_from_Radiant(); - SetTexMods(); - } -} - -static void on_cancel_button_clicked( GtkButton *button, gpointer user_data ){ - texturewin = Texturewin(); - texturewin->texdef = g_old_texdef; - // cancel the last do if we own it - if ( ( m_nUndoId == Undo_GetUndoId() ) && ( m_nUndoId != 0 ) ) { -#ifdef DBG_SI - Sys_Printf( "OnCancel calling Undo_Undo\n" ); -#endif - g_bListenUpdate = false; - Undo_Undo( TRUE ); - g_bListenUpdate = true; - m_nUndoId = 0; - } - HideDlg(); -} diff --git a/plugins/surface_ufoai/surfacedialog.h b/plugins/surface_ufoai/surfacedialog.h deleted file mode 100644 index 23b7ec9d..00000000 --- a/plugins/surface_ufoai/surfacedialog.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - Copyright (C) 1999-2007 id Software, Inc. and contributors. - For a list of contributors, see the accompanying CONTRIBUTORS file. - - This file is part of GtkRadiant. - - GtkRadiant is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - GtkRadiant is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with GtkRadiant; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef _SURFACEDIALOG_H_ -#define _SURFACEDIALOG_H_ - -void UpdateSurfaceDialog(); -void DoSurface(); -void ToggleSurface(); -void SurfaceDlgFitAll(); -GtkWidget *Get_SI_Module_Widget(); - -#endif // _SURFACEDIALOG_H_ diff --git a/plugins/surface_ufoai/surfaceflagsdialog_ufoai.h b/plugins/surface_ufoai/surfaceflagsdialog_ufoai.h deleted file mode 100644 index 210bb4a1..00000000 --- a/plugins/surface_ufoai/surfaceflagsdialog_ufoai.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - Copyright (C) 1999-2007 id Software, Inc. and contributors. - For a list of contributors, see the accompanying CONTRIBUTORS file. - - This file is part of GtkRadiant. - - GtkRadiant is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - GtkRadiant is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with GtkRadiant; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef _SURFACEFLAGSDIALOG_UFOAI_H -#define _SURFACEFLAGSDIALOG_UFOAI_H - -#endif // _SURFACEFLAGSDIALOG_UFOAI_H diff --git a/plugins/surface_ufoai/surfdlg_plugin.cpp b/plugins/surface_ufoai/surfdlg_plugin.cpp deleted file mode 100644 index a73aa0ca..00000000 --- a/plugins/surface_ufoai/surfdlg_plugin.cpp +++ /dev/null @@ -1,120 +0,0 @@ -/* - Copyright (c) 2001, Loki software, inc. - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this list - of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, this - list of conditions and the following disclaimer in the documentation and/or - other materials provided with the distribution. - - Neither the name of Loki software nor the names of its contributors may be used - to endorse or promote products derived from this software without specific prior - written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY - DIRECT,INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include -#include "surfdlg_plugin.h" -#include "surfacedialog.h" - -#include "synapse.h" - -class CSynapseClient_SurfDLG : public CSynapseClient -{ -public: -// CSynapseClient API -bool RequestAPI( APIDescriptor_t *pAPI ); -const char* GetInfo(); -const char* GetName(); -bool OnActivate(); - -CSynapseClient_SurfDLG() { } -virtual ~CSynapseClient_SurfDLG() { } -}; - -// ============================================================================= -// SYNAPSE - -_QERFuncTable_1 g_FuncTable; -_QERUndoTable g_UndoTable; -_QERAppSurfaceTable g_AppSurfaceTable; -_QERSelectedFaceTable g_SelectedFaceTable; -_QERShadersTable g_ShadersTable; -_QERAppShadersTable g_AppShadersTable; -_QERAppDataTable g_AppDataTable; - -CSynapseServer* g_pSynapseServer = NULL; -CSynapseClient_SurfDLG g_SynapseClient; - -#if __GNUC__ >= 4 -#pragma GCC visibility push(default) -#endif -extern "C" CSynapseClient * SYNAPSE_DLL_EXPORT Synapse_EnumerateInterfaces( const char *version, CSynapseServer *pServer ) { -#if __GNUC__ >= 4 -#pragma GCC visibility pop -#endif - if ( strcmp( version, SYNAPSE_VERSION ) ) { - Syn_Printf( "ERROR: synapse API version mismatch: should be '" SYNAPSE_VERSION "', got '%s'\n", version ); - return NULL; - } - g_pSynapseServer = pServer; - g_pSynapseServer->IncRef(); - Set_Syn_Printf( g_pSynapseServer->Get_Syn_Printf() ); - - g_SynapseClient.AddAPI( SURFACEDIALOG_MAJOR, "ufoai", sizeof( _QERPlugSurfaceTable ) ); - g_SynapseClient.AddAPI( RADIANT_MAJOR, NULL, sizeof( _QERFuncTable_1 ), SYN_REQUIRE, &g_FuncTable ); - g_SynapseClient.AddAPI( UNDO_MAJOR, NULL, sizeof( _QERUndoTable ), SYN_REQUIRE, &g_UndoTable ); - g_SynapseClient.AddAPI( APPSURFACEDIALOG_MAJOR, NULL, sizeof( _QERAppSurfaceTable ), SYN_REQUIRE, &g_AppSurfaceTable ); - g_SynapseClient.AddAPI( SELECTEDFACE_MAJOR, NULL, sizeof( _QERSelectedFaceTable ), SYN_REQUIRE, &g_SelectedFaceTable ); - g_SynapseClient.AddAPI( SHADERS_MAJOR, "ufoai", sizeof( _QERShadersTable ), SYN_REQUIRE, &g_ShadersTable ); - g_SynapseClient.AddAPI( APPSHADERS_MAJOR, NULL, sizeof( _QERAppShadersTable ), SYN_REQUIRE, &g_AppShadersTable ); - g_SynapseClient.AddAPI( DATA_MAJOR, NULL, sizeof( _QERAppDataTable ), SYN_REQUIRE, &g_AppDataTable ); - - return &g_SynapseClient; -} - -bool CSynapseClient_SurfDLG::RequestAPI( APIDescriptor_t *pAPI ){ - if ( !strcmp( pAPI->major_name, SURFACEDIALOG_MAJOR ) ) { - _QERPlugSurfaceTable* pSurfDialogTable = static_cast<_QERPlugSurfaceTable*>( pAPI->mpTable ); - if ( !strcmp( pAPI->minor_name, "ufoai" ) ) { - pSurfDialogTable->m_pfnToggleSurface = &ToggleSurface; - pSurfDialogTable->m_pfnDoSurface = &DoSurface; - pSurfDialogTable->m_pfnUpdateSurfaceDialog = &UpdateSurfaceDialog; - pSurfDialogTable->m_pfnSurfaceDlgFitAll = &SurfaceDlgFitAll; - pSurfDialogTable->m_pfnGet_SI_Module_Widget = &Get_SI_Module_Widget; - return true; - } - } - - Syn_Printf( "ERROR: RequestAPI( '%s' ) not found in '%s'\n", pAPI->major_name, GetInfo() ); - return false; -} - -#include "version.h" - -const char* CSynapseClient_SurfDLG::GetInfo(){ - return "Surface Dialog (UFO: Alien Invasion) module built " __DATE__ " " RADIANT_VERSION; -} - -const char* CSynapseClient_SurfDLG::GetName(){ - return "surface"; -} - -bool CSynapseClient_SurfDLG::OnActivate(){ - return true; -} diff --git a/plugins/surface_ufoai/surfdlg_plugin.h b/plugins/surface_ufoai/surfdlg_plugin.h deleted file mode 100644 index b90020d5..00000000 --- a/plugins/surface_ufoai/surfdlg_plugin.h +++ /dev/null @@ -1,97 +0,0 @@ -/* - Copyright (c) 2001, Loki software, inc. - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this list - of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, this - list of conditions and the following disclaimer in the documentation and/or - other materials provided with the distribution. - - Neither the name of Loki software nor the names of its contributors may be used - to endorse or promote products derived from this software without specific prior - written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY - DIRECT,INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _SURFDLG_PLUGIN_H_ -#define _SURFDLG_PLUGIN_H_ - -#ifdef __linux__ - -typedef void* HMODULE; -typedef void* LPVOID; -typedef char* LPCSTR; - -#endif // __linux__ - -#include "qerplugin.h" -#include "synapse.h" -#include "iselectedface.h" -#include "iundo.h" -#include "ishaders.h" -#include "mathlib.h" -#include "missing.h" -#include "idata.h" - -#include "isurfaceplugin.h" - -class SurfaceDialog : public IPluginTexdef -{ -int refCount; -public: -// Increment the number of references to this object -void IncRef() { refCount++; } -// Decrement the reference count -void DecRef() { - if ( --refCount <= 0 ) { - delete this; - } -} -}; - -extern _QERFuncTable_1 g_FuncTable; -extern _QERUndoTable g_UndoTable; -extern _QERAppSurfaceTable g_AppSurfaceTable; -extern _QERSelectedFaceTable g_SelectedFaceTable; -extern _QERShadersTable g_ShadersTable; -extern _QERAppShadersTable g_AppShadersTable; -extern _QERAppDataTable g_AppDataTable; - -#define GetSelectedFaceCount g_SelectedFaceTable.m_pfnGetSelectedFaceCount - -#define Undo_Undo g_UndoTable.m_pfnUndo_Undo -#define Undo_GetUndoId g_UndoTable.m_pfnUndo_GetUndoId - -#define Sys_Printf g_FuncTable.m_pfnSysPrintf -#define Sys_FPrintf g_FuncTable.m_pfnSysFPrintf -#define Sys_UpdateWindows g_FuncTable.m_pfnSysUpdateWindows - - -#define Select_FitTexture g_AppSurfaceTable.m_pfnSelect_FitTexture -#define Get_SI_Inc g_AppSurfaceTable.m_pfnQERApp_QeglobalsSavedinfo_SIInc -#define GridSize g_AppSurfaceTable.m_pfnQeglobalsGetGridSize -#define FaceList_FitTexture g_AppSurfaceTable.m_pfnFaceList_FitTexture -#define GetMainWindow g_AppSurfaceTable.m_pfnGetMainWindow -#define GetSelectedFaceCountfromBrushes g_AppSurfaceTable.m_pfnGetSelectedFaceCountfromBrushes -#define GetSelFacesTexdef g_AppSurfaceTable.m_pfnGetSelFacesTexdef -#define SetTexdef_FaceList g_AppSurfaceTable.m_pfnSetTexdef_FaceList -#define SetWinPos_from_Prefs g_AppSurfaceTable.m_pfnSetWinPos_From_Prefs - -#define Texturewin g_AppShadersTable.m_pfnQeglobalsTexturewin - -#endif // _SURFDLG_PLUGIN_H_ diff --git a/po/de.po b/po/de.po index 1d351501..f61ce8ff 100644 --- a/po/de.po +++ b/po/de.po @@ -37,110 +37,6 @@ msgstr "" msgid "Select Inside" msgstr "" -#: contrib/ufoai/plugin.cpp:48 -msgid "UFO: Alien Invasion plugin " -msgstr "UFO: Alien Invasion plugin " - -#: contrib/ufoai/plugin.cpp:64 -msgid "Filter actorclip" -msgstr "" - -#: contrib/ufoai/plugin.cpp:65 -msgid "Actorclip" -msgstr "" - -#: contrib/ufoai/plugin.cpp:71 -msgid "Filter weaponclip" -msgstr "" - -#: contrib/ufoai/plugin.cpp:72 -msgid "Weaponclip" -msgstr "" - -#: contrib/ufoai/plugin.cpp:78 -msgid "Filter nodraw" -msgstr "" - -#: contrib/ufoai/plugin.cpp:79 -msgid "NoDraw" -msgstr "" - -#: contrib/ufoai/plugin.cpp:85 -msgid "Filter stepon" -msgstr "" - -#: contrib/ufoai/plugin.cpp:86 -msgid "Stepon" -msgstr "" - -#: contrib/ufoai/plugin.cpp:92 -msgid "Filter level1" -msgstr "Filter level1" - -#: contrib/ufoai/plugin.cpp:93 -msgid "Level 1" -msgstr "Level 1" - -#: contrib/ufoai/plugin.cpp:99 -msgid "Filter level2" -msgstr "Filter level2" - -#: contrib/ufoai/plugin.cpp:100 -msgid "Level 2" -msgstr "Level 2" - -#: contrib/ufoai/plugin.cpp:106 -msgid "Filter level3" -msgstr "Filter level3" - -#: contrib/ufoai/plugin.cpp:107 -msgid "Level 3" -msgstr "Level 3" - -#: contrib/ufoai/plugin.cpp:113 -msgid "Filter level4" -msgstr "Filter level4" - -#: contrib/ufoai/plugin.cpp:114 -msgid "Level 4" -msgstr "Level 4" - -#: contrib/ufoai/plugin.cpp:120 -msgid "Filter level5" -msgstr "Filter level5" - -#: contrib/ufoai/plugin.cpp:121 -msgid "Level 5" -msgstr "Level 5" - -#: contrib/ufoai/plugin.cpp:127 -msgid "Filter level6" -msgstr "Filter level6" - -#: contrib/ufoai/plugin.cpp:128 -msgid "Level 6" -msgstr "Level 6" - -#: contrib/ufoai/plugin.cpp:134 -msgid "Filter level7" -msgstr "Filter level7" - -#: contrib/ufoai/plugin.cpp:135 -msgid "Level 7" -msgstr "Level 7" - -#: contrib/ufoai/plugin.cpp:141 -msgid "Filter level8" -msgstr "Filter level8" - -#: contrib/ufoai/plugin.cpp:142 -msgid "Level 8" -msgstr "Level 8" - -#: contrib/ufoai/plugin.cpp:210 -msgid "About" -msgstr "Über" - #: radiant/mainframe.cpp:939 #: radiant/mainframe.cpp:934 msgid "_File" diff --git a/radiant.pot b/radiant.pot index 414a650a..272ce48f 100644 --- a/radiant.pot +++ b/radiant.pot @@ -17,110 +17,6 @@ msgstr "" msgid "Select Inside" msgstr "" -#: contrib/ufoai/plugin.cpp:48 -msgid "UFO: Alien Invasion plugin " -msgstr "" - -#: contrib/ufoai/plugin.cpp:64 -msgid "Filter actorclip" -msgstr "" - -#: contrib/ufoai/plugin.cpp:65 -msgid "Actorclip" -msgstr "" - -#: contrib/ufoai/plugin.cpp:71 -msgid "Filter weaponclip" -msgstr "" - -#: contrib/ufoai/plugin.cpp:72 -msgid "Weaponclip" -msgstr "" - -#: contrib/ufoai/plugin.cpp:78 -msgid "Filter nodraw" -msgstr "" - -#: contrib/ufoai/plugin.cpp:79 -msgid "NoDraw" -msgstr "" - -#: contrib/ufoai/plugin.cpp:85 -msgid "Filter stepon" -msgstr "" - -#: contrib/ufoai/plugin.cpp:86 -msgid "Stepon" -msgstr "" - -#: contrib/ufoai/plugin.cpp:92 -msgid "Filter level1" -msgstr "" - -#: contrib/ufoai/plugin.cpp:93 -msgid "Level 1" -msgstr "" - -#: contrib/ufoai/plugin.cpp:99 -msgid "Filter level2" -msgstr "" - -#: contrib/ufoai/plugin.cpp:100 -msgid "Level 2" -msgstr "" - -#: contrib/ufoai/plugin.cpp:106 -msgid "Filter level3" -msgstr "" - -#: contrib/ufoai/plugin.cpp:107 -msgid "Level 3" -msgstr "" - -#: contrib/ufoai/plugin.cpp:113 -msgid "Filter level4" -msgstr "" - -#: contrib/ufoai/plugin.cpp:114 -msgid "Level 4" -msgstr "" - -#: contrib/ufoai/plugin.cpp:120 -msgid "Filter level5" -msgstr "" - -#: contrib/ufoai/plugin.cpp:121 -msgid "Level 5" -msgstr "" - -#: contrib/ufoai/plugin.cpp:127 -msgid "Filter level6" -msgstr "" - -#: contrib/ufoai/plugin.cpp:128 -msgid "Level 6" -msgstr "" - -#: contrib/ufoai/plugin.cpp:134 -msgid "Filter level7" -msgstr "" - -#: contrib/ufoai/plugin.cpp:135 -msgid "Level 7" -msgstr "" - -#: contrib/ufoai/plugin.cpp:141 -msgid "Filter level8" -msgstr "" - -#: contrib/ufoai/plugin.cpp:142 -msgid "Level 8" -msgstr "" - -#: contrib/ufoai/plugin.cpp:210 -msgid "About" -msgstr "" - #: radiant/mainframe.cpp:939 radiant/mainframe.cpp:934 msgid "_File" msgstr "" diff --git a/radiant.sln b/radiant.sln index 8696f426..de4cbee6 100644 --- a/radiant.sln +++ b/radiant.sln @@ -59,11 +59,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "spritemodel", "plugins\spri EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "textool", "plugins\textool\textool.vcxproj", "{4F52DED4-285A-4E99-9C78-734D59E8ACD6}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "surface_ufoai", "plugins\surface_ufoai\surface_ufoai.vcxproj", "{F400371F-455F-4B6C-9F13-A2E57110E725}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "surface_quake2", "plugins\surface_quake2\surface_quake2.vcxproj", "{32AB82AA-C781-4E5E-83A0-A164D371306F}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "surface_heretic2", "plugins\surface_heretic2\surface_heretic2.vcxproj", "{12932084-E212-45AB-B3BE-A2A5AEEBA581}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "surface_idtech2", "plugins\surface_idtech2\surface_idtech2.vcxproj", "{F400371F-455F-4B6C-9F13-A2E57110E725}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "prtview", "contrib\prtview\prtview.vcxproj", "{AB6534A8-ED1B-46DC-84EA-8AA080C12F6A}" EndProject