UltimateZoneBuilder/Source/BuilderModes/General/BuilderPlug.cs

115 lines
2.5 KiB
C#
Raw Normal View History

2008-05-15 08:56:23 +00:00
#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;
2008-05-15 08:56:23 +00:00
using CodeImp.DoomBuilder.IO;
using CodeImp.DoomBuilder.Map;
using CodeImp.DoomBuilder.Rendering;
using CodeImp.DoomBuilder.Geometry;
using System.Drawing;
using CodeImp.DoomBuilder.Editing;
using CodeImp.DoomBuilder.Plugins;
#endregion
namespace CodeImp.DoomBuilder.BuilderModes
{
public class BuilderPlug : Plug
{
#region ================== Constants
#endregion
#region ================== Variables
// Static instance
private static BuilderPlug me;
// Main objects
private MenusForm menusform;
2008-05-15 19:31:11 +00:00
private CurveLinedefsForm curvelinedefsform;
2008-05-15 08:56:23 +00:00
#endregion
#region ================== Properties
public static BuilderPlug Me { get { return me; } }
public MenusForm MenusForm { get { return menusform; } }
2008-05-15 19:31:11 +00:00
public CurveLinedefsForm CurveLinedefsForm { get { return curvelinedefsform; } }
2008-05-15 08:56:23 +00:00
#endregion
#region ================== Initialize / Dispose
// When plugin is initialized
public override void OnInitialize()
{
// Setup
me = this;
// Load menus form and register it
menusform = new MenusForm();
menusform.Register();
2008-05-15 19:31:11 +00:00
// Load curve linedefs form
curvelinedefsform = new CurveLinedefsForm();
2008-05-15 08:56:23 +00:00
}
// Disposer
public override void Dispose()
{
// Not already disposed?
if(!IsDisposed)
{
// Clean up
menusform.Unregister();
menusform.Dispose();
2008-05-15 19:31:11 +00:00
menusform = null;
curvelinedefsform.Dispose();
curvelinedefsform = null;
2008-05-15 08:56:23 +00:00
// Done
me = null;
base.Dispose();
}
}
#endregion
#region ================== Events
// When the editing mode changes
public override void OnModeChange(EditMode oldmode, EditMode newmode)
{
// Show the correct menu for the new mode
menusform.ShowEditingModeMenu(newmode);
}
#endregion
}
}