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.Collections.Generic;
|
2015-11-16 21:10:11 +00:00
|
|
|
using System.Globalization;
|
2009-04-19 18:07:22 +00:00
|
|
|
using System.Windows.Forms;
|
|
|
|
using CodeImp.DoomBuilder.Config;
|
2017-02-12 18:33:31 +00:00
|
|
|
using System.Drawing;
|
2009-04-19 18:07:22 +00:00
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
namespace CodeImp.DoomBuilder.Windows
|
|
|
|
{
|
|
|
|
internal partial class ActionBrowserForm : DelayedForm
|
|
|
|
{
|
|
|
|
// Constants
|
|
|
|
private const int MAX_OPTIONS = 8;
|
|
|
|
|
|
|
|
// Variables
|
|
|
|
private int selectedaction;
|
2014-07-18 11:25:08 +00:00
|
|
|
private readonly ComboBox[] options;
|
|
|
|
private readonly Label[] optionlbls;
|
|
|
|
private readonly TreeNode[] allNodes; //mxd
|
2016-02-21 00:11:09 +00:00
|
|
|
private readonly bool addanyaction; //mxd
|
2021-05-24 20:26:01 +00:00
|
|
|
private int actionidmaxdigits;
|
2009-04-19 18:07:22 +00:00
|
|
|
|
|
|
|
// Properties
|
|
|
|
public int SelectedAction { get { return selectedaction; } }
|
|
|
|
|
|
|
|
// Constructor
|
2016-02-21 00:11:09 +00:00
|
|
|
public ActionBrowserForm(int action, bool addanyaction)
|
2009-04-19 18:07:22 +00:00
|
|
|
{
|
|
|
|
// Initialize
|
|
|
|
InitializeComponent();
|
|
|
|
|
2016-02-21 00:11:09 +00:00
|
|
|
//mxd. Show "Any action" item?
|
|
|
|
this.addanyaction = addanyaction;
|
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
// Make array references for controls
|
2014-02-18 14:04:14 +00:00
|
|
|
options = new[] { option0, option1, option2, option3, option4, option5, option6, option7 };
|
|
|
|
optionlbls = new[] { option0label, option1label, option2label, option3label, option4label,
|
2009-04-19 18:07:22 +00:00
|
|
|
option5label, option6label, option7label };
|
|
|
|
|
|
|
|
// Show prefixes panel only for doom type maps
|
2012-09-07 14:04:32 +00:00
|
|
|
if(!General.Map.FormatInterface.HasBuiltInActivations)
|
2009-04-19 18:07:22 +00:00
|
|
|
{
|
|
|
|
prefixespanel.Visible = false;
|
2013-09-11 09:47:53 +00:00
|
|
|
actions.Height += prefixespanel.Height + 3; //mxd
|
2009-04-19 18:07:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Go for all predefined categories
|
2014-12-03 23:15:26 +00:00
|
|
|
CreateActionCategories(action);
|
2013-09-11 09:47:53 +00:00
|
|
|
allNodes = new TreeNode[actions.Nodes.Count];
|
|
|
|
actions.Nodes.CopyTo(allNodes, 0);
|
2009-04-19 18:07:22 +00:00
|
|
|
|
|
|
|
// Using generalized actions?
|
|
|
|
if(General.Map.Config.GeneralizedActions)
|
|
|
|
{
|
|
|
|
// Add for all generalized categories to the combobox
|
|
|
|
category.Items.AddRange(General.Map.Config.GenActionCategories.ToArray());
|
|
|
|
|
|
|
|
// Given action is generalized?
|
|
|
|
if(GameConfiguration.IsGeneralized(action, General.Map.Config.GenActionCategories))
|
|
|
|
{
|
|
|
|
// Open the generalized tab
|
|
|
|
tabs.SelectedTab = tabgeneralized;
|
|
|
|
|
|
|
|
// Select category
|
|
|
|
foreach(GeneralizedCategory ac in category.Items)
|
Changed, Select Similar Sectors action: when "Effect" option is enabled, all sectors with at least one matching generalized/predefined effect will be selected.
Added, Tag Explorer plugin: a separate category for each generalized/predefined effect is now created when "Sort by action special" sort mode is used.
Added, Edit Effect window: normal and generalized effects can now be set at the same time.
Fixed, Edit Action window: in some cases Generalized actions were incorrectly processed.
Fixed, Edit Effect window: in some cases Generalized effects were incorrectly processed.
Fixed, Select Similar window: Tab control was incorrectly anchored.
Fixed, Nodes Viewer mode, cosmetic: segs angles were calculated incorrectly when showing nodes in classic format.
Fixed: HiRes textures, which didn't override any texture or flat were not loaded.
Fixed, Tag Explorer plugin: linedef action categories were missing title when "Sort by action special" sort mode was used.
Cosmetic: renamed "Grid Setup" action to "Grid and Backdrop Setup".
2016-03-21 15:19:14 +00:00
|
|
|
{
|
|
|
|
if((action >= ac.Offset) && (action < (ac.Offset + ac.Length)))
|
|
|
|
{
|
|
|
|
category.SelectedItem = ac;
|
|
|
|
break; //mxd
|
|
|
|
}
|
|
|
|
}
|
2009-04-19 18:07:22 +00:00
|
|
|
|
|
|
|
// Anything selected?
|
|
|
|
if(category.SelectedIndex > -1)
|
|
|
|
{
|
|
|
|
// Go for all options in selected category
|
2015-12-28 15:01:53 +00:00
|
|
|
GeneralizedCategory sc = category.SelectedItem as GeneralizedCategory;
|
|
|
|
int actionbits = action - sc.Offset;
|
Changed, Select Similar Sectors action: when "Effect" option is enabled, all sectors with at least one matching generalized/predefined effect will be selected.
Added, Tag Explorer plugin: a separate category for each generalized/predefined effect is now created when "Sort by action special" sort mode is used.
Added, Edit Effect window: normal and generalized effects can now be set at the same time.
Fixed, Edit Action window: in some cases Generalized actions were incorrectly processed.
Fixed, Edit Effect window: in some cases Generalized effects were incorrectly processed.
Fixed, Select Similar window: Tab control was incorrectly anchored.
Fixed, Nodes Viewer mode, cosmetic: segs angles were calculated incorrectly when showing nodes in classic format.
Fixed: HiRes textures, which didn't override any texture or flat were not loaded.
Fixed, Tag Explorer plugin: linedef action categories were missing title when "Sort by action special" sort mode was used.
Cosmetic: renamed "Grid Setup" action to "Grid and Backdrop Setup".
2016-03-21 15:19:14 +00:00
|
|
|
|
|
|
|
// Go for all options, bigger steps first (mxd)
|
|
|
|
// INFO: both GeneralizedOptions and GeneralizedBits are incrimentally sorted
|
|
|
|
for(int i = MAX_OPTIONS - 1; i > -1; i--)
|
2009-04-19 18:07:22 +00:00
|
|
|
{
|
|
|
|
// Option used?
|
|
|
|
if(i < sc.Options.Count)
|
|
|
|
{
|
Changed, Select Similar Sectors action: when "Effect" option is enabled, all sectors with at least one matching generalized/predefined effect will be selected.
Added, Tag Explorer plugin: a separate category for each generalized/predefined effect is now created when "Sort by action special" sort mode is used.
Added, Edit Effect window: normal and generalized effects can now be set at the same time.
Fixed, Edit Action window: in some cases Generalized actions were incorrectly processed.
Fixed, Edit Effect window: in some cases Generalized effects were incorrectly processed.
Fixed, Select Similar window: Tab control was incorrectly anchored.
Fixed, Nodes Viewer mode, cosmetic: segs angles were calculated incorrectly when showing nodes in classic format.
Fixed: HiRes textures, which didn't override any texture or flat were not loaded.
Fixed, Tag Explorer plugin: linedef action categories were missing title when "Sort by action special" sort mode was used.
Cosmetic: renamed "Grid Setup" action to "Grid and Backdrop Setup".
2016-03-21 15:19:14 +00:00
|
|
|
// Go for all bits, bigger bits first (mxd)
|
|
|
|
for(int b = sc.Options[i].Bits.Count - 1; b > -1; b--)
|
2009-04-19 18:07:22 +00:00
|
|
|
{
|
|
|
|
// Select this setting if matches
|
Changed, Select Similar Sectors action: when "Effect" option is enabled, all sectors with at least one matching generalized/predefined effect will be selected.
Added, Tag Explorer plugin: a separate category for each generalized/predefined effect is now created when "Sort by action special" sort mode is used.
Added, Edit Effect window: normal and generalized effects can now be set at the same time.
Fixed, Edit Action window: in some cases Generalized actions were incorrectly processed.
Fixed, Edit Effect window: in some cases Generalized effects were incorrectly processed.
Fixed, Select Similar window: Tab control was incorrectly anchored.
Fixed, Nodes Viewer mode, cosmetic: segs angles were calculated incorrectly when showing nodes in classic format.
Fixed: HiRes textures, which didn't override any texture or flat were not loaded.
Fixed, Tag Explorer plugin: linedef action categories were missing title when "Sort by action special" sort mode was used.
Cosmetic: renamed "Grid Setup" action to "Grid and Backdrop Setup".
2016-03-21 15:19:14 +00:00
|
|
|
GeneralizedBit bit = sc.Options[i].Bits[b];
|
|
|
|
if((actionbits & bit.Index) == bit.Index)
|
2016-02-21 00:11:09 +00:00
|
|
|
{
|
Changed, Select Similar Sectors action: when "Effect" option is enabled, all sectors with at least one matching generalized/predefined effect will be selected.
Added, Tag Explorer plugin: a separate category for each generalized/predefined effect is now created when "Sort by action special" sort mode is used.
Added, Edit Effect window: normal and generalized effects can now be set at the same time.
Fixed, Edit Action window: in some cases Generalized actions were incorrectly processed.
Fixed, Edit Effect window: in some cases Generalized effects were incorrectly processed.
Fixed, Select Similar window: Tab control was incorrectly anchored.
Fixed, Nodes Viewer mode, cosmetic: segs angles were calculated incorrectly when showing nodes in classic format.
Fixed: HiRes textures, which didn't override any texture or flat were not loaded.
Fixed, Tag Explorer plugin: linedef action categories were missing title when "Sort by action special" sort mode was used.
Cosmetic: renamed "Grid Setup" action to "Grid and Backdrop Setup".
2016-03-21 15:19:14 +00:00
|
|
|
options[i].SelectedItem = bit;
|
|
|
|
actionbits -= bit.Index; //mxd
|
|
|
|
if(bit.Index > 0) break; //mxd
|
2016-02-21 00:11:09 +00:00
|
|
|
}
|
2009-04-19 18:07:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2016-02-21 00:11:09 +00:00
|
|
|
|
|
|
|
//mxd. Make sure something is selected
|
|
|
|
if(category.SelectedIndex == -1 && category.Items.Count > 0)
|
|
|
|
category.SelectedIndex = 0;
|
2009-04-19 18:07:22 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Remove generalized tab
|
|
|
|
tabs.TabPages.Remove(tabgeneralized);
|
|
|
|
}
|
2017-02-12 18:33:31 +00:00
|
|
|
|
|
|
|
// [ZZ] we are drawing nodes manually. we need nice number padding.
|
|
|
|
actions.DrawMode = TreeViewDrawMode.OwnerDrawText;
|
|
|
|
actions.DrawNode += Actions_DrawNode;
|
2009-04-19 18:07:22 +00:00
|
|
|
}
|
2017-02-12 18:33:31 +00:00
|
|
|
|
|
|
|
private void Actions_DrawNode(object sender, DrawTreeNodeEventArgs e)
|
|
|
|
{
|
|
|
|
Rectangle nodeRect = Rectangle.FromLTRB(e.Bounds.Left + 1, e.Bounds.Top, e.Bounds.Right + 1, e.Bounds.Bottom);
|
|
|
|
Rectangle nodeTextRect = Rectangle.FromLTRB(nodeRect.Left, nodeRect.Top + 1, nodeRect.Right, nodeRect.Bottom);
|
|
|
|
string nodeText = e.Node.Text;
|
|
|
|
string[] parts = nodeText.Split(new char[] { '\t' }, 2);
|
|
|
|
|
|
|
|
Font nodeFont = e.Node.NodeFont;
|
|
|
|
if (nodeFont == null) nodeFont = ((TreeView)sender).Font;
|
|
|
|
|
|
|
|
int wd = (int)e.Graphics.MeasureString(parts[parts.Length - 1], nodeFont).Width;
|
|
|
|
nodeRect.Width = wd;
|
|
|
|
|
2021-05-24 20:26:01 +00:00
|
|
|
string pad = " ".PadLeft(actionidmaxdigits+1, '9');
|
|
|
|
SizeF tagSize = e.Graphics.MeasureString(pad, nodeFont);
|
2017-02-12 18:33:31 +00:00
|
|
|
if (parts.Length == 2)
|
|
|
|
nodeRect.Width += (int)tagSize.Width;
|
|
|
|
|
|
|
|
Brush fgBrush = null;
|
|
|
|
if ((e.State & TreeNodeStates.Selected) != 0)
|
|
|
|
{
|
|
|
|
// fill selected bg
|
|
|
|
e.Graphics.FillRectangle(SystemBrushes.Highlight, nodeRect);
|
|
|
|
// draw the node text
|
|
|
|
fgBrush = SystemBrushes.HighlightText;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// fill non selected bg (winforms does weird things here)
|
|
|
|
// never understood the fact that "Window" color is actually white, but actual window background is counted as "3D element".
|
|
|
|
e.Graphics.FillRectangle(SystemBrushes.Window, nodeRect);
|
|
|
|
//
|
|
|
|
fgBrush = SystemBrushes.WindowText;
|
|
|
|
}
|
|
|
|
|
|
|
|
StringFormat nodeStringFmt = new StringFormat
|
|
|
|
{
|
|
|
|
FormatFlags = StringFormatFlags.NoWrap,
|
|
|
|
Trimming = StringTrimming.None
|
|
|
|
};
|
|
|
|
|
|
|
|
if (parts.Length == 2)
|
|
|
|
{
|
|
|
|
e.Graphics.DrawString(parts[0], nodeFont, fgBrush, nodeTextRect, nodeStringFmt);
|
|
|
|
nodeTextRect.X += (int)tagSize.Width;
|
|
|
|
e.Graphics.DrawString(parts[1], nodeFont, fgBrush, nodeTextRect, nodeStringFmt);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
e.Graphics.DrawString(parts[0], nodeFont, fgBrush, nodeTextRect, nodeStringFmt);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
// If the node has focus, draw the focus rectangle large, making
|
|
|
|
// it large enough to include the text of the node tag, if present.
|
|
|
|
if ((e.State & TreeNodeStates.Focused) != 0)
|
|
|
|
{
|
|
|
|
using (Pen focusPen = SystemPens.In)
|
|
|
|
{
|
|
|
|
focusPen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dot;
|
|
|
|
Rectangle focusBounds = nodeRect;
|
|
|
|
focusBounds.Size = new Size(focusBounds.Width - 1, focusBounds.Height - 1);
|
|
|
|
e.Graphics.DrawRectangle(focusPen, focusBounds);
|
|
|
|
}
|
|
|
|
}*/
|
|
|
|
}
|
|
|
|
|
|
|
|
// This browses for an action
|
|
|
|
// Returns the new action or the same action when cancelled
|
|
|
|
public static int BrowseAction(IWin32Window owner, int action) { return BrowseAction(owner, action, false); } //mxd
|
2016-02-21 00:11:09 +00:00
|
|
|
public static int BrowseAction(IWin32Window owner, int action, bool addanyaction)
|
2009-04-19 18:07:22 +00:00
|
|
|
{
|
2016-02-21 00:11:09 +00:00
|
|
|
ActionBrowserForm f = new ActionBrowserForm(action, addanyaction);
|
2009-04-19 18:07:22 +00:00
|
|
|
if(f.ShowDialog(owner) == DialogResult.OK) action = f.SelectedAction;
|
|
|
|
f.Dispose();
|
|
|
|
return action;
|
|
|
|
}
|
2012-09-07 14:04:32 +00:00
|
|
|
|
2013-09-11 09:47:53 +00:00
|
|
|
//mxd
|
2014-12-03 23:15:26 +00:00
|
|
|
private void CreateActionCategories(int action)
|
|
|
|
{
|
2013-09-11 09:47:53 +00:00
|
|
|
actions.BeginUpdate();
|
|
|
|
actions.ShowLines = true;
|
2016-02-21 00:11:09 +00:00
|
|
|
|
|
|
|
// Add "Any action" item?
|
|
|
|
if(addanyaction)
|
|
|
|
{
|
|
|
|
TreeNode aan = actions.Nodes.Add("Any action");
|
|
|
|
aan.Tag = new LinedefActionInfo(-1, "Any action", false, false);
|
|
|
|
if(action == -1)
|
|
|
|
{
|
|
|
|
actions.SelectedNode = aan;
|
|
|
|
aan.EnsureVisible();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-12-28 15:01:53 +00:00
|
|
|
foreach(LinedefActionCategory ac in General.Map.Config.ActionCategories)
|
2014-12-03 23:15:26 +00:00
|
|
|
{
|
2013-09-11 09:47:53 +00:00
|
|
|
// Empty category names will not be created
|
|
|
|
// (those actions will go in the root of the tree)
|
2015-12-28 15:01:53 +00:00
|
|
|
if(ac.Title.Length > 0)
|
2014-12-03 23:15:26 +00:00
|
|
|
{
|
2013-09-11 09:47:53 +00:00
|
|
|
// Create category
|
2015-12-28 15:01:53 +00:00
|
|
|
TreeNode cn = actions.Nodes.Add(ac.Title);
|
|
|
|
foreach(LinedefActionInfo ai in ac.Actions)
|
2014-12-03 23:15:26 +00:00
|
|
|
{
|
2017-02-12 18:33:31 +00:00
|
|
|
// Create action
|
|
|
|
TreeNode n = cn.Nodes.Add((ai.Index > 0) ? string.Format("{0}\t{1}", ai.Index, ai.Title) : ai.Title);
|
2013-09-11 09:47:53 +00:00
|
|
|
n.Tag = ai;
|
2012-09-07 14:04:32 +00:00
|
|
|
|
2021-05-24 20:26:01 +00:00
|
|
|
// Get number of digits in the int. Thanks to https://stackoverflow.com/a/4483960
|
|
|
|
// We need this for the correct spacing between the action id and the description
|
|
|
|
if (ai.Index > 0)
|
|
|
|
{
|
|
|
|
int numdigits = (int)Math.Floor(Math.Log10(ai.Index) + 1);
|
|
|
|
if (actionidmaxdigits < numdigits)
|
|
|
|
actionidmaxdigits = numdigits;
|
|
|
|
}
|
|
|
|
|
2013-09-11 09:47:53 +00:00
|
|
|
// This is the given action?
|
2021-05-24 20:26:01 +00:00
|
|
|
if (ai.Index == action)
|
2014-12-03 23:15:26 +00:00
|
|
|
{
|
2013-09-11 09:47:53 +00:00
|
|
|
// Select this and expand the category
|
|
|
|
cn.Expand();
|
|
|
|
actions.SelectedNode = n;
|
|
|
|
n.EnsureVisible();
|
|
|
|
}
|
|
|
|
}
|
2015-12-28 15:01:53 +00:00
|
|
|
}
|
2014-12-03 23:15:26 +00:00
|
|
|
else
|
|
|
|
{
|
2013-09-11 09:47:53 +00:00
|
|
|
// Put actions in the tree root
|
2015-12-28 15:01:53 +00:00
|
|
|
foreach(LinedefActionInfo ai in ac.Actions)
|
2014-12-03 23:15:26 +00:00
|
|
|
{
|
2013-09-11 09:47:53 +00:00
|
|
|
// Create action
|
2017-02-12 18:33:31 +00:00
|
|
|
TreeNode n = actions.Nodes.Add((ai.Index > 0) ? string.Format("{0}\t{1}", ai.Index, ai.Title) : ai.Title);
|
|
|
|
n.Tag = ai;
|
2013-09-11 09:47:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
actions.EndUpdate();
|
|
|
|
}
|
2012-09-07 14:04:32 +00:00
|
|
|
|
2013-09-11 09:47:53 +00:00
|
|
|
//mxd
|
2016-02-23 13:55:53 +00:00
|
|
|
private void FilterActions(string text)
|
2014-12-03 23:15:26 +00:00
|
|
|
{
|
2016-02-23 13:55:53 +00:00
|
|
|
List<TreeNode> filterednodes = new List<TreeNode>();
|
|
|
|
HashSet<string> added = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
|
2012-09-07 14:04:32 +00:00
|
|
|
|
2016-02-23 13:55:53 +00:00
|
|
|
// First add nodes, which titles start with given text
|
2015-12-28 15:01:53 +00:00
|
|
|
foreach(TreeNode n in allNodes)
|
2014-12-03 23:15:26 +00:00
|
|
|
{
|
2015-12-28 15:01:53 +00:00
|
|
|
foreach(TreeNode cn in n.Nodes)
|
2014-12-03 23:15:26 +00:00
|
|
|
{
|
2013-09-11 09:47:53 +00:00
|
|
|
LinedefActionInfo ai = cn.Tag as LinedefActionInfo;
|
2016-02-23 13:55:53 +00:00
|
|
|
if(ai != null && ai.Title.ToUpperInvariant().StartsWith(text))
|
|
|
|
{
|
|
|
|
filterednodes.Add(cn);
|
|
|
|
added.Add(ai.Title);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Then add nodes, which titles contain given text
|
|
|
|
foreach(TreeNode n in allNodes)
|
|
|
|
{
|
|
|
|
foreach(TreeNode cn in n.Nodes)
|
|
|
|
{
|
|
|
|
LinedefActionInfo ai = cn.Tag as LinedefActionInfo;
|
|
|
|
if(ai != null && !added.Contains(ai.Title) && ai.Title.ToUpperInvariant().Contains(text))
|
|
|
|
filterednodes.Add(cn);
|
2013-09-11 09:47:53 +00:00
|
|
|
}
|
|
|
|
}
|
2012-09-07 14:04:32 +00:00
|
|
|
|
2013-09-11 09:47:53 +00:00
|
|
|
actions.BeginUpdate();
|
|
|
|
actions.Nodes.Clear();
|
|
|
|
actions.ShowLines = false;
|
2016-02-23 13:55:53 +00:00
|
|
|
actions.Nodes.AddRange(filterednodes.ToArray());
|
2013-09-11 09:47:53 +00:00
|
|
|
actions.EndUpdate();
|
|
|
|
}
|
2009-04-19 18:07:22 +00:00
|
|
|
|
|
|
|
// OK clicked
|
|
|
|
private void apply_Click(object sender, EventArgs e)
|
|
|
|
{
|
|
|
|
// Presume no result
|
|
|
|
selectedaction = 0;
|
|
|
|
|
|
|
|
// Predefined action?
|
|
|
|
if(tabs.SelectedTab == tabactions)
|
|
|
|
{
|
|
|
|
// Action node selected?
|
2016-03-18 12:52:12 +00:00
|
|
|
if(actions.SelectedNode != null && (actions.SelectedNode.Tag is LinedefActionInfo))
|
2009-04-19 18:07:22 +00:00
|
|
|
{
|
|
|
|
// Our result
|
2016-03-18 12:52:12 +00:00
|
|
|
selectedaction = ((LinedefActionInfo)actions.SelectedNode.Tag).Index;
|
2009-04-19 18:07:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
// Generalized action
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Category selected?
|
|
|
|
if(category.SelectedIndex > -1)
|
|
|
|
{
|
|
|
|
// Add category bits and go for all options
|
2015-12-28 15:01:53 +00:00
|
|
|
GeneralizedCategory sc = category.SelectedItem as GeneralizedCategory;
|
2009-04-19 18:07:22 +00:00
|
|
|
selectedaction = sc.Offset;
|
|
|
|
for(int i = 0; i < MAX_OPTIONS; i++)
|
|
|
|
{
|
|
|
|
// Option used?
|
|
|
|
if(i < sc.Options.Count)
|
|
|
|
{
|
|
|
|
// Add selected bits
|
|
|
|
if(options[i].SelectedIndex > -1)
|
|
|
|
selectedaction += (options[i].SelectedItem as GeneralizedBit).Index;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Done
|
|
|
|
this.DialogResult = DialogResult.OK;
|
|
|
|
this.Close();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Cancel clicked
|
|
|
|
private void cancel_Click(object sender, EventArgs e)
|
|
|
|
{
|
|
|
|
// Leave
|
|
|
|
this.DialogResult = DialogResult.Cancel;
|
|
|
|
this.Close();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Generalized category selected
|
|
|
|
private void category_SelectedIndexChanged(object sender, EventArgs e)
|
|
|
|
{
|
|
|
|
// Category selected?
|
|
|
|
if(category.SelectedIndex > -1)
|
|
|
|
{
|
|
|
|
// Get the category
|
2015-12-28 15:01:53 +00:00
|
|
|
GeneralizedCategory ac = category.SelectedItem as GeneralizedCategory;
|
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
// Go for all options
|
|
|
|
for(int i = 0; i < MAX_OPTIONS; i++)
|
|
|
|
{
|
|
|
|
// Option used in selected category?
|
|
|
|
if(i < ac.Options.Count)
|
|
|
|
{
|
|
|
|
// Setup controls
|
|
|
|
optionlbls[i].Text = ac.Options[i].Name + ":";
|
|
|
|
options[i].Items.Clear();
|
|
|
|
options[i].Items.AddRange(ac.Options[i].Bits.ToArray());
|
|
|
|
|
|
|
|
// Show option
|
|
|
|
options[i].Visible = true;
|
|
|
|
optionlbls[i].Visible = true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Hide option
|
|
|
|
options[i].Visible = false;
|
|
|
|
optionlbls[i].Visible = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Hide all options
|
|
|
|
for(int i = 0; i < MAX_OPTIONS; i++)
|
|
|
|
{
|
|
|
|
options[i].Visible = false;
|
|
|
|
optionlbls[i].Visible = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Double clicking on item
|
|
|
|
private void actions_DoubleClick(object sender, EventArgs e)
|
|
|
|
{
|
|
|
|
// Action node selected?
|
|
|
|
if((actions.SelectedNode != null) && (actions.SelectedNode.Tag is LinedefActionInfo))
|
|
|
|
{
|
|
|
|
if(apply.Enabled) apply_Click(this, EventArgs.Empty);
|
|
|
|
}
|
|
|
|
}
|
2012-09-07 14:04:32 +00:00
|
|
|
|
2013-09-11 09:47:53 +00:00
|
|
|
//mxd
|
2014-12-03 23:15:26 +00:00
|
|
|
private void tbFilter_TextChanged(object sender, EventArgs e)
|
|
|
|
{
|
Fixed, Visual mode, Auto-align actions: incorrect texture was used when clamping texture offsets of 3D floor sides.
Fixed, Numeric textbox: incorrect character was treated as decimal separator character was used when using certain Windows regional settings.
Changed, Edit Things window: when applicable, the "Filter" textbox is now focused when opening the window.
Changed, Sector Effects browser window: when applicable, the "Filter" textbox is now focused when opening the window.
Changed, Edit Things window: when the "Filter" textbox is focused, pressing the "Down" key will now switch focus to the Things list.
Changed, Sector Effects Browser window: when the "Filter" textbox is focused, pressing the "Down" key will now switch focus to the Effects list.
Changed, Linedef Action Browser window: when the "Filter" textbox is focused, pressing the "Down" key will now switch focus to the Actions list.
Configurations, Doom map format thing flags: changed "Multiplayer" flag name to "Multiplayer only".
2015-09-23 11:04:12 +00:00
|
|
|
if(!string.IsNullOrEmpty(tbFilter.Text.Trim()))
|
2014-12-03 23:15:26 +00:00
|
|
|
{
|
2016-02-23 13:55:53 +00:00
|
|
|
FilterActions(tbFilter.Text.ToUpperInvariant());
|
2014-12-03 23:15:26 +00:00
|
|
|
}
|
Fixed, Visual mode, Auto-align actions: incorrect texture was used when clamping texture offsets of 3D floor sides.
Fixed, Numeric textbox: incorrect character was treated as decimal separator character was used when using certain Windows regional settings.
Changed, Edit Things window: when applicable, the "Filter" textbox is now focused when opening the window.
Changed, Sector Effects browser window: when applicable, the "Filter" textbox is now focused when opening the window.
Changed, Edit Things window: when the "Filter" textbox is focused, pressing the "Down" key will now switch focus to the Things list.
Changed, Sector Effects Browser window: when the "Filter" textbox is focused, pressing the "Down" key will now switch focus to the Effects list.
Changed, Linedef Action Browser window: when the "Filter" textbox is focused, pressing the "Down" key will now switch focus to the Actions list.
Configurations, Doom map format thing flags: changed "Multiplayer" flag name to "Multiplayer only".
2015-09-23 11:04:12 +00:00
|
|
|
else
|
2014-12-03 23:15:26 +00:00
|
|
|
{
|
2013-09-11 09:47:53 +00:00
|
|
|
actions.Nodes.Clear();
|
2014-12-03 23:15:26 +00:00
|
|
|
CreateActionCategories(actions.SelectedNode != null ? ((LinedefActionInfo)actions.SelectedNode.Tag).Index : 0);
|
2013-09-11 09:47:53 +00:00
|
|
|
}
|
|
|
|
}
|
2012-09-07 14:04:32 +00:00
|
|
|
|
Fixed, Visual mode, Auto-align actions: incorrect texture was used when clamping texture offsets of 3D floor sides.
Fixed, Numeric textbox: incorrect character was treated as decimal separator character was used when using certain Windows regional settings.
Changed, Edit Things window: when applicable, the "Filter" textbox is now focused when opening the window.
Changed, Sector Effects browser window: when applicable, the "Filter" textbox is now focused when opening the window.
Changed, Edit Things window: when the "Filter" textbox is focused, pressing the "Down" key will now switch focus to the Things list.
Changed, Sector Effects Browser window: when the "Filter" textbox is focused, pressing the "Down" key will now switch focus to the Effects list.
Changed, Linedef Action Browser window: when the "Filter" textbox is focused, pressing the "Down" key will now switch focus to the Actions list.
Configurations, Doom map format thing flags: changed "Multiplayer" flag name to "Multiplayer only".
2015-09-23 11:04:12 +00:00
|
|
|
//mxd. Switch focus to actions list?
|
|
|
|
private void tbFilter_KeyUp(object sender, KeyEventArgs e)
|
|
|
|
{
|
|
|
|
if(e.KeyCode == Keys.Down && actions.Nodes.Count > 0)
|
|
|
|
{
|
|
|
|
actions.SelectedNode = actions.Nodes[0];
|
|
|
|
actions.Focus();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-09-11 09:47:53 +00:00
|
|
|
//mxd
|
2014-12-03 23:15:26 +00:00
|
|
|
private void btnClearFilter_Click(object sender, EventArgs e)
|
|
|
|
{
|
2013-09-11 09:47:53 +00:00
|
|
|
tbFilter.Clear();
|
|
|
|
}
|
2014-07-18 11:25:08 +00:00
|
|
|
|
|
|
|
//mxd
|
2014-12-03 23:15:26 +00:00
|
|
|
private void ActionBrowserForm_Shown(object sender, EventArgs e)
|
|
|
|
{
|
Fixed, Visual mode, Auto-align actions: incorrect texture was used when clamping texture offsets of 3D floor sides.
Fixed, Numeric textbox: incorrect character was treated as decimal separator character was used when using certain Windows regional settings.
Changed, Edit Things window: when applicable, the "Filter" textbox is now focused when opening the window.
Changed, Sector Effects browser window: when applicable, the "Filter" textbox is now focused when opening the window.
Changed, Edit Things window: when the "Filter" textbox is focused, pressing the "Down" key will now switch focus to the Things list.
Changed, Sector Effects Browser window: when the "Filter" textbox is focused, pressing the "Down" key will now switch focus to the Effects list.
Changed, Linedef Action Browser window: when the "Filter" textbox is focused, pressing the "Down" key will now switch focus to the Actions list.
Configurations, Doom map format thing flags: changed "Multiplayer" flag name to "Multiplayer only".
2015-09-23 11:04:12 +00:00
|
|
|
if(tabs.SelectedTab == tabactions) tbFilter.Focus();
|
2014-07-18 11:25:08 +00:00
|
|
|
}
|
2015-11-16 21:10:11 +00:00
|
|
|
|
|
|
|
//mxd
|
|
|
|
private void actions_MouseEnter(object sender, EventArgs e)
|
|
|
|
{
|
|
|
|
actions.Focus();
|
|
|
|
}
|
|
|
|
|
|
|
|
//mxd. Transfer focus to Filter textbox
|
|
|
|
private void actions_KeyPress(object sender, KeyPressEventArgs e)
|
|
|
|
{
|
|
|
|
tbFilter.Focus();
|
|
|
|
if(e.KeyChar == '\b') // Any better way to check for Backspace?..
|
|
|
|
{
|
|
|
|
if(!string.IsNullOrEmpty(tbFilter.Text) && tbFilter.SelectionStart > 0 && tbFilter.SelectionLength == 0)
|
|
|
|
{
|
|
|
|
int s = tbFilter.SelectionStart - 1;
|
|
|
|
tbFilter.Text = tbFilter.Text.Remove(s, 1);
|
|
|
|
tbFilter.SelectionStart = s;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
tbFilter.AppendText(e.KeyChar.ToString(CultureInfo.InvariantCulture));
|
|
|
|
}
|
|
|
|
}
|
2009-04-19 18:07:22 +00:00
|
|
|
}
|
|
|
|
}
|