From 894867d692e92a3893741b23dc0769b3c304ba5a Mon Sep 17 00:00:00 2001 From: James Crook Date: Sun, 16 Aug 2020 20:22:48 +0100 Subject: [PATCH] Bug 2295 - ENH: cannot add a comment in a Macro with Audacity Comments can now be added using the Comment command. --- src/commands/HelpCommand.cpp | 20 ++++++++++++++++++++ src/commands/HelpCommand.h | 20 ++++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/src/commands/HelpCommand.cpp b/src/commands/HelpCommand.cpp index ca855282a..2c2f5929f 100644 --- a/src/commands/HelpCommand.cpp +++ b/src/commands/HelpCommand.cpp @@ -27,7 +27,11 @@ const ComponentInterfaceSymbol HelpCommand::Symbol { XO("Help") }; +const ComponentInterfaceSymbol CommentCommand::Symbol +{ XO("Comment") }; + namespace{ BuiltinCommandsModule::Registration< HelpCommand > reg; } +namespace{ BuiltinCommandsModule::Registration< CommentCommand > reg2; } enum { kJson, @@ -103,3 +107,19 @@ bool HelpCommand::ApplyInner(const CommandContext & context){ return true; } +bool CommentCommand::DefineParams( ShuttleParams & S ){ + S.Define( mComment, wxT("_"), "" ); + return true; +} + +void CommentCommand::PopulateOrExchange(ShuttleGui & S) +{ + S.AddSpace(0, 5); + + S.StartMultiColumn(2, wxALIGN_CENTER); + { + S.TieTextBox(XXO("_"),mComment,80); + } + S.EndMultiColumn(); +} + diff --git a/src/commands/HelpCommand.h b/src/commands/HelpCommand.h index 41d9020d6..d3329bcc9 100644 --- a/src/commands/HelpCommand.h +++ b/src/commands/HelpCommand.h @@ -43,5 +43,25 @@ public: wxString mCommandName; }; +class CommentCommand : public AudacityCommand +{ +public: + static const ComponentInterfaceSymbol Symbol; + int mFormat; + + // ComponentInterface overrides + ComponentInterfaceSymbol GetSymbol() override {return Symbol;}; + TranslatableString GetDescription() override {return XO("For comments in a macro.");}; + bool DefineParams( ShuttleParams & S ) override; + void PopulateOrExchange(ShuttleGui & S) override; + bool Apply(const CommandContext & context) override { + return false; + }; + // AudacityCommand overrides + wxString ManualPage() override {return wxT("Extra_Menu:_Scriptables_II#comment");}; +public: + wxString mComment; +}; + #endif /* End of include guard: __HELPCOMMAND__ */