2009-04-19 18:07:22 +00:00
|
|
|
|
|
|
|
#region ================== Copyright (c) 2007 Pascal vd Heiden
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (c) 2007 Pascal vd Heiden, www.codeimp.com
|
|
|
|
* This program is released under GNU General Public License
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region ================== Namespaces
|
|
|
|
|
|
|
|
using System;
|
|
|
|
using System.Windows.Forms;
|
|
|
|
using CodeImp.DoomBuilder.Editing;
|
2014-03-19 13:03:47 +00:00
|
|
|
using CodeImp.DoomBuilder.Windows;
|
2009-04-19 18:07:22 +00:00
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
namespace CodeImp.DoomBuilder.BuilderModes
|
|
|
|
{
|
|
|
|
public partial class MenusForm : Form
|
|
|
|
{
|
|
|
|
#region ================== Variables
|
|
|
|
|
|
|
|
// Menus list
|
|
|
|
private ToolStripItem[] menus;
|
|
|
|
|
2014-03-19 13:03:47 +00:00
|
|
|
// mxd. More menus
|
|
|
|
private ToolStripItem[] exportmenuitems;
|
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
// Buttons list
|
|
|
|
private ToolStripItem[] buttons;
|
|
|
|
|
2013-03-18 13:52:27 +00:00
|
|
|
//mxd
|
|
|
|
public struct BrightnessGradientModes
|
|
|
|
{
|
2015-01-16 23:37:20 +00:00
|
|
|
public const string Sectors = "Sector Brightness";
|
|
|
|
public const string Light = "Light Color";
|
|
|
|
public const string Fade = "Fade Color";
|
|
|
|
public const string LightAndFade = "Light and Fade Colors";
|
|
|
|
public const string Floors = "Floor Brightness";
|
|
|
|
public const string Ceilings = "Ceiling Brightness";
|
2015-01-16 21:38:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//mxd
|
2015-01-16 23:37:20 +00:00
|
|
|
internal struct GradientInterpolationModes
|
2015-01-16 21:38:42 +00:00
|
|
|
{
|
|
|
|
public const string Linear = "Linear";
|
|
|
|
public const string EaseInOutSine = "EaseInOutSine";
|
|
|
|
public const string EaseInSine = "EaseInSine";
|
|
|
|
public const string EaseOutSine = "EaseOutSine";
|
2013-03-18 13:52:27 +00:00
|
|
|
}
|
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region ================== Properties
|
|
|
|
|
|
|
|
public ToolStripMenuItem LinedefsMenu { get { return linedefsmenu; } }
|
|
|
|
public ToolStripMenuItem SectorsMenu { get { return sectorsmenu; } }
|
|
|
|
public ToolStripButton ViewSelectionNumbers { get { return buttonselectionnumbers; } }
|
2013-09-16 11:44:47 +00:00
|
|
|
public ToolStripButton ViewSelectionEffects { get { return buttonselectioneffects; } }
|
2009-04-19 18:07:22 +00:00
|
|
|
public ToolStripSeparator SeparatorSectors1 { get { return separatorsectors1; } }
|
2015-01-16 21:38:42 +00:00
|
|
|
public ToolStripSeparator SeparatorSectors2 { get { return separatorsectors2; } } //mxd
|
|
|
|
public ToolStripSeparator SeparatorSectors3 { get { return separatorsectors3; } } //mxd
|
2009-04-19 18:07:22 +00:00
|
|
|
public ToolStripButton MakeGradientBrightness { get { return buttonbrightnessgradient; } }
|
|
|
|
public ToolStripButton MakeGradientFloors { get { return buttonfloorgradient; } }
|
|
|
|
public ToolStripButton MakeGradientCeilings { get { return buttonceilinggradient; } }
|
|
|
|
public ToolStripButton FlipSelectionV { get { return buttonflipselectionv; } }
|
|
|
|
public ToolStripButton FlipSelectionH { get { return buttonflipselectionh; } }
|
|
|
|
public ToolStripButton CurveLinedefs { get { return buttoncurvelinedefs; } }
|
2010-08-15 13:45:43 +00:00
|
|
|
public ToolStripButton CopyProperties { get { return buttoncopyproperties; } }
|
|
|
|
public ToolStripButton PasteProperties { get { return buttonpasteproperties; } }
|
2014-04-09 10:16:33 +00:00
|
|
|
public ToolStripButton PastePropertiesOptions { get { return buttonpastepropertiesoptions; } } //mxd
|
2010-08-15 13:45:43 +00:00
|
|
|
public ToolStripSeparator SeparatorCopyPaste { get { return seperatorcopypaste; } }
|
2015-01-16 21:38:42 +00:00
|
|
|
public ToolStripComboBox GradientModeMenu { get { return gradientModeMenu; } } //mxd
|
|
|
|
public ToolStripComboBox GradientInterpolationMenu { get { return gradientInterpolationMenu; } } //mxd
|
2013-03-18 13:52:27 +00:00
|
|
|
public ToolStripButton MarqueSelectTouching { get { return buttonMarqueSelectTouching; } } //mxd
|
|
|
|
public ToolStripButton AlignThingsToWall { get { return buttonAlignThingsToWall; } } //mxd
|
2014-02-26 14:11:06 +00:00
|
|
|
public ToolStripButton TextureOffsetLock { get { return buttonTextureOffsetLock; } } //mxd
|
2014-07-18 15:11:37 +00:00
|
|
|
public ToolStripButton DragThingsInSelectedSectors { get { return buttonDragThingsInSelectedSectors; } } //mxd
|
2014-02-26 14:11:06 +00:00
|
|
|
public ToolStripButton MakeDoor { get { return buttonMakeDoor; } } //mxd
|
2009-04-19 18:07:22 +00:00
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region ================== Constructor / Disposer
|
|
|
|
|
|
|
|
// Constructor
|
|
|
|
public MenusForm()
|
|
|
|
{
|
|
|
|
// Initialize
|
|
|
|
InitializeComponent();
|
|
|
|
|
|
|
|
// Apply settings
|
|
|
|
buttonselectionnumbers.Checked = BuilderPlug.Me.ViewSelectionNumbers;
|
2013-09-16 11:44:47 +00:00
|
|
|
buttonselectioneffects.Checked = BuilderPlug.Me.ViewSelectionEffects; //mxd
|
2013-03-18 13:52:27 +00:00
|
|
|
|
|
|
|
//mxd
|
2015-01-16 21:38:42 +00:00
|
|
|
gradientModeMenu.Items.AddRange(new[] { BrightnessGradientModes.Sectors, BrightnessGradientModes.Light, BrightnessGradientModes.Fade, BrightnessGradientModes.LightAndFade, BrightnessGradientModes.Ceilings, BrightnessGradientModes.Floors });
|
|
|
|
gradientModeMenu.SelectedIndex = 0;
|
|
|
|
gradientInterpolationMenu.Items.AddRange(new[] { GradientInterpolationModes.Linear, GradientInterpolationModes.EaseInOutSine, GradientInterpolationModes.EaseInSine, GradientInterpolationModes.EaseOutSine });
|
|
|
|
gradientInterpolationMenu.SelectedIndex = 0;
|
2009-04-19 18:07:22 +00:00
|
|
|
|
|
|
|
// List all menus
|
|
|
|
menus = new ToolStripItem[menustrip.Items.Count];
|
|
|
|
for(int i = 0; i < menustrip.Items.Count; i++) menus[i] = menustrip.Items[i];
|
|
|
|
|
2014-03-19 13:03:47 +00:00
|
|
|
//mxd
|
|
|
|
exportmenuitems = new ToolStripItem[exportStripMenuItem.DropDownItems.Count];
|
|
|
|
for(int i = 0; i < exportStripMenuItem.DropDownItems.Count; i++)
|
|
|
|
exportmenuitems[i] = exportStripMenuItem.DropDownItems[i];
|
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
// List all buttons
|
|
|
|
buttons = new ToolStripItem[globalstrip.Items.Count];
|
|
|
|
for(int i = 0; i < globalstrip.Items.Count; i++) buttons[i] = globalstrip.Items[i];
|
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region ================== Methods
|
|
|
|
|
|
|
|
// This registers with the core
|
|
|
|
public void Register()
|
|
|
|
{
|
|
|
|
// Add the menus to the core
|
|
|
|
foreach(ToolStripMenuItem m in menus)
|
|
|
|
General.Interface.AddMenu(m);
|
|
|
|
|
|
|
|
// Add the buttons to the core
|
|
|
|
foreach(ToolStripItem b in buttons)
|
|
|
|
General.Interface.AddButton(b);
|
2014-03-19 13:03:47 +00:00
|
|
|
|
|
|
|
//mxd
|
|
|
|
foreach(ToolStripMenuItem menu in exportmenuitems)
|
|
|
|
General.Interface.AddMenu(menu, MenuSection.FileExport);
|
2009-04-19 18:07:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// This unregisters from the core
|
|
|
|
public void Unregister()
|
|
|
|
{
|
|
|
|
// Remove the menus from the core
|
|
|
|
foreach(ToolStripMenuItem m in menus)
|
|
|
|
General.Interface.RemoveMenu(m);
|
|
|
|
|
|
|
|
// Remove the buttons from the core
|
|
|
|
foreach(ToolStripItem b in buttons)
|
|
|
|
General.Interface.RemoveButton(b);
|
2014-03-19 13:03:47 +00:00
|
|
|
|
|
|
|
//mxd
|
|
|
|
foreach(ToolStripMenuItem menu in exportmenuitems)
|
|
|
|
General.Interface.RemoveMenu(menu);
|
2009-04-19 18:07:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// This hides all menus
|
|
|
|
public void HideAllMenus()
|
|
|
|
{
|
|
|
|
foreach(ToolStripMenuItem m in menus) m.Visible = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// This hides all except one menu
|
|
|
|
public void HideAllMenusExcept(ToolStripMenuItem showthis)
|
|
|
|
{
|
|
|
|
HideAllMenus();
|
|
|
|
showthis.Visible = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// This shows the menu for the current editing mode
|
|
|
|
public void ShowEditingModeMenu(EditMode mode)
|
|
|
|
{
|
|
|
|
Type sourcemode = typeof(object);
|
|
|
|
if(mode != null)
|
|
|
|
{
|
|
|
|
sourcemode = mode.GetType();
|
|
|
|
|
|
|
|
// When in a volatile mode, check against the last stable mode
|
|
|
|
if(mode.Attributes.Volatile) sourcemode = General.Editing.PreviousStableMode;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Final decision
|
|
|
|
if(sourcemode == typeof(LinedefsMode)) HideAllMenusExcept(linedefsmenu);
|
|
|
|
else if(sourcemode == typeof(SectorsMode)) HideAllMenusExcept(sectorsmenu);
|
2013-03-18 13:52:27 +00:00
|
|
|
else if(sourcemode == typeof(ThingsMode)) HideAllMenusExcept(thingsmenu); //mxd
|
2013-09-11 13:14:45 +00:00
|
|
|
else if(sourcemode == typeof(VerticesMode)) HideAllMenusExcept(vertsmenu); //mxd
|
2009-04-19 18:07:22 +00:00
|
|
|
else HideAllMenus();
|
|
|
|
}
|
|
|
|
|
|
|
|
// This invokes an action from control event
|
|
|
|
private void InvokeTaggedAction(object sender, EventArgs e)
|
|
|
|
{
|
|
|
|
General.Interface.InvokeTaggedAction(sender, e);
|
|
|
|
}
|
|
|
|
|
|
|
|
// View selection numbers clicked
|
|
|
|
private void buttonselectionnumbers_Click(object sender, EventArgs e)
|
|
|
|
{
|
|
|
|
BuilderPlug.Me.ViewSelectionNumbers = buttonselectionnumbers.Checked;
|
|
|
|
General.Interface.RedrawDisplay();
|
2014-08-26 11:08:34 +00:00
|
|
|
General.Interface.DisplayStatus(StatusType.Info, (buttonselectionnumbers.Checked ?
|
|
|
|
"Show selection numbers" :
|
|
|
|
"Don't show selection numbers"));
|
2009-04-19 18:07:22 +00:00
|
|
|
}
|
2013-03-18 13:52:27 +00:00
|
|
|
|
2013-09-16 11:44:47 +00:00
|
|
|
//mxd
|
2014-08-26 11:08:34 +00:00
|
|
|
private void buttonselectioneffects_Click(object sender, EventArgs e)
|
|
|
|
{
|
2013-09-16 11:44:47 +00:00
|
|
|
BuilderPlug.Me.ViewSelectionEffects = buttonselectioneffects.Checked;
|
|
|
|
General.Interface.RedrawDisplay();
|
2014-08-26 11:08:34 +00:00
|
|
|
General.Interface.DisplayStatus(StatusType.Info, (buttonselectioneffects.Checked ?
|
|
|
|
"Show sector tags and effects" :
|
|
|
|
"Don't show sector tags and effects"));
|
2013-09-16 11:44:47 +00:00
|
|
|
}
|
|
|
|
|
2013-03-18 13:52:27 +00:00
|
|
|
//mxd
|
2014-08-26 11:08:34 +00:00
|
|
|
private void buttonMarqueSelectTouching_Click(object sender, EventArgs e)
|
|
|
|
{
|
2013-03-18 13:52:27 +00:00
|
|
|
BuilderPlug.Me.MarqueSelectTouching = buttonMarqueSelectTouching.Checked;
|
2014-08-26 11:08:34 +00:00
|
|
|
General.Interface.DisplayStatus(StatusType.Info, (buttonMarqueSelectTouching.Checked ?
|
|
|
|
"Select map elements touching selection rectangle" :
|
|
|
|
"Select map elements inside of selection rectangle"));
|
2013-03-18 13:52:27 +00:00
|
|
|
}
|
2013-04-11 09:27:16 +00:00
|
|
|
|
|
|
|
//mxd
|
2014-08-26 11:08:34 +00:00
|
|
|
private void buttonTextureOffsetLock_Click(object sender, EventArgs e)
|
|
|
|
{
|
2013-04-11 09:27:16 +00:00
|
|
|
BuilderPlug.Me.LockSectorTextureOffsetsWhileDragging = buttonTextureOffsetLock.Checked;
|
2014-08-26 11:08:34 +00:00
|
|
|
General.Interface.DisplayStatus(StatusType.Info, (buttonTextureOffsetLock.Checked ?
|
|
|
|
"Lock texture offsets when dragging sectors" :
|
|
|
|
"Don't lock texture offsets when dragging sectors"));
|
2013-04-11 09:27:16 +00:00
|
|
|
}
|
2013-05-30 12:52:27 +00:00
|
|
|
|
|
|
|
//mxd
|
2014-08-26 11:08:34 +00:00
|
|
|
private void linedefsmenu_DropDownOpening(object sender, EventArgs e)
|
|
|
|
{
|
2015-02-12 22:04:49 +00:00
|
|
|
aligntexturesitem.Enabled = General.Map.UDMF;
|
|
|
|
updatelightfogitem.Enabled = General.Map.UDMF;
|
2013-05-30 12:52:27 +00:00
|
|
|
}
|
|
|
|
|
2013-09-11 08:49:45 +00:00
|
|
|
//mxd
|
2015-01-16 23:37:20 +00:00
|
|
|
private void gradientMode_DropDownClosed(object sender, EventArgs e)
|
2014-08-26 11:08:34 +00:00
|
|
|
{
|
2013-09-11 08:49:45 +00:00
|
|
|
General.Interface.FocusDisplay();
|
|
|
|
}
|
|
|
|
|
2014-07-18 15:11:37 +00:00
|
|
|
//mxd
|
2014-08-26 11:08:34 +00:00
|
|
|
private void buttonDragThingsInSelectedSectors_Click(object sender, EventArgs e)
|
|
|
|
{
|
2014-07-18 15:11:37 +00:00
|
|
|
BuilderPlug.Me.DragThingsInSectorsMode = buttonDragThingsInSelectedSectors.Checked;
|
2014-08-26 11:08:34 +00:00
|
|
|
General.Interface.DisplayStatus(StatusType.Info, (buttonDragThingsInSelectedSectors.Checked ?
|
|
|
|
"Drag things in selected sectors" :
|
|
|
|
"Don't drag things in selected sectors"));
|
2014-07-18 15:11:37 +00:00
|
|
|
}
|
|
|
|
|
2013-05-30 12:52:27 +00:00
|
|
|
#endregion
|
2009-04-19 18:07:22 +00:00
|
|
|
}
|
|
|
|
}
|