From b28ec5a77da24d0a133042f1076d7612a40b0cff Mon Sep 17 00:00:00 2001 From: jdolan Date: Mon, 8 Jul 2013 23:09:09 -0400 Subject: [PATCH] Start to clean up the internal structure of the idTech2 surface inspector. --- plugins/surface/surfacedialog.cpp | 2 -- .../surface_idtech2/surface_idtech2.vcproj | 2 +- .../surface_idtech2/surface_idtech2.vcxproj | 2 +- .../surface_idtech2.vcxproj.filters | 2 +- plugins/surface_idtech2/surfacedialog.cpp | 32 ++++--------------- plugins/surface_idtech2/surfacedialog.h | 12 +++++++ ...agsdialog_idtech2.cpp => surfaceflags.cpp} | 16 ++++++---- ...ceflagsdialog_idtech2.h => surfaceflags.h} | 12 +++++-- plugins/surface_idtech2/surfdlg_plugin.h | 1 - 9 files changed, 40 insertions(+), 41 deletions(-) rename plugins/surface_idtech2/{surfaceflagsdialog_idtech2.cpp => surfaceflags.cpp} (97%) rename plugins/surface_idtech2/{surfaceflagsdialog_idtech2.h => surfaceflags.h} (72%) diff --git a/plugins/surface/surfacedialog.cpp b/plugins/surface/surfacedialog.cpp index 44ab6717..f55e4163 100644 --- a/plugins/surface/surfacedialog.cpp +++ b/plugins/surface/surfacedialog.cpp @@ -33,8 +33,6 @@ #include "surfdlg_plugin.h" - - #ifdef _DEBUG //#define DBG_SI 1 #endif diff --git a/plugins/surface_idtech2/surface_idtech2.vcproj b/plugins/surface_idtech2/surface_idtech2.vcproj index 210b777d..f5d9e256 100644 --- a/plugins/surface_idtech2/surface_idtech2.vcproj +++ b/plugins/surface_idtech2/surface_idtech2.vcproj @@ -181,7 +181,7 @@ > - + diff --git a/plugins/surface_idtech2/surface_idtech2.vcxproj.filters b/plugins/surface_idtech2/surface_idtech2.vcxproj.filters index f11a6707..29507511 100644 --- a/plugins/surface_idtech2/surface_idtech2.vcxproj.filters +++ b/plugins/surface_idtech2/surface_idtech2.vcxproj.filters @@ -15,7 +15,7 @@ src - + src diff --git a/plugins/surface_idtech2/surfacedialog.cpp b/plugins/surface_idtech2/surfacedialog.cpp index efc86d42..05cac400 100644 --- a/plugins/surface_idtech2/surfacedialog.cpp +++ b/plugins/surface_idtech2/surfacedialog.cpp @@ -27,7 +27,8 @@ #include #include -#include "surfdlg_plugin.h" +#include "surfacedialog.h" +#include "surfaceflags.h" #ifdef _DEBUG //#define DBG_SI 1 @@ -57,31 +58,13 @@ 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(); - -// IDTECH2 Flags Functions -void SetFlagButtons_IDTECH2( texdef_to_face_t *texdef_face_list, bool b_isListEmpty ); -void SetChangeInFlags_Face_IDTECH2( texdef_to_face_t *texdef_face_list ); -GtkWidget* Create_IDTECH2FlagsDialog( 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 +// 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; @@ -111,7 +94,6 @@ GtkWidget *GetDlgWidget( const char* name ) GtkWidget *spin_width; GtkWidget *spin_height; - GtkWidget *texture_combo; GtkWidget *texture_combo_entry; @@ -337,10 +319,10 @@ static void GetTexdefInfo_from_Radiant(){ IsFaceConflicting(); PopulateTextureComboList(); if ( texdef_face_list_empty() ) { - SetFlagButtons_IDTECH2( get_texdef_face_list(), TRUE ); + set_surface_flags_button_state( get_texdef_face_list(), TRUE ); } else{ - SetFlagButtons_IDTECH2( get_texdef_face_list(), FALSE ); + set_surface_flags_button_state( get_texdef_face_list(), FALSE ); } } @@ -534,7 +516,7 @@ void GetTexMods( bool b_SetUndoPoint ){ if ( !texdef_face_list_empty() ) { g_bListenUpdate = FALSE; - SetChangeInFlags_Face_IDTECH2( get_texdef_face_list() ); + apply_surface_flags( get_texdef_face_list() ); SetTexdef_FaceList( get_texdef_face_list(), b_SetUndoPoint, FALSE ); g_bListenUpdate = TRUE; @@ -806,7 +788,7 @@ GtkWidget* create_SurfaceInspector( void ){ (GtkAttachOptions) ( 0 ), 0, 0 ); // Add the SURF_ and CONTENTS_ flags frame - Create_IDTECH2FlagsDialog( vbox1 ); + create_SurfaceFlagsFrame( vbox1 ); g_signal_connect( (gpointer) SurfaceInspector, "delete_event", diff --git a/plugins/surface_idtech2/surfacedialog.h b/plugins/surface_idtech2/surfacedialog.h index 23b7ec9d..8d51fc94 100644 --- a/plugins/surface_idtech2/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_idtech2/surfaceflagsdialog_idtech2.cpp b/plugins/surface_idtech2/surfaceflags.cpp similarity index 97% rename from plugins/surface_idtech2/surfaceflagsdialog_idtech2.cpp rename to plugins/surface_idtech2/surfaceflags.cpp index 6a0c5932..16a3b522 100644 --- a/plugins/surface_idtech2/surfaceflagsdialog_idtech2.cpp +++ b/plugins/surface_idtech2/surfaceflags.cpp @@ -25,8 +25,8 @@ #include #include "surfdlg_plugin.h" - -#include "surfaceflagsdialog_idtech2.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_IDTECH2( 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_IDTECH2( texdef_to_face_t *texdef_face_list, bool b_isListEm 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_IDTECH2( texdef_to_face_t *texdef_face_list, bool b_isListEm 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,7 +171,7 @@ void SetFlagButtons_IDTECH2( texdef_to_face_t *texdef_face_list, bool b_isListEm setup_buttons = FALSE; } -void SetChangeInFlags_Face_IDTECH2( texdef_to_face_t *faces ){ +void apply_surface_flags( texdef_to_face_t *faces ){ texdef_to_face_t *face; texdef_t *tex; @@ -182,8 +186,6 @@ void SetChangeInFlags_Face_IDTECH2( texdef_to_face_t *faces ){ } } -extern void GetTexMods( bool b_SetUndoPoint ); - 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 @@ -283,7 +285,7 @@ void on_contentbutton_clicked( GtkButton *button, gpointer user_data ){ #define IDTECH2_FLAG_BUTTON_BORDER 3 -GtkWidget* Create_IDTECH2FlagsDialog( GtkWidget* surfacedialog_widget ){ +GtkWidget* create_SurfaceFlagsFrame( GtkWidget* surfacedialog_widget ){ GtkWidget *frame1; GtkWidget *vbox1; GtkWidget *vbox2; diff --git a/plugins/surface_idtech2/surfaceflagsdialog_idtech2.h b/plugins/surface_idtech2/surfaceflags.h similarity index 72% rename from plugins/surface_idtech2/surfaceflagsdialog_idtech2.h rename to plugins/surface_idtech2/surfaceflags.h index e9f11406..6c761e73 100644 --- a/plugins/surface_idtech2/surfaceflagsdialog_idtech2.h +++ b/plugins/surface_idtech2/surfaceflags.h @@ -19,7 +19,13 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef _SURFACEFLAGSDIALOG_IDTECH2_H -#define _SURFACEFLAGSDIALOG_IDTECH2_H +#ifndef _SURFACEFLAGS_H +#define _SURFACEFLAGS_H -#endif // _SURFACEFLAGSDIALOG_IDTECH2_H +#include "surfdlg_plugin.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_idtech2/surfdlg_plugin.h b/plugins/surface_idtech2/surfdlg_plugin.h index b90020d5..6f65af77 100644 --- a/plugins/surface_idtech2/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