Selection groups are now stored in the map's .dbs file.

Rewritten Add to/Select/Clear group Edit menu handling.
This commit is contained in:
MaxED 2014-07-16 09:45:04 +00:00
parent f3f6d62081
commit 7cce80f030
9 changed files with 303 additions and 490 deletions

View file

@ -417,6 +417,9 @@ namespace CodeImp.DoomBuilder {
//mxd. check script names
UpdateScriptNames();
//mxd. Restore selection groups
options.ReadSelectionGroups();
// Bind any methods
General.Actions.BindMethods(this);
@ -503,6 +506,9 @@ namespace CodeImp.DoomBuilder {
//mxd. check script names
UpdateScriptNames();
//mxd. Restore selection groups
options.ReadSelectionGroups();
// Center map in screen
if (General.Editing.Mode is ClassicMode) {
ClassicMode mode = General.Editing.Mode as ClassicMode;
@ -1239,7 +1245,7 @@ namespace CodeImp.DoomBuilder {
General.Interface.SetCursor(Cursors.WaitCursor);
// Clear group
map.ClearGroup(0x01 << groupindex, groupindex);
map.ClearGroup(0x01 << groupindex);
General.Interface.DisplayStatus(StatusType.Action, "Cleared group " + (groupindex + 1));
General.Interface.SetCursor(Cursors.Default);

View file

@ -1,52 +1,40 @@
namespace CodeImp.DoomBuilder.Map
using System.Collections.Generic;
namespace CodeImp.DoomBuilder.Map
{
public class GroupInfo
{
private int numSectors;
private int numLines;
private int numVerts;
private int numThings;
private readonly int numSectors;
private readonly int numLines;
private readonly int numVerts;
private readonly int numThings;
public GroupInfo(int numSectors, int numLines, int numVerts, int numThings) {
private readonly int index;
private readonly bool empty;
public bool Empty { get { return empty; } }
public int Index { get { return index; } }
public GroupInfo(int index, int numSectors, int numLines, int numVerts, int numThings) {
this.index = index;
this.numSectors = numSectors;
this.numLines = numLines;
this.numVerts = numVerts;
this.numThings = numThings;
empty = (numSectors == 0 && numLines == 0 && numVerts == 0 && numThings == 0);
}
public override string ToString() {
string result = string.Empty;
if(numSectors > 0) result = numSectors + (numSectors > 1 ? " sectors" : " sector");
if (empty) return index + ": Empty";
List<string> result = new List<string>();
if(numLines > 0){
if(string.IsNullOrEmpty(result))
result = numLines + (numLines > 1 ? " lines" : " line");
else
result += ", " + numLines + (numLines > 1 ? " lines" : " line");
}
if(numSectors > 0) result.Add(numSectors + (numSectors > 1 ? " sectors" : " sector"));
if(numLines > 0) result.Add(numLines + (numLines > 1 ? " lines" : " line"));
if(numVerts > 0) result.Add(numVerts + (numVerts > 1 ? " vertices" : " vertex"));
if(numThings > 0) result.Add(numThings + (numThings > 1 ? " things" : " thing"));
if(numVerts > 0){
if(string.IsNullOrEmpty(result))
result = numVerts + (numVerts > 1 ? " vertices" : " vertex");
else
result += ", " + numLines + (numVerts > 1 ? " vertices" : " vertex");
}
if(numThings > 0){
if(string.IsNullOrEmpty(result))
result = numThings + (numThings > 1 ? " things" : " thing");
else
result += ", " + numThings + (numThings > 1 ? " things" : " thing");
}
return result;
}
internal void Append(int numSectors, int numLines, int numVerts, int numThings) {
this.numSectors += numSectors;
this.numLines += numLines;
this.numVerts += numVerts;
this.numThings += numThings;
return index + ": " + string.Join(", ", result.ToArray());
}
}
}

View file

@ -290,6 +290,9 @@ namespace CodeImp.DoomBuilder.Map
// Write resources to config
resources.WriteToConfig(mapconfig, "resources");
//mxd. Save selection groups
General.Map.Map.WriteSelectionGroups(mapconfig);
//mxd. Save Tag Labels
if(tagLabels.Count > 0) {
ListDictionary tagLabelsData = new ListDictionary();
@ -326,12 +329,13 @@ namespace CodeImp.DoomBuilder.Map
mapconfig.WriteSetting("overrideceilheight", overrideceilheight);
mapconfig.WriteSetting("overridebrightness", overridebrightness);
//mxd. Write script compiler
if(!string.IsNullOrEmpty(scriptcompiler))
mapconfig.WriteSetting("scriptcompiler", scriptcompiler);
// Write grid settings
General.Map.Grid.WriteToConfig(mapconfig, "grid");
//mxd. Write script compiler
if(!string.IsNullOrEmpty(scriptcompiler)) mapconfig.WriteSetting("scriptcompiler", scriptcompiler);
// Write scripts to config
mapconfig.DeleteSetting("scripts");
for(int i = 0; i < scriptfiles.Count; i++)
@ -414,6 +418,12 @@ namespace CodeImp.DoomBuilder.Map
General.Map.Grid.ReadFromConfig(mapconfig, "grid");
}
//mxd. This reads stored selection groups from the map configuration
internal void ReadSelectionGroups()
{
General.Map.Map.ReadSelectionGroups(mapconfig);
}
// This displays the current map name
public override string ToString()
{
@ -423,10 +433,8 @@ namespace CodeImp.DoomBuilder.Map
// This returns the UDMF field type
internal int GetUniversalFieldType(string elementname, string fieldname, int defaulttype)
{
int type;
// Check if the field type is set in the game configuration
type = General.Map.Config.ReadSetting("universalfields." + elementname + "." + fieldname + ".type", -1);
int type = General.Map.Config.ReadSetting("universalfields." + elementname + "." + fieldname + ".type", -1);
if(type == -1)
{
// Read from map configuration

View file

@ -17,14 +17,16 @@
#region ================== Namespaces
using System;
using System.Collections;
using System.Collections.Generic;
using CodeImp.DoomBuilder.Geometry;
using CodeImp.DoomBuilder.Windows;
using System.Collections.Specialized;
using System.Drawing;
using CodeImp.DoomBuilder.IO;
using CodeImp.DoomBuilder.Types;
using System.IO;
using CodeImp.DoomBuilder.Config;
using CodeImp.DoomBuilder.Geometry;
using CodeImp.DoomBuilder.IO;
using CodeImp.DoomBuilder.Types;
using CodeImp.DoomBuilder.Windows;
#endregion
@ -49,6 +51,9 @@ namespace CodeImp.DoomBuilder.Map
// conflict with any other valid UDMF field.
internal const string VIRTUAL_SECTOR_FIELD = "!virtual_sector";
//mxd
private const string SELECTION_GROUPS_PATH = "selectiongroups";
// Handler for tag fields
public delegate void TagHandler<T>(MapElement element, bool actionargument, UniversalType type, ref int value, T obj);
@ -75,9 +80,6 @@ namespace CodeImp.DoomBuilder.Map
private int numsectors;
private int numthings;
//mxd
private GroupInfo[] groupInfos;
// Behavior
private int freezearrays;
private bool autoremove;
@ -158,8 +160,6 @@ namespace CodeImp.DoomBuilder.Map
internal bool AutoRemove { get { return autoremove; } set { autoremove = value; } }
public GroupInfo[] GroupInfos { get { return groupInfos; } } //mxd
#endregion
#region ================== Constructor / Disposer
@ -180,7 +180,6 @@ namespace CodeImp.DoomBuilder.Map
indexholes = new List<int>();
lastsectorindex = 0;
autoremove = true;
groupInfos = new GroupInfo[10]; //mxd
// We have no destructor
GC.SuppressFinalize(this);
@ -202,7 +201,6 @@ namespace CodeImp.DoomBuilder.Map
indexholes = new List<int>();
lastsectorindex = 0;
autoremove = true;
groupInfos = new GroupInfo[10]; //mxd
// Deserialize
Deserialize(stream);
@ -252,7 +250,6 @@ namespace CodeImp.DoomBuilder.Map
sel_sectors = null;
sel_things = null;
indexholes = null;
groupInfos = null; //mxd
// Done
isdisposed = true;
@ -1317,100 +1314,201 @@ namespace CodeImp.DoomBuilder.Map
foreach(Thing t in things) if(t.Marked == mark) t.Selected = select;
}
#endregion
#region ================== Selection groups
/// <summary>This selects geometry by selection group index.</summary>
public void SelectVerticesByGroup(int groupmask)
{
foreach(SelectableElement e in vertices) e.SelectByGroup(groupmask);
foreach(Vertex e in vertices) e.SelectByGroup(groupmask);
}
/// <summary>This selects geometry by selection group index.</summary>
public void SelectLinedefsByGroup(int groupmask)
{
foreach(SelectableElement e in linedefs) e.SelectByGroup(groupmask);
foreach(Linedef e in linedefs) e.SelectByGroup(groupmask);
}
/// <summary>This selects geometry by selection group index.</summary>
public void SelectSectorsByGroup(int groupmask)
{
foreach(SelectableElement e in sectors) e.SelectByGroup(groupmask);
foreach(Sector e in sectors) e.SelectByGroup(groupmask);
}
/// <summary>This selects geometry by selection group index.</summary>
public void SelectThingsByGroup(int groupmask)
{
foreach(SelectableElement e in things) e.SelectByGroup(groupmask);
foreach(Thing e in things) e.SelectByGroup(groupmask);
}
/// <summary>This adds the current selection to the specified selection group.</summary>
//mxd. switched groupmask to groupindex
public void AddSelectionToGroup(int groupindex)
{
int groupmask = 0x01 << groupindex;
foreach(Vertex e in vertices) if(e.Selected) e.AddToGroup(groupmask);
foreach(Linedef e in linedefs) if(e.Selected) e.AddToGroup(groupmask);
foreach(Sector e in sectors) if(e.Selected) e.AddToGroup(groupmask);
foreach(Thing e in things) if(e.Selected) e.AddToGroup(groupmask);
}
/// <summary>This clears specified selection group.</summary>
//mxd
public void ClearGroup(int groupmask)
{
foreach(Vertex e in vertices) e.RemoveFromGroup(groupmask);
foreach(Linedef e in linedefs) e.RemoveFromGroup(groupmask);
foreach(Sector e in sectors) e.RemoveFromGroup(groupmask);
foreach(Thing e in things) e.RemoveFromGroup(groupmask);
}
//mxd
internal GroupInfo GetGroupInfo(int groupindex)
{
int numSectors = 0;
int numLines = 0;
int numVerts = 0;
int numThings = 0;
int groupmask = 0x01 << groupindex;
foreach(SelectableElement e in vertices) {
if(e.Selected) {
numVerts++;//mxd
e.AddToGroup(groupmask);
foreach(Vertex e in vertices) if(e.IsInGroup(groupmask)) numVerts++; //mxd
foreach(Linedef e in linedefs) if(e.IsInGroup(groupmask)) numLines++; //mxd
foreach(Sector e in sectors) if(e.IsInGroup(groupmask)) numSectors++; //mxd
foreach(Thing e in things) if(e.IsInGroup(groupmask)) numThings++; //mxd
return new GroupInfo(groupindex + 1, numSectors, numLines, numVerts, numThings);
}
//mxd
internal void WriteSelectionGroups(Configuration cfg)
{
List<string> indices;
// Fill structure
IDictionary groups = new ListDictionary();
for(int i = 0; i < 10; i++)
{
IDictionary group = new ListDictionary();
int groupmask = 0x01 << i;
//store verts
indices = new List<string>();
foreach(Vertex e in vertices) if(e.IsInGroup(groupmask)) indices.Add(e.Index.ToString());
if(indices.Count > 0) group.Add("vertices", string.Join(" ", indices.ToArray()));
//store linedefs
indices.Clear();
foreach(Linedef e in linedefs) if(e.IsInGroup(groupmask)) indices.Add(e.Index.ToString());
if(indices.Count > 0) group.Add("linedefs", string.Join(" ", indices.ToArray()));
//store sectors
indices.Clear();
foreach(Sector e in sectors) if(e.IsInGroup(groupmask)) indices.Add(e.Index.ToString());
if(indices.Count > 0) group.Add("sectors", string.Join(" ", indices.ToArray()));
//store things
indices.Clear();
foreach(Thing e in things) if(e.IsInGroup(groupmask)) indices.Add(e.Index.ToString());
if(indices.Count > 0) group.Add("things", string.Join(" ", indices.ToArray()));
//add to main collection
if(group.Count > 0) groups.Add(i, group);
}
// Write to config
if(groups.Count > 0) cfg.WriteSetting(SELECTION_GROUPS_PATH, groups);
}
//mxd
internal void ReadSelectionGroups(Configuration cfg)
{
IDictionary grouplist = cfg.ReadSetting(SELECTION_GROUPS_PATH, new Hashtable());
IDictionary groupinfo;
foreach(DictionaryEntry mp in grouplist) {
// Item is a structure?
if(mp.Value is IDictionary) {
//get group number
int groupnum;
if(!int.TryParse(mp.Key as string, out groupnum)) continue;
int groupmask = 0x01 << groupnum;
groupinfo = (IDictionary)mp.Value;
if(groupinfo.Contains("vertices"))
{
string s = groupinfo["vertices"] as string;
if (!string.IsNullOrEmpty(s))
{
List<int> indices = getIndices(groupinfo["vertices"] as string);
foreach (int index in indices)
{
if(index > vertices.Length) continue;
vertices[index].AddToGroup(groupmask);
}
}
}
foreach(SelectableElement e in linedefs) {
if(e.Selected) {
numLines++;//mxd
e.AddToGroup(groupmask);
if(groupinfo.Contains("linedefs"))
{
string s = groupinfo["linedefs"] as string;
if(!string.IsNullOrEmpty(s))
{
List<int> indices = getIndices(groupinfo["linedefs"] as string);
foreach(int index in indices)
{
if(index > linedefs.Length) continue;
linedefs[index].AddToGroup(groupmask);
}
}
}
foreach(SelectableElement e in sectors) {
if(e.Selected) {
numSectors++;//mxd
e.AddToGroup(groupmask);
if(groupinfo.Contains("sectors"))
{
string s = groupinfo["sectors"] as string;
if(!string.IsNullOrEmpty(s))
{
List<int> indices = getIndices(groupinfo["sectors"] as string);
foreach(int index in indices)
{
if(index > sectors.Length) continue;
sectors[index].AddToGroup(groupmask);
}
}
}
foreach(SelectableElement e in things) {
if(e.Selected) {
numThings++;//mxd
e.AddToGroup(groupmask);
if(groupinfo.Contains("things"))
{
string s = groupinfo["things"] as string;
if(!string.IsNullOrEmpty(s))
{
List<int> indices = getIndices(groupinfo["things"] as string);
foreach(int index in indices)
{
if(index > things.Length) continue;
things[index].AddToGroup(groupmask);
}
}
}
}
}
}
//mxd
if(numSectors > 0 || numLines > 0 || numThings > 0 || numVerts > 0) {
if(groupInfos[groupindex] != null)
groupInfos[groupindex].Append(numSectors, numLines, numVerts, numThings);
else
groupInfos[groupindex] = new GroupInfo(numSectors, numLines, numVerts, numThings);
}
}
private List<int> getIndices(string input)
{
string[] parts = input.Split(new[] {' '}, StringSplitOptions.RemoveEmptyEntries);
int index;
List<int> result = new List<int>(parts.Length);
//mxd
public void ClearGroup(int groupmask, int groupindex) {
foreach(SelectableElement e in vertices)
e.RemoveFromGroup(groupmask);
foreach (string part in parts) if(int.TryParse(part, out index)) result.Add(index);
foreach(SelectableElement e in linedefs)
e.RemoveFromGroup(groupmask);
foreach(SelectableElement e in sectors)
e.RemoveFromGroup(groupmask);
foreach(SelectableElement e in things)
e.RemoveFromGroup(groupmask);
groupInfos[groupindex] = null;
}
//mxd
public bool HaveSelectionGroups() {
foreach(GroupInfo info in groupInfos)
if(info != null) return true;
return false;
return result;
}
#endregion
@ -3117,9 +3215,9 @@ namespace CodeImp.DoomBuilder.Map
}
//mxd
public void UpdateCustomLinedefColors() {
foreach(Linedef l in linedefs)
l.UpdateColorPreset();
public void UpdateCustomLinedefColors()
{
foreach(Linedef l in linedefs) l.UpdateColorPreset();
}
#endregion

View file

@ -101,6 +101,12 @@ namespace CodeImp.DoomBuilder.Map
this.Selected = ((groups & groupsmask) != 0);
}
//mxd. This checks if given element belongs to a particular group
public bool IsInGroup(int groupsmask)
{
return ((groups & groupsmask) != 0);
}
#endregion
}
}

View file

@ -82,38 +82,8 @@ namespace CodeImp.DoomBuilder.Windows
this.itemgridsetup = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator();
this.addToGroup = new System.Windows.Forms.ToolStripMenuItem();
this.addGroup1 = new System.Windows.Forms.ToolStripMenuItem();
this.addGroup2 = new System.Windows.Forms.ToolStripMenuItem();
this.addGroup3 = new System.Windows.Forms.ToolStripMenuItem();
this.addGroup4 = new System.Windows.Forms.ToolStripMenuItem();
this.addGroup5 = new System.Windows.Forms.ToolStripMenuItem();
this.addGroup6 = new System.Windows.Forms.ToolStripMenuItem();
this.addGroup7 = new System.Windows.Forms.ToolStripMenuItem();
this.addGroup8 = new System.Windows.Forms.ToolStripMenuItem();
this.addGroup9 = new System.Windows.Forms.ToolStripMenuItem();
this.addGroup10 = new System.Windows.Forms.ToolStripMenuItem();
this.selectGroup = new System.Windows.Forms.ToolStripMenuItem();
this.selectGroup1 = new System.Windows.Forms.ToolStripMenuItem();
this.selectGroup2 = new System.Windows.Forms.ToolStripMenuItem();
this.selectGroup3 = new System.Windows.Forms.ToolStripMenuItem();
this.selectGroup4 = new System.Windows.Forms.ToolStripMenuItem();
this.selectGroup5 = new System.Windows.Forms.ToolStripMenuItem();
this.selectGroup6 = new System.Windows.Forms.ToolStripMenuItem();
this.selectGroup7 = new System.Windows.Forms.ToolStripMenuItem();
this.selectGroup8 = new System.Windows.Forms.ToolStripMenuItem();
this.selectGroup9 = new System.Windows.Forms.ToolStripMenuItem();
this.selectGroup10 = new System.Windows.Forms.ToolStripMenuItem();
this.clearGroup = new System.Windows.Forms.ToolStripMenuItem();
this.clearGroup1 = new System.Windows.Forms.ToolStripMenuItem();
this.clearGroup2 = new System.Windows.Forms.ToolStripMenuItem();
this.clearGroup3 = new System.Windows.Forms.ToolStripMenuItem();
this.clearGroup4 = new System.Windows.Forms.ToolStripMenuItem();
this.clearGroup5 = new System.Windows.Forms.ToolStripMenuItem();
this.clearGroup6 = new System.Windows.Forms.ToolStripMenuItem();
this.clearGroup7 = new System.Windows.Forms.ToolStripMenuItem();
this.clearGroup8 = new System.Windows.Forms.ToolStripMenuItem();
this.clearGroup9 = new System.Windows.Forms.ToolStripMenuItem();
this.clearGroup10 = new System.Windows.Forms.ToolStripMenuItem();
this.itemmapoptions = new System.Windows.Forms.ToolStripMenuItem();
this.itemviewusedtags = new System.Windows.Forms.ToolStripMenuItem();
this.itemviewthingtypes = new System.Windows.Forms.ToolStripMenuItem();
@ -389,7 +359,7 @@ namespace CodeImp.DoomBuilder.Windows
this.menuhelp});
this.menumain.Location = new System.Drawing.Point(0, 0);
this.menumain.Name = "menumain";
this.menumain.Size = new System.Drawing.Size(328, 24);
this.menumain.Size = new System.Drawing.Size(420, 24);
this.menumain.TabIndex = 0;
//
// menufile
@ -683,297 +653,21 @@ namespace CodeImp.DoomBuilder.Windows
//
// addToGroup
//
this.addToGroup.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.addGroup1,
this.addGroup2,
this.addGroup3,
this.addGroup4,
this.addGroup5,
this.addGroup6,
this.addGroup7,
this.addGroup8,
this.addGroup9,
this.addGroup10});
this.addToGroup.Name = "addToGroup";
this.addToGroup.Size = new System.Drawing.Size(219, 22);
this.addToGroup.Text = "Add Selection to Group";
this.addToGroup.DropDownOpening += new System.EventHandler(this.addToGroup_DropDownOpening);
//
// addGroup1
//
this.addGroup1.Name = "addGroup1";
this.addGroup1.Size = new System.Drawing.Size(253, 22);
this.addGroup1.Tag = "builder_assigngroup1";
this.addGroup1.Text = "1: 100 sectors, 12 vertices, 5 things";
this.addGroup1.Click += new System.EventHandler(this.InvokeTaggedAction);
//
// addGroup2
//
this.addGroup2.Name = "addGroup2";
this.addGroup2.Size = new System.Drawing.Size(253, 22);
this.addGroup2.Tag = "builder_assigngroup2";
this.addGroup2.Text = "2:";
this.addGroup2.Click += new System.EventHandler(this.InvokeTaggedAction);
//
// addGroup3
//
this.addGroup3.Name = "addGroup3";
this.addGroup3.Size = new System.Drawing.Size(253, 22);
this.addGroup3.Tag = "builder_assigngroup3";
this.addGroup3.Text = "3:";
this.addGroup3.Click += new System.EventHandler(this.InvokeTaggedAction);
//
// addGroup4
//
this.addGroup4.Name = "addGroup4";
this.addGroup4.Size = new System.Drawing.Size(253, 22);
this.addGroup4.Tag = "builder_assigngroup4";
this.addGroup4.Text = "4:";
this.addGroup4.Click += new System.EventHandler(this.InvokeTaggedAction);
//
// addGroup5
//
this.addGroup5.Name = "addGroup5";
this.addGroup5.Size = new System.Drawing.Size(253, 22);
this.addGroup5.Tag = "builder_assigngroup5";
this.addGroup5.Text = "5:";
this.addGroup5.Click += new System.EventHandler(this.InvokeTaggedAction);
//
// addGroup6
//
this.addGroup6.Name = "addGroup6";
this.addGroup6.Size = new System.Drawing.Size(253, 22);
this.addGroup6.Tag = "builder_assigngroup6";
this.addGroup6.Text = "6:";
this.addGroup6.Click += new System.EventHandler(this.InvokeTaggedAction);
//
// addGroup7
//
this.addGroup7.Name = "addGroup7";
this.addGroup7.Size = new System.Drawing.Size(253, 22);
this.addGroup7.Tag = "builder_assigngroup7";
this.addGroup7.Text = "7:";
this.addGroup7.Click += new System.EventHandler(this.InvokeTaggedAction);
//
// addGroup8
//
this.addGroup8.Name = "addGroup8";
this.addGroup8.Size = new System.Drawing.Size(253, 22);
this.addGroup8.Tag = "builder_assigngroup8";
this.addGroup8.Text = "8:";
this.addGroup8.Click += new System.EventHandler(this.InvokeTaggedAction);
//
// addGroup9
//
this.addGroup9.Name = "addGroup9";
this.addGroup9.Size = new System.Drawing.Size(253, 22);
this.addGroup9.Tag = "builder_assigngroup9";
this.addGroup9.Text = "9:";
this.addGroup9.Click += new System.EventHandler(this.InvokeTaggedAction);
//
// addGroup10
//
this.addGroup10.Name = "addGroup10";
this.addGroup10.Size = new System.Drawing.Size(253, 22);
this.addGroup10.Tag = "builder_assigngroup10";
this.addGroup10.Text = "10:";
this.addGroup10.Click += new System.EventHandler(this.InvokeTaggedAction);
//
// selectGroup
//
this.selectGroup.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.selectGroup1,
this.selectGroup2,
this.selectGroup3,
this.selectGroup4,
this.selectGroup5,
this.selectGroup6,
this.selectGroup7,
this.selectGroup8,
this.selectGroup9,
this.selectGroup10});
this.selectGroup.Name = "selectGroup";
this.selectGroup.Size = new System.Drawing.Size(219, 22);
this.selectGroup.Text = "Select Group";
this.selectGroup.DropDownOpening += new System.EventHandler(this.selectGroup_DropDownOpening);
//
// selectGroup1
//
this.selectGroup1.Name = "selectGroup1";
this.selectGroup1.Size = new System.Drawing.Size(89, 22);
this.selectGroup1.Tag = "builder_selectgroup1";
this.selectGroup1.Text = "1:";
this.selectGroup1.Click += new System.EventHandler(this.InvokeTaggedAction);
//
// selectGroup2
//
this.selectGroup2.Name = "selectGroup2";
this.selectGroup2.Size = new System.Drawing.Size(89, 22);
this.selectGroup2.Tag = "builder_selectgroup2";
this.selectGroup2.Text = "2:";
this.selectGroup2.Click += new System.EventHandler(this.InvokeTaggedAction);
//
// selectGroup3
//
this.selectGroup3.Name = "selectGroup3";
this.selectGroup3.Size = new System.Drawing.Size(89, 22);
this.selectGroup3.Tag = "builder_selectgroup3";
this.selectGroup3.Text = "3:";
this.selectGroup3.Click += new System.EventHandler(this.InvokeTaggedAction);
//
// selectGroup4
//
this.selectGroup4.Name = "selectGroup4";
this.selectGroup4.Size = new System.Drawing.Size(89, 22);
this.selectGroup4.Tag = "builder_selectgroup4";
this.selectGroup4.Text = "4:";
this.selectGroup4.Click += new System.EventHandler(this.InvokeTaggedAction);
//
// selectGroup5
//
this.selectGroup5.Name = "selectGroup5";
this.selectGroup5.Size = new System.Drawing.Size(89, 22);
this.selectGroup5.Tag = "builder_selectgroup5";
this.selectGroup5.Text = "5:";
this.selectGroup5.Click += new System.EventHandler(this.InvokeTaggedAction);
//
// selectGroup6
//
this.selectGroup6.Name = "selectGroup6";
this.selectGroup6.Size = new System.Drawing.Size(89, 22);
this.selectGroup6.Tag = "builder_selectgroup6";
this.selectGroup6.Text = "6:";
this.selectGroup6.Click += new System.EventHandler(this.InvokeTaggedAction);
//
// selectGroup7
//
this.selectGroup7.Name = "selectGroup7";
this.selectGroup7.Size = new System.Drawing.Size(89, 22);
this.selectGroup7.Tag = "builder_selectgroup7";
this.selectGroup7.Text = "7:";
this.selectGroup7.Click += new System.EventHandler(this.InvokeTaggedAction);
//
// selectGroup8
//
this.selectGroup8.Name = "selectGroup8";
this.selectGroup8.Size = new System.Drawing.Size(89, 22);
this.selectGroup8.Tag = "builder_selectgroup8";
this.selectGroup8.Text = "8:";
this.selectGroup8.Click += new System.EventHandler(this.InvokeTaggedAction);
//
// selectGroup9
//
this.selectGroup9.Name = "selectGroup9";
this.selectGroup9.Size = new System.Drawing.Size(89, 22);
this.selectGroup9.Tag = "builder_selectgroup9";
this.selectGroup9.Text = "9:";
this.selectGroup9.Click += new System.EventHandler(this.InvokeTaggedAction);
//
// selectGroup10
//
this.selectGroup10.Name = "selectGroup10";
this.selectGroup10.Size = new System.Drawing.Size(89, 22);
this.selectGroup10.Tag = "builder_selectgroup10";
this.selectGroup10.Text = "10:";
this.selectGroup10.Click += new System.EventHandler(this.InvokeTaggedAction);
//
// clearGroup
//
this.clearGroup.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.clearGroup1,
this.clearGroup2,
this.clearGroup3,
this.clearGroup4,
this.clearGroup5,
this.clearGroup6,
this.clearGroup7,
this.clearGroup8,
this.clearGroup9,
this.clearGroup10});
this.clearGroup.Name = "clearGroup";
this.clearGroup.Size = new System.Drawing.Size(219, 22);
this.clearGroup.Text = "Clear Group";
this.clearGroup.DropDownOpening += new System.EventHandler(this.selectGroup_DropDownOpening);
//
// clearGroup1
//
this.clearGroup1.Name = "clearGroup1";
this.clearGroup1.Size = new System.Drawing.Size(89, 22);
this.clearGroup1.Tag = "builder_cleargroup1";
this.clearGroup1.Text = "1:";
this.clearGroup1.Click += new System.EventHandler(this.InvokeTaggedAction);
//
// clearGroup2
//
this.clearGroup2.Name = "clearGroup2";
this.clearGroup2.Size = new System.Drawing.Size(89, 22);
this.clearGroup2.Tag = "builder_cleargroup2";
this.clearGroup2.Text = "2:";
this.clearGroup2.Click += new System.EventHandler(this.InvokeTaggedAction);
//
// clearGroup3
//
this.clearGroup3.Name = "clearGroup3";
this.clearGroup3.Size = new System.Drawing.Size(89, 22);
this.clearGroup3.Tag = "builder_cleargroup3";
this.clearGroup3.Text = "3:";
this.clearGroup3.Click += new System.EventHandler(this.InvokeTaggedAction);
//
// clearGroup4
//
this.clearGroup4.Name = "clearGroup4";
this.clearGroup4.Size = new System.Drawing.Size(89, 22);
this.clearGroup4.Tag = "builder_cleargroup4";
this.clearGroup4.Text = "4:";
this.clearGroup4.Click += new System.EventHandler(this.InvokeTaggedAction);
//
// clearGroup5
//
this.clearGroup5.Name = "clearGroup5";
this.clearGroup5.Size = new System.Drawing.Size(89, 22);
this.clearGroup5.Tag = "builder_cleargroup5";
this.clearGroup5.Text = "5:";
this.clearGroup5.Click += new System.EventHandler(this.InvokeTaggedAction);
//
// clearGroup6
//
this.clearGroup6.Name = "clearGroup6";
this.clearGroup6.Size = new System.Drawing.Size(89, 22);
this.clearGroup6.Tag = "builder_cleargroup6";
this.clearGroup6.Text = "6:";
this.clearGroup6.Click += new System.EventHandler(this.InvokeTaggedAction);
//
// clearGroup7
//
this.clearGroup7.Name = "clearGroup7";
this.clearGroup7.Size = new System.Drawing.Size(89, 22);
this.clearGroup7.Tag = "builder_cleargroup7";
this.clearGroup7.Text = "7:";
this.clearGroup7.Click += new System.EventHandler(this.InvokeTaggedAction);
//
// clearGroup8
//
this.clearGroup8.Name = "clearGroup8";
this.clearGroup8.Size = new System.Drawing.Size(89, 22);
this.clearGroup8.Tag = "builder_cleargroup8";
this.clearGroup8.Text = "8:";
this.clearGroup8.Click += new System.EventHandler(this.InvokeTaggedAction);
//
// clearGroup9
//
this.clearGroup9.Name = "clearGroup9";
this.clearGroup9.Size = new System.Drawing.Size(89, 22);
this.clearGroup9.Tag = "builder_cleargroup9";
this.clearGroup9.Text = "9:";
this.clearGroup9.Click += new System.EventHandler(this.InvokeTaggedAction);
//
// clearGroup10
//
this.clearGroup10.Name = "clearGroup10";
this.clearGroup10.Size = new System.Drawing.Size(89, 22);
this.clearGroup10.Tag = "builder_cleargroup10";
this.clearGroup10.Text = "10:";
this.clearGroup10.Click += new System.EventHandler(this.InvokeTaggedAction);
//
// itemmapoptions
//
@ -2281,6 +1975,8 @@ namespace CodeImp.DoomBuilder.Windows
// statistics
//
this.statistics.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.statistics.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.statistics.ForeColor = System.Drawing.SystemColors.GrayText;
this.statistics.Location = new System.Drawing.Point(869, 2);
this.statistics.Name = "statistics";
this.statistics.Size = new System.Drawing.Size(118, 102);
@ -2684,37 +2380,7 @@ namespace CodeImp.DoomBuilder.Windows
private System.Windows.Forms.ToolStripSeparator toolStripSeparator5;
private System.Windows.Forms.ToolStripMenuItem addToGroup;
private System.Windows.Forms.ToolStripMenuItem selectGroup;
private System.Windows.Forms.ToolStripMenuItem addGroup1;
private System.Windows.Forms.ToolStripMenuItem addGroup2;
private System.Windows.Forms.ToolStripMenuItem addGroup3;
private System.Windows.Forms.ToolStripMenuItem addGroup4;
private System.Windows.Forms.ToolStripMenuItem addGroup5;
private System.Windows.Forms.ToolStripMenuItem addGroup6;
private System.Windows.Forms.ToolStripMenuItem addGroup7;
private System.Windows.Forms.ToolStripMenuItem addGroup8;
private System.Windows.Forms.ToolStripMenuItem addGroup9;
private System.Windows.Forms.ToolStripMenuItem addGroup10;
private System.Windows.Forms.ToolStripMenuItem selectGroup1;
private System.Windows.Forms.ToolStripMenuItem selectGroup2;
private System.Windows.Forms.ToolStripMenuItem selectGroup3;
private System.Windows.Forms.ToolStripMenuItem selectGroup4;
private System.Windows.Forms.ToolStripMenuItem selectGroup5;
private System.Windows.Forms.ToolStripMenuItem selectGroup6;
private System.Windows.Forms.ToolStripMenuItem selectGroup7;
private System.Windows.Forms.ToolStripMenuItem selectGroup8;
private System.Windows.Forms.ToolStripMenuItem selectGroup9;
private System.Windows.Forms.ToolStripMenuItem selectGroup10;
private System.Windows.Forms.ToolStripMenuItem clearGroup;
private System.Windows.Forms.ToolStripMenuItem clearGroup1;
private System.Windows.Forms.ToolStripMenuItem clearGroup2;
private System.Windows.Forms.ToolStripMenuItem clearGroup3;
private System.Windows.Forms.ToolStripMenuItem clearGroup4;
private System.Windows.Forms.ToolStripMenuItem clearGroup5;
private System.Windows.Forms.ToolStripMenuItem clearGroup6;
private System.Windows.Forms.ToolStripMenuItem clearGroup7;
private System.Windows.Forms.ToolStripMenuItem clearGroup8;
private System.Windows.Forms.ToolStripMenuItem clearGroup9;
private System.Windows.Forms.ToolStripMenuItem clearGroup10;
private System.Windows.Forms.ContextMenuStrip toolbarContextMenu;
private System.Windows.Forms.ToolStripMenuItem toggleFile;
private System.Windows.Forms.ToolStripMenuItem toggleScript;

View file

@ -2486,31 +2486,51 @@ namespace CodeImp.DoomBuilder.Windows
}
//mxd
private void addToGroup_DropDownOpening(object sender, EventArgs e) {
for(int i = 0; i < addToGroup.DropDown.Items.Count; i++)
addToGroup.DropDown.Items[i].Text = (i + 1) + ": " + (General.Map.Map.GroupInfos[i] == null ? " Empty" : General.Map.Map.GroupInfos[i].ToString());
private void menuedit_DropDownOpening(object sender, EventArgs e)
{
if (General.Map == null)
{
selectGroup.Enabled = false;
clearGroup.Enabled = false;
addToGroup.Enabled = false;
return;
}
//mxd
private void selectGroup_DropDownOpening(object sender, EventArgs e) {
ToolStripMenuItem menu = sender as ToolStripMenuItem;
//get data
ToolStripItem item;
GroupInfo[] infos = new GroupInfo[10];
for(int i = 0; i < infos.Length; i++) infos[i] = General.Map.Map.GetGroupInfo(i);
for(int i = 0; i < menu.DropDown.Items.Count; i++) {
if(General.Map.Map.GroupInfos[i] == null) {
menu.DropDown.Items[i].Visible = false;
} else {
menu.DropDown.Items[i].Visible = true;
menu.DropDown.Items[i].Text = (i + 1) + ": " + General.Map.Map.GroupInfos[i];
}
}
//update "Add to group" menu
addToGroup.Enabled = true;
addToGroup.DropDownItems.Clear();
foreach (GroupInfo gi in infos)
{
item = addToGroup.DropDownItems.Add(gi.ToString());
item.Tag = "builder_assigngroup" + gi.Index;
item.Click += InvokeTaggedAction;
}
//mxd
private void menuedit_DropDownOpening(object sender, EventArgs e) {
if(General.Map == null) return;
bool haveGroups = General.Map.Map.HaveSelectionGroups();
selectGroup.Enabled = haveGroups;
clearGroup.Enabled = haveGroups;
//update "Select group" menu
selectGroup.DropDownItems.Clear();
foreach (GroupInfo gi in infos) {
if(gi.Empty) continue;
item = selectGroup.DropDownItems.Add(gi.ToString());
item.Tag = "builder_selectgroup" + gi.Index;
item.Click += InvokeTaggedAction;
}
//update "Clear group" menu
clearGroup.DropDownItems.Clear();
foreach(GroupInfo gi in infos) {
if(gi.Empty) continue;
item = clearGroup.DropDownItems.Add(gi.ToString());
item.Tag = "builder_cleargroup" + gi.Index;
item.Click += InvokeTaggedAction;
}
selectGroup.Enabled = selectGroup.DropDownItems.Count > 0;
clearGroup.Enabled = clearGroup.DropDownItems.Count > 0;
}
// Action to toggle snap to grid

View file

@ -186,6 +186,27 @@
<metadata name="sectorinfo.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="heightpanel1.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="labelcollapsedinfo.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="modename.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="buttontoggleinfo.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="linedefinfo.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="thinginfo.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="sectorinfo.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="redrawtimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>433, 17</value>
</metadata>