mirror of
https://git.do.srb2.org/STJr/ZoneBuilder.git
synced 2024-11-10 06:41:49 +00:00
Add action for deselecting things, tweak other new actions
This commit is contained in:
parent
9191c30126
commit
94887efa9a
6 changed files with 86 additions and 9 deletions
|
@ -388,6 +388,23 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
BuilderPlug.Me.MenusForm.SyncronizeThingEditSectorsItem.Checked = BuilderPlug.Me.SyncronizeThingEdit;
|
BuilderPlug.Me.MenusForm.SyncronizeThingEditSectorsItem.Checked = BuilderPlug.Me.SyncronizeThingEdit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This keeps only the single-sided lines selected
|
||||||
|
[BeginAction("deselectthings")]
|
||||||
|
public void DeselectThings()
|
||||||
|
{
|
||||||
|
int counter = 0;
|
||||||
|
ICollection<Thing> selected = General.Map.Map.GetSelectedThings(true);
|
||||||
|
foreach (Thing t in selected)
|
||||||
|
{
|
||||||
|
t.Selected = false;
|
||||||
|
counter++;
|
||||||
|
}
|
||||||
|
|
||||||
|
UpdateSelectionInfo();
|
||||||
|
General.Interface.DisplayStatus(StatusType.Action, "Deselected things (" + counter + ")");
|
||||||
|
General.Interface.RedrawDisplay();
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2446,14 +2446,18 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
}
|
}
|
||||||
|
|
||||||
General.Map.UndoRedo.CreateUndo("Decrement linedef tags by 1", this, UndoGroup.LinedefTagChange, CreateSelectionCRC(selected));
|
General.Map.UndoRedo.CreateUndo("Decrement linedef tags by 1", this, UndoGroup.LinedefTagChange, CreateSelectionCRC(selected));
|
||||||
General.Interface.DisplayStatus(StatusType.Action, "Incremented tag" + (selected.Count > 1 ? "s of " : " of ") + selected.Count + (selected.Count > 1 ? " linedefs by 1." : " linedef by 1."));
|
|
||||||
|
|
||||||
foreach (Linedef l in selected)
|
foreach (Linedef l in selected)
|
||||||
{
|
{
|
||||||
l.Tag = Math.Min(l.Tag + 1, 65535);
|
l.Tag = Math.Min(l.Tag + 1, 65535);
|
||||||
l.UpdateCache();
|
l.UpdateCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (selected.Count > 1)
|
||||||
|
General.Interface.DisplayStatus(StatusType.Action, "Incremented tags of " + selected.Count + " linedefs by 1.");
|
||||||
|
else
|
||||||
|
General.Interface.DisplayStatus(StatusType.Action, "Incremented tag of one linedef to " + selected.First().Tag + ".");
|
||||||
|
|
||||||
// Update
|
// Update
|
||||||
General.Map.Map.Update();
|
General.Map.Map.Update();
|
||||||
General.Interface.RedrawDisplay();
|
General.Interface.RedrawDisplay();
|
||||||
|
@ -2476,7 +2480,6 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
}
|
}
|
||||||
|
|
||||||
General.Map.UndoRedo.CreateUndo("Decrement linedef tags by 1", this, UndoGroup.LinedefTagChange, CreateSelectionCRC(selected));
|
General.Map.UndoRedo.CreateUndo("Decrement linedef tags by 1", this, UndoGroup.LinedefTagChange, CreateSelectionCRC(selected));
|
||||||
General.Interface.DisplayStatus(StatusType.Action, "Decremented tag" + (selected.Count > 1 ? "s of " : " of ") + selected.Count + (selected.Count > 1 ? " linedefs by 1." : " linedef by 1."));
|
|
||||||
|
|
||||||
foreach (Linedef l in selected)
|
foreach (Linedef l in selected)
|
||||||
{
|
{
|
||||||
|
@ -2484,6 +2487,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
l.UpdateCache();
|
l.UpdateCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (selected.Count > 1)
|
||||||
|
General.Interface.DisplayStatus(StatusType.Action, "Decremented tags of " + selected.Count + " linedefs by 1.");
|
||||||
|
else
|
||||||
|
General.Interface.DisplayStatus(StatusType.Action, "Decremented tag of one linedef to " + selected.First().Tag + ".");
|
||||||
|
|
||||||
// Update
|
// Update
|
||||||
General.Map.Map.Update();
|
General.Map.Map.Update();
|
||||||
General.Interface.RedrawDisplay();
|
General.Interface.RedrawDisplay();
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using CodeImp.DoomBuilder.Actions;
|
using CodeImp.DoomBuilder.Actions;
|
||||||
using CodeImp.DoomBuilder.BuilderModes.Interface;
|
using CodeImp.DoomBuilder.BuilderModes.Interface;
|
||||||
|
@ -2623,7 +2624,6 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
}
|
}
|
||||||
|
|
||||||
General.Map.UndoRedo.CreateUndo("Decrement sector tags by 1", this, UndoGroup.SectorTagChange, CreateSelectionCRC(selected));
|
General.Map.UndoRedo.CreateUndo("Decrement sector tags by 1", this, UndoGroup.SectorTagChange, CreateSelectionCRC(selected));
|
||||||
General.Interface.DisplayStatus(StatusType.Action, "Incremented tag" + (selected.Count > 1 ? "s of " : " of ") + selected.Count + (selected.Count > 1 ? " sectors by 1." : " sector by 1."));
|
|
||||||
|
|
||||||
foreach (Sector s in selected)
|
foreach (Sector s in selected)
|
||||||
{
|
{
|
||||||
|
@ -2632,7 +2632,14 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
s.UpdateCache();
|
s.UpdateCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (selected.Count > 1)
|
||||||
|
General.Interface.DisplayStatus(StatusType.Action, "Incremented tags of " + selected.Count + " sectors by 1.");
|
||||||
|
else
|
||||||
|
General.Interface.DisplayStatus(StatusType.Action, "Incremented tag of one sector to " + selected.First().Tag + ".");
|
||||||
|
|
||||||
// Update
|
// Update
|
||||||
|
UpdateSelectionInfo();
|
||||||
|
UpdateEffectLabels();
|
||||||
General.Map.Map.Update();
|
General.Map.Map.Update();
|
||||||
General.Interface.RedrawDisplay();
|
General.Interface.RedrawDisplay();
|
||||||
General.Interface.RefreshInfo();
|
General.Interface.RefreshInfo();
|
||||||
|
@ -2654,7 +2661,6 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
}
|
}
|
||||||
|
|
||||||
General.Map.UndoRedo.CreateUndo("Decrement sector tags by 1", this, UndoGroup.SectorTagChange, CreateSelectionCRC(selected));
|
General.Map.UndoRedo.CreateUndo("Decrement sector tags by 1", this, UndoGroup.SectorTagChange, CreateSelectionCRC(selected));
|
||||||
General.Interface.DisplayStatus(StatusType.Action, "Decremented tag" + (selected.Count > 1 ? "s of " : " of ") + selected.Count + (selected.Count > 1 ? " sectors by 1." : " sector by 1."));
|
|
||||||
|
|
||||||
foreach (Sector s in selected)
|
foreach (Sector s in selected)
|
||||||
{
|
{
|
||||||
|
@ -2663,7 +2669,14 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
s.UpdateCache();
|
s.UpdateCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (selected.Count > 1)
|
||||||
|
General.Interface.DisplayStatus(StatusType.Action, "Decremented tags of " + selected.Count + " sectors by 1.");
|
||||||
|
else
|
||||||
|
General.Interface.DisplayStatus(StatusType.Action, "Decremented tag of one sector to " + selected.First().Tag + ".");
|
||||||
|
|
||||||
// Update
|
// Update
|
||||||
|
UpdateSelectionInfo();
|
||||||
|
UpdateEffectLabels();
|
||||||
General.Map.Map.Update();
|
General.Map.Map.Update();
|
||||||
General.Interface.RedrawDisplay();
|
General.Interface.RedrawDisplay();
|
||||||
General.Interface.RefreshInfo();
|
General.Interface.RefreshInfo();
|
||||||
|
|
|
@ -1386,6 +1386,16 @@ deselectfofplanes
|
||||||
allowscroll = true;
|
allowscroll = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
deselectthings
|
||||||
|
{
|
||||||
|
title = "Deselect things";
|
||||||
|
category = "visual";
|
||||||
|
description = "Deselects all things from your selection in Visual Mode.";
|
||||||
|
allowkeys = true;
|
||||||
|
allowmouse = true;
|
||||||
|
allowscroll = true;
|
||||||
|
}
|
||||||
|
|
||||||
placevisualstart
|
placevisualstart
|
||||||
{
|
{
|
||||||
title = "Place Visual Mode Camera";
|
title = "Place Visual Mode Camera";
|
||||||
|
|
|
@ -1058,7 +1058,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnRemoveFOFSelection()
|
public bool OnRemoveFOFSelection()
|
||||||
{
|
{
|
||||||
if (level != null)
|
if (level != null)
|
||||||
{
|
{
|
||||||
|
@ -1068,8 +1068,10 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
BaseVisualSector vs = (BaseVisualSector)mode.GetVisualSector(level.sector);
|
BaseVisualSector vs = (BaseVisualSector)mode.GetVisualSector(level.sector);
|
||||||
selected = false;
|
selected = false;
|
||||||
mode.RemoveSelectedObject(this);
|
mode.RemoveSelectedObject(this);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
@ -33,6 +33,7 @@ using CodeImp.DoomBuilder.Config;
|
||||||
using CodeImp.DoomBuilder.GZBuilder.Data;
|
using CodeImp.DoomBuilder.GZBuilder.Data;
|
||||||
using CodeImp.DoomBuilder.Types;
|
using CodeImp.DoomBuilder.Types;
|
||||||
using CodeImp.DoomBuilder.Data;
|
using CodeImp.DoomBuilder.Data;
|
||||||
|
using System.Diagnostics;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -4467,23 +4468,49 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
{
|
{
|
||||||
PreAction(UndoGroup.None);
|
PreAction(UndoGroup.None);
|
||||||
List<IVisualEventReceiver> objs = GetSelectedObjects(true, false, false, false);
|
List<IVisualEventReceiver> objs = GetSelectedObjects(true, false, false, false);
|
||||||
|
int counter = 0;
|
||||||
|
|
||||||
foreach (IVisualEventReceiver i in objs)
|
foreach (IVisualEventReceiver i in objs)
|
||||||
{
|
{
|
||||||
if (i is VisualFloor)
|
if (i is VisualFloor)
|
||||||
{
|
{
|
||||||
VisualFloor vf = i as VisualFloor;
|
VisualFloor vf = i as VisualFloor;
|
||||||
vf.OnRemoveFOFSelection();
|
if (vf.OnRemoveFOFSelection())
|
||||||
|
counter++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i is VisualCeiling)
|
if (i is VisualCeiling)
|
||||||
{
|
{
|
||||||
VisualCeiling vc = i as VisualCeiling;
|
VisualCeiling vc = i as VisualCeiling;
|
||||||
vc.OnRemoveFOFSelection();
|
if (vc.OnRemoveFOFSelection())
|
||||||
|
counter++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
General.Interface.DisplayStatus(StatusType.Action, "Deselected FOF planes.");
|
General.Interface.DisplayStatus(StatusType.Action, "Deselected FOF planes (" + counter + ")");
|
||||||
|
General.Interface.RedrawDisplay();
|
||||||
|
UpdateSelectionInfo();
|
||||||
|
UpdateChangedObjects();
|
||||||
|
}
|
||||||
|
|
||||||
|
[BeginAction("deselectthings")]
|
||||||
|
public void DeselectThings()
|
||||||
|
{
|
||||||
|
PreAction(UndoGroup.None);
|
||||||
|
List<IVisualEventReceiver> objs = GetSelectedObjects(false, false, true, false);
|
||||||
|
int counter = 0;
|
||||||
|
|
||||||
|
foreach (IVisualEventReceiver i in objs)
|
||||||
|
{
|
||||||
|
if (i is VisualThing)
|
||||||
|
{
|
||||||
|
BaseVisualThing vt = i as BaseVisualThing;
|
||||||
|
vt.OnSelectEnd();
|
||||||
|
counter++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
General.Interface.DisplayStatus(StatusType.Action, "Deselected things (" + counter + ")");
|
||||||
General.Interface.RedrawDisplay();
|
General.Interface.RedrawDisplay();
|
||||||
UpdateSelectionInfo();
|
UpdateSelectionInfo();
|
||||||
UpdateChangedObjects();
|
UpdateChangedObjects();
|
||||||
|
|
Loading…
Reference in a new issue