Fix math for subsequent layers

This commit is contained in:
Tiago Conceição
2020-09-07 19:00:36 +01:00
parent dcf85cb509
commit ea74e39c42
3 changed files with 12 additions and 9 deletions
@@ -1,6 +1,7 @@
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Threading.Tasks;
@@ -43,17 +44,16 @@ namespace UVtools.Core.Operations
{
if (DiscardRemainingLayers)
{
return (uint) (1 + InsertAfterLayerIndex + Files.Count - (ReplaceStartLayer ? 1u : 0u));
return (uint) (1 + InsertAfterLayerIndex + Files.Count - (ReplaceStartLayer ? 1 : 0));
}
if (!ReplaceSubsequentLayers)
if (ReplaceSubsequentLayers)
{
return (uint)(totalLayers + Files.Count - (ReplaceStartLayer ? 1u : 0u));
uint result = (uint) (1 + InsertAfterLayerIndex + Files.Count - (ReplaceStartLayer ? 1 : 0));
return result <= totalLayers ? totalLayers : result;
}
// Need to calculate the total layer count after subsequent replacing, taking in account that layer count can grow
return (uint)(totalLayers + Files.Count - (ReplaceStartLayer ? 1 : 0));
return 0;
}
}
}
@@ -11,6 +11,7 @@ using System.Runtime.CompilerServices;
using System.Windows.Forms;
using UVtools.Core.Extensions;
using UVtools.GUI.Annotations;
using UVtools.GUI.Forms;
namespace UVtools.GUI.Controls
{
@@ -69,10 +70,12 @@ namespace UVtools.GUI.Controls
}
}
#endregion
#region Properties
[ReadOnly(true)] [Browsable(false)] public FrmToolWindow ParentToolWindow => ParentForm as FrmToolWindow;
[Editor("System.ComponentModel.Design.MultilineStringEditor", typeof(UITypeEditor))]
[SettingsBindable(true)]
public string Description { get; set; }
@@ -105,7 +108,7 @@ namespace UVtools.GUI.Controls
[ReadOnly(true)]
[Browsable(false)]
public virtual string ConfirmationText { get; } = "do this action?";
public virtual string ConfirmationText => $"{Text}?";
#endregion
+1 -1
View File
@@ -82,7 +82,7 @@ namespace UVtools.GUI.Forms
[ReadOnly(true)]
[Browsable(false)]
public virtual string ConfirmationText { get; } = "do this action?";
public virtual string ConfirmationText => $"{Text}?";
#endregion