From 123167461de1ee2070cc6ebe3875585c34a6bb2b Mon Sep 17 00:00:00 2001 From: codeimp Date: Sun, 12 Jul 2009 11:14:34 +0000 Subject: [PATCH] Added option to drag automatically (without having to press the mouse button) when pasting --- .../ClassicModes/EditSelectionMode.cs | 6 ++- .../BuilderModes/General/BuilderPlug.cs | 3 ++ .../Interface/PreferencesForm.Designer.cs | 45 ++++++++++++------- .../BuilderModes/Interface/PreferencesForm.cs | 2 + .../Interface/PreferencesForm.resx | 3 ++ 5 files changed, 41 insertions(+), 18 deletions(-) diff --git a/Source/Plugins/BuilderModes/ClassicModes/EditSelectionMode.cs b/Source/Plugins/BuilderModes/ClassicModes/EditSelectionMode.cs index ae491a22..6cb81aae 100644 --- a/Source/Plugins/BuilderModes/ClassicModes/EditSelectionMode.cs +++ b/Source/Plugins/BuilderModes/ClassicModes/EditSelectionMode.cs @@ -799,7 +799,7 @@ namespace CodeImp.DoomBuilder.BuilderModes Update(); // When pasting and mouse is in screen, drag selection immediately - //if(pasting && mouseinside) OnSelect(); + if(pasting && mouseinside && BuilderPlug.Me.AutoDragOnPaste) OnSelectBegin(); } else { @@ -1138,7 +1138,9 @@ namespace CodeImp.DoomBuilder.BuilderModes protected override void OnSelectBegin() { base.OnSelectBegin(); - + + if(mode != ModifyMode.None) return; + // Used in many cases: Vector2D center = offset + size * 0.5f; Vector2D delta; diff --git a/Source/Plugins/BuilderModes/General/BuilderPlug.cs b/Source/Plugins/BuilderModes/General/BuilderPlug.cs index 7369ff17..633282ce 100644 --- a/Source/Plugins/BuilderModes/General/BuilderPlug.cs +++ b/Source/Plugins/BuilderModes/General/BuilderPlug.cs @@ -79,6 +79,7 @@ namespace CodeImp.DoomBuilder.BuilderModes private float highlightthingsrange; private float splitlinedefsrange; private bool usehighlight; + private bool autodragonpaste; #endregion @@ -114,6 +115,7 @@ namespace CodeImp.DoomBuilder.BuilderModes public float HighlightThingsRange { get { return highlightthingsrange; } } public float SplitLinedefsRange { get { return splitlinedefsrange; } } public bool UseHighlight { get { return usehighlight; } set { usehighlight = value; } } + public bool AutoDragOnPaste { get { return autodragonpaste; } set { autodragonpaste = value; } } #endregion @@ -186,6 +188,7 @@ namespace CodeImp.DoomBuilder.BuilderModes highlightrange = (float)General.Settings.ReadPluginSetting("highlightrange", 20); highlightthingsrange = (float)General.Settings.ReadPluginSetting("highlightthingsrange", 10); splitlinedefsrange = (float)General.Settings.ReadPluginSetting("splitlinedefsrange", 10); + autodragonpaste = General.Settings.ReadPluginSetting("autodragonpaste", false); } #endregion diff --git a/Source/Plugins/BuilderModes/Interface/PreferencesForm.Designer.cs b/Source/Plugins/BuilderModes/Interface/PreferencesForm.Designer.cs index 18fd3455..cbf25e32 100644 --- a/Source/Plugins/BuilderModes/Interface/PreferencesForm.Designer.cs +++ b/Source/Plugins/BuilderModes/Interface/PreferencesForm.Designer.cs @@ -52,6 +52,7 @@ namespace CodeImp.DoomBuilder.BuilderModes this.groupBox1 = new System.Windows.Forms.GroupBox(); this.label1 = new System.Windows.Forms.Label(); this.heightbysidedef = new System.Windows.Forms.ComboBox(); + this.autodragonpaste = new System.Windows.Forms.CheckBox(); this.tabs.SuspendLayout(); this.taboptions.SuspendLayout(); this.groupBox3.SuspendLayout(); @@ -88,6 +89,7 @@ namespace CodeImp.DoomBuilder.BuilderModes // // groupBox3 // + this.groupBox3.Controls.Add(this.autodragonpaste); this.groupBox3.Controls.Add(this.visualmodeclearselection); this.groupBox3.Controls.Add(this.autoclearselection); this.groupBox3.Controls.Add(this.editnewthing); @@ -103,7 +105,7 @@ namespace CodeImp.DoomBuilder.BuilderModes // visualmodeclearselection // this.visualmodeclearselection.AutoSize = true; - this.visualmodeclearselection.Location = new System.Drawing.Point(23, 161); + this.visualmodeclearselection.Location = new System.Drawing.Point(23, 137); this.visualmodeclearselection.Name = "visualmodeclearselection"; this.visualmodeclearselection.Size = new System.Drawing.Size(220, 18); this.visualmodeclearselection.TabIndex = 5; @@ -113,7 +115,7 @@ namespace CodeImp.DoomBuilder.BuilderModes // autoclearselection // this.autoclearselection.AutoSize = true; - this.autoclearselection.Location = new System.Drawing.Point(23, 129); + this.autoclearselection.Location = new System.Drawing.Point(23, 111); this.autoclearselection.Name = "autoclearselection"; this.autoclearselection.Size = new System.Drawing.Size(231, 18); this.autoclearselection.TabIndex = 4; @@ -133,7 +135,7 @@ namespace CodeImp.DoomBuilder.BuilderModes // editnewsector // this.editnewsector.AutoSize = true; - this.editnewsector.Location = new System.Drawing.Point(23, 65); + this.editnewsector.Location = new System.Drawing.Point(23, 59); this.editnewsector.Name = "editnewsector"; this.editnewsector.Size = new System.Drawing.Size(271, 18); this.editnewsector.TabIndex = 2; @@ -143,7 +145,7 @@ namespace CodeImp.DoomBuilder.BuilderModes // additiveselect // this.additiveselect.AutoSize = true; - this.additiveselect.Location = new System.Drawing.Point(23, 97); + this.additiveselect.Location = new System.Drawing.Point(23, 85); this.additiveselect.Name = "additiveselect"; this.additiveselect.Size = new System.Drawing.Size(211, 18); this.additiveselect.TabIndex = 3; @@ -177,7 +179,7 @@ namespace CodeImp.DoomBuilder.BuilderModes this.splitlinedefsrange.AllowNegative = false; this.splitlinedefsrange.AllowRelative = false; this.splitlinedefsrange.ButtonStep = 5; - this.splitlinedefsrange.Location = new System.Drawing.Point(167, 149); + this.splitlinedefsrange.Location = new System.Drawing.Point(167, 152); this.splitlinedefsrange.Name = "splitlinedefsrange"; this.splitlinedefsrange.Size = new System.Drawing.Size(59, 24); this.splitlinedefsrange.StepValues = null; @@ -189,7 +191,7 @@ namespace CodeImp.DoomBuilder.BuilderModes this.stitchrange.AllowNegative = false; this.stitchrange.AllowRelative = false; this.stitchrange.ButtonStep = 5; - this.stitchrange.Location = new System.Drawing.Point(167, 109); + this.stitchrange.Location = new System.Drawing.Point(167, 112); this.stitchrange.Name = "stitchrange"; this.stitchrange.Size = new System.Drawing.Size(59, 24); this.stitchrange.StepValues = null; @@ -201,7 +203,7 @@ namespace CodeImp.DoomBuilder.BuilderModes this.highlightthingsrange.AllowNegative = false; this.highlightthingsrange.AllowRelative = false; this.highlightthingsrange.ButtonStep = 5; - this.highlightthingsrange.Location = new System.Drawing.Point(167, 69); + this.highlightthingsrange.Location = new System.Drawing.Point(167, 72); this.highlightthingsrange.Name = "highlightthingsrange"; this.highlightthingsrange.Size = new System.Drawing.Size(59, 24); this.highlightthingsrange.StepValues = null; @@ -213,7 +215,7 @@ namespace CodeImp.DoomBuilder.BuilderModes this.highlightrange.AllowNegative = false; this.highlightrange.AllowRelative = false; this.highlightrange.ButtonStep = 5; - this.highlightrange.Location = new System.Drawing.Point(167, 29); + this.highlightrange.Location = new System.Drawing.Point(167, 32); this.highlightrange.Name = "highlightrange"; this.highlightrange.Size = new System.Drawing.Size(59, 24); this.highlightrange.StepValues = null; @@ -222,7 +224,7 @@ namespace CodeImp.DoomBuilder.BuilderModes // label8 // this.label8.AutoSize = true; - this.label8.Location = new System.Drawing.Point(232, 154); + this.label8.Location = new System.Drawing.Point(232, 157); this.label8.Name = "label8"; this.label8.Size = new System.Drawing.Size(35, 14); this.label8.TabIndex = 15; @@ -231,7 +233,7 @@ namespace CodeImp.DoomBuilder.BuilderModes // label2 // this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(33, 114); + this.label2.Location = new System.Drawing.Point(33, 117); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(117, 14); this.label2.TabIndex = 4; @@ -241,7 +243,7 @@ namespace CodeImp.DoomBuilder.BuilderModes // label3 // this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(232, 114); + this.label3.Location = new System.Drawing.Point(232, 117); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(35, 14); this.label3.TabIndex = 6; @@ -250,7 +252,7 @@ namespace CodeImp.DoomBuilder.BuilderModes // label9 // this.label9.AutoSize = true; - this.label9.Location = new System.Drawing.Point(47, 154); + this.label9.Location = new System.Drawing.Point(47, 157); this.label9.Name = "label9"; this.label9.Size = new System.Drawing.Size(103, 14); this.label9.TabIndex = 13; @@ -260,7 +262,7 @@ namespace CodeImp.DoomBuilder.BuilderModes // label5 // this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point(20, 34); + this.label5.Location = new System.Drawing.Point(20, 37); this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size(130, 14); this.label5.TabIndex = 7; @@ -270,7 +272,7 @@ namespace CodeImp.DoomBuilder.BuilderModes // label6 // this.label6.AutoSize = true; - this.label6.Location = new System.Drawing.Point(232, 74); + this.label6.Location = new System.Drawing.Point(232, 77); this.label6.Name = "label6"; this.label6.Size = new System.Drawing.Size(35, 14); this.label6.TabIndex = 12; @@ -279,7 +281,7 @@ namespace CodeImp.DoomBuilder.BuilderModes // label4 // this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(232, 34); + this.label4.Location = new System.Drawing.Point(232, 37); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(35, 14); this.label4.TabIndex = 9; @@ -288,7 +290,7 @@ namespace CodeImp.DoomBuilder.BuilderModes // label7 // this.label7.AutoSize = true; - this.label7.Location = new System.Drawing.Point(36, 74); + this.label7.Location = new System.Drawing.Point(36, 77); this.label7.Name = "label7"; this.label7.Size = new System.Drawing.Size(114, 14); this.label7.TabIndex = 10; @@ -330,6 +332,16 @@ namespace CodeImp.DoomBuilder.BuilderModes this.heightbysidedef.Size = new System.Drawing.Size(199, 22); this.heightbysidedef.TabIndex = 0; // + // autodragonpaste + // + this.autodragonpaste.AutoSize = true; + this.autodragonpaste.Location = new System.Drawing.Point(23, 163); + this.autodragonpaste.Name = "autodragonpaste"; + this.autodragonpaste.Size = new System.Drawing.Size(205, 18); + this.autodragonpaste.TabIndex = 6; + this.autodragonpaste.Text = "Drag selection automatically on paste"; + this.autodragonpaste.UseVisualStyleBackColor = true; + // // PreferencesForm // this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); @@ -380,5 +392,6 @@ namespace CodeImp.DoomBuilder.BuilderModes private CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox stitchrange; private CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox highlightthingsrange; private CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox highlightrange; + private System.Windows.Forms.CheckBox autodragonpaste; } } \ No newline at end of file diff --git a/Source/Plugins/BuilderModes/Interface/PreferencesForm.cs b/Source/Plugins/BuilderModes/Interface/PreferencesForm.cs index f2d31580..16236b2d 100644 --- a/Source/Plugins/BuilderModes/Interface/PreferencesForm.cs +++ b/Source/Plugins/BuilderModes/Interface/PreferencesForm.cs @@ -66,6 +66,7 @@ namespace CodeImp.DoomBuilder.BuilderModes splitlinedefsrange.Text = General.Settings.ReadPluginSetting("splitlinedefsrange", 10).ToString(); autoclearselection.Checked = BuilderPlug.Me.AutoClearSelection; visualmodeclearselection.Checked = BuilderPlug.Me.VisualModeClearSelection; + autodragonpaste.Checked = BuilderPlug.Me.AutoDragOnPaste; } #endregion @@ -86,6 +87,7 @@ namespace CodeImp.DoomBuilder.BuilderModes General.Settings.WritePluginSetting("splitlinedefsrange", splitlinedefsrange.GetResult(0)); General.Settings.WritePluginSetting("autoclearselection", autoclearselection.Checked); General.Settings.WritePluginSetting("visualmodeclearselection", visualmodeclearselection.Checked); + General.Settings.WritePluginSetting("autodragonpaste", autodragonpaste.Checked); } // When Cancel is pressed on the preferences dialog diff --git a/Source/Plugins/BuilderModes/Interface/PreferencesForm.resx b/Source/Plugins/BuilderModes/Interface/PreferencesForm.resx index 0230378d..7bf2ce3e 100644 --- a/Source/Plugins/BuilderModes/Interface/PreferencesForm.resx +++ b/Source/Plugins/BuilderModes/Interface/PreferencesForm.resx @@ -126,6 +126,9 @@ True + + True + True