diff --git a/radiant/dialog.cpp b/radiant/dialog.cpp index 3fdcaee4..e95f5b67 100644 --- a/radiant/dialog.cpp +++ b/radiant/dialog.cpp @@ -45,7 +45,7 @@ Dialog::Dialog (){ m_pDataList = (GSList*)NULL; m_nReturn = IDCANCEL; m_bNeedBuild = true; - m_nLoop = 0; + m_nLoop = false; } Dialog::~Dialog (){ @@ -265,7 +265,7 @@ void Dialog::UpdateData( bool retrieve ){ } void Dialog::EndModal( int code ) { - m_nLoop = 0; + m_nLoop = false; m_nReturn = code; } @@ -278,7 +278,7 @@ int Dialog::DoModal(){ gtk_grab_add( m_pWidget ); gtk_widget_show( m_pWidget ); - m_nLoop = 1; + m_nLoop = true; while ( m_nLoop ) { gtk_main_iteration(); } diff --git a/radiant/dialog.h b/radiant/dialog.h index 1bb9845c..69779821 100644 --- a/radiant/dialog.h +++ b/radiant/dialog.h @@ -60,14 +60,13 @@ virtual void ShowDlg(); virtual void HideDlg(); void Create(); void Destroy(); -GtkWidget* GetDlgWidget( const char* name ) -{ return GTK_WIDGET( g_object_get_data( G_OBJECT( m_pWidget ), name ) ); } -GtkWidget* GetWidget() -{ return m_pWidget; } +GtkWidget* GetDlgWidget( const char* name ) { return GTK_WIDGET( g_object_get_data( G_OBJECT( m_pWidget ), name ) ); } +GtkWidget* GetWidget() { return m_pWidget; } +bool IsModal() { return m_nLoop; } protected: GtkWidget *m_pWidget; -int m_nLoop; +bool m_nLoop; int m_nReturn; void AddDialogData( GtkWidget *widget, void *buf, DLG_DATA_TYPE type ) diff --git a/radiant/gtkmisc.cpp b/radiant/gtkmisc.cpp index 10da1e57..8217b00b 100644 --- a/radiant/gtkmisc.cpp +++ b/radiant/gtkmisc.cpp @@ -1712,7 +1712,9 @@ bool WINAPI color_dialog( void *parent, float *color, const char* title ){ } void OpenURL( const char *url ){ +#ifndef _WIN32 char command[2 * PATH_MAX]; +#endif Sys_Printf( "OpenURL: %s\n", url ); #ifdef _WIN32 diff --git a/radiant/preferences.cpp b/radiant/preferences.cpp index e987bd87..8b74f298 100644 --- a/radiant/preferences.cpp +++ b/radiant/preferences.cpp @@ -148,6 +148,7 @@ #define TEXTURECOMPRESSIONFORMAT_KEY "TextureCompressionFormat" #define LIGHTRADIUS_KEY "LightRadiuses" #define Q3MAP2TEX_KEY "Q3Map2Tex" +#define X64Q3MAP2_KEY "x64Q3Map2" #ifdef ATIHACK_812 #define ATIHACK_KEY "ATIHack" @@ -661,6 +662,7 @@ PrefsDlg::PrefsDlg (){ #endif m_nLightRadiuses = 1; m_bQ3Map2Texturing = TRUE; + m_bx64q3map2 = TRUE; #ifdef ATIHACK_812 m_bGlATIHack = FALSE; #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(){ // Main Preferences dialog GtkWidget *dialog, *mainvbox, *hbox, *sc_win, *preflabel; @@ -1526,7 +1539,7 @@ void PrefsDlg::BuildDialog(){ dialog = m_pWidget; 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_widget_realize( dialog ); @@ -2693,12 +2706,20 @@ void PrefsDlg::BuildDialog(){ g_object_set_data( G_OBJECT( dialog ), "check_q3map2", check ); 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 gtk_notebook_append_page( GTK_NOTEBOOK( notebook ), pageframe, preflabel ); gtk_notebook_set_page( GTK_NOTEBOOK( notebook ), PTAB_FRONT ); - - return; } // end new prefs dialog @@ -3116,6 +3137,7 @@ void PrefsDlg::LoadPrefs(){ mLocalPrefs.GetPref( LIGHTRADIUS_KEY, &m_nLightRadiuses, TRUE ); mLocalPrefs.GetPref( Q3MAP2TEX_KEY, &m_bQ3Map2Texturing, TRUE ); + mLocalPrefs.GetPref( X64Q3MAP2_KEY, &m_bx64q3map2, TRUE ); #ifdef ATIHACK_812 mLocalPrefs.GetPref( ATIHACK_KEY, &m_bGlATIHack, FALSE ); diff --git a/radiant/preferences.h b/radiant/preferences.h index 4b9bc36b..d9a489d3 100644 --- a/radiant/preferences.h +++ b/radiant/preferences.h @@ -695,6 +695,9 @@ int m_nTextureCompressionFormat; int m_nLightRadiuses; bool m_bQ3Map2Texturing; +#ifdef _WIN32 +bool m_bx64q3map2; +#endif #ifdef ATIHACK_812 bool m_bGlATIHack; diff --git a/radiant/qe3.cpp b/radiant/qe3.cpp index 0ece4e7f..e22ad01c 100644 --- a/radiant/qe3.cpp +++ b/radiant/qe3.cpp @@ -443,6 +443,7 @@ void ReplaceTemplates( char* w, const char* r ){ const char *__TOOLSPATH = "TEMPLATEtoolspath"; const char *__BASEDIR = "TEMPLATEbasedir"; const char *__APPPATH = "TEMPLATEapppath"; + const char *__Q3MAP2 = "TEMPLATEq3map2"; // iterate through string r while ( *r != '\0' ) @@ -469,6 +470,15 @@ void ReplaceTemplates( char* w, const char* r ){ r += strlen( __APPPATH ) + 1; 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 { r++;