diff --git a/Source/BuilderModes/FindReplace/FindSectorTags.cs b/Source/BuilderModes/FindReplace/FindSectorTags.cs index 43b34662..0494647d 100644 --- a/Source/BuilderModes/FindReplace/FindSectorTags.cs +++ b/Source/BuilderModes/FindReplace/FindSectorTags.cs @@ -124,7 +124,10 @@ namespace CodeImp.DoomBuilder.BuilderModes public override void ObjectSelected(FindReplaceObject[] selection) { if(selection.Length == 1) + { + ZoomToSelection(selection); General.Interface.ShowSectorInfo(selection[0].Sector); + } else General.Interface.HideInfo(); @@ -143,6 +146,14 @@ namespace CodeImp.DoomBuilder.BuilderModes } } } + + // Edit objects + public override void EditObjects(FindReplaceObject[] selection) + { + List sectors = new List(selection.Length); + foreach(FindReplaceObject o in selection) sectors.Add(o.Sector); + General.Interface.ShowEditSectors(sectors); + } #endregion } diff --git a/Source/Controls/ActionSelectorControl.cs b/Source/Controls/ActionSelectorControl.cs index 88dc81d6..6b2fcf10 100644 --- a/Source/Controls/ActionSelectorControl.cs +++ b/Source/Controls/ActionSelectorControl.cs @@ -37,13 +37,14 @@ namespace CodeImp.DoomBuilder.Controls // Variables private List generalizedcategories; + private bool controlpressed = false; // Constants private const string NUMBER_SEPERATOR = "\t"; // Properties public bool Empty { get { return (number.Text.Length == 0); } set { if(value) number.Text = ""; } } - public int Value { get { if(number.Text.Length > 0) return int.Parse(number.Text); else return 0; } set { number.Text = value.ToString(); } } + public int Value { get { return GetValue(); } set { number.Text = value.ToString(); } } public List GeneralizedCategories { get { return generalizedcategories; } set { generalizedcategories = value; } } // Constructor @@ -53,6 +54,23 @@ namespace CodeImp.DoomBuilder.Controls InitializeComponent(); } + // This returns the numeric value + public int GetValue() + { + int val = 0; + + if(number.Text.Length > 0) + { + try + { + val = Convert.ToInt32(number.Text); + } + catch(Exception e) { } + } + + return val; + } + // This clears all information public void ClearInfo() { @@ -200,6 +218,11 @@ namespace CodeImp.DoomBuilder.Controls // Keys pressed in number box private void number_KeyDown(object sender, KeyEventArgs e) { + controlpressed = e.Control; + + // Allow CTRL+X, CTRL+C and CTRL+V + if(controlpressed && ((e.KeyCode == Keys.X) || (e.KeyCode == Keys.C) || (e.KeyCode == Keys.V))) return; + // Not numeric or control key? if(((e.KeyValue < 48) || (e.KeyValue > 57)) && (e.KeyCode != Keys.Back) && (e.KeyCode != Keys.Left) && @@ -213,6 +236,9 @@ namespace CodeImp.DoomBuilder.Controls // Keys pressed in number box private void number_KeyPress(object sender, KeyPressEventArgs e) { + // Allow CTRL+X, CTRL+C and CTRL+V + if(controlpressed && ((e.KeyChar == '\u0018') || (e.KeyChar == '\u0003') || (e.KeyChar == '\u0016'))) return; + // Not numeric or control key? if(((e.KeyChar < 48) || (e.KeyChar > 57)) && (e.KeyChar != 8)) { diff --git a/Source/Controls/NumericTextbox.cs b/Source/Controls/NumericTextbox.cs index 4ff0ed42..32740335 100644 --- a/Source/Controls/NumericTextbox.cs +++ b/Source/Controls/NumericTextbox.cs @@ -42,7 +42,8 @@ namespace CodeImp.DoomBuilder.Controls private bool allownegative = false; // Allow negative numbers private bool allowrelative = false; // Allow ++ and -- prefix for relative changes - + private bool controlpressed = false; + #endregion #region ================== Properties @@ -64,6 +65,20 @@ namespace CodeImp.DoomBuilder.Controls #region ================== Methods + // Key pressed + protected override void OnKeyDown(KeyEventArgs e) + { + controlpressed = e.Control; + base.OnKeyDown(e); + } + + // Key released + protected override void OnKeyUp(KeyEventArgs e) + { + controlpressed = e.Control; + base.OnKeyUp(e); + } + // When a key is pressed protected override void OnKeyPress(KeyPressEventArgs e) { @@ -77,6 +92,7 @@ namespace CodeImp.DoomBuilder.Controls // Determine allowed chars if(allownegative) allowedchars += "-"; if(allowrelative) allowedchars += "+-"; + if(controlpressed) allowedchars += "\u0018\u0003\u0016"; // Check if key is not allowed if(allowedchars.IndexOf(e.KeyChar) == -1)