control 32/64 bit version of q3map2 for the Windows build. requires a restart of the editor (and regen of the project file)

This commit is contained in:
Timothee "TTimo" Besset 2013-06-15 21:03:14 -05:00
parent f0c620b09f
commit 6b62952832
6 changed files with 47 additions and 11 deletions

View file

@ -45,7 +45,7 @@ Dialog::Dialog (){
m_pDataList = (GSList*)NULL; m_pDataList = (GSList*)NULL;
m_nReturn = IDCANCEL; m_nReturn = IDCANCEL;
m_bNeedBuild = true; m_bNeedBuild = true;
m_nLoop = 0; m_nLoop = false;
} }
Dialog::~Dialog (){ Dialog::~Dialog (){
@ -265,7 +265,7 @@ void Dialog::UpdateData( bool retrieve ){
} }
void Dialog::EndModal( int code ) { void Dialog::EndModal( int code ) {
m_nLoop = 0; m_nLoop = false;
m_nReturn = code; m_nReturn = code;
} }
@ -278,7 +278,7 @@ int Dialog::DoModal(){
gtk_grab_add( m_pWidget ); gtk_grab_add( m_pWidget );
gtk_widget_show( m_pWidget ); gtk_widget_show( m_pWidget );
m_nLoop = 1; m_nLoop = true;
while ( m_nLoop ) { while ( m_nLoop ) {
gtk_main_iteration(); gtk_main_iteration();
} }

View file

@ -60,14 +60,13 @@ virtual void ShowDlg();
virtual void HideDlg(); virtual void HideDlg();
void Create(); void Create();
void Destroy(); void Destroy();
GtkWidget* GetDlgWidget( const char* name ) GtkWidget* GetDlgWidget( const char* name ) { return GTK_WIDGET( g_object_get_data( G_OBJECT( m_pWidget ), name ) ); }
{ return GTK_WIDGET( g_object_get_data( G_OBJECT( m_pWidget ), name ) ); } GtkWidget* GetWidget() { return m_pWidget; }
GtkWidget* GetWidget() bool IsModal() { return m_nLoop; }
{ return m_pWidget; }
protected: protected:
GtkWidget *m_pWidget; GtkWidget *m_pWidget;
int m_nLoop; bool m_nLoop;
int m_nReturn; int m_nReturn;
void AddDialogData( GtkWidget *widget, void *buf, DLG_DATA_TYPE type ) void AddDialogData( GtkWidget *widget, void *buf, DLG_DATA_TYPE type )

View file

@ -1712,7 +1712,9 @@ bool WINAPI color_dialog( void *parent, float *color, const char* title ){
} }
void OpenURL( const char *url ){ void OpenURL( const char *url ){
#ifndef _WIN32
char command[2 * PATH_MAX]; char command[2 * PATH_MAX];
#endif
Sys_Printf( "OpenURL: %s\n", url ); Sys_Printf( "OpenURL: %s\n", url );
#ifdef _WIN32 #ifdef _WIN32

View file

@ -148,6 +148,7 @@
#define TEXTURECOMPRESSIONFORMAT_KEY "TextureCompressionFormat" #define TEXTURECOMPRESSIONFORMAT_KEY "TextureCompressionFormat"
#define LIGHTRADIUS_KEY "LightRadiuses" #define LIGHTRADIUS_KEY "LightRadiuses"
#define Q3MAP2TEX_KEY "Q3Map2Tex" #define Q3MAP2TEX_KEY "Q3Map2Tex"
#define X64Q3MAP2_KEY "x64Q3Map2"
#ifdef ATIHACK_812 #ifdef ATIHACK_812
#define ATIHACK_KEY "ATIHack" #define ATIHACK_KEY "ATIHack"
@ -661,6 +662,7 @@ PrefsDlg::PrefsDlg (){
#endif #endif
m_nLightRadiuses = 1; m_nLightRadiuses = 1;
m_bQ3Map2Texturing = TRUE; m_bQ3Map2Texturing = TRUE;
m_bx64q3map2 = TRUE;
#ifdef ATIHACK_812 #ifdef ATIHACK_812
m_bGlATIHack = FALSE; m_bGlATIHack = FALSE;
#endif #endif
@ -1511,6 +1513,17 @@ static void treeSelection( GtkTreeSelection* selection, gpointer data ){
} }
} }
static void OnX64Toggle( GtkWidget *widget, gpointer data ) {
Dialog * d = static_cast< Dialog * >( data );
if ( !d->IsModal() ) {
// calls to gtk_toggle_button_get_active trigger the "toggle" signal to fire .. so ignore unless we're in the modal dialog
return;
}
gtk_MessageBox( widget, _( "You must restart Radiant for the change to take effect." ) );
g_PrefsDlg.m_nLastProjectVer = -1;
g_PrefsDlg.m_strLastProject = "";
}
void PrefsDlg::BuildDialog(){ void PrefsDlg::BuildDialog(){
// Main Preferences dialog // Main Preferences dialog
GtkWidget *dialog, *mainvbox, *hbox, *sc_win, *preflabel; GtkWidget *dialog, *mainvbox, *hbox, *sc_win, *preflabel;
@ -1526,7 +1539,7 @@ void PrefsDlg::BuildDialog(){
dialog = m_pWidget; dialog = m_pWidget;
gtk_window_set_title( GTK_WINDOW( dialog ), _( "GtkRadiant Preferences" ) ); gtk_window_set_title( GTK_WINDOW( dialog ), _( "GtkRadiant Preferences" ) );
gtk_window_set_transient_for( GTK_WINDOW( dialog ), GTK_WINDOW( g_pParentWnd->m_pWidget ) ); gtk_window_set_transient_for( GTK_WINDOW( dialog ), GTK_WINDOW( g_pParentWnd->m_pWidget ) );
gtk_window_set_position( GTK_WINDOW( dialog ), GTK_WIN_POS_CENTER_ON_PARENT ); gtk_window_set_position( GTK_WINDOW( dialog ), GTK_WIN_POS_CENTER_ON_PARENT );
gtk_widget_realize( dialog ); gtk_widget_realize( dialog );
@ -2693,12 +2706,20 @@ void PrefsDlg::BuildDialog(){
g_object_set_data( G_OBJECT( dialog ), "check_q3map2", check ); g_object_set_data( G_OBJECT( dialog ), "check_q3map2", check );
AddDialogData( check, &g_PrefsDlg.m_bQ3Map2Texturing, DLG_CHECK_BOOL ); AddDialogData( check, &g_PrefsDlg.m_bQ3Map2Texturing, DLG_CHECK_BOOL );
#ifdef _WIN32
// use 64 bit q3map2
check = gtk_check_button_new_with_label( _( "Use 64 bit q3map2" ) );
gtk_widget_show( check );
gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, FALSE, 0 );
g_object_set_data( G_OBJECT( dialog ), "check_x64_q3map2", check );
AddDialogData( check, &g_PrefsDlg.m_bx64q3map2, DLG_CHECK_BOOL );
g_signal_connect( GTK_OBJECT( check ), "toggled", GTK_SIGNAL_FUNC( OnX64Toggle ), this );
#endif
// Add the page to the notebook // Add the page to the notebook
gtk_notebook_append_page( GTK_NOTEBOOK( notebook ), pageframe, preflabel ); gtk_notebook_append_page( GTK_NOTEBOOK( notebook ), pageframe, preflabel );
gtk_notebook_set_page( GTK_NOTEBOOK( notebook ), PTAB_FRONT ); gtk_notebook_set_page( GTK_NOTEBOOK( notebook ), PTAB_FRONT );
return;
} }
// end new prefs dialog // end new prefs dialog
@ -3116,6 +3137,7 @@ void PrefsDlg::LoadPrefs(){
mLocalPrefs.GetPref( LIGHTRADIUS_KEY, &m_nLightRadiuses, TRUE ); mLocalPrefs.GetPref( LIGHTRADIUS_KEY, &m_nLightRadiuses, TRUE );
mLocalPrefs.GetPref( Q3MAP2TEX_KEY, &m_bQ3Map2Texturing, TRUE ); mLocalPrefs.GetPref( Q3MAP2TEX_KEY, &m_bQ3Map2Texturing, TRUE );
mLocalPrefs.GetPref( X64Q3MAP2_KEY, &m_bx64q3map2, TRUE );
#ifdef ATIHACK_812 #ifdef ATIHACK_812
mLocalPrefs.GetPref( ATIHACK_KEY, &m_bGlATIHack, FALSE ); mLocalPrefs.GetPref( ATIHACK_KEY, &m_bGlATIHack, FALSE );

View file

@ -695,6 +695,9 @@ int m_nTextureCompressionFormat;
int m_nLightRadiuses; int m_nLightRadiuses;
bool m_bQ3Map2Texturing; bool m_bQ3Map2Texturing;
#ifdef _WIN32
bool m_bx64q3map2;
#endif
#ifdef ATIHACK_812 #ifdef ATIHACK_812
bool m_bGlATIHack; bool m_bGlATIHack;

View file

@ -443,6 +443,7 @@ void ReplaceTemplates( char* w, const char* r ){
const char *__TOOLSPATH = "TEMPLATEtoolspath"; const char *__TOOLSPATH = "TEMPLATEtoolspath";
const char *__BASEDIR = "TEMPLATEbasedir"; const char *__BASEDIR = "TEMPLATEbasedir";
const char *__APPPATH = "TEMPLATEapppath"; const char *__APPPATH = "TEMPLATEapppath";
const char *__Q3MAP2 = "TEMPLATEq3map2";
// iterate through string r // iterate through string r
while ( *r != '\0' ) while ( *r != '\0' )
@ -469,6 +470,15 @@ void ReplaceTemplates( char* w, const char* r ){
r += strlen( __APPPATH ) + 1; r += strlen( __APPPATH ) + 1;
p = g_strAppPath.GetBuffer(); p = g_strAppPath.GetBuffer();
} }
else if ( strncmp( r + 1, __Q3MAP2, strlen( __Q3MAP2 ) ) == 0 ) {
r += strlen( __Q3MAP2 ) + 1;
// see https://github.com/TTimo/GtkRadiant/issues/116
if ( g_PrefsDlg.m_bx64q3map2 ) {
p = "x64/q3map2";
} else {
p = "q3map2";
}
}
else else
{ {
r++; r++;