Don't move to another macro if it's only going to have one step

This commit is contained in:
Asriel Camora
2023-10-24 01:07:26 -07:00
parent 889d07433c
commit cd0fbacbbc
3 changed files with 27 additions and 11 deletions
+1
View File
@@ -59,6 +59,7 @@ public class MacroCopyConfiguration
public bool AddNotification { get; set; } = true; public bool AddNotification { get; set; } = true;
// Requires AddNotification // Requires AddNotification
public bool ForceNotification { get; set; }
public bool AddNotificationSound { get; set; } = true; public bool AddNotificationSound { get; set; } = true;
public int IntermediateNotificationSound { get; set; } = 10; public int IntermediateNotificationSound { get; set; } = 10;
public int EndNotificationSound { get; set; } = 6; public int EndNotificationSound { get; set; } = 6;
+7 -1
View File
@@ -37,7 +37,9 @@ public static class MacroCopy
s.Add(GetActionCommand(actions[i], config)); s.Add(GetActionCommand(actions[i], config));
if (i != actions.Count - 1 && (config.Type == MacroCopyConfiguration.CopyType.CopyToMacro || !config.CombineMacro)) if (config.Type == MacroCopyConfiguration.CopyType.CopyToMacro || !config.CombineMacro)
{
if (i != actions.Count - 1 && (i != actions.Count - 2 || config.ForceNotification))
{ {
if (s.Count == MacroSize - 1) if (s.Count == MacroSize - 1)
{ {
@@ -51,10 +53,14 @@ public static class MacroCopy
} }
} }
} }
}
if (s.Count > 0) if (s.Count > 0)
{
if (s.Count < MacroSize)
{ {
if (GetEndCommand(macros.Count, true, config) is { } endCommand) if (GetEndCommand(macros.Count, true, config) is { } endCommand)
s.Add(endCommand); s.Add(endCommand);
}
macros.Add(string.Join(Environment.NewLine, s)); macros.Add(string.Join(Environment.NewLine, s));
} }
+9
View File
@@ -280,6 +280,15 @@ public sealed class Settings : Window, IDisposable
if (Config.MacroCopy.AddNotification) if (Config.MacroCopy.AddNotification)
{ {
DrawOption(
"Force Notification",
"Prioritize always having a notification sound at the end of\n" +
"every macro. Keeping this off prevents macros with only 1 action.",
Config.MacroCopy.ForceNotification,
v => Config.MacroCopy.ForceNotification = v,
ref isDirty
);
DrawOption( DrawOption(
"Add Notification Sound", "Add Notification Sound",
"Adds a sound to the end of every macro.", "Adds a sound to the end of every macro.",