mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2024-11-27 06:02:11 +00:00
more on selectable editing modes
This commit is contained in:
parent
6e67dba0d4
commit
e135c279eb
22 changed files with 165 additions and 87 deletions
|
@ -99,7 +99,7 @@
|
||||||
<DesignTime>True</DesignTime>
|
<DesignTime>True</DesignTime>
|
||||||
<DependentUpon>Resources.resx</DependentUpon>
|
<DependentUpon>Resources.resx</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<None Include="Testing\TriangulatorMode.cs" />
|
<Compile Include="Testing\TriangulatorMode.cs" />
|
||||||
<Compile Include="ClassicModes\DragThingsMode.cs" />
|
<Compile Include="ClassicModes\DragThingsMode.cs" />
|
||||||
<Compile Include="General\LineLengthLabel.cs" />
|
<Compile Include="General\LineLengthLabel.cs" />
|
||||||
<Compile Include="VisualModes\BaseVisualMode.cs" />
|
<Compile Include="VisualModes\BaseVisualMode.cs" />
|
||||||
|
@ -110,7 +110,7 @@
|
||||||
<Compile Include="VisualModes\VisualFloor.cs" />
|
<Compile Include="VisualModes\VisualFloor.cs" />
|
||||||
<Compile Include="VisualModes\VisualLower.cs" />
|
<Compile Include="VisualModes\VisualLower.cs" />
|
||||||
<Compile Include="VisualModes\VisualMiddle.cs" />
|
<Compile Include="VisualModes\VisualMiddle.cs" />
|
||||||
<None Include="Testing\WAuthorMode.cs" />
|
<Compile Include="Testing\WAuthorMode.cs" />
|
||||||
<Compile Include="Testing\WAuthorTools.cs">
|
<Compile Include="Testing\WAuthorTools.cs">
|
||||||
<SubType>Form</SubType>
|
<SubType>Form</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
|
|
@ -40,10 +40,10 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
{
|
{
|
||||||
[EditMode(DisplayName = "Brightness Mode",
|
[EditMode(DisplayName = "Brightness Mode",
|
||||||
SwitchAction = "brightnessmode",
|
SwitchAction = "brightnessmode",
|
||||||
ButtonDesc = "Brightness Mode",
|
|
||||||
ButtonImage = "BrightnessMode.png",
|
ButtonImage = "BrightnessMode.png",
|
||||||
ButtonOrder = int.MinValue + 201,
|
ButtonOrder = int.MinValue + 201,
|
||||||
AllowCopyPaste = false)]
|
AllowCopyPaste = false,
|
||||||
|
UseByDefault = true)]
|
||||||
|
|
||||||
public sealed class BrightnessMode : BaseClassicMode
|
public sealed class BrightnessMode : BaseClassicMode
|
||||||
{
|
{
|
||||||
|
|
|
@ -37,9 +37,11 @@ using CodeImp.DoomBuilder.Actions;
|
||||||
|
|
||||||
namespace CodeImp.DoomBuilder.BuilderModes
|
namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
{
|
{
|
||||||
[EditMode(DisplayName = "Drawing",
|
[EditMode(DisplayName = "Drawing Mode",
|
||||||
SwitchAction = "drawlinesmode",
|
SwitchAction = "drawlinesmode",
|
||||||
Volatile = true)]
|
Volatile = true,
|
||||||
|
UseByDefault = true,
|
||||||
|
Optional = false)]
|
||||||
|
|
||||||
public class DrawGeometryMode : BaseClassicMode
|
public class DrawGeometryMode : BaseClassicMode
|
||||||
{
|
{
|
||||||
|
|
|
@ -39,9 +39,11 @@ using System.Drawing;
|
||||||
|
|
||||||
namespace CodeImp.DoomBuilder.BuilderModes
|
namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
{
|
{
|
||||||
[EditMode(DisplayName = "Edit Selection",
|
[EditMode(DisplayName = "Edit Selection Mode",
|
||||||
SwitchAction = "editselectionmode", // Action name used to switch to this mode
|
SwitchAction = "editselectionmode", // Action name used to switch to this mode
|
||||||
Volatile = true)]
|
Volatile = true,
|
||||||
|
UseByDefault = true,
|
||||||
|
Optional = false)]
|
||||||
|
|
||||||
public class EditSelectionMode : BaseClassicMode
|
public class EditSelectionMode : BaseClassicMode
|
||||||
{
|
{
|
||||||
|
|
|
@ -36,9 +36,10 @@ using CodeImp.DoomBuilder.Editing;
|
||||||
|
|
||||||
namespace CodeImp.DoomBuilder.BuilderModes
|
namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
{
|
{
|
||||||
[EditMode(DisplayName = "Map Analysis",
|
[EditMode(DisplayName = "Map Analysis Mode",
|
||||||
SwitchAction = "errorcheckmode",
|
SwitchAction = "errorcheckmode",
|
||||||
Volatile = true)]
|
Volatile = true,
|
||||||
|
UseByDefault = true)]
|
||||||
|
|
||||||
public sealed class ErrorCheckMode : BaseClassicMode
|
public sealed class ErrorCheckMode : BaseClassicMode
|
||||||
{
|
{
|
||||||
|
|
|
@ -36,9 +36,10 @@ using CodeImp.DoomBuilder.Editing;
|
||||||
|
|
||||||
namespace CodeImp.DoomBuilder.BuilderModes
|
namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
{
|
{
|
||||||
[EditMode(DisplayName = "Find & Replace",
|
[EditMode(DisplayName = "Find & Replace Mode",
|
||||||
SwitchAction = "findmode",
|
SwitchAction = "findmode",
|
||||||
Volatile = true)]
|
Volatile = true,
|
||||||
|
UseByDefault = true)]
|
||||||
|
|
||||||
public sealed class FindReplaceMode : BaseClassicMode
|
public sealed class FindReplaceMode : BaseClassicMode
|
||||||
{
|
{
|
||||||
|
|
|
@ -38,11 +38,11 @@ using CodeImp.DoomBuilder.Config;
|
||||||
|
|
||||||
namespace CodeImp.DoomBuilder.BuilderModes
|
namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
{
|
{
|
||||||
[EditMode(DisplayName = "Linedefs",
|
[EditMode(DisplayName = "Linedefs Mode",
|
||||||
SwitchAction = "linedefsmode", // Action name used to switch to this mode
|
SwitchAction = "linedefsmode", // Action name used to switch to this mode
|
||||||
ButtonDesc = "Linedefs Mode", // Description on the button in toolbar/menu
|
|
||||||
ButtonImage = "LinesMode.png", // Image resource name for the button
|
ButtonImage = "LinesMode.png", // Image resource name for the button
|
||||||
ButtonOrder = int.MinValue + 100)] // Position of the button (lower is more to the left)
|
ButtonOrder = int.MinValue + 100, // Position of the button (lower is more to the left)
|
||||||
|
UseByDefault = true)]
|
||||||
|
|
||||||
public class LinedefsMode : BaseClassicMode
|
public class LinedefsMode : BaseClassicMode
|
||||||
{
|
{
|
||||||
|
|
|
@ -37,11 +37,11 @@ using CodeImp.DoomBuilder.Actions;
|
||||||
|
|
||||||
namespace CodeImp.DoomBuilder.BuilderModes
|
namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
{
|
{
|
||||||
[EditMode(DisplayName = "Make Sectors",
|
[EditMode(DisplayName = "Make Sectors Mode",
|
||||||
SwitchAction = "makesectormode",
|
SwitchAction = "makesectormode",
|
||||||
ButtonDesc = "Make Sectors Mode", // Description on the button in toolbar/menu
|
|
||||||
ButtonImage = "NewSector2.png", // Image resource name for the button
|
ButtonImage = "NewSector2.png", // Image resource name for the button
|
||||||
ButtonOrder = int.MinValue + 202)] // Position of the button (lower is more to the left)
|
ButtonOrder = int.MinValue + 202, // Position of the button (lower is more to the left)
|
||||||
|
UseByDefault = true)]
|
||||||
|
|
||||||
public class MakeSectorMode : BaseClassicMode
|
public class MakeSectorMode : BaseClassicMode
|
||||||
{
|
{
|
||||||
|
|
|
@ -39,11 +39,11 @@ using CodeImp.DoomBuilder.BuilderModes.Interface;
|
||||||
|
|
||||||
namespace CodeImp.DoomBuilder.BuilderModes
|
namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
{
|
{
|
||||||
[EditMode(DisplayName = "Sectors",
|
[EditMode(DisplayName = "Sectors Mode",
|
||||||
SwitchAction = "sectorsmode", // Action name used to switch to this mode
|
SwitchAction = "sectorsmode", // Action name used to switch to this mode
|
||||||
ButtonDesc = "Sectors Mode", // Description on the button in toolbar/menu
|
|
||||||
ButtonImage = "SectorsMode.png", // Image resource name for the button
|
ButtonImage = "SectorsMode.png", // Image resource name for the button
|
||||||
ButtonOrder = int.MinValue + 200)] // Position of the button (lower is more to the left)
|
ButtonOrder = int.MinValue + 200, // Position of the button (lower is more to the left)
|
||||||
|
UseByDefault = true)]
|
||||||
|
|
||||||
public class SectorsMode : BaseClassicMode
|
public class SectorsMode : BaseClassicMode
|
||||||
{
|
{
|
||||||
|
|
|
@ -38,11 +38,11 @@ using CodeImp.DoomBuilder.Types;
|
||||||
|
|
||||||
namespace CodeImp.DoomBuilder.BuilderModes
|
namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
{
|
{
|
||||||
[EditMode(DisplayName = "Things",
|
[EditMode(DisplayName = "Things Mode",
|
||||||
SwitchAction = "thingsmode", // Action name used to switch to this mode
|
SwitchAction = "thingsmode", // Action name used to switch to this mode
|
||||||
ButtonDesc = "Things Mode", // Description on the button in toolbar/menu
|
|
||||||
ButtonImage = "ThingsMode.png", // Image resource name for the button
|
ButtonImage = "ThingsMode.png", // Image resource name for the button
|
||||||
ButtonOrder = int.MinValue + 300)] // Position of the button (lower is more to the left)
|
ButtonOrder = int.MinValue + 300, // Position of the button (lower is more to the left)
|
||||||
|
UseByDefault = true)]
|
||||||
|
|
||||||
public class ThingsMode : BaseClassicMode
|
public class ThingsMode : BaseClassicMode
|
||||||
{
|
{
|
||||||
|
|
|
@ -36,11 +36,11 @@ using CodeImp.DoomBuilder.Actions;
|
||||||
|
|
||||||
namespace CodeImp.DoomBuilder.BuilderModes
|
namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
{
|
{
|
||||||
[EditMode(DisplayName = "Vertices",
|
[EditMode(DisplayName = "Vertices Mode",
|
||||||
SwitchAction = "verticesmode", // Action name used to switch to this mode
|
SwitchAction = "verticesmode", // Action name used to switch to this mode
|
||||||
ButtonDesc = "Vertices Mode", // Description on the button in toolbar/menu
|
|
||||||
ButtonImage = "VerticesMode.png", // Image resource name for the button
|
ButtonImage = "VerticesMode.png", // Image resource name for the button
|
||||||
ButtonOrder = int.MinValue + 0)] // Position of the button (lower is more to the left)
|
ButtonOrder = int.MinValue + 0, // Position of the button (lower is more to the left)
|
||||||
|
UseByDefault = true)]
|
||||||
|
|
||||||
public class VerticesMode : BaseClassicMode
|
public class VerticesMode : BaseClassicMode
|
||||||
{
|
{
|
||||||
|
|
|
@ -39,8 +39,8 @@ namespace CodeImp.DoomBuilder.BuilderModes.Editing
|
||||||
{
|
{
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
|
|
||||||
[EditMode(SwitchAction = "triangulatormode", // Action name used to switch to this mode
|
[EditMode(DisplayName = "Triangulator Mode",
|
||||||
ButtonDesc = "Triangulator Mode", // Description on the button in toolbar/menu
|
SwitchAction = "triangulatormode", // Action name used to switch to this mode
|
||||||
ButtonImage = "TriangulatorMode.png", // Image resource name for the button
|
ButtonImage = "TriangulatorMode.png", // Image resource name for the button
|
||||||
ButtonOrder = int.MaxValue)] // Position of the button (lower is more to the left)
|
ButtonOrder = int.MaxValue)] // Position of the button (lower is more to the left)
|
||||||
|
|
||||||
|
|
|
@ -36,8 +36,10 @@ using CodeImp.DoomBuilder.Actions;
|
||||||
|
|
||||||
namespace CodeImp.DoomBuilder.BuilderModes.Editing
|
namespace CodeImp.DoomBuilder.BuilderModes.Editing
|
||||||
{
|
{
|
||||||
[EditMode(SwitchAction = "wauthormode",
|
#if DEBUG
|
||||||
ButtonDesc = "WadAuthor Mode",
|
|
||||||
|
[EditMode(DisplayName = "WadAuthor Mode",
|
||||||
|
SwitchAction = "wauthormode",
|
||||||
ButtonImage = "WAuthor.png",
|
ButtonImage = "WAuthor.png",
|
||||||
ButtonOrder = int.MinValue + 4)]
|
ButtonOrder = int.MinValue + 4)]
|
||||||
|
|
||||||
|
@ -385,4 +387,6 @@ namespace CodeImp.DoomBuilder.BuilderModes.Editing
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,9 +39,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
{
|
{
|
||||||
[EditMode(DisplayName = "Visual Mode",
|
[EditMode(DisplayName = "Visual Mode",
|
||||||
SwitchAction = "visualmode", // Action name used to switch to this mode
|
SwitchAction = "visualmode", // Action name used to switch to this mode
|
||||||
ButtonDesc = "Visual Mode", // Description on the button in toolbar/menu
|
|
||||||
ButtonImage = "VisualMode.png", // Image resource name for the button
|
ButtonImage = "VisualMode.png", // Image resource name for the button
|
||||||
ButtonOrder = 0)] // Position of the button (lower is more to the left)
|
ButtonOrder = 0, // Position of the button (lower is more to the left)
|
||||||
|
UseByDefault = true)]
|
||||||
|
|
||||||
public class BaseVisualMode : VisualMode
|
public class BaseVisualMode : VisualMode
|
||||||
{
|
{
|
||||||
|
|
|
@ -25,6 +25,7 @@ using CodeImp.DoomBuilder.IO;
|
||||||
using CodeImp.DoomBuilder.Data;
|
using CodeImp.DoomBuilder.Data;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using CodeImp.DoomBuilder.Editing;
|
using CodeImp.DoomBuilder.Editing;
|
||||||
|
using System.Collections.Specialized;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -32,6 +33,13 @@ namespace CodeImp.DoomBuilder.Config
|
||||||
{
|
{
|
||||||
internal class ConfigurationInfo : IComparable<ConfigurationInfo>
|
internal class ConfigurationInfo : IComparable<ConfigurationInfo>
|
||||||
{
|
{
|
||||||
|
#region ================== Constants
|
||||||
|
|
||||||
|
private const string MODE_DISABLED_KEY = "disabled";
|
||||||
|
private const string MODE_ENABLED_KEY = "enabled";
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region ================== Variables
|
#region ================== Variables
|
||||||
|
|
||||||
private string name;
|
private string name;
|
||||||
|
@ -47,7 +55,7 @@ namespace CodeImp.DoomBuilder.Config
|
||||||
private int testskill;
|
private int testskill;
|
||||||
private List<ThingsFilter> thingsfilters;
|
private List<ThingsFilter> thingsfilters;
|
||||||
private List<DefinedTextureSet> texturesets;
|
private List<DefinedTextureSet> texturesets;
|
||||||
private List<string> editmodes;
|
private Dictionary<string, bool> editmodes;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -65,7 +73,7 @@ namespace CodeImp.DoomBuilder.Config
|
||||||
public bool CustomParameters { get { return customparameters; } set { customparameters = value; } }
|
public bool CustomParameters { get { return customparameters; } set { customparameters = value; } }
|
||||||
internal ICollection<ThingsFilter> ThingsFilters { get { return thingsfilters; } }
|
internal ICollection<ThingsFilter> ThingsFilters { get { return thingsfilters; } }
|
||||||
public List<DefinedTextureSet> TextureSets { get { return texturesets; } }
|
public List<DefinedTextureSet> TextureSets { get { return texturesets; } }
|
||||||
internal List<string> EditModes { get { return editmodes; } }
|
internal Dictionary<string, bool> EditModes { get { return editmodes; } }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -108,11 +116,14 @@ namespace CodeImp.DoomBuilder.Config
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make list of edit modes
|
// Make list of edit modes
|
||||||
this.editmodes = new List<string>();
|
this.editmodes = new Dictionary<string, bool>();
|
||||||
IDictionary modes = General.Settings.ReadSetting("configurations." + settingskey + ".editmodes", new Hashtable());
|
IDictionary modes = General.Settings.ReadSetting("configurations." + settingskey + ".editmodes", new Hashtable());
|
||||||
foreach(DictionaryEntry de in modes)
|
foreach(DictionaryEntry de in modes)
|
||||||
{
|
{
|
||||||
editmodes.Add(de.Value.ToString());
|
if(de.Key.ToString().StartsWith(MODE_ENABLED_KEY))
|
||||||
|
editmodes.Add(de.Value.ToString(), true);
|
||||||
|
else if(de.Key.ToString().StartsWith(MODE_DISABLED_KEY))
|
||||||
|
editmodes.Add(de.Value.ToString(), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -159,10 +170,18 @@ namespace CodeImp.DoomBuilder.Config
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write filters to configuration
|
// Write filters to configuration
|
||||||
for(int i = 0; i < editmodes.Count; i++)
|
ListDictionary modeslist = new ListDictionary();
|
||||||
|
int index = 0;
|
||||||
|
foreach(KeyValuePair<string, bool> em in editmodes)
|
||||||
{
|
{
|
||||||
General.Settings.WriteSetting("configurations." + settingskey + ".editmodes.mode" + i.ToString(CultureInfo.InvariantCulture), editmodes[i]);
|
if(em.Value)
|
||||||
|
modeslist.Add(MODE_ENABLED_KEY + index.ToString(CultureInfo.InvariantCulture), em.Key);
|
||||||
|
else
|
||||||
|
modeslist.Add(MODE_DISABLED_KEY + index.ToString(CultureInfo.InvariantCulture), em.Key);
|
||||||
|
|
||||||
|
index++;
|
||||||
}
|
}
|
||||||
|
General.Settings.WriteSetting("configurations." + settingskey + ".editmodes", modeslist);
|
||||||
}
|
}
|
||||||
|
|
||||||
// String representation
|
// String representation
|
||||||
|
@ -188,7 +207,7 @@ namespace CodeImp.DoomBuilder.Config
|
||||||
ci.testskill = this.testskill;
|
ci.testskill = this.testskill;
|
||||||
ci.texturesets = new List<DefinedTextureSet>();
|
ci.texturesets = new List<DefinedTextureSet>();
|
||||||
foreach(DefinedTextureSet s in this.texturesets) ci.texturesets.Add(s.Copy());
|
foreach(DefinedTextureSet s in this.texturesets) ci.texturesets.Add(s.Copy());
|
||||||
ci.editmodes = new List<string>(this.editmodes);
|
ci.editmodes = new Dictionary<string, bool>(this.editmodes);
|
||||||
return ci;
|
return ci;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -208,17 +227,20 @@ namespace CodeImp.DoomBuilder.Config
|
||||||
this.testskill = ci.testskill;
|
this.testskill = ci.testskill;
|
||||||
this.texturesets = new List<DefinedTextureSet>();
|
this.texturesets = new List<DefinedTextureSet>();
|
||||||
foreach(DefinedTextureSet s in ci.texturesets) this.texturesets.Add(s.Copy());
|
foreach(DefinedTextureSet s in ci.texturesets) this.texturesets.Add(s.Copy());
|
||||||
this.editmodes = new List<string>(ci.editmodes);
|
this.editmodes = new Dictionary<string, bool>(ci.editmodes);
|
||||||
}
|
}
|
||||||
|
|
||||||
// This applies the defaults
|
// This applies the defaults
|
||||||
public void ApplyDefaults()
|
public void ApplyDefaults(GameConfiguration gameconfig)
|
||||||
|
{
|
||||||
|
// We can only apply texture set defaults when the game configuration is specified
|
||||||
|
if(gameconfig != null)
|
||||||
{
|
{
|
||||||
// No texture sets?
|
// No texture sets?
|
||||||
if(texturesets.Count == 0)
|
if(texturesets.Count == 0)
|
||||||
{
|
{
|
||||||
// Copy the default texture sets from the game configuration
|
// Copy the default texture sets from the game configuration
|
||||||
foreach(DefinedTextureSet s in General.Map.Config.TextureSets)
|
foreach(DefinedTextureSet s in gameconfig.TextureSets)
|
||||||
{
|
{
|
||||||
// Add a copy to our list
|
// Add a copy to our list
|
||||||
texturesets.Add(s.Copy());
|
texturesets.Add(s.Copy());
|
||||||
|
@ -226,6 +248,19 @@ namespace CodeImp.DoomBuilder.Config
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Go for all available editing modes
|
||||||
|
foreach(EditModeInfo info in General.Editing.ModesInfo)
|
||||||
|
{
|
||||||
|
// Is this a mode thats is optional?
|
||||||
|
if(info.IsOptional)
|
||||||
|
{
|
||||||
|
// Add if not listed yet
|
||||||
|
if(!editmodes.ContainsKey(info.Type.FullName))
|
||||||
|
editmodes.Add(info.Type.FullName, info.Attributes.UseByDefault);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,12 +39,12 @@ namespace CodeImp.DoomBuilder.Editing
|
||||||
// Properties
|
// Properties
|
||||||
private string switchaction = null;
|
private string switchaction = null;
|
||||||
private string buttonimage = null;
|
private string buttonimage = null;
|
||||||
private string buttondesc = null;
|
|
||||||
private int buttonorder = 0;
|
private int buttonorder = 0;
|
||||||
private bool optional = false;
|
private bool optional = true;
|
||||||
private bool isvolatile = false;
|
private bool isvolatile = false;
|
||||||
private string displayname = "<unnamed mode>";
|
private string displayname = "<unnamed mode>";
|
||||||
private bool allowcopypaste = true;
|
private bool allowcopypaste = true;
|
||||||
|
private bool usebydefault = false;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -63,11 +63,6 @@ namespace CodeImp.DoomBuilder.Editing
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string ButtonImage { get { return buttonimage; } set { buttonimage = value; } }
|
public string ButtonImage { get { return buttonimage; } set { buttonimage = value; } }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Toolbar button and menu item description of this mode.
|
|
||||||
/// </summary>
|
|
||||||
public string ButtonDesc { get { return buttondesc; } set { buttondesc = value; } }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sorting number for the order of buttons on the toolbar. Buttons with
|
/// Sorting number for the order of buttons on the toolbar. Buttons with
|
||||||
/// lower values will be more to the left than buttons with higher values.
|
/// lower values will be more to the left than buttons with higher values.
|
||||||
|
@ -80,6 +75,13 @@ namespace CodeImp.DoomBuilder.Editing
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool Optional { get { return optional; } set { optional = value; } }
|
public bool Optional { get { return optional; } set { optional = value; } }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Set this to true to select this editing mode for use in all game configurations
|
||||||
|
/// by default. This only applies the first time and can still be changed by the user.
|
||||||
|
/// THIS OPTION MAY BE INTRUSIVE TO THE USER, USE WITH GREAT CARE!
|
||||||
|
/// </summary>
|
||||||
|
public bool UseByDefault { get { return usebydefault; } set { usebydefault = value; } }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// When set to true, this mode is cancelled when core actions like
|
/// When set to true, this mode is cancelled when core actions like
|
||||||
/// undo and save are performed. The editing mode should then return to
|
/// undo and save are performed. The editing mode should then return to
|
||||||
|
@ -88,8 +90,8 @@ namespace CodeImp.DoomBuilder.Editing
|
||||||
public bool Volatile { get { return isvolatile; } set { isvolatile = value; } }
|
public bool Volatile { get { return isvolatile; } set { isvolatile = value; } }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Name to display on the button information bar when no specific element
|
/// Name to display in the game configuration editing modes list and on the
|
||||||
/// information is displayed.
|
/// information bar when the mode is currently active.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string DisplayName { get { return displayname; } set { displayname = value; } }
|
public string DisplayName { get { return displayname; } set { displayname = value; } }
|
||||||
|
|
||||||
|
|
|
@ -61,6 +61,7 @@ namespace CodeImp.DoomBuilder.Editing
|
||||||
|
|
||||||
public Plugin Plugin { get { return plugin; } }
|
public Plugin Plugin { get { return plugin; } }
|
||||||
public Type Type { get { return type; } }
|
public Type Type { get { return type; } }
|
||||||
|
public bool IsOptional { get { return ((switchactionattr != null) || (buttonimage != null)) && attribs.Optional; } }
|
||||||
public BeginActionAttribute SwitchAction { get { return switchactionattr; } }
|
public BeginActionAttribute SwitchAction { get { return switchactionattr; } }
|
||||||
public Image ButtonImage { get { return buttonimage; } }
|
public Image ButtonImage { get { return buttonimage; } }
|
||||||
public string ButtonDesc { get { return buttondesc; } }
|
public string ButtonDesc { get { return buttondesc; } }
|
||||||
|
@ -78,14 +79,18 @@ namespace CodeImp.DoomBuilder.Editing
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.attribs = attr;
|
this.attribs = attr;
|
||||||
|
|
||||||
|
// Make switch action info
|
||||||
|
if((attribs.SwitchAction != null) && (attribs.SwitchAction.Length > 0))
|
||||||
|
switchactionattr = new BeginActionAttribute(attribs.SwitchAction);
|
||||||
|
|
||||||
// Make button info
|
// Make button info
|
||||||
if((attr.ButtonImage != null) && (attr.ButtonDesc != null))
|
if(attr.ButtonImage != null)
|
||||||
{
|
{
|
||||||
buttonimagestream = plugin.GetResourceStream(attr.ButtonImage);
|
buttonimagestream = plugin.GetResourceStream(attr.ButtonImage);
|
||||||
if(buttonimagestream != null)
|
if(buttonimagestream != null)
|
||||||
{
|
{
|
||||||
buttonimage = Image.FromStream(buttonimagestream);
|
buttonimage = Image.FromStream(buttonimagestream);
|
||||||
buttondesc = attr.ButtonDesc;
|
buttondesc = attr.DisplayName;
|
||||||
buttonorder = attr.ButtonOrder;
|
buttonorder = attr.ButtonOrder;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -113,13 +118,9 @@ namespace CodeImp.DoomBuilder.Editing
|
||||||
// This binds the action to switch to this editing mode
|
// This binds the action to switch to this editing mode
|
||||||
public void BindSwitchAction()
|
public void BindSwitchAction()
|
||||||
{
|
{
|
||||||
// Make switch action info
|
if((switchactiondel == null) && (switchactionattr != null))
|
||||||
if((switchactiondel == null) && (attribs.SwitchAction != null) && (attribs.SwitchAction.Length > 0))
|
|
||||||
{
|
{
|
||||||
switchactionattr = new BeginActionAttribute(attribs.SwitchAction);
|
|
||||||
switchactiondel = new ActionDelegate(UserSwitchToMode);
|
switchactiondel = new ActionDelegate(UserSwitchToMode);
|
||||||
|
|
||||||
// Bind switch action
|
|
||||||
General.Actions.BindBeginDelegate(plugin.Assembly, switchactiondel, switchactionattr);
|
General.Actions.BindBeginDelegate(plugin.Assembly, switchactiondel, switchactionattr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -153,7 +153,10 @@ namespace CodeImp.DoomBuilder.Editing
|
||||||
{
|
{
|
||||||
foreach(EditModeInfo emi in allmodes)
|
foreach(EditModeInfo emi in allmodes)
|
||||||
{
|
{
|
||||||
if(General.Map.ConfigSettings.EditModes.Contains(emi.Type.FullName))
|
// Include the mode when it is listed and enabled
|
||||||
|
// Also include the mode when it is not optional
|
||||||
|
if( (General.Map.ConfigSettings.EditModes.ContainsKey(emi.Type.FullName) &&
|
||||||
|
General.Map.ConfigSettings.EditModes[emi.Type.FullName]) || !emi.IsOptional )
|
||||||
{
|
{
|
||||||
// Add the mode to be used and bind switch action
|
// Add the mode to be used and bind switch action
|
||||||
usedmodes.Add(emi);
|
usedmodes.Add(emi);
|
||||||
|
@ -188,11 +191,34 @@ namespace CodeImp.DoomBuilder.Editing
|
||||||
{
|
{
|
||||||
EditMode oldmode = mode;
|
EditMode oldmode = mode;
|
||||||
|
|
||||||
// Log info
|
if(nextmode != null)
|
||||||
if(newmode != null)
|
{
|
||||||
General.WriteLogLine("Switching edit mode to " + newmode.GetType().Name + "...");
|
// Verify that this mode is usable
|
||||||
|
bool allowuse = false;
|
||||||
|
foreach(EditModeInfo emi in usedmodes)
|
||||||
|
{
|
||||||
|
if(emi.Type.FullName == nextmode.GetType().FullName)
|
||||||
|
{
|
||||||
|
allowuse = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!allowuse)
|
||||||
|
{
|
||||||
|
General.Interface.MessageBeep(MessageBeepType.Error);
|
||||||
|
General.WriteLogLine("Attempt to switch to an invalid edit mode " + nextmode.GetType().Name + "!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
General.WriteLogLine("Switching edit mode to " + nextmode.GetType().Name + "...");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
General.WriteLogLine("Stopping edit mode...");
|
General.WriteLogLine("Stopping edit mode...");
|
||||||
|
}
|
||||||
|
|
||||||
// Remember previous mode
|
// Remember previous mode
|
||||||
newmode = nextmode;
|
newmode = nextmode;
|
||||||
|
|
|
@ -599,14 +599,19 @@ namespace CodeImp.DoomBuilder
|
||||||
plugins = new PluginManager();
|
plugins = new PluginManager();
|
||||||
plugins.LoadAllPlugins();
|
plugins.LoadAllPlugins();
|
||||||
|
|
||||||
|
// Load game configurations
|
||||||
|
General.WriteLogLine("Loading game configurations...");
|
||||||
|
LoadAllGameConfigurations();
|
||||||
|
|
||||||
|
// Create editing modes
|
||||||
|
General.WriteLogLine("Creating editing modes manager...");
|
||||||
|
editing = new EditingManager();
|
||||||
|
|
||||||
// Now that all settings have been combined (core & plugins) apply the defaults
|
// Now that all settings have been combined (core & plugins) apply the defaults
|
||||||
General.WriteLogLine("Applying configuration settings...");
|
General.WriteLogLine("Applying configuration settings...");
|
||||||
actions.ApplyDefaultShortcutKeys();
|
actions.ApplyDefaultShortcutKeys();
|
||||||
mainwindow.ApplyShortcutKeys();
|
mainwindow.ApplyShortcutKeys();
|
||||||
|
foreach(ConfigurationInfo info in configs) info.ApplyDefaults(null);
|
||||||
// Load game configurations
|
|
||||||
General.WriteLogLine("Loading game configurations...");
|
|
||||||
LoadAllGameConfigurations();
|
|
||||||
|
|
||||||
// Load compiler configurations
|
// Load compiler configurations
|
||||||
General.WriteLogLine("Loading compiler configurations...");
|
General.WriteLogLine("Loading compiler configurations...");
|
||||||
|
@ -632,10 +637,6 @@ namespace CodeImp.DoomBuilder
|
||||||
General.WriteLogLine("Creating types manager...");
|
General.WriteLogLine("Creating types manager...");
|
||||||
types = new TypesManager();
|
types = new TypesManager();
|
||||||
|
|
||||||
// Create editing modes
|
|
||||||
General.WriteLogLine("Creating editing modes manager...");
|
|
||||||
editing = new EditingManager();
|
|
||||||
|
|
||||||
// Do auto map loading when window is delayed
|
// Do auto map loading when window is delayed
|
||||||
if(delaymainwindow)
|
if(delaymainwindow)
|
||||||
mainwindow.PerformAutoMapLoading();
|
mainwindow.PerformAutoMapLoading();
|
||||||
|
|
|
@ -234,7 +234,7 @@ namespace CodeImp.DoomBuilder
|
||||||
General.WriteLogLine("Loading game configuration...");
|
General.WriteLogLine("Loading game configuration...");
|
||||||
configinfo = General.GetConfigurationInfo(options.ConfigFile);
|
configinfo = General.GetConfigurationInfo(options.ConfigFile);
|
||||||
config = new GameConfiguration(General.LoadGameConfiguration(options.ConfigFile));
|
config = new GameConfiguration(General.LoadGameConfiguration(options.ConfigFile));
|
||||||
configinfo.ApplyDefaults();
|
configinfo.ApplyDefaults(config);
|
||||||
General.Editing.UpdateCurrentEditModes();
|
General.Editing.UpdateCurrentEditModes();
|
||||||
|
|
||||||
// Create map data
|
// Create map data
|
||||||
|
@ -306,7 +306,7 @@ namespace CodeImp.DoomBuilder
|
||||||
General.WriteLogLine("Loading game configuration...");
|
General.WriteLogLine("Loading game configuration...");
|
||||||
configinfo = General.GetConfigurationInfo(options.ConfigFile);
|
configinfo = General.GetConfigurationInfo(options.ConfigFile);
|
||||||
config = new GameConfiguration(General.LoadGameConfiguration(options.ConfigFile));
|
config = new GameConfiguration(General.LoadGameConfiguration(options.ConfigFile));
|
||||||
configinfo.ApplyDefaults();
|
configinfo.ApplyDefaults(config);
|
||||||
General.Editing.UpdateCurrentEditModes();
|
General.Editing.UpdateCurrentEditModes();
|
||||||
|
|
||||||
// Create map data
|
// Create map data
|
||||||
|
@ -1314,7 +1314,7 @@ namespace CodeImp.DoomBuilder
|
||||||
General.WriteLogLine("Loading game configuration...");
|
General.WriteLogLine("Loading game configuration...");
|
||||||
configinfo = General.GetConfigurationInfo(options.ConfigFile);
|
configinfo = General.GetConfigurationInfo(options.ConfigFile);
|
||||||
config = new GameConfiguration(General.LoadGameConfiguration(options.ConfigFile));
|
config = new GameConfiguration(General.LoadGameConfiguration(options.ConfigFile));
|
||||||
configinfo.ApplyDefaults();
|
configinfo.ApplyDefaults(config);
|
||||||
General.Editing.UpdateCurrentEditModes();
|
General.Editing.UpdateCurrentEditModes();
|
||||||
|
|
||||||
// Setup new map format IO
|
// Setup new map format IO
|
||||||
|
|
4
Source/Windows/ConfigForm.Designer.cs
generated
4
Source/Windows/ConfigForm.Designer.cs
generated
|
@ -566,11 +566,11 @@ namespace CodeImp.DoomBuilder.Windows
|
||||||
this.colmodeplugin});
|
this.colmodeplugin});
|
||||||
this.listmodes.FullRowSelect = true;
|
this.listmodes.FullRowSelect = true;
|
||||||
this.listmodes.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable;
|
this.listmodes.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable;
|
||||||
this.listmodes.Location = new System.Drawing.Point(15, 76);
|
this.listmodes.Location = new System.Drawing.Point(15, 70);
|
||||||
this.listmodes.MultiSelect = false;
|
this.listmodes.MultiSelect = false;
|
||||||
this.listmodes.Name = "listmodes";
|
this.listmodes.Name = "listmodes";
|
||||||
this.listmodes.ShowGroups = false;
|
this.listmodes.ShowGroups = false;
|
||||||
this.listmodes.Size = new System.Drawing.Size(442, 226);
|
this.listmodes.Size = new System.Drawing.Size(442, 233);
|
||||||
this.listmodes.Sorting = System.Windows.Forms.SortOrder.Ascending;
|
this.listmodes.Sorting = System.Windows.Forms.SortOrder.Ascending;
|
||||||
this.listmodes.TabIndex = 26;
|
this.listmodes.TabIndex = 26;
|
||||||
this.listmodes.UseCompatibleStateImageBehavior = false;
|
this.listmodes.UseCompatibleStateImageBehavior = false;
|
||||||
|
|
|
@ -78,7 +78,7 @@ namespace CodeImp.DoomBuilder.Windows
|
||||||
foreach(EditModeInfo emi in General.Editing.ModesInfo)
|
foreach(EditModeInfo emi in General.Editing.ModesInfo)
|
||||||
{
|
{
|
||||||
// Is this mode selectable by the user?
|
// Is this mode selectable by the user?
|
||||||
if(emi.ButtonImage != null)
|
if(emi.IsOptional)
|
||||||
{
|
{
|
||||||
lvi = listmodes.Items.Add(emi.Attributes.DisplayName);
|
lvi = listmodes.Items.Add(emi.Attributes.DisplayName);
|
||||||
lvi.Tag = emi;
|
lvi.Tag = emi;
|
||||||
|
@ -110,6 +110,9 @@ namespace CodeImp.DoomBuilder.Windows
|
||||||
// Load the game configuration
|
// Load the game configuration
|
||||||
gameconfig = new GameConfiguration(General.LoadGameConfiguration(configinfo.Filename));
|
gameconfig = new GameConfiguration(General.LoadGameConfiguration(configinfo.Filename));
|
||||||
|
|
||||||
|
// Set defaults
|
||||||
|
configinfo.ApplyDefaults(gameconfig);
|
||||||
|
|
||||||
// Fill resources list
|
// Fill resources list
|
||||||
configdata.EditResourceLocationList(configinfo.Resources);
|
configdata.EditResourceLocationList(configinfo.Resources);
|
||||||
|
|
||||||
|
@ -172,7 +175,7 @@ namespace CodeImp.DoomBuilder.Windows
|
||||||
foreach(ListViewItem lvi in listmodes.Items)
|
foreach(ListViewItem lvi in listmodes.Items)
|
||||||
{
|
{
|
||||||
EditModeInfo emi = (lvi.Tag as EditModeInfo);
|
EditModeInfo emi = (lvi.Tag as EditModeInfo);
|
||||||
lvi.Checked = configinfo.EditModes.Contains(emi.Type.FullName);
|
lvi.Checked = (configinfo.EditModes.ContainsKey(emi.Type.FullName) && configinfo.EditModes[emi.Type.FullName]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -486,16 +489,16 @@ namespace CodeImp.DoomBuilder.Windows
|
||||||
|
|
||||||
// Apply changes
|
// Apply changes
|
||||||
EditModeInfo emi = (e.Item.Tag as EditModeInfo);
|
EditModeInfo emi = (e.Item.Tag as EditModeInfo);
|
||||||
bool currentstate = configinfo.EditModes.Contains(emi.Type.FullName);
|
bool currentstate = (configinfo.EditModes.ContainsKey(emi.Type.FullName) && configinfo.EditModes[emi.Type.FullName]);
|
||||||
if(e.Item.Checked && !currentstate)
|
if(e.Item.Checked && !currentstate)
|
||||||
{
|
{
|
||||||
// Add
|
// Add
|
||||||
configinfo.EditModes.Add(emi.Type.FullName);
|
configinfo.EditModes[emi.Type.FullName] = true;
|
||||||
}
|
}
|
||||||
else if(!e.Item.Checked && currentstate)
|
else if(!e.Item.Checked && currentstate)
|
||||||
{
|
{
|
||||||
// Remove
|
// Remove
|
||||||
configinfo.EditModes.Remove(emi.Type.FullName);
|
configinfo.EditModes[emi.Type.FullName] = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue