mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-01-18 14:31:50 +00:00
Added additive selection in classic modes (and an option to make additive selections without holding the shift key)
This commit is contained in:
parent
b5897d0f5b
commit
67f4237bc0
8 changed files with 181 additions and 73 deletions
|
@ -602,19 +602,37 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
// This is called wheh selection ends
|
||||
protected override void OnEndMultiSelection()
|
||||
{
|
||||
// Go for all lines
|
||||
foreach(Linedef l in General.Map.Map.Linedefs)
|
||||
if(General.Interface.ShiftState ^ BuilderPlug.Me.AdditiveSelect)
|
||||
{
|
||||
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 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));
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
|
|
@ -445,19 +445,37 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
// This is called wheh selection ends
|
||||
protected override void OnEndMultiSelection()
|
||||
{
|
||||
// Go for all lines
|
||||
foreach(Linedef l in General.Map.Map.Linedefs)
|
||||
if(General.Interface.ShiftState ^ BuilderPlug.Me.AdditiveSelect)
|
||||
{
|
||||
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 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));
|
||||
}
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
base.OnEndMultiSelection();
|
||||
|
||||
// Clear overlay
|
||||
|
|
|
@ -571,17 +571,35 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
// This is called wheh selection ends
|
||||
protected override void OnEndMultiSelection()
|
||||
{
|
||||
// Go for all lines
|
||||
foreach(Linedef l in General.Map.Map.Linedefs)
|
||||
if(General.Interface.ShiftState ^ BuilderPlug.Me.AdditiveSelect)
|
||||
{
|
||||
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 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));
|
||||
}
|
||||
}
|
||||
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
|
||||
|
|
|
@ -438,15 +438,29 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
// This is called wheh selection ends
|
||||
protected override void OnEndMultiSelection()
|
||||
{
|
||||
// Go for all things
|
||||
foreach(Thing t in General.Map.ThingsFilter.VisibleThings)
|
||||
if(General.Interface.ShiftState ^ BuilderPlug.Me.AdditiveSelect)
|
||||
{
|
||||
t.Selected = ((t.Position.x >= selectionrect.Left) &&
|
||||
(t.Position.y >= selectionrect.Top) &&
|
||||
(t.Position.x <= selectionrect.Right) &&
|
||||
(t.Position.y <= selectionrect.Bottom));
|
||||
// Go for all things
|
||||
foreach(Thing t in General.Map.ThingsFilter.VisibleThings)
|
||||
{
|
||||
t.Selected |= ((t.Position.x >= selectionrect.Left) &&
|
||||
(t.Position.y >= selectionrect.Top) &&
|
||||
(t.Position.x <= selectionrect.Right) &&
|
||||
(t.Position.y <= selectionrect.Bottom));
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
// Go for all things
|
||||
foreach(Thing t in General.Map.ThingsFilter.VisibleThings)
|
||||
{
|
||||
t.Selected = ((t.Position.x >= selectionrect.Left) &&
|
||||
(t.Position.y >= selectionrect.Top) &&
|
||||
(t.Position.x <= selectionrect.Right) &&
|
||||
(t.Position.y <= selectionrect.Bottom));
|
||||
}
|
||||
}
|
||||
|
||||
base.OnEndMultiSelection();
|
||||
|
||||
// Clear overlay
|
||||
|
|
|
@ -372,15 +372,29 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
// This is called wheh selection ends
|
||||
protected override void OnEndMultiSelection()
|
||||
{
|
||||
// Go for all vertices
|
||||
foreach(Vertex v in General.Map.Map.Vertices)
|
||||
if(General.Interface.ShiftState ^ BuilderPlug.Me.AdditiveSelect)
|
||||
{
|
||||
v.Selected = ((v.Position.x >= selectionrect.Left) &&
|
||||
(v.Position.y >= selectionrect.Top) &&
|
||||
(v.Position.x <= selectionrect.Right) &&
|
||||
(v.Position.y <= selectionrect.Bottom));
|
||||
// Go for all vertices
|
||||
foreach(Vertex v in General.Map.Map.Vertices)
|
||||
{
|
||||
v.Selected |= ((v.Position.x >= selectionrect.Left) &&
|
||||
(v.Position.y >= selectionrect.Top) &&
|
||||
(v.Position.x <= selectionrect.Right) &&
|
||||
(v.Position.y <= selectionrect.Bottom));
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
// Go for all vertices
|
||||
foreach(Vertex v in General.Map.Map.Vertices)
|
||||
{
|
||||
v.Selected = ((v.Position.x >= selectionrect.Left) &&
|
||||
(v.Position.y >= selectionrect.Top) &&
|
||||
(v.Position.x <= selectionrect.Right) &&
|
||||
(v.Position.y <= selectionrect.Bottom));
|
||||
}
|
||||
}
|
||||
|
||||
base.OnEndMultiSelection();
|
||||
|
||||
// Clear overlay
|
||||
|
|
|
@ -64,6 +64,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
private int changeheightbysidedef; // 0 = nothing, 1 = change ceiling, 2 = change floor
|
||||
private bool editnewthing;
|
||||
private bool editnewsector;
|
||||
private bool additiveselect;
|
||||
private string copiedtexture;
|
||||
private string copiedflat;
|
||||
private Point copiedoffsets;
|
||||
|
@ -90,6 +91,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
public int ChangeHeightBySidedef { get { return changeheightbysidedef; } }
|
||||
public bool EditNewThing { get { return editnewthing; } }
|
||||
public bool EditNewSector { get { return editnewsector; } }
|
||||
public bool AdditiveSelect { get { return additiveselect; } }
|
||||
public string CopiedTexture { get { return copiedtexture; } set { copiedtexture = value; } }
|
||||
public string CopiedFlat { get { return copiedflat; } set { copiedflat = value; } }
|
||||
public Point CopiedOffsets { get { return copiedoffsets; } set { copiedoffsets = value; } }
|
||||
|
@ -110,9 +112,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
// Settings
|
||||
showvisualthings = 2;
|
||||
usegravity = false;
|
||||
changeheightbysidedef = General.Settings.ReadPluginSetting("changeheightbysidedef", 0);
|
||||
editnewthing = General.Settings.ReadPluginSetting("editnewthing", true);
|
||||
editnewsector = General.Settings.ReadPluginSetting("editnewsector", false);
|
||||
LoadSettings();
|
||||
|
||||
// Load menus form and register it
|
||||
menusform = new MenusForm();
|
||||
|
@ -153,8 +153,21 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
|
||||
#endregion
|
||||
|
||||
#region ================== Methods
|
||||
|
||||
// This loads the plugin settings
|
||||
private void LoadSettings()
|
||||
{
|
||||
changeheightbysidedef = General.Settings.ReadPluginSetting("changeheightbysidedef", 0);
|
||||
editnewthing = General.Settings.ReadPluginSetting("editnewthing", true);
|
||||
editnewsector = General.Settings.ReadPluginSetting("editnewsector", false);
|
||||
additiveselect = General.Settings.ReadPluginSetting("additiveselect", false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Events
|
||||
|
||||
|
||||
// When floor surface geometry is created for classic modes
|
||||
public override void OnSectorFloorSurfaceUpdate(Sector s, ref FlatVertex[] vertices)
|
||||
{
|
||||
|
@ -218,9 +231,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
base.OnClosePreferences(controller);
|
||||
|
||||
// Apply settings that could have been changed
|
||||
changeheightbysidedef = General.Settings.ReadPluginSetting("changeheightbysidedef", 0);
|
||||
editnewthing = General.Settings.ReadPluginSetting("editnewthing", true);
|
||||
editnewsector = General.Settings.ReadPluginSetting("editnewsector", false);
|
||||
LoadSettings();
|
||||
|
||||
// Unload preferences
|
||||
preferencesform.Dispose();
|
||||
|
|
|
@ -30,10 +30,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
{
|
||||
this.tabs = new System.Windows.Forms.TabControl();
|
||||
this.taboptions = new System.Windows.Forms.TabPage();
|
||||
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.editnewthing = new System.Windows.Forms.CheckBox();
|
||||
this.editnewsector = new System.Windows.Forms.CheckBox();
|
||||
this.additiveselect = new System.Windows.Forms.CheckBox();
|
||||
this.tabs.SuspendLayout();
|
||||
this.taboptions.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
|
@ -53,6 +54,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
//
|
||||
// taboptions
|
||||
//
|
||||
this.taboptions.Controls.Add(this.additiveselect);
|
||||
this.taboptions.Controls.Add(this.editnewsector);
|
||||
this.taboptions.Controls.Add(this.editnewthing);
|
||||
this.taboptions.Controls.Add(this.heightbysidedef);
|
||||
|
@ -66,6 +68,26 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
this.taboptions.Text = "Editing";
|
||||
this.taboptions.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// editnewsector
|
||||
//
|
||||
this.editnewsector.AutoSize = true;
|
||||
this.editnewsector.Location = new System.Drawing.Point(21, 81);
|
||||
this.editnewsector.Name = "editnewsector";
|
||||
this.editnewsector.Size = new System.Drawing.Size(271, 18);
|
||||
this.editnewsector.TabIndex = 3;
|
||||
this.editnewsector.Text = "Edit sector properties when drawing a new sector";
|
||||
this.editnewsector.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// editnewthing
|
||||
//
|
||||
this.editnewthing.AutoSize = true;
|
||||
this.editnewthing.Location = new System.Drawing.Point(21, 55);
|
||||
this.editnewthing.Name = "editnewthing";
|
||||
this.editnewthing.Size = new System.Drawing.Size(256, 18);
|
||||
this.editnewthing.TabIndex = 2;
|
||||
this.editnewthing.Text = "Edit thing properties when inserting a new thing";
|
||||
this.editnewthing.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// heightbysidedef
|
||||
//
|
||||
this.heightbysidedef.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
|
@ -88,25 +110,15 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
this.label1.TabIndex = 0;
|
||||
this.label1.Text = "When sector height changes are used on a wall in Visual Mode:";
|
||||
//
|
||||
// editnewthing
|
||||
// additiveselect
|
||||
//
|
||||
this.editnewthing.AutoSize = true;
|
||||
this.editnewthing.Location = new System.Drawing.Point(21, 55);
|
||||
this.editnewthing.Name = "editnewthing";
|
||||
this.editnewthing.Size = new System.Drawing.Size(256, 18);
|
||||
this.editnewthing.TabIndex = 2;
|
||||
this.editnewthing.Text = "Edit thing properties when inserting a new thing";
|
||||
this.editnewthing.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// editnewsector
|
||||
//
|
||||
this.editnewsector.AutoSize = true;
|
||||
this.editnewsector.Location = new System.Drawing.Point(21, 81);
|
||||
this.editnewsector.Name = "editnewsector";
|
||||
this.editnewsector.Size = new System.Drawing.Size(271, 18);
|
||||
this.editnewsector.TabIndex = 3;
|
||||
this.editnewsector.Text = "Edit sector properties when drawing a new sector";
|
||||
this.editnewsector.UseVisualStyleBackColor = true;
|
||||
this.additiveselect.AutoSize = true;
|
||||
this.additiveselect.Location = new System.Drawing.Point(21, 119);
|
||||
this.additiveselect.Name = "additiveselect";
|
||||
this.additiveselect.Size = new System.Drawing.Size(211, 18);
|
||||
this.additiveselect.TabIndex = 4;
|
||||
this.additiveselect.Text = "Additive selecting without holding shift";
|
||||
this.additiveselect.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// PreferencesForm
|
||||
//
|
||||
|
@ -135,5 +147,6 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
private System.Windows.Forms.ComboBox heightbysidedef;
|
||||
private System.Windows.Forms.CheckBox editnewsector;
|
||||
private System.Windows.Forms.CheckBox editnewthing;
|
||||
private System.Windows.Forms.CheckBox additiveselect;
|
||||
}
|
||||
}
|
|
@ -59,6 +59,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
heightbysidedef.SelectedIndex = General.Settings.ReadPluginSetting("changeheightbysidedef", 0);
|
||||
editnewthing.Checked = General.Settings.ReadPluginSetting("editnewthing", true);
|
||||
editnewsector.Checked = General.Settings.ReadPluginSetting("editnewsector", false);
|
||||
additiveselect.Checked = General.Settings.ReadPluginSetting("additiveselect", false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -72,6 +73,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
General.Settings.WritePluginSetting("changeheightbysidedef", heightbysidedef.SelectedIndex);
|
||||
General.Settings.WritePluginSetting("editnewthing", editnewthing.Checked);
|
||||
General.Settings.WritePluginSetting("editnewsector", editnewsector.Checked);
|
||||
General.Settings.WritePluginSetting("additiveselect", additiveselect.Checked);
|
||||
}
|
||||
|
||||
// When Cancel is pressed on the preferences dialog
|
||||
|
|
Loading…
Reference in a new issue