- refactored all editing mode management into the EditingManager

- added interface controls for editing mode selection in game configurations
This commit is contained in:
codeimp 2008-11-27 10:33:09 +00:00
parent af509c3682
commit ae8daa2924
34 changed files with 532 additions and 351 deletions

View file

@ -648,6 +648,7 @@
<None Include="Resources\Copy.png" />
<None Include="Resources\Cut.png" />
<None Include="Resources\Close.png" />
<Compile Include="Editing\EditingManager.cs" />
<Content Include="Resources\DB2.ico" />
<Compile Include="VisualModes\Clipper.cs" />
<Compile Include="VisualModes\VisualBlockEntry.cs" />

View file

@ -101,7 +101,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Switch to EditSelectionMode
EditSelectionMode editmode = new EditSelectionMode();
editmode.Pasting = true;
General.Map.ChangeMode(editmode);
General.Map.Editing.ChangeMode(editmode);
}
#endregion

View file

@ -407,7 +407,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
General.Interface.RemoveButton(BuilderPlug.Me.MenusForm.MakeGradientBrightness);
// Going to EditSelectionMode?
if(General.Map.NewMode is EditSelectionMode)
if(General.Map.Editing.NewMode is EditSelectionMode)
{
// No selection made? But we have a highlight!
if((General.Map.Map.GetSelectedSectors(true).Count == 0) && (highlighted != null))

View file

@ -57,7 +57,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
#region ================== Properties
// Just keep the base mode button checked
public override string EditModeButtonName { get { return General.Map.PreviousStableMode.Name; } }
public override string EditModeButtonName { get { return General.Map.Editing.PreviousStableMode.Name; } }
#endregion
@ -162,7 +162,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
base.OnCancel();
// Return to base mode
General.Map.ChangeMode(General.Map.PreviousStableMode.Name);
General.Map.Editing.ChangeMode(General.Map.Editing.PreviousStableMode.Name);
}
// Mode engages
@ -221,7 +221,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
General.Map.IsChanged = true;
// Return to base mode
General.Map.ChangeMode(General.Map.PreviousStableMode.Name);
General.Map.Editing.ChangeMode(General.Map.Editing.PreviousStableMode.Name);
}
// Redrawing display

View file

@ -83,7 +83,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
#region ================== Properties
// Just keep the base mode button checked
public override string EditModeButtonName { get { return General.Map.PreviousStableMode.Name; } }
public override string EditModeButtonName { get { return General.Map.Editing.PreviousStableMode.Name; } }
#endregion
@ -283,7 +283,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
base.OnCancel();
// Return to vertices mode
General.Map.ChangeMode(General.Map.PreviousStableMode.Name);
General.Map.Editing.ChangeMode(General.Map.Editing.PreviousStableMode.Name);
}
// Mode engages
@ -367,7 +367,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
protected override void OnEditEnd()
{
// Just return to base mode, Disengage will be called automatically.
General.Map.ChangeMode(General.Map.PreviousStableMode.Name);
General.Map.Editing.ChangeMode(General.Map.Editing.PreviousStableMode.Name);
base.OnEditEnd();
}

View file

@ -268,7 +268,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
base.OnCancel();
// Return to vertices mode
General.Map.ChangeMode(basemode);
General.Map.Editing.ChangeMode(basemode);
}
// Mode engages
@ -354,7 +354,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
protected override void OnEditEnd()
{
// Just return to vertices mode, geometry will be merged on disengage.
General.Map.ChangeMode(basemode);
General.Map.Editing.ChangeMode(basemode);
base.OnEditEnd();
}

View file

@ -69,7 +69,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
#region ================== Properties
// Just keep the base mode button checked
public override string EditModeButtonName { get { return General.Map.PreviousStableMode.Name; } }
public override string EditModeButtonName { get { return General.Map.Editing.PreviousStableMode.Name; } }
#endregion
@ -335,7 +335,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
base.OnCancel();
// Return to original mode
General.Map.ChangeMode(General.Map.PreviousStableMode.Name);
General.Map.Editing.ChangeMode(General.Map.Editing.PreviousStableMode.Name);
}
// Accepted
@ -369,7 +369,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
Cursor.Current = Cursors.Default;
// Return to original mode
General.Map.ChangeMode(General.Map.PreviousStableMode.Name);
General.Map.Editing.ChangeMode(General.Map.Editing.PreviousStableMode.Name);
}
// This redraws the display
@ -454,7 +454,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
public void FinishDraw()
{
// Accept the changes
General.Map.AcceptMode();
General.Map.Editing.AcceptMode();
}
#endregion

View file

@ -133,7 +133,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
#region ================== Properties
// Just keep the base mode button checked
public override string EditModeButtonName { get { return General.Map.PreviousStableMode.Name; } }
public override string EditModeButtonName { get { return General.Map.Editing.PreviousStableMode.Name; } }
public bool Pasting { get { return pasting; } set { pasting = value; } }
@ -690,7 +690,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
General.Interface.DisplayWarning("Please make a selection first!");
// Cancel now
General.Map.CancelMode();
General.Map.Editing.CancelMode();
}
}
@ -711,7 +711,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
General.Map.Map.Update(true, true);
// Return to previous stable mode
General.Map.ChangeMode(General.Map.PreviousStableMode.Name);
General.Map.Editing.ChangeMode(General.Map.Editing.PreviousStableMode.Name);
}
// When accepted
@ -848,7 +848,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
if(!modealreadyswitching)
{
// Return to previous stable mode
General.Map.ChangeMode(General.Map.PreviousStableMode.Name);
General.Map.Editing.ChangeMode(General.Map.Editing.PreviousStableMode.Name);
}
}
@ -1084,7 +1084,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Outside the selection?
default:
// Accept and be done with it
General.Map.AcceptMode();
General.Map.Editing.AcceptMode();
break;
}
}
@ -1131,7 +1131,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
public void ClearSelection()
{
// Accept changes
General.Map.AcceptMode();
General.Map.Editing.AcceptMode();
General.Map.Map.ClearAllSelected();
}

View file

@ -67,7 +67,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
base.OnCancel();
// Return to base mode
General.Map.ChangeMode(General.Map.PreviousStableMode.Name);
General.Map.Editing.ChangeMode(General.Map.Editing.PreviousStableMode.Name);
}
// Mode engages
@ -112,7 +112,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
General.Map.IsChanged = true;
// Return to base mode
General.Map.ChangeMode(General.Map.PreviousStableMode.Name);
General.Map.Editing.ChangeMode(General.Map.Editing.PreviousStableMode.Name);
}
// Redrawing display

View file

@ -67,7 +67,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
base.OnCancel();
// Return to base mode
General.Map.ChangeMode(General.Map.PreviousStableMode.Name);
General.Map.Editing.ChangeMode(General.Map.Editing.PreviousStableMode.Name);
}
// Mode engages
@ -103,7 +103,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
General.Map.IsChanged = true;
// Return to base mode
General.Map.ChangeMode(General.Map.PreviousStableMode.Name);
General.Map.Editing.ChangeMode(General.Map.Editing.PreviousStableMode.Name);
}
// Redrawing display

View file

@ -178,7 +178,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
base.OnCancel();
// Return to this mode
General.Map.ChangeMode(new LinedefsMode());
General.Map.Editing.ChangeMode(new LinedefsMode());
}
// Mode engages
@ -202,7 +202,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
base.OnDisengage();
// Going to EditSelectionMode?
if(General.Map.NewMode is EditSelectionMode)
if(General.Map.Editing.NewMode is EditSelectionMode)
{
// No selection made? But we have a highlight!
if((General.Map.Map.GetSelectedLinedefs(true).Count == 0) && (highlighted != null))
@ -343,7 +343,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Start drawing mode
DrawGeometryMode drawmode = new DrawGeometryMode();
drawmode.DrawPointAt(mousemappos, true);
General.Map.ChangeMode(drawmode);
General.Map.Editing.ChangeMode(drawmode);
}
base.OnEditBegin();
@ -419,7 +419,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
// Start dragging the selection
General.Map.ChangeMode(new DragLinedefsMode(mousedownmappos));
General.Map.Editing.ChangeMode(new DragLinedefsMode(mousedownmappos));
}
}
}
@ -633,7 +633,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
if(selected.Count > 0)
{
// Go into curve linedefs mode
General.Map.ChangeMode(new CurveLinedefsMode(new LinedefsMode()));
General.Map.Editing.ChangeMode(new CurveLinedefsMode(new LinedefsMode()));
}
}

View file

@ -246,7 +246,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
base.OnCancel();
// Return to base mode
General.Map.ChangeMode(new SectorsMode());
General.Map.Editing.ChangeMode(new SectorsMode());
}
// Mode engages
@ -271,14 +271,14 @@ namespace CodeImp.DoomBuilder.BuilderModes
base.OnDisengage();
// Check which mode we are switching to
if(General.Map.NewMode is VerticesMode)
if(General.Map.Editing.NewMode is VerticesMode)
{
// Convert selection to vertices
// Clear selected sectors
General.Map.Map.ClearSelectedSectors();
}
else if(General.Map.NewMode is LinedefsMode)
else if(General.Map.Editing.NewMode is LinedefsMode)
{
// Convert selection to linedefs

View file

@ -251,7 +251,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
base.OnCancel();
// Return to this mode
General.Map.ChangeMode(new SectorsMode());
General.Map.Editing.ChangeMode(new SectorsMode());
}
// Mode engages
@ -295,7 +295,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
base.OnDisengage();
// Going to EditSelectionMode?
if(General.Map.NewMode is EditSelectionMode)
if(General.Map.Editing.NewMode is EditSelectionMode)
{
// No selection made? But we have a highlight!
if((General.Map.Map.GetSelectedSectors(true).Count == 0) && (highlighted != null))
@ -429,7 +429,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Start drawing mode
DrawGeometryMode drawmode = new DrawGeometryMode();
drawmode.DrawPointAt(mousemappos, true);
General.Map.ChangeMode(drawmode);
General.Map.Editing.ChangeMode(drawmode);
}
base.OnEditBegin();
@ -545,7 +545,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
// Start dragging the selection
General.Map.ChangeMode(new DragSectorsMode(mousedownmappos));
General.Map.Editing.ChangeMode(new DragSectorsMode(mousedownmappos));
}
}
}

View file

@ -80,7 +80,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
base.OnCancel();
// Return to this mode
General.Map.ChangeMode(new ThingsMode());
General.Map.Editing.ChangeMode(new ThingsMode());
}
// Mode engages
@ -104,7 +104,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
base.OnDisengage();
// Going to EditSelectionMode?
if(General.Map.NewMode is EditSelectionMode)
if(General.Map.Editing.NewMode is EditSelectionMode)
{
// No selection made? But we have a highlight!
if((General.Map.Map.GetSelectedThings(true).Count == 0) && (highlighted != null))
@ -417,7 +417,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
// Start dragging the selection
General.Map.ChangeMode(new DragThingsMode(new ThingsMode(), mousedownmappos));
General.Map.Editing.ChangeMode(new DragThingsMode(new ThingsMode(), mousedownmappos));
}
}
}

View file

@ -77,7 +77,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
base.OnCancel();
// Return to this mode
General.Map.ChangeMode(new VerticesMode());
General.Map.Editing.ChangeMode(new VerticesMode());
}
// Mode engages
@ -106,7 +106,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
base.OnDisengage();
// Going to EditSelectionMode?
if(General.Map.NewMode is EditSelectionMode)
if(General.Map.Editing.NewMode is EditSelectionMode)
{
// No selection made? But we have a highlight!
if((General.Map.Map.GetSelectedVertices(true).Count == 0) && (highlighted != null))
@ -275,7 +275,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Start drawing mode
DrawGeometryMode drawmode = new DrawGeometryMode();
drawmode.DrawPointAt(mousemappos, true);
General.Map.ChangeMode(drawmode);
General.Map.Editing.ChangeMode(drawmode);
}
}
@ -334,7 +334,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
// Start dragging the selection
General.Map.ChangeMode(new DragVerticesMode(highlighted, mousedownmappos));
General.Map.Editing.ChangeMode(new DragVerticesMode(highlighted, mousedownmappos));
}
}
}

View file

@ -88,7 +88,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
if(e.CloseReason == CloseReason.UserClosing)
{
// Just cancel
General.Map.CancelMode();
General.Map.Editing.CancelMode();
e.Cancel = true;
}
}
@ -193,14 +193,14 @@ namespace CodeImp.DoomBuilder.BuilderModes
private void cancel_Click(object sender, EventArgs e)
{
// Cancel now
General.Map.CancelMode();
General.Map.Editing.CancelMode();
}
// Apply clicked
private void apply_Click(object sender, EventArgs e)
{
// Apply now
General.Map.AcceptMode();
General.Map.Editing.AcceptMode();
}
#endregion

View file

@ -331,7 +331,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
if(e.CloseReason == CloseReason.UserClosing)
{
e.Cancel = true;
General.Map.CancelMode();
General.Map.Editing.CancelMode();
}
}

View file

@ -213,14 +213,14 @@ namespace CodeImp.DoomBuilder.BuilderModes
if(e.CloseReason == CloseReason.UserClosing)
{
e.Cancel = true;
General.Map.CancelMode();
General.Map.Editing.CancelMode();
}
}
// Close button clicked
private void closebutton_Click(object sender, EventArgs e)
{
General.Map.CancelMode();
General.Map.Editing.CancelMode();
}
#endregion

View file

@ -124,7 +124,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// When these modes are active, then test against the base mode they will return to
if((mode is DragGeometryMode) || (mode is DragThingsMode) ||
(mode is DrawGeometryMode) || (mode is CurveLinedefsMode))
sourcemode = General.Map.PreviousStableMode;
sourcemode = General.Map.Editing.PreviousStableMode;
// Final decision
if(sourcemode == typeof(LinedefsMode)) HideAllMenusExcept(linedefsmenu);

View file

@ -94,7 +94,7 @@ namespace CodeImp.DoomBuilder.BuilderModes.Editing
base.OnCancel();
// Return to this mode
General.Map.ChangeMode(new SectorsMode());
General.Map.Editing.ChangeMode(new SectorsMode());
}
// Mode engages
@ -109,14 +109,14 @@ namespace CodeImp.DoomBuilder.BuilderModes.Editing
base.OnDisengage();
// Check which mode we are switching to
if(General.Map.NewMode is VerticesMode)
if(General.Map.Editing.NewMode is VerticesMode)
{
// Convert selection to vertices
// Clear selected sectors
General.Map.Map.ClearSelectedSectors();
}
else if(General.Map.NewMode is LinedefsMode)
else if(General.Map.Editing.NewMode is LinedefsMode)
{
// Convert selection to linedefs

View file

@ -39,8 +39,7 @@ namespace CodeImp.DoomBuilder.BuilderModes.Editing
[EditMode(SwitchAction = "wauthormode",
ButtonDesc = "WadAuthor Mode",
ButtonImage = "WAuthor.png",
ButtonOrder = int.MinValue + 4,
ConfigSpecific = true)]
ButtonOrder = int.MinValue + 4)]
public class WAuthorMode : ClassicMode
{
@ -106,7 +105,7 @@ namespace CodeImp.DoomBuilder.BuilderModes.Editing
base.OnCancel();
// Return to this mode
General.Map.ChangeMode(new WAuthorMode());
General.Map.Editing.ChangeMode(new WAuthorMode());
}
// Mode engages

View file

@ -95,9 +95,9 @@ namespace CodeImp.DoomBuilder.Editing
this.renderer2d = (Renderer2D)General.Map.Renderer2D;
// If the current mode is a ClassicMode, copy mouse properties
if(General.Map.Mode is ClassicMode)
if(General.Map.Editing.Mode is ClassicMode)
{
ClassicMode oldmode = General.Map.Mode as ClassicMode;
ClassicMode oldmode = General.Map.Editing.Mode as ClassicMode;
// Copy mouse properties
mousepos = oldmode.mousepos;

View file

@ -97,7 +97,7 @@ namespace CodeImp.DoomBuilder.Editing
// Ask the editing mode to prepare selection for copying.
// The edit mode should mark all vertices, lines and sectors
// that need to be copied.
if(General.Map.Mode.OnCopyBegin())
if(General.Map.Editing.Mode.OnCopyBegin())
{
// Copy the marked geometry
// This links sidedefs that are not linked to a marked sector to a virtual sector
@ -114,7 +114,7 @@ namespace CodeImp.DoomBuilder.Editing
// Done
memstream.Dispose();
General.Map.Mode.OnCopyEnd();
General.Map.Editing.Mode.OnCopyEnd();
General.Plugins.OnCopyEnd();
return true;
}
@ -137,7 +137,7 @@ namespace CodeImp.DoomBuilder.Editing
if(General.Plugins.OnPasteBegin())
{
// Ask the editing mode to prepare selection for pasting.
if(General.Map.Mode.OnPasteBegin())
if(General.Map.Editing.Mode.OnPasteBegin())
{
// Read from clipboard
Stream memstream = (Stream)Clipboard.GetData(CLIPBOARD_DATA_FORMAT);
@ -156,7 +156,7 @@ namespace CodeImp.DoomBuilder.Editing
// Done
memstream.Dispose();
General.Map.Mode.OnPasteEnd();
General.Map.Editing.Mode.OnPasteEnd();
General.Plugins.OnPasteEnd();
return true;
}

View file

@ -35,19 +35,19 @@ namespace CodeImp.DoomBuilder.Editing
public class EditModeAttribute : Attribute
{
#region ================== Variables
// Properties
private string switchaction = null;
private string buttonimage = null;
private string buttondesc = null;
private int buttonorder = 0;
private bool configspecific = false;
private bool optional = false;
private bool isvolatile = false;
private string displayname = "Unnamed Mode";
private bool allowcopypaste = true;
#endregion
#region ================== Properties
/// <summary>
@ -75,11 +75,10 @@ namespace CodeImp.DoomBuilder.Editing
public int ButtonOrder { get { return buttonorder; } set { buttonorder = value; } }
/// <summary>
/// When set to true, this mode is only accessible from
/// the toolbar/menu when the game configuration specifies this mode by
/// class name in the "additionalmodes" structure.
/// When set to false, this mode will always be available for use and the user cannot
/// change this in the game configuration.
/// </summary>
public bool ConfigSpecific { get { return configspecific; } set { configspecific = value; } }
public bool Optional { get { return optional; } set { optional = value; } }
/// <summary>
/// When set to true, this mode is cancelled when core actions like

View file

@ -43,8 +43,7 @@ namespace CodeImp.DoomBuilder.Editing
// Mode type
private Plugin plugin;
private Type type;
private bool configspecific;
private bool isvolatile;
private EditModeAttribute attribs;
// Mode switching
private BeginActionAttribute switchactionattr = null;
@ -65,8 +64,7 @@ namespace CodeImp.DoomBuilder.Editing
public BeginActionAttribute SwitchAction { get { return switchactionattr; } }
public Image ButtonImage { get { return buttonimage; } }
public string ButtonDesc { get { return buttondesc; } }
public bool ConfigSpecific { get { return configspecific; } }
public bool Volatile { get { return isvolatile; } }
public EditModeAttribute Attributes { get { return attribs; } }
#endregion
@ -78,8 +76,7 @@ namespace CodeImp.DoomBuilder.Editing
// Initialize
this.plugin = plugin;
this.type = type;
this.configspecific = attr.ConfigSpecific;
this.isvolatile = attr.Volatile;
this.attribs = attr;
// Make switch action info
if((attr.SwitchAction != null) && (attr.SwitchAction.Length > 0))
@ -133,13 +130,13 @@ namespace CodeImp.DoomBuilder.Editing
if(General.Map != null)
{
// Not switching from volatile mode to volatile mode?
if((General.Map.Mode == null) || !General.Map.Mode.Attributes.Volatile || !this.isvolatile)
if((General.Map.Editing.Mode == null) || !General.Map.Editing.Mode.Attributes.Volatile || !this.attribs.Volatile)
{
// Create instance
newmode = plugin.CreateObject<EditMode>(type);
// Switch mode
General.Map.ChangeMode(newmode);
General.Map.Editing.ChangeMode(newmode);
}
}
}
@ -156,7 +153,7 @@ namespace CodeImp.DoomBuilder.Editing
newmode = plugin.CreateObject<EditMode>(type);
// Switch mode
General.Map.ChangeMode(newmode);
General.Map.Editing.ChangeMode(newmode);
}
}
@ -172,7 +169,7 @@ namespace CodeImp.DoomBuilder.Editing
newmode = plugin.CreateObjectA<EditMode>(type, args);
// Switch mode
if(!General.Map.ChangeMode(newmode))
if(!General.Map.Editing.ChangeMode(newmode))
{
// When cancelled, dispose mode
newmode.Dispose();

View file

@ -0,0 +1,260 @@
#region ================== Copyright (c) 2007 Pascal vd Heiden
/*
* Copyright (c) 2007 Pascal vd Heiden, www.codeimp.com
* This program is released under GNU General Public License
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#endregion
#region ================== Namespaces
using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Reflection;
using CodeImp.DoomBuilder.Windows;
using CodeImp.DoomBuilder.IO;
using CodeImp.DoomBuilder.Map;
using CodeImp.DoomBuilder.Rendering;
using System.Diagnostics;
using CodeImp.DoomBuilder.Actions;
using CodeImp.DoomBuilder.Geometry;
using CodeImp.DoomBuilder.Plugins;
#endregion
namespace CodeImp.DoomBuilder.Editing
{
public sealed class EditingManager
{
#region ================== Constants
#endregion
#region ================== Variables
// All editing modes available
private List<EditModeInfo> allmodes;
// Editing modes selected through configuration
private List<EditModeInfo> usedmodes;
// Status
private EditMode mode;
private EditMode newmode;
private Type prevmode;
private Type prevstablemode;
// Disposing
private bool isdisposed = false;
#endregion
#region ================== Properties
public EditMode Mode { get { return mode; } }
public EditMode NewMode { get { return newmode; } }
public Type PreviousMode { get { return prevmode; } }
public Type PreviousStableMode { get { return prevstablemode; } }
public bool IsDisposed { get { return isdisposed; } }
#endregion
#region ================== Constructor / Disposer
// Constructor
internal EditingManager()
{
// Initialize
allmodes = new List<EditModeInfo>();
usedmodes = new List<EditModeInfo>();
// Make list of all editing modes we can find
foreach(Plugin p in General.Plugins.Plugins)
{
// For all classes that inherit from EditMode
Type[] editclasses = p.FindClasses(typeof(EditMode));
foreach(Type t in editclasses)
{
// For all defined EditMode attributes
EditModeAttribute[] emattrs = (EditModeAttribute[])t.GetCustomAttributes(typeof(EditModeAttribute), false);
foreach(EditModeAttribute a in emattrs)
{
// Make edit mode information
allmodes.Add(new EditModeInfo(p, t, a));
}
}
}
// Sort the modes in order for buttons
allmodes.Sort();
// We have no destructor
GC.SuppressFinalize(this);
}
// Disposer
internal void Dispose()
{
// Not already disposed?
if(!isdisposed)
{
// Clean up
// Done
isdisposed = true;
}
}
#endregion
#region ================== Methods
// This returns specific editing mode info by name
internal EditModeInfo GetEditModeInfo(string editmodename)
{
// Find the edit mode
foreach(EditModeInfo emi in usedmodes)
{
// Mode matches class name?
if(emi.ToString() == editmodename) return emi;
}
// No such mode found
return null;
}
// This is called when the editing modes must update
internal void UpdateCurrentEditModes()
{
// For now we use all the modes we can find
usedmodes.Clear();
usedmodes.AddRange(allmodes);
// Remove editing mode buttons from interface
General.MainWindow.RemoveEditModeButtons();
// Go for all used edit modes to add buttons
foreach(EditModeInfo emi in usedmodes)
{
if((emi.ButtonImage != null) && (emi.ButtonDesc != null))
General.MainWindow.AddEditModeButton(emi);
}
}
//
// This changes the editing mode.
// Order in which events occur for the old and new modes:
//
// - Constructor of new mode is called
// - Disengage of old mode is called
// ----- Mode switches -----
// - Engage of new mode is called
// - Dispose of old mode is called
//
// Returns false when cancelled
public bool ChangeMode(EditMode nextmode)
{
EditMode oldmode = mode;
// Log info
if(newmode != null)
General.WriteLogLine("Switching edit mode to " + newmode.GetType().Name + "...");
else
General.WriteLogLine("Stopping edit mode...");
// Remember previous mode
newmode = nextmode;
if(mode != null)
{
prevmode = mode.GetType();
if(!mode.Attributes.Volatile) prevstablemode = prevmode;
}
else
{
prevmode = null;
prevstablemode = null;
}
// Let the plugins know beforehand and check if not cancelled
if(General.Plugins.ModeChanges(oldmode, newmode))
{
// Disenagage old mode
if(oldmode != null) oldmode.OnDisengage();
// Reset cursor
General.Interface.SetCursor(Cursors.Default);
// Apply new mode
mode = newmode;
// Engage new mode
if(newmode != null) newmode.OnEngage();
// Update the interface
General.MainWindow.EditModeChanged();
// Dispose old mode
if(oldmode != null) oldmode.Dispose();
// Done switching
newmode = null;
// Redraw the display
General.MainWindow.RedrawDisplay();
return true;
}
else
{
// Cancelled
General.WriteLogLine("Edit mode change cancelled.");
return false;
}
}
// This changes mode by class name and optionally with arguments
public void ChangeMode(string classname, params object[] args)
{
EditModeInfo emi = GetEditModeInfo(classname);
if(emi != null) emi.SwitchToMode(args);
}
#endregion
#region ================== Actions
/// <summary>
/// This cancels the current mode.
/// </summary>
[BeginAction("cancelmode")]
public void CancelMode()
{
// Let the mode know
mode.OnCancel();
}
/// <summary>
/// This accepts the changes in the current mode.
/// </summary>
[BeginAction("acceptmode")]
public void AcceptMode()
{
// Let the mode know
mode.OnAccept();
}
#endregion
}
}

View file

@ -222,7 +222,7 @@ namespace CodeImp.DoomBuilder.Editing
if(General.Plugins.OnUndoBegin())
{
// Call UndoBegin event
if(General.Map.Mode.OnUndoBegin())
if(General.Map.Editing.Mode.OnUndoBegin())
{
// Cancel volatile mode, if any
// This returns false when mode was not volatile
@ -255,7 +255,7 @@ namespace CodeImp.DoomBuilder.Editing
General.Map.ChangeMapSet(u.map);
// Done
General.Map.Mode.OnUndoEnd();
General.Map.Editing.Mode.OnUndoEnd();
General.Plugins.OnUndoEnd();
// Update
@ -281,7 +281,7 @@ namespace CodeImp.DoomBuilder.Editing
if(General.Plugins.OnRedoBegin())
{
// Call RedoBegin event
if(General.Map.Mode.OnRedoBegin())
if(General.Map.Editing.Mode.OnRedoBegin())
{
// Cancel volatile mode, if any
General.CancelVolatileMode();
@ -313,7 +313,7 @@ namespace CodeImp.DoomBuilder.Editing
General.Map.ChangeMapSet(r.map);
// Done
General.Map.Mode.OnRedoEnd();
General.Map.Editing.Mode.OnRedoEnd();
General.Plugins.OnRedoEnd();
// Update

View file

@ -813,10 +813,10 @@ namespace CodeImp.DoomBuilder
public static bool CancelVolatileMode()
{
// Volatile mode?
if((map != null) & (map.Mode != null) && map.Mode.Attributes.Volatile)
if((map != null) & (map.Editing.Mode != null) && map.Editing.Mode.Attributes.Volatile)
{
// Cancel
map.Mode.OnCancel();
map.Editing.Mode.OnCancel();
return true;
}
else
@ -830,10 +830,10 @@ namespace CodeImp.DoomBuilder
public static bool DisengageVolatileMode()
{
// Volatile mode?
if((map != null) && (map.Mode != null) && map.Mode.Attributes.Volatile)
if((map != null) && (map.Editing.Mode != null) && map.Editing.Mode.Attributes.Volatile)
{
// Change back to normal mode
map.ChangeMode(map.PreviousStableMode.Name);
map.Editing.ChangeMode(map.Editing.PreviousStableMode.Name);
return true;
}
else

View file

@ -40,7 +40,7 @@ using CodeImp.DoomBuilder.Compilers;
namespace CodeImp.DoomBuilder
{
public class MapManager
public sealed class MapManager
{
#region ================== Constants
@ -75,10 +75,7 @@ namespace CodeImp.DoomBuilder
private ConfigurationInfo configinfo;
private GameConfiguration config;
private DataManager data;
private EditMode mode;
private EditMode newmode;
private Type prevmode;
private Type prevstablemode;
private EditingManager editing;
private D3DDevice graphics;
private Renderer2D renderer2d;
private Renderer3D renderer3d;
@ -103,10 +100,7 @@ namespace CodeImp.DoomBuilder
public string TempPath { get { return temppath; } }
internal MapOptions Options { get { return options; } }
public MapSet Map { get { return map; } }
public EditMode Mode { get { return mode; } }
public EditMode NewMode { get { return newmode; } }
public Type PreviousMode { get { return prevmode; } }
public Type PreviousStableMode { get { return prevstablemode; } }
public EditingManager Editing { get { return editing; } }
public DataManager Data { get { return data; } }
public bool IsChanged { get { return changed | CheckScriptChanged(); } set { changed |= value; } }
public bool IsDisposed { get { return isdisposed; } }
@ -147,6 +141,7 @@ namespace CodeImp.DoomBuilder
copypaste = new CopyPasteManager();
launcher = new Launcher(this);
thingsfilter = new NullThingsFilter();
editing = new EditingManager();
}
// Disposer
@ -159,7 +154,7 @@ namespace CodeImp.DoomBuilder
CloseScriptEditor(false);
// Change to no mode
ChangeMode((EditMode)null);
editing.ChangeMode((EditMode)null);
// Unbind any methods
General.Actions.UnbindMethods(this);
@ -169,6 +164,7 @@ namespace CodeImp.DoomBuilder
if(launcher != null) launcher.Dispose();
if(copypaste != null) copypaste.Dispose();
if(undoredo != null) undoredo.Dispose();
if(editing != null) editing.Dispose();
General.WriteLogLine("Unloading data resources...");
if(data != null) data.Dispose();
General.WriteLogLine("Closing temporary file...");
@ -179,6 +175,20 @@ namespace CodeImp.DoomBuilder
if(renderer2d != null) renderer2d.Dispose();
if(renderer3d != null) renderer3d.Dispose();
if(graphics != null) graphics.Dispose();
grid = null;
launcher = null;
copypaste = null;
undoredo = null;
editing = null;
data = null;
tempwad = null;
map = null;
renderer2d = null;
renderer3d = null;
graphics = null;
// We may spend some time to clean things up here
GC.Collect();
// Remove temp file
General.WriteLogLine("Removing temporary directory...");
@ -187,9 +197,6 @@ namespace CodeImp.DoomBuilder
General.WriteLogLine(e.GetType().Name + ": " + e.Message);
General.WriteLogLine("Failed to remove temporary directory!");
}
// We may spend some time to clean things up here
GC.Collect();
// Done
isdisposed = true;
@ -233,7 +240,7 @@ namespace CodeImp.DoomBuilder
configinfo = General.GetConfigurationInfo(options.ConfigFile);
config = new GameConfiguration(General.LoadGameConfiguration(options.ConfigFile));
configinfo.ApplyDefaults();
General.Plugins.GameConfigurationChanged();
editing.UpdateCurrentEditModes();
// Create map data
map = new MapSet();
@ -266,8 +273,8 @@ namespace CodeImp.DoomBuilder
General.Actions.BindMethods(this);
// Set default mode
ChangeMode("VerticesMode");
ClassicMode cmode = (mode as ClassicMode);
editing.ChangeMode("VerticesMode");
ClassicMode cmode = (editing.Mode as ClassicMode);
cmode.SetZoom(0.5f);
renderer2d.SetViewMode((ViewMode)General.Settings.DefaultViewMode);
@ -305,7 +312,7 @@ namespace CodeImp.DoomBuilder
configinfo = General.GetConfigurationInfo(options.ConfigFile);
config = new GameConfiguration(General.LoadGameConfiguration(options.ConfigFile));
configinfo.ApplyDefaults();
General.Plugins.GameConfigurationChanged();
editing.UpdateCurrentEditModes();
// Create map data
map = new MapSet();
@ -353,11 +360,11 @@ namespace CodeImp.DoomBuilder
General.Actions.BindMethods(this);
// Set default mode
ChangeMode("VerticesMode");
editing.ChangeMode("VerticesMode");
renderer2d.SetViewMode((ViewMode)General.Settings.DefaultViewMode);
// Center map in screen
if(General.Map.Mode is ClassicMode) (General.Map.Mode as ClassicMode).CenterInScreen();
if(General.Map.Editing.Mode is ClassicMode) (General.Map.Editing.Mode as ClassicMode).CenterInScreen();
// Success
General.WriteLogLine("Map loading done");
@ -373,7 +380,6 @@ namespace CodeImp.DoomBuilder
{
MapSet outputset;
string nodebuildername, oldstatus, settingsfile;
Configuration mapsettings;
WAD targetwad;
int index;
bool includenodes = false;
@ -929,107 +935,6 @@ namespace CodeImp.DoomBuilder
#endregion
#region ================== Editing Modes
/// <summary>
/// This cancels the current mode.
/// </summary>
[BeginAction("cancelmode")]
public void CancelMode()
{
// Let the mode know
mode.OnCancel();
}
/// <summary>
/// This accepts the changes in the current mode.
/// </summary>
[BeginAction("acceptmode")]
public void AcceptMode()
{
// Let the mode know
mode.OnAccept();
}
//
// This changes the editing mode.
// Order in which events occur for the old and new modes:
//
// - Constructor of new mode is called
// - Disengage of old mode is called
// ----- Mode switches -----
// - Engage of new mode is called
// - Dispose of old mode is called
//
// Returns false when cancelled
public bool ChangeMode(EditMode nextmode)
{
EditMode oldmode = mode;
// Log info
if(newmode != null)
General.WriteLogLine("Switching edit mode to " + newmode.GetType().Name + "...");
else
General.WriteLogLine("Stopping edit mode...");
// Remember previous mode
newmode = nextmode;
if(mode != null)
{
prevmode = mode.GetType();
if(!mode.Attributes.Volatile) prevstablemode = prevmode;
}
else
{
prevmode = null;
prevstablemode = null;
}
// Let the plugins know beforehand and check if not cancelled
if(General.Plugins.ModeChanges(oldmode, newmode))
{
// Disenagage old mode
if(oldmode != null) oldmode.OnDisengage();
// Reset cursor
General.Interface.SetCursor(Cursors.Default);
// Apply new mode
mode = newmode;
// Engage new mode
if(newmode != null) newmode.OnEngage();
// Update the interface
General.MainWindow.EditModeChanged();
// Dispose old mode
if(oldmode != null) oldmode.Dispose();
// Done switching
newmode = null;
// Redraw the display
General.MainWindow.RedrawDisplay();
return true;
}
else
{
// Cancelled
General.WriteLogLine("Edit mode change cancelled.");
return false;
}
}
// This changes mode by class name and optionally with arguments
public void ChangeMode(string classname, params object[] args)
{
EditModeInfo emi = General.Plugins.GetEditModeInfo(classname);
if(emi != null) emi.SwitchToMode(args);
}
#endregion
#region ================== Selection Groups
// This adds selection to a group
@ -1368,7 +1273,7 @@ namespace CodeImp.DoomBuilder
General.WriteLogLine("Reloading game configuration...");
configinfo = General.GetConfigurationInfo(options.ConfigFile);
config = new GameConfiguration(General.LoadGameConfiguration(options.ConfigFile));
General.Plugins.GameConfigurationChanged();
editing.UpdateCurrentEditModes();
// Reload data resources
General.WriteLogLine("Reloading data resources...");
@ -1415,7 +1320,7 @@ namespace CodeImp.DoomBuilder
configinfo = General.GetConfigurationInfo(options.ConfigFile);
config = new GameConfiguration(General.LoadGameConfiguration(options.ConfigFile));
configinfo.ApplyDefaults();
General.Plugins.GameConfigurationChanged();
editing.UpdateCurrentEditModes();
// Setup new map format IO
General.WriteLogLine("Initializing map format interface " + config.FormatInterface + "...");

View file

@ -24,6 +24,7 @@ using System.Text;
using System.IO;
using System.Reflection;
using CodeImp.DoomBuilder.Actions;
using CodeImp.DoomBuilder.Editing;
#endregion
@ -115,7 +116,7 @@ namespace CodeImp.DoomBuilder.Plugins
#endregion
#region ================== Methods
// This creates a stream to read a resource or returns null when not found
public Stream GetResourceStream(string resourcename)
{

View file

@ -42,19 +42,16 @@ namespace CodeImp.DoomBuilder.Plugins
// Plugins
private List<Plugin> plugins;
// Modes
private List<EditModeInfo> editmodes;
// Disposing
private bool isdisposed = false;
#endregion
#region ================== Properties
public ICollection<EditModeInfo> EditModes { get { return editmodes; } }
internal List<Plugin> Plugins { get { return plugins; } }
public bool IsDisposed { get { return isdisposed; } }
#endregion
#region ================== Constructor / Disposer
@ -64,7 +61,6 @@ namespace CodeImp.DoomBuilder.Plugins
{
// Make lists
this.plugins = new List<Plugin>();
this.editmodes = new List<EditModeInfo>();
// We have no destructor
GC.SuppressFinalize(this);
@ -132,68 +128,10 @@ namespace CodeImp.DoomBuilder.Plugins
// Load actions
General.Actions.LoadActions(p.Assembly);
// For all classes that inherit from EditMode
editclasses = p.FindClasses(typeof(EditMode));
foreach(Type t in editclasses)
{
// For all defined EditMode attributes
emattrs = (EditModeAttribute[])t.GetCustomAttributes(typeof(EditModeAttribute), false);
foreach(EditModeAttribute a in emattrs)
{
// Make edit mode information
editmodeinfo = new EditModeInfo(p, t, a);
editmodes.Add(editmodeinfo);
}
}
// Plugin is now initialized
p.Plug.OnInitialize();
}
}
// Sort the list in order for buttons
editmodes.Sort();
// Go for all edit modes to add buttons
foreach(EditModeInfo emi in editmodes)
{
// Add all non-config-specific buttons to interface
if((emi.ButtonImage != null) && (emi.ButtonDesc != null) && !emi.ConfigSpecific)
General.MainWindow.AddEditModeButton(emi);
}
}
// This returns specific editing mode info by name
public EditModeInfo GetEditModeInfo(string editmodename)
{
// Find the edit mode
foreach(EditModeInfo emi in editmodes)
{
// Mode matches class name?
if(emi.ToString() == editmodename) return emi;
}
// No such mode found
return null;
}
// This is called when the game canfiguration is set or changed
public void GameConfigurationChanged()
{
// Remove all config-specific editing mode buttons from toolbar
General.MainWindow.RemoveSpecificEditModeButtons();
// Go for all edit modes to add buttons
foreach(EditModeInfo emi in editmodes)
{
// Add only non-config-specific buttons to interface
if((emi.ButtonImage != null) && (emi.ButtonDesc != null) && emi.ConfigSpecific)
{
// Add if this button is specified by the game config
if(General.Map.Config.IsEditModeSpecified(emi.Type.Name))
General.MainWindow.AddEditModeButton(emi);
}
}
}
// This returns a plugin by assembly, or null when plugin cannot be found

View file

@ -39,6 +39,7 @@ namespace CodeImp.DoomBuilder.Windows
System.Windows.Forms.Label label1;
System.Windows.Forms.Label label8;
System.Windows.Forms.Label label4;
System.Windows.Forms.Label label10;
this.labelparameters = new System.Windows.Forms.Label();
this.cancel = new System.Windows.Forms.Button();
this.apply = new System.Windows.Forms.Button();
@ -66,9 +67,13 @@ namespace CodeImp.DoomBuilder.Windows
this.copytexturesets = new System.Windows.Forms.Button();
this.removetextureset = new System.Windows.Forms.Button();
this.addtextureset = new System.Windows.Forms.Button();
this.tabmodes = new System.Windows.Forms.TabPage();
this.listconfigs = new System.Windows.Forms.ListView();
this.columnname = new System.Windows.Forms.ColumnHeader();
this.testprogramdialog = new System.Windows.Forms.OpenFileDialog();
this.listmodes = new System.Windows.Forms.ListView();
this.colmodename = new System.Windows.Forms.ColumnHeader();
this.colmodeplugin = new System.Windows.Forms.ColumnHeader();
label5 = new System.Windows.Forms.Label();
label6 = new System.Windows.Forms.Label();
label3 = new System.Windows.Forms.Label();
@ -78,11 +83,13 @@ namespace CodeImp.DoomBuilder.Windows
label1 = new System.Windows.Forms.Label();
label8 = new System.Windows.Forms.Label();
label4 = new System.Windows.Forms.Label();
label10 = new System.Windows.Forms.Label();
this.tabs.SuspendLayout();
this.tabresources.SuspendLayout();
this.tabnodebuilder.SuspendLayout();
this.tabtesting.SuspendLayout();
this.tabtextures.SuspendLayout();
this.tabmodes.SuspendLayout();
this.SuspendLayout();
//
// label5
@ -102,7 +109,7 @@ namespace CodeImp.DoomBuilder.Windows
label6.AutoEllipsis = true;
label6.Location = new System.Drawing.Point(12, 15);
label6.Name = "label6";
label6.Size = new System.Drawing.Size(394, 37);
label6.Size = new System.Drawing.Size(452, 37);
label6.TabIndex = 21;
label6.Text = "These are the resources that will be loaded when this configuration is chosen for" +
" editing. Usually you add your IWAD (like doom.wad or doom2.wad) here.";
@ -114,7 +121,7 @@ namespace CodeImp.DoomBuilder.Windows
label3.AutoEllipsis = true;
label3.Location = new System.Drawing.Point(12, 15);
label3.Name = "label3";
label3.Size = new System.Drawing.Size(385, 54);
label3.Size = new System.Drawing.Size(443, 54);
label3.TabIndex = 22;
label3.Text = resources.GetString("label3.Text");
//
@ -143,7 +150,7 @@ namespace CodeImp.DoomBuilder.Windows
label9.AutoEllipsis = true;
label9.Location = new System.Drawing.Point(12, 15);
label9.Name = "label9";
label9.Size = new System.Drawing.Size(394, 54);
label9.Size = new System.Drawing.Size(452, 54);
label9.TabIndex = 23;
label9.Text = "Here you can specify the program settings to use for launching a game engine when" +
" testing the map. Press F1 for help with custom parameters.";
@ -173,10 +180,21 @@ namespace CodeImp.DoomBuilder.Windows
label4.AutoEllipsis = true;
label4.Location = new System.Drawing.Point(12, 15);
label4.Name = "label4";
label4.Size = new System.Drawing.Size(394, 75);
label4.Size = new System.Drawing.Size(445, 75);
label4.TabIndex = 24;
label4.Text = resources.GetString("label4.Text");
//
// label10
//
label10.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
label10.AutoEllipsis = true;
label10.Location = new System.Drawing.Point(12, 15);
label10.Name = "label10";
label10.Size = new System.Drawing.Size(445, 58);
label10.TabIndex = 25;
label10.Text = resources.GetString("label10.Text");
//
// labelparameters
//
this.labelparameters.AutoSize = true;
@ -191,7 +209,7 @@ namespace CodeImp.DoomBuilder.Windows
//
this.cancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.cancel.Location = new System.Drawing.Point(567, 368);
this.cancel.Location = new System.Drawing.Point(617, 368);
this.cancel.Name = "cancel";
this.cancel.Size = new System.Drawing.Size(112, 25);
this.cancel.TabIndex = 17;
@ -202,7 +220,7 @@ namespace CodeImp.DoomBuilder.Windows
// apply
//
this.apply.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.apply.Location = new System.Drawing.Point(449, 368);
this.apply.Location = new System.Drawing.Point(499, 368);
this.apply.Name = "apply";
this.apply.Size = new System.Drawing.Size(112, 25);
this.apply.TabIndex = 16;
@ -212,20 +230,22 @@ namespace CodeImp.DoomBuilder.Windows
//
// tabs
//
this.tabs.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
this.tabs.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.tabs.Controls.Add(this.tabresources);
this.tabs.Controls.Add(this.tabnodebuilder);
this.tabs.Controls.Add(this.tabtesting);
this.tabs.Controls.Add(this.tabtextures);
this.tabs.Controls.Add(this.tabmodes);
this.tabs.Enabled = false;
this.tabs.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.tabs.ItemSize = new System.Drawing.Size(100, 19);
this.tabs.Location = new System.Drawing.Point(256, 12);
this.tabs.Location = new System.Drawing.Point(248, 12);
this.tabs.Name = "tabs";
this.tabs.Padding = new System.Drawing.Point(20, 3);
this.tabs.SelectedIndex = 0;
this.tabs.Size = new System.Drawing.Size(423, 345);
this.tabs.Size = new System.Drawing.Size(481, 345);
this.tabs.TabIndex = 18;
//
// tabresources
@ -237,7 +257,7 @@ namespace CodeImp.DoomBuilder.Windows
this.tabresources.Location = new System.Drawing.Point(4, 23);
this.tabresources.Name = "tabresources";
this.tabresources.Padding = new System.Windows.Forms.Padding(6);
this.tabresources.Size = new System.Drawing.Size(415, 318);
this.tabresources.Size = new System.Drawing.Size(473, 318);
this.tabresources.TabIndex = 0;
this.tabresources.Text = "Resources";
this.tabresources.UseVisualStyleBackColor = true;
@ -251,7 +271,7 @@ namespace CodeImp.DoomBuilder.Windows
this.configdata.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.configdata.Location = new System.Drawing.Point(15, 55);
this.configdata.Name = "configdata";
this.configdata.Size = new System.Drawing.Size(382, 220);
this.configdata.Size = new System.Drawing.Size(440, 220);
this.configdata.TabIndex = 20;
this.configdata.OnContentChanged += new CodeImp.DoomBuilder.Controls.ResourceListEditor.ContentChanged(this.resourcelocations_OnContentChanged);
//
@ -266,7 +286,7 @@ namespace CodeImp.DoomBuilder.Windows
this.tabnodebuilder.Location = new System.Drawing.Point(4, 23);
this.tabnodebuilder.Name = "tabnodebuilder";
this.tabnodebuilder.Padding = new System.Windows.Forms.Padding(6);
this.tabnodebuilder.Size = new System.Drawing.Size(415, 318);
this.tabnodebuilder.Size = new System.Drawing.Size(473, 318);
this.tabnodebuilder.TabIndex = 1;
this.tabnodebuilder.Text = "Nodebuilder";
this.tabnodebuilder.UseVisualStyleBackColor = true;
@ -279,7 +299,7 @@ namespace CodeImp.DoomBuilder.Windows
this.nodebuildertest.FormattingEnabled = true;
this.nodebuildertest.Location = new System.Drawing.Point(167, 122);
this.nodebuildertest.Name = "nodebuildertest";
this.nodebuildertest.Size = new System.Drawing.Size(230, 22);
this.nodebuildertest.Size = new System.Drawing.Size(288, 22);
this.nodebuildertest.Sorted = true;
this.nodebuildertest.TabIndex = 25;
this.nodebuildertest.SelectedIndexChanged += new System.EventHandler(this.nodebuildertest_SelectedIndexChanged);
@ -292,7 +312,7 @@ namespace CodeImp.DoomBuilder.Windows
this.nodebuildersave.FormattingEnabled = true;
this.nodebuildersave.Location = new System.Drawing.Point(167, 83);
this.nodebuildersave.Name = "nodebuildersave";
this.nodebuildersave.Size = new System.Drawing.Size(230, 22);
this.nodebuildersave.Size = new System.Drawing.Size(288, 22);
this.nodebuildersave.Sorted = true;
this.nodebuildersave.TabIndex = 23;
this.nodebuildersave.SelectedIndexChanged += new System.EventHandler(this.nodebuildersave_SelectedIndexChanged);
@ -315,7 +335,7 @@ namespace CodeImp.DoomBuilder.Windows
this.tabtesting.Location = new System.Drawing.Point(4, 23);
this.tabtesting.Name = "tabtesting";
this.tabtesting.Padding = new System.Windows.Forms.Padding(6);
this.tabtesting.Size = new System.Drawing.Size(415, 318);
this.tabtesting.Size = new System.Drawing.Size(473, 318);
this.tabtesting.TabIndex = 2;
this.tabtesting.Text = "Testing";
this.tabtesting.UseVisualStyleBackColor = true;
@ -339,16 +359,17 @@ namespace CodeImp.DoomBuilder.Windows
this.skill.GeneralizedCategories = null;
this.skill.Location = new System.Drawing.Point(87, 94);
this.skill.Name = "skill";
this.skill.Size = new System.Drawing.Size(271, 21);
this.skill.Size = new System.Drawing.Size(329, 21);
this.skill.TabIndex = 35;
this.skill.Value = 402;
this.skill.ValueChanges += new System.EventHandler(this.skill_ValueChanges);
//
// browsetestprogram
//
this.browsetestprogram.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.browsetestprogram.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.browsetestprogram.Image = global::CodeImp.DoomBuilder.Properties.Resources.Folder;
this.browsetestprogram.Location = new System.Drawing.Point(363, 58);
this.browsetestprogram.Location = new System.Drawing.Point(422, 58);
this.browsetestprogram.Name = "browsetestprogram";
this.browsetestprogram.Padding = new System.Windows.Forms.Padding(0, 0, 1, 3);
this.browsetestprogram.Size = new System.Drawing.Size(30, 23);
@ -375,7 +396,7 @@ namespace CodeImp.DoomBuilder.Windows
this.testresult.Multiline = true;
this.testresult.Name = "testresult";
this.testresult.ReadOnly = true;
this.testresult.Size = new System.Drawing.Size(308, 79);
this.testresult.Size = new System.Drawing.Size(366, 79);
this.testresult.TabIndex = 31;
this.testresult.Visible = false;
//
@ -396,7 +417,7 @@ namespace CodeImp.DoomBuilder.Windows
this.testparameters.Location = new System.Drawing.Point(86, 156);
this.testparameters.Multiline = true;
this.testparameters.Name = "testparameters";
this.testparameters.Size = new System.Drawing.Size(308, 41);
this.testparameters.Size = new System.Drawing.Size(366, 41);
this.testparameters.TabIndex = 28;
this.testparameters.Visible = false;
this.testparameters.TextChanged += new System.EventHandler(this.testparameters_TextChanged);
@ -408,7 +429,7 @@ namespace CodeImp.DoomBuilder.Windows
this.testapplication.Location = new System.Drawing.Point(86, 59);
this.testapplication.Name = "testapplication";
this.testapplication.ReadOnly = true;
this.testapplication.Size = new System.Drawing.Size(272, 20);
this.testapplication.Size = new System.Drawing.Size(330, 20);
this.testapplication.TabIndex = 25;
this.testapplication.TextChanged += new System.EventHandler(this.testapplication_TextChanged);
//
@ -425,19 +446,22 @@ namespace CodeImp.DoomBuilder.Windows
this.tabtextures.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.tabtextures.Location = new System.Drawing.Point(4, 23);
this.tabtextures.Name = "tabtextures";
this.tabtextures.Size = new System.Drawing.Size(415, 318);
this.tabtextures.Size = new System.Drawing.Size(473, 318);
this.tabtextures.TabIndex = 3;
this.tabtextures.Text = "Textures";
this.tabtextures.UseVisualStyleBackColor = true;
//
// listtextures
//
this.listtextures.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.listtextures.FullRowSelect = true;
this.listtextures.HideSelection = false;
this.listtextures.Location = new System.Drawing.Point(15, 84);
this.listtextures.Name = "listtextures";
this.listtextures.ShowGroups = false;
this.listtextures.Size = new System.Drawing.Size(382, 147);
this.listtextures.Size = new System.Drawing.Size(442, 147);
this.listtextures.SmallImageList = this.smallimages;
this.listtextures.Sorting = System.Windows.Forms.SortOrder.Ascending;
this.listtextures.TabIndex = 32;
@ -454,6 +478,7 @@ namespace CodeImp.DoomBuilder.Windows
//
// restoretexturesets
//
this.restoretexturesets.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.restoretexturesets.Location = new System.Drawing.Point(15, 275);
this.restoretexturesets.Name = "restoretexturesets";
this.restoretexturesets.Size = new System.Drawing.Size(140, 24);
@ -464,6 +489,7 @@ namespace CodeImp.DoomBuilder.Windows
//
// edittextureset
//
this.edittextureset.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.edittextureset.Enabled = false;
this.edittextureset.Location = new System.Drawing.Point(88, 237);
this.edittextureset.Name = "edittextureset";
@ -475,8 +501,9 @@ namespace CodeImp.DoomBuilder.Windows
//
// pastetexturesets
//
this.pastetexturesets.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.pastetexturesets.Enabled = false;
this.pastetexturesets.Location = new System.Drawing.Point(339, 237);
this.pastetexturesets.Location = new System.Drawing.Point(399, 237);
this.pastetexturesets.Name = "pastetexturesets";
this.pastetexturesets.Size = new System.Drawing.Size(58, 24);
this.pastetexturesets.TabIndex = 29;
@ -486,8 +513,9 @@ namespace CodeImp.DoomBuilder.Windows
//
// copytexturesets
//
this.copytexturesets.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.copytexturesets.Enabled = false;
this.copytexturesets.Location = new System.Drawing.Point(275, 237);
this.copytexturesets.Location = new System.Drawing.Point(335, 237);
this.copytexturesets.Name = "copytexturesets";
this.copytexturesets.Size = new System.Drawing.Size(58, 24);
this.copytexturesets.TabIndex = 28;
@ -497,6 +525,7 @@ namespace CodeImp.DoomBuilder.Windows
//
// removetextureset
//
this.removetextureset.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.removetextureset.Enabled = false;
this.removetextureset.Location = new System.Drawing.Point(161, 237);
this.removetextureset.Name = "removetextureset";
@ -508,6 +537,7 @@ namespace CodeImp.DoomBuilder.Windows
//
// addtextureset
//
this.addtextureset.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.addtextureset.Location = new System.Drawing.Point(15, 237);
this.addtextureset.Name = "addtextureset";
this.addtextureset.Size = new System.Drawing.Size(67, 24);
@ -516,6 +546,18 @@ namespace CodeImp.DoomBuilder.Windows
this.addtextureset.UseVisualStyleBackColor = true;
this.addtextureset.Click += new System.EventHandler(this.addtextureset_Click);
//
// tabmodes
//
this.tabmodes.Controls.Add(this.listmodes);
this.tabmodes.Controls.Add(label10);
this.tabmodes.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.tabmodes.Location = new System.Drawing.Point(4, 23);
this.tabmodes.Name = "tabmodes";
this.tabmodes.Size = new System.Drawing.Size(473, 318);
this.tabmodes.TabIndex = 4;
this.tabmodes.Text = "Modes";
this.tabmodes.UseVisualStyleBackColor = true;
//
// listconfigs
//
this.listconfigs.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
@ -546,12 +588,39 @@ namespace CodeImp.DoomBuilder.Windows
this.testprogramdialog.Filter = "Executable Files (*.exe)|*.exe|Batch Files (*.bat)|*.bat";
this.testprogramdialog.Title = "Browse Test Program";
//
// listmodes
//
this.listmodes.CheckBoxes = true;
this.listmodes.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.colmodename,
this.colmodeplugin});
this.listmodes.FullRowSelect = true;
this.listmodes.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable;
this.listmodes.Location = new System.Drawing.Point(15, 76);
this.listmodes.MultiSelect = false;
this.listmodes.Name = "listmodes";
this.listmodes.ShowGroups = false;
this.listmodes.Size = new System.Drawing.Size(442, 226);
this.listmodes.TabIndex = 26;
this.listmodes.UseCompatibleStateImageBehavior = false;
this.listmodes.View = System.Windows.Forms.View.Details;
//
// colmodename
//
this.colmodename.Text = "Editing Mode";
this.colmodename.Width = 179;
//
// colmodeplugin
//
this.colmodeplugin.Text = "Plugin";
this.colmodeplugin.Width = 221;
//
// ConfigForm
//
this.AcceptButton = this.apply;
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.CancelButton = this.cancel;
this.ClientSize = new System.Drawing.Size(690, 403);
this.ClientSize = new System.Drawing.Size(740, 403);
this.Controls.Add(this.listconfigs);
this.Controls.Add(this.tabs);
this.Controls.Add(this.cancel);
@ -574,6 +643,7 @@ namespace CodeImp.DoomBuilder.Windows
this.tabtesting.ResumeLayout(false);
this.tabtesting.PerformLayout();
this.tabtextures.ResumeLayout(false);
this.tabmodes.ResumeLayout(false);
this.ResumeLayout(false);
}
@ -610,5 +680,9 @@ namespace CodeImp.DoomBuilder.Windows
private System.Windows.Forms.Button removetextureset;
private System.Windows.Forms.ListView listtextures;
private System.Windows.Forms.ImageList smallimages;
private System.Windows.Forms.TabPage tabmodes;
private System.Windows.Forms.ListView listmodes;
private System.Windows.Forms.ColumnHeader colmodename;
private System.Windows.Forms.ColumnHeader colmodeplugin;
}
}

View file

@ -177,6 +177,15 @@
<data name="label4.Text" xml:space="preserve">
<value>Texture Sets are a way to group textures and flats into categories, so that you can easily find a texture for the specific style or purpose you need by selecting one of the categories. Textures that are not in any category are automatically shown in the "Others" category.</value>
</data>
<metadata name="label10.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="label10.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<data name="label10.Text" xml:space="preserve">
<value>Here you can select the editing modes that you wish to use in this configuration. This is usefull in case there are plugins with additional editing modes that can be used instead of the original editing modes.</value>
</data>
<metadata name="labelparameters.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
@ -234,6 +243,9 @@
<metadata name="tabtextures.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="listtextures.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="smallimages.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>159, 17</value>
</metadata>
@ -298,6 +310,12 @@
<metadata name="addtextureset.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="tabmodes.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="listmodes.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="listconfigs.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>

View file

@ -200,10 +200,10 @@ namespace CodeImp.DoomBuilder.Windows
{
// Check appropriate button on interface
// And show the mode name
if(General.Map.Mode != null)
if(General.Map.Editing.Mode != null)
{
General.MainWindow.CheckEditModeButton(General.Map.Mode.EditModeButtonName);
General.MainWindow.DisplayModeName(General.Map.Mode.Attributes.DisplayName);
General.MainWindow.CheckEditModeButton(General.Map.Editing.Mode.EditModeButtonName);
General.MainWindow.DisplayModeName(General.Map.Editing.Mode.Attributes.DisplayName);
}
else
{
@ -214,8 +214,8 @@ namespace CodeImp.DoomBuilder.Windows
// View mode only matters in classic editing modes
for(int i = 0; i < Renderer2D.NUM_VIEW_MODES; i++)
{
viewmodesitems[i].Enabled = (General.Map.Mode is ClassicMode);
viewmodesbuttons[i].Enabled = (General.Map.Mode is ClassicMode);
viewmodesitems[i].Enabled = (General.Map.Editing.Mode is ClassicMode);
viewmodesbuttons[i].Enabled = (General.Map.Editing.Mode is ClassicMode);
}
}
@ -691,7 +691,7 @@ namespace CodeImp.DoomBuilder.Windows
if(General.Map == null) return;
// In classic mode?
if(General.Map.Mode is ClassicMode)
if(General.Map.Editing.Mode is ClassicMode)
{
// Requested from menu?
if(sender is ToolStripMenuItem)
@ -700,7 +700,7 @@ namespace CodeImp.DoomBuilder.Windows
zoom = int.Parse((sender as ToolStripMenuItem).Tag.ToString(), CultureInfo.InvariantCulture);
// Zoom now
(General.Map.Mode as ClassicMode).SetZoom((float)zoom / 100f);
(General.Map.Editing.Mode as ClassicMode).SetZoom((float)zoom / 100f);
}
}
}
@ -711,8 +711,8 @@ namespace CodeImp.DoomBuilder.Windows
if(General.Map == null) return;
// In classic mode?
if(General.Map.Mode is ClassicMode)
(General.Map.Mode as ClassicMode).CenterInScreen();
if(General.Map.Editing.Mode is ClassicMode)
(General.Map.Editing.Mode as ClassicMode).CenterInScreen();
}
// This changes grid display
@ -736,7 +736,7 @@ namespace CodeImp.DoomBuilder.Windows
if(General.Map == null) return;
// In classic mode?
if(General.Map.Mode is ClassicMode)
if(General.Map.Editing.Mode is ClassicMode)
{
// Requested from menu?
if(sender is ToolStripMenuItem)
@ -792,9 +792,9 @@ namespace CodeImp.DoomBuilder.Windows
// This redraws the display on the next paint event
public void RedrawDisplay()
{
if((General.Map != null) && (General.Map.Mode != null))
if((General.Map != null) && (General.Map.Editing.Mode != null))
{
General.Map.Mode.OnRedrawDisplay();
General.Map.Editing.Mode.OnRedrawDisplay();
}
else
{
@ -807,9 +807,9 @@ namespace CodeImp.DoomBuilder.Windows
{
if(General.Map != null)
{
if(General.Map.Mode != null)
if(General.Map.Editing.Mode != null)
{
if(!displayresized) General.Map.Mode.OnPresentDisplay();
if(!displayresized) General.Map.Editing.Mode.OnPresentDisplay();
}
else
{
@ -867,10 +867,10 @@ namespace CodeImp.DoomBuilder.Windows
}
// Mouse click
private void display_MouseClick(object sender, MouseEventArgs e) { if((General.Map != null) && (General.Map.Mode != null)) General.Map.Mode.OnMouseClick(e); }
private void display_MouseClick(object sender, MouseEventArgs e) { if((General.Map != null) && (General.Map.Editing.Mode != null)) General.Map.Editing.Mode.OnMouseClick(e); }
// Mouse doubleclick
private void display_MouseDoubleClick(object sender, MouseEventArgs e) { if((General.Map != null) && (General.Map.Mode != null)) General.Map.Mode.OnMouseDoubleClick(e); }
private void display_MouseDoubleClick(object sender, MouseEventArgs e) { if((General.Map != null) && (General.Map.Editing.Mode != null)) General.Map.Editing.Mode.OnMouseDoubleClick(e); }
// Mouse down
private void display_MouseDown(object sender, MouseEventArgs e)
@ -891,27 +891,27 @@ namespace CodeImp.DoomBuilder.Windows
General.Actions.KeyPressed(key);
// Invoke on editing mode
if((General.Map != null) && (General.Map.Mode != null)) General.Map.Mode.OnMouseDown(e);
if((General.Map != null) && (General.Map.Editing.Mode != null)) General.Map.Editing.Mode.OnMouseDown(e);
}
// Mouse enters
private void display_MouseEnter(object sender, EventArgs e)
{
mouseinside = true;
if((General.Map != null) && (mouseinput == null) && (General.Map.Mode != null)) General.Map.Mode.OnMouseEnter(e);
if((General.Map != null) && (mouseinput == null) && (General.Map.Editing.Mode != null)) General.Map.Editing.Mode.OnMouseEnter(e);
}
// Mouse leaves
private void display_MouseLeave(object sender, EventArgs e)
{
mouseinside = false;
if((General.Map != null) && (mouseinput == null) && (General.Map.Mode != null)) General.Map.Mode.OnMouseLeave(e);
if((General.Map != null) && (mouseinput == null) && (General.Map.Editing.Mode != null)) General.Map.Editing.Mode.OnMouseLeave(e);
}
// Mouse moves
private void display_MouseMove(object sender, MouseEventArgs e)
{
if((General.Map != null) && (mouseinput == null) && (General.Map.Mode != null)) General.Map.Mode.OnMouseMove(e);
if((General.Map != null) && (mouseinput == null) && (General.Map.Editing.Mode != null)) General.Map.Editing.Mode.OnMouseMove(e);
}
// Mouse up
@ -933,7 +933,7 @@ namespace CodeImp.DoomBuilder.Windows
General.Actions.KeyReleased(key);
// Invoke on editing mode
if((General.Map != null) && (General.Map.Mode != null)) General.Map.Mode.OnMouseUp(e);
if((General.Map != null) && (General.Map.Editing.Mode != null)) General.Map.Editing.Mode.OnMouseUp(e);
}
#endregion
@ -1082,7 +1082,7 @@ namespace CodeImp.DoomBuilder.Windows
General.Actions.KeyPressed((int)e.KeyData);
// Invoke on editing mode
if((General.Map != null) && (General.Map.Mode != null)) General.Map.Mode.OnKeyDown(e);
if((General.Map != null) && (General.Map.Editing.Mode != null)) General.Map.Editing.Mode.OnKeyDown(e);
}
// When a key is released
@ -1103,7 +1103,7 @@ namespace CodeImp.DoomBuilder.Windows
General.Actions.KeyReleased((int)e.KeyData);
// Invoke on editing mode
if((General.Map != null) && (General.Map.Mode != null)) General.Map.Mode.OnKeyUp(e);
if((General.Map != null) && (General.Map.Editing.Mode != null)) General.Map.Editing.Mode.OnKeyUp(e);
}
#endregion
@ -1311,29 +1311,18 @@ namespace CodeImp.DoomBuilder.Windows
}
// This removes the config-specific editing mode buttons
internal void RemoveSpecificEditModeButtons()
internal void RemoveEditModeButtons()
{
bool removed;
do
// Go for all items
foreach(ToolStripItem i in editmodeitems)
{
// Go for all items
removed = false;
foreach(ToolStripItem i in editmodeitems)
{
// Only remove the button if it is for a config-specific editing mode
if((i.Tag as EditModeInfo).ConfigSpecific)
{
// Remove it and restart
editmodeitems.Remove(i);
toolbar.Items.Remove(i);
menumode.DropDownItems.Remove(i);
removed = true;
break;
}
}
// Remove it and restart
toolbar.Items.Remove(i);
menumode.DropDownItems.Remove(i);
}
while(removed);
// Done
editmodeitems.Clear();
}
// This adds an editing mode button to the toolbar and edit menu
@ -1650,9 +1639,9 @@ namespace CodeImp.DoomBuilder.Windows
// Enable/disable items
itemundo.Enabled = (General.Map != null) && (General.Map.UndoRedo.NextUndo != null);
itemredo.Enabled = (General.Map != null) && (General.Map.UndoRedo.NextRedo != null);
itemcut.Enabled = (General.Map != null) && General.Map.Mode.Attributes.AllowCopyPaste;
itemcopy.Enabled = (General.Map != null) && General.Map.Mode.Attributes.AllowCopyPaste;
itempaste.Enabled = (General.Map != null) && General.Map.Mode.Attributes.AllowCopyPaste;
itemcut.Enabled = (General.Map != null) && General.Map.Editing.Mode.Attributes.AllowCopyPaste;
itemcopy.Enabled = (General.Map != null) && General.Map.Editing.Mode.Attributes.AllowCopyPaste;
itempaste.Enabled = (General.Map != null) && General.Map.Editing.Mode.Attributes.AllowCopyPaste;
itemmapoptions.Enabled = (General.Map != null);
itemsnaptogrid.Enabled = (General.Map != null);
itemautomerge.Enabled = (General.Map != null);
@ -2052,13 +2041,13 @@ namespace CodeImp.DoomBuilder.Windows
{
// Process mouse input
deltamouse = mouseinput.Process();
if((General.Map != null) && (General.Map.Mode != null))
General.Map.Mode.OnMouseInput(deltamouse);
if((General.Map != null) && (General.Map.Editing.Mode != null))
General.Map.Editing.Mode.OnMouseInput(deltamouse);
}
// Process signal
if((General.Map != null) && (General.Map.Mode != null))
General.Map.Mode.OnProcess(deltatime);
if((General.Map != null) && (General.Map.Editing.Mode != null))
General.Map.Editing.Mode.OnProcess(deltatime);
}
#endregion