return 1;
}
+void Brush_switchFormat( bool switch_format ){
+ if ( switch_format )
+ {
+ g_useAlternativeTextureProjection.m_latched = g_useAlternativeTextureProjection.m_value;
+ g_useAlternativeTextureProjection.m_value = !g_useAlternativeTextureProjection.m_value;
+ PreferencesDialog_restartRequired( g_useAlternativeTextureProjection.m_description );
+ PreferencesDialog_restartIfRequired();
+ }
+}
+
void Brush_Construct( EBrushType type ){
if ( type == eBrushTypeQuake3 ) {
g_showAlternativeTextureProjectionOption = true;
"AlternativeTextureProjection",
make_property_string( g_useAlternativeTextureProjection.m_latched )
);
+
g_useAlternativeTextureProjection.useLatched();
if ( g_useAlternativeTextureProjection.m_value ) {
void Brush_unlatchPreferences();
int Brush_toggleFormatCount();
void Brush_toggleFormat( int i );
+void Brush_switchFormat( bool switch_format );
#endif
SaveCommandMap( path.c_str() );
}
+/* HACK: If ui::main is not called yet,
+gtk_main_quit will not quit, so tell main
+to not call ui::main. This happens when a
+map is loaded from command line and require
+a restart because of wrong format.
+Delete this when the code to not have to
+restart to load another format is merged. */
+bool g_dontStart = false;
+
int main( int argc, char* argv[] ){
#if GTK_TARGET == 3
// HACK: force legacy GL backend as we don't support GL3 yet
remove_local_pid();
- ui::main();
+ /* HACK: If ui::main is not called yet,
+ gtk_main_quit will not quit, so tell main
+ to not call ui::main. This happens when a
+ map is loaded from command line and require
+ a restart because of wrong format.
+ Delete this when the code to not have to
+ restart to load another format is merged. */
+ if ( !g_dontStart )
+ {
+ ui::main();
+ }
// avoid saving prefs when the app is minimized
if ( g_pParentWnd->IsSleeping() ) {
void GLWindow_Destroy(){
}
+/* HACK: If ui::main is not called yet,
+gtk_main_quit will not quit, so tell main
+to not call ui::main. This happens when a
+map is loaded from command line and require
+a restart because of wrong format.
+Delete this when the code to not have to
+restart to load another format is merged. */
+extern bool g_dontStart;
+
void Radiant_Restart(){
// preferences are expected to be already saved in any way
// this is just to be sure and be future proof
// quit if radiant successfully started
if ( status == 0 ) {
gtk_main_quit();
+ /* HACK: If ui::main is not called yet,
+ gtk_main_quit will not quit, so tell main
+ to not call ui::main. This happens when a
+ map is loaded from command line and require
+ a restart because of wrong format.
+ Delete this when the code to not have to
+ restart to load another format is merged. */
+ g_dontStart = true;
}
}
MRU_AddFile( filename );
g_strLastMapFolder = g_path_get_dirname( filename );
+ bool switch_format = false;
+
{
ScopeTimer timer( "map load" );
if ( !format->wrongFormat ) {
break;
}
+ switch_format = !switch_format;
}
}
Map_StartPosition();
g_currentMap = &g_map;
+
+ Brush_switchFormat( switch_format );
}
class Excluder
g_restart_required.push_back( staticName );
}
-void PreferencesDialog_showDialog(){
- if ( ConfirmModified( "Edit Preferences" ) && g_Preferences.DoModal() == eIDOK ) {
- if ( !g_restart_required.empty() ) {
- StringOutputStream message( 256 );
- message << "Preference changes require a restart:\n\n";
+bool PreferencesDialog_isRestartRequired(){
+ return !g_restart_required.empty();
+}
- for ( std::vector<const char*>::iterator i = g_restart_required.begin(); i != g_restart_required.end(); ++i )
- {
- message << ( *i ) << '\n';
- }
+void PreferencesDialog_restartIfRequired(){
+ if ( !g_restart_required.empty() ) {
+ StringOutputStream message( 256 );
+ message << "Preference changes require a restart:\n\n";
+
+ for ( std::vector<const char*>::iterator i = g_restart_required.begin(); i != g_restart_required.end(); ++i )
+ {
+ message << ( *i ) << '\n';
+ }
- message << "\nRestart now?";
+ message << "\nRestart now?";
- auto ret = ui::alert( MainFrame_getWindow(), message.c_str(), "Restart " RADIANT_NAME "?", ui::alert_type::YESNO, ui::alert_icon::Question );
+ auto ret = ui::alert( MainFrame_getWindow(), message.c_str(), "Restart " RADIANT_NAME "?", ui::alert_type::YESNO, ui::alert_icon::Question );
- g_restart_required.clear();
+ g_restart_required.clear();
- if ( ret == ui::alert_response::YES ) {
- g_GamesDialog.m_bSkipGamePromptOnce = true;
- Radiant_Restart();
- }
+ if ( ret == ui::alert_response::YES ) {
+ g_GamesDialog.m_bSkipGamePromptOnce = true;
+ Radiant_Restart();
}
}
}
+void PreferencesDialog_showDialog(){
+ if ( ConfirmModified( "Edit Preferences" ) && g_Preferences.DoModal() == eIDOK ) {
+ PreferencesDialog_restartIfRequired();
+ }
+}
+
struct GameName {
static void Export(const Callback<void(const char *)> &returnz) {
returnz(gamename_get());
void PreferencesDialog_addSettingsPreferences( const PreferencesPageCallback& callback );
void PreferencesDialog_addSettingsPage( const PreferenceGroupCallback& callback );
+bool PreferencesDialog_isRestartRequired();
void PreferencesDialog_restartRequired( const char* staticName );
template<typename Value>
void PreferencesDialog_constructWindow( ui::Window main_window );
void PreferencesDialog_destroyWindow();
+
+void PreferencesDialog_restartIfRequired();
void PreferencesDialog_showDialog();
void GlobalPreferences_Init();