UltimateZoneBuilder/Source/Core/GZBuilder/Controls/PairedIntControl.cs
MaxED ead2521451 Sectors mode, UDMF: Create Brightness Gradient action can now work in "Light" and "Fade" modes.
Visual mode: added support for "fogdensity" and "outsidefogdensity" MAPINFO properties.
Sector Info panel now shows the number of sector's sidedefs as well as light and fade colors (UDMF only).
UDMF: Sector and sidedef flags are now copied/pasted when using "Copy Properties" and "Paste Properties" actions.
Fixed: in some cases default texture overrides were used even when corresponding option was disabled.
Sector Edit form: light and fade values were not saved when a value was pasted/entered into text box.
Sector Edit form: "reset value" button was not shown for light and fade values when selected sectors had different light/fade colors.
Reverted Open Map form changes from previous commit (my assumption that map marker is always empty was not correct...)
Updated documentation.
2013-09-11 08:49:45 +00:00

81 lines
2.1 KiB
C#

#region ================== Namespaces
using System;
using System.Windows.Forms;
using CodeImp.DoomBuilder.Map;
#endregion
namespace CodeImp.DoomBuilder.GZBuilder.Controls
{
public partial class PairedIntControl : UserControl
{
#region ================== Events
public event EventHandler OnValuesChanged;
#endregion
#region ================== Variables
private int defaultValue;
private bool blockUpdate;
#endregion
#region ================== Properties
public string Label { get { return label.Text; } set { label.Text = value; } }
public int DefaultValue { get { return defaultValue; } set { defaultValue = value; } }
public int ButtonStep { get { return (int)value1.ButtonStep; } set { value1.ButtonStep = value; value2.ButtonStep = value; } }
#endregion
public PairedIntControl() {
InitializeComponent();
}
public void SetValues(int val1, int val2) {
blockUpdate = true;
if(!string.IsNullOrEmpty(value1.Text) && value1.Text != val1.ToString())
value1.Text = "";
else
value1.Text = val1.ToString();
if(!string.IsNullOrEmpty(value2.Text) && value2.Text != val2.ToString())
value2.Text = "";
else
value2.Text = val2.ToString();
blockUpdate = false;
}
public int GetValue1(int original) {
return value1.GetResult(original);
}
public int GetValue2(int original) {
return value2.GetResult(original);
}
private void checkValues() {
bool changed = string.IsNullOrEmpty(value1.Text) || string.IsNullOrEmpty(value2.Text)
|| value1.GetResult(defaultValue) != defaultValue || value2.GetResult(defaultValue) != defaultValue;
label.Enabled = changed;
bReset.Visible = changed;
if(!blockUpdate && OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty);
}
private void bReset_Click(object sender, EventArgs e) {
value1.Text = defaultValue.ToString();
value2.Text = defaultValue.ToString();
checkValues();
}
private void value1_WhenTextChanged(object sender, EventArgs e) {
checkValues();
}
}
}