Start to clean up the internal structure of the idTech2 surface inspector.

This commit is contained in:
jdolan 2013-07-08 23:09:09 -04:00
parent 5c34795c7f
commit b28ec5a77d
9 changed files with 40 additions and 41 deletions

View file

@ -33,8 +33,6 @@
#include "surfdlg_plugin.h"
#ifdef _DEBUG
//#define DBG_SI 1
#endif

View file

@ -181,7 +181,7 @@
>
</File>
<File
RelativePath=".\surfaceflagsdialog_idtech2.cpp"
RelativePath=".\surfaceflags.cpp"
>
</File>
<File

View file

@ -162,7 +162,7 @@
</ItemGroup>
<ItemGroup>
<ClCompile Include="surfacedialog.cpp" />
<ClCompile Include="surfaceflagsdialog_idtech2.cpp" />
<ClCompile Include="surfaceflags.cpp" />
<ClCompile Include="surfdlg_plugin.cpp" />
</ItemGroup>
<ItemGroup>

View file

@ -15,7 +15,7 @@
<ClCompile Include="surfacedialog.cpp">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="surfaceflagsdialog_idtech2.cpp">
<ClCompile Include="surfaceflags.cpp">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="surfdlg_plugin.cpp">

View file

@ -27,7 +27,8 @@
#include <glib/gi18n.h>
#include <gdk/gdkkeysyms.h>
#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",

View file

@ -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();

View file

@ -25,8 +25,8 @@
#include <glib/gi18n.h>
#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;

View file

@ -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

View file

@ -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