From 9b446458c4a4355b2ae4f1007eb30720fe543e13 Mon Sep 17 00:00:00 2001 From: codeimp Date: Wed, 13 May 2009 22:46:03 +0000 Subject: [PATCH] Resources are now only reloaded when needed due to changing resource related settings on the Game Configurations dialog --- Source/Core/Windows/ConfigForm.cs | 18 +++++++++++++++++- Source/Core/Windows/MainForm.cs | 2 +- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/Source/Core/Windows/ConfigForm.cs b/Source/Core/Windows/ConfigForm.cs index 74541176..b9ca13e1 100644 --- a/Source/Core/Windows/ConfigForm.cs +++ b/Source/Core/Windows/ConfigForm.cs @@ -41,7 +41,12 @@ namespace CodeImp.DoomBuilder.Windows private GameConfiguration gameconfig; private ConfigurationInfo configinfo; private List copiedsets; - + private bool preventchanges = false; + private bool reloadresources = false; + + // Properties + public bool ReloadResources { get { return reloadresources; } } + // Constructor public ConfigForm() { @@ -105,6 +110,8 @@ namespace CodeImp.DoomBuilder.Windows { // Enable panels tabs.Enabled = true; + + preventchanges = true; // Get config info of selected item configinfo = listconfigs.SelectedItems[0].Tag as ConfigurationInfo; @@ -184,6 +191,9 @@ namespace CodeImp.DoomBuilder.Windows EditModeInfo emi = (lvi.Tag as EditModeInfo); lvi.Checked = (configinfo.EditModes.ContainsKey(emi.Type.FullName) && configinfo.EditModes[emi.Type.FullName]); } + + // Done + preventchanges = false; } } @@ -226,6 +236,7 @@ namespace CodeImp.DoomBuilder.Windows // Apply to selected configuration configinfo.Resources.Clear(); configinfo.Resources.AddRange(configdata.GetResources()); + if(!preventchanges) reloadresources = true; } // Nodebuilder selection changed @@ -404,6 +415,7 @@ namespace CodeImp.DoomBuilder.Windows item.Tag = s; item.ImageIndex = 0; listtextures.Sort(); + reloadresources = true; } } @@ -419,6 +431,7 @@ namespace CodeImp.DoomBuilder.Windows form.ShowDialog(this); listtextures.SelectedItems[0].Text = s.Name; listtextures.Sort(); + reloadresources = true; } } @@ -432,6 +445,7 @@ namespace CodeImp.DoomBuilder.Windows DefinedTextureSet s = (listtextures.SelectedItems[0].Tag as DefinedTextureSet); configinfo.TextureSets.Remove(s); listtextures.SelectedItems[0].Remove(); + reloadresources = true; } } @@ -479,6 +493,7 @@ namespace CodeImp.DoomBuilder.Windows configinfo.TextureSets.Add(s); } listtextures.Sort(); + reloadresources = true; } } @@ -499,6 +514,7 @@ namespace CodeImp.DoomBuilder.Windows configinfo.TextureSets.Add(s); } listtextures.Sort(); + reloadresources = true; } } diff --git a/Source/Core/Windows/MainForm.cs b/Source/Core/Windows/MainForm.cs index b907ab75..def56d54 100644 --- a/Source/Core/Windows/MainForm.cs +++ b/Source/Core/Windows/MainForm.cs @@ -1965,7 +1965,7 @@ namespace CodeImp.DoomBuilder.Windows General.Plugins.ProgramReconfigure(); // Reload resources if a map is open - if(General.Map != null) General.Actions.InvokeAction("builder_reloadresources"); + if((General.Map != null) && cfgform.ReloadResources) General.Actions.InvokeAction("builder_reloadresources"); // Redraw display RedrawDisplay();