mirror of
https://git.do.srb2.org/STJr/ZoneBuilder.git
synced 2024-11-10 06:41:49 +00:00
Added, action argument inputs: added "<" and ">" prefixes. These decrement/increment given value by selected map element number.
Changed, action argument inputs: "+++" and "---" prefixes now do the same thing as they do in other numeric controls (e.g. add/subtract given value multiplied by selected map element number to/from initial value). Changed, action argument inputs: changed value colors, added tooltips.
This commit is contained in:
parent
7435d4bd5b
commit
202014f62f
5 changed files with 48 additions and 20 deletions
7
Source/Core/Controls/ArgumentBox.Designer.cs
generated
7
Source/Core/Controls/ArgumentBox.Designer.cs
generated
|
@ -28,18 +28,24 @@ namespace CodeImp.DoomBuilder.Controls
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
|
this.components = new System.ComponentModel.Container();
|
||||||
this.combobox = new System.Windows.Forms.ComboBox();
|
this.combobox = new System.Windows.Forms.ComboBox();
|
||||||
this.button = new System.Windows.Forms.Button();
|
this.button = new System.Windows.Forms.Button();
|
||||||
this.scrollbuttons = new System.Windows.Forms.VScrollBar();
|
this.scrollbuttons = new System.Windows.Forms.VScrollBar();
|
||||||
|
this.tooltip = new System.Windows.Forms.ToolTip(this.components);
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
// combobox
|
// combobox
|
||||||
//
|
//
|
||||||
this.combobox.DropDownWidth = 130;
|
this.combobox.DropDownWidth = 130;
|
||||||
|
this.combobox.ForeColor = System.Drawing.SystemColors.HotTrack;
|
||||||
this.combobox.Location = new System.Drawing.Point(0, 2);
|
this.combobox.Location = new System.Drawing.Point(0, 2);
|
||||||
this.combobox.Name = "combobox";
|
this.combobox.Name = "combobox";
|
||||||
this.combobox.Size = new System.Drawing.Size(149, 21);
|
this.combobox.Size = new System.Drawing.Size(149, 21);
|
||||||
this.combobox.TabIndex = 0;
|
this.combobox.TabIndex = 0;
|
||||||
|
this.tooltip.SetToolTip(this.combobox, "Use ++ or -- prefixes to change by given value.\r\nUse +++ or --- prefixes to incre" +
|
||||||
|
"mentally change by given value.\r\nUse < or > prefixes to decrementally or increme" +
|
||||||
|
"ntally set given value.");
|
||||||
this.combobox.Validating += new System.ComponentModel.CancelEventHandler(this.combobox_Validating);
|
this.combobox.Validating += new System.ComponentModel.CancelEventHandler(this.combobox_Validating);
|
||||||
this.combobox.TextChanged += new System.EventHandler(this.combobox_TextChanged);
|
this.combobox.TextChanged += new System.EventHandler(this.combobox_TextChanged);
|
||||||
//
|
//
|
||||||
|
@ -86,5 +92,6 @@ namespace CodeImp.DoomBuilder.Controls
|
||||||
private System.Windows.Forms.ComboBox combobox;
|
private System.Windows.Forms.ComboBox combobox;
|
||||||
private System.Windows.Forms.Button button;
|
private System.Windows.Forms.Button button;
|
||||||
private System.Windows.Forms.VScrollBar scrollbuttons;
|
private System.Windows.Forms.VScrollBar scrollbuttons;
|
||||||
|
private System.Windows.Forms.ToolTip tooltip;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,7 +89,7 @@ namespace CodeImp.DoomBuilder.Controls
|
||||||
private void combobox_Validating(object sender, CancelEventArgs e)
|
private void combobox_Validating(object sender, CancelEventArgs e)
|
||||||
{
|
{
|
||||||
string str = combobox.Text.Trim().ToLowerInvariant();
|
string str = combobox.Text.Trim().ToLowerInvariant();
|
||||||
str = str.TrimStart('+', '-');
|
str = str.TrimStart('+', '-', '<', '>');
|
||||||
|
|
||||||
// Anything in the box?
|
// Anything in the box?
|
||||||
if(combobox.Text.Trim().Length > 0)
|
if(combobox.Text.Trim().Length > 0)
|
||||||
|
@ -266,20 +266,22 @@ namespace CodeImp.DoomBuilder.Controls
|
||||||
// This checks if the number is relative
|
// This checks if the number is relative
|
||||||
public bool CheckIsRelative()
|
public bool CheckIsRelative()
|
||||||
{
|
{
|
||||||
// Prefixed with +++, ---, ++ or --?
|
// Prefixed with +++, ---, <, >, ++ or --?
|
||||||
string str = combobox.Text.Trim();
|
string str = combobox.Text.Trim();
|
||||||
return (str.StartsWith("+++") || str.StartsWith("---") || str.StartsWith("++") || str.StartsWith("--"));
|
return (str.StartsWith("+++") || str.StartsWith("---")
|
||||||
|
|| str.StartsWith("++") || str.StartsWith("--")
|
||||||
|
|| str.StartsWith("<") || str.StartsWith(">"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// This returns the selected value
|
// This returns the selected value
|
||||||
public int GetResult(int original) { return GetResult(original, 0); } //mxd
|
public int GetResult(int original) { return GetResult(original, 0); } //mxd
|
||||||
public int GetResult(int original, int offset)
|
public int GetResult(int original, int step)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
// Strip prefixes
|
// Strip prefixes
|
||||||
string str = combobox.Text.Trim().ToLowerInvariant();
|
string str = combobox.Text.Trim().ToLowerInvariant();
|
||||||
string numstr = str.TrimStart('+', '-'); //mxd
|
string numstr = str.TrimStart('+', '-', '<', '>'); //mxd
|
||||||
|
|
||||||
// Anything in the box?
|
// Anything in the box?
|
||||||
if(numstr.Length > 0)
|
if(numstr.Length > 0)
|
||||||
|
@ -290,7 +292,7 @@ namespace CodeImp.DoomBuilder.Controls
|
||||||
// Add offset to number
|
// Add offset to number
|
||||||
int num;
|
int num;
|
||||||
if(!int.TryParse(numstr, out num)) num = 0;
|
if(!int.TryParse(numstr, out num)) num = 0;
|
||||||
result = num + offset;
|
result = original + num * step;
|
||||||
}
|
}
|
||||||
//mxd. Prefixed with ---?
|
//mxd. Prefixed with ---?
|
||||||
else if(str.StartsWith("---"))
|
else if(str.StartsWith("---"))
|
||||||
|
@ -298,7 +300,23 @@ namespace CodeImp.DoomBuilder.Controls
|
||||||
// Subtract offset from number
|
// Subtract offset from number
|
||||||
int num;
|
int num;
|
||||||
if(!int.TryParse(numstr, out num)) num = 0;
|
if(!int.TryParse(numstr, out num)) num = 0;
|
||||||
result = num - offset;
|
result = original - num * step;
|
||||||
|
}
|
||||||
|
// mxd. Prefixed with <?
|
||||||
|
else if(str.StartsWith("<"))
|
||||||
|
{
|
||||||
|
// Incremental decrease
|
||||||
|
int num;
|
||||||
|
if(!int.TryParse(numstr, out num)) num = 0;
|
||||||
|
result = num - step;
|
||||||
|
}
|
||||||
|
// mxd. Prefixed with >?
|
||||||
|
else if(str.StartsWith(">"))
|
||||||
|
{
|
||||||
|
// Incremental increase
|
||||||
|
int num;
|
||||||
|
if(!int.TryParse(numstr, out num)) num = 0;
|
||||||
|
result = num + step;
|
||||||
}
|
}
|
||||||
// Prefixed with ++?
|
// Prefixed with ++?
|
||||||
else if(str.StartsWith("++"))
|
else if(str.StartsWith("++"))
|
||||||
|
|
|
@ -120,6 +120,9 @@
|
||||||
<metadata name="combobox.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
<metadata name="combobox.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
<value>True</value>
|
<value>True</value>
|
||||||
</metadata>
|
</metadata>
|
||||||
|
<metadata name="tooltip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>17, 17</value>
|
||||||
|
</metadata>
|
||||||
<metadata name="button.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
<metadata name="button.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
<value>True</value>
|
<value>True</value>
|
||||||
</metadata>
|
</metadata>
|
||||||
|
|
|
@ -133,7 +133,7 @@ namespace CodeImp.DoomBuilder.Controls
|
||||||
|
|
||||||
#region ================== Apply
|
#region ================== Apply
|
||||||
|
|
||||||
public void Apply(Linedef l, int offset)
|
public void Apply(Linedef l, int step)
|
||||||
{
|
{
|
||||||
//mxd. Script name/number handling
|
//mxd. Script name/number handling
|
||||||
// We can't rely on control visibility here, because all controlls will be invisible if ArgumentsControl is invisible
|
// We can't rely on control visibility here, because all controlls will be invisible if ArgumentsControl is invisible
|
||||||
|
@ -161,7 +161,7 @@ namespace CodeImp.DoomBuilder.Controls
|
||||||
|
|
||||||
// Apply classic arg
|
// Apply classic arg
|
||||||
case ArgZeroMode.DEFAULT:
|
case ArgZeroMode.DEFAULT:
|
||||||
l.Args[0] = arg0.GetResult(l.Args[0], offset);
|
l.Args[0] = arg0.GetResult(l.Args[0], step);
|
||||||
if(l.Fields.ContainsKey("arg0str")) l.Fields.Remove("arg0str");
|
if(l.Fields.ContainsKey("arg0str")) l.Fields.Remove("arg0str");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -169,13 +169,13 @@ namespace CodeImp.DoomBuilder.Controls
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply the rest of args
|
// Apply the rest of args
|
||||||
l.Args[1] = arg1.GetResult(l.Args[1], offset);
|
l.Args[1] = arg1.GetResult(l.Args[1], step);
|
||||||
l.Args[2] = arg2.GetResult(l.Args[2], offset);
|
l.Args[2] = arg2.GetResult(l.Args[2], step);
|
||||||
l.Args[3] = arg3.GetResult(l.Args[3], offset);
|
l.Args[3] = arg3.GetResult(l.Args[3], step);
|
||||||
l.Args[4] = arg4.GetResult(l.Args[4], offset);
|
l.Args[4] = arg4.GetResult(l.Args[4], step);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Apply(Thing t, int offset)
|
public void Apply(Thing t, int step)
|
||||||
{
|
{
|
||||||
//mxd. Script name/number handling
|
//mxd. Script name/number handling
|
||||||
// We can't rely on control visibility here, because all controlls will be invisible if ArgumentsControl is invisible
|
// We can't rely on control visibility here, because all controlls will be invisible if ArgumentsControl is invisible
|
||||||
|
@ -203,7 +203,7 @@ namespace CodeImp.DoomBuilder.Controls
|
||||||
|
|
||||||
// Apply classic arg
|
// Apply classic arg
|
||||||
case ArgZeroMode.DEFAULT:
|
case ArgZeroMode.DEFAULT:
|
||||||
t.Args[0] = arg0.GetResult(t.Args[0], offset);
|
t.Args[0] = arg0.GetResult(t.Args[0], step);
|
||||||
if(t.Fields.ContainsKey("arg0str")) t.Fields.Remove("arg0str");
|
if(t.Fields.ContainsKey("arg0str")) t.Fields.Remove("arg0str");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -211,10 +211,10 @@ namespace CodeImp.DoomBuilder.Controls
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply the rest of args
|
// Apply the rest of args
|
||||||
t.Args[1] = arg1.GetResult(t.Args[1], offset);
|
t.Args[1] = arg1.GetResult(t.Args[1], step);
|
||||||
t.Args[2] = arg2.GetResult(t.Args[2], offset);
|
t.Args[2] = arg2.GetResult(t.Args[2], step);
|
||||||
t.Args[3] = arg3.GetResult(t.Args[3], offset);
|
t.Args[3] = arg3.GetResult(t.Args[3], step);
|
||||||
t.Args[4] = arg4.GetResult(t.Args[4], offset);
|
t.Args[4] = arg4.GetResult(t.Args[4], step);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
@ -228,7 +228,7 @@ namespace CodeImp.DoomBuilder.Controls
|
||||||
string textpart = this.Text;
|
string textpart = this.Text;
|
||||||
|
|
||||||
// Strip prefixes
|
// Strip prefixes
|
||||||
textpart = textpart.Replace("+", "").Replace("-", "").Replace("*", "").Replace("/", ""); //mxd
|
textpart = textpart.TrimStart('+', '-', '*', '/'); //mxd
|
||||||
|
|
||||||
// Any numbers left?
|
// Any numbers left?
|
||||||
if(textpart.Length > 0)
|
if(textpart.Length > 0)
|
||||||
|
|
Loading…
Reference in a new issue