From 5a8c6342ea50d54911bac74a1d6d6bfa531550f0 Mon Sep 17 00:00:00 2001 From: MaxED Date: Sat, 30 Apr 2016 19:27:26 +0000 Subject: [PATCH] Fixed, Script Editor: fixed a crash triggered by creating a new tab, then closing script editor. Fixed, Sectors mode: tags and effect labels were displayed instead of selection number labels after disabling, then enabling selection numbers when there were sectors with tags or effects selected. --- Source/Core/Controls/ScriptEditorPanel.cs | 10 ++++++++-- .../BuilderModes/ClassicModes/BaseClassicMode.cs | 3 +++ .../Plugins/BuilderModes/ClassicModes/SectorsMode.cs | 6 ++++++ Source/Plugins/BuilderModes/Interface/MenusForm.cs | 10 ++++++++++ 4 files changed, 27 insertions(+), 2 deletions(-) diff --git a/Source/Core/Controls/ScriptEditorPanel.cs b/Source/Core/Controls/ScriptEditorPanel.cs index 23f13acc..dd5e3065 100644 --- a/Source/Core/Controls/ScriptEditorPanel.cs +++ b/Source/Core/Controls/ScriptEditorPanel.cs @@ -466,9 +466,15 @@ namespace CodeImp.DoomBuilder.Controls foreach(ScriptDocumentTab t in tabs.TabPages) //mxd { if(t.ExplicitSave) - General.Map.Options.ScriptFileSettings.Add(t.Filename, t.GetViewSettings()); + { + // Don't store tabs, which were never saved (this only happens when a new tab was created and no text was entered into it before closing the script editor) + if(!t.IsSaveAsRequired) + General.Map.Options.ScriptFileSettings[t.Filename] = t.GetViewSettings(); + } else - General.Map.Options.ScriptLumpSettings.Add(t.Filename, t.GetViewSettings()); + { + General.Map.Options.ScriptLumpSettings[t.Filename] = t.GetViewSettings(); + } } } diff --git a/Source/Plugins/BuilderModes/ClassicModes/BaseClassicMode.cs b/Source/Plugins/BuilderModes/ClassicModes/BaseClassicMode.cs index cb02ae05..ffb464a6 100644 --- a/Source/Plugins/BuilderModes/ClassicModes/BaseClassicMode.cs +++ b/Source/Plugins/BuilderModes/ClassicModes/BaseClassicMode.cs @@ -269,6 +269,9 @@ namespace CodeImp.DoomBuilder.BuilderModes General.Map.Map.EndAddRemove(); //mxd } + + public virtual void OnViewSelectionNumbersChanged(bool enabled) { } //mxd + public virtual void OnViewSelectionEffectsChanged(bool enabled) { } //mxd #endregion diff --git a/Source/Plugins/BuilderModes/ClassicModes/SectorsMode.cs b/Source/Plugins/BuilderModes/ClassicModes/SectorsMode.cs index 24a9d5f3..205b2de7 100644 --- a/Source/Plugins/BuilderModes/ClassicModes/SectorsMode.cs +++ b/Source/Plugins/BuilderModes/ClassicModes/SectorsMode.cs @@ -1394,6 +1394,12 @@ namespace CodeImp.DoomBuilder.BuilderModes base.OnRedoEnd(); //mxd } + //mxd + public override void OnViewSelectionNumbersChanged(bool enabled) + { + if(enabled) UpdateSelectedLabels(); + } + //mxd public override void ToggleHighlight() { diff --git a/Source/Plugins/BuilderModes/Interface/MenusForm.cs b/Source/Plugins/BuilderModes/Interface/MenusForm.cs index 8eb00abe..25465dc6 100644 --- a/Source/Plugins/BuilderModes/Interface/MenusForm.cs +++ b/Source/Plugins/BuilderModes/Interface/MenusForm.cs @@ -223,6 +223,11 @@ namespace CodeImp.DoomBuilder.BuilderModes private void buttonselectionnumbers_Click(object sender, EventArgs e) { BuilderPlug.Me.ViewSelectionNumbers = buttonselectionnumbers.Checked; + + //mxd. Notify current mode + BaseClassicMode mode = General.Editing.Mode as BaseClassicMode; + if(mode != null) mode.OnViewSelectionNumbersChanged(BuilderPlug.Me.ViewSelectionNumbers); + General.Interface.RedrawDisplay(); General.Interface.DisplayStatus(StatusType.Info, (buttonselectionnumbers.Checked ? "Show selection numbers" : @@ -233,6 +238,11 @@ namespace CodeImp.DoomBuilder.BuilderModes private void buttonselectioneffects_Click(object sender, EventArgs e) { BuilderPlug.Me.ViewSelectionEffects = buttonselectioneffects.Checked; + + // Notify current mode + BaseClassicMode mode = General.Editing.Mode as BaseClassicMode; + if(mode != null) mode.OnViewSelectionEffectsChanged(BuilderPlug.Me.ViewSelectionEffects); + General.Interface.RedrawDisplay(); General.Interface.DisplayStatus(StatusType.Info, (buttonselectioneffects.Checked ? "Show sector tags and effects" :