Changed, Vertices/Linedefs/Sectors/Things modes: selected map element is no longer deselected after accepting Edit window when it was the only selected map element when the Edit window was opening.

This commit is contained in:
MaxED 2016-09-27 19:39:46 +00:00 committed by spherallic
parent ce91d27ad2
commit 66f4b43184
4 changed files with 51 additions and 15 deletions

View file

@ -68,6 +68,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Interface
private bool editpressed;
private bool selectionfromhighlight; //mxd
#endregion
@ -543,8 +544,18 @@ namespace CodeImp.DoomBuilder.BuilderModes
{
base.UpdateSelectionInfo();
// Dispose old labels
if(labels != null) foreach(SelectionLabel l in labels.Values) l.Dispose();
if(labels != null)
{
// Dispose old labels
foreach(SelectionLabel l in labels.Values) l.Dispose();
// Don't show lables for selected-from-highlight item
if(selectionfromhighlight)
{
labels.Clear();
return;
}
}
// Make text labels for selected linedefs
ICollection<Linedef> orderedselection = General.Map.Map.GetSelectedLinedefs(true);
@ -866,8 +877,10 @@ namespace CodeImp.DoomBuilder.BuilderModes
if(!highlighted.Selected && (BuilderPlug.Me.AutoClearSelection || (General.Map.Map.SelectedLinedefsCount == 0)))
{
// Make this the only selection
selectionfromhighlight = true; //mxd
General.Map.Map.ClearSelectedLinedefs();
highlighted.Selected = true;
UpdateSelectionInfo(); //mxd
General.Interface.RedrawDisplay();
}
@ -916,7 +929,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
General.Map.Map.Update();
// When a single line was selected, deselect it now
if(selected.Count == 1)
if(selected.Count == 1 && selectionfromhighlight)
{
General.Map.Map.ClearSelectedLinedefs();
}
@ -927,14 +940,14 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Update entire display
General.Map.Renderer2D.UpdateExtraFloorFlag(); //mxd
UpdateSelectionInfo(); //mxd
General.Interface.RedrawDisplay();
}
}
UpdateSelectionInfo(); //mxd
}
editpressed = false;
selectionfromhighlight = false; //mxd
base.OnEditEnd();
}

View file

@ -59,6 +59,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Interface
private bool editpressed;
private bool selectionfromhighlight; //mxd
// Labels
private Dictionary<Sector, TextLabel[]> labels;
@ -557,6 +558,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
// This updates labels from the selected sectors
private void UpdateSelectedLabels()
{
// Don't show lables for selected-from-highlight item
if(selectionfromhighlight) return;
// Go for all labels in all selected sectors
ICollection<Sector> orderedselection = General.Map.Map.GetSelectedSectors(true);
PixelColor c = (General.Settings.UseHighlight ? General.Colors.Highlight : General.Colors.Selection); //mxd
@ -935,11 +939,13 @@ namespace CodeImp.DoomBuilder.BuilderModes
if(!highlighted.Selected && (BuilderPlug.Me.AutoClearSelection || (General.Map.Map.SelectedSectorsCount == 0)))
{
// Make this the only selection
selectionfromhighlight = true; //mxd
General.Map.Map.ClearSelectedSectors();
General.Map.Map.ClearSelectedLinedefs();
SelectSector(highlighted, true, false);
UpdateSelectedLabels(); //mxd
UpdateOverlaySurfaces(); //mxd
UpdateSelectionInfo(); //mxd
General.Interface.RedrawDisplay();
}
@ -989,7 +995,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
General.Map.Renderer2D.UpdateExtraFloorFlag(); //mxd
// When a single sector was selected, deselect it now
if(selected.Count == 1)
if(selected.Count == 1 && selectionfromhighlight)
{
General.Map.Map.ClearSelectedSectors();
General.Map.Map.ClearSelectedLinedefs();
@ -1019,6 +1025,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
editpressed = false;
selectionfromhighlight = false; //mxd
base.OnEditEnd();
}

View file

@ -63,6 +63,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
private bool editpressed;
private bool thinginserted;
private bool awaitingMouseClick; //mxd
private bool selectionfromhighlight; //mxd
//mxd. Event lines
private List<Line3D> persistenteventlines;
@ -496,8 +497,10 @@ namespace CodeImp.DoomBuilder.BuilderModes
if(!highlighted.Selected && (BuilderPlug.Me.AutoClearSelection || (General.Map.Map.SelectedThingsCount == 0)))
{
// Make this the only selection
selectionfromhighlight = true; //mxd
General.Map.Map.ClearSelectedThings();
highlighted.Selected = true;
UpdateSelectionInfo(); //mxd
General.Interface.RedrawDisplay();
}
@ -557,7 +560,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
General.Interface.OnEditFormValuesChanged -= thingEditForm_OnValuesChanged;
// When a single thing was selected, deselect it now
if(selected.Count == 1)
if(selected.Count == 1 && selectionfromhighlight)
{
General.Map.Map.ClearSelectedThings();
}
@ -580,6 +583,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
editpressed = false;
selectionfromhighlight = false; //mxd
base.OnEditEnd();
}
@ -1019,8 +1023,18 @@ namespace CodeImp.DoomBuilder.BuilderModes
{
base.UpdateSelectionInfo();
// Dispose old labels
if(labels != null) foreach(TextLabel l in labels.Values) l.Dispose();
if(labels != null)
{
// Dispose old labels
foreach(TextLabel l in labels.Values) l.Dispose();
// Don't show lables for selected-from-highlight item
if(selectionfromhighlight)
{
labels.Clear();
return;
}
}
// Make text labels for selected linedefs
ICollection<Thing> orderedselection = General.Map.Map.GetSelectedThings(true);

View file

@ -54,6 +54,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Interface
private bool editpressed;
private bool selectionfromhighlight; //mxd
#endregion
@ -284,12 +285,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
if(!highlighted.Selected && (BuilderPlug.Me.AutoClearSelection || (General.Map.Map.SelectedVerticessCount == 0)))
{
// Make this the only selection
selectionfromhighlight = true; //mxd
General.Map.Map.ClearSelectedVertices();
highlighted.Selected = true;
UpdateSelectionInfo(); //mxd
General.Interface.RedrawDisplay();
//mxd
General.Interface.DisplayStatus(StatusType.Selection, "1 vertex selected.");
}
// Update display
@ -398,7 +398,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
General.Interface.OnEditFormValuesChanged -= vertexEditForm_OnValuesChanged;
// When a single vertex was selected, deselect it now
if(selected.Count == 1)
if(selected.Count == 1 && selectionfromhighlight)
{
General.Map.Map.ClearSelectedVertices();
}
@ -406,14 +406,16 @@ namespace CodeImp.DoomBuilder.BuilderModes
{
foreach(Vertex v in selected) v.Selected = true;
}
// Update entire display
UpdateSelectionInfo(); //mxd
General.Interface.RedrawDisplay();
}
}
UpdateSelectionInfo(); //mxd
}
editpressed = false;
selectionfromhighlight = false; //mxd
base.OnEditEnd();
}