mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-01-18 22:41:46 +00:00
Added vertex properties dialog
@ Fixed a visible ComboBox in the universal fields editor @ NumericTextbox now has the ability to use decimals (set property AllowDecimal to true)
This commit is contained in:
parent
fb9e7a1c69
commit
db3f23317f
11 changed files with 657 additions and 6 deletions
|
@ -682,6 +682,12 @@
|
|||
<DependentUpon>ScriptFindReplaceForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Windows\StatusInfo.cs" />
|
||||
<Compile Include="Windows\VertexEditForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Windows\VertexEditForm.Designer.cs">
|
||||
<DependentUpon>VertexEditForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="ZDoom\ActorStructure.cs" />
|
||||
<Compile Include="ZDoom\PatchStructure.cs" />
|
||||
<Compile Include="ZDoom\TexturesParser.cs" />
|
||||
|
@ -827,6 +833,10 @@
|
|||
<EmbeddedResource Include="Resources\Thing2D_2.png" />
|
||||
<EmbeddedResource Include="Resources\White.png" />
|
||||
<EmbeddedResource Include="Resources\Font.cfg" />
|
||||
<EmbeddedResource Include="Windows\VertexEditForm.resx">
|
||||
<SubType>Designer</SubType>
|
||||
<DependentUpon>VertexEditForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<PropertyGroup>
|
||||
<PreBuildEvent>"$(SolutionDir)VersionFromSVN.exe" "$(ProjectDir)Properties\AssemblyInfo.cs" -F 0 -M "Debug" "$(ConfigurationName)"
|
||||
|
|
|
@ -246,6 +246,24 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
{
|
||||
// Edit pressed in this mode
|
||||
editpressed = true;
|
||||
|
||||
// Highlighted item not selected?
|
||||
if(!highlighted.Selected)
|
||||
{
|
||||
// Make this the only selection
|
||||
General.Map.Map.ClearSelectedVertices();
|
||||
highlighted.Selected = true;
|
||||
General.Interface.RedrawDisplay();
|
||||
}
|
||||
|
||||
// Update display
|
||||
if(renderer.StartPlotter(false))
|
||||
{
|
||||
// Redraw highlight to show selection
|
||||
renderer.PlotVertex(highlighted, renderer.DetermineVertexColor(highlighted));
|
||||
renderer.Finish();
|
||||
renderer.Present();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -315,6 +333,28 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
// Done editing
|
||||
protected override void OnEditEnd()
|
||||
{
|
||||
// Edit pressed in this mode?
|
||||
if(editpressed)
|
||||
{
|
||||
// Anything selected?
|
||||
ICollection<Vertex> selected = General.Map.Map.GetSelectedVertices(true);
|
||||
if(selected.Count > 0)
|
||||
{
|
||||
if(General.Interface.IsActiveWindow)
|
||||
{
|
||||
// Show line edit dialog
|
||||
General.Interface.ShowEditVertices(selected);
|
||||
General.Map.Map.Update();
|
||||
|
||||
// When a single vertex was selected, deselect it now
|
||||
if(selected.Count == 1) General.Map.Map.ClearSelectedVertices();
|
||||
|
||||
// Update entire display
|
||||
General.Interface.RedrawDisplay();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
editpressed = false;
|
||||
base.OnEditEnd();
|
||||
}
|
||||
|
|
|
@ -123,7 +123,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
{
|
||||
List<Vertex> vertices = new List<Vertex>(selection.Length);
|
||||
foreach(FindReplaceObject o in selection) vertices.Add(o.Vertex);
|
||||
// TODO: General.Interface.ShowEditVertices(vertices);
|
||||
General.Interface.ShowEditVertices(vertices);
|
||||
General.Map.Map.Update();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
|
@ -61,6 +61,7 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
public FieldsEditorControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
enumscombo.Visible = false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
|
@ -42,6 +42,7 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
|
||||
private bool allownegative = false; // Allow negative numbers
|
||||
private bool allowrelative = false; // Allow ++ and -- prefix for relative changes
|
||||
private bool allowdecimal = false; // Allow decimal (float) numbers
|
||||
private bool controlpressed = false;
|
||||
|
||||
#endregion
|
||||
|
@ -50,6 +51,7 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
|
||||
public bool AllowNegative { get { return allownegative; } set { allownegative = value; } }
|
||||
public bool AllowRelative { get { return allowrelative; } set { allowrelative = value; } }
|
||||
public bool AllowDecimal { get { return allowdecimal; } set { allowdecimal = value; } }
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -90,9 +92,10 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
char otherprefix;
|
||||
|
||||
// Determine allowed chars
|
||||
if(allownegative) allowedchars += "-";
|
||||
if(allownegative) allowedchars += CultureInfo.CurrentUICulture.NumberFormat.NegativeSign;
|
||||
if(allowrelative) allowedchars += "+-";
|
||||
if(controlpressed) allowedchars += "\u0018\u0003\u0016";
|
||||
if(allowdecimal) allowedchars += CultureInfo.CurrentUICulture.NumberFormat.CurrencyDecimalSeparator;
|
||||
|
||||
// Check if key is not allowed
|
||||
if(allowedchars.IndexOf(e.KeyChar) == -1)
|
||||
|
@ -169,7 +172,7 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
|
||||
// Strip prefixes
|
||||
textpart = textpart.Replace("+", "");
|
||||
textpart = textpart.Replace("-", "");
|
||||
if(!allownegative) textpart = textpart.Replace("-", "");
|
||||
|
||||
// No numbers left?
|
||||
if(textpart.Length == 0)
|
||||
|
@ -186,11 +189,11 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
public int GetResult(int original)
|
||||
{
|
||||
string textpart = this.Text;
|
||||
int result = 0;
|
||||
int result;
|
||||
|
||||
// Strip prefixes
|
||||
textpart = textpart.Replace("+", "");
|
||||
textpart = textpart.Replace("-", "");
|
||||
if(!allownegative) textpart = textpart.Replace("-", "");
|
||||
|
||||
// Any numbers left?
|
||||
if(textpart.Length > 0)
|
||||
|
@ -212,7 +215,47 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
else
|
||||
{
|
||||
// Return the new value
|
||||
if(int.TryParse(this.Text, out result)) return result; else return 0;
|
||||
return int.TryParse(this.Text, out result) ? result : 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Nothing given, keep original value
|
||||
return original;
|
||||
}
|
||||
}
|
||||
|
||||
// This determines the result value
|
||||
public float GetResultFloat(float original)
|
||||
{
|
||||
string textpart = this.Text;
|
||||
float result;
|
||||
|
||||
// Strip prefixes
|
||||
textpart = textpart.Replace("+", "");
|
||||
if(!allownegative) textpart = textpart.Replace("-", "");
|
||||
|
||||
// Any numbers left?
|
||||
if(textpart.Length > 0)
|
||||
{
|
||||
// Prefixed with ++?
|
||||
if(this.Text.StartsWith("++"))
|
||||
{
|
||||
// Add number to original
|
||||
if(!float.TryParse(textpart, out result)) result = 0;
|
||||
return original + result;
|
||||
}
|
||||
// Prefixed with --?
|
||||
else if(this.Text.StartsWith("--"))
|
||||
{
|
||||
// Subtract number from original
|
||||
if(!float.TryParse(textpart, out result)) result = 0;
|
||||
return original - result;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Return the new value
|
||||
return float.TryParse(this.Text, out result) ? result : 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
@ -57,6 +57,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
void DisplayStatus(StatusType type, string message);
|
||||
void DisplayStatus(StatusInfo newstatus);
|
||||
void RedrawDisplay();
|
||||
DialogResult ShowEditVertices(ICollection<Vertex> vertices);
|
||||
DialogResult ShowEditLinedefs(ICollection<Linedef> lines);
|
||||
DialogResult ShowEditSectors(ICollection<Sector> sectors);
|
||||
DialogResult ShowEditThings(ICollection<Thing> things);
|
||||
|
|
|
@ -2139,6 +2139,20 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
{
|
||||
return EffectBrowserForm.BrowseEffect(owner, initialvalue);
|
||||
}
|
||||
|
||||
// This shows the dialog to edit vertices
|
||||
public DialogResult ShowEditVertices(ICollection<Vertex> vertices)
|
||||
{
|
||||
DialogResult result;
|
||||
|
||||
// Show sector edit dialog
|
||||
VertexEditForm f = new VertexEditForm();
|
||||
f.Setup(vertices);
|
||||
result = f.ShowDialog(this);
|
||||
f.Dispose();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// This shows the dialog to edit lines
|
||||
public DialogResult ShowEditLinedefs(ICollection<Linedef> lines)
|
||||
|
|
|
@ -129,6 +129,9 @@
|
|||
<metadata name="taglabel.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
<metadata name="taglabel.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
<metadata name="groupeffect.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
|
@ -138,6 +141,12 @@
|
|||
<metadata name="label8.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
<metadata name="label9.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
<metadata name="label8.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
<metadata name="groupfloorceiling.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
|
@ -153,4 +162,16 @@
|
|||
<metadata name="label6.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
<metadata name="label5.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
<metadata name="label2.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
<metadata name="label4.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
<metadata name="label6.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
</root>
|
221
Source/Windows/VertexEditForm.Designer.cs
generated
Normal file
221
Source/Windows/VertexEditForm.Designer.cs
generated
Normal file
|
@ -0,0 +1,221 @@
|
|||
namespace CodeImp.DoomBuilder.Windows
|
||||
{
|
||||
partial class VertexEditForm
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
System.Windows.Forms.TabPage tabproperties;
|
||||
System.Windows.Forms.Label label1;
|
||||
System.Windows.Forms.Label label6;
|
||||
this.groupposition = new System.Windows.Forms.GroupBox();
|
||||
this.positiony = new CodeImp.DoomBuilder.Controls.NumericTextbox();
|
||||
this.positionx = new CodeImp.DoomBuilder.Controls.NumericTextbox();
|
||||
this.tabs = new System.Windows.Forms.TabControl();
|
||||
this.tabcustom = new System.Windows.Forms.TabPage();
|
||||
this.fieldslist = new CodeImp.DoomBuilder.Controls.FieldsEditorControl();
|
||||
this.cancel = new System.Windows.Forms.Button();
|
||||
this.apply = new System.Windows.Forms.Button();
|
||||
tabproperties = new System.Windows.Forms.TabPage();
|
||||
label1 = new System.Windows.Forms.Label();
|
||||
label6 = new System.Windows.Forms.Label();
|
||||
tabproperties.SuspendLayout();
|
||||
this.groupposition.SuspendLayout();
|
||||
this.tabs.SuspendLayout();
|
||||
this.tabcustom.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// tabproperties
|
||||
//
|
||||
tabproperties.Controls.Add(this.groupposition);
|
||||
tabproperties.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
tabproperties.Location = new System.Drawing.Point(4, 23);
|
||||
tabproperties.Name = "tabproperties";
|
||||
tabproperties.Padding = new System.Windows.Forms.Padding(3);
|
||||
tabproperties.Size = new System.Drawing.Size(428, 206);
|
||||
tabproperties.TabIndex = 0;
|
||||
tabproperties.Text = "Properties";
|
||||
tabproperties.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// groupposition
|
||||
//
|
||||
this.groupposition.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.groupposition.Controls.Add(label1);
|
||||
this.groupposition.Controls.Add(this.positiony);
|
||||
this.groupposition.Controls.Add(label6);
|
||||
this.groupposition.Controls.Add(this.positionx);
|
||||
this.groupposition.Location = new System.Drawing.Point(7, 6);
|
||||
this.groupposition.Name = "groupposition";
|
||||
this.groupposition.Size = new System.Drawing.Size(415, 194);
|
||||
this.groupposition.TabIndex = 24;
|
||||
this.groupposition.TabStop = false;
|
||||
this.groupposition.Text = " Position ";
|
||||
//
|
||||
// label1
|
||||
//
|
||||
label1.AutoSize = true;
|
||||
label1.Location = new System.Drawing.Point(188, 39);
|
||||
label1.Name = "label1";
|
||||
label1.Size = new System.Drawing.Size(18, 14);
|
||||
label1.TabIndex = 23;
|
||||
label1.Text = "Y:";
|
||||
//
|
||||
// positiony
|
||||
//
|
||||
this.positiony.AllowDecimal = false;
|
||||
this.positiony.AllowNegative = true;
|
||||
this.positiony.AllowRelative = true;
|
||||
this.positiony.ImeMode = System.Windows.Forms.ImeMode.Off;
|
||||
this.positiony.Location = new System.Drawing.Point(211, 36);
|
||||
this.positiony.Name = "positiony";
|
||||
this.positiony.Size = new System.Drawing.Size(95, 20);
|
||||
this.positiony.TabIndex = 22;
|
||||
//
|
||||
// label6
|
||||
//
|
||||
label6.AutoSize = true;
|
||||
label6.Location = new System.Drawing.Point(45, 39);
|
||||
label6.Name = "label6";
|
||||
label6.Size = new System.Drawing.Size(17, 14);
|
||||
label6.TabIndex = 21;
|
||||
label6.Text = "X:";
|
||||
//
|
||||
// positionx
|
||||
//
|
||||
this.positionx.AllowDecimal = false;
|
||||
this.positionx.AllowNegative = true;
|
||||
this.positionx.AllowRelative = true;
|
||||
this.positionx.ImeMode = System.Windows.Forms.ImeMode.Off;
|
||||
this.positionx.Location = new System.Drawing.Point(68, 36);
|
||||
this.positionx.Name = "positionx";
|
||||
this.positionx.Size = new System.Drawing.Size(95, 20);
|
||||
this.positionx.TabIndex = 20;
|
||||
//
|
||||
// tabs
|
||||
//
|
||||
this.tabs.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.tabs.Controls.Add(tabproperties);
|
||||
this.tabs.Controls.Add(this.tabcustom);
|
||||
this.tabs.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.tabs.Location = new System.Drawing.Point(10, 10);
|
||||
this.tabs.Margin = new System.Windows.Forms.Padding(1);
|
||||
this.tabs.Name = "tabs";
|
||||
this.tabs.SelectedIndex = 0;
|
||||
this.tabs.Size = new System.Drawing.Size(436, 233);
|
||||
this.tabs.SizeMode = System.Windows.Forms.TabSizeMode.Fixed;
|
||||
this.tabs.TabIndex = 0;
|
||||
//
|
||||
// tabcustom
|
||||
//
|
||||
this.tabcustom.Controls.Add(this.fieldslist);
|
||||
this.tabcustom.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.tabcustom.Location = new System.Drawing.Point(4, 23);
|
||||
this.tabcustom.Name = "tabcustom";
|
||||
this.tabcustom.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.tabcustom.Size = new System.Drawing.Size(428, 206);
|
||||
this.tabcustom.TabIndex = 1;
|
||||
this.tabcustom.Text = "Custom";
|
||||
this.tabcustom.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// fieldslist
|
||||
//
|
||||
this.fieldslist.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.fieldslist.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
|
||||
this.fieldslist.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.fieldslist.Location = new System.Drawing.Point(11, 11);
|
||||
this.fieldslist.Margin = new System.Windows.Forms.Padding(8);
|
||||
this.fieldslist.Name = "fieldslist";
|
||||
this.fieldslist.Size = new System.Drawing.Size(406, 187);
|
||||
this.fieldslist.TabIndex = 2;
|
||||
//
|
||||
// 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(334, 259);
|
||||
this.cancel.Name = "cancel";
|
||||
this.cancel.Size = new System.Drawing.Size(112, 25);
|
||||
this.cancel.TabIndex = 21;
|
||||
this.cancel.Text = "Cancel";
|
||||
this.cancel.UseVisualStyleBackColor = true;
|
||||
this.cancel.Click += new System.EventHandler(this.cancel_Click);
|
||||
//
|
||||
// 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(215, 259);
|
||||
this.apply.Name = "apply";
|
||||
this.apply.Size = new System.Drawing.Size(112, 25);
|
||||
this.apply.TabIndex = 20;
|
||||
this.apply.Text = "OK";
|
||||
this.apply.UseVisualStyleBackColor = true;
|
||||
this.apply.Click += new System.EventHandler(this.apply_Click);
|
||||
//
|
||||
// VertexEditForm
|
||||
//
|
||||
this.AcceptButton = this.apply;
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
|
||||
this.CancelButton = this.cancel;
|
||||
this.ClientSize = new System.Drawing.Size(456, 294);
|
||||
this.Controls.Add(this.cancel);
|
||||
this.Controls.Add(this.apply);
|
||||
this.Controls.Add(this.tabs);
|
||||
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 = "VertexEditForm";
|
||||
this.Opacity = 0;
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "Edit Vertex";
|
||||
tabproperties.ResumeLayout(false);
|
||||
this.groupposition.ResumeLayout(false);
|
||||
this.groupposition.PerformLayout();
|
||||
this.tabs.ResumeLayout(false);
|
||||
this.tabcustom.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.TabControl tabs;
|
||||
private System.Windows.Forms.TabPage tabcustom;
|
||||
private System.Windows.Forms.Button cancel;
|
||||
private System.Windows.Forms.Button apply;
|
||||
private CodeImp.DoomBuilder.Controls.FieldsEditorControl fieldslist;
|
||||
private CodeImp.DoomBuilder.Controls.NumericTextbox positiony;
|
||||
private System.Windows.Forms.GroupBox groupposition;
|
||||
private CodeImp.DoomBuilder.Controls.NumericTextbox positionx;
|
||||
}
|
||||
}
|
164
Source/Windows/VertexEditForm.cs
Normal file
164
Source/Windows/VertexEditForm.cs
Normal file
|
@ -0,0 +1,164 @@
|
|||
|
||||
#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.Geometry;
|
||||
using CodeImp.DoomBuilder.Map;
|
||||
using CodeImp.DoomBuilder.Data;
|
||||
using CodeImp.DoomBuilder.IO;
|
||||
using System.IO;
|
||||
using CodeImp.DoomBuilder.Config;
|
||||
using CodeImp.DoomBuilder.Editing;
|
||||
using CodeImp.DoomBuilder.Controls;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace CodeImp.DoomBuilder.Windows
|
||||
{
|
||||
public partial class VertexEditForm : DelayedForm
|
||||
{
|
||||
#region ================== Constants
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Variables
|
||||
|
||||
private ICollection<Vertex> vertices;
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Properties
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Constructor
|
||||
|
||||
// Constructor
|
||||
public VertexEditForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
// Fill universal fields list
|
||||
fieldslist.ListFixedFields(General.Map.Config.VertexFields);
|
||||
|
||||
// Not a UDMF map?
|
||||
if(!General.Map.IsType(typeof(UniversalMapSetIO)))
|
||||
{
|
||||
tabs.TabPages.Remove(tabcustom);
|
||||
}
|
||||
|
||||
// Decimals allowed?
|
||||
if(General.Map.FormatInterface.VertexDecimals > 0)
|
||||
{
|
||||
positionx.AllowDecimal = true;
|
||||
positiony.AllowDecimal = true;
|
||||
}
|
||||
|
||||
// Initialize custom fields editor
|
||||
fieldslist.Setup("vertex");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Methods
|
||||
|
||||
// This sets up the form to edit the given vertices
|
||||
public void Setup(ICollection<Vertex> vertices)
|
||||
{
|
||||
// Keep this list
|
||||
this.vertices = vertices;
|
||||
if(vertices.Count > 1) this.Text = "Edit Vertices (" + vertices.Count + ")";
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// Set all options to the first vertex properties
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Get first vertex
|
||||
Vertex vc = General.GetByIndex(vertices, 0);
|
||||
|
||||
// Position
|
||||
positionx.Text = vc.Position.x.ToString();
|
||||
positiony.Text = vc.Position.y.ToString();
|
||||
|
||||
// Custom fields
|
||||
fieldslist.SetValues(vc.Fields, true);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// Now go for all sectors and change the options when a setting is different
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Go for all vertices
|
||||
foreach(Vertex v in vertices)
|
||||
{
|
||||
// Position
|
||||
if(positionx.Text != v.Position.x.ToString()) positionx.Text = "";
|
||||
if(positiony.Text != v.Position.y.ToString()) positiony.Text = "";
|
||||
|
||||
// Custom fields
|
||||
fieldslist.SetValues(v.Fields, false);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Events
|
||||
|
||||
// OK clicked
|
||||
private void apply_Click(object sender, EventArgs e)
|
||||
{
|
||||
string undodesc = "vertex";
|
||||
|
||||
// Make undo
|
||||
if(vertices.Count > 1) undodesc = vertices.Count + " vertices";
|
||||
General.Map.UndoRedo.CreateUndo("Edit " + undodesc);
|
||||
|
||||
// Go for all vertices
|
||||
foreach(Vertex v in vertices)
|
||||
{
|
||||
// Apply position
|
||||
Vector2D p = new Vector2D();
|
||||
p.x = positionx.GetResultFloat(v.Position.x);
|
||||
p.y = positiony.GetResultFloat(v.Position.y);
|
||||
v.Move(p);
|
||||
|
||||
// Custom fields
|
||||
fieldslist.Apply(v.Fields);
|
||||
}
|
||||
|
||||
// Done
|
||||
General.Map.IsChanged = true;
|
||||
this.DialogResult = DialogResult.OK;
|
||||
this.Close();
|
||||
}
|
||||
|
||||
// Cancel clicked
|
||||
private void cancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
// Just close
|
||||
this.DialogResult = DialogResult.Cancel;
|
||||
this.Close();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
135
Source/Windows/VertexEditForm.resx
Normal file
135
Source/Windows/VertexEditForm.resx
Normal file
|
@ -0,0 +1,135 @@
|
|||
<?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="tabproperties.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
<metadata name="label1.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
<metadata name="label6.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
<metadata name="label1.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
<metadata name="label6.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
</root>
|
Loading…
Reference in a new issue