Changed mode buttons order in the toolbar.

Fixed a crash when enabling Nodes Viewer mode in an unsaved map.
This commit is contained in:
MaxED 2014-01-09 13:09:43 +00:00
parent 1adf313a91
commit 70102f1420
8 changed files with 20 additions and 20 deletions

View file

@ -1132,7 +1132,7 @@ namespace CodeImp.DoomBuilder
[BeginAction("openmapincurrentwad")]
internal static void OpenMapInCurrentWad() {
if (map == null || string.IsNullOrEmpty(map.FilePathName) || !File.Exists(map.FilePathName)){
Interface.DisplayStatus(StatusType.Warning, "Unable to open map form current WAD!");
Interface.DisplayStatus(StatusType.Warning, "Unable to open map from current WAD!");
return;
}

View file

@ -85,7 +85,7 @@ namespace CodeImp.DoomBuilder {
private List<string> scriptincludes;
// Disposing
private bool isdisposed = false;
private bool isdisposed;
#endregion
@ -532,9 +532,8 @@ namespace CodeImp.DoomBuilder {
StatusInfo oldstatus;
WAD targetwad;
int index;
bool includenodes = false;
bool includenodes;
string origmapname;
bool success = true;
General.WriteLogLine("Saving map to file: " + newfilepathname);
@ -768,7 +767,7 @@ namespace CodeImp.DoomBuilder {
// Success!
General.WriteLogLine("Map saving done");
return success;
return true;
}
#endregion

View file

@ -28,7 +28,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
[EditMode(DisplayName = "Ceiling Align Mode",
SwitchAction = "ceilingalignmode",
ButtonImage = "CeilingAlign.png",
ButtonOrder = int.MinValue + 211,
ButtonOrder = int.MinValue + 311,
ButtonGroup = "000_editing",
Volatile = true)]

View file

@ -28,7 +28,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
[EditMode(DisplayName = "Floor Align Mode",
SwitchAction = "flooralignmode",
ButtonImage = "FloorAlign.png",
ButtonOrder = int.MinValue + 210,
ButtonOrder = int.MinValue + 310,
ButtonGroup = "000_editing",
Volatile = true)]

View file

@ -31,7 +31,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
[EditMode(DisplayName = "Make Sectors Mode",
SwitchAction = "makesectormode",
ButtonImage = "NewSector2.png", // Image resource name for the button
ButtonOrder = int.MinValue + 202, // Position of the button (lower is more to the left)
ButtonOrder = int.MinValue + 302, // Position of the button (lower is more to the left)
ButtonGroup = "000_editing",
UseByDefault = true)]

View file

@ -34,7 +34,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
[EditMode(DisplayName = "Vertices Mode",
SwitchAction = "verticesmode", // Action name used to switch to this mode
ButtonImage = "VerticesMode.png", // Image resource name for the button
ButtonOrder = int.MinValue + 0, // Position of the button (lower is more to the left)
ButtonOrder = int.MinValue, // Position of the button (lower is more to the left)
ButtonGroup = "000_editing",
UseByDefault = true,
SafeStartMode = true)]

View file

@ -55,12 +55,6 @@ namespace CodeImp.DoomBuilder.Plugins.NodesViewer
me = this;
}
// Preferences changed
public override void OnClosePreferences(PreferencesController controller)
{
base.OnClosePreferences(controller);
}
// This is called when the plugin is terminated
public override void Dispose()
{

View file

@ -7,7 +7,6 @@ using System.IO;
using System.Windows.Forms;
using CodeImp.DoomBuilder.Editing;
using CodeImp.DoomBuilder.Geometry;
using CodeImp.DoomBuilder.Map;
using CodeImp.DoomBuilder.Rendering;
using CodeImp.DoomBuilder.Windows;
@ -252,10 +251,10 @@ namespace CodeImp.DoomBuilder.Plugins.NodesViewer
{
// Begin with a giant square polygon that covers the entire map
List<Vector2D> poly = new List<Vector2D>(16);
poly.Add(new Vector2D(-(float)General.Map.FormatInterface.MaxCoordinate, (float)General.Map.FormatInterface.MaxCoordinate));
poly.Add(new Vector2D((float)General.Map.FormatInterface.MaxCoordinate, (float)General.Map.FormatInterface.MaxCoordinate));
poly.Add(new Vector2D((float)General.Map.FormatInterface.MaxCoordinate, -(float)General.Map.FormatInterface.MaxCoordinate));
poly.Add(new Vector2D(-(float)General.Map.FormatInterface.MaxCoordinate, -(float)General.Map.FormatInterface.MaxCoordinate));
poly.Add(new Vector2D(-General.Map.FormatInterface.MaxCoordinate, General.Map.FormatInterface.MaxCoordinate));
poly.Add(new Vector2D(General.Map.FormatInterface.MaxCoordinate, General.Map.FormatInterface.MaxCoordinate));
poly.Add(new Vector2D(General.Map.FormatInterface.MaxCoordinate, -General.Map.FormatInterface.MaxCoordinate));
poly.Add(new Vector2D(-General.Map.FormatInterface.MaxCoordinate, -General.Map.FormatInterface.MaxCoordinate));
// Crop the polygon by the node tree splits
foreach(Split s in nodesplits) CropPolygon(poly, s);
@ -588,6 +587,14 @@ namespace CodeImp.DoomBuilder.Plugins.NodesViewer
Cursor.Current = Cursors.WaitCursor;
base.OnEngage();
//mxd. General.Map.ExportToFile in BuildNodes() won't do the trick if the map was never saved
if (string.IsNullOrEmpty(General.Map.FilePathName))
{
MessageBox.Show("Please save the map before running Nodes Viewer mode.", "Nodes Viewer mode", MessageBoxButtons.OK, MessageBoxIcon.Error);
General.Editing.CancelMode();
return;
}
if(!General.Map.LumpExists("NODES") || !General.Map.LumpExists("SSECTORS") || !General.Map.LumpExists("SEGS") || !General.Map.LumpExists("VERTEXES"))
{
// We need to build the nodes!