mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2024-11-27 06:02:11 +00:00
8599f18f4c
Buttons order was messed up in editing modes toolbar after performing "Reload Resources" action. Fixed editing modes toolbar layout.
60 lines
2.1 KiB
C#
60 lines
2.1 KiB
C#
using System;
|
|
using System.Windows.Forms;
|
|
|
|
namespace CodeImp.DoomBuilder.BuilderModes
|
|
{
|
|
internal partial class DrawRectangleOptionsPanel : UserControl
|
|
{
|
|
public event EventHandler OnValueChanged;
|
|
private bool blockEvents;
|
|
|
|
private static int radiusValue;
|
|
private static int subdivsValue;
|
|
|
|
public int BevelWidth { get { return (int)radius.Value; } set { blockEvents = true; radius.Value = value; blockEvents = false; } }
|
|
public int MaxBevelWidth { get { return (int)radius.Maximum; } set { radius.Maximum = value; } }
|
|
public int MinBevelWidth { get { return (int)radius.Minimum; } set { radius.Minimum = value; } }
|
|
public int Subdivisions { get { return (int)subdivs.Value; } set { blockEvents = true; subdivs.Value = value; blockEvents = false; } }
|
|
public int MaxSubdivisions { get { return (int)subdivs.Maximum; } set { subdivs.Maximum = value; } }
|
|
public int MinSubdivisions { get { return (int)subdivs.Minimum; } set { subdivs.Minimum = value; } }
|
|
|
|
public DrawRectangleOptionsPanel() {
|
|
InitializeComponent();
|
|
|
|
radius.Value = radiusValue;
|
|
subdivs.Value = subdivsValue;
|
|
radius.ValueChanged += ValueChanged;
|
|
subdivs.ValueChanged += ValueChanged;
|
|
}
|
|
|
|
public void Register() {
|
|
General.Interface.AddButton(radiuslabel);
|
|
General.Interface.AddButton(radius);
|
|
General.Interface.AddButton(subdivslabel);
|
|
General.Interface.AddButton(subdivs);
|
|
General.Interface.AddButton(reset);
|
|
}
|
|
|
|
public void Unregister() {
|
|
General.Interface.RemoveButton(reset);
|
|
General.Interface.RemoveButton(subdivs);
|
|
General.Interface.RemoveButton(subdivslabel);
|
|
General.Interface.RemoveButton(radius);
|
|
General.Interface.RemoveButton(radiuslabel);
|
|
}
|
|
|
|
private void ValueChanged(object sender, EventArgs e) {
|
|
radiusValue = (int)radius.Value;
|
|
subdivsValue = (int)subdivs.Value;
|
|
if(!blockEvents && OnValueChanged != null) OnValueChanged(this, EventArgs.Empty);
|
|
}
|
|
|
|
private void reset_Click(object sender, EventArgs e) {
|
|
blockEvents = true;
|
|
radius.Value = 0;
|
|
blockEvents = false;
|
|
subdivs.Value = 0;
|
|
}
|
|
|
|
}
|
|
}
|