mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2024-11-26 22:01:45 +00:00
- fixed crash in Find & Replace Mode when opening the mode for the second time after opening a new map
- added buttons on the toolbar for Find & Replace Mode and Map Analysis Mode - now allowing direct switching from volatile mode to another volatile mode (old mode is cancelled)
This commit is contained in:
parent
5a94b9b4a3
commit
e706e18c3b
13 changed files with 75 additions and 37 deletions
BIN
Resources/Icons/Find.png
Normal file
BIN
Resources/Icons/Find.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 679 B |
BIN
Resources/Icons/MapAnalysisMode.png
Normal file
BIN
Resources/Icons/MapAnalysisMode.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 452 B |
|
@ -198,6 +198,12 @@
|
|||
<ItemGroup>
|
||||
<EmbeddedResource Include="Resources\TriangulatorMode.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Resources\FindMode.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Resources\MapAnalysisMode.png" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
|
|
|
@ -38,6 +38,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
{
|
||||
[EditMode(DisplayName = "Map Analysis Mode",
|
||||
SwitchAction = "errorcheckmode",
|
||||
ButtonImage = "MapAnalysisMode.png",
|
||||
ButtonOrder = 200,
|
||||
Volatile = true,
|
||||
UseByDefault = true)]
|
||||
|
||||
|
|
|
@ -38,6 +38,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
{
|
||||
[EditMode(DisplayName = "Find & Replace Mode",
|
||||
SwitchAction = "findmode",
|
||||
ButtonImage = "FindMode.png",
|
||||
ButtonOrder = 100,
|
||||
Volatile = true,
|
||||
UseByDefault = true)]
|
||||
|
||||
|
|
|
@ -91,6 +91,13 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
{
|
||||
// If it cannot be interpreted, set replacewith to null (not replacing at all)
|
||||
if(!int.TryParse(replacewith, out replaceaction)) replacewith = null;
|
||||
if(replaceaction < 0) replacewith = null;
|
||||
if(replaceaction > Int16.MaxValue) replacewith = null;
|
||||
if(replacewith == null)
|
||||
{
|
||||
MessageBox.Show("Invalid replace value for this search type!", "Find and Replace", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return objs.ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
// Interpret the number given
|
||||
|
|
|
@ -113,7 +113,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
public virtual void RenderOverlaySelection(IRenderer2D renderer, FindReplaceObject[] selection)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
@ -89,6 +89,13 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
{
|
||||
// If it cannot be interpreted, set replacewith to null (not replacing at all)
|
||||
if(!int.TryParse(replacewith, out replacetag)) replacewith = null;
|
||||
if(replacetag < 0) replacewith = null;
|
||||
if(replacetag > MapSet.HIGHEST_TAG) replacewith = null;
|
||||
if(replacewith == null)
|
||||
{
|
||||
MessageBox.Show("Invalid replace value for this search type!", "Find and Replace", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return objs.ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
// Interpret the number given
|
||||
|
|
|
@ -58,7 +58,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
|
||||
#endregion
|
||||
|
||||
#region ================== Constructor / Show
|
||||
#region ================== Constructor
|
||||
|
||||
// Constructor
|
||||
public FindReplaceForm()
|
||||
|
@ -102,24 +102,6 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
// Select first
|
||||
searchtypes.SelectedIndex = 0;
|
||||
}
|
||||
|
||||
// This shows the window
|
||||
public void Show(Form owner)
|
||||
{
|
||||
// First time showing?
|
||||
//if((this.Location.X == 0) && (this.Location.Y == 0))
|
||||
{
|
||||
// Position at left-top of owner
|
||||
this.Location = new Point(owner.Location.X + 20, owner.Location.Y + 90);
|
||||
}
|
||||
|
||||
// Close results part
|
||||
resultspanel.Visible = false;
|
||||
this.Size = new Size(this.Width, this.Height - this.ClientSize.Height + resultspanel.Top);
|
||||
|
||||
// Show window
|
||||
base.Show(owner);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -227,6 +209,33 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
|
||||
#region ================== Methods
|
||||
|
||||
// This shows the window
|
||||
public void Show(Form owner)
|
||||
{
|
||||
// First time showing?
|
||||
//if((this.Location.X == 0) && (this.Location.Y == 0))
|
||||
{
|
||||
// Position at left-top of owner
|
||||
this.Location = new Point(owner.Location.X + 20, owner.Location.Y + 90);
|
||||
}
|
||||
|
||||
// Close results part
|
||||
resultspanel.Visible = false;
|
||||
this.Size = new Size(this.Width, this.Height - this.ClientSize.Height + resultspanel.Top);
|
||||
|
||||
// Show window
|
||||
base.Show(owner);
|
||||
}
|
||||
|
||||
// This hides the window
|
||||
new public void Hide()
|
||||
{
|
||||
base.Hide();
|
||||
|
||||
// Clear search results
|
||||
resultslist.Items.Clear();
|
||||
}
|
||||
|
||||
// This returns the selected item(s)
|
||||
internal FindReplaceObject[] GetSelection()
|
||||
{
|
||||
|
|
BIN
Source/BuilderModes/Resources/FindMode.png
Normal file
BIN
Source/BuilderModes/Resources/FindMode.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 679 B |
BIN
Source/BuilderModes/Resources/MapAnalysisMode.png
Normal file
BIN
Source/BuilderModes/Resources/MapAnalysisMode.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 452 B |
|
@ -145,23 +145,26 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
// Only when a map is opened
|
||||
if(General.Map != null)
|
||||
{
|
||||
// Not switching from volatile mode to volatile mode?
|
||||
if((General.Editing.Mode == null) || !General.Editing.Mode.Attributes.Volatile || !this.attribs.Volatile)
|
||||
// Switching from volatile mode to volatile mode?
|
||||
if((General.Editing.Mode != null) && General.Editing.Mode.Attributes.Volatile && this.attribs.Volatile)
|
||||
{
|
||||
// When in VisualMode and switching to the same VisualMode, then we switch back to the previous classic mode
|
||||
if((General.Editing.Mode is VisualMode) && (type == General.Editing.Mode.GetType()))
|
||||
{
|
||||
// Switch back to last classic mode
|
||||
General.Editing.ChangeMode(General.Editing.PreviousClassicMode.Name);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Create instance
|
||||
newmode = plugin.CreateObject<EditMode>(type);
|
||||
|
||||
// Switch mode
|
||||
General.Editing.ChangeMode(newmode);
|
||||
}
|
||||
// First cancel previous volatile mode
|
||||
General.CancelVolatileMode();
|
||||
}
|
||||
|
||||
// When in VisualMode and switching to the same VisualMode, then we switch back to the previous classic mode
|
||||
if((General.Editing.Mode is VisualMode) && (type == General.Editing.Mode.GetType()))
|
||||
{
|
||||
// Switch back to last classic mode
|
||||
General.Editing.ChangeMode(General.Editing.PreviousClassicMode.Name);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Create instance
|
||||
newmode = plugin.CreateObject<EditMode>(type);
|
||||
|
||||
// Switch mode
|
||||
General.Editing.ChangeMode(newmode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1400,6 +1400,8 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
{
|
||||
ToolStripItem item;
|
||||
int index;
|
||||
|
||||
string controlname = modeinfo.ButtonDesc.Replace("&", "&&");
|
||||
|
||||
// Create a button
|
||||
index = toolbar.Items.IndexOf(buttoneditmodesseperator);
|
||||
|
@ -1413,7 +1415,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
|
||||
// Create menu item
|
||||
index = menumode.DropDownItems.Count;
|
||||
item = new ToolStripMenuItem(modeinfo.ButtonDesc, modeinfo.ButtonImage, new EventHandler(EditModeButtonHandler));
|
||||
item = new ToolStripMenuItem(controlname, modeinfo.ButtonImage, new EventHandler(EditModeButtonHandler));
|
||||
item.Tag = modeinfo;
|
||||
item.Enabled = (General.Map != null);
|
||||
menumode.DropDownItems.Insert(index, item);
|
||||
|
|
Loading…
Reference in a new issue