Slope Mode, Draw Slopes Mode: both modes are now deprecated as they are superseded by visual sloping. The modes will be removed in the future. Entering the modes will add a warning to the Errors And Warnings dialog

This commit is contained in:
biwa 2021-03-21 21:19:14 +01:00
parent 72085284fe
commit 58c476f4e5
7 changed files with 26 additions and 8 deletions

View file

@ -43,6 +43,8 @@ namespace CodeImp.DoomBuilder.Editing
private bool usebydefault; private bool usebydefault;
private bool safestartmode; private bool safestartmode;
private string[] supportedmapformats; //mxd private string[] supportedmapformats; //mxd
private bool isdeprecated = false;
private string deprecationmessage = string.Empty;
#endregion #endregion
@ -115,6 +117,16 @@ namespace CodeImp.DoomBuilder.Editing
/// </summary> /// </summary>
public string[] SupportedMapFormats { get { return supportedmapformats; } set { supportedmapformats = value; } } public string[] SupportedMapFormats { get { return supportedmapformats; } set { supportedmapformats = value; } }
/// <summary>
/// When set to true the DeprecationMessage will be shown as a warning in the errors and warnings dialog
/// </summary>
public bool IsDeprecated { get { return isdeprecated; } set { isdeprecated = value; } }
/// <summary>
/// Message to be shown as a warning in the errors and warnings dialog when IsDeprecated is true
/// </summary>
public string DeprecationMessage { get { return deprecationmessage; } set { deprecationmessage = value; } }
#endregion #endregion
#region ================== Constructor / Disposer #region ================== Constructor / Disposer

View file

@ -91,7 +91,7 @@ namespace CodeImp.DoomBuilder.Editing
if(stream != null) if(stream != null)
{ {
buttonimage = Image.FromStream(stream); buttonimage = Image.FromStream(stream);
buttondesc = attr.DisplayName; buttondesc = attr.DisplayName + (attribs.IsDeprecated ? " (deprecated)" : "");
buttonorder = attr.ButtonOrder; buttonorder = attr.ButtonOrder;
} }
} }

View file

@ -367,6 +367,9 @@ namespace CodeImp.DoomBuilder.Editing
// Engage new mode // Engage new mode
if(newmode != null) if(newmode != null)
{ {
if (newmode.Attributes.IsDeprecated)
General.ErrorLogger.Add(ErrorType.Warning, "The editing mode \"" + newmode.Attributes.DisplayName + "\" is deprecated and will be removed in the future. " + newmode.Attributes.DeprecationMessage);
newmode.OnEngage(); newmode.OnEngage();
General.Plugins.OnEditEngage(oldmode, newmode); General.Plugins.OnEditEngage(oldmode, newmode);
} }

View file

@ -88,7 +88,7 @@ namespace CodeImp.DoomBuilder.Windows
// Is this mode selectable by the user? // Is this mode selectable by the user?
if(emi.IsOptional) if(emi.IsOptional)
{ {
lvi = listmodes.Items.Add(emi.Attributes.DisplayName); lvi = listmodes.Items.Add(emi.Attributes.DisplayName + (emi.Attributes.IsDeprecated ? " (deprecated)" : ""));
lvi.Tag = emi; lvi.Tag = emi;
lvi.SubItems.Add(emi.Plugin.Plug.Name); lvi.SubItems.Add(emi.Plugin.Plug.Name);
lvi.UseItemStyleForSubItems = true; //mxd lvi.UseItemStyleForSubItems = true; //mxd
@ -199,14 +199,14 @@ namespace CodeImp.DoomBuilder.Windows
if(emi.Attributes.SupportedMapFormats != null && if(emi.Attributes.SupportedMapFormats != null &&
Array.IndexOf(emi.Attributes.SupportedMapFormats, gameconfig.FormatInterface) == -1) Array.IndexOf(emi.Attributes.SupportedMapFormats, gameconfig.FormatInterface) == -1)
{ {
lvi.Text = emi.Attributes.DisplayName + " (map format not supported)"; lvi.Text = emi.Attributes.DisplayName + " (map format not supported" + (emi.Attributes.IsDeprecated ? ", deprecated" : "") + ")";
lvi.ForeColor = SystemColors.GrayText; lvi.ForeColor = SystemColors.GrayText;
lvi.BackColor = SystemColors.InactiveBorder; lvi.BackColor = SystemColors.InactiveBorder;
lvi.Checked = false; lvi.Checked = false;
} }
else else
{ {
lvi.Text = emi.Attributes.DisplayName; lvi.Text = emi.Attributes.DisplayName + (emi.Attributes.IsDeprecated ? " (deprecated)" : "");
lvi.ForeColor = SystemColors.WindowText; lvi.ForeColor = SystemColors.WindowText;
lvi.BackColor = SystemColors.Window; lvi.BackColor = SystemColors.Window;
lvi.Checked = (configinfo.EditModes.ContainsKey(emi.Type.FullName) && configinfo.EditModes[emi.Type.FullName]); lvi.Checked = (configinfo.EditModes.ContainsKey(emi.Type.FullName) && configinfo.EditModes[emi.Type.FullName]);

View file

@ -299,7 +299,7 @@ namespace CodeImp.DoomBuilder.Windows
if(General.Editing.Mode != null) if(General.Editing.Mode != null)
{ {
General.MainWindow.CheckEditModeButton(General.Editing.Mode.EditModeButtonName); General.MainWindow.CheckEditModeButton(General.Editing.Mode.EditModeButtonName);
General.MainWindow.DisplayModeName(General.Editing.Mode.Attributes.DisplayName); General.MainWindow.DisplayModeName(General.Editing.Mode.Attributes.DisplayName + (General.Editing.Mode.Attributes.IsDeprecated ? " (deprecated)" : ""));
} }
else else
{ {

View file

@ -50,8 +50,9 @@ namespace CodeImp.DoomBuilder.ThreeDFloorMode
SupportedMapFormats = new[] { "UniversalMapSetIO" }, SupportedMapFormats = new[] { "UniversalMapSetIO" },
Volatile = true, Volatile = true,
UseByDefault = true, UseByDefault = true,
Optional = false)] Optional = false,
IsDeprecated = true,
DeprecationMessage = "Please use the visual sloping functionality instead.")]
public class DrawSlopesMode : ClassicMode public class DrawSlopesMode : ClassicMode
{ {
#region ================== Constants #region ================== Constants

View file

@ -63,7 +63,9 @@ namespace CodeImp.DoomBuilder.ThreeDFloorMode
ButtonGroup = "000_editing", ButtonGroup = "000_editing",
SupportedMapFormats = new[] { "UniversalMapSetIO" }, SupportedMapFormats = new[] { "UniversalMapSetIO" },
UseByDefault = true, UseByDefault = true,
SafeStartMode = true)] SafeStartMode = true,
IsDeprecated = true,
DeprecationMessage = "Please use the visual sloping functionality instead.")]
public class SlopeMode : ClassicMode public class SlopeMode : ClassicMode
{ {