Reload resources if a global script was changed

This commit is contained in:
MascaraSnake 2016-03-03 16:29:46 +01:00
parent 40ebb654a3
commit c9bf195778
2 changed files with 41 additions and 0 deletions

View file

@ -132,6 +132,9 @@ namespace CodeImp.DoomBuilder.Controls
editor.SetSavePoint(); //mxd
UpdateTitle(); //mxd
panel.Reload = true;
return true;
}

View file

@ -55,6 +55,7 @@ namespace CodeImp.DoomBuilder.Controls
private ScriptStatusInfo status;
private int statusflashcount;
private bool statusflashicon;
private bool reload;
#endregion
@ -62,6 +63,8 @@ namespace CodeImp.DoomBuilder.Controls
public ScriptDocumentTab ActiveTab { get { return (tabs.SelectedTab as ScriptDocumentTab); } }
public bool Reload { get { return reload; } set { reload = value; } }
#endregion
#region ================== Constructor
@ -75,6 +78,7 @@ namespace CodeImp.DoomBuilder.Controls
// This initializes the control
public void Initialize()
{
reload = false;
// Make list of script configs
scriptconfigs = new List<ScriptConfiguration>(General.ScriptConfigs.Values);
scriptconfigs.Add(new ScriptConfiguration());
@ -467,6 +471,12 @@ namespace CodeImp.DoomBuilder.Controls
}
}
if (Reload)
{
General.Map.ReloadResources();
Reload = false;
}
return true;
}
@ -528,6 +538,12 @@ namespace CodeImp.DoomBuilder.Controls
if (!t.ExplicitSave) t.Save();
}
if (Reload)
{
General.Map.ReloadResources();
Reload = false;
}
UpdateToolbar(false);
}
@ -865,6 +881,11 @@ namespace CodeImp.DoomBuilder.Controls
// Save the current script
ScriptDocumentTab t = (tabs.SelectedTab as ScriptDocumentTab);
SaveScript(t);
if (Reload)
{
General.Map.ReloadResources();
Reload = false;
}
UpdateToolbar(true);
}
@ -881,6 +902,12 @@ namespace CodeImp.DoomBuilder.Controls
}
}
if (Reload)
{
General.Map.ReloadResources();
Reload = false;
}
UpdateToolbar(true);
}
@ -921,6 +948,11 @@ namespace CodeImp.DoomBuilder.Controls
{
ScriptDocumentTab t = (tabs.SelectedTab as ScriptDocumentTab);
CloseScript(t, false);
if (Reload)
{
General.Map.ReloadResources();
Reload = false;
}
UpdateToolbar(true);
}
@ -952,6 +984,12 @@ namespace CodeImp.DoomBuilder.Controls
if (!SaveScript(t)) return;
}
if (Reload)
{
General.Map.ReloadResources();
Reload = false;
}
// Compile now
DisplayStatus(ScriptStatusType.Busy, "Compiling script \"" + t.Title + "\"...");
Cursor.Current = Cursors.WaitCursor;