merged plugin system into trunk
|
@ -1,16 +1,34 @@
|
|||
|
||||
shortcuts
|
||||
{
|
||||
closemap = 0;
|
||||
configuration = 116;
|
||||
newmap = 131150;
|
||||
openmap = 131151;
|
||||
scrolleast = 39;
|
||||
scrollnorth = 38;
|
||||
scrollsouth = 40;
|
||||
scrollwest = 37;
|
||||
zoomin = 65530;
|
||||
zoomout = 65531;
|
||||
builder_closemap = 0;
|
||||
builder_configuration = 117;
|
||||
builder_newmap = 131150;
|
||||
builder_openmap = 131151;
|
||||
builder_scrolleast = 39;
|
||||
builder_scrollnorth = 38;
|
||||
builder_scrollsouth = 40;
|
||||
builder_scrollwest = 37;
|
||||
builder_zoomin = 65530;
|
||||
builder_zoomout = 65531;
|
||||
builder_preferences = 116;
|
||||
builder_savemap = 0;
|
||||
builder_savemapas = 0;
|
||||
builder_savemapinto = 0;
|
||||
builder_mapoptions = 113;
|
||||
builder_reloadresources = 119;
|
||||
builder_testaction = 123;
|
||||
builder_cancelmode = 27;
|
||||
builder_gridsetup = 71;
|
||||
builder_undo = 131162;
|
||||
builder_redo = 131161;
|
||||
builder_togglesnap = 0;
|
||||
builder_clearselection = 67;
|
||||
builder_toggleautomerge = 0;
|
||||
buildermodes_thingsmode = 84;
|
||||
buildermodes_linedefsmode = 76;
|
||||
buildermodes_verticesmode = 86;
|
||||
buildermodes_sectorsmode = 83;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -3,6 +3,8 @@ Microsoft Visual Studio Solution File, Format Version 9.00
|
|||
# Visual Studio 2005
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Builder", "Source\Builder.csproj", "{818B3D10-F791-4C3F-9AF5-BB2D0079B63C}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BuilderModes", "Source\BuilderModes\BuilderModes.csproj", "{B42D5AA0-F9A6-4234-9C4B-A05B11A64851}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
|
@ -13,6 +15,10 @@ Global
|
|||
{818B3D10-F791-4C3F-9AF5-BB2D0079B63C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{818B3D10-F791-4C3F-9AF5-BB2D0079B63C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{818B3D10-F791-4C3F-9AF5-BB2D0079B63C}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{B42D5AA0-F9A6-4234-9C4B-A05B11A64851}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{B42D5AA0-F9A6-4234-9C4B-A05B11A64851}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{B42D5AA0-F9A6-4234-9C4B-A05B11A64851}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{B42D5AA0-F9A6-4234-9C4B-A05B11A64851}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
|
BIN
Resources/Icons/WAuthor.png
Normal file
After Width: | Height: | Size: 601 B |
|
@ -69,16 +69,13 @@
|
|||
<Compile Include="Data\SimpleTextureImage.cs" />
|
||||
<Compile Include="Data\SpriteImage.cs" />
|
||||
<Compile Include="Data\TextureImage.cs" />
|
||||
<Compile Include="Editing\DragVerticesMode.cs" />
|
||||
<Compile Include="Editing\EditMode.cs" />
|
||||
<Compile Include="Editing\EditModeAttribute.cs" />
|
||||
<Compile Include="Editing\EditModeInfo.cs" />
|
||||
<Compile Include="Editing\GridSetup.cs" />
|
||||
<Compile Include="Editing\LinedefsMode.cs" />
|
||||
<Compile Include="Editing\SectorsMode.cs" />
|
||||
<Compile Include="Editing\ThingsMode.cs" />
|
||||
<Compile Include="Editing\UndoGroup.cs" />
|
||||
<Compile Include="Editing\UndoManager.cs" />
|
||||
<Compile Include="Editing\UndoSnapshot.cs" />
|
||||
<Compile Include="Editing\VerticesMode.cs" />
|
||||
<Compile Include="Editing\ClassicMode.cs" />
|
||||
<Compile Include="Controls\ActionDelegate.cs" />
|
||||
<Compile Include="Controls\Action.cs" />
|
||||
|
@ -169,6 +166,7 @@
|
|||
<Compile Include="Interface\ImageSelectorControl.Designer.cs">
|
||||
<DependentUpon>ImageSelectorControl.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Interface\IMainForm.cs" />
|
||||
<Compile Include="Interface\LinedefEditForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
|
@ -278,6 +276,8 @@
|
|||
<Compile Include="Map\SidedefPart.cs" />
|
||||
<Compile Include="Map\Thing.cs" />
|
||||
<Compile Include="Map\Vertex.cs" />
|
||||
<Compile Include="Plugins\Plugin.cs" />
|
||||
<Compile Include="Plugins\PluginManager.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
|
@ -292,6 +292,8 @@
|
|||
<Compile Include="Rendering\D3DShader.cs" />
|
||||
<Compile Include="Rendering\FlatVertex.cs" />
|
||||
<Compile Include="Rendering\ID3DResource.cs" />
|
||||
<Compile Include="Rendering\IRenderer2D.cs" />
|
||||
<Compile Include="Rendering\IRenderer3D.cs" />
|
||||
<Compile Include="Rendering\PixelColor.cs" />
|
||||
<Compile Include="Rendering\PixelColorBlock.cs" />
|
||||
<Compile Include="Rendering\Plotter.cs" />
|
||||
|
@ -349,13 +351,9 @@
|
|||
<None Include="Resources\Grid2.png" />
|
||||
<None Include="Resources\Hourglass.png" />
|
||||
<None Include="Resources\Filter.png" />
|
||||
<None Include="Resources\ThingsMode.png" />
|
||||
<None Include="Resources\Status1.png" />
|
||||
<None Include="Resources\Status2.png" />
|
||||
<None Include="Resources\Status0.png" />
|
||||
<None Include="Resources\VerticesMode.png" />
|
||||
<None Include="Resources\SectorsMode.png" />
|
||||
<None Include="Resources\LinesMode.png" />
|
||||
<None Include="Resources\ColorPick.png" />
|
||||
<None Include="Resources\Zoom.png" />
|
||||
<None Include="Resources\Properties.png" />
|
||||
|
|
80
Source/BuilderModes/BuilderModes.csproj
Normal file
|
@ -0,0 +1,80 @@
|
|||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>8.0.50727</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{B42D5AA0-F9A6-4234-9C4B-A05B11A64851}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>CodeImp.DoomBuilder.BuilderModes</RootNamespace>
|
||||
<AssemblyName>BuilderModes</AssemblyName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\..\Build\Plugins\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>..\..\Build\Plugins\</OutputPath>
|
||||
<DefineConstants>
|
||||
</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Editing\DragVerticesMode.cs" />
|
||||
<Compile Include="Editing\LinedefsMode.cs" />
|
||||
<Compile Include="Editing\WAuthorMode.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Editing\SectorsMode.cs" />
|
||||
<Compile Include="Editing\ThingsMode.cs" />
|
||||
<Compile Include="Editing\VerticesMode.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Builder.csproj">
|
||||
<Project>{818B3D10-F791-4C3F-9AF5-BB2D0079B63C}</Project>
|
||||
<Name>Builder</Name>
|
||||
<Private>False</Private>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Resources\Actions.cfg" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Resources\ThingsMode.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Resources\VerticesMode.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Resources\LinesMode.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Resources\SectorsMode.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Resources\WAuthor.png" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
|
@ -30,6 +30,7 @@ using CodeImp.DoomBuilder.Map;
|
|||
using CodeImp.DoomBuilder.Rendering;
|
||||
using CodeImp.DoomBuilder.Geometry;
|
||||
using System.Drawing;
|
||||
using CodeImp.DoomBuilder.Editing;
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -37,8 +38,9 @@ using System.Drawing;
|
|||
// This mode if for quickly dragging vertices without a layer.
|
||||
// The geometry is merged and the mode returns to VerticesMode when the mouse is released.
|
||||
|
||||
namespace CodeImp.DoomBuilder.Editing
|
||||
namespace CodeImp.DoomBuilder.BuilderModes.Editing
|
||||
{
|
||||
[EditMode]
|
||||
public class DragVerticesMode : ClassicMode
|
||||
{
|
||||
#region ================== Constants
|
||||
|
@ -77,6 +79,9 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
|
||||
#region ================== Properties
|
||||
|
||||
// Just keep the vertices mode button checked
|
||||
public override string EditModeButtonName { get { return typeof(VerticesMode).Name; } }
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Constructor / Disposer
|
||||
|
@ -116,7 +121,7 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
// Diposer
|
||||
// Disposer
|
||||
public override void Dispose()
|
||||
{
|
||||
// Not already disposed?
|
||||
|
@ -219,9 +224,6 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
public override void Engage()
|
||||
{
|
||||
base.Engage();
|
||||
|
||||
// Check vertices button on main window
|
||||
General.MainWindow.SetVerticesChecked(true);
|
||||
}
|
||||
|
||||
// Disenagaging
|
||||
|
@ -256,10 +258,9 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
}
|
||||
|
||||
// Hide highlight info
|
||||
General.MainWindow.HideInfo();
|
||||
General.Interface.HideInfo();
|
||||
|
||||
// Uncheck vertices button on main window
|
||||
General.MainWindow.SetVerticesChecked(false);
|
||||
// Done
|
||||
Cursor.Current = Cursors.Default;
|
||||
}
|
||||
|
||||
|
@ -287,8 +288,8 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
// This updates the dragging
|
||||
private void Update()
|
||||
{
|
||||
snaptogrid = General.MainWindow.ShiftState ^ General.MainWindow.SnapToGrid;
|
||||
snaptonearest = General.MainWindow.CtrlState;
|
||||
snaptogrid = General.Interface.ShiftState ^ General.Interface.SnapToGrid;
|
||||
snaptonearest = General.Interface.CtrlState;
|
||||
|
||||
// Move selected geometry
|
||||
if(MoveGeometryRelative(mousemappos - dragstartmappos, snaptogrid, snaptonearest))
|
||||
|
@ -297,7 +298,7 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
General.Map.Map.Update();
|
||||
|
||||
// Redraw
|
||||
General.MainWindow.RedrawDisplay();
|
||||
General.Interface.RedrawDisplay();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -325,16 +326,16 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
public override void KeyUp(KeyEventArgs e)
|
||||
{
|
||||
base.KeyUp(e);
|
||||
if(snaptogrid != General.MainWindow.ShiftState ^ General.MainWindow.SnapToGrid) Update();
|
||||
if(snaptonearest != General.MainWindow.CtrlState) Update();
|
||||
if(snaptogrid != General.Interface.ShiftState ^ General.Interface.SnapToGrid) Update();
|
||||
if(snaptonearest != General.Interface.CtrlState) Update();
|
||||
}
|
||||
|
||||
// When a key is pressed
|
||||
public override void KeyDown(KeyEventArgs e)
|
||||
{
|
||||
base.KeyDown(e);
|
||||
if(snaptogrid != General.MainWindow.ShiftState ^ General.MainWindow.SnapToGrid) Update();
|
||||
if(snaptonearest != General.MainWindow.CtrlState) Update();
|
||||
if(snaptogrid != General.Interface.ShiftState ^ General.Interface.SnapToGrid) Update();
|
||||
if(snaptonearest != General.Interface.CtrlState) Update();
|
||||
}
|
||||
|
||||
#endregion
|
|
@ -29,11 +29,16 @@ using CodeImp.DoomBuilder.IO;
|
|||
using CodeImp.DoomBuilder.Map;
|
||||
using CodeImp.DoomBuilder.Rendering;
|
||||
using CodeImp.DoomBuilder.Geometry;
|
||||
using CodeImp.DoomBuilder.Editing;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace CodeImp.DoomBuilder.Editing
|
||||
namespace CodeImp.DoomBuilder.BuilderModes.Editing
|
||||
{
|
||||
[EditMode(SwitchAction = "linedefsmode",
|
||||
ButtonDesc = "Linedefs Mode",
|
||||
ButtonImage = "LinesMode.png",
|
||||
ButtonOrder = int.MinValue + 1)]
|
||||
public class LinedefsMode : ClassicMode
|
||||
{
|
||||
#region ================== Constants
|
||||
|
@ -60,7 +65,7 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
{
|
||||
}
|
||||
|
||||
// Diposer
|
||||
// Disposer
|
||||
public override void Dispose()
|
||||
{
|
||||
// Not already disposed?
|
||||
|
@ -90,9 +95,6 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
public override void Engage()
|
||||
{
|
||||
base.Engage();
|
||||
|
||||
// Check linedefs button on main window
|
||||
General.MainWindow.SetLinedefsChecked(true);
|
||||
}
|
||||
|
||||
// Mode disengages
|
||||
|
@ -117,10 +119,7 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
}
|
||||
|
||||
// Hide highlight info
|
||||
General.MainWindow.HideInfo();
|
||||
|
||||
// Uncheck linedefs button on main window
|
||||
General.MainWindow.SetLinedefsChecked(false);
|
||||
General.Interface.HideInfo();
|
||||
}
|
||||
|
||||
// This redraws the display
|
||||
|
@ -179,9 +178,9 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
|
||||
// Show highlight info
|
||||
if((highlighted != null) && !highlighted.IsDisposed)
|
||||
General.MainWindow.ShowLinedefInfo(highlighted);
|
||||
General.Interface.ShowLinedefInfo(highlighted);
|
||||
else
|
||||
General.MainWindow.HideInfo();
|
||||
General.Interface.HideInfo();
|
||||
}
|
||||
|
||||
// Mouse moves
|
||||
|
@ -242,7 +241,7 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
// Make this the only selection
|
||||
General.Map.Map.ClearSelectedLinedefs();
|
||||
highlighted.Selected = true;
|
||||
General.MainWindow.RedrawDisplay();
|
||||
General.Interface.RedrawDisplay();
|
||||
}
|
||||
|
||||
// Update display
|
||||
|
@ -286,13 +285,13 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
if(selected.Count > 0)
|
||||
{
|
||||
// Show line edit dialog
|
||||
LinedefEditForm.EditLinedefs(General.MainWindow, selected);
|
||||
General.Interface.ShowEditLinedefs(selected);
|
||||
|
||||
// When a single line was selected, deselect it now
|
||||
if(selected.Count == 1) General.Map.Map.ClearSelectedLinedefs();
|
||||
|
||||
// Update entire display
|
||||
General.MainWindow.RedrawDisplay();
|
||||
General.Interface.RedrawDisplay();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -29,11 +29,16 @@ using CodeImp.DoomBuilder.IO;
|
|||
using CodeImp.DoomBuilder.Map;
|
||||
using CodeImp.DoomBuilder.Rendering;
|
||||
using CodeImp.DoomBuilder.Geometry;
|
||||
using CodeImp.DoomBuilder.Editing;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace CodeImp.DoomBuilder.Editing
|
||||
namespace CodeImp.DoomBuilder.BuilderModes.Editing
|
||||
{
|
||||
[EditMode(SwitchAction = "sectorsmode",
|
||||
ButtonDesc = "Sectors Mode",
|
||||
ButtonImage = "SectorsMode.png",
|
||||
ButtonOrder = int.MinValue + 2)]
|
||||
public class SectorsMode : ClassicMode
|
||||
{
|
||||
#region ================== Constants
|
||||
|
@ -58,7 +63,7 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
{
|
||||
}
|
||||
|
||||
// Diposer
|
||||
// Disposer
|
||||
public override void Dispose()
|
||||
{
|
||||
// Not already disposed?
|
||||
|
@ -88,9 +93,6 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
public override void Engage()
|
||||
{
|
||||
base.Engage();
|
||||
|
||||
// Check sectors button on main window
|
||||
General.MainWindow.SetSectorsChecked(true);
|
||||
}
|
||||
|
||||
// Mode disengages
|
||||
|
@ -115,10 +117,7 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
}
|
||||
|
||||
// Hide highlight info
|
||||
General.MainWindow.HideInfo();
|
||||
|
||||
// Uncheck sectors button on main window
|
||||
General.MainWindow.SetSectorsChecked(false);
|
||||
General.Interface.HideInfo();
|
||||
}
|
||||
|
||||
// This redraws the display
|
||||
|
@ -181,9 +180,9 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
|
||||
// Show highlight info
|
||||
if((highlighted != null) && !highlighted.IsDisposed)
|
||||
General.MainWindow.ShowSectorInfo(highlighted);
|
||||
General.Interface.ShowSectorInfo(highlighted);
|
||||
else
|
||||
General.MainWindow.HideInfo();
|
||||
General.Interface.HideInfo();
|
||||
}
|
||||
|
||||
// Mouse moves
|
|
@ -29,11 +29,16 @@ using CodeImp.DoomBuilder.IO;
|
|||
using CodeImp.DoomBuilder.Map;
|
||||
using CodeImp.DoomBuilder.Rendering;
|
||||
using CodeImp.DoomBuilder.Geometry;
|
||||
using CodeImp.DoomBuilder.Editing;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace CodeImp.DoomBuilder.Editing
|
||||
namespace CodeImp.DoomBuilder.BuilderModes.Editing
|
||||
{
|
||||
[EditMode(SwitchAction = "thingsmode",
|
||||
ButtonDesc = "Things Mode",
|
||||
ButtonImage = "ThingsMode.png",
|
||||
ButtonOrder = int.MinValue + 3)]
|
||||
public class ThingsMode : ClassicMode
|
||||
{
|
||||
#region ================== Constants
|
||||
|
@ -60,7 +65,7 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
{
|
||||
}
|
||||
|
||||
// Diposer
|
||||
// Disposer
|
||||
public override void Dispose()
|
||||
{
|
||||
// Not already disposed?
|
||||
|
@ -90,9 +95,6 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
public override void Engage()
|
||||
{
|
||||
base.Engage();
|
||||
|
||||
// Check things button on main window
|
||||
General.MainWindow.SetThingsChecked(true);
|
||||
}
|
||||
|
||||
// Mode disengages
|
||||
|
@ -101,10 +103,7 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
base.Disengage();
|
||||
|
||||
// Hide highlight info
|
||||
General.MainWindow.HideInfo();
|
||||
|
||||
// Uncheck things button on main window
|
||||
General.MainWindow.SetThingsChecked(false);
|
||||
General.Interface.HideInfo();
|
||||
}
|
||||
|
||||
// This redraws the display
|
||||
|
@ -153,9 +152,9 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
|
||||
// Show highlight info
|
||||
if((highlighted != null) && !highlighted.IsDisposed)
|
||||
General.MainWindow.ShowThingInfo(highlighted);
|
||||
General.Interface.ShowThingInfo(highlighted);
|
||||
else
|
||||
General.MainWindow.HideInfo();
|
||||
General.Interface.HideInfo();
|
||||
}
|
||||
|
||||
// Mouse moves
|
||||
|
@ -214,7 +213,7 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
// Make this the only selection
|
||||
General.Map.Map.ClearSelectedThings();
|
||||
highlighted.Selected = true;
|
||||
General.MainWindow.RedrawDisplay();
|
||||
General.Interface.RedrawDisplay();
|
||||
}
|
||||
|
||||
// Update display
|
||||
|
@ -259,7 +258,7 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
if(selected.Count == 1) General.Map.Map.ClearSelectedThings();
|
||||
|
||||
// Update entire display
|
||||
General.MainWindow.RedrawDisplay();
|
||||
General.Interface.RedrawDisplay();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -29,11 +29,16 @@ using CodeImp.DoomBuilder.IO;
|
|||
using CodeImp.DoomBuilder.Map;
|
||||
using CodeImp.DoomBuilder.Rendering;
|
||||
using CodeImp.DoomBuilder.Geometry;
|
||||
using CodeImp.DoomBuilder.Editing;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace CodeImp.DoomBuilder.Editing
|
||||
namespace CodeImp.DoomBuilder.BuilderModes.Editing
|
||||
{
|
||||
[EditMode(SwitchAction = "verticesmode",
|
||||
ButtonDesc = "Vertices Mode",
|
||||
ButtonImage = "VerticesMode.png",
|
||||
ButtonOrder = int.MinValue + 0)]
|
||||
public class VerticesMode : ClassicMode
|
||||
{
|
||||
#region ================== Constants
|
||||
|
@ -60,7 +65,7 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
{
|
||||
}
|
||||
|
||||
// Diposer
|
||||
// Disposer
|
||||
public override void Dispose()
|
||||
{
|
||||
// Not already disposed?
|
||||
|
@ -90,9 +95,6 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
public override void Engage()
|
||||
{
|
||||
base.Engage();
|
||||
|
||||
// Check vertices button on main window
|
||||
General.MainWindow.SetVerticesChecked(true);
|
||||
}
|
||||
|
||||
// Mode disengages
|
||||
|
@ -117,10 +119,7 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
}
|
||||
|
||||
// Hide highlight info
|
||||
General.MainWindow.HideInfo();
|
||||
|
||||
// Uncheck vertices button on main window
|
||||
General.MainWindow.SetVerticesChecked(false);
|
||||
General.Interface.HideInfo();
|
||||
}
|
||||
|
||||
// This redraws the display
|
||||
|
@ -169,9 +168,9 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
|
||||
// Show highlight info
|
||||
if((highlighted != null) && !highlighted.IsDisposed)
|
||||
General.MainWindow.ShowVertexInfo(highlighted);
|
||||
General.Interface.ShowVertexInfo(highlighted);
|
||||
else
|
||||
General.MainWindow.HideInfo();
|
||||
General.Interface.HideInfo();
|
||||
}
|
||||
|
||||
// Mouse moves
|
353
Source/BuilderModes/Editing/WAuthorMode.cs
Normal file
|
@ -0,0 +1,353 @@
|
|||
|
||||
#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.Interface;
|
||||
using CodeImp.DoomBuilder.IO;
|
||||
using CodeImp.DoomBuilder.Map;
|
||||
using CodeImp.DoomBuilder.Rendering;
|
||||
using CodeImp.DoomBuilder.Geometry;
|
||||
using CodeImp.DoomBuilder.Editing;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace CodeImp.DoomBuilder.BuilderModes.Editing
|
||||
{
|
||||
[EditMode(SwitchAction = "wauthormode",
|
||||
ButtonDesc = "WadAuthor Mode",
|
||||
ButtonImage = "WAuthor.png",
|
||||
ButtonOrder = int.MinValue + 4,
|
||||
ConfigSpecific = true)]
|
||||
public class WAuthorMode : ClassicMode
|
||||
{
|
||||
#region ================== Constants
|
||||
|
||||
protected const float LINEDEF_HIGHLIGHT_RANGE = 10f;
|
||||
protected const float VERTEX_HIGHLIGHT_RANGE = 8f;
|
||||
protected const float THING_HIGHLIGHT_RANGE = 2f;
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Variables
|
||||
|
||||
// Highlighted item
|
||||
protected object highlighted;
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Properties
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Constructor / Disposer
|
||||
|
||||
// Constructor
|
||||
public WAuthorMode()
|
||||
{
|
||||
// Initialize
|
||||
|
||||
// We have no destructor
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
// Disposer
|
||||
public override void Dispose()
|
||||
{
|
||||
// Not already disposed?
|
||||
if(!isdisposed)
|
||||
{
|
||||
// Clean up
|
||||
|
||||
// Dispose base
|
||||
base.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Methods
|
||||
|
||||
// Cancel mode
|
||||
public override void Cancel()
|
||||
{
|
||||
base.Cancel();
|
||||
|
||||
// Return to this mode
|
||||
General.Map.ChangeMode(new WAuthorMode());
|
||||
}
|
||||
|
||||
// Mode engages
|
||||
public override void Engage()
|
||||
{
|
||||
base.Engage();
|
||||
}
|
||||
|
||||
// Mode disengages
|
||||
public override void Disengage()
|
||||
{
|
||||
base.Disengage();
|
||||
|
||||
// Clear selected vertices
|
||||
General.Map.Map.ClearAllSelected();
|
||||
|
||||
// Hide highlight info
|
||||
General.Interface.HideInfo();
|
||||
}
|
||||
|
||||
// This redraws the display
|
||||
public unsafe override void RedrawDisplay()
|
||||
{
|
||||
// Start with a clear display
|
||||
if(renderer.Start(true, true))
|
||||
{
|
||||
// Render things
|
||||
renderer.SetThingsRenderOrder(true);
|
||||
renderer.RenderThingSet(General.Map.Map.Things);
|
||||
|
||||
// Render lines and vertices
|
||||
renderer.RenderLinedefSet(General.Map.Map.Linedefs);
|
||||
renderer.RenderVerticesSet(General.Map.Map.Vertices);
|
||||
|
||||
// Render highlighted item
|
||||
if(highlighted != null) DrawHighlight(true);
|
||||
|
||||
// Done
|
||||
renderer.Finish();
|
||||
}
|
||||
}
|
||||
|
||||
// This draws the highlighted item
|
||||
protected void DrawHighlight(bool highlightcolor)
|
||||
{
|
||||
// With highlight color
|
||||
if(highlightcolor)
|
||||
{
|
||||
// Vertex
|
||||
if(highlighted is Vertex)
|
||||
{
|
||||
if((highlighted as Vertex).IsDisposed) return;
|
||||
renderer.RenderVertex(highlighted as Vertex, ColorCollection.HIGHLIGHT);
|
||||
}
|
||||
// Linedef
|
||||
else if(highlighted is Linedef)
|
||||
{
|
||||
if((highlighted as Linedef).IsDisposed) return;
|
||||
renderer.RenderLinedef((highlighted as Linedef), General.Colors.Highlight);
|
||||
renderer.RenderVertex((highlighted as Linedef).Start, renderer.DetermineVertexColor((highlighted as Linedef).Start));
|
||||
renderer.RenderVertex((highlighted as Linedef).End, renderer.DetermineVertexColor((highlighted as Linedef).End));
|
||||
}
|
||||
// Sector
|
||||
else if(highlighted is Sector)
|
||||
{
|
||||
if((highlighted as Sector).IsDisposed) return;
|
||||
renderer.RenderSector((highlighted as Sector), General.Colors.Highlight);
|
||||
}
|
||||
// Thing
|
||||
else if(highlighted is Thing)
|
||||
{
|
||||
if((highlighted as Thing).IsDisposed) return;
|
||||
renderer.RenderThing((highlighted as Thing), General.Colors.Highlight);
|
||||
}
|
||||
}
|
||||
// With original color
|
||||
else
|
||||
{
|
||||
// Vertex
|
||||
if(highlighted is Vertex)
|
||||
{
|
||||
if((highlighted as Vertex).IsDisposed) return;
|
||||
renderer.RenderVertex(highlighted as Vertex, renderer.DetermineVertexColor(highlighted as Vertex));
|
||||
}
|
||||
// Linedef
|
||||
else if(highlighted is Linedef)
|
||||
{
|
||||
if((highlighted as Linedef).IsDisposed) return;
|
||||
renderer.RenderLinedef((highlighted as Linedef), renderer.DetermineLinedefColor((highlighted as Linedef)));
|
||||
renderer.RenderVertex((highlighted as Linedef).Start, renderer.DetermineVertexColor((highlighted as Linedef).Start));
|
||||
renderer.RenderVertex((highlighted as Linedef).End, renderer.DetermineVertexColor((highlighted as Linedef).End));
|
||||
}
|
||||
// Sector
|
||||
else if(highlighted is Sector)
|
||||
{
|
||||
if((highlighted as Sector).IsDisposed) return;
|
||||
renderer.RenderSector((highlighted as Sector));
|
||||
}
|
||||
// Thing
|
||||
else if(highlighted is Thing)
|
||||
{
|
||||
if((highlighted as Thing).IsDisposed) return;
|
||||
renderer.RenderThing((highlighted as Thing), renderer.DetermineThingColor((highlighted as Thing)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// This highlights a new item
|
||||
protected void Highlight(object h)
|
||||
{
|
||||
// Changes?
|
||||
if(highlighted != h)
|
||||
{
|
||||
// Update display
|
||||
if(renderer.Start(false, false))
|
||||
{
|
||||
// Undraw previous highlight
|
||||
if(highlighted != null) DrawHighlight(false);
|
||||
|
||||
// Set new highlight
|
||||
highlighted = h;
|
||||
|
||||
// Render highlighted item
|
||||
if(highlighted != null) DrawHighlight(true);
|
||||
|
||||
// Done
|
||||
renderer.Finish();
|
||||
}
|
||||
|
||||
// Hide info
|
||||
General.Interface.HideInfo();
|
||||
|
||||
// Anything highlighted?
|
||||
if(highlighted != null)
|
||||
{
|
||||
// Show highlight info
|
||||
if(highlighted is Vertex)
|
||||
General.Interface.ShowVertexInfo(highlighted as Vertex);
|
||||
else if(highlighted is Linedef)
|
||||
General.Interface.ShowLinedefInfo(highlighted as Linedef);
|
||||
else if(highlighted is Sector)
|
||||
General.Interface.ShowSectorInfo(highlighted as Sector);
|
||||
else if(highlighted is Thing)
|
||||
General.Interface.ShowThingInfo(highlighted as Thing);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Mouse moves
|
||||
public override void MouseMove(MouseEventArgs e)
|
||||
{
|
||||
base.MouseMove(e);
|
||||
|
||||
// Not holding any buttons?
|
||||
if(e.Button == MouseButtons.None)
|
||||
{
|
||||
// Find the nearest items within highlight range
|
||||
Vertex v = General.Map.Map.NearestVertexSquareRange(mousemappos, VERTEX_HIGHLIGHT_RANGE / renderer.Scale);
|
||||
Thing t = General.Map.Map.NearestThingSquareRange(mousemappos, THING_HIGHLIGHT_RANGE / renderer.Scale);
|
||||
Linedef l = General.Map.Map.NearestLinedef(mousemappos);
|
||||
Sector s;
|
||||
|
||||
// Check on which side of the linedef the mouse is
|
||||
float side = l.SideOfLine(mousemappos);
|
||||
if(side > 0)
|
||||
{
|
||||
// Is there a sidedef here?
|
||||
if(l.Back != null) s = l.Back.Sector;
|
||||
else s = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Is there a sidedef here?
|
||||
if(l.Front != null) s = l.Front.Sector;
|
||||
else s = null;
|
||||
}
|
||||
|
||||
// Both a vertex and thing in range?
|
||||
if((v != null) && (t != null))
|
||||
{
|
||||
// Highlight closest
|
||||
float vd = v.DistanceToSq(mousemappos);
|
||||
float td = t.DistanceToSq(mousemappos);
|
||||
if(vd < td) Highlight(v); else Highlight(t);
|
||||
}
|
||||
// Vertex in range?
|
||||
else if(v != null)
|
||||
{
|
||||
// Highlight vertex
|
||||
Highlight(v);
|
||||
}
|
||||
// Thing in range?
|
||||
else if(t != null)
|
||||
{
|
||||
// Highlight thing
|
||||
Highlight(t);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Linedef within in range?
|
||||
float ld = l.DistanceTo(mousemappos, true);
|
||||
if(ld < (LINEDEF_HIGHLIGHT_RANGE / renderer.Scale))
|
||||
{
|
||||
// Highlight line
|
||||
Highlight(l);
|
||||
}
|
||||
// Mouse inside a sector?
|
||||
else if(s != null)
|
||||
{
|
||||
// Highlight sector
|
||||
Highlight(s);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Highlight nothing
|
||||
Highlight(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Maybe i'll finish this later, or not even include this mode at all, not sure yet.
|
||||
|
||||
/*
|
||||
// Mouse leaves
|
||||
public override void MouseLeave(EventArgs e)
|
||||
{
|
||||
base.MouseLeave(e);
|
||||
|
||||
// Highlight nothing
|
||||
Highlight(null);
|
||||
}
|
||||
|
||||
// Mouse button pressed
|
||||
public override void MouseDown(MouseEventArgs e)
|
||||
{
|
||||
base.MouseDown(e);
|
||||
}
|
||||
|
||||
// Mouse released
|
||||
public override void MouseUp(MouseEventArgs e)
|
||||
{
|
||||
base.MouseUp(e);
|
||||
}
|
||||
|
||||
// Mouse wants to drag
|
||||
protected override void DragStart(MouseEventArgs e)
|
||||
{
|
||||
base.DragStart(e);
|
||||
}
|
||||
*/
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
33
Source/BuilderModes/Properties/AssemblyInfo.cs
Normal file
|
@ -0,0 +1,33 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Builder Modes")]
|
||||
[assembly: AssemblyDescription("Doom Builder Editing Modes")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("CodeImp")]
|
||||
[assembly: AssemblyProduct("Doom Builder")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2007")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("30d96659-77e7-4921-a52f-a854c1a36b7d")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyFileVersion("1.0.*")]
|
51
Source/BuilderModes/Resources/Actions.cfg
Normal file
|
@ -0,0 +1,51 @@
|
|||
/******************************************\
|
||||
Doom Builder Actions Configuration
|
||||
\******************************************/
|
||||
|
||||
// This just defines which actions there are and what description they have
|
||||
// The source code will bind to these actions with delegates (function pointers)
|
||||
|
||||
verticesmode
|
||||
{
|
||||
title = "Edit: Vertices Mode";
|
||||
description = "Switches to vertices editing mode.";
|
||||
allowkeys = true;
|
||||
allowmouse = true;
|
||||
allowscroll = true;
|
||||
}
|
||||
|
||||
linedefsmode
|
||||
{
|
||||
title = "Edit: Linedefs Mode";
|
||||
description = "Switches to linedefs editing mode.";
|
||||
allowkeys = true;
|
||||
allowmouse = true;
|
||||
allowscroll = true;
|
||||
}
|
||||
|
||||
sectorsmode
|
||||
{
|
||||
title = "Edit: Sectors Mode";
|
||||
description = "Switches to sectors editing mode.";
|
||||
allowkeys = true;
|
||||
allowmouse = true;
|
||||
allowscroll = true;
|
||||
}
|
||||
|
||||
thingsmode
|
||||
{
|
||||
title = "Edit: Things Mode";
|
||||
description = "Switches to things editing mode.";
|
||||
allowkeys = true;
|
||||
allowmouse = true;
|
||||
allowscroll = true;
|
||||
}
|
||||
|
||||
wauthormode
|
||||
{
|
||||
title = "Edit: WadAuthor Mode";
|
||||
description = "Switches to Wad Author editing mode.";
|
||||
allowkeys = true;
|
||||
allowmouse = true;
|
||||
allowscroll = true;
|
||||
}
|
Before Width: | Height: | Size: 300 B After Width: | Height: | Size: 300 B |
Before Width: | Height: | Size: 337 B After Width: | Height: | Size: 337 B |
BIN
Source/BuilderModes/Resources/ThingsMode.png
Normal file
After Width: | Height: | Size: 938 B |
Before Width: | Height: | Size: 212 B After Width: | Height: | Size: 212 B |
BIN
Source/BuilderModes/Resources/WAuthor.png
Normal file
After Width: | Height: | Size: 601 B |
|
@ -30,7 +30,7 @@ using System.Diagnostics;
|
|||
|
||||
namespace CodeImp.DoomBuilder.Config
|
||||
{
|
||||
public class CompilerInfo
|
||||
internal class CompilerInfo
|
||||
{
|
||||
#region ================== Constants
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ using System.IO;
|
|||
|
||||
namespace CodeImp.DoomBuilder.Config
|
||||
{
|
||||
public class ConfigurationInfo : IComparable<ConfigurationInfo>
|
||||
internal class ConfigurationInfo : IComparable<ConfigurationInfo>
|
||||
{
|
||||
#region ================== Variables
|
||||
|
||||
|
|
|
@ -113,7 +113,7 @@ namespace CodeImp.DoomBuilder.Config
|
|||
#region ================== Constructor / Disposer
|
||||
|
||||
// Constructor
|
||||
public GameConfiguration(Configuration cfg)
|
||||
internal GameConfiguration(Configuration cfg)
|
||||
{
|
||||
// Initialize
|
||||
this.cfg = cfg;
|
||||
|
@ -393,6 +393,12 @@ namespace CodeImp.DoomBuilder.Config
|
|||
return null;
|
||||
}
|
||||
|
||||
// This checks if a specific edit mode class is listed
|
||||
public bool IsEditModeSpecified(string classname)
|
||||
{
|
||||
return cfg.SettingExists("additionalmodes." + classname.ToString(CultureInfo.InvariantCulture));
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ namespace CodeImp.DoomBuilder.Config
|
|||
#region ================== Constructor / Disposer
|
||||
|
||||
// Constructor
|
||||
public GeneralActionBit(int index, string title)
|
||||
internal GeneralActionBit(int index, string title)
|
||||
{
|
||||
// Initialize
|
||||
this.index = index;
|
||||
|
|
|
@ -7,7 +7,7 @@ using CodeImp.DoomBuilder.IO;
|
|||
|
||||
namespace CodeImp.DoomBuilder.Config
|
||||
{
|
||||
public class GeneralActionCategory : IDisposable
|
||||
public class GeneralActionCategory
|
||||
{
|
||||
#region ================== Constants
|
||||
|
||||
|
@ -39,7 +39,7 @@ namespace CodeImp.DoomBuilder.Config
|
|||
#region ================== Constructor / Disposer
|
||||
|
||||
// Constructor
|
||||
public GeneralActionCategory(string name, Configuration cfg)
|
||||
internal GeneralActionCategory(string name, Configuration cfg)
|
||||
{
|
||||
IDictionary opts;
|
||||
|
||||
|
@ -67,8 +67,8 @@ namespace CodeImp.DoomBuilder.Config
|
|||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
// Diposer
|
||||
public void Dispose()
|
||||
// Disposer
|
||||
internal void Dispose()
|
||||
{
|
||||
// Not already disposed?
|
||||
if(!isdisposed)
|
||||
|
|
|
@ -56,7 +56,7 @@ namespace CodeImp.DoomBuilder.Config
|
|||
#region ================== Constructor / Disposer
|
||||
|
||||
// Constructor
|
||||
public GeneralActionOption(string cat, string name, IDictionary bitslist)
|
||||
internal GeneralActionOption(string cat, string name, IDictionary bitslist)
|
||||
{
|
||||
int index;
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ using CodeImp.DoomBuilder.Rendering;
|
|||
|
||||
namespace CodeImp.DoomBuilder.Config
|
||||
{
|
||||
public class LinedefActionCategory : IDisposable, IComparable<LinedefActionCategory>
|
||||
public class LinedefActionCategory : IComparable<LinedefActionCategory>
|
||||
{
|
||||
#region ================== Constants
|
||||
|
||||
|
@ -62,7 +62,7 @@ namespace CodeImp.DoomBuilder.Config
|
|||
#region ================== Constructor / Disposer
|
||||
|
||||
// Constructor
|
||||
public LinedefActionCategory(string name)
|
||||
internal LinedefActionCategory(string name)
|
||||
{
|
||||
// Initialize
|
||||
this.name = name;
|
||||
|
@ -72,8 +72,8 @@ namespace CodeImp.DoomBuilder.Config
|
|||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
// Diposer
|
||||
public void Dispose()
|
||||
// Disposer
|
||||
internal void Dispose()
|
||||
{
|
||||
// Not already disposed?
|
||||
if(!isdisposed)
|
||||
|
@ -91,7 +91,7 @@ namespace CodeImp.DoomBuilder.Config
|
|||
#region ================== Methods
|
||||
|
||||
// This adds an action to this category
|
||||
public void Add(LinedefActionInfo a)
|
||||
internal void Add(LinedefActionInfo a)
|
||||
{
|
||||
// Make it so.
|
||||
actions.Add(a);
|
||||
|
|
|
@ -68,7 +68,7 @@ namespace CodeImp.DoomBuilder.Config
|
|||
#region ================== Constructor / Disposer
|
||||
|
||||
// Constructor
|
||||
public LinedefActionInfo(int index, string desc)
|
||||
internal LinedefActionInfo(int index, string desc)
|
||||
{
|
||||
string[] parts;
|
||||
int p = 0;
|
||||
|
@ -103,7 +103,7 @@ namespace CodeImp.DoomBuilder.Config
|
|||
}
|
||||
|
||||
// Constructor
|
||||
public LinedefActionInfo(int index, Configuration cfg)
|
||||
internal LinedefActionInfo(int index, Configuration cfg)
|
||||
{
|
||||
string actionsetting = "linedeftypes." + index.ToString(CultureInfo.InvariantCulture);
|
||||
string desc;
|
||||
|
|
|
@ -56,7 +56,7 @@ namespace CodeImp.DoomBuilder.Config
|
|||
#region ================== Constructor / Disposer
|
||||
|
||||
// Constructor
|
||||
public LinedefActivateInfo(int index, string title)
|
||||
internal LinedefActivateInfo(int index, string title)
|
||||
{
|
||||
// Initialize
|
||||
this.index = index;
|
||||
|
|
|
@ -31,7 +31,7 @@ using System.Windows.Forms;
|
|||
|
||||
namespace CodeImp.DoomBuilder.Config
|
||||
{
|
||||
public class NodebuilderInfo : IComparable<NodebuilderInfo>
|
||||
internal class NodebuilderInfo : IComparable<NodebuilderInfo>
|
||||
{
|
||||
#region ================== Constants
|
||||
|
||||
|
|
|
@ -51,17 +51,17 @@ namespace CodeImp.DoomBuilder.Config
|
|||
|
||||
#region ================== Properties
|
||||
|
||||
public Configuration Config { get { return cfg; } }
|
||||
public int UndoLevels { get { return undolevels; } set { undolevels = value; } }
|
||||
public bool BlackBrowsers { get { return blackbrowsers; } set { blackbrowsers = value; } }
|
||||
public float StitchDistance { get { return stitchdistance; } set { stitchdistance = value; } }
|
||||
internal Configuration Config { get { return cfg; } }
|
||||
public int UndoLevels { get { return undolevels; } internal set { undolevels = value; } }
|
||||
public bool BlackBrowsers { get { return blackbrowsers; } internal set { blackbrowsers = value; } }
|
||||
public float StitchDistance { get { return stitchdistance; } internal set { stitchdistance = value; } }
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Constructor / Disposer
|
||||
|
||||
// Constructor
|
||||
public ProgramConfiguration()
|
||||
internal ProgramConfiguration()
|
||||
{
|
||||
// We have no destructor
|
||||
GC.SuppressFinalize(this);
|
||||
|
@ -72,7 +72,7 @@ namespace CodeImp.DoomBuilder.Config
|
|||
#region ================== Loading / Saving
|
||||
|
||||
// This loads the program configuration
|
||||
public bool Load(string cfgfilepathname, string defaultfilepathname)
|
||||
internal bool Load(string cfgfilepathname, string defaultfilepathname)
|
||||
{
|
||||
// First parse it
|
||||
if(Read(cfgfilepathname, defaultfilepathname))
|
||||
|
@ -93,7 +93,7 @@ namespace CodeImp.DoomBuilder.Config
|
|||
}
|
||||
|
||||
// This saves the program configuration
|
||||
public void Save(string filepathname)
|
||||
internal void Save(string filepathname)
|
||||
{
|
||||
// Write the cache variables
|
||||
cfg.WriteSetting("blackbrowsers", blackbrowsers);
|
||||
|
@ -171,8 +171,8 @@ namespace CodeImp.DoomBuilder.Config
|
|||
public IDictionary ReadSetting(string setting, IDictionary defaultsetting) { return cfg.ReadSetting(setting, defaultsetting); }
|
||||
|
||||
// WriteSetting
|
||||
public bool WriteSetting(string setting, object settingvalue) { return cfg.WriteSetting(setting, settingvalue); }
|
||||
public bool WriteSetting(string setting, object settingvalue, string pathseperator) { return cfg.WriteSetting(setting, settingvalue, pathseperator); }
|
||||
internal bool WriteSetting(string setting, object settingvalue) { return cfg.WriteSetting(setting, settingvalue); }
|
||||
internal bool WriteSetting(string setting, object settingvalue, string pathseperator) { return cfg.WriteSetting(setting, settingvalue, pathseperator); }
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ using CodeImp.DoomBuilder.Rendering;
|
|||
|
||||
namespace CodeImp.DoomBuilder.Config
|
||||
{
|
||||
public class ThingCategory : IDisposable
|
||||
public class ThingCategory
|
||||
{
|
||||
#region ================== Constants
|
||||
|
||||
|
@ -84,7 +84,7 @@ namespace CodeImp.DoomBuilder.Config
|
|||
#region ================== Constructor / Disposer
|
||||
|
||||
// Constructor
|
||||
public ThingCategory(Configuration cfg, string name)
|
||||
internal ThingCategory(Configuration cfg, string name)
|
||||
{
|
||||
IDictionary dic;
|
||||
int index;
|
||||
|
@ -136,7 +136,7 @@ namespace CodeImp.DoomBuilder.Config
|
|||
}
|
||||
|
||||
// Disposer
|
||||
public void Dispose()
|
||||
internal void Dispose()
|
||||
{
|
||||
// Not already disposed?
|
||||
if(!isdisposed)
|
||||
|
@ -154,7 +154,7 @@ namespace CodeImp.DoomBuilder.Config
|
|||
#region ================== Methods
|
||||
|
||||
// This adds a thing to the category
|
||||
public void AddThing(ThingTypeInfo t)
|
||||
internal void AddThing(ThingTypeInfo t)
|
||||
{
|
||||
// Add
|
||||
things.Add(t);
|
||||
|
|
|
@ -75,7 +75,7 @@ namespace CodeImp.DoomBuilder.Config
|
|||
#region ================== Constructor / Disposer
|
||||
|
||||
// Constructor
|
||||
public ThingTypeInfo(int index)
|
||||
internal ThingTypeInfo(int index)
|
||||
{
|
||||
// Initialize
|
||||
this.index = index;
|
||||
|
@ -98,7 +98,7 @@ namespace CodeImp.DoomBuilder.Config
|
|||
}
|
||||
|
||||
// Constructor
|
||||
public ThingTypeInfo(ThingCategory cat, int index, Configuration cfg)
|
||||
internal ThingTypeInfo(ThingCategory cat, int index, Configuration cfg)
|
||||
{
|
||||
string key = index.ToString(CultureInfo.InvariantCulture);
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ using System.Windows.Forms;
|
|||
|
||||
namespace CodeImp.DoomBuilder.Controls
|
||||
{
|
||||
public class Action
|
||||
internal class Action
|
||||
{
|
||||
#region ================== Variables
|
||||
|
||||
|
|
|
@ -34,9 +34,16 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
|
||||
// The action to bind to
|
||||
private string action;
|
||||
private bool baseaction;
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Properties
|
||||
|
||||
public bool BaseAction { get { return baseaction; } set { baseaction = value; } }
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Constructor / Disposer
|
||||
|
||||
// Constructor
|
||||
|
@ -44,21 +51,52 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
{
|
||||
// Initialize
|
||||
this.action = action;
|
||||
this.baseaction = false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Methods
|
||||
|
||||
// This makes the proper name
|
||||
public string GetFullActionName(Assembly asm)
|
||||
{
|
||||
string asmname;
|
||||
|
||||
if(baseaction)
|
||||
asmname = General.ThisAssembly.GetName().Name.ToLowerInvariant();
|
||||
else
|
||||
asmname = asm.GetName().Name.ToLowerInvariant();
|
||||
|
||||
return asmname + "_" + action;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Static Methods
|
||||
|
||||
// This makes the proper name
|
||||
public string GetFullActionName(Assembly asm, bool baseaction, string actionname)
|
||||
{
|
||||
string asmname;
|
||||
|
||||
if(baseaction)
|
||||
asmname = General.ThisAssembly.GetName().Name.ToLowerInvariant();
|
||||
else
|
||||
asmname = asm.GetName().Name.ToLowerInvariant();
|
||||
|
||||
return asmname + "_" + actionname;
|
||||
}
|
||||
|
||||
// This binds all methods marked with this attribute
|
||||
public static void BindMethods(Type type)
|
||||
internal static void BindMethods(Type type)
|
||||
{
|
||||
// Bind static methods
|
||||
BindMethods(null, type);
|
||||
}
|
||||
|
||||
// This binds all methods marked with this attribute
|
||||
public static void BindMethods(object obj)
|
||||
internal static void BindMethods(object obj)
|
||||
{
|
||||
// Bind instance methods
|
||||
BindMethods(obj, obj.GetType());
|
||||
|
@ -70,14 +108,15 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
MethodInfo[] methods;
|
||||
ActionAttribute[] attrs;
|
||||
ActionDelegate del;
|
||||
|
||||
string actionname;
|
||||
|
||||
if(obj == null)
|
||||
General.WriteLogLine("Binding static action methods for class " + type.Name + "...");
|
||||
else
|
||||
General.WriteLogLine("Binding action methods for " + type.Name + " object...");
|
||||
|
||||
// Go for all methods on obj
|
||||
methods = type.GetMethods();
|
||||
methods = type.GetMethods(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static);
|
||||
foreach(MethodInfo m in methods)
|
||||
{
|
||||
// Check if the method has this attribute
|
||||
|
@ -89,24 +128,42 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
// Create a delegate for this method
|
||||
del = (ActionDelegate)Delegate.CreateDelegate(typeof(ActionDelegate), obj, m);
|
||||
|
||||
// Make proper name
|
||||
actionname = a.GetFullActionName(type.Assembly);
|
||||
|
||||
// Bind method to action
|
||||
if(General.Actions.Exists(a.action))
|
||||
General.Actions[a.action].Bind(del);
|
||||
if(General.Actions.Exists(actionname))
|
||||
General.Actions[actionname].Bind(del);
|
||||
else
|
||||
throw new ArgumentException("Could not bind " + m.ReflectedType.Name + "." + m.Name + " to action \"" + a.action + "\", that action does not exist! Refer to, or edit Actions.cfg for all available application actions.");
|
||||
throw new ArgumentException("Could not bind " + m.ReflectedType.Name + "." + m.Name + " to action \"" + actionname + "\", that action does not exist! Refer to, or edit Actions.cfg for all available application actions.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// This binds a delegate manually
|
||||
internal static void BindDelegate(Assembly asm, ActionDelegate d, ActionAttribute a)
|
||||
{
|
||||
string actionname;
|
||||
|
||||
// Make proper name
|
||||
actionname = a.GetFullActionName(asm);
|
||||
|
||||
// Bind delegate to action
|
||||
if(General.Actions.Exists(actionname))
|
||||
General.Actions[actionname].Bind(d);
|
||||
else
|
||||
throw new ArgumentException("Could not bind delegate for " + d.Method.Name + " to action \"" + actionname + "\", that action does not exist! Refer to, or edit Actions.cfg for all available application actions.");
|
||||
}
|
||||
|
||||
// This unbinds all methods marked with this attribute
|
||||
public static void UnbindMethods(Type type)
|
||||
internal static void UnbindMethods(Type type)
|
||||
{
|
||||
// Unbind static methods
|
||||
UnbindMethods(null, type);
|
||||
}
|
||||
|
||||
// This unbinds all methods marked with this attribute
|
||||
public static void UnbindMethods(object obj)
|
||||
internal static void UnbindMethods(object obj)
|
||||
{
|
||||
// Unbind instance methods
|
||||
UnbindMethods(obj, obj.GetType());
|
||||
|
@ -118,6 +175,7 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
MethodInfo[] methods;
|
||||
ActionAttribute[] attrs;
|
||||
ActionDelegate del;
|
||||
string actionname;
|
||||
|
||||
if(obj == null)
|
||||
General.WriteLogLine("Unbinding static action methods for class " + type.Name + "...");
|
||||
|
@ -137,11 +195,26 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
// Create a delegate for this method
|
||||
del = (ActionDelegate)Delegate.CreateDelegate(typeof(ActionDelegate), obj, m);
|
||||
|
||||
// Make proper name
|
||||
actionname = a.GetFullActionName(type.Assembly);
|
||||
|
||||
// Unbind method from action
|
||||
General.Actions[a.action].Unbind(del);
|
||||
General.Actions[actionname].Unbind(del);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// This unbinds a delegate manually
|
||||
internal static void UnbindDelegate(Assembly asm, ActionDelegate d, ActionAttribute a)
|
||||
{
|
||||
string actionname;
|
||||
|
||||
// Make proper name
|
||||
actionname = a.GetFullActionName(asm);
|
||||
|
||||
// Unbind delegate to action
|
||||
General.Actions[actionname].Unbind(d);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
|
|
@ -26,5 +26,5 @@ using System.Text;
|
|||
|
||||
namespace CodeImp.DoomBuilder.Controls
|
||||
{
|
||||
public delegate void ActionDelegate();
|
||||
internal delegate void ActionDelegate();
|
||||
}
|
||||
|
|
|
@ -25,15 +25,18 @@ using CodeImp.DoomBuilder.Properties;
|
|||
using System.IO;
|
||||
using CodeImp.DoomBuilder.IO;
|
||||
using System.Collections;
|
||||
using System.Reflection;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace CodeImp.DoomBuilder.Controls
|
||||
{
|
||||
public class ActionManager : IDisposable
|
||||
internal class ActionManager
|
||||
{
|
||||
#region ================== Constants
|
||||
|
||||
private const string ACTIONS_RESOURCE = "Actions.cfg";
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Variables
|
||||
|
@ -62,14 +65,14 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
General.WriteLogLine("Starting action manager...");
|
||||
actions = new Dictionary<string, Action>();
|
||||
|
||||
// Load all actions
|
||||
LoadActions();
|
||||
// Load all actions in this assembly
|
||||
LoadActions(General.ThisAssembly);
|
||||
|
||||
// We have no destructor
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
// Diposer
|
||||
// Disposer
|
||||
public void Dispose()
|
||||
{
|
||||
// Not already disposed?
|
||||
|
@ -86,45 +89,73 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
|
||||
#region ================== Actions
|
||||
|
||||
// This loads all actions
|
||||
private void LoadActions()
|
||||
// This loads all actions from an assembly
|
||||
public void LoadActions(Assembly asm)
|
||||
{
|
||||
Stream actionsdata;
|
||||
StreamReader actionsreader;
|
||||
Configuration cfg;
|
||||
string name, title, desc;
|
||||
bool amouse, akeys, ascroll;
|
||||
int key;
|
||||
|
||||
// Get a stream from the resource
|
||||
actionsdata = General.ThisAssembly.GetManifestResourceStream("CodeImp.DoomBuilder.Resources.Actions.cfg");
|
||||
actionsreader = new StreamReader(actionsdata, Encoding.ASCII);
|
||||
|
||||
// Load configuration from stream
|
||||
cfg = new Configuration();
|
||||
cfg.InputConfiguration(actionsreader.ReadToEnd());
|
||||
string[] resnames;
|
||||
AssemblyName asmname = asm.GetName();
|
||||
|
||||
// Done with the resource
|
||||
actionsreader.Dispose();
|
||||
actionsdata.Dispose();
|
||||
|
||||
// Go for all objects in the configuration
|
||||
foreach(DictionaryEntry a in cfg.Root)
|
||||
// Find a resource named Actions.cfg
|
||||
resnames = asm.GetManifestResourceNames();
|
||||
foreach(string rn in resnames)
|
||||
{
|
||||
// Get action properties
|
||||
name = a.Key.ToString();
|
||||
title = cfg.ReadSetting(name + ".title", "[" + name + "]");
|
||||
desc = cfg.ReadSetting(name + ".description", "");
|
||||
key = General.Settings.ReadSetting("shortcuts." + name, 0);
|
||||
akeys = cfg.ReadSetting(name + ".allowkeys", false);
|
||||
amouse = cfg.ReadSetting(name + ".allowmouse", false);
|
||||
ascroll = cfg.ReadSetting(name + ".allowscroll", false);
|
||||
|
||||
// Create an action
|
||||
actions.Add(name, new Action(name, title, desc, key, akeys, amouse, ascroll));
|
||||
// Found one?
|
||||
if(rn.EndsWith(ACTIONS_RESOURCE, StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
// Get a stream from the resource
|
||||
actionsdata = asm.GetManifestResourceStream(rn);
|
||||
actionsreader = new StreamReader(actionsdata, Encoding.ASCII);
|
||||
|
||||
// Load configuration from stream
|
||||
cfg = new Configuration();
|
||||
cfg.InputConfiguration(actionsreader.ReadToEnd());
|
||||
|
||||
// Done with the resource
|
||||
actionsreader.Dispose();
|
||||
actionsdata.Dispose();
|
||||
|
||||
// Go for all objects in the configuration
|
||||
foreach(DictionaryEntry a in cfg.Root)
|
||||
{
|
||||
// Get action properties
|
||||
name = asmname.Name.ToLowerInvariant() + "_" + a.Key.ToString();
|
||||
title = cfg.ReadSetting(a.Key + ".title", "[" + name + "]");
|
||||
desc = cfg.ReadSetting(a.Key + ".description", "");
|
||||
akeys = cfg.ReadSetting(a.Key + ".allowkeys", false);
|
||||
amouse = cfg.ReadSetting(a.Key + ".allowmouse", false);
|
||||
ascroll = cfg.ReadSetting(a.Key + ".allowscroll", false);
|
||||
|
||||
// Create an action
|
||||
CreateAction(name, title, desc, akeys, amouse, ascroll);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// This manually creates an action
|
||||
private void CreateAction(string name, string title, string desc, bool allowkeys, bool allowmouse, bool allowscroll)
|
||||
{
|
||||
// Action does not exist yet?
|
||||
if(!actions.ContainsKey(name))
|
||||
{
|
||||
// Read the key from configuration
|
||||
int key = General.Settings.ReadSetting("shortcuts." + name, 0);
|
||||
|
||||
// Create an action
|
||||
actions.Add(name, new Action(name, title, desc, key, allowkeys, allowmouse, allowscroll));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Action already exists!
|
||||
General.WriteLogLine("WARNING: Action '" + name + "' already exists. Action names must be unique!");
|
||||
}
|
||||
}
|
||||
|
||||
// This checks if a given action exists
|
||||
public bool Exists(string action)
|
||||
{
|
||||
|
|
|
@ -1,13 +1,37 @@
|
|||
|
||||
#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.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Text;
|
||||
using CodeImp.DoomBuilder.Properties;
|
||||
using System.IO;
|
||||
using CodeImp.DoomBuilder.IO;
|
||||
using System.Collections;
|
||||
using System.Windows.Forms;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace CodeImp.DoomBuilder.Controls
|
||||
{
|
||||
public struct KeyControl
|
||||
internal struct KeyControl
|
||||
{
|
||||
#region ================== Variables
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ using System.Text;
|
|||
|
||||
namespace CodeImp.DoomBuilder.Data
|
||||
{
|
||||
public struct DataLocation : IComparable<DataLocation>, IComparable, IEquatable<DataLocation>
|
||||
internal struct DataLocation : IComparable<DataLocation>, IComparable, IEquatable<DataLocation>
|
||||
{
|
||||
// Constants
|
||||
public const int RESOURCE_WAD = 0;
|
||||
|
|
|
@ -1,3 +1,21 @@
|
|||
|
||||
#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;
|
||||
|
@ -6,9 +24,11 @@ using System.Text;
|
|||
using CodeImp.DoomBuilder.IO;
|
||||
using System.Collections.Specialized;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace CodeImp.DoomBuilder.Data
|
||||
{
|
||||
public sealed class DataLocationList : List<DataLocation>
|
||||
internal sealed class DataLocationList : List<DataLocation>
|
||||
{
|
||||
#region ================== Constructors
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ using System.Threading;
|
|||
|
||||
namespace CodeImp.DoomBuilder.Data
|
||||
{
|
||||
public sealed class DataManager : IDisposable
|
||||
public sealed class DataManager
|
||||
{
|
||||
#region ================== Constants
|
||||
|
||||
|
@ -82,14 +82,14 @@ namespace CodeImp.DoomBuilder.Data
|
|||
#region ================== Constructor / Disposer
|
||||
|
||||
// Constructor
|
||||
public DataManager()
|
||||
internal DataManager()
|
||||
{
|
||||
// We have no destructor
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
// Disposer
|
||||
public void Dispose()
|
||||
internal void Dispose()
|
||||
{
|
||||
// Not already disposed?
|
||||
if(!isdisposed)
|
||||
|
@ -107,7 +107,7 @@ namespace CodeImp.DoomBuilder.Data
|
|||
#region ================== Loading / Unloading
|
||||
|
||||
// This loads all data resources
|
||||
public void Load(DataLocationList configlist, DataLocationList maplist, DataLocation maplocation)
|
||||
internal void Load(DataLocationList configlist, DataLocationList maplist, DataLocation maplocation)
|
||||
{
|
||||
DataLocationList all = DataLocationList.Combined(configlist, maplist);
|
||||
all.Add(maplocation);
|
||||
|
@ -115,14 +115,14 @@ namespace CodeImp.DoomBuilder.Data
|
|||
}
|
||||
|
||||
// This loads all data resources
|
||||
public void Load(DataLocationList configlist, DataLocationList maplist)
|
||||
internal void Load(DataLocationList configlist, DataLocationList maplist)
|
||||
{
|
||||
DataLocationList all = DataLocationList.Combined(configlist, maplist);
|
||||
Load(all);
|
||||
}
|
||||
|
||||
// This loads all data resources
|
||||
public void Load(DataLocationList locations)
|
||||
internal void Load(DataLocationList locations)
|
||||
{
|
||||
DataReader c;
|
||||
|
||||
|
@ -191,7 +191,7 @@ namespace CodeImp.DoomBuilder.Data
|
|||
}
|
||||
|
||||
// This unloads all data
|
||||
public void Unload()
|
||||
internal void Unload()
|
||||
{
|
||||
// Stop background loader
|
||||
StopBackgroundLoader();
|
||||
|
@ -212,7 +212,7 @@ namespace CodeImp.DoomBuilder.Data
|
|||
#region ================== Suspend / Resume
|
||||
|
||||
// This suspends data resources
|
||||
public void Suspend()
|
||||
internal void Suspend()
|
||||
{
|
||||
// Stop background loader
|
||||
StopBackgroundLoader();
|
||||
|
@ -227,7 +227,7 @@ namespace CodeImp.DoomBuilder.Data
|
|||
}
|
||||
|
||||
// This resumes data resources
|
||||
public void Resume()
|
||||
internal void Resume()
|
||||
{
|
||||
// Go for all containers
|
||||
foreach(DataReader d in containers)
|
||||
|
@ -425,7 +425,7 @@ namespace CodeImp.DoomBuilder.Data
|
|||
}
|
||||
|
||||
// This returns a specific patch stream
|
||||
public Stream GetPatchData(string pname)
|
||||
internal Stream GetPatchData(string pname)
|
||||
{
|
||||
Stream patch;
|
||||
|
||||
|
@ -539,7 +539,7 @@ namespace CodeImp.DoomBuilder.Data
|
|||
}
|
||||
|
||||
// This returns a specific flat stream
|
||||
public Stream GetFlatData(string pname)
|
||||
internal Stream GetFlatData(string pname)
|
||||
{
|
||||
Stream flat;
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ using CodeImp.DoomBuilder.Rendering;
|
|||
|
||||
namespace CodeImp.DoomBuilder.Data
|
||||
{
|
||||
public abstract class DataReader : IDisposable
|
||||
internal abstract class DataReader
|
||||
{
|
||||
#region ================== Variables
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ using CodeImp.DoomBuilder.IO;
|
|||
|
||||
namespace CodeImp.DoomBuilder.Data
|
||||
{
|
||||
public sealed class DirectoryReader : DataReader
|
||||
internal sealed class DirectoryReader : DataReader
|
||||
{
|
||||
#region ================== Constants
|
||||
|
||||
|
|
|
@ -1,14 +1,36 @@
|
|||
|
||||
#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.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.IO;
|
||||
using CodeImp.DoomBuilder.IO;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace CodeImp.DoomBuilder.Data
|
||||
{
|
||||
public sealed class FlatImage : ImageData
|
||||
internal sealed class FlatImage : ImageData
|
||||
{
|
||||
#region ================== Constructor / Disposer
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ using System.Windows.Forms;
|
|||
|
||||
namespace CodeImp.DoomBuilder.Data
|
||||
{
|
||||
public abstract unsafe class ImageData : IDisposable
|
||||
public abstract unsafe class ImageData
|
||||
{
|
||||
#region ================== Constants
|
||||
|
||||
|
@ -124,7 +124,7 @@ namespace CodeImp.DoomBuilder.Data
|
|||
}
|
||||
|
||||
// This creates the 2D pixel data
|
||||
public virtual void CreatePixelData()
|
||||
internal virtual void CreatePixelData()
|
||||
{
|
||||
BitmapData bmpdata;
|
||||
|
||||
|
@ -143,7 +143,7 @@ namespace CodeImp.DoomBuilder.Data
|
|||
}
|
||||
|
||||
// This creates the Direct3D texture
|
||||
public virtual void CreateTexture()
|
||||
internal virtual void CreateTexture()
|
||||
{
|
||||
MemoryStream memstream;
|
||||
|
||||
|
@ -164,7 +164,7 @@ namespace CodeImp.DoomBuilder.Data
|
|||
}
|
||||
|
||||
// This destroys the Direct3D texture
|
||||
public void ReleaseTexture()
|
||||
internal void ReleaseTexture()
|
||||
{
|
||||
lock(this)
|
||||
{
|
||||
|
|
|
@ -29,7 +29,7 @@ using CodeImp.DoomBuilder.IO;
|
|||
|
||||
namespace CodeImp.DoomBuilder.Data
|
||||
{
|
||||
public static class ImageDataFormat
|
||||
internal static class ImageDataFormat
|
||||
{
|
||||
// Input guess formats
|
||||
public const int UNKNOWN = 0; // No clue.
|
||||
|
|
|
@ -53,8 +53,8 @@ namespace CodeImp.DoomBuilder.Data
|
|||
|
||||
// Dont do anything
|
||||
public override void LoadImage() { bitmap = CodeImp.DoomBuilder.Properties.Resources.UnknownImage; }
|
||||
public override void CreatePixelData() { }
|
||||
public override void CreateTexture() { }
|
||||
internal override void CreatePixelData() { }
|
||||
internal override void CreateTexture() { }
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ using ICSharpCode.SharpZipLib.Zip;
|
|||
|
||||
namespace CodeImp.DoomBuilder.Data
|
||||
{
|
||||
public sealed class PK3Reader : DataReader
|
||||
internal sealed class PK3Reader : DataReader
|
||||
{
|
||||
#region ================== Constants
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ using CodeImp.DoomBuilder.IO;
|
|||
|
||||
namespace CodeImp.DoomBuilder.Data
|
||||
{
|
||||
public sealed class PatchNames
|
||||
internal sealed class PatchNames
|
||||
{
|
||||
#region ================== Constants
|
||||
|
||||
|
|
|
@ -1,14 +1,37 @@
|
|||
|
||||
#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.IO;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using CodeImp.DoomBuilder.Rendering;
|
||||
using CodeImp.DoomBuilder.IO;
|
||||
using System.IO;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace CodeImp.DoomBuilder.Data
|
||||
{
|
||||
public sealed class SpriteImage : ImageData
|
||||
internal sealed class SpriteImage : ImageData
|
||||
{
|
||||
#region ================== Constructor / Disposer
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ using System.IO;
|
|||
|
||||
namespace CodeImp.DoomBuilder.Data
|
||||
{
|
||||
public sealed unsafe class TextureImage : ImageData
|
||||
internal sealed unsafe class TextureImage : ImageData
|
||||
{
|
||||
#region ================== Variables
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ using CodeImp.DoomBuilder.IO;
|
|||
|
||||
namespace CodeImp.DoomBuilder.Data
|
||||
{
|
||||
public struct TexturePatch
|
||||
internal struct TexturePatch
|
||||
{
|
||||
public string lumpname;
|
||||
public int x;
|
||||
|
|
|
@ -30,7 +30,7 @@ using CodeImp.DoomBuilder.IO;
|
|||
|
||||
namespace CodeImp.DoomBuilder.Data
|
||||
{
|
||||
public sealed class WADReader : DataReader
|
||||
internal sealed class WADReader : DataReader
|
||||
{
|
||||
#region ================== Constants
|
||||
|
||||
|
@ -61,7 +61,7 @@ namespace CodeImp.DoomBuilder.Data
|
|||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
// Diposer
|
||||
// Disposer
|
||||
public override void Dispose()
|
||||
{
|
||||
// Not already disposed?
|
||||
|
|
|
@ -51,7 +51,8 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
protected bool cancelled;
|
||||
|
||||
// Graphics
|
||||
protected Renderer2D renderer;
|
||||
protected IRenderer2D renderer;
|
||||
private Renderer2D renderer2d;
|
||||
|
||||
// Mouse status
|
||||
protected Vector2D mousepos;
|
||||
|
@ -75,9 +76,10 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
{
|
||||
// Initialize
|
||||
this.renderer = General.Map.Renderer2D;
|
||||
this.renderer2d = (Renderer2D)General.Map.Renderer2D;
|
||||
}
|
||||
|
||||
// Diposer
|
||||
// Disposer
|
||||
public override void Dispose()
|
||||
{
|
||||
// Not already disposed?
|
||||
|
@ -95,39 +97,39 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
#region ================== Scroll / Zoom
|
||||
|
||||
// This scrolls the view north
|
||||
[Action("scrollnorth")]
|
||||
[Action("scrollnorth", BaseAction = true)]
|
||||
public virtual void ScrollNorth()
|
||||
{
|
||||
// Scroll
|
||||
ScrollBy(0f, 100f / renderer.Scale);
|
||||
ScrollBy(0f, 100f / renderer2d.Scale);
|
||||
}
|
||||
|
||||
// This scrolls the view south
|
||||
[Action("scrollsouth")]
|
||||
[Action("scrollsouth", BaseAction = true)]
|
||||
public virtual void ScrollSouth()
|
||||
{
|
||||
// Scroll
|
||||
ScrollBy(0f, -100f / renderer.Scale);
|
||||
ScrollBy(0f, -100f / renderer2d.Scale);
|
||||
}
|
||||
|
||||
// This scrolls the view west
|
||||
[Action("scrollwest")]
|
||||
[Action("scrollwest", BaseAction = true)]
|
||||
public virtual void ScrollWest()
|
||||
{
|
||||
// Scroll
|
||||
ScrollBy(-100f / renderer.Scale, 0f);
|
||||
ScrollBy(-100f / renderer2d.Scale, 0f);
|
||||
}
|
||||
|
||||
// This scrolls the view east
|
||||
[Action("scrolleast")]
|
||||
[Action("scrolleast", BaseAction = true)]
|
||||
public virtual void ScrollEast()
|
||||
{
|
||||
// Scroll
|
||||
ScrollBy(100f / renderer.Scale, 0f);
|
||||
ScrollBy(100f / renderer2d.Scale, 0f);
|
||||
}
|
||||
|
||||
// This zooms in
|
||||
[Action("zoomin")]
|
||||
[Action("zoomin", BaseAction = true)]
|
||||
public virtual void ZoomIn()
|
||||
{
|
||||
// Zoom
|
||||
|
@ -135,7 +137,7 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
}
|
||||
|
||||
// This zooms out
|
||||
[Action("zoomout")]
|
||||
[Action("zoomout", BaseAction = true)]
|
||||
public virtual void ZoomOut()
|
||||
{
|
||||
// Zoom
|
||||
|
@ -146,14 +148,14 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
private void ScrollBy(float deltax, float deltay)
|
||||
{
|
||||
// Scroll now
|
||||
renderer.PositionView(renderer.OffsetX + deltax, renderer.OffsetY + deltay);
|
||||
renderer2d.PositionView(renderer2d.OffsetX + deltax, renderer2d.OffsetY + deltay);
|
||||
this.ViewChanged();
|
||||
|
||||
// Redraw
|
||||
General.MainWindow.RedrawDisplay();
|
||||
|
||||
// Determine new unprojected mouse coordinates
|
||||
mousemappos = renderer.GetMapCoordinates(mousepos);
|
||||
mousemappos = renderer2d.GetMapCoordinates(mousepos);
|
||||
General.MainWindow.UpdateCoordinates(mousemappos);
|
||||
}
|
||||
|
||||
|
@ -164,7 +166,7 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
float newscale;
|
||||
|
||||
// This will be the new zoom scale
|
||||
newscale = renderer.Scale * deltaz;
|
||||
newscale = renderer2d.Scale * deltaz;
|
||||
|
||||
// Limit scale
|
||||
if(newscale > SCALE_MAX) newscale = SCALE_MAX;
|
||||
|
@ -187,11 +189,11 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
}
|
||||
|
||||
// Calculate view position difference
|
||||
diff = ((clientsize / newscale) - (clientsize / renderer.Scale)) * zoompos;
|
||||
diff = ((clientsize / newscale) - (clientsize / renderer2d.Scale)) * zoompos;
|
||||
|
||||
// Zoom now
|
||||
renderer.PositionView(renderer.OffsetX - diff.x, renderer.OffsetY + diff.y);
|
||||
renderer.ScaleView(newscale);
|
||||
renderer2d.PositionView(renderer2d.OffsetX - diff.x, renderer2d.OffsetY + diff.y);
|
||||
renderer2d.ScaleView(newscale);
|
||||
this.ViewChanged();
|
||||
|
||||
// Redraw
|
||||
|
@ -206,7 +208,7 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
public void SetZoom(float newscale)
|
||||
{
|
||||
// Zoom now
|
||||
renderer.ScaleView(newscale);
|
||||
renderer2d.ScaleView(newscale);
|
||||
this.ViewChanged();
|
||||
|
||||
// Redraw
|
||||
|
@ -251,8 +253,8 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
if(scalew < scaleh) scale = scalew; else scale = scaleh;
|
||||
|
||||
// Change the view to see the whole map
|
||||
renderer.ScaleView(scale);
|
||||
renderer.PositionView(left + (right - left) * 0.5f, top + (bottom - top) * 0.5f);
|
||||
renderer2d.ScaleView(scale);
|
||||
renderer2d.PositionView(left + (right - left) * 0.5f, top + (bottom - top) * 0.5f);
|
||||
this.ViewChanged();
|
||||
|
||||
// Redraw
|
||||
|
@ -296,7 +298,7 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
// Record last position
|
||||
mouseinside = true;
|
||||
mousepos = new Vector2D(e.X, e.Y);
|
||||
mousemappos = renderer.GetMapCoordinates(mousepos);
|
||||
mousemappos = renderer2d.GetMapCoordinates(mousepos);
|
||||
mousebuttons = e.Button;
|
||||
|
||||
// Update labels in main window
|
||||
|
@ -370,7 +372,7 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
// This just refreshes the display
|
||||
public override void RefreshDisplay()
|
||||
{
|
||||
renderer.Present();
|
||||
renderer2d.Present();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -378,7 +380,7 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
#region ================== Methods
|
||||
|
||||
// Override cancel method to bind it with its action
|
||||
[Action("cancelmode")]
|
||||
[Action("cancelmode", BaseAction = true)]
|
||||
public override void Cancel()
|
||||
{
|
||||
cancelled = true;
|
||||
|
|
|
@ -35,7 +35,7 @@ using CodeImp.DoomBuilder.Controls;
|
|||
|
||||
namespace CodeImp.DoomBuilder.Editing
|
||||
{
|
||||
public abstract class EditMode : IDisposable
|
||||
public abstract class EditMode
|
||||
{
|
||||
#region ================== Constants
|
||||
|
||||
|
@ -56,6 +56,10 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
|
||||
public bool IsDisposed { get { return isdisposed; } }
|
||||
|
||||
// Unless overriden, this returns the name of this mode
|
||||
// for checking the appropriate button on the toolbar.
|
||||
public virtual string EditModeButtonName { get { return GetType().Name; } }
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Constructor / Disposer
|
||||
|
@ -67,7 +71,7 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
// Diposer
|
||||
// Disposer
|
||||
public virtual void Dispose()
|
||||
{
|
||||
// Not already disposed?
|
||||
|
|
68
Source/Editing/EditModeAttribute.cs
Normal file
|
@ -0,0 +1,68 @@
|
|||
|
||||
#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.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace CodeImp.DoomBuilder.Editing
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Class, Inherited = true, AllowMultiple = true)]
|
||||
public class EditModeAttribute : Attribute
|
||||
{
|
||||
#region ================== Variables
|
||||
|
||||
// Properties
|
||||
private string switchaction;
|
||||
private string buttonimage;
|
||||
private string buttondesc;
|
||||
private int buttonorder;
|
||||
private bool configspecific;
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Properties
|
||||
|
||||
public string SwitchAction { get { return switchaction; } set { switchaction = value; } }
|
||||
public string ButtonImage { get { return buttonimage; } set { buttonimage = value; } }
|
||||
public string ButtonDesc { get { return buttondesc; } set { buttondesc = value; } }
|
||||
public int ButtonOrder { get { return buttonorder; } set { buttonorder = value; } }
|
||||
public bool ConfigSpecific { get { return configspecific; } set { configspecific = value; } }
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Constructor / Disposer
|
||||
|
||||
// Constructor
|
||||
public EditModeAttribute()
|
||||
{
|
||||
// Initialize
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Methods
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
171
Source/Editing/EditModeInfo.cs
Normal file
|
@ -0,0 +1,171 @@
|
|||
|
||||
#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.Controls;
|
||||
using CodeImp.DoomBuilder.Plugins;
|
||||
using System.Drawing;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace CodeImp.DoomBuilder.Editing
|
||||
{
|
||||
internal class EditModeInfo : IComparable<EditModeInfo>
|
||||
{
|
||||
#region ================== Constants
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Variables
|
||||
|
||||
// Mode type
|
||||
private Plugin plugin;
|
||||
private Type type;
|
||||
private bool configspecific;
|
||||
|
||||
// Mode switching
|
||||
private ActionAttribute switchactionattr = null;
|
||||
private ActionDelegate switchactiondel = null;
|
||||
|
||||
// Mode button
|
||||
private Stream buttonimagestream = null;
|
||||
private Image buttonimage = null;
|
||||
private string buttondesc = null;
|
||||
private int buttonorder = int.MaxValue;
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Properties
|
||||
|
||||
public Plugin Plugin { get { return plugin; } }
|
||||
public Type Type { get { return type; } }
|
||||
public ActionAttribute SwitchAction { get { return switchactionattr; } }
|
||||
public Image ButtonImage { get { return buttonimage; } }
|
||||
public string ButtonDesc { get { return buttondesc; } }
|
||||
public bool ConfigSpecific { get { return configspecific; } }
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Constructor / Disposer
|
||||
|
||||
// Constructor
|
||||
public EditModeInfo(Plugin plugin, Type type, EditModeAttribute attr)
|
||||
{
|
||||
// Initialize
|
||||
this.plugin = plugin;
|
||||
this.type = type;
|
||||
this.configspecific = attr.ConfigSpecific;
|
||||
|
||||
// Make switch action info
|
||||
if((attr.SwitchAction != null) && (attr.SwitchAction.Length > 0))
|
||||
{
|
||||
switchactionattr = new ActionAttribute(attr.SwitchAction);
|
||||
switchactiondel = new ActionDelegate(SwitchToMode);
|
||||
|
||||
// Bind switch action
|
||||
ActionAttribute.BindDelegate(plugin.Assembly, switchactiondel, switchactionattr);
|
||||
}
|
||||
|
||||
// Make button info
|
||||
if((attr.ButtonImage != null) && (attr.ButtonDesc != null))
|
||||
{
|
||||
buttonimagestream = plugin.FindResource(attr.ButtonImage);
|
||||
if(buttonimagestream != null)
|
||||
{
|
||||
buttonimage = Image.FromStream(buttonimagestream);
|
||||
buttondesc = attr.ButtonDesc;
|
||||
buttonorder = attr.ButtonOrder;
|
||||
}
|
||||
}
|
||||
|
||||
// We have no destructor
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
// Disposer
|
||||
public void Dispose()
|
||||
{
|
||||
// Unbind switch action
|
||||
if(switchactiondel != null) ActionAttribute.UnbindDelegate(plugin.Assembly, switchactiondel, switchactionattr);
|
||||
buttonimage.Dispose();
|
||||
buttonimagestream.Dispose();
|
||||
|
||||
// Clean up
|
||||
plugin = null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Methods
|
||||
|
||||
// This switches to the mode
|
||||
public void SwitchToMode()
|
||||
{
|
||||
EditMode newmode;
|
||||
|
||||
// Only when a map is opened
|
||||
if(General.Map != null)
|
||||
{
|
||||
// Create instance
|
||||
newmode = plugin.CreateObject<EditMode>(type);
|
||||
|
||||
// Switch mode
|
||||
General.Map.ChangeMode(newmode);
|
||||
}
|
||||
}
|
||||
|
||||
// This switches to the mode with arguments
|
||||
public void SwitchToMode(object[] args)
|
||||
{
|
||||
EditMode newmode;
|
||||
|
||||
// Only when a map is opened
|
||||
if(General.Map != null)
|
||||
{
|
||||
// Create instance
|
||||
newmode = plugin.CreateObjectA<EditMode>(type, args);
|
||||
|
||||
// Switch mode
|
||||
General.Map.ChangeMode(newmode);
|
||||
}
|
||||
}
|
||||
|
||||
// String representation
|
||||
public override string ToString()
|
||||
{
|
||||
return type.Name;
|
||||
}
|
||||
|
||||
// Compare by button order
|
||||
public int CompareTo(EditModeInfo other)
|
||||
{
|
||||
if(this.buttonorder > other.buttonorder) return 1;
|
||||
else if(this.buttonorder < other.buttonorder) return -1;
|
||||
else return 0;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -1,12 +1,40 @@
|
|||
|
||||
#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.Interface;
|
||||
using CodeImp.DoomBuilder.IO;
|
||||
using CodeImp.DoomBuilder.Map;
|
||||
using CodeImp.DoomBuilder.Rendering;
|
||||
using System.Diagnostics;
|
||||
using CodeImp.DoomBuilder.Controls;
|
||||
using CodeImp.DoomBuilder.Data;
|
||||
using SlimDX.Direct3D9;
|
||||
using CodeImp.DoomBuilder.Geometry;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace CodeImp.DoomBuilder.Editing
|
||||
{
|
||||
public class GridSetup
|
||||
|
@ -39,18 +67,18 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
|
||||
public int GridSize { get { return gridsize; } }
|
||||
public float GridSizeF { get { return gridsizef; } }
|
||||
public string BackgroundName { get { return background; } }
|
||||
public int BackgroundSource { get { return backsource; } }
|
||||
public ImageData Background { get { return backimage; } }
|
||||
public int BackgroundX { get { return backoffsetx; } }
|
||||
public int BackgroundY { get { return backoffsety; } }
|
||||
internal string BackgroundName { get { return background; } }
|
||||
internal int BackgroundSource { get { return backsource; } }
|
||||
internal ImageData Background { get { return backimage; } }
|
||||
internal int BackgroundX { get { return backoffsetx; } }
|
||||
internal int BackgroundY { get { return backoffsety; } }
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Constructor / Disposer
|
||||
|
||||
// Constructor
|
||||
public GridSetup()
|
||||
internal GridSetup()
|
||||
{
|
||||
// Initialize
|
||||
SetGridSize(DEFAULT_GRID_SIZE);
|
||||
|
@ -64,7 +92,7 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
#region ================== Methods
|
||||
|
||||
// This sets the grid size
|
||||
public void SetGridSize(int size)
|
||||
internal void SetGridSize(int size)
|
||||
{
|
||||
// Change grid
|
||||
this.gridsize = size;
|
||||
|
@ -76,7 +104,7 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
}
|
||||
|
||||
// This sets the background
|
||||
public void SetBackground(string name, int source)
|
||||
internal void SetBackground(string name, int source)
|
||||
{
|
||||
// Set background
|
||||
if(name == null) name = "";
|
||||
|
@ -88,7 +116,7 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
}
|
||||
|
||||
// This sets the background offset
|
||||
public void SetBackgroundOffset(int offsetx, int offsety)
|
||||
internal void SetBackgroundOffset(int offsetx, int offsety)
|
||||
{
|
||||
// Set background offset
|
||||
this.backoffsetx = offsetx;
|
||||
|
@ -96,7 +124,7 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
}
|
||||
|
||||
// This finds and links the background image
|
||||
public void LinkBackground()
|
||||
internal void LinkBackground()
|
||||
{
|
||||
// From textures?
|
||||
if(backsource == SOURCE_TEXTURES)
|
||||
|
|
|
@ -35,7 +35,7 @@ using CodeImp.DoomBuilder.Controls;
|
|||
|
||||
namespace CodeImp.DoomBuilder.Editing
|
||||
{
|
||||
public class UndoManager : IDisposable
|
||||
public class UndoManager
|
||||
{
|
||||
#region ================== Constants
|
||||
|
||||
|
@ -61,8 +61,8 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
|
||||
#region ================== Properties
|
||||
|
||||
public UndoSnapshot NextUndo { get { if(undos.Count > 0) return undos[0]; else return null; } }
|
||||
public UndoSnapshot NextRedo { get { if(redos.Count > 0) return redos[0]; else return null; } }
|
||||
internal UndoSnapshot NextUndo { get { if(undos.Count > 0) return undos[0]; else return null; } }
|
||||
internal UndoSnapshot NextRedo { get { if(redos.Count > 0) return redos[0]; else return null; } }
|
||||
public bool IsDisposed { get { return isdisposed; } }
|
||||
|
||||
#endregion
|
||||
|
@ -70,7 +70,7 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
#region ================== Constructor / Disposer
|
||||
|
||||
// Constructor
|
||||
public UndoManager()
|
||||
internal UndoManager()
|
||||
{
|
||||
// Initialize
|
||||
ticketid = 1;
|
||||
|
@ -84,8 +84,8 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
// Diposer
|
||||
public void Dispose()
|
||||
// Disposer
|
||||
internal void Dispose()
|
||||
{
|
||||
// Not already disposed?
|
||||
if(!isdisposed)
|
||||
|
|
|
@ -35,7 +35,7 @@ using CodeImp.DoomBuilder.Controls;
|
|||
|
||||
namespace CodeImp.DoomBuilder.Editing
|
||||
{
|
||||
public class UndoSnapshot
|
||||
internal class UndoSnapshot
|
||||
{
|
||||
public MapSet map;
|
||||
public string description;
|
||||
|
|
|
@ -28,7 +28,7 @@ using System.Diagnostics;
|
|||
|
||||
namespace CodeImp.DoomBuilder
|
||||
{
|
||||
public class Clock : IDisposable
|
||||
public class Clock
|
||||
{
|
||||
#region ================== Declarations
|
||||
|
||||
|
@ -104,7 +104,7 @@ namespace CodeImp.DoomBuilder
|
|||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
// Diposer
|
||||
// Disposer
|
||||
public void Dispose()
|
||||
{
|
||||
// Not already disposed?
|
||||
|
|
|
@ -35,6 +35,7 @@ using CodeImp.DoomBuilder.Rendering;
|
|||
using CodeImp.DoomBuilder.Config;
|
||||
using SlimDX.Direct3D9;
|
||||
using System.Drawing;
|
||||
using CodeImp.DoomBuilder.Plugins;
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -45,37 +46,37 @@ namespace CodeImp.DoomBuilder
|
|||
#region ================== API Declarations
|
||||
|
||||
//[DllImport("user32.dll")]
|
||||
//public static extern bool LockWindowUpdate(IntPtr hwnd);
|
||||
//internal static extern bool LockWindowUpdate(IntPtr hwnd);
|
||||
|
||||
[DllImport("kernel32.dll", EntryPoint="RtlZeroMemory", SetLastError=false)]
|
||||
public static extern void ZeroMemory(IntPtr dest, int size);
|
||||
internal static extern void ZeroMemory(IntPtr dest, int size);
|
||||
|
||||
[DllImport("kernel32.dll", EntryPoint = "RtlMoveMemory", SetLastError = false)]
|
||||
public static extern unsafe void CopyMemory(void* dst, void* src, UIntPtr length);
|
||||
internal static extern unsafe void CopyMemory(void* dst, void* src, UIntPtr length);
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Constants
|
||||
|
||||
// Memory APIs
|
||||
public const uint MEM_COMMIT = 0x1000;
|
||||
public const uint MEM_RESERVE = 0x2000;
|
||||
public const uint MEM_DECOMMIT = 0x4000;
|
||||
public const uint MEM_RELEASE = 0x8000;
|
||||
public const uint MEM_RESET = 0x80000;
|
||||
public const uint MEM_TOP_DOWN = 0x100000;
|
||||
public const uint MEM_PHYSICAL = 0x400000;
|
||||
public const uint PAGE_NOACCESS = 0x01;
|
||||
public const uint PAGE_READONLY = 0x02;
|
||||
public const uint PAGE_READWRITE = 0x04;
|
||||
public const uint PAGE_WRITECOPY = 0x08;
|
||||
public const uint PAGE_EXECUTE = 0x10;
|
||||
public const uint PAGE_EXECUTE_READ = 0x20;
|
||||
public const uint PAGE_EXECUTE_READWRITE = 0x40;
|
||||
public const uint PAGE_EXECUTE_WRITECOPY = 0x80;
|
||||
public const uint PAGE_GUARD = 0x100;
|
||||
public const uint PAGE_NOCACHE = 0x200;
|
||||
public const uint PAGE_WRITECOMBINE = 0x400;
|
||||
internal const uint MEM_COMMIT = 0x1000;
|
||||
internal const uint MEM_RESERVE = 0x2000;
|
||||
internal const uint MEM_DECOMMIT = 0x4000;
|
||||
internal const uint MEM_RELEASE = 0x8000;
|
||||
internal const uint MEM_RESET = 0x80000;
|
||||
internal const uint MEM_TOP_DOWN = 0x100000;
|
||||
internal const uint MEM_PHYSICAL = 0x400000;
|
||||
internal const uint PAGE_NOACCESS = 0x01;
|
||||
internal const uint PAGE_READONLY = 0x02;
|
||||
internal const uint PAGE_READWRITE = 0x04;
|
||||
internal const uint PAGE_WRITECOPY = 0x08;
|
||||
internal const uint PAGE_EXECUTE = 0x10;
|
||||
internal const uint PAGE_EXECUTE_READ = 0x20;
|
||||
internal const uint PAGE_EXECUTE_READWRITE = 0x40;
|
||||
internal const uint PAGE_EXECUTE_WRITECOPY = 0x80;
|
||||
internal const uint PAGE_GUARD = 0x100;
|
||||
internal const uint PAGE_NOCACHE = 0x200;
|
||||
internal const uint PAGE_WRITECOMBINE = 0x400;
|
||||
|
||||
// Files and Folders
|
||||
private const string SETTINGS_FILE = "Builder.cfg";
|
||||
|
@ -83,6 +84,7 @@ namespace CodeImp.DoomBuilder
|
|||
private const string LOG_FILE = "Builder.log";
|
||||
private const string GAME_CONFIGS_DIR = "Configurations";
|
||||
private const string COMPILERS_DIR = "Compilers";
|
||||
private const string PLUGINS_DIR = "Plugins";
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -95,6 +97,7 @@ namespace CodeImp.DoomBuilder
|
|||
private static string temppath;
|
||||
private static string configspath;
|
||||
private static string compilerspath;
|
||||
private static string pluginspath;
|
||||
|
||||
// Main objects
|
||||
private static Assembly thisasm;
|
||||
|
@ -102,6 +105,7 @@ namespace CodeImp.DoomBuilder
|
|||
private static ProgramConfiguration settings;
|
||||
private static MapManager map;
|
||||
private static ActionManager actions;
|
||||
private static PluginManager plugins;
|
||||
private static ColorCollection colors;
|
||||
private static Clock clock;
|
||||
|
||||
|
@ -114,19 +118,22 @@ namespace CodeImp.DoomBuilder
|
|||
|
||||
#region ================== Properties
|
||||
|
||||
public static Assembly ThisAssembly { get { return thisasm; } }
|
||||
internal static Assembly ThisAssembly { get { return thisasm; } }
|
||||
public static string AppPath { get { return apppath; } }
|
||||
public static string TempPath { get { return temppath; } }
|
||||
public static string ConfigsPath { get { return configspath; } }
|
||||
public static string CompilersPath { get { return compilerspath; } }
|
||||
public static MainForm MainWindow { get { return mainwindow; } }
|
||||
public static string PluginsPath { get { return pluginspath; } }
|
||||
internal static MainForm MainWindow { get { return mainwindow; } }
|
||||
public static IMainForm Interface { get { return mainwindow; } }
|
||||
public static ProgramConfiguration Settings { get { return settings; } }
|
||||
public static ColorCollection Colors { get { return colors; } }
|
||||
public static List<ConfigurationInfo> Configs { get { return configs; } }
|
||||
public static List<NodebuilderInfo> Nodebuilders { get { return nodebuilders; } }
|
||||
public static List<CompilerInfo> Compilers { get { return compilers; } }
|
||||
internal static List<ConfigurationInfo> Configs { get { return configs; } }
|
||||
internal static List<NodebuilderInfo> Nodebuilders { get { return nodebuilders; } }
|
||||
internal static List<CompilerInfo> Compilers { get { return compilers; } }
|
||||
public static MapManager Map { get { return map; } }
|
||||
public static ActionManager Actions { get { return actions; } }
|
||||
internal static ActionManager Actions { get { return actions; } }
|
||||
internal static PluginManager Plugins { get { return plugins; } }
|
||||
public static Clock Clock { get { return clock; } }
|
||||
|
||||
#endregion
|
||||
|
@ -134,7 +141,7 @@ namespace CodeImp.DoomBuilder
|
|||
#region ================== Configurations
|
||||
|
||||
// This returns the game configuration info by filename
|
||||
public static ConfigurationInfo GetConfigurationInfo(string filename)
|
||||
internal static ConfigurationInfo GetConfigurationInfo(string filename)
|
||||
{
|
||||
// Go for all config infos
|
||||
foreach(ConfigurationInfo ci in configs)
|
||||
|
@ -153,7 +160,7 @@ namespace CodeImp.DoomBuilder
|
|||
}
|
||||
|
||||
// This loads and returns a game configuration
|
||||
public static Configuration LoadGameConfiguration(string filename)
|
||||
internal static Configuration LoadGameConfiguration(string filename)
|
||||
{
|
||||
Configuration cfg;
|
||||
|
||||
|
@ -347,7 +354,7 @@ namespace CodeImp.DoomBuilder
|
|||
}
|
||||
|
||||
// This returns a nodebuilder by name
|
||||
public static NodebuilderInfo GetNodebuilderByName(string name)
|
||||
internal static NodebuilderInfo GetNodebuilderByName(string name)
|
||||
{
|
||||
// Go for all nodebuilders
|
||||
foreach(NodebuilderInfo n in nodebuilders)
|
||||
|
@ -366,7 +373,7 @@ namespace CodeImp.DoomBuilder
|
|||
|
||||
// Main program entry
|
||||
[STAThread]
|
||||
public static void Main(string[] args)
|
||||
internal static void Main(string[] args)
|
||||
{
|
||||
Uri localpath;
|
||||
Version thisversion;
|
||||
|
@ -388,6 +395,7 @@ namespace CodeImp.DoomBuilder
|
|||
settingspath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), SETTINGS_DIR);
|
||||
configspath = Path.Combine(apppath, GAME_CONFIGS_DIR);
|
||||
compilerspath = Path.Combine(apppath, COMPILERS_DIR);
|
||||
pluginspath = Path.Combine(apppath, PLUGINS_DIR);
|
||||
logfile = Path.Combine(settingspath, LOG_FILE);
|
||||
|
||||
// Make program settings directory if missing
|
||||
|
@ -401,6 +409,7 @@ namespace CodeImp.DoomBuilder
|
|||
General.WriteLogLine("Local settings path: " + settingspath);
|
||||
General.WriteLogLine("Configurations path: " + configspath);
|
||||
General.WriteLogLine("Compilers path: " + compilerspath);
|
||||
General.WriteLogLine("Plugins path: " + pluginspath);
|
||||
|
||||
// Load configuration
|
||||
General.WriteLogLine("Loading program configuration...");
|
||||
|
@ -428,6 +437,10 @@ namespace CodeImp.DoomBuilder
|
|||
General.WriteLogLine("Starting Direct3D graphics driver...");
|
||||
Direct3D.Initialize();
|
||||
|
||||
// Load plugin manager
|
||||
General.WriteLogLine("Loading plugins...");
|
||||
plugins = new PluginManager();
|
||||
|
||||
// Load game configurations
|
||||
General.WriteLogLine("Loading game configurations...");
|
||||
LoadAllGameConfigurations();
|
||||
|
@ -465,7 +478,7 @@ namespace CodeImp.DoomBuilder
|
|||
#region ================== Terminate
|
||||
|
||||
// This terminates the program
|
||||
public static void Terminate(bool properexit)
|
||||
internal static void Terminate(bool properexit)
|
||||
{
|
||||
// Terminate properly?
|
||||
if(properexit)
|
||||
|
@ -481,6 +494,7 @@ namespace CodeImp.DoomBuilder
|
|||
mainwindow.Dispose();
|
||||
actions.Dispose();
|
||||
clock.Dispose();
|
||||
plugins.Dispose();
|
||||
Direct3D.Terminate();
|
||||
|
||||
// Save colors
|
||||
|
@ -514,7 +528,7 @@ namespace CodeImp.DoomBuilder
|
|||
|
||||
// This creates a new map
|
||||
[Action("newmap")]
|
||||
public static void NewMap()
|
||||
internal static void NewMap()
|
||||
{
|
||||
MapOptions newoptions = new MapOptions();
|
||||
MapOptionsForm optionswindow;
|
||||
|
@ -562,7 +576,7 @@ namespace CodeImp.DoomBuilder
|
|||
|
||||
// This closes the current map
|
||||
[Action("closemap")]
|
||||
public static void CloseMap()
|
||||
internal static void CloseMap()
|
||||
{
|
||||
// Ask the user to save changes (if any)
|
||||
if(General.AskSaveMap())
|
||||
|
@ -589,7 +603,7 @@ namespace CodeImp.DoomBuilder
|
|||
|
||||
// This loads a map from file
|
||||
[Action("openmap")]
|
||||
public static void OpenMap()
|
||||
internal static void OpenMap()
|
||||
{
|
||||
OpenFileDialog openfile;
|
||||
|
||||
|
@ -612,7 +626,7 @@ namespace CodeImp.DoomBuilder
|
|||
}
|
||||
|
||||
// This opens the specified file
|
||||
public static void OpenMapFile(string filename)
|
||||
internal static void OpenMapFile(string filename)
|
||||
{
|
||||
OpenMapOptionsForm openmapwindow;
|
||||
|
||||
|
@ -660,7 +674,7 @@ namespace CodeImp.DoomBuilder
|
|||
|
||||
// This saves the current map
|
||||
[Action("savemap")]
|
||||
public static void SaveMap()
|
||||
internal static void SaveMap()
|
||||
{
|
||||
// Check if a wad file is known
|
||||
if(map.FilePathName == "")
|
||||
|
@ -690,7 +704,7 @@ namespace CodeImp.DoomBuilder
|
|||
|
||||
// This saves the current map as a different file
|
||||
[Action("savemapas")]
|
||||
public static void SaveMapAs()
|
||||
internal static void SaveMapAs()
|
||||
{
|
||||
SaveFileDialog savefile;
|
||||
|
||||
|
@ -724,7 +738,7 @@ namespace CodeImp.DoomBuilder
|
|||
|
||||
// This asks to save the map if needed
|
||||
// Returns false when action was cancelled
|
||||
public static bool AskSaveMap()
|
||||
internal static bool AskSaveMap()
|
||||
{
|
||||
DialogResult result;
|
||||
|
||||
|
@ -800,13 +814,13 @@ namespace CodeImp.DoomBuilder
|
|||
}
|
||||
|
||||
// Convert bool to integer
|
||||
public static int Bool2Int(bool v)
|
||||
internal static int Bool2Int(bool v)
|
||||
{
|
||||
if(v) return 1; else return 0;
|
||||
}
|
||||
|
||||
// Convert integer to bool
|
||||
public static bool Int2Bool(int v)
|
||||
internal static bool Int2Bool(int v)
|
||||
{
|
||||
return (v != 0);
|
||||
}
|
||||
|
@ -864,7 +878,7 @@ namespace CodeImp.DoomBuilder
|
|||
}
|
||||
|
||||
// This returns a unique temp filename
|
||||
public static string MakeTempFilename(string tempdir)
|
||||
internal static string MakeTempFilename(string tempdir)
|
||||
{
|
||||
string filename;
|
||||
string chars = "abcdefghijklmnopqrstuvwxyz1234567890";
|
||||
|
@ -886,7 +900,7 @@ namespace CodeImp.DoomBuilder
|
|||
}
|
||||
|
||||
// This returns a unique temp directory name
|
||||
public static string MakeTempDirname()
|
||||
internal static string MakeTempDirname()
|
||||
{
|
||||
string dirname;
|
||||
string chars = "abcdefghijklmnopqrstuvwxyz1234567890";
|
||||
|
@ -977,7 +991,7 @@ namespace CodeImp.DoomBuilder
|
|||
#endregion
|
||||
|
||||
[Action("testaction")]
|
||||
public static void TestAction()
|
||||
internal static void TestAction()
|
||||
{
|
||||
TextureBrowserForm t = new TextureBrowserForm();
|
||||
t.ShowDialog(mainwindow);
|
||||
|
|
|
@ -24,21 +24,22 @@ using System.Text;
|
|||
using System.Windows.Forms;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Diagnostics;
|
||||
using CodeImp.DoomBuilder.Interface;
|
||||
using CodeImp.DoomBuilder.IO;
|
||||
using CodeImp.DoomBuilder.Map;
|
||||
using CodeImp.DoomBuilder.Editing;
|
||||
using System.Diagnostics;
|
||||
using CodeImp.DoomBuilder.Rendering;
|
||||
using CodeImp.DoomBuilder.Data;
|
||||
using CodeImp.DoomBuilder.Controls;
|
||||
using CodeImp.DoomBuilder.Config;
|
||||
using CodeImp.DoomBuilder.Plugins;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace CodeImp.DoomBuilder
|
||||
{
|
||||
public class MapManager : IDisposable
|
||||
public class MapManager
|
||||
{
|
||||
#region ================== Constants
|
||||
|
||||
|
@ -89,16 +90,16 @@ namespace CodeImp.DoomBuilder
|
|||
public string FilePathName { get { return filepathname; } }
|
||||
public string FileTitle { get { return filetitle; } }
|
||||
public string TempPath { get { return temppath; } }
|
||||
public MapOptions Options { get { return options; } }
|
||||
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 DataManager Data { get { return data; } }
|
||||
public bool IsChanged { get { return changed; } set { changed |= value; } }
|
||||
public bool IsDisposed { get { return isdisposed; } }
|
||||
public D3DDevice Graphics { get { return graphics; } }
|
||||
public Renderer2D Renderer2D { get { return renderer2d; } }
|
||||
public Renderer3D Renderer3D { get { return renderer3d; } }
|
||||
internal D3DDevice Graphics { get { return graphics; } }
|
||||
public IRenderer2D Renderer2D { get { return renderer2d; } }
|
||||
public IRenderer3D Renderer3D { get { return renderer3d; } }
|
||||
public GameConfiguration Config { get { return config; } }
|
||||
public GridSetup Grid { get { return grid; } }
|
||||
public UndoManager UndoRedo { get { return undoredo; } }
|
||||
|
@ -109,7 +110,7 @@ namespace CodeImp.DoomBuilder
|
|||
#region ================== Constructor / Disposer
|
||||
|
||||
// Constructor
|
||||
public MapManager()
|
||||
internal MapManager()
|
||||
{
|
||||
// We have no destructor
|
||||
GC.SuppressFinalize(this);
|
||||
|
@ -117,17 +118,16 @@ namespace CodeImp.DoomBuilder
|
|||
// Basic objects
|
||||
grid = new GridSetup();
|
||||
undoredo = new UndoManager();
|
||||
|
||||
}
|
||||
|
||||
// Diposer
|
||||
public void Dispose()
|
||||
// Disposer
|
||||
internal void Dispose()
|
||||
{
|
||||
// Not already disposed?
|
||||
if(!isdisposed)
|
||||
{
|
||||
// Change to no mode
|
||||
ChangeMode(null);
|
||||
ChangeMode((EditMode)null);
|
||||
|
||||
// Unbind any methods
|
||||
ActionAttribute.UnbindMethods(this);
|
||||
|
@ -168,7 +168,7 @@ namespace CodeImp.DoomBuilder
|
|||
#region ================== New / Open
|
||||
|
||||
// Initializes for a new map
|
||||
public bool InitializeNewMap(MapOptions options)
|
||||
internal bool InitializeNewMap(MapOptions options)
|
||||
{
|
||||
string tempfile;
|
||||
|
||||
|
@ -198,6 +198,7 @@ namespace CodeImp.DoomBuilder
|
|||
General.WriteLogLine("Loading game configuration...");
|
||||
configinfo = General.GetConfigurationInfo(options.ConfigFile);
|
||||
config = new GameConfiguration(General.LoadGameConfiguration(options.ConfigFile));
|
||||
General.Plugins.GameConfigurationChanged();
|
||||
|
||||
// Create map data
|
||||
map = new MapSet();
|
||||
|
@ -226,7 +227,7 @@ namespace CodeImp.DoomBuilder
|
|||
ActionAttribute.BindMethods(this);
|
||||
|
||||
// Set default mode
|
||||
ChangeMode(new VerticesMode());
|
||||
ChangeMode("VerticesMode");
|
||||
|
||||
// Success
|
||||
General.WriteLogLine("Map creation done");
|
||||
|
@ -234,7 +235,7 @@ namespace CodeImp.DoomBuilder
|
|||
}
|
||||
|
||||
// Initializes for an existing map
|
||||
public bool InitializeOpenMap(string filepathname, MapOptions options)
|
||||
internal bool InitializeOpenMap(string filepathname, MapOptions options)
|
||||
{
|
||||
WAD mapwad;
|
||||
string tempfile;
|
||||
|
@ -261,12 +262,13 @@ namespace CodeImp.DoomBuilder
|
|||
// Create renderers
|
||||
renderer2d = new Renderer2D(graphics);
|
||||
renderer3d = new Renderer3D(graphics);
|
||||
|
||||
|
||||
// Load game configuration
|
||||
General.WriteLogLine("Loading game configuration...");
|
||||
configinfo = General.GetConfigurationInfo(options.ConfigFile);
|
||||
config = new GameConfiguration(General.LoadGameConfiguration(options.ConfigFile));
|
||||
|
||||
General.Plugins.GameConfigurationChanged();
|
||||
|
||||
// Create map data
|
||||
map = new MapSet();
|
||||
|
||||
|
@ -312,7 +314,7 @@ namespace CodeImp.DoomBuilder
|
|||
ActionAttribute.BindMethods(this);
|
||||
|
||||
// Set default mode
|
||||
ChangeMode(new VerticesMode());
|
||||
ChangeMode("VerticesMode");
|
||||
|
||||
// Center map in screen
|
||||
(General.Map.Mode as ClassicMode).CenterInScreen();
|
||||
|
@ -327,7 +329,7 @@ namespace CodeImp.DoomBuilder
|
|||
#region ================== Save
|
||||
|
||||
// Initializes for an existing map
|
||||
public bool SaveMap(string newfilepathname, int savemode)
|
||||
internal bool SaveMap(string newfilepathname, int savemode)
|
||||
{
|
||||
MapSet outputset;
|
||||
string nodebuildername, oldstatus, settingsfile;
|
||||
|
@ -757,7 +759,7 @@ namespace CodeImp.DoomBuilder
|
|||
|
||||
// This finds a lump within the range of known lump names
|
||||
// Returns -1 when the lump cannot be found
|
||||
public static int FindSpecificLump(WAD source, string lumpname, int mapheaderindex, string mapheadername, IDictionary maplumps)
|
||||
internal static int FindSpecificLump(WAD source, string lumpname, int mapheaderindex, string mapheadername, IDictionary maplumps)
|
||||
{
|
||||
// Use the configured map lump names to find the specific lump within range,
|
||||
// because when an unknown lump is met, this search must stop.
|
||||
|
@ -793,7 +795,7 @@ namespace CodeImp.DoomBuilder
|
|||
|
||||
// This removes a specific lump and returns the position where the lump was removed
|
||||
// Returns -1 when the lump could not be found
|
||||
public static int RemoveSpecificLump(WAD source, string lumpname, int mapheaderindex, string mapheadername, IDictionary maplumps)
|
||||
internal static int RemoveSpecificLump(WAD source, string lumpname, int mapheaderindex, string mapheadername, IDictionary maplumps)
|
||||
{
|
||||
int lumpindex;
|
||||
|
||||
|
@ -846,6 +848,12 @@ namespace CodeImp.DoomBuilder
|
|||
// Apply new mode
|
||||
mode = newmode;
|
||||
|
||||
// Check appropriate button on interface
|
||||
if(newmode != null)
|
||||
General.MainWindow.CheckEditModeButton(newmode.EditModeButtonName);
|
||||
else
|
||||
General.MainWindow.CheckEditModeButton("");
|
||||
|
||||
// Engage new mode
|
||||
if(newmode != null) newmode.Engage();
|
||||
|
||||
|
@ -858,37 +866,12 @@ namespace CodeImp.DoomBuilder
|
|||
// Redraw the display
|
||||
General.MainWindow.RedrawDisplay();
|
||||
}
|
||||
|
||||
// This switches to vertices mode
|
||||
[Action("verticesmode")]
|
||||
public void SwitchVerticesMode()
|
||||
|
||||
// This changes mode by class name and optionally with arguments
|
||||
public void ChangeMode(string classname, params object[] args)
|
||||
{
|
||||
// Change to vertices mode
|
||||
ChangeMode(new VerticesMode());
|
||||
}
|
||||
|
||||
// This switches to linedefs mode
|
||||
[Action("linedefsmode")]
|
||||
public void SwitchLinedefsMode()
|
||||
{
|
||||
// Change to linedefs mode
|
||||
ChangeMode(new LinedefsMode());
|
||||
}
|
||||
|
||||
// This switches to sectors mode
|
||||
[Action("sectorsmode")]
|
||||
public void SwitchSectorsMode()
|
||||
{
|
||||
// Change to sectors mode
|
||||
ChangeMode(new SectorsMode());
|
||||
}
|
||||
|
||||
// This switches to things mode
|
||||
[Action("thingsmode")]
|
||||
public void SwitchThingsMode()
|
||||
{
|
||||
// Change to things mode
|
||||
ChangeMode(new ThingsMode());
|
||||
EditModeInfo emi = General.Plugins.GetEditModeInfo(classname);
|
||||
if(emi != null) emi.SwitchToMode(args);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -907,7 +890,7 @@ namespace CodeImp.DoomBuilder
|
|||
}
|
||||
|
||||
// This sets a new mapset for editing
|
||||
public void ChangeMapSet(MapSet newmap)
|
||||
internal void ChangeMapSet(MapSet newmap)
|
||||
{
|
||||
// Can't have a selection in an old map set
|
||||
map.ClearAllSelected();
|
||||
|
@ -920,7 +903,7 @@ namespace CodeImp.DoomBuilder
|
|||
|
||||
// This reloads resources
|
||||
[Action("reloadresources")]
|
||||
public void ReloadResources()
|
||||
internal void ReloadResources()
|
||||
{
|
||||
DataLocation maplocation;
|
||||
string oldstatus;
|
||||
|
@ -945,6 +928,7 @@ namespace CodeImp.DoomBuilder
|
|||
General.WriteLogLine("Reloading game configuration...");
|
||||
configinfo = General.GetConfigurationInfo(options.ConfigFile);
|
||||
config = new GameConfiguration(General.LoadGameConfiguration(options.ConfigFile));
|
||||
General.Plugins.GameConfigurationChanged();
|
||||
|
||||
// Reload data resources
|
||||
General.WriteLogLine("Reloading data resources...");
|
||||
|
@ -965,7 +949,7 @@ namespace CodeImp.DoomBuilder
|
|||
|
||||
// Game Configuration action
|
||||
[Action("mapoptions")]
|
||||
public void ShowMapOptions()
|
||||
internal void ShowMapOptions()
|
||||
{
|
||||
// Show map options dialog
|
||||
MapOptionsForm optionsform = new MapOptionsForm(options);
|
||||
|
|
|
@ -27,7 +27,7 @@ using System.IO;
|
|||
|
||||
namespace CodeImp.DoomBuilder.IO
|
||||
{
|
||||
public class ClippedStream : Stream
|
||||
internal class ClippedStream : Stream
|
||||
{
|
||||
#region ================== Variables
|
||||
|
||||
|
@ -73,7 +73,7 @@ namespace CodeImp.DoomBuilder.IO
|
|||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
// Diposer
|
||||
// Disposer
|
||||
public new void Dispose()
|
||||
{
|
||||
// Not already disposed?
|
||||
|
|
|
@ -33,7 +33,7 @@ using System.Drawing.Imaging;
|
|||
|
||||
namespace CodeImp.DoomBuilder.IO
|
||||
{
|
||||
public unsafe class DoomFlatReader : IImageReader
|
||||
internal unsafe class DoomFlatReader : IImageReader
|
||||
{
|
||||
#region ================== Variables
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ using CodeImp.DoomBuilder.Geometry;
|
|||
|
||||
namespace CodeImp.DoomBuilder.IO
|
||||
{
|
||||
public class DoomMapSetIO : MapSetIO
|
||||
internal class DoomMapSetIO : MapSetIO
|
||||
{
|
||||
#region ================== Constants
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ using System.Drawing.Imaging;
|
|||
|
||||
namespace CodeImp.DoomBuilder.IO
|
||||
{
|
||||
public unsafe class DoomPictureReader : IImageReader
|
||||
internal unsafe class DoomPictureReader : IImageReader
|
||||
{
|
||||
#region ================== Variables
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ using System.Drawing.Imaging;
|
|||
|
||||
namespace CodeImp.DoomBuilder.IO
|
||||
{
|
||||
public unsafe class FileImageReader : IImageReader
|
||||
internal unsafe class FileImageReader : IImageReader
|
||||
{
|
||||
#region ================== Constructor / Disposer
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ using CodeImp.DoomBuilder.Geometry;
|
|||
|
||||
namespace CodeImp.DoomBuilder.IO
|
||||
{
|
||||
public class HexenMapSetIO : MapSetIO
|
||||
internal class HexenMapSetIO : MapSetIO
|
||||
{
|
||||
#region ================== Constants
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ using System.Drawing.Imaging;
|
|||
|
||||
namespace CodeImp.DoomBuilder.IO
|
||||
{
|
||||
public unsafe interface IImageReader
|
||||
internal unsafe interface IImageReader
|
||||
{
|
||||
// Methods
|
||||
Bitmap ReadAsBitmap(Stream stream);
|
||||
|
|
|
@ -27,7 +27,7 @@ using System.IO;
|
|||
|
||||
namespace CodeImp.DoomBuilder.IO
|
||||
{
|
||||
public class Lump : IDisposable
|
||||
internal class Lump
|
||||
{
|
||||
#region ================== Variables
|
||||
|
||||
|
@ -83,7 +83,7 @@ namespace CodeImp.DoomBuilder.IO
|
|||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
// Diposer
|
||||
// Disposer
|
||||
public void Dispose()
|
||||
{
|
||||
// Not already disposed?
|
||||
|
|
|
@ -30,7 +30,7 @@ using System.Diagnostics;
|
|||
|
||||
namespace CodeImp.DoomBuilder.IO
|
||||
{
|
||||
public abstract class MapSetIO
|
||||
internal abstract class MapSetIO
|
||||
{
|
||||
#region ================== Constants
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ using System.Drawing.Imaging;
|
|||
|
||||
namespace CodeImp.DoomBuilder.IO
|
||||
{
|
||||
public unsafe class UnknownImageReader : IImageReader
|
||||
internal unsafe class UnknownImageReader : IImageReader
|
||||
{
|
||||
#region ================== Constructor / Disposer
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ using System.IO;
|
|||
|
||||
namespace CodeImp.DoomBuilder.IO
|
||||
{
|
||||
public class WAD : IDisposable
|
||||
internal class WAD
|
||||
{
|
||||
#region ================== Constants
|
||||
|
||||
|
@ -98,7 +98,7 @@ namespace CodeImp.DoomBuilder.IO
|
|||
this.Dispose();
|
||||
}
|
||||
|
||||
// Diposer
|
||||
// Disposer
|
||||
public void Dispose()
|
||||
{
|
||||
// Not already disposed?
|
||||
|
|
|
@ -29,7 +29,7 @@ using System.Diagnostics;
|
|||
|
||||
namespace CodeImp.DoomBuilder.Interface
|
||||
{
|
||||
public partial class AboutForm : DelayedForm
|
||||
internal partial class AboutForm : DelayedForm
|
||||
{
|
||||
// Constructor
|
||||
public AboutForm()
|
||||
|
|
|
@ -34,7 +34,7 @@ using CodeImp.DoomBuilder.IO;
|
|||
|
||||
namespace CodeImp.DoomBuilder.Interface
|
||||
{
|
||||
public partial class ActionBrowserForm : DelayedForm
|
||||
internal partial class ActionBrowserForm : DelayedForm
|
||||
{
|
||||
// Constants
|
||||
private const int MAX_OPTIONS = 8;
|
||||
|
|
|
@ -30,7 +30,7 @@ using CodeImp.DoomBuilder.Config;
|
|||
|
||||
namespace CodeImp.DoomBuilder.Interface
|
||||
{
|
||||
public partial class ActionSelectorControl : UserControl
|
||||
internal partial class ActionSelectorControl : UserControl
|
||||
{
|
||||
// Events
|
||||
public event EventHandler ValueChanges;
|
||||
|
|
|
@ -32,7 +32,7 @@ using CodeImp.DoomBuilder.Editing;
|
|||
|
||||
namespace CodeImp.DoomBuilder.Interface
|
||||
{
|
||||
public class AutoSelectTextbox : TextBox
|
||||
internal class AutoSelectTextbox : TextBox
|
||||
{
|
||||
#region ================== Constants
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ using System.Drawing.Drawing2D;
|
|||
|
||||
namespace CodeImp.DoomBuilder.Interface
|
||||
{
|
||||
public partial class CheckboxArrayControl : UserControl
|
||||
internal partial class CheckboxArrayControl : UserControl
|
||||
{
|
||||
// Constants
|
||||
private const int SPACING_Y = 1;
|
||||
|
|
|
@ -30,7 +30,7 @@ using CodeImp.DoomBuilder.Rendering;
|
|||
|
||||
namespace CodeImp.DoomBuilder.Interface
|
||||
{
|
||||
public partial class ColorControl : UserControl
|
||||
internal partial class ColorControl : UserControl
|
||||
{
|
||||
// Constructor
|
||||
public ColorControl()
|
||||
|
|
|
@ -32,7 +32,7 @@ using CodeImp.DoomBuilder.Config;
|
|||
|
||||
namespace CodeImp.DoomBuilder.Interface
|
||||
{
|
||||
public partial class ConfigForm : DelayedForm
|
||||
internal partial class ConfigForm : DelayedForm
|
||||
{
|
||||
// Constructor
|
||||
public ConfigForm()
|
||||
|
|
|
@ -33,7 +33,7 @@ using CodeImp.DoomBuilder.Map;
|
|||
|
||||
namespace CodeImp.DoomBuilder.Interface
|
||||
{
|
||||
public partial class FlatBrowserForm : DelayedForm
|
||||
internal partial class FlatBrowserForm : DelayedForm
|
||||
{
|
||||
// Variables
|
||||
private string selectedname;
|
||||
|
|
|
@ -37,7 +37,7 @@ using CodeImp.DoomBuilder.Map;
|
|||
|
||||
namespace CodeImp.DoomBuilder.Interface
|
||||
{
|
||||
public class FlatSelectorControl : ImageSelectorControl
|
||||
internal class FlatSelectorControl : ImageSelectorControl
|
||||
{
|
||||
// Setup
|
||||
public void Initialize()
|
||||
|
|
|
@ -33,7 +33,7 @@ using CodeImp.DoomBuilder.Editing;
|
|||
|
||||
namespace CodeImp.DoomBuilder.Interface
|
||||
{
|
||||
public partial class GridSetupForm : DelayedForm
|
||||
internal partial class GridSetupForm : DelayedForm
|
||||
{
|
||||
// Variables
|
||||
private string backgroundname;
|
||||
|
|
63
Source/Interface/IMainForm.cs
Normal file
|
@ -0,0 +1,63 @@
|
|||
|
||||
#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 System.Drawing;
|
||||
using System.ComponentModel;
|
||||
using CodeImp.DoomBuilder.Map;
|
||||
using SlimDX.Direct3D;
|
||||
using SlimDX.Direct3D9;
|
||||
using SlimDX;
|
||||
using CodeImp.DoomBuilder.Geometry;
|
||||
using System.Drawing.Imaging;
|
||||
using CodeImp.DoomBuilder.Data;
|
||||
using CodeImp.DoomBuilder.Editing;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace CodeImp.DoomBuilder.Interface
|
||||
{
|
||||
public interface IMainForm
|
||||
{
|
||||
// Properties
|
||||
bool AltState { get; }
|
||||
bool CtrlState { get; }
|
||||
bool ShiftState { get; }
|
||||
bool MouseInDisplay { get; }
|
||||
bool AutoMerge { get; }
|
||||
bool SnapToGrid { get; }
|
||||
|
||||
// Methods
|
||||
void DisplayReady();
|
||||
void DisplayStatus(string status);
|
||||
void RedrawDisplay();
|
||||
void ShowEditLinedefs(ICollection<Linedef> lines);
|
||||
void ShowLinedefInfo(Linedef l);
|
||||
void ShowSectorInfo(Sector s);
|
||||
void ShowThingInfo(Thing t);
|
||||
void ShowVertexInfo(Vertex v);
|
||||
void HideInfo();
|
||||
}
|
||||
}
|
|
@ -36,7 +36,7 @@ using System.Drawing.Drawing2D;
|
|||
|
||||
namespace CodeImp.DoomBuilder.Interface
|
||||
{
|
||||
public partial class ImageBrowserControl : UserControl
|
||||
internal partial class ImageBrowserControl : UserControl
|
||||
{
|
||||
#region ================== Delegates / Events
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ using System.Drawing.Drawing2D;
|
|||
|
||||
namespace CodeImp.DoomBuilder.Interface
|
||||
{
|
||||
public abstract partial class ImageSelectorControl : UserControl
|
||||
internal abstract partial class ImageSelectorControl : UserControl
|
||||
{
|
||||
// Properties
|
||||
public string TextureName { get { return name.Text; } set { name.Text = value; } }
|
||||
|
|
|
@ -33,7 +33,7 @@ using CodeImp.DoomBuilder.Editing;
|
|||
|
||||
namespace CodeImp.DoomBuilder.Interface
|
||||
{
|
||||
public partial class LinedefEditForm : DelayedForm
|
||||
internal partial class LinedefEditForm : DelayedForm
|
||||
{
|
||||
// Variables
|
||||
private ICollection<Linedef> lines;
|
||||
|
@ -200,16 +200,6 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// This shows the dialog to edit lines
|
||||
public static void EditLinedefs(IWin32Window owner, ICollection<Linedef> lines)
|
||||
{
|
||||
// Show line edit dialog
|
||||
LinedefEditForm f = new LinedefEditForm();
|
||||
f.Setup(lines);
|
||||
f.ShowDialog(owner);
|
||||
f.Dispose();
|
||||
}
|
||||
|
||||
// Front side (un)checked
|
||||
private void frontside_CheckStateChanged(object sender, EventArgs e)
|
||||
|
|
|
@ -31,7 +31,7 @@ using CodeImp.DoomBuilder.Map;
|
|||
|
||||
namespace CodeImp.DoomBuilder.Interface
|
||||
{
|
||||
public partial class LinedefInfoPanel : UserControl
|
||||
internal partial class LinedefInfoPanel : UserControl
|
||||
{
|
||||
// Constructor
|
||||
public LinedefInfoPanel()
|
||||
|
|
188
Source/Interface/MainForm.Designer.cs
generated
|
@ -35,16 +35,16 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
|
||||
System.Windows.Forms.ToolStripSeparator toolStripSeparator4;
|
||||
System.Windows.Forms.ToolStripSeparator toolStripSeparator9;
|
||||
System.Windows.Forms.ToolStripSeparator toolStripSeparator6;
|
||||
System.Windows.Forms.ToolStripSeparator toolStripSeparator3;
|
||||
System.Windows.Forms.ToolStripSeparator toolStripSeparator5;
|
||||
System.Windows.Forms.ToolStripSeparator toolStripSeparator7;
|
||||
System.Windows.Forms.ToolStripSeparator toolStripMenuItem5;
|
||||
System.Windows.Forms.ToolStripSeparator toolStripSeparator10;
|
||||
System.Windows.Forms.ToolStripSeparator toolStripMenuItem4;
|
||||
System.Windows.Forms.ToolStripSeparator toolStripSeparator2;
|
||||
System.Windows.Forms.ToolStripSeparator toolStripSeparator11;
|
||||
System.Windows.Forms.ToolStripSeparator toolstripSeperator1;
|
||||
System.Windows.Forms.ToolStripSeparator toolstripSeperator6;
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
|
||||
this.itemeditmodesseperator = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.buttoneditmodesseperator = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.poscommalabel = new System.Windows.Forms.ToolStripStatusLabel();
|
||||
this.menumain = new System.Windows.Forms.MenuStrip();
|
||||
this.menufile = new System.Windows.Forms.ToolStripMenuItem();
|
||||
|
@ -59,11 +59,8 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
this.menuedit = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.itemundo = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.itemredo = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.itemverticesmode = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.itemlinedefsmode = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.itemsectorsmode = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.itemthingsmode = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.itemsnaptogrid = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.itemautomerge = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.itemmapoptions = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.menutools = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.itemreloadresources = new System.Windows.Forms.ToolStripMenuItem();
|
||||
|
@ -78,10 +75,6 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
this.buttonmapoptions = new System.Windows.Forms.ToolStripButton();
|
||||
this.buttonundo = new System.Windows.Forms.ToolStripButton();
|
||||
this.buttonredo = new System.Windows.Forms.ToolStripButton();
|
||||
this.buttonverticesmode = new System.Windows.Forms.ToolStripButton();
|
||||
this.buttonlinedefsmode = new System.Windows.Forms.ToolStripButton();
|
||||
this.buttonsectorsmode = new System.Windows.Forms.ToolStripButton();
|
||||
this.buttonthingsmode = new System.Windows.Forms.ToolStripButton();
|
||||
this.buttonthingsfilter = new System.Windows.Forms.ToolStripButton();
|
||||
this.thingfilters = new System.Windows.Forms.ToolStripComboBox();
|
||||
this.toolStripSeparator8 = new System.Windows.Forms.ToolStripSeparator();
|
||||
|
@ -119,22 +112,19 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
this.linedefinfo = new CodeImp.DoomBuilder.Interface.LinedefInfoPanel();
|
||||
this.redrawtimer = new System.Windows.Forms.Timer(this.components);
|
||||
this.display = new CodeImp.DoomBuilder.Interface.RenderTargetControl();
|
||||
this.itemautomerge = new System.Windows.Forms.ToolStripMenuItem();
|
||||
toolStripMenuItem1 = new System.Windows.Forms.ToolStripSeparator();
|
||||
toolStripMenuItem2 = new System.Windows.Forms.ToolStripSeparator();
|
||||
toolStripMenuItem3 = new System.Windows.Forms.ToolStripSeparator();
|
||||
toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
|
||||
toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator();
|
||||
toolStripSeparator9 = new System.Windows.Forms.ToolStripSeparator();
|
||||
toolStripSeparator6 = new System.Windows.Forms.ToolStripSeparator();
|
||||
toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();
|
||||
toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator();
|
||||
toolStripSeparator7 = new System.Windows.Forms.ToolStripSeparator();
|
||||
toolStripMenuItem5 = new System.Windows.Forms.ToolStripSeparator();
|
||||
toolStripSeparator10 = new System.Windows.Forms.ToolStripSeparator();
|
||||
toolStripMenuItem4 = new System.Windows.Forms.ToolStripSeparator();
|
||||
toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
|
||||
toolStripSeparator11 = new System.Windows.Forms.ToolStripSeparator();
|
||||
toolstripSeperator1 = new System.Windows.Forms.ToolStripSeparator();
|
||||
toolstripSeperator6 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.menumain.SuspendLayout();
|
||||
this.toolbar.SuspendLayout();
|
||||
this.statusbar.SuspendLayout();
|
||||
|
@ -173,10 +163,10 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
toolStripSeparator9.Name = "toolStripSeparator9";
|
||||
toolStripSeparator9.Size = new System.Drawing.Size(6, 23);
|
||||
//
|
||||
// toolStripSeparator6
|
||||
// itemeditmodesseperator
|
||||
//
|
||||
toolStripSeparator6.Name = "toolStripSeparator6";
|
||||
toolStripSeparator6.Size = new System.Drawing.Size(162, 6);
|
||||
this.itemeditmodesseperator.Name = "itemeditmodesseperator";
|
||||
this.itemeditmodesseperator.Size = new System.Drawing.Size(162, 6);
|
||||
//
|
||||
// toolStripSeparator3
|
||||
//
|
||||
|
@ -184,22 +174,11 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
toolStripSeparator3.Name = "toolStripSeparator3";
|
||||
toolStripSeparator3.Size = new System.Drawing.Size(6, 25);
|
||||
//
|
||||
// toolStripSeparator5
|
||||
// buttoneditmodesseperator
|
||||
//
|
||||
toolStripSeparator5.Margin = new System.Windows.Forms.Padding(3, 0, 3, 0);
|
||||
toolStripSeparator5.Name = "toolStripSeparator5";
|
||||
toolStripSeparator5.Size = new System.Drawing.Size(6, 25);
|
||||
//
|
||||
// toolStripSeparator7
|
||||
//
|
||||
toolStripSeparator7.Margin = new System.Windows.Forms.Padding(3, 0, 3, 0);
|
||||
toolStripSeparator7.Name = "toolStripSeparator7";
|
||||
toolStripSeparator7.Size = new System.Drawing.Size(6, 25);
|
||||
//
|
||||
// toolStripMenuItem5
|
||||
//
|
||||
toolStripMenuItem5.Name = "toolStripMenuItem5";
|
||||
toolStripMenuItem5.Size = new System.Drawing.Size(162, 6);
|
||||
this.buttoneditmodesseperator.Margin = new System.Windows.Forms.Padding(3, 0, 3, 0);
|
||||
this.buttoneditmodesseperator.Name = "buttoneditmodesseperator";
|
||||
this.buttoneditmodesseperator.Size = new System.Drawing.Size(6, 25);
|
||||
//
|
||||
// toolStripSeparator10
|
||||
//
|
||||
|
@ -222,6 +201,17 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
toolStripSeparator11.Name = "toolStripSeparator11";
|
||||
toolStripSeparator11.Size = new System.Drawing.Size(162, 6);
|
||||
//
|
||||
// toolstripSeperator1
|
||||
//
|
||||
toolstripSeperator1.Margin = new System.Windows.Forms.Padding(3, 0, 3, 0);
|
||||
toolstripSeperator1.Name = "toolstripSeperator1";
|
||||
toolstripSeperator1.Size = new System.Drawing.Size(6, 25);
|
||||
//
|
||||
// toolstripSeperator6
|
||||
//
|
||||
toolstripSeperator6.Name = "toolstripSeperator6";
|
||||
toolstripSeperator6.Size = new System.Drawing.Size(162, 6);
|
||||
//
|
||||
// poscommalabel
|
||||
//
|
||||
this.poscommalabel.Name = "poscommalabel";
|
||||
|
@ -329,12 +319,8 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
this.menuedit.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.itemundo,
|
||||
this.itemredo,
|
||||
toolStripMenuItem5,
|
||||
this.itemverticesmode,
|
||||
this.itemlinedefsmode,
|
||||
this.itemsectorsmode,
|
||||
this.itemthingsmode,
|
||||
toolStripSeparator6,
|
||||
toolstripSeperator6,
|
||||
this.itemeditmodesseperator,
|
||||
this.itemsnaptogrid,
|
||||
this.itemautomerge,
|
||||
toolStripSeparator11,
|
||||
|
@ -361,42 +347,6 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
this.itemredo.Text = "Redo";
|
||||
this.itemredo.Click += new System.EventHandler(this.InvokeTaggedAction);
|
||||
//
|
||||
// itemverticesmode
|
||||
//
|
||||
this.itemverticesmode.Image = global::CodeImp.DoomBuilder.Properties.Resources.VerticesMode;
|
||||
this.itemverticesmode.Name = "itemverticesmode";
|
||||
this.itemverticesmode.Size = new System.Drawing.Size(165, 22);
|
||||
this.itemverticesmode.Tag = "verticesmode";
|
||||
this.itemverticesmode.Text = "Vertices Mode";
|
||||
this.itemverticesmode.Click += new System.EventHandler(this.InvokeTaggedAction);
|
||||
//
|
||||
// itemlinedefsmode
|
||||
//
|
||||
this.itemlinedefsmode.Image = global::CodeImp.DoomBuilder.Properties.Resources.LinesMode;
|
||||
this.itemlinedefsmode.Name = "itemlinedefsmode";
|
||||
this.itemlinedefsmode.Size = new System.Drawing.Size(165, 22);
|
||||
this.itemlinedefsmode.Tag = "linedefsmode";
|
||||
this.itemlinedefsmode.Text = "Linedefs Mode";
|
||||
this.itemlinedefsmode.Click += new System.EventHandler(this.InvokeTaggedAction);
|
||||
//
|
||||
// itemsectorsmode
|
||||
//
|
||||
this.itemsectorsmode.Image = global::CodeImp.DoomBuilder.Properties.Resources.SectorsMode;
|
||||
this.itemsectorsmode.Name = "itemsectorsmode";
|
||||
this.itemsectorsmode.Size = new System.Drawing.Size(165, 22);
|
||||
this.itemsectorsmode.Tag = "sectorsmode";
|
||||
this.itemsectorsmode.Text = "Sectors Mode";
|
||||
this.itemsectorsmode.Click += new System.EventHandler(this.InvokeTaggedAction);
|
||||
//
|
||||
// itemthingsmode
|
||||
//
|
||||
this.itemthingsmode.Image = global::CodeImp.DoomBuilder.Properties.Resources.ThingsMode;
|
||||
this.itemthingsmode.Name = "itemthingsmode";
|
||||
this.itemthingsmode.Size = new System.Drawing.Size(165, 22);
|
||||
this.itemthingsmode.Tag = "thingsmode";
|
||||
this.itemthingsmode.Text = "Things Mode";
|
||||
this.itemthingsmode.Click += new System.EventHandler(this.InvokeTaggedAction);
|
||||
//
|
||||
// itemsnaptogrid
|
||||
//
|
||||
this.itemsnaptogrid.Checked = true;
|
||||
|
@ -408,6 +358,17 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
this.itemsnaptogrid.Text = "Snap to Grid";
|
||||
this.itemsnaptogrid.Click += new System.EventHandler(this.InvokeTaggedAction);
|
||||
//
|
||||
// itemautomerge
|
||||
//
|
||||
this.itemautomerge.Checked = true;
|
||||
this.itemautomerge.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.itemautomerge.Image = global::CodeImp.DoomBuilder.Properties.Resources.mergegeometry2;
|
||||
this.itemautomerge.Name = "itemautomerge";
|
||||
this.itemautomerge.Size = new System.Drawing.Size(165, 22);
|
||||
this.itemautomerge.Tag = "toggleautomerge";
|
||||
this.itemautomerge.Text = "Merge Geometry";
|
||||
this.itemautomerge.Click += new System.EventHandler(this.InvokeTaggedAction);
|
||||
//
|
||||
// itemmapoptions
|
||||
//
|
||||
this.itemmapoptions.Image = global::CodeImp.DoomBuilder.Properties.Resources.Properties;
|
||||
|
@ -479,12 +440,8 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
toolStripSeparator10,
|
||||
this.buttonundo,
|
||||
this.buttonredo,
|
||||
toolStripSeparator5,
|
||||
this.buttonverticesmode,
|
||||
this.buttonlinedefsmode,
|
||||
this.buttonsectorsmode,
|
||||
this.buttonthingsmode,
|
||||
toolStripSeparator7,
|
||||
toolstripSeperator1,
|
||||
this.buttoneditmodesseperator,
|
||||
this.buttonthingsfilter,
|
||||
this.thingfilters,
|
||||
this.toolStripSeparator8,
|
||||
|
@ -561,50 +518,6 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
this.buttonredo.Text = "Redo";
|
||||
this.buttonredo.Click += new System.EventHandler(this.InvokeTaggedAction);
|
||||
//
|
||||
// buttonverticesmode
|
||||
//
|
||||
this.buttonverticesmode.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
|
||||
this.buttonverticesmode.Image = global::CodeImp.DoomBuilder.Properties.Resources.VerticesMode;
|
||||
this.buttonverticesmode.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.buttonverticesmode.Name = "buttonverticesmode";
|
||||
this.buttonverticesmode.Size = new System.Drawing.Size(23, 22);
|
||||
this.buttonverticesmode.Tag = "verticesmode";
|
||||
this.buttonverticesmode.Text = "Vertices Mode";
|
||||
this.buttonverticesmode.Click += new System.EventHandler(this.InvokeTaggedAction);
|
||||
//
|
||||
// buttonlinedefsmode
|
||||
//
|
||||
this.buttonlinedefsmode.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
|
||||
this.buttonlinedefsmode.Image = global::CodeImp.DoomBuilder.Properties.Resources.LinesMode;
|
||||
this.buttonlinedefsmode.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.buttonlinedefsmode.Name = "buttonlinedefsmode";
|
||||
this.buttonlinedefsmode.Size = new System.Drawing.Size(23, 22);
|
||||
this.buttonlinedefsmode.Tag = "linedefsmode";
|
||||
this.buttonlinedefsmode.Text = "Linedefs Mode";
|
||||
this.buttonlinedefsmode.Click += new System.EventHandler(this.InvokeTaggedAction);
|
||||
//
|
||||
// buttonsectorsmode
|
||||
//
|
||||
this.buttonsectorsmode.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
|
||||
this.buttonsectorsmode.Image = global::CodeImp.DoomBuilder.Properties.Resources.SectorsMode;
|
||||
this.buttonsectorsmode.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.buttonsectorsmode.Name = "buttonsectorsmode";
|
||||
this.buttonsectorsmode.Size = new System.Drawing.Size(23, 22);
|
||||
this.buttonsectorsmode.Tag = "sectorsmode";
|
||||
this.buttonsectorsmode.Text = "Sectors Mode";
|
||||
this.buttonsectorsmode.Click += new System.EventHandler(this.InvokeTaggedAction);
|
||||
//
|
||||
// buttonthingsmode
|
||||
//
|
||||
this.buttonthingsmode.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
|
||||
this.buttonthingsmode.Image = global::CodeImp.DoomBuilder.Properties.Resources.ThingsMode;
|
||||
this.buttonthingsmode.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.buttonthingsmode.Name = "buttonthingsmode";
|
||||
this.buttonthingsmode.Size = new System.Drawing.Size(23, 22);
|
||||
this.buttonthingsmode.Tag = "thingsmode";
|
||||
this.buttonthingsmode.Text = "Things Mode";
|
||||
this.buttonthingsmode.Click += new System.EventHandler(this.InvokeTaggedAction);
|
||||
//
|
||||
// buttonthingsfilter
|
||||
//
|
||||
this.buttonthingsfilter.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
|
||||
|
@ -987,17 +900,6 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
this.display.Paint += new System.Windows.Forms.PaintEventHandler(this.display_Paint);
|
||||
this.display.MouseUp += new System.Windows.Forms.MouseEventHandler(this.display_MouseUp);
|
||||
//
|
||||
// itemautomerge
|
||||
//
|
||||
this.itemautomerge.Checked = true;
|
||||
this.itemautomerge.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.itemautomerge.Image = global::CodeImp.DoomBuilder.Properties.Resources.mergegeometry2;
|
||||
this.itemautomerge.Name = "itemautomerge";
|
||||
this.itemautomerge.Size = new System.Drawing.Size(165, 22);
|
||||
this.itemautomerge.Tag = "toggleautomerge";
|
||||
this.itemautomerge.Text = "Merge Geometry";
|
||||
this.itemautomerge.Click += new System.EventHandler(this.InvokeTaggedAction);
|
||||
//
|
||||
// MainForm
|
||||
//
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
|
@ -1074,14 +976,6 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
private System.Windows.Forms.ToolStripMenuItem itemmapoptions;
|
||||
private System.Windows.Forms.ToolStripButton buttonmapoptions;
|
||||
private System.Windows.Forms.ToolStripMenuItem itemreloadresources;
|
||||
private System.Windows.Forms.ToolStripButton buttonverticesmode;
|
||||
private System.Windows.Forms.ToolStripButton buttonlinedefsmode;
|
||||
private System.Windows.Forms.ToolStripButton buttonsectorsmode;
|
||||
private System.Windows.Forms.ToolStripMenuItem itemverticesmode;
|
||||
private System.Windows.Forms.ToolStripMenuItem itemlinedefsmode;
|
||||
private System.Windows.Forms.ToolStripMenuItem itemsectorsmode;
|
||||
private System.Windows.Forms.ToolStripButton buttonthingsmode;
|
||||
private System.Windows.Forms.ToolStripMenuItem itemthingsmode;
|
||||
private LinedefInfoPanel linedefinfo;
|
||||
private VertexInfoPanel vertexinfo;
|
||||
private SectorInfoPanel sectorinfo;
|
||||
|
@ -1110,5 +1004,7 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
private System.Windows.Forms.ToolStripMenuItem itemsnaptogrid;
|
||||
private System.Windows.Forms.ToolStripButton buttonautomerge;
|
||||
private System.Windows.Forms.ToolStripMenuItem itemautomerge;
|
||||
private System.Windows.Forms.ToolStripSeparator buttoneditmodesseperator;
|
||||
private System.Windows.Forms.ToolStripSeparator itemeditmodesseperator;
|
||||
}
|
||||
}
|
|
@ -35,7 +35,7 @@ using CodeImp.DoomBuilder.Map;
|
|||
|
||||
namespace CodeImp.DoomBuilder.Interface
|
||||
{
|
||||
public partial class MainForm : DelayedForm
|
||||
public partial class MainForm : DelayedForm, IMainForm
|
||||
{
|
||||
#region ================== Constants
|
||||
|
||||
|
@ -67,6 +67,9 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
// Recent files
|
||||
private ToolStripMenuItem[] recentitems;
|
||||
|
||||
// Edit modes
|
||||
private List<ToolStripItem> editmodeitems;
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Properties
|
||||
|
@ -75,7 +78,7 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
public bool CtrlState { get { return ctrl; } }
|
||||
public bool AltState { get { return alt; } }
|
||||
public bool MouseInDisplay { get { return mouseinside; } }
|
||||
public RenderTargetControl Display { get { return display; } }
|
||||
internal RenderTargetControl Display { get { return display; } }
|
||||
public bool SnapToGrid { get { return buttonsnaptogrid.Checked; } }
|
||||
public bool AutoMerge { get { return buttonautomerge.Checked; } }
|
||||
|
||||
|
@ -84,11 +87,12 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
#region ================== Constructor / Disposer
|
||||
|
||||
// Constructor
|
||||
public MainForm()
|
||||
internal MainForm()
|
||||
{
|
||||
// Setup controls
|
||||
InitializeComponent();
|
||||
|
||||
editmodeitems = new List<ToolStripItem>();
|
||||
|
||||
// Visual Studio IDE doesn't let me set these in the designer :(
|
||||
buttonzoom.Font = menufile.Font;
|
||||
buttonzoom.DropDownDirection = ToolStripDropDownDirection.AboveLeft;
|
||||
|
@ -117,7 +121,7 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
#region ================== General
|
||||
|
||||
// This updates all menus for the current status
|
||||
public void UpdateInterface()
|
||||
internal void UpdateInterface()
|
||||
{
|
||||
// Map opened?
|
||||
if(General.Map != null)
|
||||
|
@ -138,13 +142,17 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
UpdateFileMenu();
|
||||
UpdateEditMenu();
|
||||
UpdateToolsMenu();
|
||||
UpdateEditModeItems();
|
||||
}
|
||||
|
||||
// Generic event that invokes the tagged action
|
||||
private void InvokeTaggedAction(object sender, EventArgs e)
|
||||
{
|
||||
string asmname;
|
||||
|
||||
this.Update();
|
||||
General.Actions[(sender as ToolStripItem).Tag.ToString()].Invoke();
|
||||
asmname = General.ThisAssembly.GetName().Name.ToLowerInvariant();
|
||||
General.Actions[asmname + "_" + (sender as ToolStripItem).Tag.ToString()].Invoke();
|
||||
this.Update();
|
||||
}
|
||||
|
||||
|
@ -270,7 +278,7 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
}
|
||||
|
||||
// This returns the current status text
|
||||
public string GetCurrentSatus()
|
||||
internal string GetCurrentSatus()
|
||||
{
|
||||
return statuslabel.Text;
|
||||
}
|
||||
|
@ -298,7 +306,7 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
}
|
||||
|
||||
// This updates the status icon
|
||||
public void UpdateStatusIcon()
|
||||
internal void UpdateStatusIcon()
|
||||
{
|
||||
// From another thread?
|
||||
if(statusbar.InvokeRequired)
|
||||
|
@ -342,7 +350,7 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
}
|
||||
|
||||
// This changes coordinates display
|
||||
public void UpdateCoordinates(Vector2D coords)
|
||||
internal void UpdateCoordinates(Vector2D coords)
|
||||
{
|
||||
// X position
|
||||
if(float.IsNaN(coords.x))
|
||||
|
@ -361,7 +369,7 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
}
|
||||
|
||||
// This changes zoom display
|
||||
public void UpdateZoom(float scale)
|
||||
internal void UpdateZoom(float scale)
|
||||
{
|
||||
// Update scale label
|
||||
if(float.IsNaN(scale))
|
||||
|
@ -409,7 +417,7 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
}
|
||||
|
||||
// This changes grid display
|
||||
public void UpdateGrid(int gridsize)
|
||||
internal void UpdateGrid(int gridsize)
|
||||
{
|
||||
// Update grid label
|
||||
if(gridsize == 0)
|
||||
|
@ -454,7 +462,7 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
|
||||
// This shows the grid setup dialog
|
||||
[Action("gridsetup")]
|
||||
public void ShowGridSetup()
|
||||
internal void ShowGridSetup()
|
||||
{
|
||||
// Only when a map is open
|
||||
if(General.Map == null) return;
|
||||
|
@ -473,10 +481,102 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
|
||||
#endregion
|
||||
|
||||
#region ================== Toolbar
|
||||
|
||||
// This enables or disables all editing mode items
|
||||
private void UpdateEditModeItems()
|
||||
{
|
||||
// Enable/disable all items
|
||||
foreach(ToolStripItem i in editmodeitems) i.Enabled = (General.Map != null);
|
||||
}
|
||||
|
||||
// This checks one of the edit mode items (and unchecks all others)
|
||||
internal void CheckEditModeButton(string modeclassname)
|
||||
{
|
||||
// Go for all items
|
||||
foreach(ToolStripItem i in editmodeitems)
|
||||
{
|
||||
// Check what type it is
|
||||
if(i is ToolStripMenuItem)
|
||||
{
|
||||
// Check if mode type matches with given name
|
||||
(i as ToolStripMenuItem).Checked = ((i.Tag as EditModeInfo).Type.Name == modeclassname);
|
||||
}
|
||||
else if(i is ToolStripButton)
|
||||
{
|
||||
// Check if mode type matches with given name
|
||||
(i as ToolStripButton).Checked = ((i.Tag as EditModeInfo).Type.Name == modeclassname);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// This removes the config-specific editing mode buttons
|
||||
internal void RemoveSpecificEditModeButtons()
|
||||
{
|
||||
bool removed;
|
||||
|
||||
do
|
||||
{
|
||||
// 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);
|
||||
menuedit.DropDownItems.Remove(i);
|
||||
removed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
while(removed);
|
||||
}
|
||||
|
||||
// This adds an editing mode button to the toolbar and edit menu
|
||||
internal void AddEditModeButton(EditModeInfo modeinfo)
|
||||
{
|
||||
ToolStripItem item;
|
||||
int index;
|
||||
|
||||
// Create a button
|
||||
index = toolbar.Items.IndexOf(buttoneditmodesseperator);
|
||||
item = new ToolStripButton(modeinfo.ButtonDesc, modeinfo.ButtonImage, new EventHandler(EditModeButtonHandler));
|
||||
item.DisplayStyle = ToolStripItemDisplayStyle.Image;
|
||||
item.Tag = modeinfo;
|
||||
item.Enabled = (General.Map != null);
|
||||
toolbar.Items.Insert(index, item);
|
||||
editmodeitems.Add(item);
|
||||
|
||||
// Create menu item
|
||||
index = menuedit.DropDownItems.IndexOf(itemeditmodesseperator);
|
||||
item = new ToolStripMenuItem(modeinfo.ButtonDesc, modeinfo.ButtonImage, new EventHandler(EditModeButtonHandler));
|
||||
item.Tag = modeinfo;
|
||||
item.Enabled = (General.Map != null);
|
||||
menuedit.DropDownItems.Insert(index, item);
|
||||
editmodeitems.Add(item);
|
||||
}
|
||||
|
||||
// This handles edit mode button clicks
|
||||
private void EditModeButtonHandler(object sender, EventArgs e)
|
||||
{
|
||||
EditModeInfo modeinfo;
|
||||
|
||||
this.Update();
|
||||
modeinfo = (EditModeInfo)((sender as ToolStripItem).Tag);
|
||||
General.Actions[modeinfo.SwitchAction.GetFullActionName(modeinfo.Plugin.Assembly)].Invoke();
|
||||
this.Update();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Display
|
||||
|
||||
// This shows the splash screen on display
|
||||
public void ShowSplashDisplay()
|
||||
internal void ShowSplashDisplay()
|
||||
{
|
||||
// Change display to show splash logo
|
||||
display.SetSplashLogoDisplay();
|
||||
|
@ -484,7 +584,7 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
}
|
||||
|
||||
// This clears the display
|
||||
public void ClearDisplay()
|
||||
internal void ClearDisplay()
|
||||
{
|
||||
// Clear the display
|
||||
display.SetManualRendering();
|
||||
|
@ -636,7 +736,7 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
#region ================== Menus
|
||||
|
||||
// Public method to apply shortcut keys
|
||||
public void ApplyShortcutKeys()
|
||||
internal void ApplyShortcutKeys()
|
||||
{
|
||||
// Apply shortcut keys to menus
|
||||
ApplyShortcutKeys(menumain.Items);
|
||||
|
@ -753,7 +853,7 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
}
|
||||
|
||||
// This adds a recent file to the list
|
||||
public void AddRecentFile(string filename)
|
||||
internal void AddRecentFile(string filename)
|
||||
{
|
||||
int movedownto = MAX_RECENT_FILES - 1;
|
||||
|
||||
|
@ -838,34 +938,6 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
|
||||
#region ================== Edit Menu
|
||||
|
||||
// This sets the status of the vertices button
|
||||
public void SetVerticesChecked(bool value)
|
||||
{
|
||||
itemverticesmode.Checked = value;
|
||||
buttonverticesmode.Checked = value;
|
||||
}
|
||||
|
||||
// This sets the status of the linedefs button
|
||||
public void SetLinedefsChecked(bool value)
|
||||
{
|
||||
itemlinedefsmode.Checked = value;
|
||||
buttonlinedefsmode.Checked = value;
|
||||
}
|
||||
|
||||
// This sets the status of the sectors button
|
||||
public void SetSectorsChecked(bool value)
|
||||
{
|
||||
itemsectorsmode.Checked = value;
|
||||
buttonsectorsmode.Checked = value;
|
||||
}
|
||||
|
||||
// This sets the status of the things button
|
||||
public void SetThingsChecked(bool value)
|
||||
{
|
||||
itemthingsmode.Checked = value;
|
||||
buttonthingsmode.Checked = value;
|
||||
}
|
||||
|
||||
// This sets up the edit menu
|
||||
private void UpdateEditMenu()
|
||||
{
|
||||
|
@ -876,10 +948,6 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
itemundo.Enabled = (General.Map != null) && (General.Map.UndoRedo.NextUndo != null);
|
||||
itemredo.Enabled = (General.Map != null) && (General.Map.UndoRedo.NextRedo != null);
|
||||
itemmapoptions.Enabled = (General.Map != null);
|
||||
itemverticesmode.Enabled = (General.Map != null);
|
||||
itemlinedefsmode.Enabled = (General.Map != null);
|
||||
itemsectorsmode.Enabled = (General.Map != null);
|
||||
itemthingsmode.Enabled = (General.Map != null);
|
||||
itemsnaptogrid.Enabled = (General.Map != null);
|
||||
itemautomerge.Enabled = (General.Map != null);
|
||||
|
||||
|
@ -897,10 +965,6 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
|
||||
// Toolbar icons
|
||||
buttonmapoptions.Enabled = (General.Map != null);
|
||||
buttonverticesmode.Enabled = (General.Map != null);
|
||||
buttonlinedefsmode.Enabled = (General.Map != null);
|
||||
buttonsectorsmode.Enabled = (General.Map != null);
|
||||
buttonthingsmode.Enabled = (General.Map != null);
|
||||
buttonundo.Enabled = itemundo.Enabled;
|
||||
buttonredo.Enabled = itemredo.Enabled;
|
||||
buttonundo.ToolTipText = itemundo.Text;
|
||||
|
@ -911,7 +975,7 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
|
||||
// Action to toggle snap to grid
|
||||
[Action("togglesnap")]
|
||||
public void ToggleSnapToGrid()
|
||||
internal void ToggleSnapToGrid()
|
||||
{
|
||||
buttonsnaptogrid.Checked = !buttonsnaptogrid.Checked;
|
||||
itemsnaptogrid.Checked = buttonsnaptogrid.Checked;
|
||||
|
@ -919,7 +983,7 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
|
||||
// Action to toggle auto merge
|
||||
[Action("toggleautomerge")]
|
||||
public void ToggleAutoMerge()
|
||||
internal void ToggleAutoMerge()
|
||||
{
|
||||
buttonautomerge.Checked = !buttonautomerge.Checked;
|
||||
itemautomerge.Checked = buttonautomerge.Checked;
|
||||
|
@ -954,7 +1018,7 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
|
||||
// Game Configuration action
|
||||
[Action("configuration")]
|
||||
public void ShowConfiguration()
|
||||
internal void ShowConfiguration()
|
||||
{
|
||||
// Show configuration dialog
|
||||
ConfigForm cfgform = new ConfigForm();
|
||||
|
@ -976,7 +1040,7 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
|
||||
// Preferences action
|
||||
[Action("preferences")]
|
||||
public void ShowPreferences()
|
||||
internal void ShowPreferences()
|
||||
{
|
||||
// Show preferences dialog
|
||||
PreferencesForm prefform = new PreferencesForm();
|
||||
|
@ -1023,5 +1087,19 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
public void ShowThingInfo(Thing t) { thinginfo.ShowInfo(t); }
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Dialogs
|
||||
|
||||
// This shows the dialog to edit lines
|
||||
public void ShowEditLinedefs(ICollection<Linedef> lines)
|
||||
{
|
||||
// Show line edit dialog
|
||||
LinedefEditForm f = new LinedefEditForm();
|
||||
f.Setup(lines);
|
||||
f.ShowDialog(this);
|
||||
f.Dispose();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -135,21 +135,9 @@
|
|||
<metadata name="toolStripSeparator9.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
<metadata name="toolStripSeparator6.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
<metadata name="toolStripSeparator3.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
<metadata name="toolStripSeparator5.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
<metadata name="toolStripSeparator7.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
<metadata name="toolStripMenuItem5.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
<metadata name="toolStripSeparator10.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
|
@ -162,6 +150,12 @@
|
|||
<metadata name="toolStripSeparator11.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
<metadata name="toolstripSeperator1.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
<metadata name="toolstripSeperator6.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
<metadata name="menumain.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
|
|
|
@ -32,7 +32,7 @@ using CodeImp.DoomBuilder.Config;
|
|||
|
||||
namespace CodeImp.DoomBuilder.Interface
|
||||
{
|
||||
public partial class MapOptionsForm : DelayedForm
|
||||
internal partial class MapOptionsForm : DelayedForm
|
||||
{
|
||||
// Variables
|
||||
private MapOptions options;
|
||||
|
|
|
@ -34,7 +34,7 @@ using CodeImp.DoomBuilder.Config;
|
|||
|
||||
namespace CodeImp.DoomBuilder.Interface
|
||||
{
|
||||
public partial class OpenMapOptionsForm : DelayedForm
|
||||
internal partial class OpenMapOptionsForm : DelayedForm
|
||||
{
|
||||
// Variables
|
||||
private Configuration mapsettings;
|
||||
|
|
|
@ -30,7 +30,7 @@ using CodeImp.DoomBuilder.Controls;
|
|||
|
||||
namespace CodeImp.DoomBuilder.Interface
|
||||
{
|
||||
public partial class PreferencesForm : DelayedForm
|
||||
internal partial class PreferencesForm : DelayedForm
|
||||
{
|
||||
#region ================== Variables
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ using CodeImp.DoomBuilder.Editing;
|
|||
|
||||
namespace CodeImp.DoomBuilder.Interface
|
||||
{
|
||||
public class RenderTargetControl : Panel
|
||||
internal class RenderTargetControl : Panel
|
||||
{
|
||||
#region ================== Constants
|
||||
|
||||
|
@ -59,7 +59,7 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
this.SetStyle(ControlStyles.FixedHeight, true);
|
||||
}
|
||||
|
||||
// Diposer
|
||||
// Disposer
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
// Clean up
|
||||
|
|
2
Source/Interface/ResourceListEditor.Designer.cs
generated
|
@ -1,6 +1,6 @@
|
|||
namespace CodeImp.DoomBuilder.Interface
|
||||
{
|
||||
public partial class ResourceListEditor
|
||||
partial class ResourceListEditor
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
|
|
|
@ -29,7 +29,7 @@ using CodeImp.DoomBuilder.Data;
|
|||
|
||||
namespace CodeImp.DoomBuilder.Interface
|
||||
{
|
||||
public partial class ResourceListEditor : UserControl
|
||||
internal partial class ResourceListEditor : UserControl
|
||||
{
|
||||
#region ================== Delegates / Events
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ using CodeImp.DoomBuilder.Editing;
|
|||
|
||||
namespace CodeImp.DoomBuilder.Interface
|
||||
{
|
||||
public class ResourceListView : ListView
|
||||
internal class ResourceListView : ListView
|
||||
{
|
||||
#region ================== Constants
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ using CodeImp.DoomBuilder.Data;
|
|||
|
||||
namespace CodeImp.DoomBuilder.Interface
|
||||
{
|
||||
public partial class ResourceOptionsForm : DelayedForm
|
||||
internal partial class ResourceOptionsForm : DelayedForm
|
||||
{
|
||||
// Variables
|
||||
private DataLocation res;
|
||||
|
|
|
@ -31,7 +31,7 @@ using CodeImp.DoomBuilder.Map;
|
|||
|
||||
namespace CodeImp.DoomBuilder.Interface
|
||||
{
|
||||
public partial class SectorInfoPanel : UserControl
|
||||
internal partial class SectorInfoPanel : UserControl
|
||||
{
|
||||
// Constructor
|
||||
public SectorInfoPanel()
|
||||
|
|
|
@ -33,7 +33,7 @@ using CodeImp.DoomBuilder.Map;
|
|||
|
||||
namespace CodeImp.DoomBuilder.Interface
|
||||
{
|
||||
public partial class TextureBrowserForm : DelayedForm
|
||||
internal partial class TextureBrowserForm : DelayedForm
|
||||
{
|
||||
// Variables
|
||||
private string selectedname;
|
||||
|
|