- clearing selection now editing mode's responsibility (because it is not wanted in all modes)

- fixes flashing of editing mode name and button when editing mode refuses to engage
- a highlight also works now for classic modes to go to EditSelectionMode
This commit is contained in:
codeimp 2008-09-12 05:50:19 +00:00
parent 6b1bc51dda
commit 0c77136c30
7 changed files with 124 additions and 19 deletions

View file

@ -125,6 +125,7 @@
<Compile Include="Data\DataLocationList.cs" />
<Compile Include="Data\DataManager.cs" />
<Compile Include="Data\WADReader.cs" />
<Compile Include="IO\PrefabMapSetIO.cs" />
<Compile Include="IO\UniversalCollection.cs" />
<Compile Include="IO\UniversalEntry.cs" />
<Compile Include="IO\UniversalParser.cs" />

View file

@ -520,10 +520,21 @@ namespace CodeImp.DoomBuilder.BuilderModes
if((snaptogrid != (General.Interface.ShiftState ^ General.Interface.SnapToGrid)) ||
(snaptonearest != (General.Interface.CtrlState ^ General.Interface.AutoMerge))) Update();
}
#endregion
#region ================== Methods
// This clears the selection
[BeginAction("clearselection", BaseAction = true)]
public void ClearSelection()
{
// Accept changes
General.Map.Map.ClearAllSelected();
General.Map.AcceptMode();
}
// This updates the selection
private void Update()

View file

@ -120,7 +120,18 @@ namespace CodeImp.DoomBuilder.BuilderModes
public override void OnDisengage()
{
base.OnDisengage();
// Going to EditSelectionMode?
if(General.Map.NewMode is EditSelectionMode)
{
// No selection made? But we have a highlight!
if((General.Map.Map.GetSelectedLinedefs(true).Count == 0) && (highlighted != null))
{
// Make the highlight the selection
highlighted.Selected = true;
}
}
// Hide highlight info
General.Interface.HideInfo();
}
@ -468,6 +479,17 @@ namespace CodeImp.DoomBuilder.BuilderModes
#region ================== Actions
// This clears the selection
[BeginAction("clearselection", BaseAction = true)]
public void ClearSelection()
{
// Clear selection
General.Map.Map.ClearAllSelected();
// Redraw
General.Interface.RedrawDisplay();
}
// This creates a new vertex at the mouse position
[BeginAction("insertitem", BaseAction = true)]
public virtual void InsertVertex()

View file

@ -101,6 +101,17 @@ namespace CodeImp.DoomBuilder.BuilderModes
#region ================== Methods
// This clears the selection
[BeginAction("clearselection", BaseAction = true)]
public void ClearSelection()
{
// Clear selection
General.Map.Map.ClearAllSelected();
// Redraw
General.Interface.RedrawDisplay();
}
// When undo is used
[EndAction("undo", BaseAction = true)]
public void Undo()
@ -196,6 +207,17 @@ namespace CodeImp.DoomBuilder.BuilderModes
{
base.OnDisengage();
// Going to EditSelectionMode?
if(General.Map.NewMode is EditSelectionMode)
{
// No selection made? But we have a highlight!
if((General.Map.Map.GetSelectedSectors(true).Count == 0) && (highlighted != null))
{
// Make the highlight the selection
SelectSector(highlighted, true);
}
}
// Hide highlight info
General.Interface.HideInfo();
}

View file

@ -121,6 +121,17 @@ namespace CodeImp.DoomBuilder.BuilderModes
{
base.OnDisengage();
// Going to EditSelectionMode?
if(General.Map.NewMode is EditSelectionMode)
{
// No selection made? But we have a highlight!
if((General.Map.Map.GetSelectedThings(true).Count == 0) && (highlighted != null))
{
// Make the highlight the selection
highlighted.Selected = true;
}
}
// Hide highlight info
General.Interface.HideInfo();
}
@ -450,6 +461,17 @@ namespace CodeImp.DoomBuilder.BuilderModes
#region ================== Actions
// This clears the selection
[BeginAction("clearselection", BaseAction = true)]
public void ClearSelection()
{
// Clear selection
General.Map.Map.ClearAllSelected();
// Redraw
General.Interface.RedrawDisplay();
}
// This creates a new thing at the mouse position
[BeginAction("insertitem", BaseAction = true)]
public virtual void InsertThing()

View file

@ -122,7 +122,18 @@ namespace CodeImp.DoomBuilder.BuilderModes
public override void OnDisengage()
{
base.OnDisengage();
// Going to EditSelectionMode?
if(General.Map.NewMode is EditSelectionMode)
{
// No selection made? But we have a highlight!
if((General.Map.Map.GetSelectedVertices(true).Count == 0) && (highlighted != null))
{
// Make the highlight the selection
highlighted.Selected = true;
}
}
// Hide highlight info
General.Interface.HideInfo();
}
@ -383,6 +394,17 @@ namespace CodeImp.DoomBuilder.BuilderModes
#region ================== Actions
// This clears the selection
[BeginAction("clearselection", BaseAction = true)]
public void ClearSelection()
{
// Clear selection
General.Map.Map.ClearAllSelected();
// Redraw
General.Interface.RedrawDisplay();
}
// This creates a new vertex at the mouse position
[BeginAction("insertitem", BaseAction = true)]
public virtual void InsertVertex()

View file

@ -893,22 +893,22 @@ namespace CodeImp.DoomBuilder
// Apply new mode
mode = newmode;
// Engage new mode
if(newmode != null) newmode.OnEngage();
// Check appropriate button on interface
// And show the mode name
if(newmode != null)
if(mode != null)
{
General.MainWindow.CheckEditModeButton(newmode.EditModeButtonName);
General.MainWindow.DisplayModeName(newmode.Attributes.DisplayName);
General.MainWindow.CheckEditModeButton(mode.EditModeButtonName);
General.MainWindow.DisplayModeName(mode.Attributes.DisplayName);
}
else
{
General.MainWindow.CheckEditModeButton("");
General.MainWindow.DisplayModeName("");
}
// Engage new mode
if(newmode != null) newmode.OnEngage();
// Dispose old mode
if(oldmode != null) oldmode.Dispose();
@ -928,7 +928,23 @@ namespace CodeImp.DoomBuilder
}
#endregion
#region ================== Copy / Paste
// This copies the current selection
public void CopySelection()
{
}
// This pastes what is on the clipboard and makes it the current selection
public bool PasteSelection()
{
return false;
}
#endregion
#region ================== Methods
// This changes thing filter
@ -950,17 +966,6 @@ namespace CodeImp.DoomBuilder
General.MainWindow.RedrawDisplay();
}
// This clears the selection
[BeginAction("clearselection")]
public void ClearSelection()
{
// Clear selection
map.ClearAllSelected();
// Redraw
General.MainWindow.RedrawDisplay();
}
// This sets a new mapset for editing
internal void ChangeMapSet(MapSet newmap)
{