Script Editor: pressing enter in the search box now performs the search. Pressing enter in the search box of the replace tab performs a search. Pressing enter in the replace box of the replace tab now performs a replacement. Pressing the Escape key now closes the dialog. Fixes #972

This commit is contained in:
biwa 2023-11-05 20:21:04 +01:00
parent d67894546c
commit 501c2f952d
3 changed files with 33 additions and 1 deletions

View file

@ -210,6 +210,7 @@ namespace CodeImp.DoomBuilder.Windows
this.findbox.Name = "findbox"; this.findbox.Name = "findbox";
this.findbox.Size = new System.Drawing.Size(276, 21); this.findbox.Size = new System.Drawing.Size(276, 21);
this.findbox.TabIndex = 0; this.findbox.TabIndex = 0;
this.findbox.KeyDown += new System.Windows.Forms.KeyEventHandler(this.findbox_KeyDown);
// //
// tabreplace // tabreplace
// //
@ -244,6 +245,7 @@ namespace CodeImp.DoomBuilder.Windows
this.replacebox.Name = "replacebox"; this.replacebox.Name = "replacebox";
this.replacebox.Size = new System.Drawing.Size(276, 21); this.replacebox.Size = new System.Drawing.Size(276, 21);
this.replacebox.TabIndex = 1; this.replacebox.TabIndex = 1;
this.replacebox.KeyDown += new System.Windows.Forms.KeyEventHandler(this.replacebox_KeyDown);
// //
// label5 // label5
// //
@ -288,6 +290,7 @@ namespace CodeImp.DoomBuilder.Windows
this.replacefindbox.Name = "replacefindbox"; this.replacefindbox.Name = "replacefindbox";
this.replacefindbox.Size = new System.Drawing.Size(276, 21); this.replacefindbox.Size = new System.Drawing.Size(276, 21);
this.replacefindbox.TabIndex = 0; this.replacefindbox.TabIndex = 0;
this.replacefindbox.KeyDown += new System.Windows.Forms.KeyEventHandler(this.replacefindbox_KeyDown);
// //
// label4 // label4
// //

View file

@ -228,6 +228,17 @@ namespace CodeImp.DoomBuilder.Windows
} }
} }
// The form doesn't have a regular "close" button, so we have to intercept the Esc key
protected override bool ProcessDialogKey(Keys keyData)
{
if (ModifierKeys == Keys.None && keyData == Keys.Escape)
{
this.Hide();
return true;
}
return base.ProcessDialogKey(keyData);
}
#endregion #endregion
#region ================== Events #region ================== Events
@ -387,6 +398,24 @@ namespace CodeImp.DoomBuilder.Windows
else throw new NotImplementedException("Unsupported tab type"); else throw new NotImplementedException("Unsupported tab type");
} }
private void findbox_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
findnextbutton_Click(sender, EventArgs.Empty);
}
private void replacefindbox_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
findnextbutton_Click(sender, EventArgs.Empty);
}
private void replacebox_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
replacebutton_Click(sender, EventArgs.Empty);
}
#endregion #endregion
} }
} }

View file

@ -125,7 +125,7 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAAc ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAAc
CQAAAk1TRnQBSQFMAgEBAgEAASABAAEgAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo CQAAAk1TRnQBSQFMAgEBAgEAAVABAAFQAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA AwABQA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