Added options for selection behavior in Visual Mode and Classic Modes (see Preferences -> Editing)

This commit is contained in:
codeimp 2009-07-07 11:29:56 +00:00
parent 5a1dfbee72
commit c543acd524
15 changed files with 665 additions and 336 deletions

View file

@ -2,7 +2,7 @@
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.30729</ProductVersion> <ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion> <SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{B42D5AA0-F9A6-4234-9C4B-A05B11A64851}</ProjectGuid> <ProjectGuid>{B42D5AA0-F9A6-4234-9C4B-A05B11A64851}</ProjectGuid>
<OutputType>Library</OutputType> <OutputType>Library</OutputType>
@ -250,6 +250,7 @@
<Compile Include="FindReplace\FindThingType.cs" /> <Compile Include="FindReplace\FindThingType.cs" />
<Compile Include="FindReplace\FindVertexNumber.cs" /> <Compile Include="FindReplace\FindVertexNumber.cs" />
<Compile Include="General\UndoGroup.cs" /> <Compile Include="General\UndoGroup.cs" />
<Compile Include="VisualModes\NullVisualEventReceiver.cs" />
<Compile Include="VisualModes\VisualActionResult.cs" /> <Compile Include="VisualModes\VisualActionResult.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View file

@ -590,60 +590,64 @@ namespace CodeImp.DoomBuilder.BuilderModes
// This is called wheh selection ends // This is called wheh selection ends
protected override void OnEndMultiSelection() protected override void OnEndMultiSelection()
{ {
if(General.Interface.ShiftState ^ BuilderPlug.Me.AdditiveSelect) if(BuilderPlug.Me.AutoClearSelection ||
((Math.Abs(base.selectionrect.Width) > 0.1f) && (Math.Abs(base.selectionrect.Height) > 0.1f)))
{ {
// Go for all lines if(General.Interface.ShiftState ^ BuilderPlug.Me.AdditiveSelect)
foreach(Linedef l in General.Map.Map.Linedefs)
{ {
l.Selected |= ((l.Start.Position.x >= selectionrect.Left) && // Go for all lines
(l.Start.Position.y >= selectionrect.Top) && foreach(Linedef l in General.Map.Map.Linedefs)
(l.Start.Position.x <= selectionrect.Right) &&
(l.Start.Position.y <= selectionrect.Bottom) &&
(l.End.Position.x >= selectionrect.Left) &&
(l.End.Position.y >= selectionrect.Top) &&
(l.End.Position.x <= selectionrect.Right) &&
(l.End.Position.y <= selectionrect.Bottom));
}
}
else
{
// Go for all lines
foreach(Linedef l in General.Map.Map.Linedefs)
{
l.Selected = ((l.Start.Position.x >= selectionrect.Left) &&
(l.Start.Position.y >= selectionrect.Top) &&
(l.Start.Position.x <= selectionrect.Right) &&
(l.Start.Position.y <= selectionrect.Bottom) &&
(l.End.Position.x >= selectionrect.Left) &&
(l.End.Position.y >= selectionrect.Top) &&
(l.End.Position.x <= selectionrect.Right) &&
(l.End.Position.y <= selectionrect.Bottom));
}
}
// Go for all sectors
foreach(Sector s in General.Map.Map.Sectors)
{
// Go for all sidedefs
bool allselected = true;
foreach(Sidedef sd in s.Sidedefs)
{
if(!sd.Line.Selected)
{ {
allselected = false; l.Selected |= ((l.Start.Position.x >= selectionrect.Left) &&
break; (l.Start.Position.y >= selectionrect.Top) &&
(l.Start.Position.x <= selectionrect.Right) &&
(l.Start.Position.y <= selectionrect.Bottom) &&
(l.End.Position.x >= selectionrect.Left) &&
(l.End.Position.y >= selectionrect.Top) &&
(l.End.Position.x <= selectionrect.Right) &&
(l.End.Position.y <= selectionrect.Bottom));
}
}
else
{
// Go for all lines
foreach(Linedef l in General.Map.Map.Linedefs)
{
l.Selected = ((l.Start.Position.x >= selectionrect.Left) &&
(l.Start.Position.y >= selectionrect.Top) &&
(l.Start.Position.x <= selectionrect.Right) &&
(l.Start.Position.y <= selectionrect.Bottom) &&
(l.End.Position.x >= selectionrect.Left) &&
(l.End.Position.y >= selectionrect.Top) &&
(l.End.Position.x <= selectionrect.Right) &&
(l.End.Position.y <= selectionrect.Bottom));
} }
} }
// Sector completely selected? // Go for all sectors
SelectSector(s, allselected, false); foreach(Sector s in General.Map.Map.Sectors)
{
// Go for all sidedefs
bool allselected = true;
foreach(Sidedef sd in s.Sidedefs)
{
if(!sd.Line.Selected)
{
allselected = false;
break;
}
}
// Sector completely selected?
SelectSector(s, allselected, false);
}
// Make sure all linedefs reflect selected sectors
foreach(Sidedef sd in General.Map.Map.Sidedefs)
if(!sd.Sector.Selected && ((sd.Other == null) || !sd.Other.Sector.Selected))
sd.Line.Selected = false;
} }
// Make sure all linedefs reflect selected sectors
foreach(Sidedef sd in General.Map.Map.Sidedefs)
if(!sd.Sector.Selected && ((sd.Other == null) || !sd.Other.Sector.Selected))
sd.Line.Selected = false;
base.OnEndMultiSelection(); base.OnEndMultiSelection();
UpdateOverlay(); UpdateOverlay();
General.Interface.RedrawDisplay(); General.Interface.RedrawDisplay();

View file

@ -337,7 +337,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
editpressed = true; editpressed = true;
// Highlighted item not selected? // Highlighted item not selected?
if(!highlighted.Selected) if(!highlighted.Selected && BuilderPlug.Me.AutoClearSelection)
{ {
// Make this the only selection // Make this the only selection
General.Map.Map.ClearSelectedLinedefs(); General.Map.Map.ClearSelectedLinedefs();
@ -452,34 +452,38 @@ namespace CodeImp.DoomBuilder.BuilderModes
// This is called wheh selection ends // This is called wheh selection ends
protected override void OnEndMultiSelection() protected override void OnEndMultiSelection()
{ {
if(General.Interface.ShiftState ^ BuilderPlug.Me.AdditiveSelect) if(BuilderPlug.Me.AutoClearSelection ||
((Math.Abs(base.selectionrect.Width) > 0.1f) && (Math.Abs(base.selectionrect.Height) > 0.1f)))
{ {
// Go for all lines if(General.Interface.ShiftState ^ BuilderPlug.Me.AdditiveSelect)
foreach(Linedef l in General.Map.Map.Linedefs)
{ {
l.Selected |= ((l.Start.Position.x >= selectionrect.Left) && // Go for all lines
(l.Start.Position.y >= selectionrect.Top) && foreach(Linedef l in General.Map.Map.Linedefs)
(l.Start.Position.x <= selectionrect.Right) && {
(l.Start.Position.y <= selectionrect.Bottom) && l.Selected |= ((l.Start.Position.x >= selectionrect.Left) &&
(l.End.Position.x >= selectionrect.Left) && (l.Start.Position.y >= selectionrect.Top) &&
(l.End.Position.y >= selectionrect.Top) && (l.Start.Position.x <= selectionrect.Right) &&
(l.End.Position.x <= selectionrect.Right) && (l.Start.Position.y <= selectionrect.Bottom) &&
(l.End.Position.y <= selectionrect.Bottom)); (l.End.Position.x >= selectionrect.Left) &&
(l.End.Position.y >= selectionrect.Top) &&
(l.End.Position.x <= selectionrect.Right) &&
(l.End.Position.y <= selectionrect.Bottom));
}
} }
} else
else
{
// Go for all lines
foreach(Linedef l in General.Map.Map.Linedefs)
{ {
l.Selected = ((l.Start.Position.x >= selectionrect.Left) && // Go for all lines
(l.Start.Position.y >= selectionrect.Top) && foreach(Linedef l in General.Map.Map.Linedefs)
(l.Start.Position.x <= selectionrect.Right) && {
(l.Start.Position.y <= selectionrect.Bottom) && l.Selected = ((l.Start.Position.x >= selectionrect.Left) &&
(l.End.Position.x >= selectionrect.Left) && (l.Start.Position.y >= selectionrect.Top) &&
(l.End.Position.y >= selectionrect.Top) && (l.Start.Position.x <= selectionrect.Right) &&
(l.End.Position.x <= selectionrect.Right) && (l.Start.Position.y <= selectionrect.Bottom) &&
(l.End.Position.y <= selectionrect.Bottom)); (l.End.Position.x >= selectionrect.Left) &&
(l.End.Position.y >= selectionrect.Top) &&
(l.End.Position.x <= selectionrect.Right) &&
(l.End.Position.y <= selectionrect.Bottom));
}
} }
} }

View file

@ -560,7 +560,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
editpressed = true; editpressed = true;
// Highlighted item not selected? // Highlighted item not selected?
if(!highlighted.Selected) if(!highlighted.Selected && BuilderPlug.Me.AutoClearSelection)
{ {
// Make this the only selection // Make this the only selection
General.Map.Map.ClearSelectedSectors(); General.Map.Map.ClearSelectedSectors();
@ -713,60 +713,64 @@ namespace CodeImp.DoomBuilder.BuilderModes
// This is called wheh selection ends // This is called wheh selection ends
protected override void OnEndMultiSelection() protected override void OnEndMultiSelection()
{ {
if(General.Interface.ShiftState ^ BuilderPlug.Me.AdditiveSelect) if(BuilderPlug.Me.AutoClearSelection ||
((Math.Abs(base.selectionrect.Width) > 0.1f) && (Math.Abs(base.selectionrect.Height) > 0.1f)))
{ {
// Go for all lines if(General.Interface.ShiftState ^ BuilderPlug.Me.AdditiveSelect)
foreach(Linedef l in General.Map.Map.Linedefs)
{ {
l.Selected |= ((l.Start.Position.x >= selectionrect.Left) && // Go for all lines
(l.Start.Position.y >= selectionrect.Top) && foreach(Linedef l in General.Map.Map.Linedefs)
(l.Start.Position.x <= selectionrect.Right) &&
(l.Start.Position.y <= selectionrect.Bottom) &&
(l.End.Position.x >= selectionrect.Left) &&
(l.End.Position.y >= selectionrect.Top) &&
(l.End.Position.x <= selectionrect.Right) &&
(l.End.Position.y <= selectionrect.Bottom));
}
}
else
{
// Go for all lines
foreach(Linedef l in General.Map.Map.Linedefs)
{
l.Selected = ((l.Start.Position.x >= selectionrect.Left) &&
(l.Start.Position.y >= selectionrect.Top) &&
(l.Start.Position.x <= selectionrect.Right) &&
(l.Start.Position.y <= selectionrect.Bottom) &&
(l.End.Position.x >= selectionrect.Left) &&
(l.End.Position.y >= selectionrect.Top) &&
(l.End.Position.x <= selectionrect.Right) &&
(l.End.Position.y <= selectionrect.Bottom));
}
}
// Go for all sectors
foreach(Sector s in General.Map.Map.Sectors)
{
// Go for all sidedefs
bool allselected = true;
foreach(Sidedef sd in s.Sidedefs)
{
if(!sd.Line.Selected)
{ {
allselected = false; l.Selected |= ((l.Start.Position.x >= selectionrect.Left) &&
break; (l.Start.Position.y >= selectionrect.Top) &&
(l.Start.Position.x <= selectionrect.Right) &&
(l.Start.Position.y <= selectionrect.Bottom) &&
(l.End.Position.x >= selectionrect.Left) &&
(l.End.Position.y >= selectionrect.Top) &&
(l.End.Position.x <= selectionrect.Right) &&
(l.End.Position.y <= selectionrect.Bottom));
}
}
else
{
// Go for all lines
foreach(Linedef l in General.Map.Map.Linedefs)
{
l.Selected = ((l.Start.Position.x >= selectionrect.Left) &&
(l.Start.Position.y >= selectionrect.Top) &&
(l.Start.Position.x <= selectionrect.Right) &&
(l.Start.Position.y <= selectionrect.Bottom) &&
(l.End.Position.x >= selectionrect.Left) &&
(l.End.Position.y >= selectionrect.Top) &&
(l.End.Position.x <= selectionrect.Right) &&
(l.End.Position.y <= selectionrect.Bottom));
} }
} }
// Sector completely selected? // Go for all sectors
SelectSector(s, allselected, false); foreach(Sector s in General.Map.Map.Sectors)
{
// Go for all sidedefs
bool allselected = true;
foreach(Sidedef sd in s.Sidedefs)
{
if(!sd.Line.Selected)
{
allselected = false;
break;
}
}
// Sector completely selected?
SelectSector(s, allselected, false);
}
// Make sure all linedefs reflect selected sectors
foreach(Sidedef sd in General.Map.Map.Sidedefs)
if(!sd.Sector.Selected && ((sd.Other == null) || !sd.Other.Sector.Selected))
sd.Line.Selected = false;
} }
// Make sure all linedefs reflect selected sectors
foreach(Sidedef sd in General.Map.Map.Sidedefs)
if(!sd.Sector.Selected && ((sd.Other == null) || !sd.Other.Sector.Selected))
sd.Line.Selected = false;
base.OnEndMultiSelection(); base.OnEndMultiSelection();
if(renderer.StartOverlay(true)) renderer.Finish(); if(renderer.StartOverlay(true)) renderer.Finish();
General.Interface.RedrawDisplay(); General.Interface.RedrawDisplay();

View file

@ -312,7 +312,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
editpressed = true; editpressed = true;
// Highlighted item not selected? // Highlighted item not selected?
if(!highlighted.Selected) if(!highlighted.Selected && BuilderPlug.Me.AutoClearSelection)
{ {
// Make this the only selection // Make this the only selection
General.Map.Map.ClearSelectedThings(); General.Map.Map.ClearSelectedThings();
@ -439,26 +439,30 @@ namespace CodeImp.DoomBuilder.BuilderModes
// This is called wheh selection ends // This is called wheh selection ends
protected override void OnEndMultiSelection() protected override void OnEndMultiSelection()
{ {
if(General.Interface.ShiftState ^ BuilderPlug.Me.AdditiveSelect) if(BuilderPlug.Me.AutoClearSelection ||
((Math.Abs(base.selectionrect.Width) > 0.1f) && (Math.Abs(base.selectionrect.Height) > 0.1f)))
{ {
// Go for all things if(General.Interface.ShiftState ^ BuilderPlug.Me.AdditiveSelect)
foreach(Thing t in General.Map.ThingsFilter.VisibleThings)
{ {
t.Selected |= ((t.Position.x >= selectionrect.Left) && // Go for all things
(t.Position.y >= selectionrect.Top) && foreach(Thing t in General.Map.ThingsFilter.VisibleThings)
(t.Position.x <= selectionrect.Right) && {
(t.Position.y <= selectionrect.Bottom)); t.Selected |= ((t.Position.x >= selectionrect.Left) &&
(t.Position.y >= selectionrect.Top) &&
(t.Position.x <= selectionrect.Right) &&
(t.Position.y <= selectionrect.Bottom));
}
} }
} else
else
{
// Go for all things
foreach(Thing t in General.Map.ThingsFilter.VisibleThings)
{ {
t.Selected = ((t.Position.x >= selectionrect.Left) && // Go for all things
(t.Position.y >= selectionrect.Top) && foreach(Thing t in General.Map.ThingsFilter.VisibleThings)
(t.Position.x <= selectionrect.Right) && {
(t.Position.y <= selectionrect.Bottom)); t.Selected = ((t.Position.x >= selectionrect.Left) &&
(t.Position.y >= selectionrect.Top) &&
(t.Position.x <= selectionrect.Right) &&
(t.Position.y <= selectionrect.Bottom));
}
} }
} }

View file

@ -242,7 +242,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
editpressed = true; editpressed = true;
// Highlighted item not selected? // Highlighted item not selected?
if(!highlighted.Selected) if(!highlighted.Selected && BuilderPlug.Me.AutoClearSelection)
{ {
// Make this the only selection // Make this the only selection
General.Map.Map.ClearSelectedVertices(); General.Map.Map.ClearSelectedVertices();
@ -406,26 +406,30 @@ namespace CodeImp.DoomBuilder.BuilderModes
// This is called wheh selection ends // This is called wheh selection ends
protected override void OnEndMultiSelection() protected override void OnEndMultiSelection()
{ {
if(General.Interface.ShiftState ^ BuilderPlug.Me.AdditiveSelect) if(BuilderPlug.Me.AutoClearSelection ||
((Math.Abs(base.selectionrect.Width) > 0.1f) && (Math.Abs(base.selectionrect.Height) > 0.1f)))
{ {
// Go for all vertices if(General.Interface.ShiftState ^ BuilderPlug.Me.AdditiveSelect)
foreach(Vertex v in General.Map.Map.Vertices)
{ {
v.Selected |= ((v.Position.x >= selectionrect.Left) && // Go for all vertices
(v.Position.y >= selectionrect.Top) && foreach(Vertex v in General.Map.Map.Vertices)
(v.Position.x <= selectionrect.Right) && {
(v.Position.y <= selectionrect.Bottom)); v.Selected |= ((v.Position.x >= selectionrect.Left) &&
(v.Position.y >= selectionrect.Top) &&
(v.Position.x <= selectionrect.Right) &&
(v.Position.y <= selectionrect.Bottom));
}
} }
} else
else
{
// Go for all vertices
foreach(Vertex v in General.Map.Map.Vertices)
{ {
v.Selected = ((v.Position.x >= selectionrect.Left) && // Go for all vertices
(v.Position.y >= selectionrect.Top) && foreach(Vertex v in General.Map.Map.Vertices)
(v.Position.x <= selectionrect.Right) && {
(v.Position.y <= selectionrect.Bottom)); v.Selected = ((v.Position.x >= selectionrect.Left) &&
(v.Position.y >= selectionrect.Top) &&
(v.Position.x <= selectionrect.Right) &&
(v.Position.y <= selectionrect.Bottom));
}
} }
} }

View file

@ -65,6 +65,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
private bool editnewthing; private bool editnewthing;
private bool editnewsector; private bool editnewsector;
private bool additiveselect; private bool additiveselect;
private bool autoclearselection;
private bool visualmodeclearselection;
private string copiedtexture; private string copiedtexture;
private string copiedflat; private string copiedflat;
private Point copiedoffsets; private Point copiedoffsets;
@ -97,6 +99,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
public bool EditNewThing { get { return editnewthing; } } public bool EditNewThing { get { return editnewthing; } }
public bool EditNewSector { get { return editnewsector; } } public bool EditNewSector { get { return editnewsector; } }
public bool AdditiveSelect { get { return additiveselect; } } public bool AdditiveSelect { get { return additiveselect; } }
public bool AutoClearSelection { get { return autoclearselection; } }
public bool VisualModeClearSelection { get { return visualmodeclearselection; } }
public string CopiedTexture { get { return copiedtexture; } set { copiedtexture = value; } } public string CopiedTexture { get { return copiedtexture; } set { copiedtexture = value; } }
public string CopiedFlat { get { return copiedflat; } set { copiedflat = value; } } public string CopiedFlat { get { return copiedflat; } set { copiedflat = value; } }
public Point CopiedOffsets { get { return copiedoffsets; } set { copiedoffsets = value; } } public Point CopiedOffsets { get { return copiedoffsets; } set { copiedoffsets = value; } }
@ -172,6 +176,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
editnewthing = General.Settings.ReadPluginSetting("editnewthing", true); editnewthing = General.Settings.ReadPluginSetting("editnewthing", true);
editnewsector = General.Settings.ReadPluginSetting("editnewsector", false); editnewsector = General.Settings.ReadPluginSetting("editnewsector", false);
additiveselect = General.Settings.ReadPluginSetting("additiveselect", false); additiveselect = General.Settings.ReadPluginSetting("additiveselect", false);
autoclearselection = General.Settings.ReadPluginSetting("autoclearselection", true);
visualmodeclearselection = General.Settings.ReadPluginSetting("visualmodeclearselection", false);
viewselectionnumbers = General.Settings.ReadPluginSetting("viewselectionnumbers", true); viewselectionnumbers = General.Settings.ReadPluginSetting("viewselectionnumbers", true);
stitchrange = (float)General.Settings.ReadPluginSetting("stitchrange", 20); stitchrange = (float)General.Settings.ReadPluginSetting("stitchrange", 20);
highlightrange = (float)General.Settings.ReadPluginSetting("highlightrange", 20); highlightrange = (float)General.Settings.ReadPluginSetting("highlightrange", 20);

View file

@ -30,31 +30,33 @@ namespace CodeImp.DoomBuilder.BuilderModes
{ {
this.tabs = new System.Windows.Forms.TabControl(); this.tabs = new System.Windows.Forms.TabControl();
this.taboptions = new System.Windows.Forms.TabPage(); this.taboptions = new System.Windows.Forms.TabPage();
this.label8 = new System.Windows.Forms.Label();
this.label9 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.label7 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.additiveselect = new System.Windows.Forms.CheckBox();
this.editnewsector = new System.Windows.Forms.CheckBox();
this.editnewthing = new System.Windows.Forms.CheckBox();
this.heightbysidedef = new System.Windows.Forms.ComboBox();
this.label1 = new System.Windows.Forms.Label();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.groupBox3 = new System.Windows.Forms.GroupBox(); this.groupBox3 = new System.Windows.Forms.GroupBox();
this.visualmodeclearselection = new System.Windows.Forms.CheckBox();
this.autoclearselection = new System.Windows.Forms.CheckBox();
this.editnewthing = new System.Windows.Forms.CheckBox();
this.editnewsector = new System.Windows.Forms.CheckBox();
this.additiveselect = new System.Windows.Forms.CheckBox();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.stitchrange = new CodeImp.DoomBuilder.Controls.NumericTextbox(); this.stitchrange = new CodeImp.DoomBuilder.Controls.NumericTextbox();
this.label8 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.splitlinedefsrange = new CodeImp.DoomBuilder.Controls.NumericTextbox(); this.splitlinedefsrange = new CodeImp.DoomBuilder.Controls.NumericTextbox();
this.label3 = new System.Windows.Forms.Label();
this.label9 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.highlightrange = new CodeImp.DoomBuilder.Controls.NumericTextbox(); this.highlightrange = new CodeImp.DoomBuilder.Controls.NumericTextbox();
this.highlightthingsrange = new CodeImp.DoomBuilder.Controls.NumericTextbox(); this.highlightthingsrange = new CodeImp.DoomBuilder.Controls.NumericTextbox();
this.label4 = new System.Windows.Forms.Label();
this.label7 = new System.Windows.Forms.Label();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.label1 = new System.Windows.Forms.Label();
this.heightbysidedef = new System.Windows.Forms.ComboBox();
this.tabs.SuspendLayout(); this.tabs.SuspendLayout();
this.taboptions.SuspendLayout(); this.taboptions.SuspendLayout();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.groupBox3.SuspendLayout(); this.groupBox3.SuspendLayout();
this.groupBox2.SuspendLayout();
this.groupBox1.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// tabs // tabs
@ -84,146 +86,69 @@ namespace CodeImp.DoomBuilder.BuilderModes
this.taboptions.Text = "Editing"; this.taboptions.Text = "Editing";
this.taboptions.UseVisualStyleBackColor = true; this.taboptions.UseVisualStyleBackColor = true;
// //
// label8 // groupBox3
// //
this.label8.AutoSize = true; this.groupBox3.Controls.Add(this.visualmodeclearselection);
this.label8.Location = new System.Drawing.Point(232, 130); this.groupBox3.Controls.Add(this.autoclearselection);
this.label8.Name = "label8"; this.groupBox3.Controls.Add(this.editnewthing);
this.label8.Size = new System.Drawing.Size(35, 14); this.groupBox3.Controls.Add(this.editnewsector);
this.label8.TabIndex = 15; this.groupBox3.Controls.Add(this.additiveselect);
this.label8.Text = "pixels"; this.groupBox3.Location = new System.Drawing.Point(308, 90);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(332, 171);
this.groupBox3.TabIndex = 18;
this.groupBox3.TabStop = false;
this.groupBox3.Text = " Options ";
// //
// label9 // visualmodeclearselection
// //
this.label9.AutoSize = true; this.visualmodeclearselection.AutoSize = true;
this.label9.Location = new System.Drawing.Point(47, 130); this.visualmodeclearselection.Location = new System.Drawing.Point(23, 129);
this.label9.Name = "label9"; this.visualmodeclearselection.Name = "visualmodeclearselection";
this.label9.Size = new System.Drawing.Size(103, 14); this.visualmodeclearselection.Size = new System.Drawing.Size(220, 18);
this.label9.TabIndex = 13; this.visualmodeclearselection.TabIndex = 5;
this.label9.Text = "Split linedefs within:"; this.visualmodeclearselection.Text = "Automatic clear selection in Visual Mode";
this.label9.TextAlign = System.Drawing.ContentAlignment.TopRight; this.visualmodeclearselection.UseVisualStyleBackColor = true;
// //
// label6 // autoclearselection
// //
this.label6.AutoSize = true; this.autoclearselection.AutoSize = true;
this.label6.Location = new System.Drawing.Point(232, 66); this.autoclearselection.Location = new System.Drawing.Point(23, 105);
this.label6.Name = "label6"; this.autoclearselection.Name = "autoclearselection";
this.label6.Size = new System.Drawing.Size(35, 14); this.autoclearselection.Size = new System.Drawing.Size(231, 18);
this.label6.TabIndex = 12; this.autoclearselection.TabIndex = 4;
this.label6.Text = "pixels"; this.autoclearselection.Text = "Automatic clear selection in Classic Modes";
// this.autoclearselection.UseVisualStyleBackColor = true;
// label7
//
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(36, 66);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(114, 14);
this.label7.TabIndex = 10;
this.label7.Text = "Highlight things within:";
this.label7.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(232, 34);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(35, 14);
this.label4.TabIndex = 9;
this.label4.Text = "pixels";
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(20, 34);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(130, 14);
this.label5.TabIndex = 7;
this.label5.Text = "Highlight geometry within:";
this.label5.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(232, 98);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(35, 14);
this.label3.TabIndex = 6;
this.label3.Text = "pixels";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(33, 98);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(117, 14);
this.label2.TabIndex = 4;
this.label2.Text = "Stitch geometry within:";
this.label2.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
// additiveselect
//
this.additiveselect.AutoSize = true;
this.additiveselect.Location = new System.Drawing.Point(28, 89);
this.additiveselect.Name = "additiveselect";
this.additiveselect.Size = new System.Drawing.Size(211, 18);
this.additiveselect.TabIndex = 3;
this.additiveselect.Text = "Additive selecting without holding shift";
this.additiveselect.UseVisualStyleBackColor = true;
//
// editnewsector
//
this.editnewsector.AutoSize = true;
this.editnewsector.Location = new System.Drawing.Point(28, 61);
this.editnewsector.Name = "editnewsector";
this.editnewsector.Size = new System.Drawing.Size(271, 18);
this.editnewsector.TabIndex = 2;
this.editnewsector.Text = "Edit sector properties when drawing a new sector";
this.editnewsector.UseVisualStyleBackColor = true;
// //
// editnewthing // editnewthing
// //
this.editnewthing.AutoSize = true; this.editnewthing.AutoSize = true;
this.editnewthing.Location = new System.Drawing.Point(28, 33); this.editnewthing.Location = new System.Drawing.Point(23, 33);
this.editnewthing.Name = "editnewthing"; this.editnewthing.Name = "editnewthing";
this.editnewthing.Size = new System.Drawing.Size(256, 18); this.editnewthing.Size = new System.Drawing.Size(256, 18);
this.editnewthing.TabIndex = 1; this.editnewthing.TabIndex = 1;
this.editnewthing.Text = "Edit thing properties when inserting a new thing"; this.editnewthing.Text = "Edit thing properties when inserting a new thing";
this.editnewthing.UseVisualStyleBackColor = true; this.editnewthing.UseVisualStyleBackColor = true;
// //
// heightbysidedef // editnewsector
// //
this.heightbysidedef.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.editnewsector.AutoSize = true;
this.heightbysidedef.FormattingEnabled = true; this.editnewsector.Location = new System.Drawing.Point(23, 57);
this.heightbysidedef.Items.AddRange(new object[] { this.editnewsector.Name = "editnewsector";
"Do nothing", this.editnewsector.Size = new System.Drawing.Size(271, 18);
"Change the ceiling height", this.editnewsector.TabIndex = 2;
"Change the floor height", this.editnewsector.Text = "Edit sector properties when drawing a new sector";
"Change both floor and ceiling height"}); this.editnewsector.UseVisualStyleBackColor = true;
this.heightbysidedef.Location = new System.Drawing.Point(364, 32);
this.heightbysidedef.Name = "heightbysidedef";
this.heightbysidedef.Size = new System.Drawing.Size(199, 22);
this.heightbysidedef.TabIndex = 0;
// //
// label1 // additiveselect
// //
this.label1.AutoSize = true; this.additiveselect.AutoSize = true;
this.label1.Location = new System.Drawing.Point(29, 35); this.additiveselect.Location = new System.Drawing.Point(23, 81);
this.label1.Name = "label1"; this.additiveselect.Name = "additiveselect";
this.label1.Size = new System.Drawing.Size(315, 14); this.additiveselect.Size = new System.Drawing.Size(211, 18);
this.label1.TabIndex = 0; this.additiveselect.TabIndex = 3;
this.label1.Text = "When sector height changes are used on a wall in Visual Mode:"; this.additiveselect.Text = "Additive selecting without holding shift";
this.label1.TextAlign = System.Drawing.ContentAlignment.TopRight; this.additiveselect.UseVisualStyleBackColor = true;
//
// groupBox1
//
this.groupBox1.Controls.Add(this.label1);
this.groupBox1.Controls.Add(this.heightbysidedef);
this.groupBox1.Location = new System.Drawing.Point(6, 6);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(634, 78);
this.groupBox1.TabIndex = 16;
this.groupBox1.TabStop = false;
this.groupBox1.Text = " Behavior ";
// //
// groupBox2 // groupBox2
// //
@ -246,18 +171,6 @@ namespace CodeImp.DoomBuilder.BuilderModes
this.groupBox2.TabStop = false; this.groupBox2.TabStop = false;
this.groupBox2.Text = " Ranges "; this.groupBox2.Text = " Ranges ";
// //
// groupBox3
//
this.groupBox3.Controls.Add(this.editnewthing);
this.groupBox3.Controls.Add(this.editnewsector);
this.groupBox3.Controls.Add(this.additiveselect);
this.groupBox3.Location = new System.Drawing.Point(308, 90);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(332, 171);
this.groupBox3.TabIndex = 18;
this.groupBox3.TabStop = false;
this.groupBox3.Text = " Options ";
//
// stitchrange // stitchrange
// //
this.stitchrange.AllowDecimal = false; this.stitchrange.AllowDecimal = false;
@ -270,6 +183,25 @@ namespace CodeImp.DoomBuilder.BuilderModes
this.stitchrange.Size = new System.Drawing.Size(59, 20); this.stitchrange.Size = new System.Drawing.Size(59, 20);
this.stitchrange.TabIndex = 5; this.stitchrange.TabIndex = 5;
// //
// label8
//
this.label8.AutoSize = true;
this.label8.Location = new System.Drawing.Point(232, 130);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(35, 14);
this.label8.TabIndex = 15;
this.label8.Text = "pixels";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(33, 98);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(117, 14);
this.label2.TabIndex = 4;
this.label2.Text = "Stitch geometry within:";
this.label2.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
// splitlinedefsrange // splitlinedefsrange
// //
this.splitlinedefsrange.AllowDecimal = false; this.splitlinedefsrange.AllowDecimal = false;
@ -282,6 +214,44 @@ namespace CodeImp.DoomBuilder.BuilderModes
this.splitlinedefsrange.Size = new System.Drawing.Size(59, 20); this.splitlinedefsrange.Size = new System.Drawing.Size(59, 20);
this.splitlinedefsrange.TabIndex = 14; this.splitlinedefsrange.TabIndex = 14;
// //
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(232, 98);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(35, 14);
this.label3.TabIndex = 6;
this.label3.Text = "pixels";
//
// label9
//
this.label9.AutoSize = true;
this.label9.Location = new System.Drawing.Point(47, 130);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(103, 14);
this.label9.TabIndex = 13;
this.label9.Text = "Split linedefs within:";
this.label9.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(20, 34);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(130, 14);
this.label5.TabIndex = 7;
this.label5.Text = "Highlight geometry within:";
this.label5.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(232, 66);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(35, 14);
this.label6.TabIndex = 12;
this.label6.Text = "pixels";
//
// highlightrange // highlightrange
// //
this.highlightrange.AllowDecimal = false; this.highlightrange.AllowDecimal = false;
@ -306,6 +276,60 @@ namespace CodeImp.DoomBuilder.BuilderModes
this.highlightthingsrange.Size = new System.Drawing.Size(59, 20); this.highlightthingsrange.Size = new System.Drawing.Size(59, 20);
this.highlightthingsrange.TabIndex = 11; this.highlightthingsrange.TabIndex = 11;
// //
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(232, 34);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(35, 14);
this.label4.TabIndex = 9;
this.label4.Text = "pixels";
//
// label7
//
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(36, 66);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(114, 14);
this.label7.TabIndex = 10;
this.label7.Text = "Highlight things within:";
this.label7.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
// groupBox1
//
this.groupBox1.Controls.Add(this.label1);
this.groupBox1.Controls.Add(this.heightbysidedef);
this.groupBox1.Location = new System.Drawing.Point(6, 6);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(634, 78);
this.groupBox1.TabIndex = 16;
this.groupBox1.TabStop = false;
this.groupBox1.Text = " Behavior ";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(29, 35);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(315, 14);
this.label1.TabIndex = 0;
this.label1.Text = "When sector height changes are used on a wall in Visual Mode:";
this.label1.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
// heightbysidedef
//
this.heightbysidedef.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.heightbysidedef.FormattingEnabled = true;
this.heightbysidedef.Items.AddRange(new object[] {
"Do nothing",
"Change the ceiling height",
"Change the floor height",
"Change both floor and ceiling height"});
this.heightbysidedef.Location = new System.Drawing.Point(364, 32);
this.heightbysidedef.Name = "heightbysidedef";
this.heightbysidedef.Size = new System.Drawing.Size(199, 22);
this.heightbysidedef.TabIndex = 0;
//
// PreferencesForm // PreferencesForm
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
@ -320,12 +344,12 @@ namespace CodeImp.DoomBuilder.BuilderModes
this.Text = "PreferencesForm"; this.Text = "PreferencesForm";
this.tabs.ResumeLayout(false); this.tabs.ResumeLayout(false);
this.taboptions.ResumeLayout(false); this.taboptions.ResumeLayout(false);
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
this.groupBox3.ResumeLayout(false); this.groupBox3.ResumeLayout(false);
this.groupBox3.PerformLayout(); this.groupBox3.PerformLayout();
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.ResumeLayout(false); this.ResumeLayout(false);
} }
@ -354,5 +378,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
private System.Windows.Forms.GroupBox groupBox1; private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.GroupBox groupBox3; private System.Windows.Forms.GroupBox groupBox3;
private System.Windows.Forms.GroupBox groupBox2; private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.CheckBox autoclearselection;
private System.Windows.Forms.CheckBox visualmodeclearselection;
} }
} }

View file

@ -64,6 +64,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
highlightrange.Text = General.Settings.ReadPluginSetting("highlightrange", 20).ToString(); highlightrange.Text = General.Settings.ReadPluginSetting("highlightrange", 20).ToString();
highlightthingsrange.Text = General.Settings.ReadPluginSetting("highlightthingsrange", 10).ToString(); highlightthingsrange.Text = General.Settings.ReadPluginSetting("highlightthingsrange", 10).ToString();
splitlinedefsrange.Text = General.Settings.ReadPluginSetting("splitlinedefsrange", 10).ToString(); splitlinedefsrange.Text = General.Settings.ReadPluginSetting("splitlinedefsrange", 10).ToString();
autoclearselection.Checked = BuilderPlug.Me.AutoClearSelection;
visualmodeclearselection.Checked = BuilderPlug.Me.VisualModeClearSelection;
} }
#endregion #endregion
@ -82,6 +84,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
General.Settings.WritePluginSetting("highlightrange", highlightrange.GetResult(0)); General.Settings.WritePluginSetting("highlightrange", highlightrange.GetResult(0));
General.Settings.WritePluginSetting("highlightthingsrange", highlightthingsrange.GetResult(0)); General.Settings.WritePluginSetting("highlightthingsrange", highlightthingsrange.GetResult(0));
General.Settings.WritePluginSetting("splitlinedefsrange", splitlinedefsrange.GetResult(0)); General.Settings.WritePluginSetting("splitlinedefsrange", splitlinedefsrange.GetResult(0));
General.Settings.WritePluginSetting("autoclearselection", autoclearselection.Checked);
General.Settings.WritePluginSetting("visualmodeclearselection", visualmodeclearselection.Checked);
} }
// When Cancel is pressed on the preferences dialog // When Cancel is pressed on the preferences dialog

View file

@ -126,6 +126,12 @@
<metadata name="groupBox3.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="groupBox3.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>
<metadata name="visualmodeclearselection.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="autoclearselection.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="editnewthing.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="editnewthing.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>
@ -183,6 +189,48 @@
<metadata name="heightbysidedef.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="heightbysidedef.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>
<metadata name="stitchrange.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="label8.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="label2.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="splitlinedefsrange.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="label3.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="label9.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="label5.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="label6.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="highlightrange.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="highlightthingsrange.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="label4.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="label7.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="label1.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="heightbysidedef.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="$this.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="$this.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>

View file

@ -102,8 +102,16 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Select or deselect // Select or deselect
public virtual void OnSelectEnd() public virtual void OnSelectEnd()
{ {
this.selected = !this.selected; if(this.selected)
mode.SelectionChanged = true; {
this.selected = false;
mode.RemoveSelectedObject(this);
}
else
{
this.selected = true;
mode.AddSelectedObject(this);
}
} }
// Processing // Processing

View file

@ -526,8 +526,16 @@ namespace CodeImp.DoomBuilder.BuilderModes
else else
{ {
// Add/remove selection // Add/remove selection
this.selected = !this.selected; if(this.selected)
mode.SelectionChanged = true; {
this.selected = false;
mode.RemoveSelectedObject(this);
}
else
{
this.selected = true;
mode.AddSelectedObject(this);
}
} }
} }

View file

@ -131,6 +131,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
{ {
// Initialize // Initialize
this.gravity = new Vector3D(0.0f, 0.0f, 0.0f); this.gravity = new Vector3D(0.0f, 0.0f, 0.0f);
this.selectedobjects = new List<IVisualEventReceiver>();
// We have no destructor // We have no destructor
GC.SuppressFinalize(this); GC.SuppressFinalize(this);
@ -153,6 +154,20 @@ namespace CodeImp.DoomBuilder.BuilderModes
#region ================== Methods #region ================== Methods
// This adds a selected object
internal void AddSelectedObject(IVisualEventReceiver obj)
{
selectedobjects.Add(obj);
selectionchanged = true;
}
// This removes a selected object
internal void RemoveSelectedObject(IVisualEventReceiver obj)
{
selectedobjects.Remove(obj);
selectionchanged = true;
}
// This is called before an action is performed // This is called before an action is performed
public void PreAction(int multiselectionundogroup) public void PreAction(int multiselectionundogroup)
{ {
@ -162,12 +177,13 @@ namespace CodeImp.DoomBuilder.BuilderModes
// If the action is not performed on a selected object, clear the // If the action is not performed on a selected object, clear the
// current selection and make a temporary selection for the target. // current selection and make a temporary selection for the target.
if((target.picked != null) && !target.picked.Selected) if((target.picked != null) && !target.picked.Selected && (BuilderPlug.Me.VisualModeClearSelection || (selectedobjects.Count == 0)))
{ {
// Single object, no selection // Single object, no selection
singleselection = true; singleselection = true;
ClearSelection(); ClearSelection();
target.picked.Selected = true; target.picked.Selected = true;
selectedobjects.Add(target.picked as IVisualEventReceiver);
undocreated = false; undocreated = false;
} }
else else
@ -190,17 +206,14 @@ namespace CodeImp.DoomBuilder.BuilderModes
undocreated = true; undocreated = true;
} }
} }
MakeSelectedObjectsList();
} }
// Called before an action is performed. This does not make an undo level or change selection. // Called before an action is performed. This does not make an undo level
private void PreActionNoChange() private void PreActionNoChange()
{ {
actionresult = new VisualActionResult(); actionresult = new VisualActionResult();
singleselection = false; singleselection = false;
undocreated = false; undocreated = false;
MakeSelectedObjectsList();
} }
// This is called after an action is performed // This is called after an action is performed
@ -266,7 +279,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
} }
// This makes a list of the selected object // This makes a list of the selected object
private void MakeSelectedObjectsList() private void RebuildSelectedObjectsList()
{ {
// Make list of selected objects // Make list of selected objects
selectedobjects = new List<IVisualEventReceiver>(); selectedobjects = new List<IVisualEventReceiver>();
@ -615,18 +628,26 @@ namespace CodeImp.DoomBuilder.BuilderModes
public override void OnMouseMove(MouseEventArgs e) public override void OnMouseMove(MouseEventArgs e)
{ {
base.OnMouseMove(e); base.OnMouseMove(e);
if(target.picked != null) (target.picked as IVisualEventReceiver).OnMouseMove(e); GetTargetEventReceiver(true).OnMouseMove(e);
} }
// Undo performed // Undo performed
public override void OnUndoEnd() public override void OnUndoEnd()
{ {
base.OnUndoEnd(); base.OnUndoEnd();
RebuildSelectedObjectsList();
// We can't group with this undo level anymore // We can't group with this undo level anymore
lastundogroup = UndoGroup.None; lastundogroup = UndoGroup.None;
} }
// Redo performed
public override void OnRedoEnd()
{
base.OnRedoEnd();
RebuildSelectedObjectsList();
}
#endregion #endregion
#region ================== Action Assist #region ================== Action Assist
@ -774,7 +795,31 @@ namespace CodeImp.DoomBuilder.BuilderModes
} }
return things; return things;
} }
// This returns the IVisualEventReceiver on which the action must be performed
private IVisualEventReceiver GetTargetEventReceiver(bool targetonly)
{
if(target.picked != null)
{
if(singleselection || target.picked.Selected || targetonly)
{
return (IVisualEventReceiver)target.picked;
}
else if(selectedobjects.Count > 0)
{
return selectedobjects[0];
}
else
{
return (IVisualEventReceiver)target.picked;
}
}
else
{
return new NullVisualEventReceiver();
}
}
#endregion #endregion
#region ================== Actions #region ================== Actions
@ -811,7 +856,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
{ {
PreActionNoChange(); PreActionNoChange();
PickTargetUnlocked(); PickTargetUnlocked();
if(target.picked != null) (target.picked as IVisualEventReceiver).OnSelectBegin(); GetTargetEventReceiver(true).OnSelectBegin();
PostAction(); PostAction();
} }
@ -819,7 +864,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
public void EndSelect() public void EndSelect()
{ {
PreActionNoChange(); PreActionNoChange();
if(target.picked != null) (target.picked as IVisualEventReceiver).OnSelectEnd(); GetTargetEventReceiver(true).OnSelectEnd();
PostAction(); PostAction();
} }
@ -827,7 +872,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
public void BeginEdit() public void BeginEdit()
{ {
PreAction(UndoGroup.None); PreAction(UndoGroup.None);
if(target.picked != null) (target.picked as IVisualEventReceiver).OnEditBegin(); GetTargetEventReceiver(false).OnEditBegin();
PostAction(); PostAction();
} }
@ -835,7 +880,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
public void EndEdit() public void EndEdit()
{ {
PreAction(UndoGroup.None); PreAction(UndoGroup.None);
if(target.picked != null) (target.picked as IVisualEventReceiver).OnEditEnd(); GetTargetEventReceiver(false).OnEditEnd();
PostAction(); PostAction();
} }
@ -964,7 +1009,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
PreAction(UndoGroup.None); PreAction(UndoGroup.None);
renderer.SetCrosshairBusy(true); renderer.SetCrosshairBusy(true);
General.Interface.RedrawDisplay(); General.Interface.RedrawDisplay();
if(target.picked != null) (target.picked as IVisualEventReceiver).OnSelectTexture(); GetTargetEventReceiver(false).OnSelectTexture();
UpdateChangedObjects(); UpdateChangedObjects();
renderer.SetCrosshairBusy(false); renderer.SetCrosshairBusy(false);
PostAction(); PostAction();
@ -974,7 +1019,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
public void TextureCopy() public void TextureCopy()
{ {
PreActionNoChange(); PreActionNoChange();
if(target.picked != null) (target.picked as IVisualEventReceiver).OnCopyTexture(); GetTargetEventReceiver(false).OnCopyTexture();
PostAction(); PostAction();
} }
@ -992,7 +1037,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
PreAction(UndoGroup.None); PreAction(UndoGroup.None);
renderer.SetCrosshairBusy(true); renderer.SetCrosshairBusy(true);
General.Interface.RedrawDisplay(); General.Interface.RedrawDisplay();
if(target.picked != null) (target.picked as IVisualEventReceiver).OnTextureAlign(true, false); GetTargetEventReceiver(false).OnTextureAlign(true, false);
UpdateChangedObjects(); UpdateChangedObjects();
renderer.SetCrosshairBusy(false); renderer.SetCrosshairBusy(false);
PostAction(); PostAction();
@ -1004,7 +1049,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
PreAction(UndoGroup.None); PreAction(UndoGroup.None);
renderer.SetCrosshairBusy(true); renderer.SetCrosshairBusy(true);
General.Interface.RedrawDisplay(); General.Interface.RedrawDisplay();
if(target.picked != null) (target.picked as IVisualEventReceiver).OnTextureAlign(false, true); GetTargetEventReceiver(false).OnTextureAlign(false, true);
UpdateChangedObjects(); UpdateChangedObjects();
renderer.SetCrosshairBusy(false); renderer.SetCrosshairBusy(false);
PostAction(); PostAction();
@ -1014,7 +1059,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
public void ToggleUpperUnpegged() public void ToggleUpperUnpegged()
{ {
PreAction(UndoGroup.None); PreAction(UndoGroup.None);
if(target.picked != null) (target.picked as IVisualEventReceiver).OnToggleUpperUnpegged(); GetTargetEventReceiver(false).OnToggleUpperUnpegged();
PostAction(); PostAction();
} }
@ -1022,7 +1067,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
public void ToggleLowerUnpegged() public void ToggleLowerUnpegged()
{ {
PreAction(UndoGroup.None); PreAction(UndoGroup.None);
if(target.picked != null) (target.picked as IVisualEventReceiver).OnToggleLowerUnpegged(); GetTargetEventReceiver(false).OnToggleLowerUnpegged();
PostAction(); PostAction();
} }
@ -1054,7 +1099,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
public void FloodfillTextures() public void FloodfillTextures()
{ {
PreAction(UndoGroup.None); PreAction(UndoGroup.None);
if(target.picked != null) (target.picked as IVisualEventReceiver).OnTextureFloodfill(); GetTargetEventReceiver(false).OnTextureFloodfill();
PostAction(); PostAction();
} }
@ -1062,7 +1107,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
public void TextureCopyOffsets() public void TextureCopyOffsets()
{ {
PreActionNoChange(); PreActionNoChange();
if(target.picked != null) (target.picked as IVisualEventReceiver).OnCopyTextureOffsets(); GetTargetEventReceiver(false).OnCopyTextureOffsets();
PostAction(); PostAction();
} }
@ -1078,7 +1123,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
public void CopyProperties() public void CopyProperties()
{ {
PreActionNoChange(); PreActionNoChange();
if(target.picked != null) (target.picked as IVisualEventReceiver).OnCopyProperties(); GetTargetEventReceiver(false).OnCopyProperties();
PostAction(); PostAction();
} }

View file

@ -381,8 +381,16 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Select or deselect // Select or deselect
public virtual void OnSelectEnd() public virtual void OnSelectEnd()
{ {
this.selected = !this.selected; if(this.selected)
mode.SelectionChanged = true; {
this.selected = false;
mode.RemoveSelectedObject(this);
}
else
{
this.selected = true;
mode.AddSelectedObject(this);
}
} }
// Copy properties // Copy properties

View file

@ -0,0 +1,155 @@
#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;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Reflection;
using CodeImp.DoomBuilder.Windows;
using CodeImp.DoomBuilder.IO;
using CodeImp.DoomBuilder.Map;
using CodeImp.DoomBuilder.Rendering;
using CodeImp.DoomBuilder.Geometry;
using CodeImp.DoomBuilder.Editing;
using CodeImp.DoomBuilder.VisualModes;
#endregion
namespace CodeImp.DoomBuilder.BuilderModes
{
// This doesn't do jack shit.
internal class NullVisualEventReceiver : IVisualEventReceiver
{
public NullVisualEventReceiver()
{
}
public void OnSelectBegin()
{
}
public void OnSelectEnd()
{
}
public void OnEditBegin()
{
}
public void OnEditEnd()
{
}
public void OnMouseMove(MouseEventArgs e)
{
}
public void OnChangeTargetHeight(int amount)
{
}
public void OnChangeTargetBrightness(bool up)
{
}
public void OnChangeTextureOffset(int horizontal, int vertical)
{
}
public void OnResetTextureOffset()
{
}
public void OnSelectTexture()
{
}
public void OnCopyTexture()
{
}
public void OnPasteTexture()
{
}
public void OnCopyTextureOffsets()
{
}
public void OnPasteTextureOffsets()
{
}
public void OnCopyProperties()
{
}
public void OnPasteProperties()
{
}
public void OnTextureAlign(bool alignx, bool aligny)
{
}
public void OnTextureFloodfill()
{
}
public void OnToggleUpperUnpegged()
{
}
public void OnToggleLowerUnpegged()
{
}
public void OnProcess(double deltatime)
{
}
public void OnInsert()
{
}
public void OnDelete()
{
}
public void ApplyTexture(string texture)
{
}
public void ApplyUpperUnpegged(bool set)
{
}
public void ApplyLowerUnpegged(bool set)
{
}
public string GetTextureName()
{
return "";
}
}
}