mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-01-18 14:31:50 +00:00
lots of changes/additions
This commit is contained in:
parent
bac031fa5d
commit
f6a91b7dad
55 changed files with 2376 additions and 194 deletions
|
@ -13,6 +13,8 @@ formatinterface = "DoomMapSetIO";
|
|||
|
||||
// Special linedefs
|
||||
soundlinedefflags = 64; // See linedefflags
|
||||
singlesidedflags = 1; // See linedefflags
|
||||
doublesidedflags = 4; // See linedefflags
|
||||
|
||||
// No generalized types
|
||||
generalizedlinedefs = true;
|
||||
|
@ -360,7 +362,7 @@ linedefactivations
|
|||
// but hey, are you willing to reformat the linedef types for each config?
|
||||
linedeftypes
|
||||
{
|
||||
0 = " Normal";
|
||||
0 = " None";
|
||||
1 = "DR Door Open Wait Close (also monsters)";
|
||||
2 = "W1 Door Open Stay";
|
||||
3 = "W1 Door Close Stay";
|
||||
|
|
|
@ -13,6 +13,8 @@ formatinterface = "DoomMapSetIO";
|
|||
|
||||
// Special linedefs
|
||||
soundlinedefflags = 64; // See linedefflags
|
||||
singlesidedflags = 1; // See linedefflags
|
||||
doublesidedflags = 4; // See linedefflags
|
||||
|
||||
// No generalized types
|
||||
generalizedlinedefs = false;
|
||||
|
@ -310,7 +312,7 @@ linedefactivations
|
|||
// but hey, are you willing to reformat the linedef types for each config?
|
||||
linedeftypes
|
||||
{
|
||||
0 = " Normal";
|
||||
0 = " None";
|
||||
1 = "DR Door Open Wait Close (also monsters)";
|
||||
2 = "W1 Door Open Stay";
|
||||
3 = "W1 Door Close Stay";
|
||||
|
|
|
@ -13,6 +13,8 @@ formatinterface = "DoomMapSetIO";
|
|||
|
||||
// Special linedefs
|
||||
soundlinedefflags = 64; // See linedefflags
|
||||
singlesidedflags = 1; // See linedefflags
|
||||
doublesidedflags = 4; // See linedefflags
|
||||
|
||||
// No generalized types
|
||||
generalizedlinedefs = false;
|
||||
|
@ -311,7 +313,7 @@ linedefactivations
|
|||
// but hey, are you willing to reformat the linedef types for each config?
|
||||
linedeftypes
|
||||
{
|
||||
0 = " Normal";
|
||||
0 = " None";
|
||||
1 = "DR Door Open Wait Close (also monsters)";
|
||||
2 = "W1 Door Open Stay";
|
||||
3 = "W1 Door Close Stay";
|
||||
|
|
|
@ -16,6 +16,8 @@ formatinterface = "DoomMapSetIO";
|
|||
|
||||
// Special linedefs
|
||||
soundlinedefflags = 64; // See linedefflags
|
||||
singlesidedflags = 1; // See linedefflags
|
||||
doublesidedflags = 4; // See linedefflags
|
||||
|
||||
// No generalized types
|
||||
generalizedlinedefs = false;
|
||||
|
@ -367,7 +369,7 @@ linedefactivations
|
|||
// but hey, are you willing to reformat the linedef types for each config?
|
||||
linedeftypes
|
||||
{
|
||||
0 = " Normal";
|
||||
0 = " None";
|
||||
1 = " Open Door (closes)";
|
||||
2 = " Walk Once - Open the Door";
|
||||
3 = " Walk Once - Close the Door";
|
||||
|
|
|
@ -13,6 +13,8 @@ formatinterface = "DoomMapSetIO";
|
|||
|
||||
// Special linedefs
|
||||
soundlinedefflags = 64; // See linedefflags
|
||||
singlesidedflags = 1; // See linedefflags
|
||||
doublesidedflags = 4; // See linedefflags
|
||||
|
||||
// No generalized types
|
||||
generalizedlinedefs = true;
|
||||
|
@ -368,7 +370,7 @@ linedefactivations
|
|||
// but hey, are you willing to reformat the linedef types for each config?
|
||||
linedeftypes
|
||||
{
|
||||
0 = " Normal";
|
||||
0 = " None";
|
||||
1 = "DR Door Open Wait Close (also monsters)";
|
||||
2 = "W1 Door Open Stay";
|
||||
3 = "W1 Door Close Stay";
|
||||
|
|
|
@ -13,6 +13,8 @@ formatinterface = "DoomMapSetIO";
|
|||
|
||||
// Special linedefs
|
||||
soundlinedefflags = 64; // See linedefflags
|
||||
singlesidedflags = 1; // See linedefflags
|
||||
doublesidedflags = 4; // See linedefflags
|
||||
|
||||
// No generalized types
|
||||
generalizedlinedefs = false;
|
||||
|
@ -335,7 +337,7 @@ linedefactivations
|
|||
// but hey, are you willing to reformat the linedef types for each config?
|
||||
linedeftypes
|
||||
{
|
||||
0 = " Normal";
|
||||
0 = " None";
|
||||
1 = "DR Door Open Wait Close (also monsters)";
|
||||
2 = "W1 Door Open Stay";
|
||||
3 = "W1 Door Close Stay";
|
||||
|
|
|
@ -13,6 +13,8 @@ formatinterface = "HexenMapSetIO";
|
|||
|
||||
// Special linedefs
|
||||
soundlinedefflags = 64; // See linedefflags
|
||||
singlesidedflags = 1; // See linedefflags
|
||||
doublesidedflags = 4; // See linedefflags
|
||||
|
||||
// No generalized types
|
||||
generalizedlinedefs = false;
|
||||
|
@ -353,7 +355,7 @@ linedefactivations
|
|||
// but hey, are you willing to reformat the linedef types for each config?
|
||||
linedeftypes
|
||||
{
|
||||
0 = " Normal";
|
||||
0 = " None";
|
||||
|
||||
20
|
||||
{
|
||||
|
|
|
@ -13,6 +13,8 @@ formatinterface = "DoomMapSetIO";
|
|||
|
||||
// Special linedefs
|
||||
soundlinedefflags = 64; // See linedefflags
|
||||
singlesidedflags = 1; // See linedefflags
|
||||
doublesidedflags = 4; // See linedefflags
|
||||
|
||||
// No generalized types
|
||||
generalizedlinedefs = true;
|
||||
|
@ -345,7 +347,7 @@ linedefactivations
|
|||
// but hey, are you willing to reformat the linedef types for each config?
|
||||
linedeftypes
|
||||
{
|
||||
0 = " Normal";
|
||||
0 = " None";
|
||||
1 = "DR Door Open Wait Close (also monsters)";
|
||||
2 = "W1 Door Open Stay";
|
||||
3 = "W1 Door Close Stay";
|
||||
|
|
|
@ -13,6 +13,8 @@ formatinterface = "DoomMapSetIO";
|
|||
|
||||
// Special linedefs
|
||||
soundlinedefflags = 64; // See linedefflags
|
||||
singlesidedflags = 1; // See linedefflags
|
||||
doublesidedflags = 4; // See linedefflags
|
||||
|
||||
// No generalized types
|
||||
generalizedlinedefs = true;
|
||||
|
@ -377,7 +379,7 @@ linedefactivations
|
|||
// but hey, are you willing to reformat the linedef types for each config?
|
||||
linedeftypes
|
||||
{
|
||||
0 = " Normal";
|
||||
0 = " None";
|
||||
1 = "DR Door Open Wait Close (also monsters)";
|
||||
2 = "W1 Door Open Stay";
|
||||
3 = "W1 Door Close Stay";
|
||||
|
|
|
@ -13,6 +13,8 @@ formatinterface = "DoomMapSetIO";
|
|||
|
||||
// Special linedefs
|
||||
soundlinedefflags = 64; // See linedefflags
|
||||
singlesidedflags = 1; // See linedefflags
|
||||
doublesidedflags = 4; // See linedefflags
|
||||
|
||||
// No generalized types
|
||||
generalizedlinedefs = true;
|
||||
|
@ -379,7 +381,7 @@ linedefactivations
|
|||
// but hey, are you willing to reformat the linedef types for each config?
|
||||
linedeftypes
|
||||
{
|
||||
0 = " Normal";
|
||||
0 = " None";
|
||||
1 = "DR Door Open Wait Close (also monsters)";
|
||||
2 = "W1 Door Open Stay";
|
||||
3 = "W1 Door Close Stay";
|
||||
|
|
|
@ -13,6 +13,8 @@ formatinterface = "HexenMapSetIO";
|
|||
|
||||
// Special linedefs
|
||||
soundlinedefflags = 64; // See linedefflags
|
||||
singlesidedflags = 1; // See linedefflags
|
||||
doublesidedflags = 4; // See linedefflags
|
||||
|
||||
// No generalized types
|
||||
generalizedlinedefs = false;
|
||||
|
@ -381,7 +383,7 @@ linedefactivations
|
|||
// but hey, are you willing to reformat the linedef types for each config?
|
||||
linedeftypes
|
||||
{
|
||||
0 = " Normal";
|
||||
0 = " None";
|
||||
|
||||
20
|
||||
{
|
||||
|
|
|
@ -13,6 +13,8 @@ formatinterface = "DoomMapSetIO";
|
|||
|
||||
// Special linedefs
|
||||
soundlinedefflags = 64; // See linedefflags
|
||||
singlesidedflags = 1; // See linedefflags
|
||||
doublesidedflags = 4; // See linedefflags
|
||||
|
||||
// No generalized types
|
||||
generalizedlinedefs = false;
|
||||
|
@ -317,7 +319,7 @@ linedefactivations
|
|||
// but hey, are you willing to reformat the linedef types for each config?
|
||||
linedeftypes
|
||||
{
|
||||
0 = " Normal";
|
||||
0 = " None";
|
||||
1 = "DR Door Open Wait Close (also monsters)";
|
||||
2 = "W1 Door Open Stay";
|
||||
3 = "W1 Door Close Stay";
|
||||
|
|
|
@ -13,6 +13,8 @@ formatinterface = "DoomMapSetIO";
|
|||
|
||||
// Special linedefs
|
||||
soundlinedefflags = 64; // See linedefflags
|
||||
singlesidedflags = 1; // See linedefflags
|
||||
doublesidedflags = 4; // See linedefflags
|
||||
|
||||
// No generalized types
|
||||
generalizedlinedefs = false;
|
||||
|
@ -311,7 +313,7 @@ linedefactivations
|
|||
// but hey, are you willing to reformat the linedef types for each config?
|
||||
linedeftypes
|
||||
{
|
||||
0 = " Normal";
|
||||
0 = " None";
|
||||
1 = "DR Door Open Wait Close (also monsters)";
|
||||
2 = "W1 Door Open Stay";
|
||||
3 = "W1 Door Close Stay";
|
||||
|
|
|
@ -13,6 +13,8 @@ formatinterface = "DoomMapSetIO";
|
|||
|
||||
// Special linedefs
|
||||
soundlinedefflags = 64; // See linedefflags
|
||||
singlesidedflags = 1; // See linedefflags
|
||||
doublesidedflags = 4; // See linedefflags
|
||||
|
||||
// Engine specific features
|
||||
mixtexturesflats = true;
|
||||
|
@ -378,7 +380,7 @@ linedefactivations
|
|||
// but hey, are you willing to reformat the linedef types for each config?
|
||||
linedeftypes
|
||||
{
|
||||
0 = " Normal";
|
||||
0 = " None";
|
||||
1 = "DR Door Open Wait Close (also monsters)";
|
||||
2 = "W1 Door Open Stay";
|
||||
3 = "W1 Door Close Stay";
|
||||
|
|
|
@ -13,6 +13,8 @@ formatinterface = "HexenMapSetIO";
|
|||
|
||||
// Special linedefs
|
||||
soundlinedefflags = 64; // See linedefflags
|
||||
singlesidedflags = 1; // See linedefflags
|
||||
doublesidedflags = 4; // See linedefflags
|
||||
|
||||
// No generalized types
|
||||
generalizedlinedefs = false;
|
||||
|
@ -543,7 +545,7 @@ linedefactivations
|
|||
// but hey, are you willing to reformat the linedef types for each config?
|
||||
linedeftypes
|
||||
{
|
||||
0 = " Normal";
|
||||
0 = " None";
|
||||
|
||||
20
|
||||
{
|
||||
|
|
|
@ -13,6 +13,8 @@ formatinterface = "HexenMapSetIO";
|
|||
|
||||
// Special linedefs
|
||||
soundlinedefflags = 64; // See linedefflags
|
||||
singlesidedflags = 1; // See linedefflags
|
||||
doublesidedflags = 4; // See linedefflags
|
||||
|
||||
// No generalized types
|
||||
generalizedlinedefs = false;
|
||||
|
@ -536,7 +538,7 @@ linedefactivations
|
|||
// but hey, are you willing to reformat the linedef types for each config?
|
||||
linedeftypes
|
||||
{
|
||||
0 = " Normal";
|
||||
0 = " None";
|
||||
|
||||
20
|
||||
{
|
||||
|
|
|
@ -13,6 +13,8 @@ formatinterface = "HexenMapSetIO";
|
|||
|
||||
// Special linedefs
|
||||
soundlinedefflags = 64; // See linedefflags
|
||||
singlesidedflags = 1; // See linedefflags
|
||||
doublesidedflags = 4; // See linedefflags
|
||||
|
||||
// No generalized types
|
||||
generalizedlinedefs = false;
|
||||
|
@ -381,7 +383,7 @@ linedefactivations
|
|||
// but hey, are you willing to reformat the linedef types for each config?
|
||||
linedeftypes
|
||||
{
|
||||
0 = " Normal";
|
||||
0 = " None";
|
||||
|
||||
20
|
||||
{
|
||||
|
|
|
@ -13,6 +13,8 @@ formatinterface = "HexenMapSetIO";
|
|||
|
||||
// Special linedefs
|
||||
soundlinedefflags = 64; // See linedefflags
|
||||
singlesidedflags = 1; // See linedefflags
|
||||
doublesidedflags = 4; // See linedefflags
|
||||
|
||||
// No generalized types
|
||||
generalizedlinedefs = false;
|
||||
|
@ -542,7 +544,7 @@ linedefactivations
|
|||
// but hey, are you willing to reformat the linedef types for each config?
|
||||
linedeftypes
|
||||
{
|
||||
0 = " Normal";
|
||||
0 = " None";
|
||||
|
||||
20
|
||||
{
|
||||
|
|
|
@ -13,6 +13,8 @@ formatinterface = "DoomMapSetIO";
|
|||
|
||||
// Special linedefs
|
||||
soundlinedefflags = 64; // See linedefflags
|
||||
singlesidedflags = 1; // See linedefflags
|
||||
doublesidedflags = 4; // See linedefflags
|
||||
|
||||
// No generalized types
|
||||
generalizedlinedefs = false;
|
||||
|
@ -333,7 +335,7 @@ linedefactivations
|
|||
// but hey, are you willing to reformat the linedef types for each config?
|
||||
linedeftypes
|
||||
{
|
||||
0 = " Normal";
|
||||
0 = " None";
|
||||
1 = "DR Door Open Wait Close (also monsters)";
|
||||
2 = "W1 Door Open Stay";
|
||||
3 = "W1 Door Close Stay";
|
||||
|
|
BIN
Resources/Icons/Folder.png
Normal file
BIN
Resources/Icons/Folder.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 394 B |
BIN
Resources/Icons/treeview.png
Normal file
BIN
Resources/Icons/treeview.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 231 B |
|
@ -45,7 +45,11 @@
|
|||
-->
|
||||
<ItemGroup>
|
||||
<Compile Include="Config\GameConfiguration.cs" />
|
||||
<Compile Include="Config\INumberedTitle.cs" />
|
||||
<Compile Include="Config\LinedefActionCategory.cs" />
|
||||
<Compile Include="Config\LinedefActionInfo.cs" />
|
||||
<Compile Include="Config\ProgramConfiguration.cs" />
|
||||
<Compile Include="Config\TagType.cs" />
|
||||
<Compile Include="Config\ThingCategory.cs" />
|
||||
<Compile Include="Config\ThingTypeInfo.cs" />
|
||||
<Compile Include="Controls\ActionAttribute.cs" />
|
||||
|
@ -96,6 +100,18 @@
|
|||
<Compile Include="Interface\AboutForm.Designer.cs">
|
||||
<DependentUpon>AboutForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Interface\ActionSelectorControl.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Interface\ActionSelectorControl.Designer.cs">
|
||||
<DependentUpon>ActionSelectorControl.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Interface\CheckboxArrayControl.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Interface\CheckboxArrayControl.Designer.cs">
|
||||
<DependentUpon>CheckboxArrayControl.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Interface\ColorControl.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
|
@ -130,6 +146,12 @@
|
|||
<DependentUpon>ImageBrowser.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Interface\ImageBrowserItem.cs" />
|
||||
<Compile Include="Interface\LinedefEditForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Interface\LinedefEditForm.Designer.cs">
|
||||
<DependentUpon>LinedefEditForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Interface\LinedefInfoPanel.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
|
@ -252,8 +274,10 @@
|
|||
<Reference Include="Sharpzip, Version=0.85.2.329, Culture=neutral, processorArchitecture=MSIL" />
|
||||
<Reference Include="SlimDX, Version=1.0.2851.40166, Culture=neutral, processorArchitecture=x86" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Interface\AboutForm.resx">
|
||||
|
@ -284,6 +308,8 @@
|
|||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Resources\Builder.ico" />
|
||||
<None Include="Resources\treeview.png" />
|
||||
<None Include="Resources\Folder.png" />
|
||||
<None Include="Resources\mergegeometry2.png" />
|
||||
<None Include="Resources\mergegeometry.png" />
|
||||
<None Include="Resources\Grid4.png" />
|
||||
|
@ -310,6 +336,14 @@
|
|||
<None Include="Resources\Splash2small.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Interface\ActionSelectorControl.resx">
|
||||
<SubType>Designer</SubType>
|
||||
<DependentUpon>ActionSelectorControl.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Interface\CheckboxArrayControl.resx">
|
||||
<SubType>Designer</SubType>
|
||||
<DependentUpon>CheckboxArrayControl.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Interface\ColorControl.resx">
|
||||
<SubType>Designer</SubType>
|
||||
<DependentUpon>ColorControl.cs</DependentUpon>
|
||||
|
@ -334,6 +368,10 @@
|
|||
<SubType>Designer</SubType>
|
||||
<DependentUpon>ImageBrowser.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Interface\LinedefEditForm.resx">
|
||||
<SubType>Designer</SubType>
|
||||
<DependentUpon>LinedefEditForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Interface\LinedefInfoPanel.resx">
|
||||
<SubType>Designer</SubType>
|
||||
<DependentUpon>LinedefInfoPanel.cs</DependentUpon>
|
||||
|
|
|
@ -47,6 +47,8 @@ namespace CodeImp.DoomBuilder.Config
|
|||
private float defaultflatscale;
|
||||
private string formatinterface;
|
||||
private int soundlinedefflags;
|
||||
private int singlesidedflags;
|
||||
private int doublesidedflags;
|
||||
private bool mixtexturesflats;
|
||||
|
||||
// Map lumps
|
||||
|
@ -60,6 +62,12 @@ namespace CodeImp.DoomBuilder.Config
|
|||
private List<ThingCategory> thingcategories;
|
||||
private Dictionary<int, ThingTypeInfo> things;
|
||||
|
||||
// Linedefs
|
||||
private Dictionary<int, string> linedefflags;
|
||||
private Dictionary<int, LinedefActionInfo> linedefactions;
|
||||
private List<LinedefActionInfo> sortedlinedefactions;
|
||||
private List<LinedefActionCategory> actioncategories;
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Properties
|
||||
|
@ -69,6 +77,8 @@ namespace CodeImp.DoomBuilder.Config
|
|||
public float DefaultFlatScale { get { return defaultflatscale; } }
|
||||
public string FormatInterface { get { return formatinterface; } }
|
||||
public int SoundLinedefFlags { get { return soundlinedefflags; } }
|
||||
public int SingleSidedFlags { get { return singlesidedflags; } }
|
||||
public int DoubleSidedFlags { get { return doublesidedflags; } }
|
||||
public bool MixTexturesFlats { get { return mixtexturesflats; } }
|
||||
|
||||
// Map lumps
|
||||
|
@ -82,6 +92,12 @@ namespace CodeImp.DoomBuilder.Config
|
|||
public List<ThingCategory> ThingCategories { get { return thingcategories; } }
|
||||
public ICollection<ThingTypeInfo> Things { get { return things.Values; } }
|
||||
|
||||
// Linedefs
|
||||
public IDictionary<int, string> LinedefFlags { get { return linedefflags; } }
|
||||
public IDictionary<int, LinedefActionInfo> LinedefActions { get { return linedefactions; } }
|
||||
public List<LinedefActionInfo> SortedLinedefActions { get { return sortedlinedefactions; } }
|
||||
public List<LinedefActionCategory> ActionCategories { get { return actioncategories; } }
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Constructor / Disposer
|
||||
|
@ -89,19 +105,22 @@ namespace CodeImp.DoomBuilder.Config
|
|||
// Constructor
|
||||
public GameConfiguration(Configuration cfg)
|
||||
{
|
||||
IDictionary dic;
|
||||
ThingCategory thingcat;
|
||||
|
||||
// Initialize
|
||||
this.cfg = cfg;
|
||||
this.thingcategories = new List<ThingCategory>();
|
||||
this.things = new Dictionary<int, ThingTypeInfo>();
|
||||
this.linedefflags = new Dictionary<int, string>();
|
||||
this.linedefactions = new Dictionary<int, LinedefActionInfo>();
|
||||
this.actioncategories = new List<LinedefActionCategory>();
|
||||
this.sortedlinedefactions = new List<LinedefActionInfo>();
|
||||
|
||||
// Read general settings
|
||||
defaulttexturescale = cfg.ReadSetting("defaulttexturescale", 1f);
|
||||
defaultflatscale = cfg.ReadSetting("defaultflatscale", 1f);
|
||||
formatinterface = cfg.ReadSetting("formatinterface", "");
|
||||
soundlinedefflags = cfg.ReadSetting("soundlinedefflags", 0);
|
||||
singlesidedflags = cfg.ReadSetting("singlesidedflags", 0);
|
||||
doublesidedflags = cfg.ReadSetting("doublesidedflags", 0);
|
||||
mixtexturesflats = cfg.ReadSetting("mixtexturesflats", false);
|
||||
|
||||
// Get map lumps
|
||||
|
@ -111,6 +130,27 @@ namespace CodeImp.DoomBuilder.Config
|
|||
textureranges = cfg.ReadSetting("textures", new Hashtable());
|
||||
flatranges = cfg.ReadSetting("flats", new Hashtable());
|
||||
|
||||
// Things
|
||||
LoadThingCategories();
|
||||
|
||||
// Linedefs
|
||||
LoadLinedefFlags();
|
||||
LoadLinedefActions();
|
||||
|
||||
// We have no destructor
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Loading
|
||||
|
||||
// Things and thing categories
|
||||
private void LoadThingCategories()
|
||||
{
|
||||
IDictionary dic;
|
||||
ThingCategory thingcat;
|
||||
|
||||
// Get thing categories
|
||||
dic = cfg.ReadSetting("thingtypes", new Hashtable());
|
||||
foreach(DictionaryEntry de in dic)
|
||||
|
@ -121,11 +161,100 @@ namespace CodeImp.DoomBuilder.Config
|
|||
// Add all thing in category to the big list
|
||||
foreach(ThingTypeInfo t in thingcat.Things) things.Add(t.Index, t);
|
||||
}
|
||||
}
|
||||
|
||||
// Linedef flags
|
||||
private void LoadLinedefFlags()
|
||||
{
|
||||
IDictionary dic;
|
||||
int bitflagscheck = 0;
|
||||
int bitvalue;
|
||||
|
||||
// Get linedef flags
|
||||
dic = cfg.ReadSetting("linedefflags", new Hashtable());
|
||||
foreach(DictionaryEntry de in dic)
|
||||
{
|
||||
// Try paring the bit value
|
||||
if(int.TryParse(de.Key.ToString(),
|
||||
NumberStyles.AllowLeadingWhite | NumberStyles.AllowTrailingWhite,
|
||||
CultureInfo.InvariantCulture, out bitvalue))
|
||||
{
|
||||
// Check for conflict and add to list
|
||||
if((bitvalue & bitflagscheck) == 0)
|
||||
linedefflags.Add(bitvalue, de.Value.ToString());
|
||||
else
|
||||
General.WriteLogLine("WARNING: Structure 'linedefflags' contains conflicting bit flag keys. Make sure all keys are unique integers and powers of 2!");
|
||||
|
||||
// We have no destructor
|
||||
GC.SuppressFinalize(this);
|
||||
// Update bit flags checking value
|
||||
bitflagscheck |= bitvalue;
|
||||
}
|
||||
else
|
||||
{
|
||||
General.WriteLogLine("WARNING: Structure 'linedefflags' contains invalid keys!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Linedef actions and action categories
|
||||
private void LoadLinedefActions()
|
||||
{
|
||||
Dictionary<string, LinedefActionCategory> cats = new Dictionary<string, LinedefActionCategory>();
|
||||
IDictionary dic;
|
||||
LinedefActionInfo ai;
|
||||
LinedefActionCategory ac;
|
||||
int actionnumber;
|
||||
|
||||
// Get linedef actions
|
||||
dic = cfg.ReadSetting("linedeftypes", new Hashtable());
|
||||
foreach(DictionaryEntry de in dic)
|
||||
{
|
||||
// Try paring the action number
|
||||
if(int.TryParse(de.Key.ToString(),
|
||||
NumberStyles.AllowLeadingWhite | NumberStyles.AllowTrailingWhite,
|
||||
CultureInfo.InvariantCulture, out actionnumber))
|
||||
{
|
||||
// Expanded type?
|
||||
if(de.Value is IDictionary)
|
||||
{
|
||||
// Let the class constructure read it
|
||||
ai = new LinedefActionInfo(actionnumber, cfg);
|
||||
}
|
||||
else
|
||||
{
|
||||
// We have all the information in one string (title/prefix only)
|
||||
ai = new LinedefActionInfo(actionnumber, de.Value.ToString());
|
||||
}
|
||||
|
||||
// Make or get a category
|
||||
if(cats.ContainsKey(ai.Category))
|
||||
ac = cats[ai.Category];
|
||||
else
|
||||
{
|
||||
ac = new LinedefActionCategory(ai.Category);
|
||||
cats.Add(ai.Category, ac);
|
||||
}
|
||||
|
||||
// Add action to category and sorted list
|
||||
sortedlinedefactions.Add(ai);
|
||||
ac.Add(ai);
|
||||
}
|
||||
else
|
||||
{
|
||||
General.WriteLogLine("WARNING: Structure 'linedeftypes' contains invalid keys!");
|
||||
}
|
||||
}
|
||||
|
||||
// Sort the actions list
|
||||
sortedlinedefactions.Sort();
|
||||
|
||||
// Copy categories to final list
|
||||
actioncategories.Clear();
|
||||
actioncategories.AddRange(cats.Values);
|
||||
|
||||
// Sort the categories list
|
||||
actioncategories.Sort();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Methods
|
||||
|
|
41
Source/Config/INumberedTitle.cs
Normal file
41
Source/Config/INumberedTitle.cs
Normal file
|
@ -0,0 +1,41 @@
|
|||
|
||||
#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 CodeImp.DoomBuilder.IO;
|
||||
using CodeImp.DoomBuilder.Data;
|
||||
using System.IO;
|
||||
using System.Diagnostics;
|
||||
using System.Windows.Forms;
|
||||
using CodeImp.DoomBuilder.Rendering;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace CodeImp.DoomBuilder.Config
|
||||
{
|
||||
public interface INumberedTitle
|
||||
{
|
||||
// Properties
|
||||
int Index { get; }
|
||||
string Title { get; }
|
||||
}
|
||||
}
|
108
Source/Config/LinedefActionCategory.cs
Normal file
108
Source/Config/LinedefActionCategory.cs
Normal file
|
@ -0,0 +1,108 @@
|
|||
|
||||
#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 CodeImp.DoomBuilder.IO;
|
||||
using CodeImp.DoomBuilder.Data;
|
||||
using System.IO;
|
||||
using System.Diagnostics;
|
||||
using System.Windows.Forms;
|
||||
using CodeImp.DoomBuilder.Rendering;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace CodeImp.DoomBuilder.Config
|
||||
{
|
||||
public class LinedefActionCategory : IDisposable, IComparable<LinedefActionCategory>
|
||||
{
|
||||
#region ================== Constants
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Variables
|
||||
|
||||
// Category properties
|
||||
private string name;
|
||||
|
||||
// Actions
|
||||
private List<LinedefActionInfo> actions;
|
||||
|
||||
// Disposing
|
||||
private bool isdisposed = false;
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Properties
|
||||
|
||||
public string Name { get { return name; } }
|
||||
public List<LinedefActionInfo> Actions { get { return actions; } }
|
||||
public bool IsDisposed { get { return isdisposed; } }
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Constructor / Disposer
|
||||
|
||||
// Constructor
|
||||
public LinedefActionCategory(string name)
|
||||
{
|
||||
// Initialize
|
||||
this.name = name;
|
||||
this.actions = new List<LinedefActionInfo>();
|
||||
|
||||
// We have no destructor
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
// Diposer
|
||||
public void Dispose()
|
||||
{
|
||||
// Not already disposed?
|
||||
if(!isdisposed)
|
||||
{
|
||||
// Clean up
|
||||
actions = null;
|
||||
|
||||
// Done
|
||||
isdisposed = true;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Methods
|
||||
|
||||
// This adds an action to this category
|
||||
public void Add(LinedefActionInfo a)
|
||||
{
|
||||
// Make it so.
|
||||
actions.Add(a);
|
||||
}
|
||||
|
||||
// This compares against another action category
|
||||
public int CompareTo(LinedefActionCategory other)
|
||||
{
|
||||
return string.Compare(this.name, other.name);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
158
Source/Config/LinedefActionInfo.cs
Normal file
158
Source/Config/LinedefActionInfo.cs
Normal file
|
@ -0,0 +1,158 @@
|
|||
|
||||
#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 CodeImp.DoomBuilder.IO;
|
||||
using CodeImp.DoomBuilder.Data;
|
||||
using System.IO;
|
||||
using System.Diagnostics;
|
||||
using System.Windows.Forms;
|
||||
using CodeImp.DoomBuilder.Map;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace CodeImp.DoomBuilder.Config
|
||||
{
|
||||
public class LinedefActionInfo : INumberedTitle, IComparable<LinedefActionInfo>
|
||||
{
|
||||
#region ================== Constants
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Variables
|
||||
|
||||
// Properties
|
||||
private int index;
|
||||
private string prefix;
|
||||
private string category;
|
||||
private string name;
|
||||
private string title;
|
||||
private string[] argtitle;
|
||||
private TagType[] argtagtype;
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Properties
|
||||
|
||||
public int Index { get { return index; } }
|
||||
public string Prefix { get { return prefix; } }
|
||||
public string Category { get { return category; } }
|
||||
public string Name { get { return name; } }
|
||||
public string Title { get { return title; } }
|
||||
public string[] ArgTitle { get { return argtitle; } }
|
||||
public TagType[] ArgTagType { get { return argtagtype; } }
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Constructor / Disposer
|
||||
|
||||
// Constructor
|
||||
public LinedefActionInfo(int index, string desc)
|
||||
{
|
||||
string[] parts;
|
||||
int p = 0;
|
||||
|
||||
// Initialize
|
||||
this.index = index;
|
||||
this.argtitle = new string[Linedef.NUM_ARGS];
|
||||
this.argtagtype = new TagType[Linedef.NUM_ARGS];
|
||||
|
||||
// Find the parts by splitting on spaces
|
||||
parts = desc.Split(new char[] {' '}, 3);
|
||||
if(parts.Length >= 3) this.prefix = parts[p++]; else this.prefix = "";
|
||||
if(parts.Length >= 2) this.category = parts[p++]; else this.category = "Unknown";
|
||||
if(parts.Length >= 1) this.name = this.category + " " + parts[p++]; else this.name = this.category;
|
||||
this.name = this.name.Trim();
|
||||
this.title = this.prefix + " " + this.name;
|
||||
this.title = this.title.Trim();
|
||||
|
||||
// No args/marks
|
||||
for(int i = 0; i < Linedef.NUM_ARGS; i++)
|
||||
{
|
||||
this.argtitle[i] = "";
|
||||
this.argtagtype[i] = TagType.None;
|
||||
}
|
||||
|
||||
// We have no destructor
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
// Constructor
|
||||
public LinedefActionInfo(int index, Configuration cfg)
|
||||
{
|
||||
string desc;
|
||||
string[] parts;
|
||||
int p = 0;
|
||||
int argindex;
|
||||
|
||||
// Initialize
|
||||
this.index = index;
|
||||
this.argtitle = new string[Linedef.NUM_ARGS];
|
||||
this.argtagtype = new TagType[Linedef.NUM_ARGS];
|
||||
|
||||
// Read description
|
||||
desc = cfg.ReadSetting("linedeftypes." + index.ToString(CultureInfo.InvariantCulture) + ".title", " Unknown");
|
||||
|
||||
// Find the parts by splitting on spaces
|
||||
parts = desc.Split(new char[] { ' ' }, 3);
|
||||
if(parts.Length >= 3) this.prefix = parts[p++]; else this.prefix = "";
|
||||
if(parts.Length >= 2) this.category = parts[p++]; else this.category = "Unknown";
|
||||
if(parts.Length >= 1) this.name = this.category + " " + parts[p++]; else this.name = this.category;
|
||||
this.name = this.name.Trim();
|
||||
this.title = this.prefix + " " + this.name;
|
||||
this.title = this.title.Trim();
|
||||
|
||||
// Read the args and marks
|
||||
for(int i = 0; i < Linedef.NUM_ARGS; i++)
|
||||
{
|
||||
argindex = i + 1;
|
||||
this.argtitle[i] = cfg.ReadSetting("linedeftypes." + index.ToString(CultureInfo.InvariantCulture) +
|
||||
".arg" + argindex.ToString(CultureInfo.InvariantCulture), "");
|
||||
this.argtagtype[i] = (TagType)cfg.ReadSetting("linedeftypes." + index.ToString(CultureInfo.InvariantCulture) +
|
||||
".mark" + argindex.ToString(CultureInfo.InvariantCulture), (int)TagType.None);
|
||||
}
|
||||
|
||||
// We have no destructor
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Methods
|
||||
|
||||
// This presents the item as string
|
||||
public override string ToString()
|
||||
{
|
||||
return index + ": " + prefix + " " + title;
|
||||
}
|
||||
|
||||
// This compares against another action info
|
||||
public int CompareTo(LinedefActionInfo other)
|
||||
{
|
||||
if(this.index < other.index) return -1;
|
||||
else if(this.index > other.index) return 1;
|
||||
else return 0;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
41
Source/Config/TagType.cs
Normal file
41
Source/Config/TagType.cs
Normal file
|
@ -0,0 +1,41 @@
|
|||
|
||||
#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 CodeImp.DoomBuilder.IO;
|
||||
using CodeImp.DoomBuilder.Data;
|
||||
using System.IO;
|
||||
using System.Diagnostics;
|
||||
using System.Windows.Forms;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace CodeImp.DoomBuilder.Config
|
||||
{
|
||||
public enum TagType
|
||||
{
|
||||
None = 0,
|
||||
Sector = 1,
|
||||
Thing = 2,
|
||||
Linedef = 3 // Implement this?
|
||||
}
|
||||
}
|
|
@ -343,8 +343,8 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
if(e.Button == mousedragging)
|
||||
{
|
||||
// No longer dragging
|
||||
mousedragging = MouseButtons.None;
|
||||
DragStop(e);
|
||||
mousedragging = MouseButtons.None;
|
||||
}
|
||||
|
||||
// Let the base class know
|
||||
|
|
|
@ -47,6 +47,9 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
|
||||
#region ================== Variables
|
||||
|
||||
// Mode to return to
|
||||
private EditMode basemode;
|
||||
|
||||
// Mouse position on map where dragging started
|
||||
private Vector2D dragstartmappos;
|
||||
|
||||
|
@ -79,12 +82,13 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
#region ================== Constructor / Disposer
|
||||
|
||||
// Constructor to start dragging immediately
|
||||
public DragVerticesMode(Vertex dragitem, Vector2D dragstartmappos)
|
||||
public DragVerticesMode(EditMode basemode, Vertex dragitem, Vector2D dragstartmappos)
|
||||
{
|
||||
// Initialize
|
||||
this.dragitem = dragitem;
|
||||
this.dragstartmappos = dragstartmappos;
|
||||
|
||||
this.basemode = basemode;
|
||||
|
||||
Cursor.Current = Cursors.AppStarting;
|
||||
|
||||
// Make list of selected vertices
|
||||
|
@ -208,7 +212,7 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
base.Cancel();
|
||||
|
||||
// Return to vertices mode
|
||||
General.Map.ChangeMode(new VerticesMode());
|
||||
General.Map.ChangeMode(basemode);
|
||||
}
|
||||
|
||||
// Mode engages
|
||||
|
@ -223,12 +227,6 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
// Disenagaging
|
||||
public override void Disengage()
|
||||
{
|
||||
ICollection<Linedef> movinglines;
|
||||
ICollection<Linedef> fixedlines;
|
||||
Rectangle editarea;
|
||||
int stitches = 0;
|
||||
int stitchundo;
|
||||
|
||||
base.Disengage();
|
||||
Cursor.Current = Cursors.AppStarting;
|
||||
|
||||
|
@ -244,47 +242,8 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
// Move selected geometry to final position
|
||||
MoveGeometryRelative(mousemappos - dragstartmappos, snaptogrid, snaptonearest);
|
||||
|
||||
// ===== BEGIN GEOMETRY STITCHING
|
||||
if(General.MainWindow.AutoMerge)
|
||||
{
|
||||
// Make undo for the stitching
|
||||
stitchundo = General.Map.UndoRedo.CreateUndo("stitch geometry", UndoGroup.None, 0, false);
|
||||
|
||||
// Find lines that moved during the drag
|
||||
movinglines = General.Map.Map.LinedefsFromSelectedVertices(false, true, true);
|
||||
|
||||
// Find all non-moving lines
|
||||
fixedlines = General.Map.Map.LinedefsFromSelectedVertices(true, false, false);
|
||||
|
||||
// Determine area in which we are editing
|
||||
editarea = MapSet.AreaFromLines(movinglines);
|
||||
editarea.Inflate((int)Math.Ceiling(General.Settings.StitchDistance),
|
||||
(int)Math.Ceiling(General.Settings.StitchDistance));
|
||||
|
||||
// Join nearby vertices
|
||||
stitches += MapSet.JoinVertices(unselectedverts, selectedverts, true, General.Settings.StitchDistance);
|
||||
|
||||
// Update cached values
|
||||
General.Map.Map.Update();
|
||||
|
||||
// Split moving lines with unselected vertices
|
||||
unselectedverts = MapSet.FilterArea(unselectedverts, ref editarea);
|
||||
stitches += MapSet.SplitLinesByVertices(movinglines, unselectedverts, General.Settings.StitchDistance, movinglines);
|
||||
|
||||
// Split non-moving lines with selected vertices
|
||||
fixedlines = MapSet.FilterArea(fixedlines, ref editarea);
|
||||
stitches += MapSet.SplitLinesByVertices(fixedlines, selectedverts, General.Settings.StitchDistance, movinglines);
|
||||
|
||||
// Remove looped linedefs
|
||||
stitches += MapSet.RemoveLoopedLinedefs(movinglines);
|
||||
|
||||
// Join overlapping lines
|
||||
stitches += MapSet.JoinOverlappingLines(movinglines);
|
||||
|
||||
// No stitching done? then withdraw undo
|
||||
if(stitches == 0) General.Map.UndoRedo.WithdrawUndo(stitchundo);
|
||||
}
|
||||
// ===== END GEOMETRY STITCHING
|
||||
// Stitch geometry
|
||||
General.Map.Map.StitchGeometry(selectedverts, unselectedverts);
|
||||
|
||||
// If only a single vertex was selected, deselect it now
|
||||
if(selectedverts.Count == 1) General.Map.Map.ClearSelectedVertices();
|
||||
|
@ -358,7 +317,7 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
if(e.Button == EditMode.EDIT_BUTTON)
|
||||
{
|
||||
// Just return to vertices mode, geometry will be merged on disengage.
|
||||
General.Map.ChangeMode(new VerticesMode());
|
||||
General.Map.ChangeMode(basemode);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -100,6 +100,22 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
{
|
||||
base.Disengage();
|
||||
|
||||
// Check which mode we are switching to
|
||||
if(General.Map.NewMode is VerticesMode)
|
||||
{
|
||||
// Convert selection to vertices
|
||||
|
||||
// Clear selected linedefs
|
||||
General.Map.Map.ClearSelectedLinedefs();
|
||||
}
|
||||
else if(General.Map.NewMode is SectorsMode)
|
||||
{
|
||||
// Convert selection to sectors
|
||||
|
||||
// Clear selected linedefs
|
||||
General.Map.Map.ClearSelectedLinedefs();
|
||||
}
|
||||
|
||||
// Hide highlight info
|
||||
General.MainWindow.HideInfo();
|
||||
|
||||
|
@ -121,7 +137,7 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
renderer.RenderLinedefSet(General.Map.Map.Linedefs);
|
||||
|
||||
// Render highlighted item
|
||||
if(highlighted != null)
|
||||
if((highlighted != null) && !highlighted.IsDisposed)
|
||||
renderer.RenderLinedef(highlighted, General.Colors.Highlight);
|
||||
|
||||
// Render vertices
|
||||
|
@ -139,7 +155,7 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
if(renderer.Start(false, false))
|
||||
{
|
||||
// Undraw previous highlight
|
||||
if(highlighted != null)
|
||||
if((highlighted != null) && !highlighted.IsDisposed)
|
||||
{
|
||||
renderer.RenderLinedef(highlighted, renderer.DetermineLinedefColor(highlighted));
|
||||
renderer.RenderVertex(highlighted.Start, renderer.DetermineVertexColor(highlighted.Start));
|
||||
|
@ -150,7 +166,7 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
highlighted = l;
|
||||
|
||||
// Render highlighted item
|
||||
if(highlighted != null)
|
||||
if((highlighted != null) && !highlighted.IsDisposed)
|
||||
{
|
||||
renderer.RenderLinedef(highlighted, General.Colors.Highlight);
|
||||
renderer.RenderVertex(highlighted.Start, renderer.DetermineVertexColor(highlighted.Start));
|
||||
|
@ -162,8 +178,10 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
}
|
||||
|
||||
// Show highlight info
|
||||
if(highlighted != null) General.MainWindow.ShowLinedefInfo(highlighted);
|
||||
else General.MainWindow.HideInfo();
|
||||
if((highlighted != null) && !highlighted.IsDisposed)
|
||||
General.MainWindow.ShowLinedefInfo(highlighted);
|
||||
else
|
||||
General.MainWindow.HideInfo();
|
||||
}
|
||||
|
||||
// Mouse moves
|
||||
|
@ -187,6 +205,102 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
Highlight(null);
|
||||
}
|
||||
|
||||
// Mouse button pressed
|
||||
public override void MouseDown(MouseEventArgs e)
|
||||
{
|
||||
base.MouseDown(e);
|
||||
|
||||
// Select button?
|
||||
if(e.Button == EditMode.SELECT_BUTTON)
|
||||
{
|
||||
// Item highlighted?
|
||||
if((highlighted != null) && !highlighted.IsDisposed)
|
||||
{
|
||||
// Flip selection
|
||||
highlighted.Selected = !highlighted.Selected;
|
||||
|
||||
// Update display
|
||||
if(renderer.Start(false, false))
|
||||
{
|
||||
// Redraw highlight to show selection
|
||||
renderer.RenderLinedef(highlighted, renderer.DetermineLinedefColor(highlighted));
|
||||
renderer.RenderVertex(highlighted.Start, renderer.DetermineVertexColor(highlighted.Start));
|
||||
renderer.RenderVertex(highlighted.End, renderer.DetermineVertexColor(highlighted.End));
|
||||
renderer.Finish();
|
||||
}
|
||||
}
|
||||
}
|
||||
// Edit button?
|
||||
else if(e.Button == EditMode.EDIT_BUTTON)
|
||||
{
|
||||
// Item highlighted?
|
||||
if((highlighted != null) && !highlighted.IsDisposed)
|
||||
{
|
||||
// Highlighted item not selected?
|
||||
if(!highlighted.Selected)
|
||||
{
|
||||
// Make this the only selection
|
||||
General.Map.Map.ClearSelectedLinedefs();
|
||||
highlighted.Selected = true;
|
||||
General.MainWindow.RedrawDisplay();
|
||||
}
|
||||
|
||||
// Update display
|
||||
if(renderer.Start(false, false))
|
||||
{
|
||||
// Redraw highlight to show selection
|
||||
renderer.RenderLinedef(highlighted, renderer.DetermineLinedefColor(highlighted));
|
||||
renderer.RenderVertex(highlighted.Start, renderer.DetermineVertexColor(highlighted.Start));
|
||||
renderer.RenderVertex(highlighted.End, renderer.DetermineVertexColor(highlighted.End));
|
||||
renderer.Finish();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Mouse released
|
||||
public override void MouseUp(MouseEventArgs e)
|
||||
{
|
||||
ICollection<Linedef> selected;
|
||||
|
||||
base.MouseUp(e);
|
||||
|
||||
// Item highlighted?
|
||||
if((highlighted != null) && !highlighted.IsDisposed)
|
||||
{
|
||||
// Update display
|
||||
if(renderer.Start(false, false))
|
||||
{
|
||||
// Render highlighted item
|
||||
renderer.RenderLinedef(highlighted, General.Colors.Highlight);
|
||||
renderer.RenderVertex(highlighted.Start, renderer.DetermineVertexColor(highlighted.Start));
|
||||
renderer.RenderVertex(highlighted.End, renderer.DetermineVertexColor(highlighted.End));
|
||||
renderer.Finish();
|
||||
}
|
||||
|
||||
// Edit button?
|
||||
if(e.Button == EditMode.EDIT_BUTTON)
|
||||
{
|
||||
// Anything selected?
|
||||
selected = General.Map.Map.GetLinedefsSelection(true);
|
||||
if(selected.Count > 0)
|
||||
{
|
||||
// Show line edit dialog
|
||||
LinedefEditForm f = new LinedefEditForm();
|
||||
f.Setup(selected);
|
||||
f.ShowDialog(General.MainWindow);
|
||||
f.Dispose();
|
||||
|
||||
// When a single line was selected, deselect it now
|
||||
if(selected.Count == 1) General.Map.Map.ClearSelectedLinedefs();
|
||||
|
||||
// Update entire display
|
||||
General.MainWindow.RedrawDisplay();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
@ -98,6 +98,22 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
{
|
||||
base.Disengage();
|
||||
|
||||
// Check which mode we are switching to
|
||||
if(General.Map.NewMode is VerticesMode)
|
||||
{
|
||||
// Convert selection to vertices
|
||||
|
||||
// Clear selected sectors
|
||||
General.Map.Map.ClearSelectedSectors();
|
||||
}
|
||||
else if(General.Map.NewMode is LinedefsMode)
|
||||
{
|
||||
// Convert selection to linedefs
|
||||
|
||||
// Clear selected sectors
|
||||
General.Map.Map.ClearSelectedSectors();
|
||||
}
|
||||
|
||||
// Hide highlight info
|
||||
General.MainWindow.HideInfo();
|
||||
|
||||
|
@ -120,7 +136,7 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
renderer.RenderVerticesSet(General.Map.Map.Vertices);
|
||||
|
||||
// Render highlighted item
|
||||
if(highlighted != null)
|
||||
if((highlighted != null) && !highlighted.IsDisposed)
|
||||
renderer.RenderSector(highlighted, General.Colors.Highlight);
|
||||
|
||||
// Done
|
||||
|
@ -135,7 +151,7 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
if(renderer.Start(false, false))
|
||||
{
|
||||
// Undraw previous highlight
|
||||
if(highlighted != null)
|
||||
if((highlighted != null) && !highlighted.IsDisposed)
|
||||
renderer.RenderSector(highlighted);
|
||||
|
||||
/*
|
||||
|
@ -149,7 +165,7 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
highlighted = s;
|
||||
|
||||
// Render highlighted item
|
||||
if(highlighted != null)
|
||||
if((highlighted != null) && !highlighted.IsDisposed)
|
||||
renderer.RenderSector(highlighted, General.Colors.Highlight);
|
||||
|
||||
/*
|
||||
|
@ -164,8 +180,10 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
}
|
||||
|
||||
// Show highlight info
|
||||
if(highlighted != null) General.MainWindow.ShowSectorInfo(highlighted);
|
||||
else General.MainWindow.HideInfo();
|
||||
if((highlighted != null) && !highlighted.IsDisposed)
|
||||
General.MainWindow.ShowSectorInfo(highlighted);
|
||||
else
|
||||
General.MainWindow.HideInfo();
|
||||
}
|
||||
|
||||
// Mouse moves
|
||||
|
@ -217,6 +235,58 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
Highlight(null);
|
||||
}
|
||||
|
||||
// Mouse button pressed
|
||||
public override void MouseDown(MouseEventArgs e)
|
||||
{
|
||||
base.MouseDown(e);
|
||||
bool front, back;
|
||||
|
||||
// Which button is used?
|
||||
if(e.Button == EditMode.SELECT_BUTTON)
|
||||
{
|
||||
// Item highlighted?
|
||||
if((highlighted != null) && !highlighted.IsDisposed)
|
||||
{
|
||||
// Flip selection
|
||||
highlighted.Selected = !highlighted.Selected;
|
||||
|
||||
// Make update lines selection
|
||||
foreach(Sidedef sd in highlighted.Sidedefs)
|
||||
{
|
||||
if(sd.Line.Front != null) front = sd.Line.Front.Sector.Selected; else front = false;
|
||||
if(sd.Line.Back != null) back = sd.Line.Back.Sector.Selected; else back = false;
|
||||
sd.Line.Selected = front | back;
|
||||
}
|
||||
|
||||
// Update display
|
||||
if(renderer.Start(false, false))
|
||||
{
|
||||
// Redraw highlight to show selection
|
||||
renderer.RenderSector(highlighted);
|
||||
renderer.Finish();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Mouse released
|
||||
public override void MouseUp(MouseEventArgs e)
|
||||
{
|
||||
base.MouseUp(e);
|
||||
|
||||
// Item highlighted?
|
||||
if((highlighted != null) && !highlighted.IsDisposed)
|
||||
{
|
||||
// Update display
|
||||
if(renderer.Start(false, false))
|
||||
{
|
||||
// Render highlighted item
|
||||
renderer.RenderSector(highlighted, General.Colors.Highlight);
|
||||
renderer.Finish();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
@ -122,7 +122,7 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
renderer.RenderThingSet(General.Map.Map.Things);
|
||||
|
||||
// Render highlighted item
|
||||
if(highlighted != null)
|
||||
if((highlighted != null) && !highlighted.IsDisposed)
|
||||
renderer.RenderThing(highlighted, General.Colors.Highlight);
|
||||
|
||||
// Done
|
||||
|
@ -137,14 +137,14 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
if(renderer.Start(false, false))
|
||||
{
|
||||
// Undraw previous highlight
|
||||
if(highlighted != null)
|
||||
if((highlighted != null) && !highlighted.IsDisposed)
|
||||
renderer.RenderThing(highlighted, renderer.DetermineThingColor(highlighted));
|
||||
|
||||
// Set new highlight
|
||||
highlighted = t;
|
||||
|
||||
// Render highlighted item
|
||||
if(highlighted != null)
|
||||
if((highlighted != null) && !highlighted.IsDisposed)
|
||||
renderer.RenderThing(highlighted, General.Colors.Highlight);
|
||||
|
||||
// Done
|
||||
|
@ -152,8 +152,10 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
}
|
||||
|
||||
// Show highlight info
|
||||
if(highlighted != null) General.MainWindow.ShowThingInfo(highlighted);
|
||||
else General.MainWindow.HideInfo();
|
||||
if((highlighted != null) && !highlighted.IsDisposed)
|
||||
General.MainWindow.ShowThingInfo(highlighted);
|
||||
else
|
||||
General.MainWindow.HideInfo();
|
||||
}
|
||||
|
||||
// Mouse moves
|
||||
|
@ -177,6 +179,92 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
Highlight(null);
|
||||
}
|
||||
|
||||
// Mouse button pressed
|
||||
public override void MouseDown(MouseEventArgs e)
|
||||
{
|
||||
base.MouseDown(e);
|
||||
|
||||
// Select button?
|
||||
if(e.Button == EditMode.SELECT_BUTTON)
|
||||
{
|
||||
// Item highlighted?
|
||||
if((highlighted != null) && !highlighted.IsDisposed)
|
||||
{
|
||||
// Flip selection
|
||||
highlighted.Selected = !highlighted.Selected;
|
||||
|
||||
// Update display
|
||||
if(renderer.Start(false, false))
|
||||
{
|
||||
// Redraw highlight to show selection
|
||||
renderer.RenderThing(highlighted, renderer.DetermineThingColor(highlighted));
|
||||
renderer.Finish();
|
||||
}
|
||||
}
|
||||
}
|
||||
// Edit button?
|
||||
else if(e.Button == EditMode.EDIT_BUTTON)
|
||||
{
|
||||
// Item highlighted?
|
||||
if((highlighted != null) && !highlighted.IsDisposed)
|
||||
{
|
||||
// Highlighted item not selected?
|
||||
if(!highlighted.Selected)
|
||||
{
|
||||
// Make this the only selection
|
||||
General.Map.Map.ClearSelectedThings();
|
||||
highlighted.Selected = true;
|
||||
General.MainWindow.RedrawDisplay();
|
||||
}
|
||||
|
||||
// Update display
|
||||
if(renderer.Start(false, false))
|
||||
{
|
||||
// Redraw highlight to show selection
|
||||
renderer.RenderThing(highlighted, renderer.DetermineThingColor(highlighted));
|
||||
renderer.Finish();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Mouse released
|
||||
public override void MouseUp(MouseEventArgs e)
|
||||
{
|
||||
ICollection<Thing> selected;
|
||||
|
||||
base.MouseUp(e);
|
||||
|
||||
// Item highlighted?
|
||||
if((highlighted != null) && !highlighted.IsDisposed)
|
||||
{
|
||||
// Update display
|
||||
if(renderer.Start(false, false))
|
||||
{
|
||||
// Render highlighted item
|
||||
renderer.RenderThing(highlighted, General.Colors.Highlight);
|
||||
renderer.Finish();
|
||||
}
|
||||
|
||||
// Edit button?
|
||||
if(e.Button == EditMode.EDIT_BUTTON)
|
||||
{
|
||||
// Anything selected?
|
||||
selected = General.Map.Map.GetThingsSelection(true);
|
||||
if(selected.Count > 0)
|
||||
{
|
||||
// Show thing edit dialog
|
||||
|
||||
// When a single thing was selected, deselect it now
|
||||
if(selected.Count == 1) General.Map.Map.ClearSelectedThings();
|
||||
|
||||
// Update entire display
|
||||
General.MainWindow.RedrawDisplay();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
@ -100,6 +100,22 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
{
|
||||
base.Disengage();
|
||||
|
||||
// Check which mode we are switching to
|
||||
if(General.Map.NewMode is LinedefsMode)
|
||||
{
|
||||
// Convert selection to linedefs
|
||||
|
||||
// Clear selected vertices
|
||||
General.Map.Map.ClearSelectedVertices();
|
||||
}
|
||||
else if(General.Map.NewMode is SectorsMode)
|
||||
{
|
||||
// Convert selection to sectors
|
||||
|
||||
// Clear selected vertices
|
||||
General.Map.Map.ClearSelectedVertices();
|
||||
}
|
||||
|
||||
// Hide highlight info
|
||||
General.MainWindow.HideInfo();
|
||||
|
||||
|
@ -122,7 +138,7 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
renderer.RenderVerticesSet(General.Map.Map.Vertices);
|
||||
|
||||
// Render highlighted item
|
||||
if(highlighted != null)
|
||||
if((highlighted != null) && !highlighted.IsDisposed)
|
||||
renderer.RenderVertex(highlighted, ColorCollection.HIGHLIGHT);
|
||||
|
||||
// Done
|
||||
|
@ -137,14 +153,14 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
if(renderer.Start(false, false))
|
||||
{
|
||||
// Undraw previous highlight
|
||||
if(highlighted != null)
|
||||
if((highlighted != null) && !highlighted.IsDisposed)
|
||||
renderer.RenderVertex(highlighted, renderer.DetermineVertexColor(highlighted));
|
||||
|
||||
// Set new highlight
|
||||
highlighted = v;
|
||||
|
||||
// Render highlighted item
|
||||
if(highlighted != null)
|
||||
if((highlighted != null) && !highlighted.IsDisposed)
|
||||
renderer.RenderVertex(highlighted, ColorCollection.HIGHLIGHT);
|
||||
|
||||
// Done
|
||||
|
@ -152,8 +168,10 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
}
|
||||
|
||||
// Show highlight info
|
||||
if(highlighted != null) General.MainWindow.ShowVertexInfo(highlighted);
|
||||
else General.MainWindow.HideInfo();
|
||||
if((highlighted != null) && !highlighted.IsDisposed)
|
||||
General.MainWindow.ShowVertexInfo(highlighted);
|
||||
else
|
||||
General.MainWindow.HideInfo();
|
||||
}
|
||||
|
||||
// Mouse moves
|
||||
|
@ -190,7 +208,7 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
if(e.Button == EditMode.SELECT_BUTTON)
|
||||
{
|
||||
// Item highlighted?
|
||||
if(highlighted != null)
|
||||
if((highlighted != null) && !highlighted.IsDisposed)
|
||||
{
|
||||
// Flip selection
|
||||
highlighted.Selected = !highlighted.Selected;
|
||||
|
@ -198,7 +216,7 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
// Update display
|
||||
if(renderer.Start(false, false))
|
||||
{
|
||||
// Undraw highlight to show selection
|
||||
// Redraw highlight to show selection
|
||||
renderer.RenderVertex(highlighted, renderer.DetermineVertexColor(highlighted));
|
||||
renderer.Finish();
|
||||
}
|
||||
|
@ -212,7 +230,7 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
base.MouseUp(e);
|
||||
|
||||
// Item highlighted?
|
||||
if(highlighted != null)
|
||||
if((highlighted != null) && !highlighted.IsDisposed)
|
||||
{
|
||||
// Update display
|
||||
if(renderer.Start(false, false))
|
||||
|
@ -238,7 +256,7 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
else if(e.Button == EditMode.EDIT_BUTTON)
|
||||
{
|
||||
// Anything highlighted?
|
||||
if(highlighted != null)
|
||||
if((highlighted != null) && !highlighted.IsDisposed)
|
||||
{
|
||||
// Highlighted item not selected?
|
||||
if(!highlighted.Selected)
|
||||
|
@ -249,10 +267,11 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
}
|
||||
|
||||
// Start dragging the selection
|
||||
General.Map.ChangeMode(new DragVerticesMode(highlighted, mousedownmappos));
|
||||
General.Map.ChangeMode(new DragVerticesMode(new VerticesMode(), highlighted, mousedownmappos));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
@ -777,6 +777,14 @@ namespace CodeImp.DoomBuilder
|
|||
|
||||
#region ================== Tools
|
||||
|
||||
// This returns an element from a collection by index
|
||||
public static T GetByIndex<T>(ICollection<T> collection, int index)
|
||||
{
|
||||
IEnumerator<T> e = collection.GetEnumerator();
|
||||
for(int i = -1; i < index; i++) e.MoveNext();
|
||||
return e.Current;
|
||||
}
|
||||
|
||||
// This returns the next power of 2
|
||||
public static int NextPowerOf2(int v)
|
||||
{
|
||||
|
|
|
@ -71,6 +71,7 @@ namespace CodeImp.DoomBuilder
|
|||
private GameConfiguration config;
|
||||
private DataManager data;
|
||||
private EditMode mode;
|
||||
private EditMode newmode;
|
||||
private D3DDevice graphics;
|
||||
private Renderer2D renderer2d;
|
||||
private Renderer3D renderer3d;
|
||||
|
@ -91,6 +92,7 @@ namespace CodeImp.DoomBuilder
|
|||
public 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; } }
|
||||
|
@ -825,10 +827,11 @@ namespace CodeImp.DoomBuilder
|
|||
// - Engage of new mode is called
|
||||
// - Dispose of old mode is called
|
||||
//
|
||||
public void ChangeMode(EditMode newmode)
|
||||
public void ChangeMode(EditMode nextmode)
|
||||
{
|
||||
EditMode oldmode = mode;
|
||||
|
||||
newmode = nextmode;
|
||||
|
||||
// Log info
|
||||
if(newmode != null)
|
||||
General.WriteLogLine("Switching edit mode to " + newmode.GetType().Name + "...");
|
||||
|
@ -847,6 +850,9 @@ namespace CodeImp.DoomBuilder
|
|||
// Dispose old mode
|
||||
if(mode != null) mode.Dispose();
|
||||
|
||||
// Done switching
|
||||
newmode = null;
|
||||
|
||||
// Redraw the display
|
||||
General.MainWindow.RedrawDisplay();
|
||||
}
|
||||
|
|
98
Source/Interface/ActionSelectorControl.Designer.cs
generated
Normal file
98
Source/Interface/ActionSelectorControl.Designer.cs
generated
Normal file
|
@ -0,0 +1,98 @@
|
|||
namespace CodeImp.DoomBuilder.Interface
|
||||
{
|
||||
partial class ActionSelectorControl
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if(disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Component Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.number = new System.Windows.Forms.TextBox();
|
||||
this.list = new System.Windows.Forms.ComboBox();
|
||||
this.numberpanel = new System.Windows.Forms.Panel();
|
||||
this.numberpanel.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// number
|
||||
//
|
||||
this.number.BorderStyle = System.Windows.Forms.BorderStyle.None;
|
||||
this.number.Location = new System.Drawing.Point(3, 1);
|
||||
this.number.Name = "number";
|
||||
this.number.Size = new System.Drawing.Size(43, 13);
|
||||
this.number.TabIndex = 0;
|
||||
this.number.Text = "402";
|
||||
this.number.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
|
||||
this.number.TextChanged += new System.EventHandler(this.number_TextChanged);
|
||||
this.number.KeyDown += new System.Windows.Forms.KeyEventHandler(this.number_KeyDown);
|
||||
//
|
||||
// list
|
||||
//
|
||||
this.list.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed;
|
||||
this.list.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.list.FormattingEnabled = true;
|
||||
this.list.IntegralHeight = false;
|
||||
this.list.Location = new System.Drawing.Point(57, 0);
|
||||
this.list.MaxDropDownItems = 15;
|
||||
this.list.Name = "list";
|
||||
this.list.Size = new System.Drawing.Size(251, 21);
|
||||
this.list.TabIndex = 2;
|
||||
this.list.TabStop = false;
|
||||
this.list.DrawItem += new System.Windows.Forms.DrawItemEventHandler(this.list_DrawItem);
|
||||
this.list.SelectionChangeCommitted += new System.EventHandler(this.list_SelectionChangeCommitted);
|
||||
this.list.DropDownClosed += new System.EventHandler(this.list_DropDownClosed);
|
||||
//
|
||||
// numberpanel
|
||||
//
|
||||
this.numberpanel.BackColor = System.Drawing.SystemColors.Window;
|
||||
this.numberpanel.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
|
||||
this.numberpanel.Controls.Add(this.number);
|
||||
this.numberpanel.Location = new System.Drawing.Point(0, 0);
|
||||
this.numberpanel.Name = "numberpanel";
|
||||
this.numberpanel.Size = new System.Drawing.Size(53, 21);
|
||||
this.numberpanel.TabIndex = 3;
|
||||
//
|
||||
// ActionSelectorControl
|
||||
//
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
this.BackColor = System.Drawing.SystemColors.Control;
|
||||
this.Controls.Add(this.numberpanel);
|
||||
this.Controls.Add(this.list);
|
||||
this.Cursor = System.Windows.Forms.Cursors.Default;
|
||||
this.Name = "ActionSelectorControl";
|
||||
this.Size = new System.Drawing.Size(382, 21);
|
||||
this.Layout += new System.Windows.Forms.LayoutEventHandler(this.ActionSelectorControl_Layout);
|
||||
this.Resize += new System.EventHandler(this.ActionSelectorControl_Resize);
|
||||
this.numberpanel.ResumeLayout(false);
|
||||
this.numberpanel.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.TextBox number;
|
||||
private System.Windows.Forms.ComboBox list;
|
||||
private System.Windows.Forms.Panel numberpanel;
|
||||
}
|
||||
}
|
193
Source/Interface/ActionSelectorControl.cs
Normal file
193
Source/Interface/ActionSelectorControl.cs
Normal file
|
@ -0,0 +1,193 @@
|
|||
|
||||
#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;
|
||||
using Microsoft.Win32;
|
||||
using System.Drawing.Drawing2D;
|
||||
using CodeImp.DoomBuilder.Config;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace CodeImp.DoomBuilder.Interface
|
||||
{
|
||||
public partial class ActionSelectorControl : UserControl
|
||||
{
|
||||
// Constants
|
||||
private const string NUMBER_SEPERATOR = ":\t";
|
||||
|
||||
// Properties
|
||||
public bool Empty { get { return (number.Text.Length == 0); } set { if(value) number.Text = ""; } }
|
||||
public int Value { get { if(number.Text.Length > 0) return int.Parse(number.Text); else return 0; } set { number.Text = value.ToString(); } }
|
||||
|
||||
// Constructor
|
||||
public ActionSelectorControl()
|
||||
{
|
||||
// Initialize
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
// This adds information to display
|
||||
public void AddInfo(INumberedTitle[] infolist)
|
||||
{
|
||||
// Add to list
|
||||
list.Items.AddRange(infolist);
|
||||
}
|
||||
|
||||
// Resized
|
||||
private void ActionSelectorControl_Resize(object sender, EventArgs e)
|
||||
{
|
||||
list.Width = ClientRectangle.Width - list.Left;
|
||||
ClientSize = new Size(ClientSize.Width, list.Height);
|
||||
}
|
||||
|
||||
// Layout change
|
||||
private void ActionSelectorControl_Layout(object sender, LayoutEventArgs e)
|
||||
{
|
||||
ActionSelectorControl_Resize(sender, e);
|
||||
}
|
||||
|
||||
// This draws an item in the combobox
|
||||
private void list_DrawItem(object sender, DrawItemEventArgs e)
|
||||
{
|
||||
INumberedTitle item;
|
||||
Brush displaybrush;
|
||||
Brush backbrush;
|
||||
string displayname;
|
||||
|
||||
// Unknow item?
|
||||
if(e.Index < 0)
|
||||
{
|
||||
// Grayed
|
||||
displaybrush = new SolidBrush(SystemColors.GrayText);
|
||||
backbrush = new SolidBrush(SystemColors.Window);
|
||||
|
||||
// Check what to display
|
||||
if(number.Text.Length == 0)
|
||||
displayname = "";
|
||||
else if(number.Text == "0")
|
||||
displayname = "None";
|
||||
else
|
||||
displayname = "Unknown";
|
||||
}
|
||||
// In the display part of the combobox?
|
||||
else if((e.State & DrawItemState.ComboBoxEdit) != 0)
|
||||
{
|
||||
// Show without number
|
||||
item = (INumberedTitle)list.Items[e.Index];
|
||||
displayname = item.Title.Trim();
|
||||
|
||||
// Determine colors to use
|
||||
if(item.Index == 0)
|
||||
{
|
||||
// Grayed
|
||||
displaybrush = new SolidBrush(SystemColors.GrayText);
|
||||
backbrush = new SolidBrush(SystemColors.Window);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Normal color
|
||||
displaybrush = new SolidBrush(list.ForeColor);
|
||||
backbrush = new SolidBrush(SystemColors.Window);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Use number and description
|
||||
item = (INumberedTitle)list.Items[e.Index];
|
||||
displayname = item.Index + NUMBER_SEPERATOR + item.Title;
|
||||
|
||||
// Determine colors to use
|
||||
if((e.State & DrawItemState.Focus) != 0)
|
||||
{
|
||||
displaybrush = new SolidBrush(SystemColors.HighlightText);
|
||||
backbrush = new SolidBrush(SystemColors.Highlight);
|
||||
}
|
||||
else
|
||||
{
|
||||
displaybrush = new SolidBrush(list.ForeColor);
|
||||
backbrush = new SolidBrush(SystemColors.Window);
|
||||
}
|
||||
}
|
||||
|
||||
// Draw item
|
||||
e.Graphics.FillRectangle(backbrush, e.Bounds);
|
||||
e.Graphics.DrawString(displayname, list.Font, displaybrush, e.Bounds.X, e.Bounds.Y);
|
||||
}
|
||||
|
||||
// List closed
|
||||
private void list_DropDownClosed(object sender, EventArgs e)
|
||||
{
|
||||
// Focus to number box
|
||||
number.SelectAll();
|
||||
number.Focus();
|
||||
}
|
||||
|
||||
// Number changes
|
||||
private void number_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
int itemindex = -1;
|
||||
INumberedTitle item;
|
||||
|
||||
// Not nothing?
|
||||
if(number.Text.Length > 0)
|
||||
{
|
||||
// Find the index in the list
|
||||
for(int i = 0; i < list.Items.Count; i++)
|
||||
{
|
||||
// This is the item we're looking for?
|
||||
item = (INumberedTitle)list.Items[i];
|
||||
if(item.Index.ToString() == number.Text)
|
||||
{
|
||||
// Found it
|
||||
itemindex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Select item
|
||||
if(list.SelectedIndex != itemindex) list.SelectedIndex = itemindex;
|
||||
list.Refresh();
|
||||
}
|
||||
|
||||
// Keys pressed in number box
|
||||
private void number_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
// Not numeric or control key?
|
||||
if(((e.KeyValue < 48) || (e.KeyValue > 57)) &&
|
||||
(e.KeyCode != Keys.Back) && (e.KeyCode != Keys.Left) &&
|
||||
(e.KeyCode != Keys.Right) && (e.KeyCode != Keys.Delete))
|
||||
{
|
||||
// Cancel this
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Selection made
|
||||
private void list_SelectionChangeCommitted(object sender, EventArgs e)
|
||||
{
|
||||
INumberedTitle item = (INumberedTitle)list.SelectedItem;
|
||||
number.Text = item.Index.ToString();
|
||||
}
|
||||
}
|
||||
}
|
132
Source/Interface/ActionSelectorControl.resx
Normal file
132
Source/Interface/ActionSelectorControl.resx
Normal file
|
@ -0,0 +1,132 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="number.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="list.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="numberpanel.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="$this.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
</root>
|
51
Source/Interface/CheckboxArrayControl.Designer.cs
generated
Normal file
51
Source/Interface/CheckboxArrayControl.Designer.cs
generated
Normal file
|
@ -0,0 +1,51 @@
|
|||
namespace CodeImp.DoomBuilder.Interface
|
||||
{
|
||||
partial class CheckboxArrayControl
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if(disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Component Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// CheckboxArrayControl
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.AutoScroll = true;
|
||||
this.DoubleBuffered = true;
|
||||
this.Name = "CheckboxArrayControl";
|
||||
this.Size = new System.Drawing.Size(361, 163);
|
||||
this.Layout += new System.Windows.Forms.LayoutEventHandler(this.CheckboxArrayControl_Layout);
|
||||
this.Paint += new System.Windows.Forms.PaintEventHandler(this.CheckboxArrayControl_Paint);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
}
|
||||
}
|
135
Source/Interface/CheckboxArrayControl.cs
Normal file
135
Source/Interface/CheckboxArrayControl.cs
Normal file
|
@ -0,0 +1,135 @@
|
|||
|
||||
#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;
|
||||
using Microsoft.Win32;
|
||||
using System.Drawing.Drawing2D;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace CodeImp.DoomBuilder.Interface
|
||||
{
|
||||
public partial class CheckboxArrayControl : UserControl
|
||||
{
|
||||
// Constants
|
||||
private const int SPACING_Y = 1;
|
||||
|
||||
// Variables
|
||||
private List<CheckBox> checkboxes;
|
||||
private int columns;
|
||||
|
||||
// Properties
|
||||
public List<CheckBox> Checkboxes { get { return checkboxes; } }
|
||||
public int Columns { get { return columns; } set { columns = value; } }
|
||||
|
||||
// Constructor
|
||||
public CheckboxArrayControl()
|
||||
{
|
||||
// Initialize
|
||||
InitializeComponent();
|
||||
|
||||
// Setup
|
||||
checkboxes = new List<CheckBox>();
|
||||
}
|
||||
|
||||
// This adds a checkbox
|
||||
public CheckBox Add(string text, object tag)
|
||||
{
|
||||
// Make new checkbox
|
||||
CheckBox c = new CheckBox();
|
||||
c.AutoSize = true;
|
||||
//c.FlatStyle = FlatStyle.System;
|
||||
c.UseVisualStyleBackColor = true;
|
||||
c.Text = text;
|
||||
c.Tag = tag;
|
||||
|
||||
// Add to list
|
||||
this.Controls.Add(c);
|
||||
checkboxes.Add(c);
|
||||
|
||||
// Return checkbox
|
||||
return c;
|
||||
}
|
||||
|
||||
// This positions the checkboxes
|
||||
public void PositionCheckboxes()
|
||||
{
|
||||
int boxheight = 0;
|
||||
int columnlength;
|
||||
int columnwidth;
|
||||
int row = 0;
|
||||
int col = 0;
|
||||
|
||||
// Checks
|
||||
if(columns < 1) return;
|
||||
if(checkboxes.Count < 1) return;
|
||||
|
||||
// Calculate column width
|
||||
columnwidth = this.ClientSize.Width / columns;
|
||||
|
||||
// Check what the biggest checkbox height is
|
||||
foreach(CheckBox c in checkboxes) if(c.Height > boxheight) boxheight = c.Height;
|
||||
|
||||
// Check what the preferred column length is
|
||||
columnlength = 1 + (int)Math.Floor((float)(this.ClientSize.Height - boxheight) / (float)(boxheight + SPACING_Y));
|
||||
|
||||
// When not all items fit with the preferred column length
|
||||
// we have to extend the column length to make it fit
|
||||
if((int)Math.Ceiling((float)checkboxes.Count / (float)columnlength) > columns)
|
||||
{
|
||||
// Make a column length which works for all items
|
||||
columnlength = (int)Math.Ceiling((float)checkboxes.Count / (float)columns);
|
||||
}
|
||||
|
||||
// Go for all items
|
||||
foreach(CheckBox c in checkboxes)
|
||||
{
|
||||
// Position checkbox
|
||||
c.Location = new Point(col * columnwidth, row * boxheight + (row - 1) * SPACING_Y + SPACING_Y);
|
||||
|
||||
// Next position
|
||||
if(++row == columnlength)
|
||||
{
|
||||
row = 0;
|
||||
col++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// When layout must change
|
||||
private void CheckboxArrayControl_Layout(object sender, LayoutEventArgs e)
|
||||
{
|
||||
PositionCheckboxes();
|
||||
}
|
||||
|
||||
private void CheckboxArrayControl_Paint(object sender, PaintEventArgs e)
|
||||
{
|
||||
if(this.DesignMode)
|
||||
{
|
||||
Pen p = new Pen(SystemColors.ControlDark, 1);
|
||||
p.DashStyle = DashStyle.Dash;
|
||||
e.Graphics.DrawRectangle(p, 0, 0, this.ClientRectangle.Width - 1, this.ClientRectangle.Height - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
120
Source/Interface/CheckboxArrayControl.resx
Normal file
120
Source/Interface/CheckboxArrayControl.resx
Normal file
|
@ -0,0 +1,120 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
161
Source/Interface/LinedefEditForm.Designer.cs
generated
Normal file
161
Source/Interface/LinedefEditForm.Designer.cs
generated
Normal file
|
@ -0,0 +1,161 @@
|
|||
namespace CodeImp.DoomBuilder.Interface
|
||||
{
|
||||
partial class LinedefEditForm
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if(disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.cancel = new System.Windows.Forms.Button();
|
||||
this.apply = new System.Windows.Forms.Button();
|
||||
this.actiongroup = new System.Windows.Forms.GroupBox();
|
||||
this.action = new CodeImp.DoomBuilder.Interface.ActionSelectorControl();
|
||||
this.browseaction = new System.Windows.Forms.Button();
|
||||
this.settingsgroup = new System.Windows.Forms.GroupBox();
|
||||
this.flags = new CodeImp.DoomBuilder.Interface.CheckboxArrayControl();
|
||||
this.checkBox1 = new System.Windows.Forms.CheckBox();
|
||||
this.actiongroup.SuspendLayout();
|
||||
this.settingsgroup.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// cancel
|
||||
//
|
||||
this.cancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.cancel.Location = new System.Drawing.Point(399, 387);
|
||||
this.cancel.Name = "cancel";
|
||||
this.cancel.Size = new System.Drawing.Size(112, 25);
|
||||
this.cancel.TabIndex = 17;
|
||||
this.cancel.Text = "Cancel";
|
||||
this.cancel.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// apply
|
||||
//
|
||||
this.apply.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.apply.Location = new System.Drawing.Point(281, 387);
|
||||
this.apply.Name = "apply";
|
||||
this.apply.Size = new System.Drawing.Size(112, 25);
|
||||
this.apply.TabIndex = 16;
|
||||
this.apply.Text = "OK";
|
||||
this.apply.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// actiongroup
|
||||
//
|
||||
this.actiongroup.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.actiongroup.Controls.Add(this.action);
|
||||
this.actiongroup.Controls.Add(this.browseaction);
|
||||
this.actiongroup.Location = new System.Drawing.Point(12, 177);
|
||||
this.actiongroup.Name = "actiongroup";
|
||||
this.actiongroup.Size = new System.Drawing.Size(499, 196);
|
||||
this.actiongroup.TabIndex = 18;
|
||||
this.actiongroup.TabStop = false;
|
||||
this.actiongroup.Text = " Action ";
|
||||
//
|
||||
// action
|
||||
//
|
||||
this.action.BackColor = System.Drawing.SystemColors.Control;
|
||||
this.action.Cursor = System.Windows.Forms.Cursors.Default;
|
||||
this.action.Location = new System.Drawing.Point(18, 27);
|
||||
this.action.Name = "action";
|
||||
this.action.Size = new System.Drawing.Size(430, 21);
|
||||
this.action.TabIndex = 5;
|
||||
//
|
||||
// browseaction
|
||||
//
|
||||
this.browseaction.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.browseaction.Image = global::CodeImp.DoomBuilder.Properties.Resources.treeview;
|
||||
this.browseaction.Location = new System.Drawing.Point(454, 26);
|
||||
this.browseaction.Name = "browseaction";
|
||||
this.browseaction.Padding = new System.Windows.Forms.Padding(0, 0, 1, 3);
|
||||
this.browseaction.Size = new System.Drawing.Size(30, 23);
|
||||
this.browseaction.TabIndex = 3;
|
||||
this.browseaction.Text = " ";
|
||||
this.browseaction.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// settingsgroup
|
||||
//
|
||||
this.settingsgroup.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.settingsgroup.Controls.Add(this.flags);
|
||||
this.settingsgroup.Location = new System.Drawing.Point(12, 12);
|
||||
this.settingsgroup.Name = "settingsgroup";
|
||||
this.settingsgroup.Size = new System.Drawing.Size(499, 152);
|
||||
this.settingsgroup.TabIndex = 19;
|
||||
this.settingsgroup.TabStop = false;
|
||||
this.settingsgroup.Text = " Settings ";
|
||||
//
|
||||
// flags
|
||||
//
|
||||
this.flags.AutoScroll = true;
|
||||
this.flags.Columns = 3;
|
||||
this.flags.Location = new System.Drawing.Point(18, 26);
|
||||
this.flags.Name = "flags";
|
||||
this.flags.Size = new System.Drawing.Size(475, 119);
|
||||
this.flags.TabIndex = 0;
|
||||
//
|
||||
// checkBox1
|
||||
//
|
||||
this.checkBox1.Location = new System.Drawing.Point(0, 0);
|
||||
this.checkBox1.Name = "checkBox1";
|
||||
this.checkBox1.Size = new System.Drawing.Size(104, 24);
|
||||
this.checkBox1.TabIndex = 0;
|
||||
this.checkBox1.Text = "checkBox1";
|
||||
this.checkBox1.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// LinedefEditForm
|
||||
//
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
this.ClientSize = new System.Drawing.Size(523, 422);
|
||||
this.Controls.Add(this.settingsgroup);
|
||||
this.Controls.Add(this.actiongroup);
|
||||
this.Controls.Add(this.cancel);
|
||||
this.Controls.Add(this.apply);
|
||||
this.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "LinedefEditForm";
|
||||
this.Opacity = 0;
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "Edit Linedefs";
|
||||
this.actiongroup.ResumeLayout(false);
|
||||
this.settingsgroup.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Button cancel;
|
||||
private System.Windows.Forms.Button apply;
|
||||
private System.Windows.Forms.GroupBox actiongroup;
|
||||
private System.Windows.Forms.GroupBox settingsgroup;
|
||||
private CheckboxArrayControl flags;
|
||||
private System.Windows.Forms.CheckBox checkBox1;
|
||||
private System.Windows.Forms.Button browseaction;
|
||||
private ActionSelectorControl action;
|
||||
}
|
||||
}
|
86
Source/Interface/LinedefEditForm.cs
Normal file
86
Source/Interface/LinedefEditForm.cs
Normal file
|
@ -0,0 +1,86 @@
|
|||
|
||||
#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;
|
||||
using CodeImp.DoomBuilder.Map;
|
||||
using CodeImp.DoomBuilder.Data;
|
||||
using CodeImp.DoomBuilder.IO;
|
||||
using System.IO;
|
||||
using CodeImp.DoomBuilder.Config;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace CodeImp.DoomBuilder.Interface
|
||||
{
|
||||
public partial class LinedefEditForm : DelayedForm
|
||||
{
|
||||
// Variables
|
||||
private ICollection<Linedef> lines;
|
||||
|
||||
// Constructor
|
||||
public LinedefEditForm()
|
||||
{
|
||||
// Initialize
|
||||
InitializeComponent();
|
||||
|
||||
// Fill linedef flags list
|
||||
foreach(KeyValuePair<int, string> lf in General.Map.Config.LinedefFlags) flags.Add(lf.Value, lf.Key);
|
||||
|
||||
// Fill linedef actions list
|
||||
action.AddInfo(General.Map.Config.SortedLinedefActions.ToArray());
|
||||
}
|
||||
|
||||
// This sets up the form to edit the given lines
|
||||
public void Setup(ICollection<Linedef> lines)
|
||||
{
|
||||
// Keep this list
|
||||
this.lines = lines;
|
||||
|
||||
// Go for all flags
|
||||
foreach(CheckBox c in flags.Checkboxes)
|
||||
{
|
||||
// Set the option with the first line's setting
|
||||
c.Checked = (General.GetByIndex<Linedef>(lines, 0).Flags & (int)c.Tag) != 0;
|
||||
|
||||
// Go for all lines
|
||||
foreach(Linedef l in lines)
|
||||
{
|
||||
// Make the option gray if it is different
|
||||
if(((l.Flags & (int)c.Tag) != 0) != c.Checked)
|
||||
c.CheckState = CheckState.Indeterminate;
|
||||
}
|
||||
}
|
||||
|
||||
// Set the action to the first line's action
|
||||
action.Value = General.GetByIndex<Linedef>(lines, 0).Action;
|
||||
|
||||
// Go for all lines
|
||||
foreach(Linedef l in lines)
|
||||
{
|
||||
// Erase the option if it is different
|
||||
if(l.Action != action.Value)
|
||||
action.Empty = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
120
Source/Interface/LinedefEditForm.resx
Normal file
120
Source/Interface/LinedefEditForm.resx
Normal file
|
@ -0,0 +1,120 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
96
Source/Interface/ResourceOptionsForm.Designer.cs
generated
96
Source/Interface/ResourceOptionsForm.Designer.cs
generated
|
@ -40,13 +40,13 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
this.dir_textures = new System.Windows.Forms.CheckBox();
|
||||
this.browsedir = new System.Windows.Forms.Button();
|
||||
this.dirlocation = new System.Windows.Forms.TextBox();
|
||||
this.pk3filetab = new System.Windows.Forms.TabPage();
|
||||
this.browsepk3 = new System.Windows.Forms.Button();
|
||||
this.pk3location = new System.Windows.Forms.TextBox();
|
||||
this.cancel = new System.Windows.Forms.Button();
|
||||
this.apply = new System.Windows.Forms.Button();
|
||||
this.wadfiledialog = new System.Windows.Forms.OpenFileDialog();
|
||||
this.dirdialog = new System.Windows.Forms.FolderBrowserDialog();
|
||||
this.pk3filetab = new System.Windows.Forms.TabPage();
|
||||
this.browsepk3 = new System.Windows.Forms.Button();
|
||||
this.pk3location = new System.Windows.Forms.TextBox();
|
||||
this.pk3filedialog = new System.Windows.Forms.OpenFileDialog();
|
||||
label1 = new System.Windows.Forms.Label();
|
||||
label2 = new System.Windows.Forms.Label();
|
||||
|
@ -75,6 +75,15 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
label2.TabIndex = 3;
|
||||
label2.Text = "Directory Resource:";
|
||||
//
|
||||
// label3
|
||||
//
|
||||
label3.AutoSize = true;
|
||||
label3.Location = new System.Drawing.Point(15, 20);
|
||||
label3.Name = "label3";
|
||||
label3.Size = new System.Drawing.Size(98, 14);
|
||||
label3.TabIndex = 3;
|
||||
label3.Text = "PK3 File Resource:";
|
||||
//
|
||||
// tabs
|
||||
//
|
||||
this.tabs.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
|
@ -108,11 +117,13 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
// browsewad
|
||||
//
|
||||
this.browsewad.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.browsewad.Image = global::CodeImp.DoomBuilder.Properties.Resources.Folder;
|
||||
this.browsewad.Location = new System.Drawing.Point(315, 36);
|
||||
this.browsewad.Name = "browsewad";
|
||||
this.browsewad.Padding = new System.Windows.Forms.Padding(0, 0, 1, 3);
|
||||
this.browsewad.Size = new System.Drawing.Size(30, 23);
|
||||
this.browsewad.TabIndex = 2;
|
||||
this.browsewad.Text = "...";
|
||||
this.browsewad.Text = " ";
|
||||
this.browsewad.UseVisualStyleBackColor = true;
|
||||
this.browsewad.Click += new System.EventHandler(this.browsewad_Click);
|
||||
//
|
||||
|
@ -163,11 +174,12 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
// browsedir
|
||||
//
|
||||
this.browsedir.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.browsedir.Image = global::CodeImp.DoomBuilder.Properties.Resources.Folder;
|
||||
this.browsedir.Location = new System.Drawing.Point(316, 91);
|
||||
this.browsedir.Name = "browsedir";
|
||||
this.browsedir.Padding = new System.Windows.Forms.Padding(0, 0, 1, 3);
|
||||
this.browsedir.Size = new System.Drawing.Size(30, 23);
|
||||
this.browsedir.TabIndex = 5;
|
||||
this.browsedir.Text = "...";
|
||||
this.browsedir.UseVisualStyleBackColor = true;
|
||||
this.browsedir.Click += new System.EventHandler(this.browsedir_Click);
|
||||
//
|
||||
|
@ -180,6 +192,39 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
this.dirlocation.Size = new System.Drawing.Size(293, 20);
|
||||
this.dirlocation.TabIndex = 4;
|
||||
//
|
||||
// pk3filetab
|
||||
//
|
||||
this.pk3filetab.Controls.Add(this.browsepk3);
|
||||
this.pk3filetab.Controls.Add(this.pk3location);
|
||||
this.pk3filetab.Controls.Add(label3);
|
||||
this.pk3filetab.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.pk3filetab.Location = new System.Drawing.Point(4, 23);
|
||||
this.pk3filetab.Name = "pk3filetab";
|
||||
this.pk3filetab.Size = new System.Drawing.Size(361, 134);
|
||||
this.pk3filetab.TabIndex = 2;
|
||||
this.pk3filetab.Text = "From PK3 File";
|
||||
this.pk3filetab.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// browsepk3
|
||||
//
|
||||
this.browsepk3.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.browsepk3.Image = global::CodeImp.DoomBuilder.Properties.Resources.Folder;
|
||||
this.browsepk3.Location = new System.Drawing.Point(315, 36);
|
||||
this.browsepk3.Name = "browsepk3";
|
||||
this.browsepk3.Padding = new System.Windows.Forms.Padding(0, 0, 1, 3);
|
||||
this.browsepk3.Size = new System.Drawing.Size(30, 23);
|
||||
this.browsepk3.TabIndex = 5;
|
||||
this.browsepk3.UseVisualStyleBackColor = true;
|
||||
this.browsepk3.Click += new System.EventHandler(this.browsepk3_Click);
|
||||
//
|
||||
// pk3location
|
||||
//
|
||||
this.pk3location.Location = new System.Drawing.Point(17, 37);
|
||||
this.pk3location.Name = "pk3location";
|
||||
this.pk3location.ReadOnly = true;
|
||||
this.pk3location.Size = new System.Drawing.Size(292, 20);
|
||||
this.pk3location.TabIndex = 4;
|
||||
//
|
||||
// cancel
|
||||
//
|
||||
this.cancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
|
@ -212,47 +257,6 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
//
|
||||
this.dirdialog.Description = "Please select a directory from which to load images when editing your map...";
|
||||
//
|
||||
// pk3filetab
|
||||
//
|
||||
this.pk3filetab.Controls.Add(this.browsepk3);
|
||||
this.pk3filetab.Controls.Add(this.pk3location);
|
||||
this.pk3filetab.Controls.Add(label3);
|
||||
this.pk3filetab.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.pk3filetab.Location = new System.Drawing.Point(4, 23);
|
||||
this.pk3filetab.Name = "pk3filetab";
|
||||
this.pk3filetab.Size = new System.Drawing.Size(361, 134);
|
||||
this.pk3filetab.TabIndex = 2;
|
||||
this.pk3filetab.Text = "From PK3 File";
|
||||
this.pk3filetab.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// browsepk3
|
||||
//
|
||||
this.browsepk3.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.browsepk3.Location = new System.Drawing.Point(315, 36);
|
||||
this.browsepk3.Name = "browsepk3";
|
||||
this.browsepk3.Size = new System.Drawing.Size(30, 23);
|
||||
this.browsepk3.TabIndex = 5;
|
||||
this.browsepk3.Text = "...";
|
||||
this.browsepk3.UseVisualStyleBackColor = true;
|
||||
this.browsepk3.Click += new System.EventHandler(this.browsepk3_Click);
|
||||
//
|
||||
// pk3location
|
||||
//
|
||||
this.pk3location.Location = new System.Drawing.Point(17, 37);
|
||||
this.pk3location.Name = "pk3location";
|
||||
this.pk3location.ReadOnly = true;
|
||||
this.pk3location.Size = new System.Drawing.Size(292, 20);
|
||||
this.pk3location.TabIndex = 4;
|
||||
//
|
||||
// label3
|
||||
//
|
||||
label3.AutoSize = true;
|
||||
label3.Location = new System.Drawing.Point(15, 20);
|
||||
label3.Name = "label3";
|
||||
label3.Size = new System.Drawing.Size(98, 14);
|
||||
label3.TabIndex = 3;
|
||||
label3.Text = "PK3 File Resource:";
|
||||
//
|
||||
// pk3filedialog
|
||||
//
|
||||
this.pk3filedialog.Filter = "Doom PK3 Files (*.pk3)|*.pk3";
|
||||
|
|
|
@ -129,6 +129,12 @@
|
|||
<metadata name="label2.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
<metadata name="label3.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="label3.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
<metadata name="tabs.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
|
@ -165,30 +171,6 @@
|
|||
<metadata name="pk3location.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="label3.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="label3.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
<metadata name="browsewad.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="wadlocation.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="dir_flats.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="dir_textures.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="browsedir.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="dirlocation.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="cancel.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
|
|
|
@ -34,10 +34,8 @@ namespace CodeImp.DoomBuilder.Map
|
|||
{
|
||||
#region ================== Constants
|
||||
|
||||
public const int BUFFERVERTICES = 4;
|
||||
public const int RENDERPRIMITIVES = 2;
|
||||
public static readonly byte[] EMPTY_ARGS = new byte[5];
|
||||
private const float NORMAL_LENGTH = 6f;
|
||||
public const int NUM_ARGS = 5;
|
||||
public static readonly byte[] EMPTY_ARGS = new byte[NUM_ARGS];
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -268,10 +266,28 @@ namespace CodeImp.DoomBuilder.Map
|
|||
{
|
||||
updateneeded = true;
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Methods
|
||||
|
||||
// This applies single/double sided flags
|
||||
public void ApplySidedFlags()
|
||||
{
|
||||
// Doublesided?
|
||||
if((front != null) && (back != null))
|
||||
{
|
||||
// Apply or remove flags for doublesided line
|
||||
flags &= ~General.Map.Config.SingleSidedFlags;
|
||||
flags |= General.Map.Config.DoubleSidedFlags;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Apply or remove flags for singlesided line
|
||||
flags &= ~General.Map.Config.DoubleSidedFlags;
|
||||
flags |= General.Map.Config.SingleSidedFlags;
|
||||
}
|
||||
}
|
||||
|
||||
// This returns the shortest distance from given coordinates to line
|
||||
public float SafeDistanceToSq(Vector2D p, bool bounded)
|
||||
|
@ -374,11 +390,158 @@ namespace CodeImp.DoomBuilder.Map
|
|||
// This line will be disposed
|
||||
public void Join(Linedef other)
|
||||
{
|
||||
// TODO
|
||||
Sector l1fs, l1bs, l2fs, l2bs;
|
||||
|
||||
// Get sector references
|
||||
if(other.front != null) l1fs = other.front.Sector; else l1fs = null;
|
||||
if(other.back != null) l1bs = other.back.Sector; else l1bs = null;
|
||||
if(this.front != null) l2fs = this.front.Sector; else l2fs = null;
|
||||
if(this.back != null) l2bs = this.back.Sector; else l2bs = null;
|
||||
|
||||
// Compare front sectors
|
||||
if(l1fs == l2fs)
|
||||
{
|
||||
// Copy textures
|
||||
if(other.front != null) other.front.AddTexturesTo(this.back);
|
||||
if(this.front != null) this.front.AddTexturesTo(other.back);
|
||||
|
||||
// Change sidedefs
|
||||
JoinChangeSidedefs(other, true, back);
|
||||
}
|
||||
// Compare back sectors
|
||||
else if(l1bs == l2bs)
|
||||
{
|
||||
// Copy textures
|
||||
if(other.back != null) other.back.AddTexturesTo(this.front);
|
||||
if(this.back != null) this.back.AddTexturesTo(other.front);
|
||||
|
||||
// Change sidedefs
|
||||
JoinChangeSidedefs(other, false, front);
|
||||
}
|
||||
// Compare front and back
|
||||
else if(l1fs == l2bs)
|
||||
{
|
||||
// Copy textures
|
||||
if(other.front != null) other.front.AddTexturesTo(this.front);
|
||||
if(this.back != null) this.back.AddTexturesTo(other.back);
|
||||
|
||||
// Change sidedefs
|
||||
JoinChangeSidedefs(other, true, front);
|
||||
}
|
||||
// Compare back and front
|
||||
else if(l1bs == l2fs)
|
||||
{
|
||||
// Copy textures
|
||||
if(other.back != null) other.back.AddTexturesTo(this.back);
|
||||
if(this.front != null) this.front.AddTexturesTo(other.front);
|
||||
|
||||
// Change sidedefs
|
||||
JoinChangeSidedefs(other, false, back);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Other line single sided?
|
||||
if(other.back == null)
|
||||
{
|
||||
// This line with its back to the other?
|
||||
if(this.start == other.end)
|
||||
{
|
||||
// Copy textures
|
||||
if(other.back != null) other.back.AddTexturesTo(this.front);
|
||||
if(this.back != null) this.back.AddTexturesTo(other.front);
|
||||
|
||||
// Change sidedefs
|
||||
JoinChangeSidedefs(other, false, front);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Copy textures
|
||||
if(other.back != null) other.back.AddTexturesTo(this.back);
|
||||
if(this.front != null) this.front.AddTexturesTo(other.front);
|
||||
|
||||
// Change sidedefs
|
||||
JoinChangeSidedefs(other, false, back);
|
||||
}
|
||||
}
|
||||
// This line single sided?
|
||||
if(this.back == null)
|
||||
{
|
||||
// Other line with its back to this?
|
||||
if(other.start == this.end)
|
||||
{
|
||||
// Copy textures
|
||||
if(other.back != null) other.back.AddTexturesTo(this.front);
|
||||
if(this.back != null) this.back.AddTexturesTo(other.front);
|
||||
|
||||
// Change sidedefs
|
||||
JoinChangeSidedefs(other, false, front);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Copy textures
|
||||
if(other.front != null) other.front.AddTexturesTo(this.front);
|
||||
if(this.back != null) this.back.AddTexturesTo(other.back);
|
||||
|
||||
// Change sidedefs
|
||||
JoinChangeSidedefs(other, true, front);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// This line with its back to the other?
|
||||
if(this.start == other.end)
|
||||
{
|
||||
// Copy textures
|
||||
if(other.back != null) other.back.AddTexturesTo(this.front);
|
||||
if(this.back != null) this.back.AddTexturesTo(other.front);
|
||||
|
||||
// Change sidedefs
|
||||
JoinChangeSidedefs(other, false, front);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Copy textures
|
||||
if(other.back != null) other.back.AddTexturesTo(this.back);
|
||||
if(this.front != null) this.front.AddTexturesTo(other.front);
|
||||
|
||||
// Change sidedefs
|
||||
JoinChangeSidedefs(other, false, back);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If either of the two lines was selected, keep the other selected
|
||||
if(this.selected) other.selected = true;
|
||||
|
||||
// Apply single/double sided flags
|
||||
other.ApplySidedFlags();
|
||||
|
||||
// I got killed by the other.
|
||||
this.Dispose();
|
||||
}
|
||||
|
||||
// This changes sidedefs (used for joining lines)
|
||||
private void JoinChangeSidedefs(Linedef other, bool front, Sidedef newside)
|
||||
{
|
||||
Sidedef sd;
|
||||
|
||||
// Change sidedefs
|
||||
if(front)
|
||||
{
|
||||
if(other.front != null) other.front.Dispose();
|
||||
}
|
||||
else
|
||||
{
|
||||
if(other.back != null) other.back.Dispose();
|
||||
}
|
||||
|
||||
if(newside != null)
|
||||
{
|
||||
sd = map.CreateSidedef(other, front, newside.Sector);
|
||||
newside.CopyPropertiesTo(sd);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Changes
|
||||
|
|
|
@ -26,6 +26,7 @@ using SlimDX.Direct3D;
|
|||
using CodeImp.DoomBuilder.Rendering;
|
||||
using SlimDX;
|
||||
using System.Drawing;
|
||||
using CodeImp.DoomBuilder.Editing;
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -360,6 +361,43 @@ namespace CodeImp.DoomBuilder.Map
|
|||
return list;
|
||||
}
|
||||
|
||||
// Returns a collection of vertices that match a selected state on the linedefs
|
||||
public ICollection<Vertex> GetVerticesFromLinesSelection(bool selected)
|
||||
{
|
||||
List<Vertex> list = new List<Vertex>();
|
||||
foreach(Vertex v in vertices)
|
||||
{
|
||||
foreach(Linedef l in v.Linedefs)
|
||||
{
|
||||
if(l.Selected == selected)
|
||||
{
|
||||
list.Add(v);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
// Returns a collection of vertices that match a selected state on the linedefs
|
||||
public ICollection<Vertex> GetVerticesFromSectorsSelection(bool selected)
|
||||
{
|
||||
List<Vertex> list = new List<Vertex>();
|
||||
foreach(Vertex v in vertices)
|
||||
{
|
||||
foreach(Linedef l in v.Linedefs)
|
||||
{
|
||||
if( ((l.Front != null) && (l.Front.Sector.Selected == selected)) ||
|
||||
((l.Back != null) && (l.Back.Sector.Selected == selected)) )
|
||||
{
|
||||
list.Add(v);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
// Returns a collection of things that match a selected state
|
||||
public ICollection<Thing> GetThingsSelection(bool selected)
|
||||
{
|
||||
|
@ -389,7 +427,7 @@ namespace CodeImp.DoomBuilder.Map
|
|||
#region ================== Areas
|
||||
|
||||
// This creates an area from vertices
|
||||
public static Rectangle AreaFromVertices(ICollection<Vertex> verts)
|
||||
public static Rectangle CreateArea(ICollection<Vertex> verts)
|
||||
{
|
||||
int l = int.MaxValue;
|
||||
int t = int.MaxValue;
|
||||
|
@ -410,15 +448,15 @@ namespace CodeImp.DoomBuilder.Map
|
|||
return new Rectangle(l, t, r - l, b - t);
|
||||
}
|
||||
|
||||
// This creates an area from vertices
|
||||
public static Rectangle AreaFromLines(ICollection<Linedef> lines)
|
||||
// This creates an area from linedefs
|
||||
public static Rectangle CreateArea(ICollection<Linedef> lines)
|
||||
{
|
||||
int l = int.MaxValue;
|
||||
int t = int.MaxValue;
|
||||
int r = int.MinValue;
|
||||
int b = int.MinValue;
|
||||
|
||||
// Go for all vertices
|
||||
// Go for all linedefs
|
||||
foreach(Linedef ld in lines)
|
||||
{
|
||||
// Adjust boundaries by vertices
|
||||
|
@ -437,7 +475,7 @@ namespace CodeImp.DoomBuilder.Map
|
|||
}
|
||||
|
||||
// This filters lines by a square area
|
||||
public static ICollection<Linedef> FilterArea(ICollection<Linedef> lines, ref Rectangle area)
|
||||
public static ICollection<Linedef> FilterByArea(ICollection<Linedef> lines, ref Rectangle area)
|
||||
{
|
||||
ICollection<Linedef> newlines = new List<Linedef>(lines.Count);
|
||||
|
||||
|
@ -468,7 +506,7 @@ namespace CodeImp.DoomBuilder.Map
|
|||
}
|
||||
|
||||
// This filters vertices by a square area
|
||||
public static ICollection<Vertex> FilterArea(ICollection<Vertex> verts, ref Rectangle area)
|
||||
public static ICollection<Vertex> FilterByArea(ICollection<Vertex> verts, ref Rectangle area)
|
||||
{
|
||||
ICollection<Vertex> newverts = new List<Vertex>(verts.Count);
|
||||
|
||||
|
@ -492,6 +530,63 @@ namespace CodeImp.DoomBuilder.Map
|
|||
|
||||
#endregion
|
||||
|
||||
#region ================== Stitching
|
||||
|
||||
// This stitches geometry
|
||||
public int StitchGeometry(ICollection<Vertex> movingverts, ICollection<Vertex> fixedverts)
|
||||
{
|
||||
ICollection<Linedef> movinglines;
|
||||
ICollection<Linedef> fixedlines;
|
||||
ICollection<Vertex> nearbyfixedverts;
|
||||
Rectangle editarea;
|
||||
int stitches = 0;
|
||||
int stitchundo;
|
||||
|
||||
if(General.MainWindow.AutoMerge)
|
||||
{
|
||||
// Make undo for the stitching
|
||||
stitchundo = General.Map.UndoRedo.CreateUndo("stitch geometry", UndoGroup.None, 0, false);
|
||||
|
||||
// Find lines that moved during the drag
|
||||
movinglines = LinedefsFromSelectedVertices(false, true, true);
|
||||
|
||||
// Find all non-moving lines
|
||||
fixedlines = LinedefsFromSelectedVertices(true, false, false);
|
||||
|
||||
// Determine area in which we are editing
|
||||
editarea = MapSet.CreateArea(movinglines);
|
||||
editarea.Inflate((int)Math.Ceiling(General.Settings.StitchDistance),
|
||||
(int)Math.Ceiling(General.Settings.StitchDistance));
|
||||
|
||||
// Join nearby vertices
|
||||
stitches += MapSet.JoinVertices(fixedverts, movingverts, true, General.Settings.StitchDistance);
|
||||
|
||||
// Update cached values
|
||||
Update();
|
||||
|
||||
// Split moving lines with unselected vertices
|
||||
nearbyfixedverts = MapSet.FilterByArea(fixedverts, ref editarea);
|
||||
stitches += MapSet.SplitLinesByVertices(movinglines, nearbyfixedverts, General.Settings.StitchDistance, movinglines);
|
||||
|
||||
// Split non-moving lines with selected vertices
|
||||
fixedlines = MapSet.FilterByArea(fixedlines, ref editarea);
|
||||
stitches += MapSet.SplitLinesByVertices(fixedlines, movingverts, General.Settings.StitchDistance, movinglines);
|
||||
|
||||
// Remove looped linedefs
|
||||
stitches += MapSet.RemoveLoopedLinedefs(movinglines);
|
||||
|
||||
// Join overlapping lines
|
||||
stitches += MapSet.JoinOverlappingLines(movinglines);
|
||||
|
||||
// No stitching done? then withdraw undo
|
||||
if(stitches == 0) General.Map.UndoRedo.WithdrawUndo(stitchundo);
|
||||
}
|
||||
|
||||
return stitches;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Geometry Tools
|
||||
|
||||
// This joins overlapping lines together
|
||||
|
@ -688,7 +783,8 @@ namespace CodeImp.DoomBuilder.Map
|
|||
if(l.DistanceToSq(v.Position, true) <= splitdist2)
|
||||
{
|
||||
// Line is not already referencing v?
|
||||
if((l.Start != v) && (l.End != v))
|
||||
if(((l.Start.X != v.X) || (l.Start.Y != v.Y)) &&
|
||||
((l.End.X != v.X) || (l.End.Y != v.Y)))
|
||||
{
|
||||
// Split line l with vertex v
|
||||
nl = l.Split(v);
|
||||
|
|
|
@ -154,6 +154,9 @@ namespace CodeImp.DoomBuilder.Map
|
|||
{
|
||||
int copyoffsets = 0;
|
||||
|
||||
// s cannot be null
|
||||
if(s == null) return;
|
||||
|
||||
// Upper texture set?
|
||||
if((texnamehigh.Length > 0) && (texnamehigh[0] != '-'))
|
||||
{
|
||||
|
|
|
@ -34,7 +34,8 @@ namespace CodeImp.DoomBuilder.Map
|
|||
{
|
||||
#region ================== Constants
|
||||
|
||||
public static readonly byte[] EMPTY_ARGS = new byte[5];
|
||||
public const int NUM_ARGS = 5;
|
||||
public static readonly byte[] EMPTY_ARGS = new byte[NUM_ARGS];
|
||||
|
||||
#endregion
|
||||
|
||||
|
|
|
@ -146,7 +146,7 @@ namespace CodeImp.DoomBuilder.Map
|
|||
#endregion
|
||||
|
||||
#region ================== Methods
|
||||
|
||||
|
||||
// This returns the distance from given coordinates
|
||||
public float DistanceToSq(Vector2D p)
|
||||
{
|
||||
|
|
14
Source/Properties/Resources.Designer.cs
generated
14
Source/Properties/Resources.Designer.cs
generated
|
@ -81,6 +81,13 @@ namespace CodeImp.DoomBuilder.Properties {
|
|||
}
|
||||
}
|
||||
|
||||
internal static System.Drawing.Bitmap Folder {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("Folder", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
internal static System.Drawing.Bitmap Grid2 {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("Grid2", resourceCulture);
|
||||
|
@ -207,6 +214,13 @@ namespace CodeImp.DoomBuilder.Properties {
|
|||
}
|
||||
}
|
||||
|
||||
internal static System.Drawing.Bitmap treeview {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("treeview", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
internal static System.Drawing.Bitmap Undo {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("Undo", resourceCulture);
|
||||
|
|
|
@ -118,6 +118,9 @@
|
|||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="Folder" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\Folder.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="Redo" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\Redo.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
|
@ -148,9 +151,6 @@
|
|||
<data name="mergegeometry" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\mergegeometry.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="File" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\NewMap.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="Undo" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\Undo.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
|
@ -166,6 +166,9 @@
|
|||
<data name="Grid2" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\Grid2.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="OpenMap" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\OpenMap.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="Grid4" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\Grid4.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
|
@ -187,10 +190,13 @@
|
|||
<data name="Hourglass" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\Hourglass.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="OpenMap" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\OpenMap.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="mergegeometry2" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\mergegeometry2.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="File" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\NewMap.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="treeview" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\treeview.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
</root>
|
BIN
Source/Resources/Folder.png
Normal file
BIN
Source/Resources/Folder.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 394 B |
BIN
Source/Resources/treeview.png
Normal file
BIN
Source/Resources/treeview.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 231 B |
Loading…
Reference in a new issue