working on map analysis mode

This commit is contained in:
codeimp 2008-10-23 05:53:34 +00:00
parent 9044a0dc41
commit 28172b94bb
7 changed files with 407 additions and 0 deletions

View file

@ -35,6 +35,7 @@
<ItemGroup>
<Compile Include="ClassicModes\BaseClassicMode.cs" />
<Compile Include="ClassicModes\BrightnessMode.cs" />
<Compile Include="ClassicModes\ErrorCheckMode.cs" />
<Compile Include="ClassicModes\EditSelectionMode.cs" />
<Compile Include="ClassicModes\CurveLinedefsMode.cs" />
<Compile Include="ClassicModes\DragLinedefsMode.cs" />
@ -56,6 +57,12 @@
<Compile Include="Interface\CurveLinedefsForm.Designer.cs">
<DependentUpon>CurveLinedefsForm.cs</DependentUpon>
</Compile>
<Compile Include="Interface\ErrorCheckForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Interface\ErrorCheckForm.Designer.cs">
<DependentUpon>ErrorCheckForm.cs</DependentUpon>
</Compile>
<Compile Include="Interface\FindReplaceForm.cs">
<SubType>Form</SubType>
</Compile>
@ -147,6 +154,10 @@
<EmbeddedResource Include="Resources\BrightnessMode.png" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Interface\ErrorCheckForm.resx">
<SubType>Designer</SubType>
<DependentUpon>ErrorCheckForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Interface\FindReplaceForm.resx">
<DependentUpon>FindReplaceForm.cs</DependentUpon>
<SubType>Designer</SubType>

View file

@ -0,0 +1,116 @@
#region ================== Copyright (c) 2007 Pascal vd Heiden
/*
* Copyright (c) 2007 Pascal vd Heiden, www.codeimp.com
* This program is released under GNU General Public License
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#endregion
#region ================== Namespaces
using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Reflection;
using CodeImp.DoomBuilder.Windows;
using CodeImp.DoomBuilder.IO;
using CodeImp.DoomBuilder.Map;
using CodeImp.DoomBuilder.Rendering;
using CodeImp.DoomBuilder.Geometry;
using System.Drawing;
using CodeImp.DoomBuilder.Editing;
#endregion
namespace CodeImp.DoomBuilder.BuilderModes
{
[EditMode(DisplayName = "Map Analysis",
SwitchAction = "errorcheckmode",
Volatile = false)]
public sealed class ErrorCheckMode : BaseClassicMode
{
#region ================== Constants
#endregion
#region ================== Variables
#endregion
#region ================== Properties
#endregion
#region ================== Constructor / Disposer
#endregion
#region ================== Events
// Cancelled
public override void OnCancel()
{
// Cancel base class
base.OnCancel();
// Return to base mode
General.Map.ChangeMode(General.Map.PreviousStableMode.Name);
}
// Mode engages
public override void OnEngage()
{
base.OnEngage();
renderer.SetPresentation(Presentation.Standard);
// Show toolbox window
BuilderPlug.Me.ErrorCheckForm.Show((Form)General.Interface);
}
// Disenagaging
public override void OnDisengage()
{
base.OnDisengage();
// Hide object info
General.Interface.HideInfo();
// Hide toolbox window
BuilderPlug.Me.ErrorCheckForm.Hide();
}
// This applies the curves and returns to the base mode
public override void OnAccept()
{
// Snap to map format accuracy
General.Map.Map.SnapAllToAccuracy();
// Update caches
General.Map.Map.Update();
General.Map.IsChanged = true;
// Return to base mode
General.Map.ChangeMode(General.Map.PreviousStableMode.Name);
}
// Redrawing display
public override void OnRedrawDisplay()
{
}
#endregion
}
}

View file

@ -55,6 +55,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
private MenusForm menusform;
private CurveLinedefsForm curvelinedefsform;
private FindReplaceForm findreplaceform;
private ErrorCheckForm errorcheckform;
#endregion
@ -65,6 +66,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
public MenusForm MenusForm { get { return menusform; } }
public CurveLinedefsForm CurveLinedefsForm { get { return curvelinedefsform; } }
public FindReplaceForm FindReplaceForm { get { return findreplaceform; } }
public ErrorCheckForm ErrorCheckForm { get { return errorcheckform; } }
#endregion
@ -85,6 +87,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Load find/replace form
findreplaceform = new FindReplaceForm();
// Load error checking form
errorcheckform = new ErrorCheckForm();
}
// Disposer
@ -101,6 +106,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
curvelinedefsform = null;
findreplaceform.Dispose();
findreplaceform = null;
errorcheckform.Dispose();
errorcheckform = null;
// Done
me = null;

View file

@ -0,0 +1,54 @@
namespace CodeImp.DoomBuilder.BuilderModes
{
partial class ErrorCheckForm
{
/// <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.SuspendLayout();
//
// ErrorCheckForm
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.ClientSize = new System.Drawing.Size(406, 319);
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 = "ErrorCheckForm";
this.Opacity = 0;
this.ShowIcon = false;
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
this.Text = "Map Analysis";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.ErrorCheckForm_FormClosing);
this.ResumeLayout(false);
}
#endregion
}
}

View file

@ -0,0 +1,89 @@
#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.Diagnostics;
using CodeImp.DoomBuilder.Actions;
using CodeImp.DoomBuilder.Data;
using CodeImp.DoomBuilder.Config;
using CodeImp.DoomBuilder.Map;
using CodeImp.DoomBuilder.Controls;
using CodeImp.DoomBuilder.Windows;
using System.Reflection;
using System.Globalization;
#endregion
namespace CodeImp.DoomBuilder.BuilderModes
{
public partial class ErrorCheckForm : DelayedForm
{
#region ================== Constructor / Show
// Constructor
public ErrorCheckForm()
{
InitializeComponent();
}
// This shows the window
public void Show(Form owner)
{
// First time showing?
//if((this.Location.X == 0) && (this.Location.Y == 0))
{
// Position at left-top of owner
this.Location = new Point(owner.Location.X + 20, owner.Location.Y + 90);
}
// Close results part
//resultspanel.Visible = false;
//this.Size = new Size(this.Width, this.Height - this.ClientSize.Height + resultspanel.Top);
// Show window
base.Show(owner);
}
#endregion
#region ================== Events
// Window closing
private void ErrorCheckForm_FormClosing(object sender, FormClosingEventArgs e)
{
// If the user closes the form, then just cancel the mode
if(e.CloseReason == CloseReason.UserClosing)
{
e.Cancel = true;
General.Map.CancelMode();
}
}
#endregion
#region ================== Methods
#endregion
}
}

View 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>

View file

@ -257,3 +257,13 @@ makedoor
allowmouse = true;
allowscroll = true;
}
errorcheckmode
{
title = "Map Analysis Mode";
category = "modes";
description = "Checks your map for errors and mistakes and reports the results.";
allowkeys = true;
allowmouse = true;
allowscroll = true;
}