UltimateZoneBuilder/Source/Plugins/BuilderModes/Interface/DrawGridOptionsPanel.cs
MaxED 0369c969d1 According to dotnetperls.com, "new Dictionary<string, [anything]>(StringComparer.Ordinal)" works 17% faster than "new Dictionary<string, [anything]>()", so let's stick that everywhere and see what happens :)
Draw Curve Mode: added settings panel.
Sectors mode: added "Make Door" button to the toolbar.
Swapped Side panel and Info panel z-order. 
Interface: split toolbar into 3 separate toolbars. All toolbar buttons are now viewable at 1024x768.
Interface: grouped stuff in "Modes" menu a bit better.
Interface: added "Draw [stuff]" buttons to modes toolbar.
Interface: reorganized main menu. Hope it makes more sense now.
API: added General.Interface.AddModesButton() and General.Interface.AddModesMenu(), which can be used to add buttons to specific group in "Modes" toolbar and menu items to specific group in "Modes" menu, so actions, which behave like an editing mode, but are not part of one can be added there.
2014-02-26 14:11:06 +00:00

46 lines
2.2 KiB
C#

using System;
using System.Windows.Forms;
using CodeImp.DoomBuilder.Actions;
namespace CodeImp.DoomBuilder.BuilderModes
{
public partial class DrawGridOptionsPanel : UserControl
{
public event EventHandler OnValueChanged;
public event EventHandler OnGridLockChanged;
private bool blockEvents;
private readonly string help;
private readonly string gridlockhelp;
public bool Triangulate { get { return triangulate.Checked; } set { blockEvents = true; triangulate.Checked = value; blockEvents = false; } }
public bool LockToGrid { get { return gridlock.Checked; } set { blockEvents = true; gridlock.Checked = value; blockEvents = false; } }
public int HorizontalSlices { get { return (int)slicesH.Value; } set { blockEvents = true; slicesH.Value = value; blockEvents = false; } }
public int VerticalSlices { get { return (int)slicesV.Value; } set { blockEvents = true; slicesV.Value = value; blockEvents = false; } }
public DrawGridOptionsPanel() {
InitializeComponent();
//set hints
help = HintsManager.GetRtfString("Use <b>" + Actions.Action.GetShortcutKeyDesc("buildermodes_increasebevel") + "</b> and <b>" + Actions.Action.GetShortcutKeyDesc("buildermodes_decreasebevel") + "</b> to change the number of horizontal slices<br>"
+ "Use <b>" + Actions.Action.GetShortcutKeyDesc("buildermodes_increasesubdivlevel") + "</b> and <b>" + Actions.Action.GetShortcutKeyDesc("buildermodes_decreasesubdivlevel") + "</b> to change the number of vertical slices");
gridlockhelp = HintsManager.GetRtfString("Use <b>" + Actions.Action.GetShortcutKeyDesc("builder_griddec") + "</b> and <b>" + Actions.Action.GetShortcutKeyDesc("builder_gridinc") + "</b> to change grid size.");
hints.SelectedRtf = help;
}
private void ValueChanged(object sender, EventArgs e) {
if(!blockEvents && OnValueChanged != null) OnValueChanged(this, EventArgs.Empty);
}
private void gridlock_CheckedChanged(object sender, EventArgs e) {
slicesH.Enabled = !gridlock.Checked;
slicesV.Enabled = !gridlock.Checked;
hints.Clear();
hints.SelectedRtf = (gridlock.Checked ? gridlockhelp : help);
if(blockEvents) return;
if(OnGridLockChanged != null) OnGridLockChanged(this, EventArgs.Empty);
}
}
}