diff --git a/mac/Audacity.xcodeproj/project.pbxproj b/mac/Audacity.xcodeproj/project.pbxproj index 46f216954..d92d232ce 100644 --- a/mac/Audacity.xcodeproj/project.pbxproj +++ b/mac/Audacity.xcodeproj/project.pbxproj @@ -1267,6 +1267,7 @@ 5EF3E64F203FBAFB006C6882 /* Demo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5EF3E647203FBAFB006C6882 /* Demo.cpp */; }; 5EF3E650203FBAFB006C6882 /* GetInfoCommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5EF3E649203FBAFB006C6882 /* GetInfoCommand.cpp */; }; 5EF3E651203FBAFB006C6882 /* LoadCommands.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5EF3E64B203FBAFB006C6882 /* LoadCommands.cpp */; }; + 5EF3E653203FBBE0006C6882 /* CommandTargets.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5EF3E652203FBBE0006C6882 /* CommandTargets.cpp */; }; 5EF958851DEB121800191280 /* InconsistencyException.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5EF958831DEB121800191280 /* InconsistencyException.cpp */; }; 8406A93812D0F2510011EA01 /* EQDefaultCurves.xml in Resources */ = {isa = PBXBuildFile; fileRef = 8406A93712D0F2510011EA01 /* EQDefaultCurves.xml */; }; 8484F31413086237002DF7F0 /* DeviceManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8484F31213086237002DF7F0 /* DeviceManager.cpp */; }; @@ -3165,6 +3166,7 @@ 5EF3E64A203FBAFB006C6882 /* GetInfoCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GetInfoCommand.h; sourceTree = ""; }; 5EF3E64B203FBAFB006C6882 /* LoadCommands.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LoadCommands.cpp; sourceTree = ""; }; 5EF3E64C203FBAFB006C6882 /* LoadCommands.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LoadCommands.h; sourceTree = ""; }; + 5EF3E652203FBBE0006C6882 /* CommandTargets.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CommandTargets.cpp; sourceTree = ""; }; 5EF958831DEB121800191280 /* InconsistencyException.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InconsistencyException.cpp; sourceTree = ""; }; 5EF958841DEB121800191280 /* InconsistencyException.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InconsistencyException.h; sourceTree = ""; }; 82FF184D13CF01A600C1B664 /* dBTable.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = dBTable.cpp; path = sbsms/src/dBTable.cpp; sourceTree = ""; }; @@ -3764,6 +3766,7 @@ 28D540000FD1912A00FA7C75 /* CommandHandler.cpp */, 174D9026098C78AF00D5909F /* CommandManager.cpp */, 28851F9D1027F16400152EE1 /* CommandSignature.cpp */, + 5EF3E652203FBBE0006C6882 /* CommandTargets.cpp */, 28851F9F1027F16400152EE1 /* CommandType.cpp */, 28851FA11027F16400152EE1 /* CompareAudioCommand.cpp */, 5EF3E647203FBAFB006C6882 /* Demo.cpp */, @@ -7783,6 +7786,7 @@ 1790B19409883BFD008A330A /* TimeTrack.cpp in Sources */, 1790B19709883BFD008A330A /* Track.cpp in Sources */, 1790B19809883BFD008A330A /* TrackArtist.cpp in Sources */, + 5EF3E653203FBBE0006C6882 /* CommandTargets.cpp in Sources */, 1790B19909883BFD008A330A /* TrackPanel.cpp in Sources */, 5E667A601F0BEE5F00C942A5 /* WaveTrackVZoomHandle.cpp in Sources */, 1790B19A09883BFD008A330A /* TrackPanelAx.cpp in Sources */, diff --git a/src/commands/Command.cpp b/src/commands/Command.cpp index a100a8d81..592fd8f99 100644 --- a/src/commands/Command.cpp +++ b/src/commands/Command.cpp @@ -284,3 +284,14 @@ bool CommandImplementation::Apply(const CommandContext & WXUNUSED(context)) { return true; } + +// Hackery so that we dont have to update the makefiles on linux (yet) +#ifndef __WIN32__ +#ifndef __WXMAC__ + +#include "CommandTargets.cpp" + + +#endif +#endif + diff --git a/src/commands/CommandContext.cpp b/src/commands/CommandContext.cpp index 22822be2a..9b341df61 100644 --- a/src/commands/CommandContext.cpp +++ b/src/commands/CommandContext.cpp @@ -46,7 +46,8 @@ CommandContext::CommandContext( , const CommandParameter ¶m ) : project{ p } - , pOutput( nullptr ) + // No target specified? Use the special interactive one that pops up a dialog. + , pOutput( std::move( std::make_unique()) ) , pEvt{ e } , index{ ii } , parameter{ param } diff --git a/src/commands/CommandTargets.cpp b/src/commands/CommandTargets.cpp new file mode 100644 index 000000000..b2514fc35 --- /dev/null +++ b/src/commands/CommandTargets.cpp @@ -0,0 +1,158 @@ +/********************************************************************** + + Audacity - A Digital Audio Editor + Copyright 1999-2009 Audacity Team + License: wxwidgets + + Dan Horgan + +******************************************************************//** + +\file CommandTargets.cpp +\brief Contains definitions for CommandType class + +\class InteractiveOutputTarget +\brief InteractiveOutputTarget is an output target that pops up a +dialog, if necessary. + +*//*******************************************************************/ + +#include "../Audacity.h" +#include "CommandTargets.h" +#include +#include "../ShuttleGui.h" +#include "../Project.h" + + + +/// Dialog for long messages. +class AUDACITY_DLL_API LongMessageDialog /* not final */ : public wxDialogWrapper +{ +public: + // constructors and destructors + LongMessageDialog(wxWindow * parent, + const wxString & title, + int type = 0, + int flags = wxDEFAULT_DIALOG_STYLE, + int additionalButtons = 0); + ~LongMessageDialog(); + + bool Init(); + virtual void OnOk(wxCommandEvent & evt); + virtual void OnCancel(wxCommandEvent & evt); + + static void AcceptText( const wxString & Text ); + + wxTextCtrl * mText; + static LongMessageDialog * pDlg; +private: + int mType; + int mAdditionalButtons; + + DECLARE_EVENT_TABLE() + wxDECLARE_NO_COPY_CLASS(LongMessageDialog); +}; + + +LongMessageDialog * LongMessageDialog::pDlg = NULL; + + +BEGIN_EVENT_TABLE(LongMessageDialog, wxDialogWrapper) + EVT_BUTTON(wxID_OK, LongMessageDialog::OnOk) +END_EVENT_TABLE() + +LongMessageDialog::LongMessageDialog(wxWindow * parent, + const wxString & title, + int type, + int flags, + int additionalButtons) +: wxDialogWrapper(parent, wxID_ANY, title, wxDefaultPosition, wxDefaultSize, flags | wxRESIZE_BORDER) +{ + mType = type; + mAdditionalButtons = additionalButtons; +} + +LongMessageDialog::~LongMessageDialog(){ + pDlg = NULL; +} + + +bool LongMessageDialog::Init() +{ + ShuttleGui S(this, eIsCreating); + + S.SetBorder(5); + S.StartVerticalLay(true); + { + mText = S.AddTextWindow( "" ); + long buttons = eOkButton; + S.AddStandardButtons(buttons|mAdditionalButtons); + } + S.EndVerticalLay(); + + Layout(); + Fit(); + SetMinSize(wxSize(600,700)); + Center(); + return true; +} + +void LongMessageDialog::OnOk(wxCommandEvent & WXUNUSED(evt)){ + //Close(true); + Destroy(); +} + +void LongMessageDialog::OnCancel(wxCommandEvent & WXUNUSED(evt)){ + //Close(true); + Destroy(); +} + +void LongMessageDialog::AcceptText( const wxString & Text ) +{ + if( pDlg == NULL ){ + pDlg = new LongMessageDialog( GetActiveProject(), "Long Message" ); + pDlg->Init(); + pDlg->Show(); + } + pDlg->mText->SetValue( pDlg->mText->GetValue( ) + "\n" + Text ); +} + + + + + + +/// Displays messages from a command in an AudacityMessageBox +class MessageDialogTarget final : public CommandMessageTarget +{ +public: + virtual ~MessageDialogTarget() {} + void Update(const wxString &message) override + { + LongMessageDialog::AcceptText(message); + } +}; + + + +/// Extended Target Factory with more options. +class ExtTargetFactory : public TargetFactory +{ +public: + static std::shared_ptr LongMessages() + { + return std::make_shared(); + } + +}; + + + +InteractiveOutputTarget::InteractiveOutputTarget() : + CommandOutputTarget( + ExtTargetFactory::ProgressDefault(), + ExtTargetFactory::LongMessages(), + ExtTargetFactory::MessageDefault() + ) +{ +} diff --git a/src/commands/CommandTargets.h b/src/commands/CommandTargets.h index 6d4b1e5e6..423c58598 100644 --- a/src/commands/CommandTargets.h +++ b/src/commands/CommandTargets.h @@ -185,7 +185,7 @@ public: /// Assumes responsibility for pointers passed into it. class CommandOutputTarget { -private: +protected: std::unique_ptr mProgressTarget; std::shared_ptr mStatusTarget; std::shared_ptr mErrorTarget; @@ -215,4 +215,11 @@ public: } }; +class InteractiveOutputTarget : public CommandOutputTarget +{ +public: + InteractiveOutputTarget(); + +}; + #endif /* End of include guard: __COMMANDTARGETS__ */ diff --git a/src/commands/GetInfoCommand.cpp b/src/commands/GetInfoCommand.cpp index fc5be4fcd..96d87c3b5 100644 --- a/src/commands/GetInfoCommand.cpp +++ b/src/commands/GetInfoCommand.cpp @@ -52,10 +52,11 @@ enum { }; -const int nFormats =2; +const int nFormats =3; static const wxString kFormats[nFormats] = { XO("JSON"), + XO("LISP"), XO("Other") }; @@ -81,8 +82,8 @@ void GetInfoCommand::PopulateOrExchange(ShuttleGui & S) S.StartMultiColumn(2, wxALIGN_CENTER); { - S.TieChoice( _("Types:"), mInfoType, &types); - S.TieChoice( _("Formats:"), mFormat, &formats); + S.TieChoice( _("Type:"), mInfoType, &types); + S.TieChoice( _("Format:"), mFormat, &formats); } S.EndMultiColumn(); } diff --git a/win/Projects/Audacity/Audacity.vcxproj b/win/Projects/Audacity/Audacity.vcxproj index ddd3a2230..d1df20878 100755 --- a/win/Projects/Audacity/Audacity.vcxproj +++ b/win/Projects/Audacity/Audacity.vcxproj @@ -139,6 +139,7 @@ + diff --git a/win/Projects/Audacity/Audacity.vcxproj.filters b/win/Projects/Audacity/Audacity.vcxproj.filters index 5c5937b72..8fad169d7 100755 --- a/win/Projects/Audacity/Audacity.vcxproj.filters +++ b/win/Projects/Audacity/Audacity.vcxproj.filters @@ -1064,6 +1064,9 @@ src\commands + + src\commands +