Added, Errors and Warnings window: most of warnings/errors related to (G)ZDoom text lump parsing can now be double-clicked to show warning/error source in the Script Editor.

Fixed: some map format conversion errors were never displayed, because errors list was cleared after performing map conversion.
Fixed: 3d floor indicators in 2D modes were not updated after leaving Visual mode.
Fixed: some UDMF-only interface buttons were never removed after converting map format from UDMF.
This commit is contained in:
MaxED 2016-11-26 00:02:56 +00:00
parent 9553042c84
commit aecd017b19
37 changed files with 601 additions and 116 deletions

View file

@ -1191,6 +1191,8 @@
<None Include="Resources\GridDecrease.png" />
<None Include="Resources\GridIncrease.png" />
<None Include="Resources\FixedThingsScale.png" />
<None Include="Resources\ErrorLargeMapObject.png" />
<None Include="Resources\ErrorLargeText.png" />
<Content Include="Resources\Light.png" />
<None Include="Resources\Lightbulb.png" />
<None Include="Resources\LightDisabled.png" />
@ -1210,6 +1212,8 @@
<None Include="Resources\ModelDisabled.png" />
<None Include="Resources\ModelFiltered.png" />
<Content Include="Resources\Model_selected.png" />
<None Include="Resources\WarningLargeText.png" />
<None Include="Resources\WarningLargeMapObject.png" />
<None Include="Resources\Script.png" />
<None Include="Resources\SplitSectors.png" />
<None Include="Resources\ScriptProperty.png" />

View file

@ -24,6 +24,7 @@ using System.Windows.Forms;
using CodeImp.DoomBuilder.Compilers;
using CodeImp.DoomBuilder.Config;
using CodeImp.DoomBuilder.Controls.Scripting;
using CodeImp.DoomBuilder.Data;
using CodeImp.DoomBuilder.Data.Scripting;
using CodeImp.DoomBuilder.Windows;
using ScintillaNET;
@ -213,7 +214,7 @@ namespace CodeImp.DoomBuilder.Controls
if(File.Exists(settings.Filename))
{
// Load this!
ScriptFileDocumentTab t = OpenFile(settings.Filename);
ScriptFileDocumentTab t = OpenFile(settings.Filename, settings.ScriptType);
t.SetViewSettings(settings); //mxd
if(settings.IsActiveTab) activetab = t;
}
@ -622,6 +623,42 @@ namespace CodeImp.DoomBuilder.Controls
splitter.Panel2Collapsed = (errorlist.Items.Count == 0);
}
//mxd
internal void ShowError(TextResourceErrorItem item)
{
// Resource exists?
DataReader dr = null;
foreach(DataReader reader in General.Map.Data.Containers)
{
if(reader.Location.location == item.ResourceLocation)
{
dr = reader;
break;
}
}
// Target lump exists?
if(dr == null || !dr.FileExists(item.LumpName, item.LumpIndex)) return;
TextResourceData trd = new TextResourceData(dr, dr.LoadFile(item.LumpName, item.LumpIndex), item.LumpName, item.LumpIndex, false);
var targettab = OpenResource(new ScriptResource(trd, item.ScriptType));
// Go to error line
if(targettab != null && item.LineNumber != CompilerError.NO_LINE_NUMBER)
targettab.MoveToLine(item.LineNumber);
}
//mxd
/*internal void ShowError(TextFileErrorItem item)
{
// File exists?
ScriptDocumentTab targettab = OpenFile(item.Filename, item.ScriptType);
// Go to error line
if(targettab != null && item.LineNumber != CompilerError.NO_LINE_NUMBER)
targettab.MoveToLine(item.LineNumber);
}*/
// This writes all explicitly opened files to the configuration
public void WriteOpenFilesToConfiguration()
{
@ -843,7 +880,7 @@ namespace CodeImp.DoomBuilder.Controls
}
// This opens the given file, returns null when failed
public ScriptFileDocumentTab OpenFile(string filename)
public ScriptFileDocumentTab OpenFile(string filename, ScriptType scripttype)
{
//mxd. Check if we already have this file opened
foreach(var tab in tabs.TabPages)
@ -861,33 +898,43 @@ namespace CodeImp.DoomBuilder.Controls
ScriptConfiguration foundconfig = new ScriptConfiguration();
// Find the most suitable script configuration to use
foreach(ScriptConfiguration cfg in scriptconfigs)
if(scripttype == ScriptType.UNKNOWN)
{
foreach(string ext in cfg.Extensions)
foreach(ScriptConfiguration cfg in scriptconfigs)
{
// Use this configuration if the extension matches
if(filename.EndsWith("." + ext, StringComparison.OrdinalIgnoreCase))
foreach(string ext in cfg.Extensions)
{
foundconfig = cfg;
break;
// Use this configuration if the extension matches
if(filename.EndsWith("." + ext, StringComparison.OrdinalIgnoreCase))
{
foundconfig = cfg;
break;
}
}
}
}
else
{
foundconfig = General.GetScriptConfiguration(scripttype);
}
// Create new document
ScriptFileDocumentTab t = new ScriptFileDocumentTab(this, foundconfig);
if(t.Open(filename))
{
//mxd
ScriptType st = t.VerifyScriptType();
if(st != ScriptType.UNKNOWN)
//mxd. Try to determine script type from file contents...
if(scripttype == ScriptType.UNKNOWN)
{
foreach(ScriptConfiguration cfg in scriptconfigs)
ScriptType st = t.VerifyScriptType();
if(st != ScriptType.UNKNOWN)
{
if(cfg.ScriptType == st)
foreach(ScriptConfiguration cfg in scriptconfigs)
{
t.ChangeScriptConfig(cfg);
break;
if(cfg.ScriptType == st)
{
t.ChangeScriptConfig(cfg);
break;
}
}
}
}
@ -1137,7 +1184,7 @@ namespace CodeImp.DoomBuilder.Controls
{
if(!openedfiles.Contains(name))
{
ScriptFileDocumentTab t = OpenFile(name);
ScriptFileDocumentTab t = OpenFile(name, ScriptType.UNKNOWN);
// Apply document settings
if(General.Map.Options.ScriptDocumentSettings.ContainsKey(t.Filename))
@ -1484,7 +1531,7 @@ namespace CodeImp.DoomBuilder.Controls
// If we don't have the script opened, see if we can find the file and open the script
if(!foundscript && File.Exists(err.filename))
{
ScriptDocumentTab t = OpenFile(err.filename);
ScriptDocumentTab t = OpenFile(err.filename, ScriptType.UNKNOWN);
if(t != null) t.MoveToLine(err.linenumber);
}

View file

@ -1255,7 +1255,7 @@ namespace CodeImp.DoomBuilder.Data
int index = file.FindLumpIndex(lumpname);
if(index == -1)
{
errors.Add(new CompilerError { description = "Lump \"" + lumpname + "\" does not exist", filename = this.location.GetDisplayName() });
errors.Add(new CompilerError("Lump \"" + lumpname + "\" does not exist", location.GetDisplayName()));
return false;
}

View file

@ -16,22 +16,285 @@
#region ================== Namespaces
using System;
using System.Collections.Generic;
using System.Drawing;
using CodeImp.DoomBuilder.Config;
using CodeImp.DoomBuilder.Data;
using CodeImp.DoomBuilder.Editing;
using CodeImp.DoomBuilder.Geometry;
using CodeImp.DoomBuilder.Map;
#endregion
namespace CodeImp.DoomBuilder
{
internal struct ErrorItem
{
public ErrorType type;
public string message;
#region ================== ErrorItem (mxd)
internal ErrorItem(ErrorType type, string message)
public class ErrorItem
{
protected ErrorType type;
protected string description;
protected Image icon;
public ErrorType Type { get { return type; } }
public string Description { get { return description; } }
public Image Icon { get { return icon; } }
internal virtual bool IsShowable { get { return false; } }
public ErrorItem(ErrorType type, string description)
{
this.type = type;
this.message = message;
this.description = description;
this.icon = GetIcon();
}
protected virtual Image GetIcon()
{
return (type == ErrorType.Error ? Properties.Resources.ErrorLarge : Properties.Resources.WarningLarge);
}
internal virtual void ShowSource() { }
}
#endregion
#region ================== MapElementErrorItem (mxd)
public class MapElementErrorItem : ErrorItem
{
private MapElement target;
private RectangleF zoomarea;
private string targetmodename;
internal override bool IsShowable { get { return true; } }
public MapElementErrorItem(ErrorType type, MapElement target, string description) : base(type, description)
{
this.target = target;
// Calculate zoom area
List<Vector2D> points = new List<Vector2D>();
RectangleF area = MapSet.CreateEmptyArea();
// Add all points to a list
if(target is Vertex)
{
points.Add((target as Vertex).Position);
targetmodename = "VerticesMode";
}
else if(target is Linedef)
{
points.Add((target as Linedef).Start.Position);
points.Add((target as Linedef).End.Position);
targetmodename = "LinedefsMode";
}
else if(target is Sidedef)
{
points.Add((target as Sidedef).Line.Start.Position);
points.Add((target as Sidedef).Line.End.Position);
targetmodename = "LinedefsMode";
}
else if(target is Sector)
{
Sector s = (target as Sector);
foreach(Sidedef sd in s.Sidedefs)
{
points.Add(sd.Line.Start.Position);
points.Add(sd.Line.End.Position);
}
targetmodename = "SectorsMode";
}
else if(target is Thing)
{
Thing t = (target as Thing);
Vector2D p = t.Position;
points.Add(p);
points.Add(p + new Vector2D(t.Size * 2.0f, t.Size * 2.0f));
points.Add(p + new Vector2D(t.Size * 2.0f, -t.Size * 2.0f));
points.Add(p + new Vector2D(-t.Size * 2.0f, t.Size * 2.0f));
points.Add(p + new Vector2D(-t.Size * 2.0f, -t.Size * 2.0f));
targetmodename = "ThingsMode";
}
else
{
General.Fail("Unknown object given to zoom in on.");
}
// Make a view area from the points
foreach(Vector2D p in points)
area = MapSet.IncreaseArea(area, p);
// Make the area square, using the largest side
if(area.Width > area.Height)
{
float delta = area.Width - area.Height;
area.Y -= delta * 0.5f;
area.Height += delta;
}
else
{
float delta = area.Height - area.Width;
area.X -= delta * 0.5f;
area.Width += delta;
}
// Add padding
area.Inflate(100f, 100f);
// Store
this.zoomarea = area;
}
internal override void ShowSource()
{
// Switch to appropriate mode...
if(General.Editing.Mode.GetType().Name != targetmodename)
{
// Leave any volatile mode
General.Editing.CancelVolatileMode();
General.Editing.ChangeMode(targetmodename);
}
// Select map element if it still exists
if(target != null && !target.IsDisposed)
{
General.Map.Map.ClearAllSelected();
if(target is Vertex)
{
((Vertex)target).Selected = true;
}
else if(target is Sidedef)
{
((Sidedef)target).Line.Selected = true;
}
else if(target is Linedef)
{
((Linedef)target).Selected = true;
}
else if(target is Sector)
{
Sector s = (Sector)target;
((ClassicMode)General.Editing.Mode).SelectMapElement(s);
foreach(Sidedef sd in s.Sidedefs) sd.Line.Selected = true;
}
else if(target is Thing)
{
((Thing)target).Selected = true;
}
else
{
throw new NotImplementedException("Unknown MapElement type!");
}
}
// Show area
ClassicMode editmode = (General.Editing.Mode as ClassicMode);
editmode.CenterOnArea(zoomarea, 0.6f);
}
protected override Image GetIcon()
{
return (type == ErrorType.Error ? Properties.Resources.ErrorLargeMapObject : Properties.Resources.WarningLargeMapObject);
}
}
#endregion
#region ================== TextResourceErrorItem (mxd)
public class TextResourceErrorItem : ErrorItem
{
private string resourcelocation;
private ScriptType scripttype;
private string lumpname;
private int lumpindex;
private int linenumber;
public string ResourceLocation { get { return resourcelocation; } }
public ScriptType ScriptType { get { return scripttype; } }
public string LumpName { get { return lumpname; } }
public int LumpIndex { get { return lumpindex; } }
public int LineNumber { get { return linenumber; } }
internal override bool IsShowable { get { return true; } }
internal TextResourceErrorItem(ErrorType type, ScriptType scripttype, DataLocation resourcelocation, string lumpname, int lumpindex, int linenumber, string description)
: base(type, description)
{
this.resourcelocation = resourcelocation.location;
this.scripttype = scripttype;
this.lumpname = lumpname;
this.lumpindex = lumpindex;
this.linenumber = linenumber;
}
internal override void ShowSource()
{
// Only when a map is loaded
if(General.Map == null || General.Map.Data == null) return;
// Show Script Editor
General.Map.ShowScriptEditor();
// Show in ScriptEditor
General.Map.ScriptEditor.DisplayError(this);
}
protected override Image GetIcon()
{
return (type == ErrorType.Error ? Properties.Resources.ErrorLargeText : Properties.Resources.WarningLargeText);
}
}
#endregion
#region ================== TextFileErrorItem (mxd)
/*public class TextFileErrorItem : ErrorItem
{
private string filepathname;
private ScriptType scripttype;
private int linenumber;
public string Filename { get { return filepathname; } }
public ScriptType ScriptType { get { return scripttype; } }
public int LineNumber { get { return linenumber; } }
internal override bool IsShowable { get { return true; } }
public TextFileErrorItem(ErrorType type, ScriptType scripttype, string filepathname, int linenumber, string description)
: base(type, description)
{
this.filepathname = filepathname;
this.scripttype = scripttype;
this.linenumber = linenumber;
}
internal override void ShowSource()
{
// Only when a map is loaded
if(General.Map == null || General.Map.Data == null) return;
// Show Script Editor
General.Map.ShowScriptEditor();
// Show in ScriptEditor
General.Map.ScriptEditor.DisplayError(this);
}
protected override Image GetIcon()
{
return (type == ErrorType.Error ? Properties.Resources.ErrorLargeText : Properties.Resources.WarningLargeText);
}
}*/
#endregion
#region ================== ErrorType
public enum ErrorType
{
/// <summary>
@ -44,4 +307,6 @@ namespace CodeImp.DoomBuilder
/// </summary>
Warning
}
#endregion
}

View file

@ -76,23 +76,23 @@ namespace CodeImp.DoomBuilder
}
// This adds a new error
public void Add(ErrorType type, string message)
public void Add(ErrorType type, string message) { Add(new ErrorItem(type, message)); }
public void Add(ErrorItem error) //mxd
{
string prefix = "";
lock(threadlock)
{
//mxd. Don't add duplicate messages
if(errors.Count == 0 || message != errors[errors.Count - 1].message || type != errors[errors.Count - 1].type)
if(errors.Count == 0 || error.Description != errors[errors.Count - 1].Description || error.Type != errors[errors.Count - 1].Type)
{
errors.Add(new ErrorItem(type, message));
switch(type)
errors.Add(error);
string prefix = "";
switch(error.Type)
{
case ErrorType.Error:
erroradded = true;
prefix = "ERROR: ";
#if DEBUG
DebugConsole.WriteLine(DebugMessageType.ERROR, message);
DebugConsole.WriteLine(DebugMessageType.ERROR, error.Description);
#endif
break;
@ -100,17 +100,17 @@ namespace CodeImp.DoomBuilder
warningadded = true;
prefix = "WARNING: ";
#if DEBUG
DebugConsole.WriteLine(DebugMessageType.WARNING, message);
DebugConsole.WriteLine(DebugMessageType.WARNING, error.Description);
#endif
break;
}
changed = true;
General.WriteLogLine(prefix + message);
General.WriteLogLine(prefix + error.Description);
General.MainWindow.SetWarningsCount(errors.Count, erroradded); //mxd
}
//mxd. But still blink the indicator on errors
else if(type == ErrorType.Error)
// But still blink the indicator on errors
else if(error.Type == ErrorType.Error)
{
General.MainWindow.SetWarningsCount(errors.Count, true);
}

View file

@ -1053,7 +1053,7 @@ namespace CodeImp.DoomBuilder
filetitle = Path.GetFileName(filepathname);
// Reload resources
ReloadResources();
ReloadResources(true);
}
try
@ -2208,7 +2208,7 @@ namespace CodeImp.DoomBuilder
DebugConsole.Clear();
#endif
ReloadResources();
ReloadResources(true);
if(General.ErrorLogger.IsErrorAdded)
{
@ -2223,7 +2223,7 @@ namespace CodeImp.DoomBuilder
}
internal void ReloadResources()
internal void ReloadResources(bool clearerrors) //mxd. clearerrors flag
{
// Keep old display info
StatusInfo oldstatus = General.MainWindow.Status;
@ -2242,8 +2242,8 @@ namespace CodeImp.DoomBuilder
GC.WaitForPendingFinalizers();
GC.Collect(); //mxd
// Clear errors
General.ErrorLogger.Clear();
// Clear errors?
if(clearerrors) General.ErrorLogger.Clear();
// Reload game configuration
General.WriteLogLine("Reloading game configuration...");
@ -2310,6 +2310,9 @@ namespace CodeImp.DoomBuilder
// Stop data manager
data.Dispose();
//mxd. Clear errors
General.ErrorLogger.Clear();
// Apply new options
this.options = optionsform.Options;
@ -2383,7 +2386,7 @@ namespace CodeImp.DoomBuilder
map.UpdateCustomLinedefColors();
// Reload resources
ReloadResources();
ReloadResources(false);
// Update interface
General.MainWindow.SetupInterface();

View file

@ -593,7 +593,8 @@ namespace CodeImp.DoomBuilder.Map
//Convert tag to arg0
if(tags[0] < General.Map.FormatInterface.MinArgument || tags[0] > General.Map.FormatInterface.MaxArgument)
{
General.ErrorLogger.Add(ErrorType.Warning, "Linedef " + Index + ": unable to convert Tag (" + tags[0] + ") to LineID because it's outside of supported argument range [" + General.Map.FormatInterface.MinArgument + ".." + General.Map.FormatInterface.MaxArgument + "].");
string message = "Linedef " + Index + ": unable to convert Tag (" + tags[0] + ") to LineID because it's outside of supported argument range [" + General.Map.FormatInterface.MinArgument + ".." + General.Map.FormatInterface.MaxArgument + "].";
General.ErrorLogger.Add(new MapElementErrorItem(ErrorType.Warning, this, message));
}
else
{
@ -621,18 +622,21 @@ namespace CodeImp.DoomBuilder.Map
if(tags[0] != 0)
{
General.ErrorLogger.Add(ErrorType.Warning, "Linedef " + Index + ": unable to convert Tag (" + tags[0] + ") to LineID, because target sector tag (arg0) is greater than " + General.Map.FormatInterface.MaxArgument + ".");
string message = "Linedef " + Index + ": unable to convert Tag (" + tags[0] + ") to LineID, because target sector tag (arg0) is greater than " + General.Map.FormatInterface.MaxArgument + ".";
General.ErrorLogger.Add(new MapElementErrorItem(ErrorType.Warning, this, message));
}
}
else if(args[0] < General.Map.FormatInterface.MinArgument)
{
General.ErrorLogger.Add(ErrorType.Warning, "Linedef " + Index + ": unable to convert arg0 (" + args[0] + "), because it's outside of supported argument range [" + General.Map.FormatInterface.MinArgument + ".." + General.Map.FormatInterface.MaxArgument + "].");
string message = "Linedef " + Index + ": unable to convert arg0 (" + args[0] + "), because it's outside of supported argument range [" + General.Map.FormatInterface.MinArgument + ".." + General.Map.FormatInterface.MaxArgument + "].";
General.ErrorLogger.Add(new MapElementErrorItem(ErrorType.Warning, this, message));
}
else if(tags[0] > General.Map.FormatInterface.MinArgument) // Convert to LineID?
{
if(tags[0] > General.Map.FormatInterface.MaxArgument)
{
General.ErrorLogger.Add(ErrorType.Warning, "Linedef " + Index + ": unable to convert Tag (" + tags[0] + ") to LineID, because linedef tag is greater than " + General.Map.FormatInterface.MaxArgument + ".");
string message = "Linedef " + Index + ": unable to convert Tag (" + tags[0] + ") to LineID, because linedef tag is greater than " + General.Map.FormatInterface.MaxArgument + ".";
General.ErrorLogger.Add(new MapElementErrorItem(ErrorType.Warning, this, message));
}
else
{
@ -647,7 +651,8 @@ namespace CodeImp.DoomBuilder.Map
{
if(action != 0)
{
General.ErrorLogger.Add(ErrorType.Warning, "Linedef " + Index + ": unable to convert Tag (" + tags[0] + ") to LineID, because linedef already has an action.");
string message = "Linedef " + Index + ": unable to convert Tag (" + tags[0] + ") to LineID, because linedef already has an action.";
General.ErrorLogger.Add(new MapElementErrorItem(ErrorType.Warning, this, message));
}
else // Convert to Line_SetIdentification
{
@ -662,7 +667,8 @@ namespace CodeImp.DoomBuilder.Map
}
else if(tags[0] < General.Map.FormatInterface.MinArgument)
{
General.ErrorLogger.Add(ErrorType.Warning, "Linedef " + Index + ": unable to convert Tag (" + tags[0] + ") to LineID, because it's outside of supported argument range [" + General.Map.FormatInterface.MinArgument + ".." + General.Map.FormatInterface.MaxArgument + "].");
string message = "Linedef " + Index + ": unable to convert Tag (" + tags[0] + ") to LineID, because it's outside of supported argument range [" + General.Map.FormatInterface.MinArgument + ".." + General.Map.FormatInterface.MaxArgument + "].";
General.ErrorLogger.Add(new MapElementErrorItem(ErrorType.Warning, this, message));
}
break;
}

View file

@ -291,6 +291,20 @@ namespace CodeImp.DoomBuilder.Properties {
}
}
internal static System.Drawing.Bitmap ErrorLargeMapObject {
get {
object obj = ResourceManager.GetObject("ErrorLargeMapObject", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
internal static System.Drawing.Bitmap ErrorLargeText {
get {
object obj = ResourceManager.GetObject("ErrorLargeText", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
internal static System.Drawing.Bitmap Expand {
get {
object obj = ResourceManager.GetObject("Expand", resourceCulture);
@ -1145,6 +1159,20 @@ namespace CodeImp.DoomBuilder.Properties {
}
}
internal static System.Drawing.Bitmap WarningLargeMapObject {
get {
object obj = ResourceManager.GetObject("WarningLargeMapObject", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
internal static System.Drawing.Bitmap WarningLargeText {
get {
object obj = ResourceManager.GetObject("WarningLargeText", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
internal static System.Drawing.Bitmap WarningOff {
get {
object obj = ResourceManager.GetObject("WarningOff", resourceCulture);

View file

@ -595,4 +595,16 @@
<data name="Check" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Check.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="ErrorLargeMapObject" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\ErrorLargeMapObject.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="ErrorLargeText" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\ErrorLargeText.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="WarningLargeMapObject" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\WarningLargeMapObject.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="WarningLargeText" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\WarningLargeText.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1,016 B

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 749 B

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View file

@ -235,6 +235,9 @@ namespace CodeImp.DoomBuilder.VisualModes
selectedVisualSectors = null;
selectedVisualThings = null;
//mxd. Extra floors may've been edited
General.Map.Renderer2D.UpdateExtraFloorFlag();
// Stop special input mode
General.Interface.DisableProcessing();
General.Interface.StopExclusiveMouseInput();

View file

@ -757,11 +757,7 @@ namespace CodeImp.DoomBuilder.VisualModes
//mxd
private void UpdateLightRadius(int interval)
{
if(lightType == DynamicLightType.NONE)
{
General.ErrorLogger.Add(ErrorType.Error, "Please check that thing is light before accessing it's PositionAndRadius! You can use lightType, which is -1 if thing isn't light");
return;
}
if(lightType == DynamicLightType.NONE) return;
if(General.Settings.GZDrawLightsMode == LightRenderMode.ALL || Array.IndexOf(GZBuilder.GZGeneral.GZ_ANIMATED_LIGHT_TYPES, lightType) == -1)
{

View file

@ -38,6 +38,7 @@ namespace CodeImp.DoomBuilder.Windows
this.grid = new System.Windows.Forms.DataGridView();
this.iconcolumn = new System.Windows.Forms.DataGridViewImageColumn();
this.textcolumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.showsource = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.grid)).BeginInit();
this.SuspendLayout();
//
@ -47,8 +48,8 @@ namespace CodeImp.DoomBuilder.Windows
this.copyselected.Enabled = false;
this.copyselected.Location = new System.Drawing.Point(12, 416);
this.copyselected.Name = "copyselected";
this.copyselected.Size = new System.Drawing.Size(122, 25);
this.copyselected.TabIndex = 1;
this.copyselected.Size = new System.Drawing.Size(110, 25);
this.copyselected.TabIndex = 0;
this.copyselected.Text = "Copy Selection";
this.copyselected.UseVisualStyleBackColor = true;
this.copyselected.Click += new System.EventHandler(this.copyselected_Click);
@ -56,10 +57,10 @@ namespace CodeImp.DoomBuilder.Windows
// clearlist
//
this.clearlist.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.clearlist.Location = new System.Drawing.Point(150, 416);
this.clearlist.Location = new System.Drawing.Point(128, 416);
this.clearlist.Name = "clearlist";
this.clearlist.Size = new System.Drawing.Size(122, 25);
this.clearlist.TabIndex = 2;
this.clearlist.Size = new System.Drawing.Size(110, 25);
this.clearlist.TabIndex = 1;
this.clearlist.Text = "Clear";
this.clearlist.UseVisualStyleBackColor = true;
this.clearlist.Click += new System.EventHandler(this.clearlist_Click);
@ -85,7 +86,7 @@ namespace CodeImp.DoomBuilder.Windows
//
this.checkshow.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.checkshow.AutoSize = true;
this.checkshow.Location = new System.Drawing.Point(301, 421);
this.checkshow.Location = new System.Drawing.Point(363, 421);
this.checkshow.Name = "checkshow";
this.checkshow.Size = new System.Drawing.Size(199, 17);
this.checkshow.TabIndex = 3;
@ -129,17 +130,18 @@ namespace CodeImp.DoomBuilder.Windows
this.grid.Size = new System.Drawing.Size(732, 395);
this.grid.StandardTab = true;
this.grid.TabIndex = 5;
this.grid.CellContentDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.grid_CellContentDoubleClick);
this.grid.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.grid_CellContentClick);
//
// iconcolumn
//
this.iconcolumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
this.iconcolumn.HeaderText = "Icon";
this.iconcolumn.MinimumWidth = 20;
this.iconcolumn.MinimumWidth = 30;
this.iconcolumn.Name = "iconcolumn";
this.iconcolumn.ReadOnly = true;
this.iconcolumn.Resizable = System.Windows.Forms.DataGridViewTriState.False;
this.iconcolumn.Width = 24;
this.iconcolumn.Width = 32;
//
// textcolumn
//
@ -147,12 +149,25 @@ namespace CodeImp.DoomBuilder.Windows
this.textcolumn.Name = "textcolumn";
this.textcolumn.ReadOnly = true;
//
// showsource
//
this.showsource.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.showsource.Enabled = false;
this.showsource.Location = new System.Drawing.Point(244, 416);
this.showsource.Name = "showsource";
this.showsource.Size = new System.Drawing.Size(110, 25);
this.showsource.TabIndex = 2;
this.showsource.Text = "Show source";
this.showsource.UseVisualStyleBackColor = true;
this.showsource.Click += new System.EventHandler(this.showsource_Click);
//
// ErrorsForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.CancelButton = this.close;
this.ClientSize = new System.Drawing.Size(756, 453);
this.Controls.Add(this.showsource);
this.Controls.Add(this.checkshow);
this.Controls.Add(this.close);
this.Controls.Add(this.clearlist);
@ -184,6 +199,7 @@ namespace CodeImp.DoomBuilder.Windows
private System.Windows.Forms.Timer checkerrors;
private System.Windows.Forms.CheckBox checkshow;
private System.Windows.Forms.DataGridView grid;
private System.Windows.Forms.Button showsource;
private System.Windows.Forms.DataGridViewImageColumn iconcolumn;
private System.Windows.Forms.DataGridViewTextBoxColumn textcolumn;
}

View file

@ -61,15 +61,34 @@ namespace CodeImp.DoomBuilder.Windows
IEnumerable<ErrorItem> errors = General.ErrorLogger.GetErrors(startindex);
foreach(ErrorItem e in errors)
{
Image icon = (e.type == ErrorType.Error) ? Properties.Resources.ErrorLarge : Properties.Resources.WarningLarge;
int index = grid.Rows.Add();
DataGridViewRow row = grid.Rows[index];
row.Cells[0].Value = icon;
row.Cells[0].Value = e.Icon;
row.Cells[0].Style.Alignment = DataGridViewContentAlignment.TopCenter;
row.Cells[0].Style.Padding = new Padding(0, 5, 0, 0);
row.Cells[1].Value = e.message;
row.Cells[1].Value = e.Description;
row.Cells[1].Style.WrapMode = DataGridViewTriState.True;
row.Cells[1].Tag = e; //mxd
}
//mxd
clearlist.Enabled = (grid.Rows.Count > 0);
}
//mxd
private ErrorItem GetErrorItem(int rowindex)
{
if(grid.Rows.Count == 0 || grid.SelectedRows.Count != 1) return null;
DataGridViewRow row = grid.Rows[rowindex];
return (row.Cells[1].Tag as ErrorItem);
}
//mxd
private void ShowErrorSource()
{
if(grid.Rows.Count == 0 || grid.SelectedRows.Count != 1) return;
ErrorItem error = GetErrorItem(grid.SelectedRows[0].Index);
if(error != null) error.ShowSource();
}
#endregion
@ -101,6 +120,10 @@ namespace CodeImp.DoomBuilder.Windows
{
General.ErrorLogger.Clear();
grid.Rows.Clear();
copyselected.Enabled = false; //mxd
showsource.Enabled = false; //mxd
clearlist.Enabled = false; //mxd
}
// Copy selection
@ -120,17 +143,17 @@ namespace CodeImp.DoomBuilder.Windows
}
//mxd
try
{
Clipboard.SetDataObject(str.ToString(), true, 5, 200);
}
catch(ExternalException)
{
General.Interface.DisplayStatus(StatusType.Warning, "Failed to perform a Clipboard operation...");
}
try { Clipboard.SetDataObject(str.ToString(), true, 5, 200); }
catch(ExternalException) { General.Interface.DisplayStatus(StatusType.Warning, "Failed to perform a Clipboard operation..."); }
}
}
//mxd
private void showsource_Click(object sender, EventArgs e)
{
ShowErrorSource();
}
// Help requested
private void ErrorsForm_HelpRequested(object sender, HelpEventArgs hlpevent)
{
@ -138,8 +161,6 @@ namespace CodeImp.DoomBuilder.Windows
hlpevent.Handled = true;
}
#endregion
private void ErrorsForm_Shown(object sender, EventArgs e)
{
if(grid.Rows.Count > 0) grid.Rows[0].Selected = false;
@ -148,6 +169,18 @@ namespace CodeImp.DoomBuilder.Windows
private void grid_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
copyselected.Enabled = true;
//mxd. Can we show error source?
ErrorItem error = GetErrorItem(e.RowIndex);
showsource.Enabled = (error != null && error.IsShowable);
}
//mxd
private void grid_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e)
{
ShowErrorSource();
}
#endregion
}
}

View file

@ -117,21 +117,12 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="copyselected.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="clearlist.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="close.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="checkerrors.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>103, 17</value>
</metadata>
<metadata name="checkshow.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="grid.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>

View file

@ -77,6 +77,18 @@ namespace CodeImp.DoomBuilder.Windows
editor.OnReloadResources();
}
//mxd
internal void DisplayError(TextResourceErrorItem error)
{
editor.ShowError(error);
}
//mxd
/*internal void DisplayError(TextFileErrorItem error)
{
editor.ShowError(error);
}*/
#endregion
#region ================== Events

View file

@ -144,7 +144,10 @@ namespace CodeImp.DoomBuilder.ZDoom
if(!base.Parse(data, clearerrors)) return false;
//mxd. Region-as-category stuff...
List<DecorateCategoryInfo> regions = new List<DecorateCategoryInfo>(); //mxd
List<DecorateCategoryInfo> regions = new List<DecorateCategoryInfo>();
//mxd. Regions tracking...
List<KeyValuePair<int, string>> regionlines = new List<KeyValuePair<int, string>>(); // <line number, region title>
// Keep local data
Stream localstream = datastream;
@ -296,8 +299,10 @@ namespace CodeImp.DoomBuilder.ZDoom
//mxd. Region-as-category handling
case "#region":
int line = GetCurrentLineNumber();
SkipWhitespace(false);
string cattitle = ReadLine();
regionlines.Add(new KeyValuePair<int, string>(line, cattitle));
if(!string.IsNullOrEmpty(cattitle))
{
// Make new category info
@ -319,10 +324,11 @@ namespace CodeImp.DoomBuilder.ZDoom
//mxd. Region-as-category handling
case "#endregion":
if(regions.Count > 0)
regions.RemoveAt(regions.Count - 1);
if(regions.Count > 0) regions.RemoveAt(regions.Count - 1);
if(regionlines.Count > 0)
regionlines.RemoveAt(regionlines.Count - 1);
else
LogWarning("Unexpected #endregion token");
LogWarning("Unexpected #endregion");
break;
default:
@ -371,6 +377,18 @@ namespace CodeImp.DoomBuilder.ZDoom
}
}
//mxd. Check unclosed #regions
if(regionlines.Count > 0)
{
foreach(var group in regionlines)
{
if(!string.IsNullOrEmpty(group.Value))
LogWarning("Unclosed #region \"" + group.Value + "\"", group.Key);
else
LogWarning("Unclosed #region", group.Key);
}
}
// Return true when no errors occurred
return (ErrorDescription == null);
}

View file

@ -273,7 +273,9 @@ namespace CodeImp.DoomBuilder.ZDoom
if(datastream.Position == datastream.Length) //mxd
{
// ZDoom doesn't give even a warning message about this, so we shouldn't report error or fail parsing.
General.ErrorLogger.Add(ErrorType.Warning, "DECORATE warning in \"" + sourcename + "\", line " + GetCurrentLineNumber() + ". Block comment is not closed.");
string message = ScriptType + " warning in \"" + sourcename + "\", line " + GetCurrentLineNumber() + ". Block comment is not closed.";
TextResourceErrorItem error = new TextResourceErrorItem(ErrorType.Warning, ScriptType, datalocation, sourcename, sourcelumpindex, GetCurrentLineNumber(), message);
General.ErrorLogger.Add(error);
return false;
}
@ -705,23 +707,41 @@ namespace CodeImp.DoomBuilder.ZDoom
}
//mxd. This adds a warning to the ErrorLogger
protected internal void LogWarning(string message)
protected internal void LogWarning(string message) { LogWarning(message, CompilerError.NO_LINE_NUMBER); }
protected internal void LogWarning(string message, int linenumber)
{
// Add a warning
int errline = (datastream != null ? GetCurrentLineNumber() : CompilerError.NO_LINE_NUMBER);
int errline = (linenumber != CompilerError.NO_LINE_NUMBER
? linenumber
: (datastream != null ? GetCurrentLineNumber() : CompilerError.NO_LINE_NUMBER));
string errsource = (ScriptType == ScriptType.ACS && sourcename.StartsWith("?") ? sourcename.Substring(1) : Path.Combine(datalocation.GetDisplayName(), sourcename));
if(sourcelumpindex != -1) errsource += ":" + sourcelumpindex;
General.ErrorLogger.Add(ErrorType.Warning, ScriptType + " warning in \"" + errsource
+ (errline != CompilerError.NO_LINE_NUMBER ? "\", line " + (errline + 1) : "\"") + ". "
+ message + ".");
message = ScriptType + " warning in \"" + errsource
+ (errline != CompilerError.NO_LINE_NUMBER ? "\", line " + (errline + 1) : "\"") + ". "
+ message + ".";
TextResourceErrorItem error = new TextResourceErrorItem(ErrorType.Warning,
ScriptType, datalocation,
(sourcename.StartsWith("?") ? sourcename.Substring(1) : sourcename),
sourcelumpindex, errline, message);
General.ErrorLogger.Add(error);
}
//mxd. This adds an error to the ErrorLogger
public void LogError()
{
General.ErrorLogger.Add(ErrorType.Error, ScriptType + " error in \"" + shorterrorsource
+ (errorline != CompilerError.NO_LINE_NUMBER ? "\", line " + (errorline + 1) : "\"") + ". "
+ errordesc + ".");
string message = ScriptType + " error in \"" + shorterrorsource
+ (errorline != CompilerError.NO_LINE_NUMBER ? "\", line " + (errorline + 1) : "\"") + ". "
+ errordesc + ".";
TextResourceErrorItem error = new TextResourceErrorItem(ErrorType.Warning,
ScriptType, datalocation,
(sourcename.StartsWith("?") ? sourcename.Substring(1) : sourcename),
sourcelumpindex, errorline, message);
General.ErrorLogger.Add(error);
}
//mxd

View file

@ -22,22 +22,26 @@ namespace CodeImp.DoomBuilder.AutomapMode
public void Register()
{
General.Interface.BeginToolbarUpdate(); //mxd
General.Interface.AddButton(showhiddenlines);
General.Interface.AddButton(showsecretsectors);
if(!General.Map.DOOM) General.Interface.AddButton(showlocks);
General.Interface.AddButton(colorpresetseparator);
General.Interface.AddButton(colorpresetlabel);
General.Interface.AddButton(colorpreset);
General.Interface.EndToolbarUpdate(); //mxd
}
public void Unregister()
{
General.Interface.BeginToolbarUpdate(); //mxd
General.Interface.RemoveButton(colorpreset);
General.Interface.RemoveButton(colorpresetlabel);
General.Interface.RemoveButton(colorpresetseparator);
if(!General.Map.DOOM) General.Interface.RemoveButton(showlocks);
General.Interface.RemoveButton(showlocks);
General.Interface.RemoveButton(showsecretsectors);
General.Interface.RemoveButton(showhiddenlines);
General.Interface.EndToolbarUpdate(); //mxd
}
private void showhiddenlines_CheckedChanged(object sender, EventArgs e)

View file

@ -21,10 +21,12 @@ namespace CodeImp.DoomBuilder.BuilderEffects
public void Register()
{
// Add the menus to the core
General.Interface.BeginToolbarUpdate();
General.Interface.AddModesMenu(menujitter, "002_modify");
General.Interface.AddModesButton(buttonjitter, "002_modify");
General.Interface.AddModesMenu(menusectorflatshading, "002_modify");
General.Interface.AddModesButton(buttonsectorflatshading, "002_modify");
General.Interface.EndToolbarUpdate();
for(int i = 0; i < stripimport.DropDownItems.Count; i++)
General.Interface.AddMenu(stripimport.DropDownItems[i] as ToolStripMenuItem, MenuSection.FileImport);
@ -34,10 +36,12 @@ namespace CodeImp.DoomBuilder.BuilderEffects
public void Unregister()
{
// Remove the menus from the core
General.Interface.BeginToolbarUpdate();
General.Interface.RemoveMenu(menujitter);
General.Interface.RemoveButton(buttonjitter);
General.Interface.RemoveMenu(menusectorflatshading);
General.Interface.RemoveButton(buttonsectorflatshading);
General.Interface.EndToolbarUpdate();
for(int i = 0; i < stripimport.DropDownItems.Count; i++)
General.Interface.RemoveMenu(stripimport.DropDownItems[i] as ToolStripMenuItem);

View file

@ -1222,8 +1222,10 @@ namespace CodeImp.DoomBuilder.BuilderModes
snaptonearest = General.Interface.AutoMerge; //mxd
// Add toolbar buttons
General.Interface.BeginToolbarUpdate(); //mxd
General.Interface.AddButton(BuilderPlug.Me.MenusForm.FlipSelectionH);
General.Interface.AddButton(BuilderPlug.Me.MenusForm.FlipSelectionV);
General.Interface.EndToolbarUpdate(); //mxd
//mxd. Get EditPanel-related settings
usepreciseposition = General.Settings.ReadPluginSetting("editselectionmode.usepreciseposition", true);
@ -1740,8 +1742,10 @@ namespace CodeImp.DoomBuilder.BuilderModes
base.OnDisengage();
// Remove toolbar buttons
General.Interface.BeginToolbarUpdate(); //mxd
General.Interface.RemoveButton(BuilderPlug.Me.MenusForm.FlipSelectionH);
General.Interface.RemoveButton(BuilderPlug.Me.MenusForm.FlipSelectionV);
General.Interface.EndToolbarUpdate(); //mxd
//mxd. Save EditPanel-related settings
General.Settings.WritePluginSetting("editselectionmode.usepreciseposition", usepreciseposition);

View file

@ -555,15 +555,12 @@ namespace CodeImp.DoomBuilder.BuilderModes
General.Interface.RemoveButton(BuilderPlug.Me.MenusForm.ViewSelectionNumbers); //mxd
General.Interface.RemoveButton(BuilderPlug.Me.MenusForm.ViewSelectionEffects); //mxd
General.Interface.RemoveButton(BuilderPlug.Me.MenusForm.SeparatorSectors1); //mxd
if(General.Map.UDMF) //mxd
{
General.Interface.RemoveButton(BuilderPlug.Me.MenusForm.MakeGradientBrightness);
General.Interface.RemoveButton(BuilderPlug.Me.MenusForm.GradientInterpolationMenu);
}
General.Interface.RemoveButton(BuilderPlug.Me.MenusForm.MakeGradientBrightness);
General.Interface.RemoveButton(BuilderPlug.Me.MenusForm.GradientInterpolationMenu);
General.Interface.RemoveButton(BuilderPlug.Me.MenusForm.CurveLinedefs);
General.Interface.RemoveButton(BuilderPlug.Me.MenusForm.MarqueSelectTouching); //mxd
General.Interface.RemoveButton(BuilderPlug.Me.MenusForm.SyncronizeThingEditButton); //mxd
if(General.Map.UDMF) General.Interface.RemoveButton(BuilderPlug.Me.MenusForm.TextureOffsetLock); //mxd
General.Interface.RemoveButton(BuilderPlug.Me.MenusForm.TextureOffsetLock); //mxd
General.Interface.EndToolbarUpdate(); //mxd
// Going to EditSelectionMode?

View file

@ -762,14 +762,14 @@ namespace CodeImp.DoomBuilder.BuilderModes
General.Interface.RemoveButton(BuilderPlug.Me.MenusForm.MakeDoor); //mxd
General.Interface.RemoveButton(BuilderPlug.Me.MenusForm.SeparatorSectors2); //mxd
General.Interface.RemoveButton(BuilderPlug.Me.MenusForm.MakeGradientBrightness);
if(General.Map.UDMF) General.Interface.RemoveButton(BuilderPlug.Me.MenusForm.GradientModeMenu); //mxd
General.Interface.RemoveButton(BuilderPlug.Me.MenusForm.GradientModeMenu); //mxd
General.Interface.RemoveButton(BuilderPlug.Me.MenusForm.GradientInterpolationMenu); //mxd
General.Interface.RemoveButton(BuilderPlug.Me.MenusForm.MakeGradientFloors);
General.Interface.RemoveButton(BuilderPlug.Me.MenusForm.MakeGradientCeilings);
General.Interface.RemoveButton(BuilderPlug.Me.MenusForm.SeparatorSectors3); //mxd
General.Interface.RemoveButton(BuilderPlug.Me.MenusForm.MarqueSelectTouching); //mxd
General.Interface.RemoveButton(BuilderPlug.Me.MenusForm.SyncronizeThingEditButton); //mxd
if(General.Map.UDMF) General.Interface.RemoveButton(BuilderPlug.Me.MenusForm.TextureOffsetLock); //mxd
General.Interface.RemoveButton(BuilderPlug.Me.MenusForm.TextureOffsetLock); //mxd
General.Interface.EndToolbarUpdate(); //mxd
// Keep only sectors selected

View file

@ -184,8 +184,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
General.Interface.RemoveButton(BuilderPlug.Me.MenusForm.PastePropertiesOptions); //mxd
General.Interface.RemoveButton(BuilderPlug.Me.MenusForm.SeparatorCopyPaste); //mxd
General.Interface.RemoveButton(BuilderPlug.Me.MenusForm.ViewSelectionNumbers); //mxd
if(General.Map.FormatInterface.HasThingAction)
General.Interface.RemoveButton(BuilderPlug.Me.MenusForm.ViewSelectionEffects); //mxd
General.Interface.RemoveButton(BuilderPlug.Me.MenusForm.ViewSelectionEffects); //mxd
General.Interface.RemoveButton(BuilderPlug.Me.MenusForm.SeparatorSectors1); //mxd
General.Interface.RemoveButton(BuilderPlug.Me.MenusForm.AlignThingsToWall); //mxd

View file

@ -112,15 +112,12 @@ namespace CodeImp.DoomBuilder.BuilderModes
base.OnDisengage();
// Remove toolbar buttons
if(General.Map.UDMF)
{
General.Interface.BeginToolbarUpdate();
General.Interface.RemoveButton(BuilderPlug.Me.MenusForm.CopyProperties);
General.Interface.RemoveButton(BuilderPlug.Me.MenusForm.PasteProperties);
General.Interface.RemoveButton(BuilderPlug.Me.MenusForm.PastePropertiesOptions); //mxd
General.Interface.RemoveButton(BuilderPlug.Me.MenusForm.TextureOffsetLock); //mxd
General.Interface.EndToolbarUpdate();
}
General.Interface.BeginToolbarUpdate();
General.Interface.RemoveButton(BuilderPlug.Me.MenusForm.CopyProperties);
General.Interface.RemoveButton(BuilderPlug.Me.MenusForm.PasteProperties);
General.Interface.RemoveButton(BuilderPlug.Me.MenusForm.PastePropertiesOptions); //mxd
General.Interface.RemoveButton(BuilderPlug.Me.MenusForm.TextureOffsetLock); //mxd
General.Interface.EndToolbarUpdate();
// Going to EditSelectionMode?
EditSelectionMode mode = General.Editing.NewMode as EditSelectionMode;

View file

@ -54,6 +54,7 @@ namespace CodeImp.DoomBuilder.BuilderModes.Interface
public void Register()
{
General.Interface.BeginToolbarUpdate();
General.Interface.AddButton(vertslabel);
General.Interface.AddButton(verts);
General.Interface.AddButton(distancelabel);
@ -67,10 +68,12 @@ namespace CodeImp.DoomBuilder.BuilderModes.Interface
General.Interface.AddButton(separator2);
General.Interface.AddButton(apply);
General.Interface.AddButton(cancel);
General.Interface.EndToolbarUpdate();
}
public void Unregister()
{
General.Interface.BeginToolbarUpdate();
General.Interface.RemoveButton(cancel);
General.Interface.RemoveButton(apply);
General.Interface.RemoveButton(anglelabel);
@ -85,6 +88,7 @@ namespace CodeImp.DoomBuilder.BuilderModes.Interface
General.Interface.RemoveButton(distancelabel);
General.Interface.RemoveButton(verts);
General.Interface.RemoveButton(vertslabel);
General.Interface.EndToolbarUpdate();
}
#endregion

View file

@ -26,22 +26,26 @@ namespace CodeImp.DoomBuilder.BuilderModes
public void Register()
{
General.Interface.BeginToolbarUpdate();
General.Interface.AddButton(continuousdrawing);
General.Interface.AddButton(autoclosedrawing);
General.Interface.AddButton(toolStripSeparator1);
General.Interface.AddButton(seglabel);
General.Interface.AddButton(seglen);
General.Interface.AddButton(reset);
General.Interface.EndToolbarUpdate();
}
public void Unregister()
{
General.Interface.BeginToolbarUpdate();
General.Interface.RemoveButton(reset);
General.Interface.RemoveButton(seglen);
General.Interface.RemoveButton(seglabel);
General.Interface.RemoveButton(toolStripSeparator1);
General.Interface.RemoveButton(autoclosedrawing);
General.Interface.RemoveButton(continuousdrawing);
General.Interface.EndToolbarUpdate();
}
private void seglen_ValueChanged(object sender, EventArgs e)

View file

@ -32,6 +32,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
subdivs.ValueChanged += ValueChanged;
angle.ValueChanged += ValueChanged;
General.Interface.BeginToolbarUpdate();
General.Interface.AddButton(continuousdrawing);
General.Interface.AddButton(showguidelines);
General.Interface.AddButton(toolStripSeparator1);
@ -42,10 +43,12 @@ namespace CodeImp.DoomBuilder.BuilderModes
General.Interface.AddButton(anglelabel);
General.Interface.AddButton(angle);
General.Interface.AddButton(reset);
General.Interface.EndToolbarUpdate();
}
public void Unregister()
{
General.Interface.BeginToolbarUpdate();
General.Interface.RemoveButton(reset);
General.Interface.RemoveButton(angle);
General.Interface.RemoveButton(anglelabel);
@ -56,6 +59,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
General.Interface.RemoveButton(toolStripSeparator1);
General.Interface.RemoveButton(showguidelines);
General.Interface.RemoveButton(continuousdrawing);
General.Interface.EndToolbarUpdate();
}
private void ValueChanged(object sender, EventArgs e)

View file

@ -20,16 +20,20 @@ namespace CodeImp.DoomBuilder.BuilderModes
public void Register()
{
General.Interface.BeginToolbarUpdate();
General.Interface.AddButton(continuousdrawing);
General.Interface.AddButton(autoclosedrawing);
General.Interface.AddButton(showguidelines);
General.Interface.EndToolbarUpdate();
}
public void Unregister()
{
General.Interface.BeginToolbarUpdate();
General.Interface.RemoveButton(showguidelines);
General.Interface.RemoveButton(autoclosedrawing);
General.Interface.RemoveButton(continuousdrawing);
General.Interface.EndToolbarUpdate();
}
private void continuousdrawing_CheckedChanged(object sender, EventArgs e)

View file

@ -30,6 +30,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
radius.ValueChanged += ValueChanged;
subdivs.ValueChanged += ValueChanged;
General.Interface.BeginToolbarUpdate();
General.Interface.AddButton(continuousdrawing);
General.Interface.AddButton(showguidelines);
General.Interface.AddButton(toolStripSeparator1);
@ -38,10 +39,12 @@ namespace CodeImp.DoomBuilder.BuilderModes
General.Interface.AddButton(subdivslabel);
General.Interface.AddButton(subdivs);
General.Interface.AddButton(reset);
General.Interface.EndToolbarUpdate();
}
public void Unregister()
{
General.Interface.BeginToolbarUpdate();
General.Interface.RemoveButton(reset);
General.Interface.RemoveButton(subdivs);
General.Interface.RemoveButton(subdivslabel);
@ -50,6 +53,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
General.Interface.RemoveButton(toolStripSeparator1);
General.Interface.RemoveButton(showguidelines);
General.Interface.RemoveButton(continuousdrawing);
General.Interface.EndToolbarUpdate();
}
private void ValueChanged(object sender, EventArgs e)

View file

@ -165,8 +165,10 @@ namespace CodeImp.DoomBuilder.BuilderModes
General.Interface.RemoveMenu(i);
// Remove the buttons from the core
General.Interface.BeginToolbarUpdate(); //mxd
foreach(ToolStripItem b in buttons)
General.Interface.RemoveButton(b);
General.Interface.EndToolbarUpdate(); //mxd
//mxd. Export menu
foreach(ToolStripItem i in exportmenuitems)

View file

@ -54,19 +54,23 @@ namespace CodeImp.DoomBuilder.Plugins.VisplaneExplorer
// This adds the buttons to the toolbar
public void AddToInterface()
{
General.Interface.BeginToolbarUpdate(); //mxd
General.Interface.AddButton(statsbutton);
General.Interface.AddButton(separator); //mxd
General.Interface.AddButton(cbopendoors); //mxd
General.Interface.AddButton(cbheatmap); //mxd
General.Interface.EndToolbarUpdate(); //mxd
}
// This removes the buttons from the toolbar
public void RemoveFromInterface()
{
General.Interface.BeginToolbarUpdate(); //mxd
General.Interface.RemoveButton(cbheatmap); //mxd
General.Interface.RemoveButton(cbopendoors); //mxd
General.Interface.RemoveButton(separator); //mxd
General.Interface.RemoveButton(statsbutton);
General.Interface.EndToolbarUpdate(); //mxd
//mxd. Save settings
General.Settings.WritePluginSetting("opendoors", cbopendoors.Checked);