Skip to content

Commit

Permalink
Add command categories
Browse files Browse the repository at this point in the history
  • Loading branch information
stevencohn committed Sep 26, 2022
1 parent c021d9a commit 0077f10
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 49 deletions.
88 changes: 44 additions & 44 deletions OneMore/AddInCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ public void AddFavoriteSectionCmd(IRibbonControl control)
=> new FavoritesProvider(ribbon).AddFavorite(true);


[Command("ribFootnoteButton_Label", Keys.Control | Keys.Alt | Keys.F)]
[Command("ribFootnoteButton_Label", Keys.Control | Keys.Alt | Keys.F, "References")]
public async Task AddFootnoteCmd(IRibbonControl control)
=> await factory.Run<AddFootnoteCommand>();


[Command("ribAddFormulaButton_Label", Keys.F5)]
[Command("ribAddFormulaButton_Label", Keys.F5, "Tables")]
public async Task AddFormulaCmd(IRibbonControl control)
=> await factory.Run<AddFormulaCommand>();

Expand All @@ -45,47 +45,47 @@ public async Task AnalyzeCmd(IRibbonControl control)
=> await factory.Run<AnalyzeCommand>();


[Command("ApplyStyle1Command", Keys.Control | Keys.Alt | Keys.Shift | Keys.D1)]
[Command("ApplyStyle1Command", Keys.Control | Keys.Alt | Keys.Shift | Keys.D1, "Styles")]
public async Task ApplyStyle1Cmd(IRibbonControl control)
=> await factory.Run<ApplyStyleCommand>(0);


[Command("ApplyStyle2Command", Keys.Control | Keys.Alt | Keys.Shift | Keys.D2)]
[Command("ApplyStyle2Command", Keys.Control | Keys.Alt | Keys.Shift | Keys.D2, "Styles")]
public async Task ApplyStyle2Cmd(IRibbonControl control)
=> await factory.Run<ApplyStyleCommand>(1);


[Command("ApplyStyle3Command", Keys.Control | Keys.Alt | Keys.Shift | Keys.D3)]
[Command("ApplyStyle3Command", Keys.Control | Keys.Alt | Keys.Shift | Keys.D3, "Styles")]
public async Task ApplyStyle3Cmd(IRibbonControl control)
=> await factory.Run<ApplyStyleCommand>(2);


[Command("ApplyStyle4Command", Keys.Control | Keys.Alt | Keys.Shift | Keys.D4)]
[Command("ApplyStyle4Command", Keys.Control | Keys.Alt | Keys.Shift | Keys.D4, "Styles")]
public async Task ApplyStyle4Cmd(IRibbonControl control)
=> await factory.Run<ApplyStyleCommand>(3);


[Command("ApplyStyle5Command", Keys.Control | Keys.Alt | Keys.Shift | Keys.D5)]
[Command("ApplyStyle5Command", Keys.Control | Keys.Alt | Keys.Shift | Keys.D5, "Styles")]
public async Task ApplyStyle5Cmd(IRibbonControl control)
=> await factory.Run<ApplyStyleCommand>(4);


[Command("ApplyStyle6Command", Keys.Control | Keys.Alt | Keys.Shift | Keys.D6)]
[Command("ApplyStyle6Command", Keys.Control | Keys.Alt | Keys.Shift | Keys.D6, "Styles")]
public async Task ApplyStyle6Cmd(IRibbonControl control)
=> await factory.Run<ApplyStyleCommand>(5);


[Command("ApplyStyle7Command", Keys.Control | Keys.Alt | Keys.Shift | Keys.D7)]
[Command("ApplyStyle7Command", Keys.Control | Keys.Alt | Keys.Shift | Keys.D7, "Styles")]
public async Task ApplyStyle7Cmd(IRibbonControl control)
=> await factory.Run<ApplyStyleCommand>(6);


[Command("ApplyStyle8Command", Keys.Control | Keys.Alt | Keys.Shift | Keys.D8)]
[Command("ApplyStyle8Command", Keys.Control | Keys.Alt | Keys.Shift | Keys.D8, "Styles")]
public async Task ApplyStyle8Cmd(IRibbonControl control)
=> await factory.Run<ApplyStyleCommand>(7);


[Command("ApplyStyle9Command", Keys.Control | Keys.Alt | Keys.Shift | Keys.D9)]
[Command("ApplyStyle9Command", Keys.Control | Keys.Alt | Keys.Shift | Keys.D9, "Styles")]
public async Task ApplyStyle9Cmd(IRibbonControl control)
=> await factory.Run<ApplyStyleCommand>(8);

Expand All @@ -106,7 +106,7 @@ public async Task BreakingCmd(IRibbonControl control)
=> await factory.Run<BreakingCommand>();


[Command("ribCalendarButton_Label", Keys.None)]
[Command("ribCalendarButton_Label", Keys.None, "Tools")]
public async Task CalendarCmd(IRibbonControl control)
=> await factory.Run<CalendarCommand>();

Expand All @@ -117,15 +117,15 @@ public async Task CaptionAttachmentsCmd(IRibbonControl control)
public async Task ChangePageColorCmd(IRibbonControl control)
=> await factory.Run<ChangePageColorCommand>();

[Command("ChooseFavoriteCommand", Keys.Alt | Keys.F)]
[Command("ChooseFavoriteCommand", Keys.Alt | Keys.F, "Tools")]
public async Task ChooseFavoriteCmd(IRibbonControl control)
=> await factory.Run<GotoFavoriteCommand>(null);

public async Task ClearBackgroundCmd(IRibbonControl control)
=> await factory.Run<ClearBackgroundCommand>();


[Command("ClearLogCommand", Keys.Control | Keys.F8)]
[Command("ClearLogCommand", Keys.Control | Keys.F8, "Tools")]
public async Task ClearLogCmd(IRibbonControl control)
=> await factory.Run<ClearLogCommand>();

Expand All @@ -149,12 +149,12 @@ public async Task CopyDownCmd(IRibbonControl control)
=> await factory.Run<FillCellsCommand>(FillCells.CopyDown);


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


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

Expand All @@ -174,7 +174,7 @@ public async Task DateStampCmd(IRibbonControl control)
=> await factory.Run<DateStampCommand>();


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

Expand All @@ -186,12 +186,12 @@ public async Task DeleteReminderCmd(IRibbonControl control)
=> await factory.Run<DeleteReminderCommand>();


[Command("DiagnosticsCommand", Keys.Shift | Keys.F8)]
[Command("DiagnosticsCommand", Keys.Shift | Keys.F8, "Tools")]
public async Task DiagnosticsCmd(IRibbonControl control)
=> await factory.Run<DiagnosticsCommand>();


[Command("ribNoSpellCheckButton_Label", Keys.F4)]
[Command("ribNoSpellCheckButton_Label", Keys.F4, "Editing")]
public async Task DisableSpellCheckCmd(IRibbonControl control)
=> await factory.Run<ProofingCommand>(ProofingCommand.NoLang);

Expand All @@ -209,7 +209,7 @@ public async Task ExpandContentCmd(IRibbonControl control)
=> await factory.Run<ExpandoCommand>(Expando.Expand);


[Command("ribExpandSnippetButton_Label", Keys.Alt | Keys.F3)]
[Command("ribExpandSnippetButton_Label", Keys.Alt | Keys.F3, "Snippets")]
public async Task ExpandSnippetCmd(IRibbonControl control)
=> await factory.Run<InsertSnippetCommand>(string.Empty);

Expand All @@ -218,7 +218,7 @@ public async Task FillAcrossCmd(IRibbonControl control)
=> await factory.Run<FillCellsCommand>(FillCells.FillAcross);


[Command("ribFillDownButton_Label", Keys.Control | Keys.D)]
[Command("ribFillDownButton_Label", Keys.Control | Keys.D, "Tables")]
public async Task FillDownCmd(IRibbonControl control)
=> await factory.Run<FillCellsCommand>(FillCells.FillDown);

Expand All @@ -239,12 +239,12 @@ public async Task ImportOutlookTasksCmd(IRibbonControl control)
=> await factory.Run<ImportOutlookTasksCommand>();


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


[Command("ribHighlightButton_Label", Keys.Control | Keys.Shift | Keys.H)]
[Command("ribHighlightButton_Label", Keys.Control | Keys.Shift | Keys.H, "Editing")]
public async Task HighlightCmd(IRibbonControl control)
=> await factory.Run<HighlightCommand>();

Expand All @@ -263,7 +263,7 @@ public async Task InsertBlueStatusCmd(IRibbonControl control)
=> await factory.Run<InsertStatusCommand>(StatusColor.Blue);


[Command("ribBoxButton_Label", Keys.None)]
[Command("ribBoxButton_Label", Keys.None, "Snippets")]
public async Task InsertBoxCmd(IRibbonControl control)
=> await factory.Run<InsertCodeBlockCommand>(false);

Expand All @@ -278,22 +278,22 @@ public async Task InsertCellsCmd(IRibbonControl control)
=> await factory.Run<InsertCellsCommand>();


[Command("ribCodeBlockButton_Label", Keys.F6)]
[Command("ribCodeBlockButton_Label", Keys.F6, "Snippets")]
public async Task InsertCodeBlockCmd(IRibbonControl control)
=> await factory.Run<InsertCodeBlockCommand>(true);


[Command("ribInsertDateButton_Label", Keys.Control | Keys.Shift | Keys.D)]
[Command("ribInsertDateButton_Label", Keys.Control | Keys.Shift | Keys.D, "Snippets")]
public async Task InsertDateCmd(IRibbonControl control)
=> await factory.Run<InsertDateCommand>(false);


[Command("ribInsertDateTimeButton_Label", Keys.Control | Keys.Shift | Keys.Alt | Keys.D)]
[Command("ribInsertDateTimeButton_Label", Keys.Control | Keys.Shift | Keys.Alt | Keys.D, "Snippets")]
public async Task InsertDateTimeCmd(IRibbonControl control)
=> await factory.Run<InsertDateCommand>(true);


[Command("ribInsertDoubleLineButton_Label", Keys.Alt | Keys.Shift| Keys.F12)]
[Command("ribInsertDoubleLineButton_Label", Keys.Alt | Keys.Shift| Keys.F12, "Snippets")]
public async Task InsertDoubleHorizontalLineCmd(IRibbonControl control)
=> await factory.Run<InsertLineCommand>('═');

Expand All @@ -308,7 +308,7 @@ public async Task InsertGreenStatusCmd(IRibbonControl control)
=> await factory.Run<InsertStatusCommand>(StatusColor.Green);


[Command("ribInsertSingleLineButton_Label", Keys.Alt | Keys.Shift | Keys.F11)]
[Command("ribInsertSingleLineButton_Label", Keys.Alt | Keys.Shift | Keys.F11, "Snippets")]
public async Task InsertHorizontalLineCmd(IRibbonControl control)
=> await factory.Run<InsertLineCommand>('─');

Expand All @@ -326,7 +326,7 @@ public async Task InsertSnippetCmd(IRibbonControl control)
=> await factory.Run<InsertSnippetCommand>(control.Tag); // tag=filepath


[Command("ribInsertTimerButton_Label", Keys.F2)]
[Command("ribInsertTimerButton_Label", Keys.F2, "Extras")]
public async Task InsertTimerCmd(IRibbonControl control)
=> await factory.Run<TimerWindowCommand>(true);

Expand Down Expand Up @@ -386,12 +386,12 @@ public async Task PasteCellsCmd(IRibbonControl control)
=> await factory.Run<PasteCellsCommand>();


[Command("ribPasteRtfButton_Label", Keys.Control | Keys.Alt | Keys.V)]
[Command("ribPasteRtfButton_Label", Keys.Control | Keys.Alt | Keys.V, "Editing")]
public async Task PasteRtfCmd(IRibbonControl control)
=> await factory.Run<PasteRtfCommand>();


[Command("ribPasteTextButton_Label", Keys.Control | Keys.Shift | Keys.V)]
[Command("ribPasteTextButton_Label", Keys.Control | Keys.Shift | Keys.V, "Editing")]
public async Task PasteTextCmd(IRibbonControl control)
=> await factory.Run<PasteTextCommand>();

Expand All @@ -400,7 +400,7 @@ public async Task PronunciateCmd(IRibbonControl control)
=> await factory.Run<PronunciateCommand>();


[Command("ribRecalculateFormulaButton_Label", Keys.Shift | Keys.F5)]
[Command("ribRecalculateFormulaButton_Label", Keys.Shift | Keys.F5, "Tables")]
public async Task RecalculateFormulaCmd(IRibbonControl control)
=> await factory.Run<RecalculateFormulaCommand>();

Expand All @@ -412,7 +412,7 @@ public async Task RefreshPageLinksCmd(IRibbonControl control)
=> await factory.Run<RefreshPageLinksCommand>();


[Command("ribRemindButton_Label", Keys.F8)]
[Command("ribRemindButton_Label", Keys.F8, "Extras")]
public async Task RemindCmd(IRibbonControl control)
=> await factory.Run<RemindCommand>();

Expand All @@ -427,7 +427,7 @@ public async Task RemoveEmptyCmd(IRibbonControl control)
=> await factory.Run<RemoveEmptyCommand>();


[Command("ribFootnoteRemoveButton_Label", Keys.Control | Keys.Shift | Keys.F)]
[Command("ribFootnoteRemoveButton_Label", Keys.Control | Keys.Shift | Keys.F, "References")]
public async Task RemoveFootnoteCmd(IRibbonControl control)
=> await factory.Run<RemoveFootnoteCommand>();

Expand All @@ -448,7 +448,7 @@ public async Task RemoveTagsCmd(IRibbonControl control)
=> await factory.Run<RemoveTagsCommand>();


[Command("ribReplayButton_Label", Keys.Alt | Keys.Shift | Keys.R)]
[Command("ribReplayButton_Label", Keys.Alt | Keys.Shift | Keys.R, "")]
public async Task ReplayCmd(IRibbonControl control)
=> await factory.ReplayLastAction();

Expand Down Expand Up @@ -478,12 +478,12 @@ public async Task SaveSnippetCmd(IRibbonControl control)
=> await factory.Run<SaveSnippetCommand>();


[Command("ribSearchButton_Label", Keys.None)]
[Command("ribSearchButton_Label", Keys.None, "Search")]
public async Task SearchCmd(IRibbonControl control)
=> await factory.Run<SearchCommand>();


[Command("ribReplaceButton_Label", Keys.Control | Keys.H)]
[Command("ribReplaceButton_Label", Keys.Control | Keys.H, "Search")]
public async Task SearchAndReplaceCmd(IRibbonControl control)
=> await factory.Run<SearchAndReplaceCommand>();

Expand All @@ -510,7 +510,7 @@ public async Task ShowKeyboardShortcutsCmd(IRibbonControl control)
=> await factory.Run<ShowKeyboardShortcutsCommand>();


[Command("ribShowXmlButton_Label", Keys.Control | Keys.Alt | Keys.Shift | Keys.X)]
[Command("ribShowXmlButton_Label", Keys.Control | Keys.Alt | Keys.Shift | Keys.X, "Tools")]
public async Task ShowXmlCmd(IRibbonControl control)
=> await factory.Run<ShowXmlCommand>();

Expand Down Expand Up @@ -543,7 +543,7 @@ public async Task StartBiLinkCmd(IRibbonControl control)
=> await factory.Run<BiLinkCommand>("mark");


[Command("ribStartTimerButton_Label", Keys.Alt | Keys.F2)]
[Command("ribStartTimerButton_Label", Keys.Alt | Keys.F2, "Extras")]
public async Task StartTimerCmd(IRibbonControl control)
=> await factory.Run<TimerWindowCommand>();

Expand All @@ -552,12 +552,12 @@ public async Task StrikeoutCmd(IRibbonControl control)
=> await factory.Run<StrikeoutCommand>();


[Command("ribTaggedButton_Label", Keys.Control | Keys.Alt | Keys.T)]
[Command("ribTaggedButton_Label", Keys.Control | Keys.Alt | Keys.T, "Search")]
public async Task TaggedCmd(IRibbonControl control)
=> await factory.Run<TaggedCommand>();


[Command("ribTaggingButton_Label", Keys.Alt | Keys.T)]
[Command("ribTaggingButton_Label", Keys.Alt | Keys.T, "Search")]
public async Task TaggingCmd(IRibbonControl control)
=> await factory.Run<TaggingCommand>();

Expand All @@ -566,7 +566,7 @@ public async Task TextToTableCmd(IRibbonControl control)
=> await factory.Run<TextToTableCommand>();


[Command("ribLowercaseButton_Label", Keys.Control | Keys.Shift | Keys.U)]
[Command("ribLowercaseButton_Label", Keys.Control | Keys.Shift | Keys.U, "Editing")]
public async Task ToLowercaseCmd(IRibbonControl control)
=> await factory.Run<ToCaseCommand>(ToCaseCommand.Lowercase);

Expand All @@ -578,7 +578,7 @@ public async Task ToTitlecaseCmd(IRibbonControl control)
=> await factory.Run<ToCaseCommand>(ToCaseCommand.Titlecase);


[Command("ribUppercaseButton_Label", Keys.Control | Keys.Alt | Keys.Shift | Keys.U)]
[Command("ribUppercaseButton_Label", Keys.Control | Keys.Alt | Keys.Shift | Keys.U, "Editing")]
public async Task ToUppercaseCmd(IRibbonControl control)
=> await factory.Run<ToCaseCommand>(ToCaseCommand.Uppercase);

Expand Down
22 changes: 17 additions & 5 deletions OneMore/Commands/CommandAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,34 @@ namespace River.OneMoreAddIn
internal class CommandAttribute: Attribute
{

public CommandAttribute(string resID, Keys defaultKeys)
public CommandAttribute(string resID, Keys defaultKeys, string category)
{
ResID = resID;
DefaultKeys = defaultKeys;
Category = category;
}


/// <summary>
/// The resource ID specifying the display name of the command
/// Gets the name of the category with which the command is associated
/// </summary>
public string ResID { get; private set; }
/// <remarks>
/// This is not a resource ID but rather the exact name, used for building
/// the markdown for the Wiki keyboard reference page
/// </remarks>
public string Category { get; private set; }


/// <summary>
/// The default accelerator keys for the command
/// Gets the default accelerator keys for the command which can be overriden
/// by user settings
/// </summary>
public Keys DefaultKeys { get; private set; }
}


/// <summary>
/// Gets the resource ID specifying the display name of the command
/// </summary>
public string ResID { get; private set; }
}
}

0 comments on commit 0077f10

Please sign in to comment.