From 8229cb8b71397655074b471718482217b9db99ea Mon Sep 17 00:00:00 2001 From: MaxED Date: Mon, 10 Feb 2014 09:26:13 +0000 Subject: [PATCH] Added "Go To Coordinates" action (available in "View" menu and via Ctrl-Shift-G shortcut). It will center the view on given coordinates in classic modes and place camera at given coordinates in visual mode. --- Source/Core/Builder.csproj | 9 ++ Source/Core/Editing/ClassicMode.cs | 18 ++- Source/Core/Resources/Actions.cfg | 11 ++ Source/Core/VisualModes/VisualCamera.cs | 14 +- Source/Core/VisualModes/VisualMode.cs | 18 +++ .../CenterOnCoordinatesForm.Designer.cs | 134 ++++++++++++++++++ .../Core/Windows/CenterOnCoordinatesForm.cs | 31 ++++ .../Core/Windows/CenterOnCoordinatesForm.resx | 120 ++++++++++++++++ Source/Core/Windows/MainForm.Designer.cs | 47 +++--- Source/Core/Windows/MainForm.cs | 1 + Source/Core/Windows/MainForm.resx | 14 +- .../BuilderModes/ClassicModes/BridgeMode.cs | 8 +- .../ClassicModes/DrawCurveMode.cs | 35 ++++- .../ClassicModes/DrawEllipseMode.cs | 4 + .../BuilderModes/ClassicModes/DrawGridMode.cs | 4 + .../ClassicModes/DrawRectangleMode.cs | 4 + 16 files changed, 427 insertions(+), 45 deletions(-) create mode 100644 Source/Core/Windows/CenterOnCoordinatesForm.Designer.cs create mode 100644 Source/Core/Windows/CenterOnCoordinatesForm.cs create mode 100644 Source/Core/Windows/CenterOnCoordinatesForm.resx diff --git a/Source/Core/Builder.csproj b/Source/Core/Builder.csproj index 606c14bb..d6053873 100644 --- a/Source/Core/Builder.csproj +++ b/Source/Core/Builder.csproj @@ -812,6 +812,12 @@ + + Form + + + CenterOnCoordinatesForm.cs + Form @@ -1059,6 +1065,9 @@ Designer BitFlagsForm.cs + + CenterOnCoordinatesForm.cs + ChangeMapForm.cs diff --git a/Source/Core/Editing/ClassicMode.cs b/Source/Core/Editing/ClassicMode.cs index fb6a1a4d..5cbc1e6e 100644 --- a/Source/Core/Editing/ClassicMode.cs +++ b/Source/Core/Editing/ClassicMode.cs @@ -360,9 +360,9 @@ namespace CodeImp.DoomBuilder.Editing area.Inflate(area.Width * padding, area.Height * padding); // Calculate scale to view map at - scalew = (float)General.Map.Graphics.RenderTarget.ClientSize.Width / area.Width; - scaleh = (float)General.Map.Graphics.RenderTarget.ClientSize.Height / area.Height; - if(scalew < scaleh) scale = scalew; else scale = scaleh; + scalew = General.Map.Graphics.RenderTarget.ClientSize.Width / area.Width; + scaleh = General.Map.Graphics.RenderTarget.ClientSize.Height / area.Height; + scale = scalew < scaleh ? scalew : scaleh; // Change the view to see the whole map renderer2d.ScaleView(scale); @@ -850,6 +850,18 @@ namespace CodeImp.DoomBuilder.Editing SetViewMode(ViewMode.CeilingTextures); } + //mxd + [BeginAction("centeroncoordinates", BaseAction = true)] + protected virtual void CenterOnCoordinates() { + //show form... + CenterOnCoordinatesForm form = new CenterOnCoordinatesForm(); + if (form.ShowDialog() == DialogResult.OK) { + //center view + renderer2d.PositionView(form.Coordinates.x, form.Coordinates.y); + General.Interface.RedrawDisplay(); + } + } + #endregion } diff --git a/Source/Core/Resources/Actions.cfg b/Source/Core/Resources/Actions.cfg index 1fbbe729..1ca56d4a 100644 --- a/Source/Core/Resources/Actions.cfg +++ b/Source/Core/Resources/Actions.cfg @@ -1022,6 +1022,17 @@ toggleinfopanel allowscroll = false; } +centeroncoordinates +{ + title = "Go To Coordinates"; + category = "view"; + description = "Centers the view on given map coordinates."; + allowkeys = true; + allowmouse = false; + allowscroll = false; + default = 196679; //Ctrl-Shift-G +} + showerrors { title = "Show Errors and Warnings"; diff --git a/Source/Core/VisualModes/VisualCamera.cs b/Source/Core/VisualModes/VisualCamera.cs index 1f49d0a6..5b1123df 100644 --- a/Source/Core/VisualModes/VisualCamera.cs +++ b/Source/Core/VisualModes/VisualCamera.cs @@ -114,7 +114,7 @@ namespace CodeImp.DoomBuilder.VisualModes modething.DetermineSector(); float z = modething.Position.z; if(modething.Sector != null) - z = modething.Position.z + (float)modething.Sector.FloorHeight; + z = modething.Position.z + modething.Sector.FloorHeight; // Position camera here Vector3D wantedposition = new Vector3D(modething.Position.x, modething.Position.y, z + THING_Z_OFFSET); @@ -130,10 +130,8 @@ namespace CodeImp.DoomBuilder.VisualModes } return true; } - else - { - return false; - } + + return false; } // This applies the camera position and angle to the 3D Camera Thing @@ -158,10 +156,8 @@ namespace CodeImp.DoomBuilder.VisualModes modething.Rotate(anglexy - Angle2D.PI); return true; } - else - { - return false; - } + + return false; } //mxd diff --git a/Source/Core/VisualModes/VisualMode.cs b/Source/Core/VisualModes/VisualMode.cs index 8d39243e..be4674fb 100644 --- a/Source/Core/VisualModes/VisualMode.cs +++ b/Source/Core/VisualModes/VisualMode.cs @@ -18,6 +18,7 @@ using System; using System.Collections.Generic; +using System.Windows.Forms; using CodeImp.DoomBuilder.Windows; using CodeImp.DoomBuilder.Map; using CodeImp.DoomBuilder.Rendering; @@ -1108,6 +1109,23 @@ namespace CodeImp.DoomBuilder.VisualModes #region ================== Actions + //mxd + [BeginAction("centeroncoordinates", BaseAction = true)] + protected virtual void CenterOnCoordinates() { + //show form... + CenterOnCoordinatesForm form = new CenterOnCoordinatesForm(); + if(form.ShowDialog() == DialogResult.OK) { + Sector s = General.Map.Map.GetSectorByCoordinates(form.Coordinates); + + if (s == null) { + General.Map.VisualCamera.Position = form.Coordinates; + } else { + General.Map.VisualCamera.Position = new Vector3D(form.Coordinates.x, form.Coordinates.y, s.FloorHeight + 54); + } + General.Map.VisualCamera.Sector = s; + } + } + #endregion } } diff --git a/Source/Core/Windows/CenterOnCoordinatesForm.Designer.cs b/Source/Core/Windows/CenterOnCoordinatesForm.Designer.cs new file mode 100644 index 00000000..cfd302c4 --- /dev/null +++ b/Source/Core/Windows/CenterOnCoordinatesForm.Designer.cs @@ -0,0 +1,134 @@ +namespace CodeImp.DoomBuilder.Windows +{ + partial class CenterOnCoordinatesForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) { + if(disposing && (components != null)) { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() { + this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.accept = new System.Windows.Forms.Button(); + this.cancel = new System.Windows.Forms.Button(); + this.gotoy = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox(); + this.gotox = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox(); + this.SuspendLayout(); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(12, 17); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(17, 14); + this.label1.TabIndex = 0; + this.label1.Text = "X:"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(12, 47); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(17, 14); + this.label2.TabIndex = 1; + this.label2.Text = "Y:"; + // + // accept + // + this.accept.Location = new System.Drawing.Point(109, 12); + this.accept.Name = "accept"; + this.accept.Size = new System.Drawing.Size(65, 24); + this.accept.TabIndex = 2; + this.accept.Text = "OK"; + this.accept.UseVisualStyleBackColor = true; + this.accept.Click += new System.EventHandler(this.accept_Click); + // + // cancel + // + this.cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.cancel.Location = new System.Drawing.Point(109, 42); + this.cancel.Name = "cancel"; + this.cancel.Size = new System.Drawing.Size(65, 24); + this.cancel.TabIndex = 3; + this.cancel.Text = "Cancel"; + this.cancel.UseVisualStyleBackColor = true; + this.cancel.Click += new System.EventHandler(this.cancel_Click); + // + // gotoy + // + this.gotoy.AllowDecimal = false; + this.gotoy.AllowNegative = true; + this.gotoy.AllowRelative = false; + this.gotoy.ButtonStep = 1; + this.gotoy.ButtonStepFloat = 1F; + this.gotoy.Location = new System.Drawing.Point(32, 42); + this.gotoy.Name = "gotoy"; + this.gotoy.Size = new System.Drawing.Size(71, 24); + this.gotoy.StepValues = null; + this.gotoy.TabIndex = 1; + // + // gotox + // + this.gotox.AllowDecimal = false; + this.gotox.AllowNegative = true; + this.gotox.AllowRelative = false; + this.gotox.ButtonStep = 1; + this.gotox.ButtonStepFloat = 1F; + this.gotox.Location = new System.Drawing.Point(32, 12); + this.gotox.Name = "gotox"; + this.gotox.Size = new System.Drawing.Size(71, 24); + this.gotox.StepValues = null; + this.gotox.TabIndex = 0; + // + // CenterOnCoordinatesForm + // + this.AcceptButton = this.accept; + 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(184, 74); + this.Controls.Add(this.cancel); + this.Controls.Add(this.accept); + this.Controls.Add(this.label2); + this.Controls.Add(this.label1); + this.Controls.Add(this.gotoy); + this.Controls.Add(this.gotox); + this.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; + this.Name = "CenterOnCoordinatesForm"; + this.ShowInTaskbar = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "Go To Coordinates:"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox gotox; + private CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox gotoy; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Button accept; + private System.Windows.Forms.Button cancel; + } +} \ No newline at end of file diff --git a/Source/Core/Windows/CenterOnCoordinatesForm.cs b/Source/Core/Windows/CenterOnCoordinatesForm.cs new file mode 100644 index 00000000..991bd810 --- /dev/null +++ b/Source/Core/Windows/CenterOnCoordinatesForm.cs @@ -0,0 +1,31 @@ +using System; +using System.Windows.Forms; +using CodeImp.DoomBuilder.Geometry; + +namespace CodeImp.DoomBuilder.Windows +{ + public partial class CenterOnCoordinatesForm : Form + { + private static Vector2D coordinates; + public Vector2D Coordinates { get { return coordinates; } } + + public CenterOnCoordinatesForm() { + InitializeComponent(); + gotox.Text = coordinates.x.ToString(); + gotoy.Text = coordinates.y.ToString(); + } + + private void accept_Click(object sender, EventArgs e) { + coordinates.x = (float)Math.Round(General.Clamp(gotox.GetResult((int)coordinates.x), General.Map.FormatInterface.MinCoordinate, General.Map.FormatInterface.MaxCoordinate)); + coordinates.y = (float)Math.Round(General.Clamp(gotoy.GetResult((int)coordinates.y), General.Map.FormatInterface.MinCoordinate, General.Map.FormatInterface.MaxCoordinate)); + + this.DialogResult = DialogResult.OK; + this.Close(); + } + + private void cancel_Click(object sender, EventArgs e) { + this.DialogResult = DialogResult.Cancel; + this.Close(); + } + } +} diff --git a/Source/Core/Windows/CenterOnCoordinatesForm.resx b/Source/Core/Windows/CenterOnCoordinatesForm.resx new file mode 100644 index 00000000..ff31a6db --- /dev/null +++ b/Source/Core/Windows/CenterOnCoordinatesForm.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Source/Core/Windows/MainForm.Designer.cs b/Source/Core/Windows/MainForm.Designer.cs index 1e1a7a1d..6f567e37 100644 --- a/Source/Core/Windows/MainForm.Designer.cs +++ b/Source/Core/Windows/MainForm.Designer.cs @@ -190,6 +190,7 @@ namespace CodeImp.DoomBuilder.Windows this.seperatorviews = new System.Windows.Forms.ToolStripSeparator(); this.buttonsnaptogrid = new System.Windows.Forms.ToolStripButton(); this.buttonautomerge = new System.Windows.Forms.ToolStripButton(); + this.buttonautoclearsidetextures = new System.Windows.Forms.ToolStripButton(); this.seperatorgeometry = new System.Windows.Forms.ToolStripSeparator(); this.buttontogglefx = new System.Windows.Forms.ToolStripButton(); this.buttontoggledynlight = new System.Windows.Forms.ToolStripButton(); @@ -248,7 +249,7 @@ namespace CodeImp.DoomBuilder.Windows this.dockersspace = new System.Windows.Forms.Panel(); this.dockerspanel = new CodeImp.DoomBuilder.Controls.DockersControl(); this.dockerscollapser = new System.Windows.Forms.Timer(this.components); - this.buttonautoclearsidetextures = new System.Windows.Forms.ToolStripButton(); + this.menugotocoords = new System.Windows.Forms.ToolStripMenuItem(); toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); toolStripSeparator9 = new System.Windows.Forms.ToolStripSeparator(); toolStripSeparator12 = new System.Windows.Forms.ToolStripSeparator(); @@ -960,6 +961,7 @@ namespace CodeImp.DoomBuilder.Windows this.itemviewceilings, this.seperatorviewviews, this.menuzoom, + this.menugotocoords, this.itemfittoscreen, this.itemtoggleinfo, this.seperatorviewzoom, @@ -1041,7 +1043,7 @@ namespace CodeImp.DoomBuilder.Windows // item2zoom200 // this.item2zoom200.Name = "item2zoom200"; - this.item2zoom200.Size = new System.Drawing.Size(102, 22); + this.item2zoom200.Size = new System.Drawing.Size(152, 22); this.item2zoom200.Tag = "200"; this.item2zoom200.Text = "200%"; this.item2zoom200.Click += new System.EventHandler(this.itemzoomto_Click); @@ -1049,7 +1051,7 @@ namespace CodeImp.DoomBuilder.Windows // item2zoom100 // this.item2zoom100.Name = "item2zoom100"; - this.item2zoom100.Size = new System.Drawing.Size(102, 22); + this.item2zoom100.Size = new System.Drawing.Size(152, 22); this.item2zoom100.Tag = "100"; this.item2zoom100.Text = "100%"; this.item2zoom100.Click += new System.EventHandler(this.itemzoomto_Click); @@ -1057,7 +1059,7 @@ namespace CodeImp.DoomBuilder.Windows // item2zoom50 // this.item2zoom50.Name = "item2zoom50"; - this.item2zoom50.Size = new System.Drawing.Size(102, 22); + this.item2zoom50.Size = new System.Drawing.Size(152, 22); this.item2zoom50.Tag = "50"; this.item2zoom50.Text = "50%"; this.item2zoom50.Click += new System.EventHandler(this.itemzoomto_Click); @@ -1065,7 +1067,7 @@ namespace CodeImp.DoomBuilder.Windows // item2zoom25 // this.item2zoom25.Name = "item2zoom25"; - this.item2zoom25.Size = new System.Drawing.Size(102, 22); + this.item2zoom25.Size = new System.Drawing.Size(152, 22); this.item2zoom25.Tag = "25"; this.item2zoom25.Text = "25%"; this.item2zoom25.Click += new System.EventHandler(this.itemzoomto_Click); @@ -1073,7 +1075,7 @@ namespace CodeImp.DoomBuilder.Windows // item2zoom10 // this.item2zoom10.Name = "item2zoom10"; - this.item2zoom10.Size = new System.Drawing.Size(102, 22); + this.item2zoom10.Size = new System.Drawing.Size(152, 22); this.item2zoom10.Tag = "10"; this.item2zoom10.Text = "10%"; this.item2zoom10.Click += new System.EventHandler(this.itemzoomto_Click); @@ -1081,7 +1083,7 @@ namespace CodeImp.DoomBuilder.Windows // item2zoom5 // this.item2zoom5.Name = "item2zoom5"; - this.item2zoom5.Size = new System.Drawing.Size(102, 22); + this.item2zoom5.Size = new System.Drawing.Size(152, 22); this.item2zoom5.Tag = "5"; this.item2zoom5.Text = "5%"; this.item2zoom5.Click += new System.EventHandler(this.itemzoomto_Click); @@ -1709,6 +1711,19 @@ namespace CodeImp.DoomBuilder.Windows this.buttonautomerge.Text = "Merge Geometry"; this.buttonautomerge.Click += new System.EventHandler(this.InvokeTaggedAction); // + // buttonautoclearsidetextures + // + this.buttonautoclearsidetextures.Checked = true; + this.buttonautoclearsidetextures.CheckState = System.Windows.Forms.CheckState.Checked; + this.buttonautoclearsidetextures.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.buttonautoclearsidetextures.Image = global::CodeImp.DoomBuilder.Properties.Resources.ClearTextures; + this.buttonautoclearsidetextures.ImageTransparentColor = System.Drawing.Color.Magenta; + this.buttonautoclearsidetextures.Name = "buttonautoclearsidetextures"; + this.buttonautoclearsidetextures.Size = new System.Drawing.Size(23, 22); + this.buttonautoclearsidetextures.Tag = "builder_toggleautoclearsidetextures"; + this.buttonautoclearsidetextures.Text = "Auto Clear Sidedef Textures"; + this.buttonautoclearsidetextures.Click += new System.EventHandler(this.InvokeTaggedAction); + // // seperatorgeometry // this.seperatorgeometry.Name = "seperatorgeometry"; @@ -2310,18 +2325,13 @@ namespace CodeImp.DoomBuilder.Windows this.dockerscollapser.Interval = 200; this.dockerscollapser.Tick += new System.EventHandler(this.dockerscollapser_Tick); // - // buttonautoclearsidetextures + // menugotocoords // - this.buttonautoclearsidetextures.Checked = true; - this.buttonautoclearsidetextures.CheckState = System.Windows.Forms.CheckState.Checked; - this.buttonautoclearsidetextures.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this.buttonautoclearsidetextures.Image = global::CodeImp.DoomBuilder.Properties.Resources.ClearTextures; - this.buttonautoclearsidetextures.ImageTransparentColor = System.Drawing.Color.Magenta; - this.buttonautoclearsidetextures.Name = "buttonautoclearsidetextures"; - this.buttonautoclearsidetextures.Size = new System.Drawing.Size(23, 22); - this.buttonautoclearsidetextures.Tag = "builder_toggleautoclearsidetextures"; - this.buttonautoclearsidetextures.Text = "Auto Clear Sidedef Textures"; - this.buttonautoclearsidetextures.Click += new System.EventHandler(this.InvokeTaggedAction); + this.menugotocoords.Name = "menugotocoords"; + this.menugotocoords.Size = new System.Drawing.Size(209, 22); + this.menugotocoords.Tag = "builder_centeroncoordinates"; + this.menugotocoords.Text = "Go To Coordinates..."; + this.menugotocoords.Click += new System.EventHandler(this.InvokeTaggedAction); // // MainForm // @@ -2579,5 +2589,6 @@ namespace CodeImp.DoomBuilder.Windows private System.Windows.Forms.Label modename; private System.Windows.Forms.ToolStripMenuItem itemautoclearsidetextures; private System.Windows.Forms.ToolStripButton buttonautoclearsidetextures; + private System.Windows.Forms.ToolStripMenuItem menugotocoords; } } \ No newline at end of file diff --git a/Source/Core/Windows/MainForm.cs b/Source/Core/Windows/MainForm.cs index c9b39a3d..1818ae7c 100644 --- a/Source/Core/Windows/MainForm.cs +++ b/Source/Core/Windows/MainForm.cs @@ -2470,6 +2470,7 @@ namespace CodeImp.DoomBuilder.Windows itemscripteditor.Enabled = (General.Map != null); itemfittoscreen.Enabled = (General.Map != null); menuzoom.Enabled = (General.Map != null); + menugotocoords.Enabled = (General.Map != null); //mxd itemtoggleinfo.Checked = IsInfoPanelExpanded; // View mode items diff --git a/Source/Core/Windows/MainForm.resx b/Source/Core/Windows/MainForm.resx index d7b23b16..3855b399 100644 --- a/Source/Core/Windows/MainForm.resx +++ b/Source/Core/Windows/MainForm.resx @@ -154,18 +154,18 @@ iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 - YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAABcSURBVDhPY2AYBUMoBNyzl/8HORdGk+x0kMb8wvImGE19 - A0AmI2OYDchiOF2A7jxkPsggZI1YvYDPAJBmWOCR7AKYRpg3YAZgjQmYTeg0zAsgcWQ5GJvk2KC6BgDp - BYcfucB8fQAAAABJRU5ErkJggg== + YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAABaSURBVDhPYxgFQwm4Zy//j0yTDEAa8wvLm2A0VJh4QNAA + kAQyhgqjiOM0AF0SmQbJY5MDa4QBbBrRFWMTgwNCGmEYJgfCYI3IAKYBnQYBEBuGkflgyQEGDAwA6QWH + HxoHRHkAAAAASUVORK5CYII= iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 - YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAClSURBVDhPY2CgJnjdLnGRFIxiN0wjMQ7CUAsSAGmE0fgM - wVD7rkP6KykYZjjcMpBmDEEcTsCqllgD5igq/gepBdEo3iXFgKf1kr9ABuQXljeR7AWQRrwGgBQgY1gw - IIvhNADmLGw0yCCQk/G6AJ8BIM0gQwgasLzG/wW6QTCNMG/AvACLCbA3QbEAClGYTeg0zAsgcZABMLUw - dWADSMHE5BWS1AAACnwkE01c7eYAAAAASUVORK5CYII= + YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAACWSURBVDhPY6AqeN0ucZEUDNUGAVgFcQAMtTAOMQZgqH3X + If2VFAzWBAQoBoAZQEDIBRQZMEdR8T9ILYgG8cky4Gm95C8QnV9Y3kR9A0ASyBgsCQTIYjgNgAlio0Fq + YGyyDADRIHUgNl4Dltf4v8ClEYZhBoAwWDMIgAwAmQbTgE6DAIgNwiADYGrh8iADSMFgTdQDDAwACnwk + E7rnlAUAAAAASUVORK5CYII= diff --git a/Source/Plugins/BuilderModes/ClassicModes/BridgeMode.cs b/Source/Plugins/BuilderModes/ClassicModes/BridgeMode.cs index bc950f56..787a90e3 100644 --- a/Source/Plugins/BuilderModes/ClassicModes/BridgeMode.cs +++ b/Source/Plugins/BuilderModes/ClassicModes/BridgeMode.cs @@ -97,10 +97,10 @@ namespace CodeImp.DoomBuilder.BuilderModes.ClassicModes { //show form form = new BridgeModeForm(); - form.OnCancelClick += new EventHandler(form_OnCancelClick); - form.OnOkClick += new EventHandler(form_OnOkClick); - form.OnFlipClick += new EventHandler(form_OnFlipClick); - form.OnSubdivisionChanged += new EventHandler(form_OnSubdivisionChanged); + form.OnCancelClick += form_OnCancelClick; + form.OnOkClick += form_OnOkClick; + form.OnFlipClick += form_OnFlipClick; + form.OnSubdivisionChanged += form_OnSubdivisionChanged; form.Show(Form.ActiveForm); General.Interface.FocusDisplay(); diff --git a/Source/Plugins/BuilderModes/ClassicModes/DrawCurveMode.cs b/Source/Plugins/BuilderModes/ClassicModes/DrawCurveMode.cs index 27321c59..b2c7b6e6 100644 --- a/Source/Plugins/BuilderModes/ClassicModes/DrawCurveMode.cs +++ b/Source/Plugins/BuilderModes/ClassicModes/DrawCurveMode.cs @@ -1,4 +1,6 @@ -using System; +#region ================== Namespaces + +using System; using System.Collections.Generic; using System.Drawing; using System.Windows.Forms; @@ -9,6 +11,8 @@ using CodeImp.DoomBuilder.Map; using CodeImp.DoomBuilder.Rendering; using CodeImp.DoomBuilder.Windows; +#endregion + namespace CodeImp.DoomBuilder.BuilderModes { [EditMode(DisplayName = "Draw Curve Mode", @@ -19,12 +23,18 @@ namespace CodeImp.DoomBuilder.BuilderModes public class DrawCurveMode : DrawGeometryMode { + #region ================== Variables + private HintLabel hintLabel; private Curve curve; private static int segmentLength = 32; private int minSegmentLength = 16; private int maxSegmentLength = 4096; //just some arbitrary number + #endregion + + #region ================== Constructor/Disposer + public DrawCurveMode() { hintLabel = new HintLabel(); } @@ -36,6 +46,10 @@ namespace CodeImp.DoomBuilder.BuilderModes base.Dispose(); } + #endregion + + #region ================== Methods + protected override void Update() { PixelColor stitchcolor = General.Colors.Highlight; PixelColor losecolor = General.Colors.Selection; @@ -45,8 +59,7 @@ namespace CodeImp.DoomBuilder.BuilderModes snaptonearest = General.Interface.CtrlState ^ General.Interface.AutoMerge; DrawnVertex curp = GetCurrentPosition(); - float vsize = ((float)renderer.VertexSize + 1.0f) / renderer.Scale; - float vsizeborder = ((float)renderer.VertexSize + 3.0f) / renderer.Scale; + float vsize = (renderer.VertexSize + 1.0f) / renderer.Scale; // The last label's end must go to the mouse cursor if(labels.Count > 0) @@ -121,6 +134,10 @@ namespace CodeImp.DoomBuilder.BuilderModes renderer.Present(); } + #endregion + + #region ================== Events + public override void OnAccept() { Cursor.Current = Cursors.AppStarting; @@ -217,7 +234,14 @@ namespace CodeImp.DoomBuilder.BuilderModes General.Editing.ChangeMode(General.Editing.PreviousStableMode.Name); } - //ACTIONS + public override void OnHelp() { + General.ShowHelp("/gzdb/features/classic_modes/mode_drawcurve.html"); + } + + #endregion + + #region ================== Actions + [BeginAction("increasesubdivlevel")] protected virtual void increaseSubdivLevel() { if(segmentLength < maxSegmentLength) { @@ -241,5 +265,8 @@ namespace CodeImp.DoomBuilder.BuilderModes Update(); } } + + #endregion + } } diff --git a/Source/Plugins/BuilderModes/ClassicModes/DrawEllipseMode.cs b/Source/Plugins/BuilderModes/ClassicModes/DrawEllipseMode.cs index 1de76432..c95c6cf6 100644 --- a/Source/Plugins/BuilderModes/ClassicModes/DrawEllipseMode.cs +++ b/Source/Plugins/BuilderModes/ClassicModes/DrawEllipseMode.cs @@ -118,6 +118,10 @@ namespace CodeImp.DoomBuilder.BuilderModes Update(); } + public override void OnHelp() { + General.ShowHelp("/gzdb/features/classic_modes/mode_drawellipse.html"); + } + #endregion #region ================== Actions diff --git a/Source/Plugins/BuilderModes/ClassicModes/DrawGridMode.cs b/Source/Plugins/BuilderModes/ClassicModes/DrawGridMode.cs index 369e96eb..149ad898 100644 --- a/Source/Plugins/BuilderModes/ClassicModes/DrawGridMode.cs +++ b/Source/Plugins/BuilderModes/ClassicModes/DrawGridMode.cs @@ -139,6 +139,10 @@ namespace CodeImp.DoomBuilder.BuilderModes General.Editing.ChangeMode(General.Editing.PreviousStableMode.Name); } + public override void OnHelp() { + General.ShowHelp("/gzdb/features/classic_modes/mode_drawgrid.html"); + } + private void OptionsPanelOnValueChanged(object sender, EventArgs eventArgs) { triangulate = panel.Triangulate; horizontalSlices = panel.HorizontalSlices + 1; diff --git a/Source/Plugins/BuilderModes/ClassicModes/DrawRectangleMode.cs b/Source/Plugins/BuilderModes/ClassicModes/DrawRectangleMode.cs index 07ee38e7..6a0501cc 100644 --- a/Source/Plugins/BuilderModes/ClassicModes/DrawRectangleMode.cs +++ b/Source/Plugins/BuilderModes/ClassicModes/DrawRectangleMode.cs @@ -352,6 +352,10 @@ namespace CodeImp.DoomBuilder.BuilderModes General.Editing.ChangeMode(General.Editing.PreviousStableMode.Name); } + public override void OnHelp() { + General.ShowHelp("/gzdb/features/classic_modes/mode_drawrect.html"); + } + private void OptionsPanelOnValueChanged(object sender, EventArgs eventArgs) { bevelWidth = panel.BevelWidth; subdivisions = panel.Subdivisions;