Skip to content

Commit

Permalink
Enable replay for override commands
Browse files Browse the repository at this point in the history
  • Loading branch information
stevencohn committed Dec 26, 2023
1 parent e7d51be commit 592d152
Show file tree
Hide file tree
Showing 5 changed files with 100 additions and 14 deletions.
18 changes: 9 additions & 9 deletions OneMore/AddInCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -211,12 +211,12 @@ public async Task CopyFolderCmd(IRibbonControl control)

[Command("ribCopyLinkToPageButton_Label", Keys.None, "ribReferencesMenu")]
public async Task CopyLinkToPageCmd(IRibbonControl control)
=> await factory.Run<CopyLinkCommand>(false);
=> await factory.Run<CopyLinkToPageCommand>();


[Command("ribCopyLinkToParagraphButton_Label", Keys.None, "ribReferencesMenu")]
public async Task CopyLinkToParagraphCmd(IRibbonControl control)
=> await factory.Run<CopyLinkCommand>(true);
=> await factory.Run<CopyLinkToParagraphCommand>();


[Command("ribCopyAsMarkdownButton_Label", Keys.None, "ribEditMenu")]
Expand Down Expand Up @@ -246,7 +246,7 @@ public async Task DateStampCmd(IRibbonControl control)

[Command("ribDecreaseFontSizeButton_Label", Keys.Control | Keys.Alt | Keys.OemMinus, "ribEditMenu")]
public async Task DecreaseFontSizeCmd(IRibbonControl control)
=> await factory.Run<AlterSizeCommand>(-1);
=> await factory.Run<DecreaseFontSizeCommand>();


[Command("ribDeleteFormulaButton_Label", Keys.None, "ribTableMenu")]
Expand Down Expand Up @@ -395,12 +395,12 @@ public async Task ImportOutlookTasksCmd(IRibbonControl control)

[Command("ribIncreaseFontSizeButton_Label", Keys.Control | Keys.Alt | Keys.Oemplus, "ribEditMenu")]
public async Task IncreaseFontSizeCmd(IRibbonControl control)
=> await factory.Run<AlterSizeCommand>(1);
=> await factory.Run<IncreaseFontSizeCommand>();


[Command("ribInsertBlueStatusButton_Label", Keys.None, "ribSnippetsMenu")]
public async Task InsertBlueStatusCmd(IRibbonControl control)
=> await factory.Run<InsertStatusCommand>(StatusColor.Blue);
=> await factory.Run<InsertBlueStatusCommand>();


[Command("ribInsertTextBoxButton_Label", Keys.Alt | Keys.F6, "ribSnippetsMenu")]
Expand Down Expand Up @@ -455,12 +455,12 @@ public async Task InsertExpandCmd(IRibbonControl control)

[Command("ribInsertGrayStatusButton_Label", Keys.None, "ribSnippetsMenu")]
public async Task InsertGrayStatusCmd(IRibbonControl control)
=> await factory.Run<InsertStatusCommand>(StatusColor.Gray);
=> await factory.Run<InsertGrayStatusCommand>();


[Command("ribInsertGreenStatusButton_Label", Keys.None, "ribSnippetsMenu")]
public async Task InsertGreenStatusCmd(IRibbonControl control)
=> await factory.Run<InsertStatusCommand>(StatusColor.Green);
=> await factory.Run<InsertGreenStatusCommand>();


[Command("ribInsertInfoBoxButton_Label", Keys.None, "ribSnippetsMenu")]
Expand All @@ -480,7 +480,7 @@ public async Task InsertQRCmd(IRibbonControl control)

[Command("ribInsertRedStatusButton_Label", Keys.None, "ribSnippetsMenu")]
public async Task InsertRedStatusCmd(IRibbonControl control)
=> await factory.Run<InsertStatusCommand>(StatusColor.Red);
=> await factory.Run<InsertRedStatusCommand>();


[Command("ribInsertSingleLineButton_Label", Keys.Alt | Keys.Shift | Keys.F11, "ribSnippetsMenu")]
Expand Down Expand Up @@ -509,7 +509,7 @@ public async Task InsertWarnBoxCmd(IRibbonControl control)

[Command("ribInsertYellowStatusButton_Label", Keys.None, "ribSnippetsMenu")]
public async Task InsertYellowStatusCmd(IRibbonControl control)
=> await factory.Run<InsertStatusCommand>(StatusColor.Yellow);
=> await factory.Run<InsertYellowStatusCommand>();


[Command("ribInvertSelectionButton_Label", Keys.None, "ribEditMenu")]
Expand Down
22 changes: 21 additions & 1 deletion OneMore/Commands/Edit/AlterSizeCommand.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//************************************************************************************************
// Copyright © 2018 Steven M Cohn. All rights reserved.
// Copyright © 2018 Steven M Cohn. All rights reserved.
//************************************************************************************************

namespace River.OneMoreAddIn.Commands
Expand All @@ -15,6 +15,26 @@ namespace River.OneMoreAddIn.Commands
using System.Xml.Linq;


#region Wrapper
internal class DecreaseFontSizeCommand : AlterSizeCommand
{
public DecreaseFontSizeCommand() : base() { }
public override Task Execute(params object[] args)
{
return base.Execute(-1);
}
}
internal class IncreaseFontSizeCommand : AlterSizeCommand
{
public IncreaseFontSizeCommand() : base() { }
public override Task Execute(params object[] args)
{
return base.Execute(1);
}
}
#endregion Wrapper


/// <summary>
/// Increases or decreases the font size of all text on the entire page.
/// </summary>
Expand Down
3 changes: 2 additions & 1 deletion OneMore/Commands/References/BiLinkCommand.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//************************************************************************************************
// Copyright © 2021 Steven M Cohn. All rights reserved.
// Copyright © 2021 Steven M Cohn. All rights reserved.
//************************************************************************************************

namespace River.OneMoreAddIn.Commands
Expand Down Expand Up @@ -33,6 +33,7 @@ internal class BiLinkCommand : Command

public BiLinkCommand()
{
IsCancelled = true;
}


Expand Down
22 changes: 21 additions & 1 deletion OneMore/Commands/References/CopyLinkCommand.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//************************************************************************************************
// Copyright © 2022 Steven M Cohn. All rights reserved.
// Copyright © 2022 Steven M Cohn. All rights reserved.
//************************************************************************************************

namespace River.OneMoreAddIn
Expand All @@ -14,6 +14,26 @@ namespace River.OneMoreAddIn
using Win = System.Windows;


#region Wrappers
internal class CopyLinkToPageCommand : CopyLinkCommand
{
public CopyLinkToPageCommand() : base() { }
public override Task Execute(params object[] args)
{
return base.Execute(false);
}
}
internal class CopyLinkToParagraphCommand : CopyLinkCommand
{
public CopyLinkToParagraphCommand() : base() { }
public override Task Execute(params object[] args)
{
return base.Execute(true);
}
}
#endregion Wrappers


/// <summary>
/// Copies the hyperlink to the current page or paragraph to the clipboard
/// </summary>
Expand Down
49 changes: 47 additions & 2 deletions OneMore/Commands/Snippets/InsertStatusCommand.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
//************************************************************************************************
// Copyright © 2020 Steven M Cohn. All rights reserved.
// Copyright © 2020 Steven M Cohn. All rights reserved.
//************************************************************************************************

namespace River.OneMoreAddIn.Commands
{
using System.Linq;
using System.Threading.Tasks;
using System.Xml.Linq;
using Resx = River.OneMoreAddIn.Properties.Resources;
using Resx = Properties.Resources;


internal enum StatusColor
Expand All @@ -19,6 +19,51 @@ internal enum StatusColor
Yellow
}


#region Wrappers
internal class InsertBlueStatusCommand : InsertStatusCommand
{
public InsertBlueStatusCommand() : base() { }
public override Task Execute(params object[] args)
{
return base.Execute(StatusColor.Blue);
}
}
internal class InsertGrayStatusCommand : InsertStatusCommand
{
public InsertGrayStatusCommand() : base() { }
public override Task Execute(params object[] args)
{
return base.Execute(StatusColor.Gray);
}
}
internal class InsertGreenStatusCommand : InsertStatusCommand
{
public InsertGreenStatusCommand() : base() { }
public override Task Execute(params object[] args)
{
return base.Execute(StatusColor.Green);
}
}
internal class InsertRedStatusCommand : InsertStatusCommand
{
public InsertRedStatusCommand() : base() { }
public override Task Execute(params object[] args)
{
return base.Execute(StatusColor.Red);
}
}
internal class InsertYellowStatusCommand : InsertStatusCommand
{
public InsertYellowStatusCommand() : base() { }
public override Task Execute(params object[] args)
{
return base.Execute(StatusColor.Yellow);
}
}
#endregion Wrappers


internal class InsertStatusCommand : Command
{

Expand Down

0 comments on commit 592d152

Please sign in to comment.