Automation: AudacityCommand

This is a squash of 50 commits.

This merges the capabilities of BatchCommands and Effects using a new
AudacityCommand class.  AudacityCommand provides one function to specify the
parameters, and then we leverage that one function in automation, whether by chains,
mod-script-pipe or (future) Nyquist.

- Now have AudacityCommand which is using the same mechanism as Effect
- Has configurable parameters
- Has data-entry GUI (built using shuttle GUI)
- Registers with PluginManager.
- Menu commands now provided in chains, and to python batch.
   - Tested with Zoom Toggle.

- ShuttleParams now can set, get, set defaults, validate and specify
the parameters.
- Bugfix: Don't overwrite values with defaults first time out.
- Add DefineParams function for all built-in effects.
- Extend CommandContext to carry output channels for results.

We abuse EffectsManager.  It handles both Effects and
AudacityCommands now.  In time an Effect should become a special case of
AudacityCommand and we'll split and rename the EffectManager class.

- Don't use 'default' as a parameter name.
- Massive renaming for CommandDefinitionInterface
- EffectIdentInterface becomes EffectDefinitionInterface
- EffectAutomationParameters becomes CommandAutomationParameters
- PluginType is now a bit field.

This way we can search for related types at the same time.

- Most old batch commands made into AudacityCommands.
The ones that weren't are for a reason.  They are used by mod-script-pipe
to carry commands and responses across from a non-GUI thread to the GUI
thread.

- Major tidy up of ScreenshotCommand
- Reworking of SelectCommand
- GetPreferenceCommand and SetPreferenceCommand
- GetTrackInfo and SetTrackInfo
- GetInfoCommand
- Help, Open, Save, Import and Export commands.
- Removed obsolete commands ExecMenu, GetProjectInfo and SetProjectInfo
  which are now better handled by other commands.

- JSONify "GetInfo: Commands" output, i.e. commas in the right places.

- General work on better Doxygen.
    - Lyrics -> LyricsPanel
    - Meter -> MeterPanel
- Updated Linux makefile.
- Scripting commands added into Extra menu.
- Distinct names for previously duplicated find-clipping parameters.
- Fixed longstanding error with erroneous status field number which
  previously caused an ASSERT in debug.
- Sensible formatting of numbers in Chains, 0.1 not 0.1000000000137
This commit is contained in:
James Crook 2018-01-14 18:51:41 +00:00 committed by Paul Licameli
parent b7b01d48e0
commit 1c988b4e3a
191 changed files with 4659 additions and 2768 deletions

View File

@ -1,7 +1,7 @@
# Makefile.in generated by automake 1.15 from Makefile.am.
# Makefile.in generated by automake 1.14.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2014 Free Software Foundation, Inc.
# Copyright (C) 1994-2013 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -16,17 +16,7 @@
VPATH = @srcdir@
am__is_gnu_make = { \
if test -z '$(MAKELEVEL)'; then \
false; \
elif test -n '$(MAKE_HOST)'; then \
true; \
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
true; \
else \
false; \
fi; \
}
am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
am__make_running_with_option = \
case $${target_option-} in \
?) ;; \
@ -90,6 +80,21 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
subdir = .
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(top_srcdir)/configure $(am__configure_deps) \
$(top_srcdir)/autotools/depcomp $(dist_doc_DATA) \
$(dist_pkgdata_DATA) $(nobase_dist_pkgdata_DATA) ABOUT-NLS \
INSTALL autotools/ar-lib autotools/compile \
autotools/config.guess autotools/config.rpath \
autotools/config.sub autotools/depcomp autotools/install-sh \
autotools/missing autotools/ltmain.sh \
$(top_srcdir)/autotools/ar-lib $(top_srcdir)/autotools/compile \
$(top_srcdir)/autotools/config.guess \
$(top_srcdir)/autotools/config.rpath \
$(top_srcdir)/autotools/config.sub \
$(top_srcdir)/autotools/install-sh \
$(top_srcdir)/autotools/ltmain.sh \
$(top_srcdir)/autotools/missing
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ac_c99_func_lrint.m4 \
$(top_srcdir)/m4/ac_c99_func_lrintf.m4 \
@ -132,9 +137,6 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ac_c99_func_lrint.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \
$(am__configure_deps) $(dist_doc_DATA) $(dist_pkgdata_DATA) \
$(nobase_dist_pkgdata_DATA) $(am__DIST_COMMON)
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
configure.lineno config.status.lineno
mkinstalldirs = $(install_sh) -d
@ -259,18 +261,6 @@ ETAGS = etags
CTAGS = ctags
CSCOPE = cscope
DIST_SUBDIRS = $(SUBDIRS)
am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/autotools/ar-lib \
$(top_srcdir)/autotools/compile \
$(top_srcdir)/autotools/config.guess \
$(top_srcdir)/autotools/config.rpath \
$(top_srcdir)/autotools/config.sub \
$(top_srcdir)/autotools/depcomp \
$(top_srcdir)/autotools/install-sh \
$(top_srcdir)/autotools/ltmain.sh \
$(top_srcdir)/autotools/missing ABOUT-NLS INSTALL \
autotools/ar-lib autotools/compile autotools/config.guess \
autotools/config.rpath autotools/config.sub autotools/depcomp \
autotools/install-sh autotools/ltmain.sh autotools/missing
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
@ -623,6 +613,7 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
@ -984,15 +975,15 @@ dist-xz: distdir
$(am__post_remove_distdir)
dist-tarZ: distdir
@echo WARNING: "Support for distribution archives compressed with" \
"legacy program 'compress' is deprecated." >&2
@echo WARNING: "Support for shar distribution archives is" \
"deprecated." >&2
@echo WARNING: "It will be removed altogether in Automake 2.0" >&2
tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
$(am__post_remove_distdir)
dist-shar: distdir
@echo WARNING: "Support for shar distribution archives is" \
"deprecated." >&2
@echo WARNING: "Support for distribution archives compressed with" \
"legacy program 'compress' is deprecated." >&2
@echo WARNING: "It will be removed altogether in Automake 2.0" >&2
shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
$(am__post_remove_distdir)
@ -1028,17 +1019,17 @@ distcheck: dist
esac
chmod -R a-w $(distdir)
chmod u+w $(distdir)
mkdir $(distdir)/_build $(distdir)/_build/sub $(distdir)/_inst
mkdir $(distdir)/_build $(distdir)/_inst
chmod a-w $(distdir)
test -d $(distdir)/_build || exit 0; \
dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
&& am__cwd=`pwd` \
&& $(am__cd) $(distdir)/_build/sub \
&& ../../configure \
&& $(am__cd) $(distdir)/_build \
&& ../configure \
$(AM_DISTCHECK_CONFIGURE_FLAGS) \
$(DISTCHECK_CONFIGURE_FLAGS) \
--srcdir=../.. --prefix="$$dc_install_base" \
--srcdir=.. --prefix="$$dc_install_base" \
&& $(MAKE) $(AM_MAKEFLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
&& $(MAKE) $(AM_MAKEFLAGS) check \
@ -1228,8 +1219,6 @@ uninstall-am: uninstall-binPROGRAMS uninstall-dist_docDATA \
uninstall-dist_docDATA uninstall-dist_pkgdataDATA \
uninstall-nobase_dist_pkgdataDATA
.PRECIOUS: Makefile
audacity$(EXEEXT): src/audacity$(EXEEXT)
rm -f audacity$(EXEEXT)

View File

@ -791,7 +791,9 @@ WARN_LOGFILE =
# Note: If this tag is empty the current directory is searched.
INPUT = src/ \
dox2-src/
dox2-src/ \
include/ \
lib-src/FileDialog/
# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
@ -2059,7 +2061,8 @@ INCLUDE_FILE_PATTERNS =
# recursively expanded use the := operator instead of the = operator.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
PREDEFINED =
PREDEFINED = AUDACITY_DLL_API \
=
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
# tag can be used to specify a list of macro names that should be expanded. The

13
configure vendored
View File

@ -2902,7 +2902,7 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
am__api_version='1.15'
am__api_version='1.14'
# Find a good install program. We prefer a C program (faster),
# so one script is as good as another. But avoid the broken or
@ -3074,8 +3074,8 @@ test "$program_suffix" != NONE &&
ac_script='s/[\\$]/&&/g;s/;s,x,x,$//'
program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"`
# Expand $ac_aux_dir to an absolute path.
am_aux_dir=`cd "$ac_aux_dir" && pwd`
# expand $ac_aux_dir to an absolute path
am_aux_dir=`cd $ac_aux_dir && pwd`
if test x"${MISSING+set}" != xset; then
case $am_aux_dir in
@ -3094,7 +3094,7 @@ else
$as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;}
fi
if test x"${install_sh+set}" != xset; then
if test x"${install_sh}" != xset; then
case $am_aux_dir in
*\ * | *\ *)
install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
@ -3422,8 +3422,8 @@ MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
mkdir_p='$(MKDIR_P)'
# We need awk for the "check" target (and possibly the TAP driver). The
# system "awk" is bad on some platforms.
# We need awk for the "check" target. The system "awk" is bad on
# some platforms.
# Always define AMTAR for backward compatibility. Yes, it's still used
# in the wild :-( We should find a proper way to deprecate it ...
AMTAR='$${TAR-tar}'
@ -3597,7 +3597,6 @@ END
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5
$as_echo_n "checking whether to enable maintainer-specific portions of Makefiles... " >&6; }
# Check whether --enable-maintainer-mode was given.

View File

@ -1,7 +1,7 @@
# Makefile.in generated by automake 1.15 from Makefile.am.
# Makefile.in generated by automake 1.14.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2014 Free Software Foundation, Inc.
# Copyright (C) 1994-2013 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -15,17 +15,7 @@
@SET_MAKE@
VPATH = @srcdir@
am__is_gnu_make = { \
if test -z '$(MAKELEVEL)'; then \
false; \
elif test -n '$(MAKE_HOST)'; then \
true; \
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
true; \
else \
false; \
fi; \
}
am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
am__make_running_with_option = \
case $${target_option-} in \
?) ;; \
@ -89,6 +79,8 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
subdir = help
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(dist_man_MANS) $(dist_appdata_DATA)
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ac_c99_func_lrint.m4 \
$(top_srcdir)/m4/ac_c99_func_lrintf.m4 \
@ -131,8 +123,6 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ac_c99_func_lrint.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am $(dist_appdata_DATA) \
$(am__DIST_COMMON)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/src/configwin.h \
$(top_builddir)/src/configunix.h
@ -190,7 +180,6 @@ NROFF = nroff
MANS = $(dist_man_MANS)
DATA = $(dist_appdata_DATA)
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
am__DIST_COMMON = $(dist_man_MANS) $(srcdir)/Makefile.in
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
@ -416,6 +405,7 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign help/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign help/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
@ -661,8 +651,6 @@ uninstall-man: uninstall-man1
tags-am uninstall uninstall-am uninstall-dist_appdataDATA \
uninstall-man uninstall-man1
.PRECIOUS: Makefile
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.

View File

@ -1,7 +1,7 @@
# Makefile.in generated by automake 1.15 from Makefile.am.
# Makefile.in generated by automake 1.14.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2014 Free Software Foundation, Inc.
# Copyright (C) 1994-2013 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -15,17 +15,7 @@
@SET_MAKE@
VPATH = @srcdir@
am__is_gnu_make = { \
if test -z '$(MAKELEVEL)'; then \
false; \
elif test -n '$(MAKE_HOST)'; then \
true; \
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
true; \
else \
false; \
fi; \
}
am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
am__make_running_with_option = \
case $${target_option-} in \
?) ;; \
@ -89,6 +79,10 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
subdir = images
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(dist_icons16_DATA) $(dist_icons22_DATA) $(dist_icons24_DATA) \
$(dist_icons32_DATA) $(dist_icons48_DATA) \
$(dist_iconsscalable_DATA) $(dist_pixmap_DATA)
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ac_c99_func_lrint.m4 \
$(top_srcdir)/m4/ac_c99_func_lrintf.m4 \
@ -131,10 +125,6 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ac_c99_func_lrint.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am $(dist_icons16_DATA) \
$(dist_icons22_DATA) $(dist_icons24_DATA) $(dist_icons32_DATA) \
$(dist_icons48_DATA) $(dist_iconsscalable_DATA) \
$(dist_pixmap_DATA) $(am__DIST_COMMON)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/src/configwin.h \
$(top_builddir)/src/configunix.h
@ -194,7 +184,6 @@ DATA = $(dist_icons16_DATA) $(dist_icons22_DATA) $(dist_icons24_DATA) \
$(dist_icons32_DATA) $(dist_icons48_DATA) \
$(dist_iconsscalable_DATA) $(dist_pixmap_DATA) $(pixmap_DATA)
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
am__DIST_COMMON = $(srcdir)/Makefile.in
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
@ -498,6 +487,7 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign images/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign images/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
@ -857,8 +847,6 @@ uninstall-am: uninstall-dist_icons16DATA uninstall-dist_icons22DATA \
uninstall-dist_iconsscalableDATA uninstall-dist_pixmapDATA \
uninstall-pixmapDATA
.PRECIOUS: Makefile
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.

View File

@ -42,6 +42,15 @@
#ifndef __AUDACITY_CONFIGINTERFACE_H__
#define __AUDACITY_CONFIGINTERFACE_H__
/*************************************************************************************//**
\class ConfigClientInterface
\brief ConfigClientInterface is an unholy get/set configuration class, which
differentiates between private and shared config. It should probably be replaced
with a Shuttle.
*******************************************************************************************/
class AUDACITY_DLL_API ConfigClientInterface /* not final */
{
public:
@ -84,11 +93,20 @@ public:
virtual bool RemovePrivateConfig(const wxString & group, const wxString & key) = 0;
};
#if 0
/*************************************************************************************//**
\class ConfigHostInterface
\brief ConfigHostInterface appears not to be used.
*******************************************************************************************/
class ConfigHostInterface
{
public:
virtual ~ConfigHostInterface() {};
};
#endif
#endif // __AUDACITY_CONFIGINTERFACE_H__

View File

@ -3,6 +3,7 @@
Audacity: A Digital Audio Editor
EffectAutomationParameters.h
(defining CommandAutomationParameters)
Leland Lucius
@ -39,8 +40,8 @@
**********************************************************************/
#ifndef __AUDACITY_EFFECTAUTOMATIONPARAMETERS_H__
#define __AUDACITY_EFFECTAUTOMATIONPARAMETERS_H__
#ifndef __AUDACITY_COMMAND_AUTOMATION_PARAMETERS_H__
#define __AUDACITY_COMMAND_AUTOMATION_PARAMETERS_H__
#include <locale.h>
@ -48,10 +49,22 @@
#include <wx/fileconf.h>
#include <wx/intl.h>
class EffectAutomationParameters : public wxFileConfig
/**
\brief CommandAutomationParameters, derived from wxFileConfig, is essentially doing
the same things as the Shuttle classes. It does text <-> binary conversions of
parameters. It does not seem to be using actual file read/writing.
Should it be converted to using Shuttle? Probably yes. Shuttle leads to shorter code.
And Shuttle is more multi-functional since Shuttle can report on signature, do the work of
wxWidget validators, and can create default dialogs. However until that conversion is
done, we need this class, and we use a pointer to one from within a Shuttle when interfacing
with the code that still uses it.
*/
class CommandAutomationParameters final : public wxFileConfig
{
public:
EffectAutomationParameters(const wxString & parms = wxEmptyString)
CommandAutomationParameters(const wxString & parms = wxEmptyString)
: wxFileConfig(wxEmptyString,
wxEmptyString,
wxEmptyString,
@ -61,7 +74,7 @@ public:
SetParameters(parms);
}
virtual ~EffectAutomationParameters()
virtual ~CommandAutomationParameters()
{
}
@ -114,7 +127,7 @@ public:
virtual bool DoWriteDouble(const wxString & key, double value) override
{
return DoWriteString(key, wxString::Format(wxT("%.12f"), value));
return DoWriteString(key, wxString::Format(wxT("%g"), value));
}
bool ReadFloat(const wxString & key, float *pf) const

View File

@ -45,7 +45,7 @@
#include "audacity/Types.h"
#include "audacity/IdentInterface.h"
#include "audacity/ConfigInterface.h"
#include "audacity/EffectAutomationParameters.h"
#include "audacity/EffectAutomationParameters.h" // for command automation
#include <wx/dialog.h>
@ -58,10 +58,35 @@ typedef enum EffectType
EffectTypeAnalyze
} EffectType;
class AUDACITY_DLL_API EffectIdentInterface /* not final */ : public IdentInterface
class ShuttleParams;
/*************************************************************************************//**
\class CommandDefinitionInterface
\brief CommandDefinitionInterface is an IdentInterface (to name the command) along with a
DefineParameters virtual function, that defines the parameters of the command.
*******************************************************************************************/
class AUDACITY_DLL_API CommandDefinitionInterface /* not final */ : public IdentInterface
{
public:
virtual ~EffectIdentInterface() {};
virtual ~CommandDefinitionInterface() {};
// returns true if implemented.
virtual bool DefineParams( ShuttleParams & WXUNUSED(S) ){ return false;};
};
/*************************************************************************************//**
\class EffectDefinitionInterface
\brief EffectDefinitionInterface is a CommandDefinitionInterface that additionally tracks
flag-functions for interactivity, play-preview and whether the effect can run without a GUI.
*******************************************************************************************/
class AUDACITY_DLL_API EffectDefinitionInterface /* not final */ : public CommandDefinitionInterface
{
public:
virtual ~EffectDefinitionInterface() {};
virtual EffectType GetType() = 0;
@ -94,6 +119,15 @@ public:
class EffectUIHostInterface;
class EffectUIClientInterface;
/*************************************************************************************//**
\class EffectHostInterface
\brief EffectHostInterface is a decorator of a EffectUIClientInterface. It adds
virtual (abstract) functions to get presets and actually apply the effect. It uses
ConfigClientInterface to add Getters/setters for private and shared configs.
*******************************************************************************************/
class AUDACITY_DLL_API EffectHostInterface /* not final */ : public ConfigClientInterface
{
public:
@ -116,7 +150,16 @@ public:
virtual wxString GetFactoryDefaultsGroup() = 0;
};
class AUDACITY_DLL_API EffectClientInterface /* not final */ : public EffectIdentInterface
/*************************************************************************************//**
\class EffectClientInterface
\brief EffectClientInterface provides the ident interface to Effect, and is what makes
Effect into a plug-in command. It has functions for realtime that are not part of
AudacityCommand.
*******************************************************************************************/
class AUDACITY_DLL_API EffectClientInterface /* not final */ : public EffectDefinitionInterface
{
public:
virtual ~EffectClientInterface() {};
@ -151,9 +194,15 @@ public:
virtual bool RealtimeProcessEnd() = 0;
virtual bool ShowInterface(wxWindow *parent, bool forceModal = false) = 0;
virtual bool GetAutomationParameters(EffectAutomationParameters & parms) = 0;
virtual bool SetAutomationParameters(EffectAutomationParameters & parms) = 0;
// Some effects will use define params to define what parameters they take.
// If they do, they won't need to implement Get or SetAutomation parameters.
// since the Effect class can do it. Or at least that is how things happen
// in AudacityCommand. IF we do the same in class Effect, then Effect maybe
// should derive by some route from AudacityCommand to pick up that
// functionality.
//virtual bool DefineParams( ShuttleParams & S){ return false;};
virtual bool GetAutomationParameters(CommandAutomationParameters & parms) = 0;
virtual bool SetAutomationParameters(CommandAutomationParameters & parms) = 0;
virtual bool LoadUserPreset(const wxString & name) = 0;
virtual bool SaveUserPreset(const wxString & name) = 0;
@ -163,12 +212,29 @@ public:
virtual bool LoadFactoryDefaults() = 0;
};
/*************************************************************************************//**
\class EffectUIHostInterface
\brief EffectUIHostInterface has nothing in it. It is provided so that an Effect
can call SetHostUI passing in a pointer to an EffectUIHostInterface. It contains no
functionality and is provided, apparently, for type checking. Since only EffectUIHost
uses it, EffectUIHost could be used instead.
*******************************************************************************************/
class AUDACITY_DLL_API EffectUIHostInterface
{
public:
virtual ~EffectUIHostInterface() {};
};
/*************************************************************************************//**
\class EffectUIClientInterface
\brief EffectUIClientInterface is an abstract base class to populate a UI and validate UI
values. It can import and export presets.
*******************************************************************************************/
class AUDACITY_DLL_API EffectUIClientInterface /* not final */
{
public:
@ -189,6 +255,15 @@ public:
virtual void ShowOptions() = 0;
};
/*************************************************************************************//**
\class EffectManagerInterface
\brief UNUSED. EffectManagerInterface provides a single function to find files matching
a pattern in a list.
*******************************************************************************************/
class AUDACITY_DLL_API EffectManagerInterface
{
public:

View File

@ -44,6 +44,11 @@
#include "audacity/Types.h"
/**************************************************************************//**
\brief IdentInterface provides name / vendor / version functions to identify
plugins. It is what makes a class a plug-in.
********************************************************************************/
class AUDACITY_DLL_API IdentInterface /* not final */
{
public:

View File

@ -120,11 +120,10 @@ public:
// Return value is the number of plugins found.
using RegistrationCallback =
std::function<
const PluginID &(ModuleInterface *, EffectIdentInterface *) >;
const PluginID &(ModuleInterface *, CommandDefinitionInterface *) >;
virtual unsigned DiscoverPluginsAtPath(
const wxString & path, wxString &errMsg,
const RegistrationCallback &callback =
PluginManagerInterface::DefaultRegistrationCallback)
const RegistrationCallback &callback )
= 0;
// For modules providing an interface to other dynamically loaded plugins,

View File

@ -48,19 +48,23 @@
#include "audacity/ImporterInterface.h"
#include "audacity/ModuleInterface.h"
class ModuleInterface;
class PluginManagerInterface /* not final */
{
public:
static const PluginID &DefaultRegistrationCallback(
ModuleInterface *provider, EffectIdentInterface *ident );
ModuleInterface *provider, CommandDefinitionInterface *ident );
static const PluginID &GenericRegistrationCallback(
ModuleInterface *provider, CommandDefinitionInterface *ident );
virtual bool IsPluginRegistered(const wxString & path) = 0;
virtual const PluginID & RegisterPlugin(ModuleInterface *module) = 0;
virtual const PluginID & RegisterPlugin(ModuleInterface *provider, EffectIdentInterface *effect) = 0;
virtual const PluginID & RegisterPlugin(ModuleInterface *provider, EffectDefinitionInterface *effect, int type) = 0;
virtual const PluginID & RegisterPlugin(ModuleInterface *provider, ImporterInterface *importer) = 0;
virtual void FindFilesInPathList(const wxString & pattern,

View File

@ -21,7 +21,11 @@ custom controls.
#include <wx/filectrl.h>
#include <wx/filedlg.h>
class FileDialogBase : public wxFileDialogBase
#ifndef AUDACITY_DLL_API
#define AUDACITY_DLL_API
#endif
class AUDACITY_DLL_API FileDialogBase : public wxFileDialogBase
{
public:
FileDialogBase();

View File

@ -22,7 +22,7 @@
// FileDialog
//-------------------------------------------------------------------------
class FileDialog : public FileDialogBase
class AUDACITY_DLL_API FileDialog : public FileDialogBase
{
public:
FileDialog();

View File

@ -1,7 +1,7 @@
# Makefile.in generated by automake 1.15 from Makefile.am.
# Makefile.in generated by automake 1.14.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2014 Free Software Foundation, Inc.
# Copyright (C) 1994-2013 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -14,17 +14,7 @@
@SET_MAKE@
VPATH = @srcdir@
am__is_gnu_make = { \
if test -z '$(MAKELEVEL)'; then \
false; \
elif test -n '$(MAKE_HOST)'; then \
true; \
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
true; \
else \
false; \
fi; \
}
am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
am__make_running_with_option = \
case $${target_option-} in \
?) ;; \
@ -87,6 +77,9 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
DIST_COMMON = $(srcdir)/dist-libsoxr.mk $(srcdir)/dist-libvamp.mk \
$(srcdir)/dist-portaudio.mk $(srcdir)/Makefile.in \
$(srcdir)/Makefile.am
@USE_LOCAL_EXPAT_TRUE@am__append_1 = expat
@USE_LOCAL_LIBID3TAG_TRUE@am__append_2 = libid3tag
@USE_LOCAL_LIBMAD_TRUE@am__append_3 = libmad
@ -149,7 +142,6 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ac_c99_func_lrint.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/src/configwin.h \
$(top_builddir)/src/configunix.h
@ -209,8 +201,6 @@ am__define_uniq_tagged_files = \
done | $(am__uniquify_input)`
ETAGS = etags
CTAGS = ctags
am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/dist-libsoxr.mk \
$(srcdir)/dist-libvamp.mk $(srcdir)/dist-portaudio.mk
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
am__relativize = \
dir0=`pwd`; \
@ -978,6 +968,7 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/di
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign lib-src/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign lib-src/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
@ -986,7 +977,7 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(srcdir)/dist-libsoxr.mk $(srcdir)/dist-libvamp.mk $(srcdir)/dist-portaudio.mk $(am__empty):
$(srcdir)/dist-libsoxr.mk $(srcdir)/dist-libvamp.mk $(srcdir)/dist-portaudio.mk:
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
@ -1254,8 +1245,6 @@ uninstall-am:
mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
ps ps-am tags tags-am uninstall uninstall-am
.PRECIOUS: Makefile
# Overwrite install* targets from automake. We do not want to install anything
# from the lib-src libraries, because we statically link these libraries.

View File

@ -486,8 +486,6 @@
2840CF760AEB807E00F49FC3 /* util.h in Headers */ = {isa = PBXBuildFile; fileRef = 2840CF4C0AEB807E00F49FC3 /* util.h */; };
2840CF860AEB83DB00F49FC3 /* ExportMP2.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2840CF840AEB83DB00F49FC3 /* ExportMP2.cpp */; };
2840CFA80AEB883500F49FC3 /* libtwolame.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2840CF220AEB803C00F49FC3 /* libtwolame.a */; };
284249EE10D337CE004330A6 /* GetProjectInfoCommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 284249EA10D337CE004330A6 /* GetProjectInfoCommand.cpp */; };
284249EF10D337CE004330A6 /* SetProjectInfoCommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 284249EC10D337CE004330A6 /* SetProjectInfoCommand.cpp */; };
28456AC20A2C180E00C23C1E /* ThemePrefs.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 28456AC00A2C180E00C23C1E /* ThemePrefs.cpp */; };
284750541AD4EB84000AD751 /* common.h in Headers */ = {isa = PBXBuildFile; fileRef = 2847504D1AD4EB84000AD751 /* common.h */; };
284750551AD4EB84000AD751 /* digest.c in Sources */ = {isa = PBXBuildFile; fileRef = 2847504E1AD4EB84000AD751 /* digest.c */; };
@ -887,7 +885,6 @@
28BB98051A15BE6800D1CC80 /* NoiseReduction.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 28BB98031A15BE6800D1CC80 /* NoiseReduction.cpp */; };
28BD8AB1101DF4C700686679 /* BatchEvalCommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 28BD8AA9101DF4C600686679 /* BatchEvalCommand.cpp */; };
28BD8AB2101DF4C700686679 /* CommandDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 28BD8AAA101DF4C600686679 /* CommandDirectory.cpp */; };
28BD8AB3101DF4C700686679 /* ExecMenuCommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 28BD8AAC101DF4C600686679 /* ExecMenuCommand.cpp */; };
28C3946D1818356800FDDAC9 /* AudacityLogger.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 28C3946B1818356800FDDAC9 /* AudacityLogger.cpp */; };
28C816BA131255790035BB10 /* Audacity.sh in Install wrapper */ = {isa = PBXBuildFile; fileRef = 28C816B81312555B0035BB10 /* Audacity.sh */; };
28C8211D1B5C661E00B53328 /* ViewInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 28C8211C1B5C661E00B53328 /* ViewInfo.cpp */; };
@ -1265,8 +1262,12 @@
5ED1D0AE1CDE55BD00471E3C /* OverlayPanel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5ED1D0AB1CDE55BD00471E3C /* OverlayPanel.cpp */; };
5ED1D0B11CDE560C00471E3C /* BackedPanel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5ED1D0AF1CDE560C00471E3C /* BackedPanel.cpp */; };
5EF17C231D1F0A690090A642 /* ScrubbingToolBar.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5EF17C211D1F0A690090A642 /* ScrubbingToolBar.cpp */; };
5EF3E64D203FBAFB006C6882 /* AudacityCommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5EF3E643203FBAFB006C6882 /* AudacityCommand.cpp */; };
5EF3E64E203FBAFB006C6882 /* CommandContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5EF3E645203FBAFB006C6882 /* CommandContext.cpp */; };
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 */; };
5EF958851DEB121800191280 /* InconsistencyException.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5EF958831DEB121800191280 /* InconsistencyException.cpp */; };
65BD96CF200150D5004090BD /* AutomationCommands.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65BD96CD200150D5004090BD /* AutomationCommands.cpp */; };
8406A93812D0F2510011EA01 /* EQDefaultCurves.xml in Resources */ = {isa = PBXBuildFile; fileRef = 8406A93712D0F2510011EA01 /* EQDefaultCurves.xml */; };
8484F31413086237002DF7F0 /* DeviceManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8484F31213086237002DF7F0 /* DeviceManager.cpp */; };
AA0084191EA8C6E70070CCE3 /* TracksBehaviorsPrefs.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AA0084181EA8C6E70070CCE3 /* TracksBehaviorsPrefs.cpp */; };
@ -2227,10 +2228,6 @@
2840CF4C0AEB807E00F49FC3 /* util.h */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 3; lastKnownFileType = sourcecode.c.h; name = util.h; path = twolame/libtwolame/util.h; sourceTree = "<group>"; tabWidth = 3; };
2840CF840AEB83DB00F49FC3 /* ExportMP2.cpp */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 3; lastKnownFileType = sourcecode.cpp.cpp; path = ExportMP2.cpp; sourceTree = "<group>"; tabWidth = 3; };
2840CF850AEB83DB00F49FC3 /* ExportMP2.h */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 3; lastKnownFileType = sourcecode.c.h; path = ExportMP2.h; sourceTree = "<group>"; tabWidth = 3; };
284249EA10D337CE004330A6 /* GetProjectInfoCommand.cpp */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 3; lastKnownFileType = sourcecode.cpp.cpp; path = GetProjectInfoCommand.cpp; sourceTree = "<group>"; tabWidth = 3; };
284249EB10D337CE004330A6 /* GetProjectInfoCommand.h */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 3; lastKnownFileType = sourcecode.c.h; path = GetProjectInfoCommand.h; sourceTree = "<group>"; tabWidth = 3; };
284249EC10D337CE004330A6 /* SetProjectInfoCommand.cpp */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 3; lastKnownFileType = sourcecode.cpp.cpp; path = SetProjectInfoCommand.cpp; sourceTree = "<group>"; tabWidth = 3; };
284249ED10D337CE004330A6 /* SetProjectInfoCommand.h */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 3; lastKnownFileType = sourcecode.c.h; path = SetProjectInfoCommand.h; sourceTree = "<group>"; tabWidth = 3; };
284416391B82D6BC0000574D /* TranslatableStringArray.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TranslatableStringArray.h; sourceTree = "<group>"; };
2844163A1B82D6BC0000574D /* WaveTrackLocation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WaveTrackLocation.h; sourceTree = "<group>"; };
28456AC00A2C180E00C23C1E /* ThemePrefs.cpp */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 3; lastKnownFileType = sourcecode.cpp.cpp; path = ThemePrefs.cpp; sourceTree = "<group>"; tabWidth = 3; };
@ -2694,8 +2691,6 @@
28BD8AA9101DF4C600686679 /* BatchEvalCommand.cpp */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 3; lastKnownFileType = sourcecode.cpp.cpp; path = BatchEvalCommand.cpp; sourceTree = "<group>"; tabWidth = 3; };
28BD8AAA101DF4C600686679 /* CommandDirectory.cpp */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 3; lastKnownFileType = sourcecode.cpp.cpp; path = CommandDirectory.cpp; sourceTree = "<group>"; tabWidth = 3; };
28BD8AAB101DF4C600686679 /* CommandDirectory.h */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 3; lastKnownFileType = sourcecode.c.h; path = CommandDirectory.h; sourceTree = "<group>"; tabWidth = 3; };
28BD8AAC101DF4C600686679 /* ExecMenuCommand.cpp */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 3; lastKnownFileType = sourcecode.cpp.cpp; path = ExecMenuCommand.cpp; sourceTree = "<group>"; tabWidth = 3; };
28BD8AAD101DF4C600686679 /* ExecMenuCommand.h */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 3; lastKnownFileType = sourcecode.c.h; path = ExecMenuCommand.h; sourceTree = "<group>"; tabWidth = 3; };
28BD8AB0101DF4C600686679 /* Validators.h */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 3; lastKnownFileType = sourcecode.c.h; path = Validators.h; sourceTree = "<group>"; tabWidth = 3; };
28C3946B1818356800FDDAC9 /* AudacityLogger.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AudacityLogger.cpp; sourceTree = "<group>"; };
28C3946C1818356800FDDAC9 /* AudacityLogger.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AudacityLogger.h; sourceTree = "<group>"; };
@ -3160,10 +3155,18 @@
5ED1D0B01CDE560C00471E3C /* BackedPanel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BackedPanel.h; sourceTree = "<group>"; };
5EF17C211D1F0A690090A642 /* ScrubbingToolBar.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScrubbingToolBar.cpp; sourceTree = "<group>"; };
5EF17C221D1F0A690090A642 /* ScrubbingToolBar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScrubbingToolBar.h; sourceTree = "<group>"; };
5EF3E643203FBAFB006C6882 /* AudacityCommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AudacityCommand.cpp; sourceTree = "<group>"; };
5EF3E644203FBAFB006C6882 /* AudacityCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AudacityCommand.h; sourceTree = "<group>"; };
5EF3E645203FBAFB006C6882 /* CommandContext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CommandContext.cpp; sourceTree = "<group>"; };
5EF3E646203FBAFB006C6882 /* CommandContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CommandContext.h; sourceTree = "<group>"; };
5EF3E647203FBAFB006C6882 /* Demo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Demo.cpp; sourceTree = "<group>"; };
5EF3E648203FBAFB006C6882 /* Demo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Demo.h; sourceTree = "<group>"; };
5EF3E649203FBAFB006C6882 /* GetInfoCommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GetInfoCommand.cpp; sourceTree = "<group>"; };
5EF3E64A203FBAFB006C6882 /* GetInfoCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GetInfoCommand.h; sourceTree = "<group>"; };
5EF3E64B203FBAFB006C6882 /* LoadCommands.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LoadCommands.cpp; sourceTree = "<group>"; };
5EF3E64C203FBAFB006C6882 /* LoadCommands.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LoadCommands.h; sourceTree = "<group>"; };
5EF958831DEB121800191280 /* InconsistencyException.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InconsistencyException.cpp; sourceTree = "<group>"; };
5EF958841DEB121800191280 /* InconsistencyException.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InconsistencyException.h; sourceTree = "<group>"; };
65BD96CD200150D5004090BD /* AutomationCommands.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AutomationCommands.cpp; sourceTree = "<group>"; };
65BD96CE200150D5004090BD /* AutomationCommands.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AutomationCommands.h; sourceTree = "<group>"; };
82FF184D13CF01A600C1B664 /* dBTable.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = dBTable.cpp; path = sbsms/src/dBTable.cpp; sourceTree = "<group>"; };
82FF184E13CF01A600C1B664 /* dBTable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = dBTable.h; path = sbsms/src/dBTable.h; sourceTree = "<group>"; };
82FF184F13CF01A600C1B664 /* slide.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = slide.cpp; path = sbsms/src/slide.cpp; sourceTree = "<group>"; };
@ -3751,23 +3754,25 @@
174D9025098C78AF00D5909F /* commands */ = {
isa = PBXGroup;
children = (
65BD96CD200150D5004090BD /* AutomationCommands.cpp */,
28D53FFA0FD1912A00FA7C75 /* AppCommandEvent.cpp */,
5EF3E643203FBAFB006C6882 /* AudacityCommand.cpp */,
28BD8AA9101DF4C600686679 /* BatchEvalCommand.cpp */,
28851F9C1027F16400152EE1 /* Command.cpp */,
28D53FFE0FD1912A00FA7C75 /* CommandBuilder.cpp */,
5EF3E645203FBAFB006C6882 /* CommandContext.cpp */,
28BD8AAA101DF4C600686679 /* CommandDirectory.cpp */,
28D540000FD1912A00FA7C75 /* CommandHandler.cpp */,
174D9026098C78AF00D5909F /* CommandManager.cpp */,
28851F9D1027F16400152EE1 /* CommandSignature.cpp */,
28851F9F1027F16400152EE1 /* CommandType.cpp */,
28851FA11027F16400152EE1 /* CompareAudioCommand.cpp */,
28BD8AAC101DF4C600686679 /* ExecMenuCommand.cpp */,
284249EA10D337CE004330A6 /* GetProjectInfoCommand.cpp */,
5EF3E647203FBAFB006C6882 /* Demo.cpp */,
5EF3E649203FBAFB006C6882 /* GetInfoCommand.cpp */,
28851FA31027F16400152EE1 /* GetTrackInfoCommand.cpp */,
28851FA51027F16400152EE1 /* HelpCommand.cpp */,
EDD94ED9103CB520000873F1 /* ImportExportCommands.cpp */,
174D902A098C78AF00D5909F /* Keyboard.cpp */,
5EF3E64B203FBAFB006C6882 /* LoadCommands.cpp */,
28851FA71027F16400152EE1 /* MessageCommand.cpp */,
EDFCEB9A18894AE600C98E51 /* OpenSaveCommands.cpp */,
28DE72AA10388583007E18EC /* PreferenceCommands.cpp */,
@ -3775,13 +3780,13 @@
181855950FFE916C0026D190 /* ScreenshotCommand.cpp */,
28D540030FD1912A00FA7C75 /* ScriptCommandRelay.cpp */,
28851FA91027F16400152EE1 /* SelectCommand.cpp */,
284249EC10D337CE004330A6 /* SetProjectInfoCommand.cpp */,
28DE72AC10388583007E18EC /* SetTrackInfoCommand.cpp */,
65BD96CE200150D5004090BD /* AutomationCommands.h */,
28D53FFB0FD1912A00FA7C75 /* AppCommandEvent.h */,
5EF3E644203FBAFB006C6882 /* AudacityCommand.h */,
28D53FFC0FD1912A00FA7C75 /* BatchEvalCommand.h */,
28D53FFD0FD1912A00FA7C75 /* Command.h */,
28D53FFF0FD1912A00FA7C75 /* CommandBuilder.h */,
5EF3E646203FBAFB006C6882 /* CommandContext.h */,
28BD8AAB101DF4C600686679 /* CommandDirectory.h */,
5E7838931DE4BBC2003270C0 /* CommandFlag.h */,
5E4685F81CCA9D84008741F2 /* CommandFunctors.h */,
@ -3792,12 +3797,13 @@
181855900FFE916C0026D190 /* CommandTargets.h */,
28851FA01027F16400152EE1 /* CommandType.h */,
28851FA21027F16400152EE1 /* CompareAudioCommand.h */,
28BD8AAD101DF4C600686679 /* ExecMenuCommand.h */,
284249EB10D337CE004330A6 /* GetProjectInfoCommand.h */,
5EF3E648203FBAFB006C6882 /* Demo.h */,
5EF3E64A203FBAFB006C6882 /* GetInfoCommand.h */,
28851FA41027F16400152EE1 /* GetTrackInfoCommand.h */,
28851FA61027F16400152EE1 /* HelpCommand.h */,
EDD94EDA103CB520000873F1 /* ImportExportCommands.h */,
174D902B098C78AF00D5909F /* Keyboard.h */,
5EF3E64C203FBAFB006C6882 /* LoadCommands.h */,
28851FA81027F16400152EE1 /* MessageCommand.h */,
EDFCEB9B18894AE600C98E51 /* OpenSaveCommands.h */,
28DE72AB10388583007E18EC /* PreferenceCommands.h */,
@ -3805,7 +3811,6 @@
181855960FFE916C0026D190 /* ScreenshotCommand.h */,
28D540040FD1912A00FA7C75 /* ScriptCommandRelay.h */,
28851FAA1027F16400152EE1 /* SelectCommand.h */,
284249ED10D337CE004330A6 /* SetProjectInfoCommand.h */,
28DE72AD10388583007E18EC /* SetTrackInfoCommand.h */,
28BD8AB0101DF4C600686679 /* Validators.h */,
);
@ -7745,6 +7750,7 @@
1790B17009883BFD008A330A /* Internat.cpp in Sources */,
1790B17109883BFD008A330A /* LabelTrack.cpp in Sources */,
1790B17309883BFD008A330A /* LangChoice.cpp in Sources */,
5EF3E651203FBAFB006C6882 /* LoadCommands.cpp in Sources */,
282B70331B682342009A1618 /* WaveformPrefs.cpp in Sources */,
1790B17409883BFD008A330A /* Languages.cpp in Sources */,
1790B17509883BFD008A330A /* Legacy.cpp in Sources */,
@ -7831,6 +7837,7 @@
2897F6F40AB3DB5A003C20C5 /* SelectionBar.cpp in Sources */,
2897F6F50AB3DB5A003C20C5 /* ToolBar.cpp in Sources */,
2897F6F60AB3DB5A003C20C5 /* ToolDock.cpp in Sources */,
5EF3E64E203FBAFB006C6882 /* CommandContext.cpp in Sources */,
2897F6F70AB3DB5A003C20C5 /* ToolManager.cpp in Sources */,
2897F6F80AB3DB5A003C20C5 /* ToolsToolBar.cpp in Sources */,
2897F6F90AB3DB5A003C20C5 /* TranscriptionToolBar.cpp in Sources */,
@ -7923,7 +7930,6 @@
28BD8AB1101DF4C700686679 /* BatchEvalCommand.cpp in Sources */,
28BD8AB2101DF4C700686679 /* CommandDirectory.cpp in Sources */,
5E10D9061EC8F81300B3AC57 /* PlayableTrackButtonHandles.cpp in Sources */,
28BD8AB3101DF4C700686679 /* ExecMenuCommand.cpp in Sources */,
28948427101DF8FC005B0713 /* EffectsPrefs.cpp in Sources */,
287E207F102561F300BF47A2 /* PluginManager.cpp in Sources */,
5E7396501DAFD98400BA0A4D /* SliderHandle.cpp in Sources */,
@ -7941,11 +7947,10 @@
28DE72AF10388583007E18EC /* SetTrackInfoCommand.cpp in Sources */,
28DE72B2103885AA007E18EC /* TimeWarper.cpp in Sources */,
EDD94EDB103CB520000873F1 /* ImportExportCommands.cpp in Sources */,
284249EE10D337CE004330A6 /* GetProjectInfoCommand.cpp in Sources */,
284249EF10D337CE004330A6 /* SetProjectInfoCommand.cpp in Sources */,
18CE3C951145511200282C50 /* ODDecodeFFmpegTask.cpp in Sources */,
ED90976D116CAD49002F7479 /* ExtImportPrefs.cpp in Sources */,
ED64C823124567ED007CF2FC /* ScoreAlignDialog.cpp in Sources */,
5EF3E650203FBAFB006C6882 /* GetInfoCommand.cpp in Sources */,
8484F31413086237002DF7F0 /* DeviceManager.cpp in Sources */,
5EBD243D1F74C50800132E0A /* eu_ES.po in Sources */,
5EBD35861F78D37A0084D13F /* pt_PT.po in Sources */,
@ -7956,6 +7961,7 @@
28884945131B6CF600B59735 /* be.po in Sources */,
28884946131B6CF600B59735 /* bg.po in Sources */,
28884947131B6CF600B59735 /* bn.po in Sources */,
5EF3E64D203FBAFB006C6882 /* AudacityCommand.cpp in Sources */,
AA0084191EA8C6E70070CCE3 /* TracksBehaviorsPrefs.cpp in Sources */,
28884948131B6CF600B59735 /* bs.po in Sources */,
28884949131B6CF600B59735 /* ca.po in Sources */,
@ -7995,6 +8001,7 @@
28884969131B6CF600B59735 /* ro.po in Sources */,
2888496A131B6CF600B59735 /* ru.po in Sources */,
2888496B131B6CF600B59735 /* sk.po in Sources */,
5EF3E64F203FBAFB006C6882 /* Demo.cpp in Sources */,
EDAD326B1544452E009C6220 /* sl.po in Sources */,
EDAD326C1544452E009C6220 /* sr_RS.po in Sources */,
EDAD326D1544452E009C6220 /* sr_RS@latin.po in Sources */,
@ -8008,7 +8015,6 @@
28884971131B6CF600B59735 /* vi.po in Sources */,
289D127A1B44D57F00B5B6AA /* VSTControlOSX.mm in Sources */,
28884972131B6CF600B59735 /* zh_TW.po in Sources */,
65BD96CF200150D5004090BD /* AutomationCommands.cpp in Sources */,
EDF3B7B01588C0D50032D35F /* Paulstretch.cpp in Sources */,
ED920CAF15B19F61008CA12C /* ModulePrefs.cpp in Sources */,
EDD2431416934A6100D9DEC2 /* BassTreble.cpp in Sources */,

View File

@ -64,8 +64,8 @@ def do( command ) :
doCommand( command )
def quickTest() :
do( 'Help: CommandName=Help' )
do( 'Help: CommandName=SetPreference' )
do( 'SetPreference: PrefName=GUI/Theme PrefValue=light' )
do( 'Help: Command=Help' )
do( 'Help: Command="SetTrackInfo"' )
do( 'SetPreference: Name=GUI/Theme Value=light Reload=false' )
quickTest()

View File

@ -68,6 +68,7 @@ It handles initialization and termination by subclassing wxApp.
#include "DirManager.h"
#include "commands/CommandHandler.h"
#include "commands/AppCommandEvent.h"
#include "commands/CommandContext.h"
#include "effects/Contrast.h"
#include "widgets/ASlider.h"
#include "FFmpeg.h"
@ -1643,7 +1644,7 @@ bool AudacityApp::OnInit()
void AudacityApp::InitCommandHandler()
{
mCmdHandler = std::make_unique<CommandHandler>(*this);
mCmdHandler = std::make_unique<CommandHandler>();
//SetNextHandler(mCmdHandler);
}

View File

@ -44,6 +44,9 @@ See also BatchCommandDialog and BatchProcessDialog.
#include "Track.h"
#include "widgets/ErrorDialog.h"
#include "commands/CommandFunctors.h"
#include "commands/CommandContext.h"
// KLUDGE: All commands should be on the same footing
// however, for historical reasons we distinguish between
// - Effects (which are looked up in effects lists)
@ -153,23 +156,6 @@ bool BatchCommands::ReadChain(const wxString & chain)
wxString cmd = tf[i].Left(splitAt).Strip(wxString::both);
wxString parm = tf[i].Mid(splitAt + 1).Strip(wxString::trailing);
// Backward compatibility for old Chain scripts
// Please comment the version of audacity these are introduced in, so
// that old ones can easily be removed once users have had a chance to
// migrate
if (cmd == wxT("SaveMP3_56k_before"))
cmd = wxT("ExportMP3_56k_before");
else if (cmd == wxT("SaveMP3_56k_after"))
cmd = wxT("ExportMP3_56k_after");
else if (cmd == wxT("ExportFlac"))
cmd = wxT("ExportFLAC");
else if (cmd == wxT("ExportMp3"))
cmd = wxT("ExportMP3");
else if (cmd == wxT("ExportWav"))
cmd = wxT("ExportWAV");
else if (cmd == wxT("Compressor") && (parm.find(wxT("DecayTime")) != parm.npos))
parm.Replace(wxT("DecayTime"), wxT("ReleaseTime"), NULL); // 2.0.6
// Add to lists
mCommandChain.Add(cmd);
mParamsChain.Add(parm);
@ -210,18 +196,6 @@ bool BatchCommands::WriteChain(const wxString & chain)
// Copy over the commands
int lines = mCommandChain.GetCount();
for (int i = 0; i < lines; i++) {
// restore deprecated commands in chain script
if (mCommandChain[i] == wxT("ExportMP3_56k_before"))
mCommandChain[i] = wxT("SaveMP3_56k_before");
else if (mCommandChain[i] == wxT("ExportMP3_56k_after"))
mCommandChain[i] = wxT("SaveMP3_56k_after");
else if (mCommandChain[i] == wxT("ExportFLAC"))
mCommandChain[i] = wxT("ExportFlac");
else if (mCommandChain[i] == wxT("ExportMP3"))
mCommandChain[i] = wxT("ExportMp3");
else if (mCommandChain[i] == wxT("ExportWAV"))
mCommandChain[i] = wxT("ExportWav");
tf.AddLine(mCommandChain[i] + wxT(":") + mParamsChain[ i ]);
}
@ -294,16 +268,37 @@ auto BatchCommands::GetAllCommands() -> CommandNameVector
PluginManager & pm = PluginManager::Get();
EffectManager & em = EffectManager::Get();
const PluginDescriptor *plug = pm.GetFirstPlugin(PluginTypeEffect);
while (plug)
{
auto command = em.GetEffectIdentifier(plug->GetID());
if (!command.IsEmpty())
commands.push_back( {
plug->GetUntranslatedName(), // plug->GetTranslatedName(),
command
} );
plug = pm.GetNextPlugin(PluginTypeEffect);
const PluginDescriptor *plug = pm.GetFirstPlugin(PluginTypeEffect|PluginTypeGeneric);
while (plug)
{
auto command = em.GetCommandIdentifier(plug->GetID());
if (!command.IsEmpty())
commands.push_back( {
plug->GetUntranslatedName(), // plug->GetTranslatedName(),
command
} );
plug = pm.GetNextPlugin(PluginTypeEffect|PluginTypeGeneric);
}
}
CommandManager * mManager = project->GetCommandManager();
wxArrayString mLabels;
wxArrayString mNames;
mLabels.Clear();
mNames.Clear();
mManager->GetAllCommandLabels(mLabels, false);
mManager->GetAllCommandNames(mNames, false);
for(size_t i=0; i<mNames.GetCount(); i++) {
if( !mLabels[i].Contains( "..." ) ){
mLabels[i].Replace( "&", "" );
commands.push_back(
{
mLabels[i] + " (" + mNames[i] + ")", // User readable name
mNames[i] // Internal name.
}
);
}
}
// Sort commands by their user-visible names.
@ -315,15 +310,8 @@ auto BatchCommands::GetAllCommands() -> CommandNameVector
{ return a.first < b.first; }
);
/* This is for later in development: include the menu commands.
CommandManager * mManager = project->GetCommandManager();
wxArrayString mNames;
mNames.Clear();
mManager->GetAllCommandNames(mNames, false);
for(i=0; i<mNames.GetCount(); i++) {
commands.Add( mNames[i] );
}
*/
return commands;
}
@ -479,6 +467,7 @@ wxString BatchCommands::BuildCleanFileName(const wxString &fileName, const wxStr
return cleanedName;
}
// TODO Move this out of Batch Commands
bool BatchCommands::WriteMp3File( const wxString & Name, int bitrate )
{ //check if current project is mono or stereo
unsigned numChannels = 2;
@ -611,18 +600,23 @@ bool BatchCommands::ApplySpecialCommand(int WXUNUSED(iCommand), const wxString &
}
// end CLEANSPEECH remnant
bool BatchCommands::ApplyEffectCommand(const PluginID & ID, const wxString & command, const wxString & params)
bool BatchCommands::ApplyEffectCommand(const PluginID & ID, const wxString & command, const wxString & params, const CommandContext & Context)
{
//Possibly end processing here, if in batch-debug
if( ReportAndSkip(command, params))
return true;
const PluginDescriptor *plug = PluginManager::Get().GetPlugin(ID);
if (!plug)
return false;
AudacityProject *project = GetActiveProject();
// FIXME: for later versions may want to not select-all in batch mode.
// IF nothing selected, THEN select everything
// (most effects require that you have something selected).
project->SelectAllIfNone();
if( plug->GetPluginType() != PluginTypeGeneric )
project->SelectAllIfNone();
bool res = false;
@ -631,16 +625,26 @@ bool BatchCommands::ApplyEffectCommand(const PluginID & ID, const wxString & com
// transfer the parameters to the effect...
if (EffectManager::Get().SetEffectParameters(ID, params))
{
// and apply the effect...
res = project->DoEffect(ID, AudacityProject::OnEffectFlags::kConfigured |
AudacityProject::OnEffectFlags::kSkipState |
AudacityProject::OnEffectFlags::kDontRepeatLast);
if( plug->GetPluginType() == PluginTypeGeneric )
// and apply the effect...
res = project->DoAudacityCommand(ID,
Context,
AudacityProject::OnEffectFlags::kConfigured |
AudacityProject::OnEffectFlags::kSkipState |
AudacityProject::OnEffectFlags::kDontRepeatLast);
else
// and apply the effect...
res = project->DoEffect(ID,
Context,
AudacityProject::OnEffectFlags::kConfigured |
AudacityProject::OnEffectFlags::kSkipState |
AudacityProject::OnEffectFlags::kDontRepeatLast);
}
return res;
}
bool BatchCommands::ApplyCommand(const wxString & command, const wxString & params)
bool BatchCommands::ApplyCommand(const wxString & command, const wxString & params, CommandContext const * pContext)
{
unsigned int i;
@ -656,7 +660,26 @@ bool BatchCommands::ApplyCommand(const wxString & command, const wxString & para
const PluginID & ID = EffectManager::Get().GetEffectByIdentifier( command );
if (!ID.empty())
{
return ApplyEffectCommand(ID, command, params);
if( pContext )
return ApplyEffectCommand(ID, command, params, *pContext);
const CommandContext context( *GetActiveProject() );
return ApplyEffectCommand(ID, command, params, context);
}
AudacityProject *project = GetActiveProject();
CommandManager * pManager = project->GetCommandManager();
if( pContext ){
if( pManager->HandleTextualCommand( command, *pContext, AlwaysEnabledFlag, AlwaysEnabledFlag ) )
return true;
pContext->Status( wxString::Format(
_("Your batch command of %s was not recognized."), command ));
return false;
}
else
{
const CommandContext context( *GetActiveProject() );
if( pManager->HandleTextualCommand( command, context, AlwaysEnabledFlag, AlwaysEnabledFlag ) )
return true;
}
AudacityMessageBox(
@ -681,7 +704,8 @@ bool BatchCommands::ApplyCommandInBatchMode(const wxString & command, const wxSt
}
// ApplyChain returns true on success, false otherwise.
// Any error reporting to the user has already been done.
// Any error reporting to the user in setting up the chain
// has already been done.
bool BatchCommands::ApplyChain(const wxString & filename)
{
mFileName = filename;

View File

@ -18,6 +18,7 @@
#include "export/Export.h"
class Effect;
class CommandContext;
class BatchCommands final {
public:
@ -25,10 +26,10 @@ class BatchCommands final {
BatchCommands();
public:
bool ApplyChain(const wxString & filename = wxT(""));
bool ApplyCommand( const wxString & command, const wxString & params );
bool ApplyCommand( const wxString & command, const wxString & params, CommandContext const * pContext=NULL );
bool ApplyCommandInBatchMode(const wxString & command, const wxString &params);
bool ApplySpecialCommand(int iCommand, const wxString & command,const wxString & params);
bool ApplyEffectCommand(const PluginID & ID, const wxString & command, const wxString & params);
bool ApplyEffectCommand(const PluginID & ID, const wxString & command, const wxString & params, const CommandContext & Context);
bool ReportAndSkip( const wxString & command, const wxString & params );
void AbortBatch();

View File

@ -38,6 +38,7 @@
#include "Project.h"
#include "Internat.h"
#include "commands/CommandManager.h"
#include "commands/CommandContext.h"
#include "effects/Effect.h"
#include "../images/Arrow.xpm"
#include "../images/Empty9x16.xpm"
@ -166,6 +167,7 @@ void BatchProcessDialog::OnApplyToProject(wxCommandEvent & WXUNUSED(event))
S.SetBorder(20);
S.AddFixedText(wxString::Format(_("Applying '%s' to current project"),
name));
mResults = S.AddTextWindow( wxT("") );
}
S.EndStatic();
}

View File

@ -36,6 +36,7 @@ class wxRadioButton;
class wxListCtrl;
class wxListEvent;
class wxButton;
class wxTextCtrl;
class ShuttleGui;
class BatchProcessDialog final : public wxDialogWrapper {
@ -56,6 +57,7 @@ class BatchProcessDialog final : public wxDialogWrapper {
wxListCtrl *mChains;
wxListCtrl *mList;
BatchCommands mBatchCommands;
wxTextCtrl *mResults;
bool mAbort;
@ -104,6 +106,7 @@ private:
wxButton *mRename;
wxButton *mDefaults;
BatchCommands mBatchCommands; /// Provides list of available commands.
wxString mActiveChain;

View File

@ -276,14 +276,16 @@ audacity_SOURCES = \
wxFileNameWrapper.h \
commands/AppCommandEvent.cpp \
commands/AppCommandEvent.h \
commands/AutomationCommands.cpp \
commands/AutomationCommands.h \
commands/AudacityCommand.cpp \
commands/AudacityCommand.h \
commands/BatchEvalCommand.cpp \
commands/BatchEvalCommand.h \
commands/Command.cpp \
commands/Command.h \
commands/CommandBuilder.cpp \
commands/CommandBuilder.h \
commands/CommandContext.cpp \
commands/CommandContext.h \
commands/CommandDirectory.cpp \
commands/CommandDirectory.h \
commands/CommandFlag.h \
@ -300,10 +302,10 @@ audacity_SOURCES = \
commands/CommandType.h \
commands/CompareAudioCommand.cpp \
commands/CompareAudioCommand.h \
commands/ExecMenuCommand.cpp \
commands/ExecMenuCommand.h \
commands/GetProjectInfoCommand.cpp \
commands/GetProjectInfoCommand.h \
commands/Demo.cpp \
commands/Demo.h \
commands/GetInfoCommand.cpp \
commands/GetInfoCommand.h \
commands/GetTrackInfoCommand.cpp \
commands/GetTrackInfoCommand.h \
commands/HelpCommand.cpp \
@ -312,6 +314,8 @@ audacity_SOURCES = \
commands/ImportExportCommands.h \
commands/Keyboard.cpp \
commands/Keyboard.h \
commands/LoadCommands.cpp \
commands/LoadCommands.h \
commands/MessageCommand.cpp \
commands/MessageCommand.h \
commands/OpenSaveCommands.cpp \
@ -326,8 +330,6 @@ audacity_SOURCES = \
commands/ScriptCommandRelay.h \
commands/SelectCommand.cpp \
commands/SelectCommand.h \
commands/SetProjectInfoCommand.cpp \
commands/SetProjectInfoCommand.h \
commands/SetTrackInfoCommand.cpp \
commands/SetTrackInfoCommand.h \
commands/Validators.h \

View File

@ -1,7 +1,7 @@
# Makefile.in generated by automake 1.15 from Makefile.am.
# Makefile.in generated by automake 1.14.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2014 Free Software Foundation, Inc.
# Copyright (C) 1994-2013 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -16,17 +16,7 @@
VPATH = @srcdir@
am__is_gnu_make = { \
if test -z '$(MAKELEVEL)'; then \
false; \
elif test -n '$(MAKE_HOST)'; then \
true; \
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
true; \
else \
false; \
fi; \
}
am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
am__make_running_with_option = \
case $${target_option-} in \
?) ;; \
@ -200,6 +190,9 @@ bin_PROGRAMS = audacity$(EXEEXT)
@USE_VST_TRUE@ $(NULL)
subdir = src
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(srcdir)/configtemplate.h $(srcdir)/audacity.desktop.in \
$(top_srcdir)/autotools/depcomp $(dist_mime_DATA)
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ac_c99_func_lrint.m4 \
$(top_srcdir)/m4/ac_c99_func_lrintf.m4 \
@ -242,8 +235,6 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ac_c99_func_lrint.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am $(dist_mime_DATA) \
$(am__DIST_COMMON)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = configwin.h configunix.h
CONFIG_CLEAN_FILES = audacity.desktop
@ -338,11 +329,12 @@ am__audacity_SOURCES_DIST = BlockFile.cpp BlockFile.h DirManager.cpp \
VoiceKey.h WaveClip.cpp WaveClip.h WaveTrack.cpp WaveTrack.h \
WaveTrackLocation.h WrappedType.cpp WrappedType.h \
wxFileNameWrapper.h commands/AppCommandEvent.cpp \
commands/AppCommandEvent.h commands/AutomationCommands.cpp \
commands/AutomationCommands.h commands/BatchEvalCommand.cpp \
commands/AppCommandEvent.h commands/AudacityCommand.cpp \
commands/AudacityCommand.h commands/BatchEvalCommand.cpp \
commands/BatchEvalCommand.h commands/Command.cpp \
commands/Command.h commands/CommandBuilder.cpp \
commands/CommandBuilder.h commands/CommandDirectory.cpp \
commands/CommandBuilder.h commands/CommandContext.cpp \
commands/CommandContext.h commands/CommandDirectory.cpp \
commands/CommandDirectory.h commands/CommandFlag.h \
commands/CommandFunctors.h commands/CommandHandler.cpp \
commands/CommandHandler.h commands/CommandManager.cpp \
@ -350,23 +342,21 @@ am__audacity_SOURCES_DIST = BlockFile.cpp BlockFile.h DirManager.cpp \
commands/CommandSignature.cpp commands/CommandSignature.h \
commands/CommandTargets.h commands/CommandType.cpp \
commands/CommandType.h commands/CompareAudioCommand.cpp \
commands/CompareAudioCommand.h commands/ExecMenuCommand.cpp \
commands/ExecMenuCommand.h commands/GetProjectInfoCommand.cpp \
commands/GetProjectInfoCommand.h \
commands/GetTrackInfoCommand.cpp \
commands/CompareAudioCommand.h commands/Demo.cpp \
commands/Demo.h commands/GetInfoCommand.cpp \
commands/GetInfoCommand.h commands/GetTrackInfoCommand.cpp \
commands/GetTrackInfoCommand.h commands/HelpCommand.cpp \
commands/HelpCommand.h commands/ImportExportCommands.cpp \
commands/ImportExportCommands.h commands/Keyboard.cpp \
commands/Keyboard.h commands/MessageCommand.cpp \
commands/Keyboard.h commands/LoadCommands.cpp \
commands/LoadCommands.h commands/MessageCommand.cpp \
commands/MessageCommand.h commands/OpenSaveCommands.cpp \
commands/OpenSaveCommands.h commands/PreferenceCommands.cpp \
commands/PreferenceCommands.h commands/ResponseQueue.cpp \
commands/ResponseQueue.h commands/ScreenshotCommand.cpp \
commands/ScreenshotCommand.h commands/ScriptCommandRelay.cpp \
commands/ScriptCommandRelay.h commands/SelectCommand.cpp \
commands/SelectCommand.h commands/SetProjectInfoCommand.cpp \
commands/SetProjectInfoCommand.h \
commands/SetTrackInfoCommand.cpp \
commands/SelectCommand.h commands/SetTrackInfoCommand.cpp \
commands/SetTrackInfoCommand.h commands/Validators.h \
effects/Amplify.cpp effects/Amplify.h effects/AutoDuck.cpp \
effects/AutoDuck.h effects/BassTreble.cpp effects/BassTreble.h \
@ -660,22 +650,24 @@ am_audacity_OBJECTS = $(am__objects_1) audacity-AboutDialog.$(OBJEXT) \
audacity-VoiceKey.$(OBJEXT) audacity-WaveClip.$(OBJEXT) \
audacity-WaveTrack.$(OBJEXT) audacity-WrappedType.$(OBJEXT) \
commands/audacity-AppCommandEvent.$(OBJEXT) \
commands/audacity-AutomationCommands.$(OBJEXT) \
commands/audacity-AudacityCommand.$(OBJEXT) \
commands/audacity-BatchEvalCommand.$(OBJEXT) \
commands/audacity-Command.$(OBJEXT) \
commands/audacity-CommandBuilder.$(OBJEXT) \
commands/audacity-CommandContext.$(OBJEXT) \
commands/audacity-CommandDirectory.$(OBJEXT) \
commands/audacity-CommandHandler.$(OBJEXT) \
commands/audacity-CommandManager.$(OBJEXT) \
commands/audacity-CommandSignature.$(OBJEXT) \
commands/audacity-CommandType.$(OBJEXT) \
commands/audacity-CompareAudioCommand.$(OBJEXT) \
commands/audacity-ExecMenuCommand.$(OBJEXT) \
commands/audacity-GetProjectInfoCommand.$(OBJEXT) \
commands/audacity-Demo.$(OBJEXT) \
commands/audacity-GetInfoCommand.$(OBJEXT) \
commands/audacity-GetTrackInfoCommand.$(OBJEXT) \
commands/audacity-HelpCommand.$(OBJEXT) \
commands/audacity-ImportExportCommands.$(OBJEXT) \
commands/audacity-Keyboard.$(OBJEXT) \
commands/audacity-LoadCommands.$(OBJEXT) \
commands/audacity-MessageCommand.$(OBJEXT) \
commands/audacity-OpenSaveCommands.$(OBJEXT) \
commands/audacity-PreferenceCommands.$(OBJEXT) \
@ -683,7 +675,6 @@ am_audacity_OBJECTS = $(am__objects_1) audacity-AboutDialog.$(OBJEXT) \
commands/audacity-ScreenshotCommand.$(OBJEXT) \
commands/audacity-ScriptCommandRelay.$(OBJEXT) \
commands/audacity-SelectCommand.$(OBJEXT) \
commands/audacity-SetProjectInfoCommand.$(OBJEXT) \
commands/audacity-SetTrackInfoCommand.$(OBJEXT) \
effects/audacity-Amplify.$(OBJEXT) \
effects/audacity-AutoDuck.$(OBJEXT) \
@ -1006,8 +997,6 @@ am__define_uniq_tagged_files = \
done | $(am__uniquify_input)`
ETAGS = etags
CTAGS = ctags
am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/audacity.desktop.in \
$(srcdir)/configtemplate.h $(top_srcdir)/autotools/depcomp
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
@ -1350,11 +1339,12 @@ audacity_SOURCES = $(libaudacity_la_SOURCES) AboutDialog.cpp \
VoiceKey.h WaveClip.cpp WaveClip.h WaveTrack.cpp WaveTrack.h \
WaveTrackLocation.h WrappedType.cpp WrappedType.h \
wxFileNameWrapper.h commands/AppCommandEvent.cpp \
commands/AppCommandEvent.h commands/AutomationCommands.cpp \
commands/AutomationCommands.h commands/BatchEvalCommand.cpp \
commands/AppCommandEvent.h commands/AudacityCommand.cpp \
commands/AudacityCommand.h commands/BatchEvalCommand.cpp \
commands/BatchEvalCommand.h commands/Command.cpp \
commands/Command.h commands/CommandBuilder.cpp \
commands/CommandBuilder.h commands/CommandDirectory.cpp \
commands/CommandBuilder.h commands/CommandContext.cpp \
commands/CommandContext.h commands/CommandDirectory.cpp \
commands/CommandDirectory.h commands/CommandFlag.h \
commands/CommandFunctors.h commands/CommandHandler.cpp \
commands/CommandHandler.h commands/CommandManager.cpp \
@ -1362,23 +1352,21 @@ audacity_SOURCES = $(libaudacity_la_SOURCES) AboutDialog.cpp \
commands/CommandSignature.cpp commands/CommandSignature.h \
commands/CommandTargets.h commands/CommandType.cpp \
commands/CommandType.h commands/CompareAudioCommand.cpp \
commands/CompareAudioCommand.h commands/ExecMenuCommand.cpp \
commands/ExecMenuCommand.h commands/GetProjectInfoCommand.cpp \
commands/GetProjectInfoCommand.h \
commands/GetTrackInfoCommand.cpp \
commands/CompareAudioCommand.h commands/Demo.cpp \
commands/Demo.h commands/GetInfoCommand.cpp \
commands/GetInfoCommand.h commands/GetTrackInfoCommand.cpp \
commands/GetTrackInfoCommand.h commands/HelpCommand.cpp \
commands/HelpCommand.h commands/ImportExportCommands.cpp \
commands/ImportExportCommands.h commands/Keyboard.cpp \
commands/Keyboard.h commands/MessageCommand.cpp \
commands/Keyboard.h commands/LoadCommands.cpp \
commands/LoadCommands.h commands/MessageCommand.cpp \
commands/MessageCommand.h commands/OpenSaveCommands.cpp \
commands/OpenSaveCommands.h commands/PreferenceCommands.cpp \
commands/PreferenceCommands.h commands/ResponseQueue.cpp \
commands/ResponseQueue.h commands/ScreenshotCommand.cpp \
commands/ScreenshotCommand.h commands/ScriptCommandRelay.cpp \
commands/ScriptCommandRelay.h commands/SelectCommand.cpp \
commands/SelectCommand.h commands/SetProjectInfoCommand.cpp \
commands/SetProjectInfoCommand.h \
commands/SetTrackInfoCommand.cpp \
commands/SelectCommand.h commands/SetTrackInfoCommand.cpp \
commands/SetTrackInfoCommand.h commands/Validators.h \
effects/Amplify.cpp effects/Amplify.h effects/AutoDuck.cpp \
effects/AutoDuck.h effects/BassTreble.cpp effects/BassTreble.h \
@ -1597,6 +1585,7 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign src/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
@ -1758,14 +1747,16 @@ commands/$(DEPDIR)/$(am__dirstamp):
@: > commands/$(DEPDIR)/$(am__dirstamp)
commands/audacity-AppCommandEvent.$(OBJEXT): commands/$(am__dirstamp) \
commands/$(DEPDIR)/$(am__dirstamp)
commands/audacity-AutomationCommands.$(OBJEXT): \
commands/$(am__dirstamp) commands/$(DEPDIR)/$(am__dirstamp)
commands/audacity-AudacityCommand.$(OBJEXT): commands/$(am__dirstamp) \
commands/$(DEPDIR)/$(am__dirstamp)
commands/audacity-BatchEvalCommand.$(OBJEXT): \
commands/$(am__dirstamp) commands/$(DEPDIR)/$(am__dirstamp)
commands/audacity-Command.$(OBJEXT): commands/$(am__dirstamp) \
commands/$(DEPDIR)/$(am__dirstamp)
commands/audacity-CommandBuilder.$(OBJEXT): commands/$(am__dirstamp) \
commands/$(DEPDIR)/$(am__dirstamp)
commands/audacity-CommandContext.$(OBJEXT): commands/$(am__dirstamp) \
commands/$(DEPDIR)/$(am__dirstamp)
commands/audacity-CommandDirectory.$(OBJEXT): \
commands/$(am__dirstamp) commands/$(DEPDIR)/$(am__dirstamp)
commands/audacity-CommandHandler.$(OBJEXT): commands/$(am__dirstamp) \
@ -1778,10 +1769,10 @@ commands/audacity-CommandType.$(OBJEXT): commands/$(am__dirstamp) \
commands/$(DEPDIR)/$(am__dirstamp)
commands/audacity-CompareAudioCommand.$(OBJEXT): \
commands/$(am__dirstamp) commands/$(DEPDIR)/$(am__dirstamp)
commands/audacity-ExecMenuCommand.$(OBJEXT): commands/$(am__dirstamp) \
commands/audacity-Demo.$(OBJEXT): commands/$(am__dirstamp) \
commands/$(DEPDIR)/$(am__dirstamp)
commands/audacity-GetInfoCommand.$(OBJEXT): commands/$(am__dirstamp) \
commands/$(DEPDIR)/$(am__dirstamp)
commands/audacity-GetProjectInfoCommand.$(OBJEXT): \
commands/$(am__dirstamp) commands/$(DEPDIR)/$(am__dirstamp)
commands/audacity-GetTrackInfoCommand.$(OBJEXT): \
commands/$(am__dirstamp) commands/$(DEPDIR)/$(am__dirstamp)
commands/audacity-HelpCommand.$(OBJEXT): commands/$(am__dirstamp) \
@ -1790,6 +1781,8 @@ commands/audacity-ImportExportCommands.$(OBJEXT): \
commands/$(am__dirstamp) commands/$(DEPDIR)/$(am__dirstamp)
commands/audacity-Keyboard.$(OBJEXT): commands/$(am__dirstamp) \
commands/$(DEPDIR)/$(am__dirstamp)
commands/audacity-LoadCommands.$(OBJEXT): commands/$(am__dirstamp) \
commands/$(DEPDIR)/$(am__dirstamp)
commands/audacity-MessageCommand.$(OBJEXT): commands/$(am__dirstamp) \
commands/$(DEPDIR)/$(am__dirstamp)
commands/audacity-OpenSaveCommands.$(OBJEXT): \
@ -1804,8 +1797,6 @@ commands/audacity-ScriptCommandRelay.$(OBJEXT): \
commands/$(am__dirstamp) commands/$(DEPDIR)/$(am__dirstamp)
commands/audacity-SelectCommand.$(OBJEXT): commands/$(am__dirstamp) \
commands/$(DEPDIR)/$(am__dirstamp)
commands/audacity-SetProjectInfoCommand.$(OBJEXT): \
commands/$(am__dirstamp) commands/$(DEPDIR)/$(am__dirstamp)
commands/audacity-SetTrackInfoCommand.$(OBJEXT): \
commands/$(am__dirstamp) commands/$(DEPDIR)/$(am__dirstamp)
effects/$(am__dirstamp):
@ -2489,22 +2480,24 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@blockfile/$(DEPDIR)/libaudacity_la-SilentBlockFile.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@blockfile/$(DEPDIR)/libaudacity_la-SimpleBlockFile.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@commands/$(DEPDIR)/audacity-AppCommandEvent.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@commands/$(DEPDIR)/audacity-AutomationCommands.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@commands/$(DEPDIR)/audacity-AudacityCommand.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@commands/$(DEPDIR)/audacity-BatchEvalCommand.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@commands/$(DEPDIR)/audacity-Command.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@commands/$(DEPDIR)/audacity-CommandBuilder.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@commands/$(DEPDIR)/audacity-CommandContext.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@commands/$(DEPDIR)/audacity-CommandDirectory.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@commands/$(DEPDIR)/audacity-CommandHandler.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@commands/$(DEPDIR)/audacity-CommandManager.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@commands/$(DEPDIR)/audacity-CommandSignature.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@commands/$(DEPDIR)/audacity-CommandType.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@commands/$(DEPDIR)/audacity-CompareAudioCommand.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@commands/$(DEPDIR)/audacity-ExecMenuCommand.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@commands/$(DEPDIR)/audacity-GetProjectInfoCommand.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@commands/$(DEPDIR)/audacity-Demo.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@commands/$(DEPDIR)/audacity-GetInfoCommand.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@commands/$(DEPDIR)/audacity-GetTrackInfoCommand.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@commands/$(DEPDIR)/audacity-HelpCommand.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@commands/$(DEPDIR)/audacity-ImportExportCommands.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@commands/$(DEPDIR)/audacity-Keyboard.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@commands/$(DEPDIR)/audacity-LoadCommands.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@commands/$(DEPDIR)/audacity-MessageCommand.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@commands/$(DEPDIR)/audacity-OpenSaveCommands.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@commands/$(DEPDIR)/audacity-PreferenceCommands.Po@am__quote@
@ -2512,7 +2505,6 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@commands/$(DEPDIR)/audacity-ScreenshotCommand.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@commands/$(DEPDIR)/audacity-ScriptCommandRelay.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@commands/$(DEPDIR)/audacity-SelectCommand.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@commands/$(DEPDIR)/audacity-SetProjectInfoCommand.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@commands/$(DEPDIR)/audacity-SetTrackInfoCommand.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@effects/$(DEPDIR)/audacity-Amplify.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@effects/$(DEPDIR)/audacity-AutoDuck.Po@am__quote@
@ -4212,19 +4204,19 @@ commands/audacity-AppCommandEvent.obj: commands/AppCommandEvent.cpp
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(audacity_CPPFLAGS) $(CPPFLAGS) $(audacity_CXXFLAGS) $(CXXFLAGS) -c -o commands/audacity-AppCommandEvent.obj `if test -f 'commands/AppCommandEvent.cpp'; then $(CYGPATH_W) 'commands/AppCommandEvent.cpp'; else $(CYGPATH_W) '$(srcdir)/commands/AppCommandEvent.cpp'; fi`
commands/audacity-AutomationCommands.o: commands/AutomationCommands.cpp
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(audacity_CPPFLAGS) $(CPPFLAGS) $(audacity_CXXFLAGS) $(CXXFLAGS) -MT commands/audacity-AutomationCommands.o -MD -MP -MF commands/$(DEPDIR)/audacity-AutomationCommands.Tpo -c -o commands/audacity-AutomationCommands.o `test -f 'commands/AutomationCommands.cpp' || echo '$(srcdir)/'`commands/AutomationCommands.cpp
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) commands/$(DEPDIR)/audacity-AutomationCommands.Tpo commands/$(DEPDIR)/audacity-AutomationCommands.Po
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='commands/AutomationCommands.cpp' object='commands/audacity-AutomationCommands.o' libtool=no @AMDEPBACKSLASH@
commands/audacity-AudacityCommand.o: commands/AudacityCommand.cpp
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(audacity_CPPFLAGS) $(CPPFLAGS) $(audacity_CXXFLAGS) $(CXXFLAGS) -MT commands/audacity-AudacityCommand.o -MD -MP -MF commands/$(DEPDIR)/audacity-AudacityCommand.Tpo -c -o commands/audacity-AudacityCommand.o `test -f 'commands/AudacityCommand.cpp' || echo '$(srcdir)/'`commands/AudacityCommand.cpp
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) commands/$(DEPDIR)/audacity-AudacityCommand.Tpo commands/$(DEPDIR)/audacity-AudacityCommand.Po
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='commands/AudacityCommand.cpp' object='commands/audacity-AudacityCommand.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(audacity_CPPFLAGS) $(CPPFLAGS) $(audacity_CXXFLAGS) $(CXXFLAGS) -c -o commands/audacity-AutomationCommands.o `test -f 'commands/AutomationCommands.cpp' || echo '$(srcdir)/'`commands/AutomationCommands.cpp
@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(audacity_CPPFLAGS) $(CPPFLAGS) $(audacity_CXXFLAGS) $(CXXFLAGS) -c -o commands/audacity-AudacityCommand.o `test -f 'commands/AudacityCommand.cpp' || echo '$(srcdir)/'`commands/AudacityCommand.cpp
commands/audacity-AutomationCommands.obj: commands/AutomationCommands.cpp
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(audacity_CPPFLAGS) $(CPPFLAGS) $(audacity_CXXFLAGS) $(CXXFLAGS) -MT commands/audacity-AutomationCommands.obj -MD -MP -MF commands/$(DEPDIR)/audacity-AutomationCommands.Tpo -c -o commands/audacity-AutomationCommands.obj `if test -f 'commands/AutomationCommands.cpp'; then $(CYGPATH_W) 'commands/AutomationCommands.cpp'; else $(CYGPATH_W) '$(srcdir)/commands/AutomationCommands.cpp'; fi`
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) commands/$(DEPDIR)/audacity-AutomationCommands.Tpo commands/$(DEPDIR)/audacity-AutomationCommands.Po
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='commands/AutomationCommands.cpp' object='commands/audacity-AutomationCommands.obj' libtool=no @AMDEPBACKSLASH@
commands/audacity-AudacityCommand.obj: commands/AudacityCommand.cpp
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(audacity_CPPFLAGS) $(CPPFLAGS) $(audacity_CXXFLAGS) $(CXXFLAGS) -MT commands/audacity-AudacityCommand.obj -MD -MP -MF commands/$(DEPDIR)/audacity-AudacityCommand.Tpo -c -o commands/audacity-AudacityCommand.obj `if test -f 'commands/AudacityCommand.cpp'; then $(CYGPATH_W) 'commands/AudacityCommand.cpp'; else $(CYGPATH_W) '$(srcdir)/commands/AudacityCommand.cpp'; fi`
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) commands/$(DEPDIR)/audacity-AudacityCommand.Tpo commands/$(DEPDIR)/audacity-AudacityCommand.Po
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='commands/AudacityCommand.cpp' object='commands/audacity-AudacityCommand.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(audacity_CPPFLAGS) $(CPPFLAGS) $(audacity_CXXFLAGS) $(CXXFLAGS) -c -o commands/audacity-AutomationCommands.obj `if test -f 'commands/AutomationCommands.cpp'; then $(CYGPATH_W) 'commands/AutomationCommands.cpp'; else $(CYGPATH_W) '$(srcdir)/commands/AutomationCommands.cpp'; fi`
@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(audacity_CPPFLAGS) $(CPPFLAGS) $(audacity_CXXFLAGS) $(CXXFLAGS) -c -o commands/audacity-AudacityCommand.obj `if test -f 'commands/AudacityCommand.cpp'; then $(CYGPATH_W) 'commands/AudacityCommand.cpp'; else $(CYGPATH_W) '$(srcdir)/commands/AudacityCommand.cpp'; fi`
commands/audacity-BatchEvalCommand.o: commands/BatchEvalCommand.cpp
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(audacity_CPPFLAGS) $(CPPFLAGS) $(audacity_CXXFLAGS) $(CXXFLAGS) -MT commands/audacity-BatchEvalCommand.o -MD -MP -MF commands/$(DEPDIR)/audacity-BatchEvalCommand.Tpo -c -o commands/audacity-BatchEvalCommand.o `test -f 'commands/BatchEvalCommand.cpp' || echo '$(srcdir)/'`commands/BatchEvalCommand.cpp
@ -4268,6 +4260,20 @@ commands/audacity-CommandBuilder.obj: commands/CommandBuilder.cpp
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(audacity_CPPFLAGS) $(CPPFLAGS) $(audacity_CXXFLAGS) $(CXXFLAGS) -c -o commands/audacity-CommandBuilder.obj `if test -f 'commands/CommandBuilder.cpp'; then $(CYGPATH_W) 'commands/CommandBuilder.cpp'; else $(CYGPATH_W) '$(srcdir)/commands/CommandBuilder.cpp'; fi`
commands/audacity-CommandContext.o: commands/CommandContext.cpp
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(audacity_CPPFLAGS) $(CPPFLAGS) $(audacity_CXXFLAGS) $(CXXFLAGS) -MT commands/audacity-CommandContext.o -MD -MP -MF commands/$(DEPDIR)/audacity-CommandContext.Tpo -c -o commands/audacity-CommandContext.o `test -f 'commands/CommandContext.cpp' || echo '$(srcdir)/'`commands/CommandContext.cpp
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) commands/$(DEPDIR)/audacity-CommandContext.Tpo commands/$(DEPDIR)/audacity-CommandContext.Po
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='commands/CommandContext.cpp' object='commands/audacity-CommandContext.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(audacity_CPPFLAGS) $(CPPFLAGS) $(audacity_CXXFLAGS) $(CXXFLAGS) -c -o commands/audacity-CommandContext.o `test -f 'commands/CommandContext.cpp' || echo '$(srcdir)/'`commands/CommandContext.cpp
commands/audacity-CommandContext.obj: commands/CommandContext.cpp
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(audacity_CPPFLAGS) $(CPPFLAGS) $(audacity_CXXFLAGS) $(CXXFLAGS) -MT commands/audacity-CommandContext.obj -MD -MP -MF commands/$(DEPDIR)/audacity-CommandContext.Tpo -c -o commands/audacity-CommandContext.obj `if test -f 'commands/CommandContext.cpp'; then $(CYGPATH_W) 'commands/CommandContext.cpp'; else $(CYGPATH_W) '$(srcdir)/commands/CommandContext.cpp'; fi`
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) commands/$(DEPDIR)/audacity-CommandContext.Tpo commands/$(DEPDIR)/audacity-CommandContext.Po
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='commands/CommandContext.cpp' object='commands/audacity-CommandContext.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(audacity_CPPFLAGS) $(CPPFLAGS) $(audacity_CXXFLAGS) $(CXXFLAGS) -c -o commands/audacity-CommandContext.obj `if test -f 'commands/CommandContext.cpp'; then $(CYGPATH_W) 'commands/CommandContext.cpp'; else $(CYGPATH_W) '$(srcdir)/commands/CommandContext.cpp'; fi`
commands/audacity-CommandDirectory.o: commands/CommandDirectory.cpp
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(audacity_CPPFLAGS) $(CPPFLAGS) $(audacity_CXXFLAGS) $(CXXFLAGS) -MT commands/audacity-CommandDirectory.o -MD -MP -MF commands/$(DEPDIR)/audacity-CommandDirectory.Tpo -c -o commands/audacity-CommandDirectory.o `test -f 'commands/CommandDirectory.cpp' || echo '$(srcdir)/'`commands/CommandDirectory.cpp
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) commands/$(DEPDIR)/audacity-CommandDirectory.Tpo commands/$(DEPDIR)/audacity-CommandDirectory.Po
@ -4352,33 +4358,33 @@ commands/audacity-CompareAudioCommand.obj: commands/CompareAudioCommand.cpp
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(audacity_CPPFLAGS) $(CPPFLAGS) $(audacity_CXXFLAGS) $(CXXFLAGS) -c -o commands/audacity-CompareAudioCommand.obj `if test -f 'commands/CompareAudioCommand.cpp'; then $(CYGPATH_W) 'commands/CompareAudioCommand.cpp'; else $(CYGPATH_W) '$(srcdir)/commands/CompareAudioCommand.cpp'; fi`
commands/audacity-ExecMenuCommand.o: commands/ExecMenuCommand.cpp
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(audacity_CPPFLAGS) $(CPPFLAGS) $(audacity_CXXFLAGS) $(CXXFLAGS) -MT commands/audacity-ExecMenuCommand.o -MD -MP -MF commands/$(DEPDIR)/audacity-ExecMenuCommand.Tpo -c -o commands/audacity-ExecMenuCommand.o `test -f 'commands/ExecMenuCommand.cpp' || echo '$(srcdir)/'`commands/ExecMenuCommand.cpp
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) commands/$(DEPDIR)/audacity-ExecMenuCommand.Tpo commands/$(DEPDIR)/audacity-ExecMenuCommand.Po
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='commands/ExecMenuCommand.cpp' object='commands/audacity-ExecMenuCommand.o' libtool=no @AMDEPBACKSLASH@
commands/audacity-Demo.o: commands/Demo.cpp
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(audacity_CPPFLAGS) $(CPPFLAGS) $(audacity_CXXFLAGS) $(CXXFLAGS) -MT commands/audacity-Demo.o -MD -MP -MF commands/$(DEPDIR)/audacity-Demo.Tpo -c -o commands/audacity-Demo.o `test -f 'commands/Demo.cpp' || echo '$(srcdir)/'`commands/Demo.cpp
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) commands/$(DEPDIR)/audacity-Demo.Tpo commands/$(DEPDIR)/audacity-Demo.Po
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='commands/Demo.cpp' object='commands/audacity-Demo.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(audacity_CPPFLAGS) $(CPPFLAGS) $(audacity_CXXFLAGS) $(CXXFLAGS) -c -o commands/audacity-ExecMenuCommand.o `test -f 'commands/ExecMenuCommand.cpp' || echo '$(srcdir)/'`commands/ExecMenuCommand.cpp
@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(audacity_CPPFLAGS) $(CPPFLAGS) $(audacity_CXXFLAGS) $(CXXFLAGS) -c -o commands/audacity-Demo.o `test -f 'commands/Demo.cpp' || echo '$(srcdir)/'`commands/Demo.cpp
commands/audacity-ExecMenuCommand.obj: commands/ExecMenuCommand.cpp
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(audacity_CPPFLAGS) $(CPPFLAGS) $(audacity_CXXFLAGS) $(CXXFLAGS) -MT commands/audacity-ExecMenuCommand.obj -MD -MP -MF commands/$(DEPDIR)/audacity-ExecMenuCommand.Tpo -c -o commands/audacity-ExecMenuCommand.obj `if test -f 'commands/ExecMenuCommand.cpp'; then $(CYGPATH_W) 'commands/ExecMenuCommand.cpp'; else $(CYGPATH_W) '$(srcdir)/commands/ExecMenuCommand.cpp'; fi`
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) commands/$(DEPDIR)/audacity-ExecMenuCommand.Tpo commands/$(DEPDIR)/audacity-ExecMenuCommand.Po
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='commands/ExecMenuCommand.cpp' object='commands/audacity-ExecMenuCommand.obj' libtool=no @AMDEPBACKSLASH@
commands/audacity-Demo.obj: commands/Demo.cpp
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(audacity_CPPFLAGS) $(CPPFLAGS) $(audacity_CXXFLAGS) $(CXXFLAGS) -MT commands/audacity-Demo.obj -MD -MP -MF commands/$(DEPDIR)/audacity-Demo.Tpo -c -o commands/audacity-Demo.obj `if test -f 'commands/Demo.cpp'; then $(CYGPATH_W) 'commands/Demo.cpp'; else $(CYGPATH_W) '$(srcdir)/commands/Demo.cpp'; fi`
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) commands/$(DEPDIR)/audacity-Demo.Tpo commands/$(DEPDIR)/audacity-Demo.Po
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='commands/Demo.cpp' object='commands/audacity-Demo.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(audacity_CPPFLAGS) $(CPPFLAGS) $(audacity_CXXFLAGS) $(CXXFLAGS) -c -o commands/audacity-ExecMenuCommand.obj `if test -f 'commands/ExecMenuCommand.cpp'; then $(CYGPATH_W) 'commands/ExecMenuCommand.cpp'; else $(CYGPATH_W) '$(srcdir)/commands/ExecMenuCommand.cpp'; fi`
@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(audacity_CPPFLAGS) $(CPPFLAGS) $(audacity_CXXFLAGS) $(CXXFLAGS) -c -o commands/audacity-Demo.obj `if test -f 'commands/Demo.cpp'; then $(CYGPATH_W) 'commands/Demo.cpp'; else $(CYGPATH_W) '$(srcdir)/commands/Demo.cpp'; fi`
commands/audacity-GetProjectInfoCommand.o: commands/GetProjectInfoCommand.cpp
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(audacity_CPPFLAGS) $(CPPFLAGS) $(audacity_CXXFLAGS) $(CXXFLAGS) -MT commands/audacity-GetProjectInfoCommand.o -MD -MP -MF commands/$(DEPDIR)/audacity-GetProjectInfoCommand.Tpo -c -o commands/audacity-GetProjectInfoCommand.o `test -f 'commands/GetProjectInfoCommand.cpp' || echo '$(srcdir)/'`commands/GetProjectInfoCommand.cpp
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) commands/$(DEPDIR)/audacity-GetProjectInfoCommand.Tpo commands/$(DEPDIR)/audacity-GetProjectInfoCommand.Po
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='commands/GetProjectInfoCommand.cpp' object='commands/audacity-GetProjectInfoCommand.o' libtool=no @AMDEPBACKSLASH@
commands/audacity-GetInfoCommand.o: commands/GetInfoCommand.cpp
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(audacity_CPPFLAGS) $(CPPFLAGS) $(audacity_CXXFLAGS) $(CXXFLAGS) -MT commands/audacity-GetInfoCommand.o -MD -MP -MF commands/$(DEPDIR)/audacity-GetInfoCommand.Tpo -c -o commands/audacity-GetInfoCommand.o `test -f 'commands/GetInfoCommand.cpp' || echo '$(srcdir)/'`commands/GetInfoCommand.cpp
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) commands/$(DEPDIR)/audacity-GetInfoCommand.Tpo commands/$(DEPDIR)/audacity-GetInfoCommand.Po
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='commands/GetInfoCommand.cpp' object='commands/audacity-GetInfoCommand.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(audacity_CPPFLAGS) $(CPPFLAGS) $(audacity_CXXFLAGS) $(CXXFLAGS) -c -o commands/audacity-GetProjectInfoCommand.o `test -f 'commands/GetProjectInfoCommand.cpp' || echo '$(srcdir)/'`commands/GetProjectInfoCommand.cpp
@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(audacity_CPPFLAGS) $(CPPFLAGS) $(audacity_CXXFLAGS) $(CXXFLAGS) -c -o commands/audacity-GetInfoCommand.o `test -f 'commands/GetInfoCommand.cpp' || echo '$(srcdir)/'`commands/GetInfoCommand.cpp
commands/audacity-GetProjectInfoCommand.obj: commands/GetProjectInfoCommand.cpp
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(audacity_CPPFLAGS) $(CPPFLAGS) $(audacity_CXXFLAGS) $(CXXFLAGS) -MT commands/audacity-GetProjectInfoCommand.obj -MD -MP -MF commands/$(DEPDIR)/audacity-GetProjectInfoCommand.Tpo -c -o commands/audacity-GetProjectInfoCommand.obj `if test -f 'commands/GetProjectInfoCommand.cpp'; then $(CYGPATH_W) 'commands/GetProjectInfoCommand.cpp'; else $(CYGPATH_W) '$(srcdir)/commands/GetProjectInfoCommand.cpp'; fi`
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) commands/$(DEPDIR)/audacity-GetProjectInfoCommand.Tpo commands/$(DEPDIR)/audacity-GetProjectInfoCommand.Po
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='commands/GetProjectInfoCommand.cpp' object='commands/audacity-GetProjectInfoCommand.obj' libtool=no @AMDEPBACKSLASH@
commands/audacity-GetInfoCommand.obj: commands/GetInfoCommand.cpp
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(audacity_CPPFLAGS) $(CPPFLAGS) $(audacity_CXXFLAGS) $(CXXFLAGS) -MT commands/audacity-GetInfoCommand.obj -MD -MP -MF commands/$(DEPDIR)/audacity-GetInfoCommand.Tpo -c -o commands/audacity-GetInfoCommand.obj `if test -f 'commands/GetInfoCommand.cpp'; then $(CYGPATH_W) 'commands/GetInfoCommand.cpp'; else $(CYGPATH_W) '$(srcdir)/commands/GetInfoCommand.cpp'; fi`
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) commands/$(DEPDIR)/audacity-GetInfoCommand.Tpo commands/$(DEPDIR)/audacity-GetInfoCommand.Po
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='commands/GetInfoCommand.cpp' object='commands/audacity-GetInfoCommand.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(audacity_CPPFLAGS) $(CPPFLAGS) $(audacity_CXXFLAGS) $(CXXFLAGS) -c -o commands/audacity-GetProjectInfoCommand.obj `if test -f 'commands/GetProjectInfoCommand.cpp'; then $(CYGPATH_W) 'commands/GetProjectInfoCommand.cpp'; else $(CYGPATH_W) '$(srcdir)/commands/GetProjectInfoCommand.cpp'; fi`
@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(audacity_CPPFLAGS) $(CPPFLAGS) $(audacity_CXXFLAGS) $(CXXFLAGS) -c -o commands/audacity-GetInfoCommand.obj `if test -f 'commands/GetInfoCommand.cpp'; then $(CYGPATH_W) 'commands/GetInfoCommand.cpp'; else $(CYGPATH_W) '$(srcdir)/commands/GetInfoCommand.cpp'; fi`
commands/audacity-GetTrackInfoCommand.o: commands/GetTrackInfoCommand.cpp
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(audacity_CPPFLAGS) $(CPPFLAGS) $(audacity_CXXFLAGS) $(CXXFLAGS) -MT commands/audacity-GetTrackInfoCommand.o -MD -MP -MF commands/$(DEPDIR)/audacity-GetTrackInfoCommand.Tpo -c -o commands/audacity-GetTrackInfoCommand.o `test -f 'commands/GetTrackInfoCommand.cpp' || echo '$(srcdir)/'`commands/GetTrackInfoCommand.cpp
@ -4436,6 +4442,20 @@ commands/audacity-Keyboard.obj: commands/Keyboard.cpp
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(audacity_CPPFLAGS) $(CPPFLAGS) $(audacity_CXXFLAGS) $(CXXFLAGS) -c -o commands/audacity-Keyboard.obj `if test -f 'commands/Keyboard.cpp'; then $(CYGPATH_W) 'commands/Keyboard.cpp'; else $(CYGPATH_W) '$(srcdir)/commands/Keyboard.cpp'; fi`
commands/audacity-LoadCommands.o: commands/LoadCommands.cpp
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(audacity_CPPFLAGS) $(CPPFLAGS) $(audacity_CXXFLAGS) $(CXXFLAGS) -MT commands/audacity-LoadCommands.o -MD -MP -MF commands/$(DEPDIR)/audacity-LoadCommands.Tpo -c -o commands/audacity-LoadCommands.o `test -f 'commands/LoadCommands.cpp' || echo '$(srcdir)/'`commands/LoadCommands.cpp
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) commands/$(DEPDIR)/audacity-LoadCommands.Tpo commands/$(DEPDIR)/audacity-LoadCommands.Po
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='commands/LoadCommands.cpp' object='commands/audacity-LoadCommands.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(audacity_CPPFLAGS) $(CPPFLAGS) $(audacity_CXXFLAGS) $(CXXFLAGS) -c -o commands/audacity-LoadCommands.o `test -f 'commands/LoadCommands.cpp' || echo '$(srcdir)/'`commands/LoadCommands.cpp
commands/audacity-LoadCommands.obj: commands/LoadCommands.cpp
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(audacity_CPPFLAGS) $(CPPFLAGS) $(audacity_CXXFLAGS) $(CXXFLAGS) -MT commands/audacity-LoadCommands.obj -MD -MP -MF commands/$(DEPDIR)/audacity-LoadCommands.Tpo -c -o commands/audacity-LoadCommands.obj `if test -f 'commands/LoadCommands.cpp'; then $(CYGPATH_W) 'commands/LoadCommands.cpp'; else $(CYGPATH_W) '$(srcdir)/commands/LoadCommands.cpp'; fi`
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) commands/$(DEPDIR)/audacity-LoadCommands.Tpo commands/$(DEPDIR)/audacity-LoadCommands.Po
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='commands/LoadCommands.cpp' object='commands/audacity-LoadCommands.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(audacity_CPPFLAGS) $(CPPFLAGS) $(audacity_CXXFLAGS) $(CXXFLAGS) -c -o commands/audacity-LoadCommands.obj `if test -f 'commands/LoadCommands.cpp'; then $(CYGPATH_W) 'commands/LoadCommands.cpp'; else $(CYGPATH_W) '$(srcdir)/commands/LoadCommands.cpp'; fi`
commands/audacity-MessageCommand.o: commands/MessageCommand.cpp
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(audacity_CPPFLAGS) $(CPPFLAGS) $(audacity_CXXFLAGS) $(CXXFLAGS) -MT commands/audacity-MessageCommand.o -MD -MP -MF commands/$(DEPDIR)/audacity-MessageCommand.Tpo -c -o commands/audacity-MessageCommand.o `test -f 'commands/MessageCommand.cpp' || echo '$(srcdir)/'`commands/MessageCommand.cpp
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) commands/$(DEPDIR)/audacity-MessageCommand.Tpo commands/$(DEPDIR)/audacity-MessageCommand.Po
@ -4534,20 +4554,6 @@ commands/audacity-SelectCommand.obj: commands/SelectCommand.cpp
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(audacity_CPPFLAGS) $(CPPFLAGS) $(audacity_CXXFLAGS) $(CXXFLAGS) -c -o commands/audacity-SelectCommand.obj `if test -f 'commands/SelectCommand.cpp'; then $(CYGPATH_W) 'commands/SelectCommand.cpp'; else $(CYGPATH_W) '$(srcdir)/commands/SelectCommand.cpp'; fi`
commands/audacity-SetProjectInfoCommand.o: commands/SetProjectInfoCommand.cpp
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(audacity_CPPFLAGS) $(CPPFLAGS) $(audacity_CXXFLAGS) $(CXXFLAGS) -MT commands/audacity-SetProjectInfoCommand.o -MD -MP -MF commands/$(DEPDIR)/audacity-SetProjectInfoCommand.Tpo -c -o commands/audacity-SetProjectInfoCommand.o `test -f 'commands/SetProjectInfoCommand.cpp' || echo '$(srcdir)/'`commands/SetProjectInfoCommand.cpp
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) commands/$(DEPDIR)/audacity-SetProjectInfoCommand.Tpo commands/$(DEPDIR)/audacity-SetProjectInfoCommand.Po
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='commands/SetProjectInfoCommand.cpp' object='commands/audacity-SetProjectInfoCommand.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(audacity_CPPFLAGS) $(CPPFLAGS) $(audacity_CXXFLAGS) $(CXXFLAGS) -c -o commands/audacity-SetProjectInfoCommand.o `test -f 'commands/SetProjectInfoCommand.cpp' || echo '$(srcdir)/'`commands/SetProjectInfoCommand.cpp
commands/audacity-SetProjectInfoCommand.obj: commands/SetProjectInfoCommand.cpp
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(audacity_CPPFLAGS) $(CPPFLAGS) $(audacity_CXXFLAGS) $(CXXFLAGS) -MT commands/audacity-SetProjectInfoCommand.obj -MD -MP -MF commands/$(DEPDIR)/audacity-SetProjectInfoCommand.Tpo -c -o commands/audacity-SetProjectInfoCommand.obj `if test -f 'commands/SetProjectInfoCommand.cpp'; then $(CYGPATH_W) 'commands/SetProjectInfoCommand.cpp'; else $(CYGPATH_W) '$(srcdir)/commands/SetProjectInfoCommand.cpp'; fi`
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) commands/$(DEPDIR)/audacity-SetProjectInfoCommand.Tpo commands/$(DEPDIR)/audacity-SetProjectInfoCommand.Po
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='commands/SetProjectInfoCommand.cpp' object='commands/audacity-SetProjectInfoCommand.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(audacity_CPPFLAGS) $(CPPFLAGS) $(audacity_CXXFLAGS) $(CXXFLAGS) -c -o commands/audacity-SetProjectInfoCommand.obj `if test -f 'commands/SetProjectInfoCommand.cpp'; then $(CYGPATH_W) 'commands/SetProjectInfoCommand.cpp'; else $(CYGPATH_W) '$(srcdir)/commands/SetProjectInfoCommand.cpp'; fi`
commands/audacity-SetTrackInfoCommand.o: commands/SetTrackInfoCommand.cpp
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(audacity_CPPFLAGS) $(CPPFLAGS) $(audacity_CXXFLAGS) $(CXXFLAGS) -MT commands/audacity-SetTrackInfoCommand.o -MD -MP -MF commands/$(DEPDIR)/audacity-SetTrackInfoCommand.Tpo -c -o commands/audacity-SetTrackInfoCommand.o `test -f 'commands/SetTrackInfoCommand.cpp' || echo '$(srcdir)/'`commands/SetTrackInfoCommand.cpp
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) commands/$(DEPDIR)/audacity-SetTrackInfoCommand.Tpo commands/$(DEPDIR)/audacity-SetTrackInfoCommand.Po
@ -7597,8 +7603,6 @@ uninstall-am: uninstall-binPROGRAMS uninstall-desktopDATA \
tags tags-am uninstall uninstall-am uninstall-binPROGRAMS \
uninstall-desktopDATA uninstall-dist_mimeDATA
.PRECIOUS: Makefile
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.

View File

@ -478,7 +478,8 @@ public:
reinit(count, initialize);
}
ArrayOf(const ArrayOf&) PROHIBITED;
//ArrayOf(const ArrayOf&) PROHIBITED;
ArrayOf(const ArrayOf&) = delete;
ArrayOf(ArrayOf&& that)
: std::unique_ptr < X[] >
(std::move((std::unique_ptr < X[] >&)(that)))
@ -536,7 +537,8 @@ public:
(*this)[ii] = ArrayOf<X>{ M, initialize };
}
ArraysOf(const ArraysOf&) PROHIBITED;
//ArraysOf(const ArraysOf&) PROHIBITED;
ArraysOf(const ArraysOf&) =delete;
ArraysOf& operator= (ArraysOf&& that)
{
ArrayOf<ArrayOf<X>>::operator=(std::move(that));

View File

@ -139,6 +139,8 @@ simplifies construction of menu items.
#include "widgets/Meter.h"
#include "widgets/ErrorDialog.h"
#include "./commands/AudacityCommand.h"
#include "commands/CommandContext.h"
enum {
kAlignStartZero = 0,
@ -163,7 +165,7 @@ enum {
POST_TIMER_RECORD_SHUTDOWN
};
#include "commands/CommandFunctors.h"
#include "commands/CommandContext.h"
#include "commands/ScreenshotCommand.h"
//
// Effects menu arrays
@ -1134,7 +1136,7 @@ void AudacityProject::CreateMenusAndCommands()
wxString buildMenuLabel;
if (!mLastEffect.IsEmpty()) {
buildMenuLabel.Printf(_("Repeat %s"),
EffectManager::Get().GetEffectName(mLastEffect));
EffectManager::Get().GetCommandName(mLastEffect));
}
else
buildMenuLabel = _("Repeat Last Effect");
@ -1247,7 +1249,7 @@ void AudacityProject::CreateMenusAndCommands()
gAudioIO->mDetectUpstreamDropouts);
#endif
c->AddItem(wxT("Screenshot"), _("&Screenshot Tools..."), FN(OnScreenshot));
c->AddItem(wxT("FancyScreenshot"), _("&Screenshot Tools..."), FN(OnScreenshot));
// PRL: team consensus for 2.2.0 was, we let end users have this diagnostic,
// as they used to in 1.3.x
@ -1584,6 +1586,33 @@ void AudacityProject::CreateMenusAndCommands()
AudioIONotBusyFlag | TrackPanelHasFocus | TracksExistFlag);
c->EndSubMenu();
// Effects Manager also (now) manages Generic commands.
// plug-in manager, as if an effect.
c->BeginSubMenu(_("&Automation"));
// Note that the PLUGIN_SYMBOL must have a space between words,
// whereas the short-form used here must not.
// (If you did write "CompareAudio" for the PLUGIN_SYMBOL name, then
// you would have to use "Compareaudio" here.)
c->AddItem(wxT("Demo"), _("Just a Demo!"), FN(OnAudacityCommand),
AudioIONotBusyFlag, AudioIONotBusyFlag);
c->AddItem(wxT("Screenshot"), _("Screenshot (Vanilla)"), FN(OnAudacityCommand),
AudioIONotBusyFlag, AudioIONotBusyFlag);
c->AddItem(wxT("SetTrackInfo"), _("Set Track Info"), FN(OnAudacityCommand),
AudioIONotBusyFlag, AudioIONotBusyFlag);
c->AddItem(wxT("CompareAudio"), _("Compare Audio"), FN(OnAudacityCommand),
AudioIONotBusyFlag, AudioIONotBusyFlag);
c->AddItem(wxT("SelectTime"), _("Select Time"), FN(OnAudacityCommand),
AudioIONotBusyFlag, AudioIONotBusyFlag);
c->AddItem(wxT("SelectTracks"), _("Select Tracks"), FN(OnAudacityCommand),
AudioIONotBusyFlag, AudioIONotBusyFlag);
c->AddItem(wxT("Select"), _("Select"), FN(OnAudacityCommand),
AudioIONotBusyFlag, AudioIONotBusyFlag);
c->EndSubMenu();
// Accel key is not bindable.
c->AddItem(wxT("FullScreenOnOff"), _("&Full screen (on/off)"), FN(OnFullScreen),
#ifdef __WXMAC__
@ -1600,6 +1629,9 @@ void AudacityProject::CreateMenusAndCommands()
FN(OnMacMinimizeAll), wxT("Ctrl+Alt+M"),
AlwaysEnabledFlag, AlwaysEnabledFlag);
#endif
c->EndMenu();
@ -1881,12 +1913,14 @@ void AudacityProject::AddEffectMenuItemGroup(CommandManager *c,
c->BeginSubMenu(name);
while (i < namesCnt && names[i].IsSameAs(name))
{
wxString item = PluginManager::Get().GetPlugin(plugs[i])->GetPath();
c->AddItem(item,
item,
FN(OnEffect),
flags[i],
flags[i], plugs[i]);
const PluginDescriptor *plug = PluginManager::Get().GetPlugin(plugs[i]);
wxString item = plug->GetPath();
if( plug->GetPluginType() == PluginTypeEffect )
c->AddItem(item,
item,
FN(OnEffect),
flags[i],
flags[i], plugs[i]);
i++;
}
@ -1895,11 +1929,13 @@ void AudacityProject::AddEffectMenuItemGroup(CommandManager *c,
}
else
{
c->AddItem(names[i],
names[i],
FN(OnEffect),
flags[i],
flags[i], plugs[i]);
const PluginDescriptor *plug = PluginManager::Get().GetPlugin(plugs[i]);
if( plug->GetPluginType() == PluginTypeEffect )
c->AddItem(names[i],
names[i],
FN(OnEffect),
flags[i],
flags[i], plugs[i]);
}
if (max > 0)
@ -4305,6 +4341,48 @@ void AudacityProject::OnZeroCrossing(const CommandContext &WXUNUSED(context) )
mTrackPanel->Refresh(false);
}
/// DoAudacityCommand() takes a PluginID and executes the assocated effect.
///
/// At the moment flags are used only to indicate whether to prompt for parameters,
bool AudacityProject::DoAudacityCommand(const PluginID & ID, const CommandContext & context, int flags)
{
const PluginDescriptor *plug = PluginManager::Get().GetPlugin(ID);
if (!plug)
return false;
if (flags & OnEffectFlags::kConfigured)
{
OnStop(*this);
// SelectAllIfNone();
}
EffectManager & em = EffectManager::Get();
bool success = em.DoAudacityCommand(ID,
context,
this,
(flags & OnEffectFlags::kConfigured) == 0);
if (!success)
return false;
/*
if (em.GetSkipStateFlag())
flags = flags | OnEffectFlags::kSkipState;
if (!(flags & OnEffectFlags::kSkipState))
{
wxString shortDesc = em.GetCommandName(ID);
wxString longDesc = em.GetCommandDescription(ID);
PushState(longDesc, shortDesc);
}
*/
RedrawProject();
return true;
}
//
// Effect Menus
//
@ -4313,7 +4391,7 @@ void AudacityProject::OnZeroCrossing(const CommandContext &WXUNUSED(context) )
///
/// At the moment flags are used only to indicate whether to prompt for parameters,
/// whether to save the state to history and whether to allow 'Repeat Last Effect'.
bool AudacityProject::DoEffect(const PluginID & ID, int flags)
bool AudacityProject::DoEffect(const PluginID & ID, const CommandContext &WXUNUSED(context), int flags)
{
const PluginDescriptor *plug = PluginManager::Get().GetPlugin(ID);
if (!plug)
@ -4374,7 +4452,7 @@ bool AudacityProject::DoEffect(const PluginID & ID, int flags)
newTrack->SetSelected(true);
}
}
EffectManager & em = EffectManager::Get();
success = em.DoEffect(ID, this, mRate,
@ -4390,8 +4468,8 @@ bool AudacityProject::DoEffect(const PluginID & ID, int flags)
if (!(flags & OnEffectFlags::kSkipState))
{
wxString shortDesc = em.GetEffectName(ID);
wxString longDesc = em.GetEffectDescription(ID);
wxString shortDesc = em.GetCommandName(ID);
wxString longDesc = em.GetCommandDescription(ID);
PushState(longDesc, shortDesc);
}
@ -4400,7 +4478,7 @@ bool AudacityProject::DoEffect(const PluginID & ID, int flags)
// Only remember a successful effect, don't remember insert,
// or analyze effects.
if (type == EffectTypeProcess) {
wxString shortDesc = em.GetEffectName(ID);
wxString shortDesc = em.GetCommandName(ID);
mLastEffect = ID;
wxString lastEffectDesc;
/* i18n-hint: %s will be the name of the effect which will be
@ -4442,14 +4520,14 @@ bool AudacityProject::DoEffect(const PluginID & ID, int flags)
void AudacityProject::OnEffect(const CommandContext &context)
{
DoEffect(context.parameter, 0);
DoEffect(context.parameter, context, 0);
}
void AudacityProject::OnRepeatLastEffect(const CommandContext &context)
{
if (!mLastEffect.IsEmpty())
{
DoEffect(mLastEffect, OnEffectFlags::kConfigured);
DoEffect(mLastEffect, context, OnEffectFlags::kConfigured);
}
}
@ -4498,7 +4576,16 @@ void AudacityProject::OnManageAnalyzers(const CommandContext &WXUNUSED(context)
void AudacityProject::OnStereoToMono(const CommandContext &context)
{
DoEffect(EffectManager::Get().GetEffectByIdentifier(wxT("StereoToMono")),
OnEffectFlags::kConfigured);
context,
OnEffectFlags::kConfigured);
}
void AudacityProject::OnAudacityCommand(const CommandContext & ctx)
{
wxLogDebug( "Command was: %s", ctx.parameter);
DoAudacityCommand(EffectManager::Get().GetEffectByIdentifier(ctx.parameter),
ctx,
OnEffectFlags::kNone); // Not configured, so prompt user.
}
//

View File

@ -13,6 +13,7 @@
#include "Experimental.h"
// These are all member functions of class AudacityProject.
// Vaughan, 2010-08-05:
// Note that this file is included in a "public" section of Project.h.
@ -487,12 +488,14 @@ public:
static const int kDontRepeatLast = 0x04;
};
bool DoEffect(const PluginID & ID, int flags);
bool DoEffect(const PluginID & ID, const CommandContext & context, int flags);
void OnEffect(const CommandContext &context );
void OnRepeatLastEffect(const CommandContext &context );
bool DoAudacityCommand(const PluginID & ID, const CommandContext &, int flags);
void OnApplyChain(const CommandContext &context );
void OnEditChains(const CommandContext &context );
void OnStereoToMono(const CommandContext &context );
void OnAudacityCommand(const CommandContext &context );
void OnManagePluginsMenu(EffectType Type);
static void RebuildAllMenuBars();
void OnManageGenerators(const CommandContext &context );
@ -556,6 +559,7 @@ double GridMove(double t, int minPix);
// Make sure we return to "public" for subsequent declarations in Project.h.
public:
#endif

View File

@ -539,7 +539,7 @@ wxArrayString ModuleManager::FindPluginsForProvider(const PluginID & providerID,
return mDynModules[providerID]->FindPluginPaths(PluginManager::Get());
}
bool ModuleManager::RegisterPlugin(const PluginID & providerID, const wxString & path, wxString &errMsg)
bool ModuleManager::RegisterEffectPlugin(const PluginID & providerID, const wxString & path, wxString &errMsg)
{
errMsg.clear();
if (mDynModules.find(providerID) == mDynModules.end())
@ -547,7 +547,7 @@ bool ModuleManager::RegisterPlugin(const PluginID & providerID, const wxString &
return false;
}
auto nFound = mDynModules[providerID]->DiscoverPluginsAtPath(path, errMsg);
auto nFound = mDynModules[providerID]->DiscoverPluginsAtPath(path, errMsg, PluginManagerInterface::DefaultRegistrationCallback);
return nFound > 0;
}

View File

@ -99,7 +99,7 @@ public:
void FindAllPlugins(PluginIDList & providers, wxArrayString & paths);
wxArrayString FindPluginsForProvider(const PluginID & provider, const wxString & path);
bool RegisterPlugin(const PluginID & provider, const wxString & path,
bool RegisterEffectPlugin(const PluginID & provider, const wxString & path,
wxString &errMsg);
IdentInterface *CreateProviderInstance(const PluginID & provider, const wxString & path);

View File

@ -11,7 +11,12 @@
\file PluginManager.cpp
\brief
*//*******************************************************************/
************************************************************************//**
\class PluginManager
\brief PluginManager maintains a list of all plug ins. That covers modules,
effects, generators, analysis-effects, commands. It also has functions
for shared and private configs - which need to move out.
*****************************************************************************/
#include <algorithm>
@ -952,7 +957,8 @@ void PluginRegistrationDialog::OnOK(wxCommandEvent & WXUNUSED(evt))
mLongestPath + wxT("\n");
wxString msg;
msg.Printf(_("Enabling effects:\n\n%s"), last3);
msg.Printf(_("Enabling effects or commands:\n\n%s"), last3);
// Make sure the progress dialog is deleted before we call EndModal() or
// we will leave the project window in an unusable state on OSX.
@ -970,7 +976,7 @@ void PluginRegistrationDialog::OnOK(wxCommandEvent & WXUNUSED(evt))
if (item.state == STATE_Enabled && item.plugs[0]->GetPluginType() == PluginTypeStub)
{
last3 = last3.AfterFirst(wxT('\n')) + item.path + wxT("\n");
auto status = progress.Update(++i, enableCount, wxString::Format(_("Enabling effect:\n\n%s"), last3));
auto status = progress.Update(++i, enableCount, wxString::Format(_("Enabling effect or command:\n\n%s"), last3));
if (status == ProgressResult::Cancelled)
{
break;
@ -982,7 +988,7 @@ void PluginRegistrationDialog::OnOK(wxCommandEvent & WXUNUSED(evt))
for (size_t j = 0, cnt = item.plugs.size(); j < cnt; j++)
{
wxString errMsg;
if (mm.RegisterPlugin(item.plugs[j]->GetProviderID(), path,
if (mm.RegisterEffectPlugin(item.plugs[j]->GetProviderID(), path,
errMsg))
{
for (size_t j = 0, cnt = item.plugs.size(); j < cnt; j++)
@ -1000,7 +1006,7 @@ void PluginRegistrationDialog::OnOK(wxCommandEvent & WXUNUSED(evt))
}
if (!errMsgs.empty())
AudacityMessageBox( wxString::Format(
_("Effect at %s failed to register:\n%s"),
_("Effect or Command at %s failed to register:\n%s"),
path, errMsgs
) );
}
@ -1370,11 +1376,21 @@ void PluginDescriptor::SetImporterExtensions(const wxArrayString & extensions)
// ============================================================================
const PluginID &PluginManagerInterface::DefaultRegistrationCallback(
ModuleInterface *provider, EffectIdentInterface *pInterface )
ModuleInterface *provider, CommandDefinitionInterface *pInterface )
{
EffectDefinitionInterface * pEInterface = dynamic_cast<EffectDefinitionInterface*>(pInterface);
if( pEInterface )
return PluginManager::Get().RegisterPlugin(provider, pEInterface, PluginTypeEffect);
return PluginManager::Get().RegisterPlugin(provider, pInterface);
}
const PluginID &PluginManagerInterface::GenericRegistrationCallback(
ModuleInterface *provider, CommandDefinitionInterface *pInterface )
{
return PluginManager::Get().RegisterPlugin(provider, pInterface);
}
bool PluginManager::IsPluginRegistered(const wxString & path)
{
for (PluginMap::iterator iter = mPlugins.begin(); iter != mPlugins.end(); ++iter)
@ -1398,9 +1414,28 @@ const PluginID & PluginManager::RegisterPlugin(ModuleInterface *module)
return plug.GetID();
}
const PluginID & PluginManager::RegisterPlugin(ModuleInterface *provider, EffectIdentInterface *effect)
const PluginID & PluginManager::RegisterPlugin(ModuleInterface *provider, CommandDefinitionInterface *command)
{
PluginDescriptor & plug = CreatePlugin(GetID(effect), effect, PluginTypeEffect);
PluginDescriptor & plug = CreatePlugin(GetID(command), command, (PluginType)PluginTypeGeneric);
plug.SetProviderID(PluginManager::GetID(provider));
//plug.SetEffectType(effect->GetType());
//plug.SetEffectFamily(effect->GetFamily());
//plug.SetEffectInteractive(effect->IsInteractive());
//plug.SetEffectDefault(effect->IsDefault());
//plug.SetEffectRealtime(effect->SupportsRealtime());
//plug.SetEffectAutomatable(effect->SupportsAutomation());
plug.SetEnabled(true);
plug.SetValid(true);
return plug.GetID();
}
const PluginID & PluginManager::RegisterPlugin(ModuleInterface *provider, EffectDefinitionInterface *effect, int type)
{
PluginDescriptor & plug = CreatePlugin(GetID(effect), effect, (PluginType)type);
plug.SetProviderID(PluginManager::GetID(provider));
@ -1805,15 +1840,14 @@ bool PluginManager::DropFile(const wxString &fileName)
std::vector<PluginID> ids;
std::vector<wxString> names;
nPlugIns = module->DiscoverPluginsAtPath(dstPath, errMsg,
[&](ModuleInterface *provider, EffectIdentInterface *ident){
[&](ModuleInterface *provider, CommandDefinitionInterface *ident){
// Register as by default, but also collecting the PluginIDs
// and names
const auto &id =
PluginManagerInterface::DefaultRegistrationCallback(
const PluginID * id = &PluginManagerInterface::DefaultRegistrationCallback(
provider, ident);
ids.push_back(id);
ids.push_back(*id);
names.push_back( wxGetTranslation( ident->GetName() ) );
return id;
return *id;
});
if ( ! nPlugIns ) {
// Unlikely after the dry run succeeded
@ -1877,6 +1911,7 @@ void PluginManager::Load()
// Now the rest
LoadGroup(&registry, PluginTypeEffect);
LoadGroup(&registry, PluginTypeGeneric );
LoadGroup(&registry, PluginTypeExporter);
LoadGroup(&registry, PluginTypeImporter);
@ -2174,12 +2209,13 @@ void PluginManager::Save()
// Save the individual groups
SaveGroup(&registry, PluginTypeEffect);
SaveGroup(&registry, PluginTypeExporter);
SaveGroup(&registry, PluginTypeGeneric);
SaveGroup(&registry, PluginTypeImporter);
SaveGroup(&registry, PluginTypeStub);
// Not used by 2.1.1 or greater, but must save to allow users to switch between 2.1.0
// and 2.1.1+. This should be removed after a few releases past 2.1.0.
SaveGroup(&registry, PluginTypeNone);
//SaveGroup(&registry, PluginTypeNone);
// And now the providers
SaveGroup(&registry, PluginTypeModule);
@ -2377,9 +2413,9 @@ bool PluginManager::ShowManager(wxWindow *parent, EffectType type)
// Here solely for the purpose of Nyquist Workbench until
// a better solution is devised.
const PluginID & PluginManager::RegisterPlugin(EffectIdentInterface *effect)
const PluginID & PluginManager::RegisterPlugin(EffectDefinitionInterface *effect, PluginType type)
{
PluginDescriptor & plug = CreatePlugin(GetID(effect), effect, PluginTypeEffect);
PluginDescriptor & plug = CreatePlugin(GetID(effect), effect, type);
plug.SetEffectType(effect->GetType());
plug.SetEffectFamilyId(effect->GetFamilyId());
@ -2433,40 +2469,40 @@ const PluginDescriptor *PluginManager::GetPlugin(const PluginID & ID)
return &mPlugins[ID];
}
const PluginDescriptor *PluginManager::GetFirstPlugin(PluginType type)
const PluginDescriptor *PluginManager::GetFirstPlugin(int type)
{
for (mPluginsIter = mPlugins.begin(); mPluginsIter != mPlugins.end(); ++mPluginsIter)
{
PluginDescriptor & plug = mPluginsIter->second;
bool familyEnabled = true;
if (type == PluginTypeEffect)
PluginType plugType = plug.GetPluginType();
if( plug.IsValid() && plug.IsEnabled() && ((plugType & type) != 0))
{
// This preference may be written by EffectsPrefs
gPrefs->Read(plug.GetEffectFamilyId() + wxT("/Enable"), &familyEnabled, true);
}
if (plug.IsValid() && plug.IsEnabled() && plug.GetPluginType() == type && familyEnabled)
{
return &mPluginsIter->second;
bool familyEnabled = true;
if( (plugType & PluginTypeEffect) != 0)
// This preference may be written by EffectsPrefs
gPrefs->Read(plug.GetEffectFamilyId() + wxT("/Enable"), &familyEnabled, true);
if (familyEnabled)
return &mPluginsIter->second;
}
}
return NULL;
}
const PluginDescriptor *PluginManager::GetNextPlugin(PluginType type)
const PluginDescriptor *PluginManager::GetNextPlugin(int type)
{
while (++mPluginsIter != mPlugins.end())
{
PluginDescriptor & plug = mPluginsIter->second;
bool familyEnabled = true;
if (type == PluginTypeEffect)
PluginType plugType = plug.GetPluginType();
if( plug.IsValid() && plug.IsEnabled() && ((plugType & type) != 0))
{
// This preference may be written by EffectsPrefs
gPrefs->Read(plug.GetEffectFamilyId() + wxT("/Enable"), &familyEnabled, true);
}
if (plug.IsValid() && plug.IsEnabled() && plug.GetPluginType() == type && familyEnabled)
{
return &mPluginsIter->second;
bool familyEnabled = true;
if( (plugType & PluginTypeEffect) != 0)
// This preference may be written by EffectsPrefs
gPrefs->Read(plug.GetEffectFamilyId() + wxT("/Enable"), &familyEnabled, true);
if (familyEnabled)
return &mPluginsIter->second;
}
}
@ -2596,7 +2632,17 @@ PluginID PluginManager::GetID(ModuleInterface *module)
module->GetPath());
}
PluginID PluginManager::GetID(EffectIdentInterface *effect)
PluginID PluginManager::GetID(CommandDefinitionInterface *command)
{
return wxString::Format(wxT("%s_%s_%s_%s_%s"),
GetPluginTypeString(PluginTypeGeneric),
wxEmptyString,
command->GetVendor(),
command->GetName(),
command->GetPath());
}
PluginID PluginManager::GetID(EffectDefinitionInterface *effect)
{
return wxString::Format(wxT("%s_%s_%s_%s_%s"),
GetPluginTypeString(PluginTypeEffect),
@ -2624,6 +2670,7 @@ wxString PluginManager::GetPluginTypeString(PluginType type)
switch (type)
{
default:
case PluginTypeNone:
str = wxT("Placeholder");
break;
@ -2633,6 +2680,9 @@ wxString PluginManager::GetPluginTypeString(PluginType type)
case PluginTypeEffect:
str = wxT("Effect");
break;
case PluginTypeGeneric:
str = wxT("Generic");
break;
case PluginTypeExporter:
str = wxT("Exporter");
break;

View File

@ -31,12 +31,13 @@
typedef enum
{
PluginTypeNone = -1, // 2.1.0 placeholder entries...not used by 2.1.1 or greater
PluginTypeStub, // Used for plugins that have not yet been registered
PluginTypeEffect,
PluginTypeExporter,
PluginTypeImporter,
PluginTypeModule,
PluginTypeNone = 0, // 2.1.0 placeholder entries...not used by 2.1.1 or greater
PluginTypeStub =1, // Used for plugins that have not yet been registered
PluginTypeEffect =1<<1,
PluginTypeGeneric=1<<2,
PluginTypeExporter=1<<3,
PluginTypeImporter=1<<4,
PluginTypeModule=1<<5,
} PluginType;
// TODO: Convert this to multiple derived classes
@ -182,7 +183,8 @@ public:
bool IsPluginRegistered(const wxString & path) override;
const PluginID & RegisterPlugin(ModuleInterface *module) override;
const PluginID & RegisterPlugin(ModuleInterface *provider, EffectIdentInterface *effect) override;
const PluginID & RegisterPlugin(ModuleInterface *provider, CommandDefinitionInterface *command);
const PluginID & RegisterPlugin(ModuleInterface *provider, EffectDefinitionInterface *effect, int type) override;
const PluginID & RegisterPlugin(ModuleInterface *provider, ImporterInterface *importer) override;
void FindFilesInPathList(const wxString & pattern,
@ -236,7 +238,8 @@ public:
static PluginManager & Get();
static PluginID GetID(ModuleInterface *module);
static PluginID GetID(EffectIdentInterface *effect);
static PluginID GetID(CommandDefinitionInterface *command);
static PluginID GetID(EffectDefinitionInterface *effect);
static PluginID GetID(ImporterInterface *importer);
// This string persists in configuration files
@ -246,8 +249,8 @@ public:
int GetPluginCount(PluginType type);
const PluginDescriptor *GetPlugin(const PluginID & ID);
const PluginDescriptor *GetFirstPlugin(PluginType type);
const PluginDescriptor *GetNextPlugin(PluginType type);
const PluginDescriptor *GetFirstPlugin(int type); // possible or of several PlugInTypes.
const PluginDescriptor *GetNextPlugin( int type);
const PluginDescriptor *GetFirstPluginForEffectType(EffectType type);
const PluginDescriptor *GetNextPluginForEffectType(EffectType type);
@ -265,9 +268,7 @@ public:
bool ShowManager(wxWindow *parent, EffectType type = EffectTypeNone);
// Here solely for the purpose of Nyquist Workbench until
// a better solution is devised.
const PluginID & RegisterPlugin(EffectIdentInterface *effect);
const PluginID & RegisterPlugin(EffectDefinitionInterface *effect, PluginType type );
void UnregisterPlugin(const PluginID & ID);
private:

View File

@ -165,6 +165,7 @@ scroll information. It also has some status flags.
#include "commands/CommandTargets.h"
#include "commands/Command.h"
#include "commands/CommandType.h"
#include "commands/CommandContext.h"
#include "../images/AudacityLogoAlpha.xpm"
@ -4304,8 +4305,10 @@ bool AudacityProject::Import(const wxString &fileName, WaveTrackArray* pTrackArr
//TODO: All we want is a SelectAll()
SelectNone();
SelectAllIfNone();
const CommandContext context( *this);
DoEffect(EffectManager::Get().GetEffectByIdentifier(wxT("Normalize")),
OnEffectFlags::kConfigured);
context,
OnEffectFlags::kConfigured);
}
// This is a no-fail:
@ -5177,7 +5180,7 @@ void AudacityProject::SafeDisplayStatusMessage(const wxChar *msg)
TargetFactory::MessageDefault());
CommandType *type = CommandDirectory::Get()->LookUp(wxT("Message"));
wxASSERT_MSG(type != NULL, wxT("Message command not found!"));
CommandHolder statusCmd = type->Create(std::move(target));
OldStyleCommandPointer statusCmd = type->Create(std::move(target));
statusCmd->SetParameter(wxT("MessageString"), msg);
ScriptCommandRelay::PostCommand(this, statusCmd);

View File

@ -155,6 +155,22 @@ class ImportXMLTagHandler final : public XMLTagHandler
AudacityProject* mProject;
};
class EffectPlugs;
typedef wxArrayString PluginIDList;
class CommandContext;
class CommandManager;
class Track;
class TrackHolder;
class TrackList;
class WaveClip;
class WaveTrack;
#include "./commands/CommandFlag.h"
#include "../include/audacity/EffectInterface.h"
#include "./commands/CommandManager.h"
class AUDACITY_DLL_API AudacityProject final : public wxFrame,
public TrackPanelListener,
public SelectionBarListener,

50
src/Registrar.h Normal file
View File

@ -0,0 +1,50 @@
/**********************************************************************
Audacity: A Digital Audio Editor
Registrar.h
James Crook
*******************************************************************//**
\class Registrar
\brief Base class for registration callback.
Audcaity will call providers RegisterNameOfThing() functions with
an &Registrar as the argument. RegisterNameOfThing() is then
responsible for calling the appropriate callback functions.
**********************************************************************/
#ifndef __AUDACITY_REGISTRAR__
#define __AUDACITY_REGISTRAR__
#include "Audacity.h"
#include "MemoryX.h"
class Command;
class LoadableModule;
class CommandDefinitionInterface;
class Effect;
class AUDACITY_DLL_API Registrar
{
public:
Registrar(){
bWantsModules = false;
bWantsCommands= false;
bWantsCommandTypes= false;
bWantsEffects= false;
}
bool bWantsModules;
bool bWantsCommands;
bool bWantsCommandTypes;
bool bWantsEffects;
virtual void AddCommandType(movable_ptr<CommandDefinitionInterface> && WXUNUSED(comDef) ){;};
virtual void AddCommand(movable_ptr<AudacityCommand> && WXUNUSED(command) ){;};
virtual void AddModule(movable_ptr<LoadableModule> && WXUNUSED(module) ){;};
virtual void AddEffect(movable_ptr<Effect> && WXUNUSED(effect) ){;};
};
#endif

View File

@ -6,13 +6,22 @@
Dominic Mazzoni
*******************************************************************/
*******************************************************************//**
\class ScreenFrame
\brief ScreenFrame provides an alternative Gui for ScreenshotCommand.
It adds a timer that allows a delay before taking a screenshot,
provides lots of one-click buttons, options to resize the screen.
It forwards the actual work of doing the commands to the ScreenshotCommand.
***********************************************************************/
#include "Screenshot.h"
#include "MemoryX.h"
#include "commands/ScreenshotCommand.h"
#include "commands/CommandTargets.h"
#include "commands/CommandDirectory.h"
#include "commands/CommandContext.h"
#include <wx/defs.h>
#include <wx/event.h>
#include <wx/frame.h>
@ -35,6 +44,7 @@
#include "Prefs.h"
#include "toolbars/ToolManager.h"
#include "Track.h"
class CommandType;
@ -88,7 +98,7 @@ class ScreenFrame final : public wxFrame
wxStatusBar *mStatus;
std::unique_ptr<ScreenshotCommand> mCommand;
CommandExecutionContext mContext;
CommandContext mContext;
DECLARE_EVENT_TABLE()
};
@ -241,9 +251,9 @@ std::unique_ptr<ScreenshotCommand> ScreenFrame::CreateCommand()
std::make_unique<CommandOutputTarget>(std::make_unique<NullProgressTarget>(),
std::make_shared<StatusBarTarget>(*mStatus),
std::make_shared<MessageBoxTarget>());
CommandType *type = CommandDirectory::Get()->LookUp(wxT("Screenshot"));
wxASSERT_MSG(type != NULL, wxT("Screenshot command doesn't exist!"));
return std::make_unique<ScreenshotCommand>(*type, std::move(output), this);
//CommandType *type = CommandDirectory::Get()->LookUp(wxT("Screenshot"));
//wxASSERT_MSG(type != NULL, wxT("Screenshot command doesn't exist!"));
return std::make_unique<ScreenshotCommand>();//*type, std::move(output), this);
}
ScreenFrame::ScreenFrame(wxWindow * parent, wxWindowID id)
@ -263,12 +273,12 @@ ScreenFrame::ScreenFrame(wxWindow * parent, wxWindowID id)
#endif
wxSYSTEM_MENU|wxCAPTION|wxCLOSE_BOX),
mContext(&wxGetApp(), GetActiveProject())
mContext( *GetActiveProject() )
{
mDelayCheckBox = NULL;
mDirectoryTextBox = NULL;
mStatus = CreateStatusBar();
mStatus = CreateStatusBar(3);
mCommand = CreateCommand();
Populate();
@ -543,21 +553,18 @@ void ScreenFrame::OnDirChoose(wxCommandEvent & WXUNUSED(event))
mDirectoryTextBox->SetValue(path);
gPrefs->Write(wxT("/ScreenshotPath"), path);
gPrefs->Flush();
mCommand->mPath = path;
}
}
void ScreenFrame::OnToggleBackgroundBlue(wxCommandEvent & WXUNUSED(event))
{
mWhite->SetValue(false);
mCommand->SetParameter(wxT("Background"),
mBlue->GetValue() ? wxT("Blue") : wxT("None"));
}
void ScreenFrame::OnToggleBackgroundWhite(wxCommandEvent & WXUNUSED(event))
{
mBlue->SetValue(false);
mCommand->SetParameter(wxT("Background"),
mWhite->GetValue() ? wxT("White") : wxT("None"));
}
void ScreenFrame::SizeMainWindow(int w, int h)
@ -583,9 +590,11 @@ void ScreenFrame::OnMainWindowLarge(wxCommandEvent & WXUNUSED(event))
void ScreenFrame::DoCapture(wxString captureMode)
{
Hide();
mCommand->SetParameter(wxT("FilePath"), mDirectoryTextBox->GetValue());
mCommand->SetParameter(wxT("CaptureMode"), captureMode);
//mCommand->SetParameter(wxT("FilePath"), mDirectoryTextBox->GetValue());
//mCommand->SetParameter(wxT("CaptureMode"), captureMode);
mCommand->mBack = mWhite->GetValue() ? "White" : mBlue->GetValue() ? "Blue" : "None";
mCommand->mPath = mDirectoryTextBox->GetValue();
mCommand->mWhat = captureMode;
if (!mCommand->Apply(mContext))
mStatus->SetStatusText(_("Capture failed!"), mainStatusBarField);
Show();
@ -597,32 +606,32 @@ void ScreenFrame::OnCaptureSomething(wxCommandEvent & event)
wxArrayString Names;
Names.Add(wxT("menus"));
Names.Add(wxT("effects"));
Names.Add(wxT("preferences"));
Names.Add(wxT("Menus"));
Names.Add(wxT("Effects"));
Names.Add(wxT("Preferences"));
Names.Add(wxT("toolbars"));
Names.Add(wxT("window"));
Names.Add(wxT("fullwindow"));
Names.Add(wxT("windowplus"));
Names.Add(wxT("fullscreen"));
Names.Add(wxT("selectionbar"));
Names.Add(wxT("spectralselection"));
Names.Add(wxT("tools"));
Names.Add(wxT("transport"));
Names.Add(wxT("mixer"));
Names.Add(wxT("meter"));
Names.Add(wxT("playmeter"));
Names.Add(wxT("recordmeter"));
Names.Add(wxT("edit"));
Names.Add(wxT("device"));
Names.Add(wxT("transcription"));
Names.Add(wxT("scrub"));
Names.Add(wxT("trackpanel"));
Names.Add(wxT("ruler"));
Names.Add(wxT("tracks"));
Names.Add(wxT("firsttrack"));
Names.Add(wxT("secondtrack"));
Names.Add(wxT("Toolbars"));
Names.Add(wxT("Window"));
Names.Add(wxT("Full_Window"));
Names.Add(wxT("Window_Plus"));
Names.Add(wxT("Fullscreen"));
Names.Add(wxT("Selectionbar"));
Names.Add(wxT("Spectral_Selection"));
Names.Add(wxT("Tools"));
Names.Add(wxT("Transport"));
Names.Add(wxT("Mixer"));
Names.Add(wxT("Meter"));
Names.Add(wxT("Play_Meter"));
Names.Add(wxT("Record_Meter"));
Names.Add(wxT("Edit"));
Names.Add(wxT("Device"));
Names.Add(wxT("Transcription"));
Names.Add(wxT("Scrub"));
Names.Add(wxT("Trackpanel"));
Names.Add(wxT("Ruler"));
Names.Add(wxT("Tracks"));
Names.Add(wxT("First_Track"));
Names.Add(wxT("Second_Track"));
DoCapture(Names[i]);
}

View File

@ -64,6 +64,8 @@ preferences.
#include <wx/radiobut.h>
#include <wx/button.h>
#include "../include/audacity/EffectAutomationParameters.h" // for command automation
//#include "Project.h"
#include "Shuttle.h"
#include "WrappedType.h"
@ -323,3 +325,231 @@ bool ShuttleCli::ExchangeWithMaster(const wxString & Name)
}
return true;
}
bool ShuttleParams::ExchangeWithMaster(const wxString & WXUNUSED(Name))
{
return true;
}
#pragma warning( push )
#pragma warning( disable: 4100 ) // unused parameters.
/*
void ShuttleParams::DefineEnum( int &var, const wxChar * key, const int vdefault, wxArrayString strings )
{
}
*/
void ShuttleGetAutomation::Define( bool & var, const wxChar * key, const bool vdefault, const bool vmin, const bool vmax, const bool vscl )
{
mpEap->Write(key, var);
}
void ShuttleGetAutomation::Define( int & var, const wxChar * key, const int vdefault, const int vmin, const int vmax, const int vscl )
{
mpEap->Write(key, var);
}
void ShuttleGetAutomation::Define( size_t & var, const wxChar * key, const int vdefault, const int vmin, const int vmax, const int vscl )
{
mpEap->Write(key, var);
}
void ShuttleGetAutomation::Define( double & var, const wxChar * key, const float vdefault, const float vmin, const float vmax, const float vscl )
{
mpEap->WriteFloat(key, var);
}
void ShuttleGetAutomation::Define( float & var, const wxChar * key, const float vdefault, const float vmin, const float vmax, const float vscl )
{
mpEap->WriteFloat(key, var);
}
void ShuttleGetAutomation::Define( double & var, const wxChar * key, const double vdefault, const double vmin, const double vmax, const double vscl )
{
mpEap->Write(key, var);
}
void ShuttleGetAutomation::Define( wxString &var, const wxChar * key, const wxString vdefault, const wxString vmin, const wxString vmax, const wxString vscl )
{
mpEap->Write(key, var);
}
void ShuttleGetAutomation::DefineEnum( wxString &var, const wxChar * key, const wxString vdefault, wxArrayString strings )
{
mpEap->Write(key, var);
}
void ShuttleGetAutomation::DefineEnum( int &var, const wxChar * key, const int vdefault, wxArrayString strings )
{
mpEap->Write(key, strings[var]);
}
void ShuttleSetAutomation::Define( bool & var, const wxChar * key, const bool vdefault, const bool vmin, const bool vmax, const bool vscl )
{
if( !bOK )
return;
// Use of temp in this and related functions is to handle the case of
// only committing values if all values pass verification.
bool temp =var;
bOK = mpEap->ReadAndVerify(key, &temp, vdefault);
if( bWrite && bOK)
var = temp;
}
void ShuttleSetAutomation::Define( int & var, const wxChar * key, const int vdefault, const int vmin, const int vmax, const int vscl )
{
if( !bOK )
return;
int temp =var;
bOK = mpEap->ReadAndVerify(key, &temp, vdefault, vmin, vmax);
if( bWrite && bOK)
var = temp;
}
void ShuttleSetAutomation::Define( size_t & var, const wxChar * key, const int vdefault, const int vmin, const int vmax, const int vscl )
{
if( !bOK )
return;
int temp = var;
bOK = mpEap->ReadAndVerify(key, &temp, vdefault, vmin, vmax);
if( bWrite && bOK )
var = temp;
}
void ShuttleSetAutomation::Define( float & var, const wxChar * key, const float vdefault, const float vmin, const float vmax, const float vscl )
{
if( !bOK )
return;
float temp = var;
bOK = mpEap->ReadAndVerify(key, &temp, vdefault, vmin, vmax);
if( bWrite && bOK )
var = temp;
}
void ShuttleSetAutomation::Define( double & var, const wxChar * key, const float vdefault, const float vmin, const float vmax, const float vscl )
{
if( !bOK )
return;
double temp = var;
bOK = mpEap->ReadAndVerify(key, &temp, vdefault, vmin, vmax);
if( bWrite && bOK)
var = temp;
}
void ShuttleSetAutomation::Define( double & var, const wxChar * key, const double vdefault, const double vmin, const double vmax, const double vscl )
{
if( !bOK )
return;
double temp = var;
bOK = mpEap->ReadAndVerify(key, &temp, vdefault, vmin, vmax);
if( bWrite && bOK)
var = temp;
}
void ShuttleSetAutomation::Define( wxString &var, const wxChar * key, const wxString vdefault, const wxString vmin, const wxString vmax, const wxString vscl )
{
if( !bOK )
return;
wxString temp = var;
bOK = mpEap->ReadAndVerify(key, &temp, vdefault);
if( bWrite && bOK )
var = temp;
}
void ShuttleSetAutomation::DefineEnum( wxString &var, const wxChar * key, const wxString vdefault, wxArrayString strings )
{
if( !bOK )
return;
int temp =0;
bOK = mpEap->ReadAndVerify(key, &temp, vdefault, strings);
if( bWrite && bOK)
var = strings[temp];
}
void ShuttleSetAutomation::DefineEnum( int &var, const wxChar * key, const int vdefault, wxArrayString strings )
{
if( !bOK )
return;
int temp = var;
bOK = mpEap->ReadAndVerify(key, &temp, vdefault, strings);
if( bWrite && bOK)
var = temp;
}
// JSON definitions.
// All these MUST end with ",\r\n", so that we can put them in an array (and so we can remove the last "," easily for JSON).
void ShuttleGetDefinition::Define( bool & var, const wxChar * key, const bool vdefault, const bool vmin, const bool vmax, const bool vscl )
{
Result += wxString::Format( " { key: \"%s\", type: \"bool\", default: \"%s\"},\r\n",
key , vdefault ? "True" : "False" );
}
void ShuttleGetDefinition::Define( int & var, const wxChar * key, const int vdefault, const int vmin, const int vmax, const int vscl )
{
Result += wxString::Format( " { key: \"%s\", type: \"int\", default: \"%i\"},\r\n",
key , vdefault );
}
void ShuttleGetDefinition::Define( size_t & var, const wxChar * key, const int vdefault, const int vmin, const int vmax, const int vscl )
{
Result += wxString::Format( " { key: \"%s\", type: \"size_t\", default: \"%li\"},\r\n",
key , vdefault );
}
void ShuttleGetDefinition::Define( float & var, const wxChar * key, const float vdefault, const float vmin, const float vmax, const float vscl )
{
Result += wxString::Format( " { key: \"%s\", type: \"float\", default: \"%f\"},\r\n",
key , vdefault );
}
void ShuttleGetDefinition::Define( double & var, const wxChar * key, const float vdefault, const float vmin, const float vmax, const float vscl )
{
Result += wxString::Format( " { key: \"%s\", type: \"float\", default: \"%f\"},\r\n",
key , vdefault );
}
void ShuttleGetDefinition::Define( double & var, const wxChar * key, const double vdefault, const double vmin, const double vmax, const double vscl )
{
Result += wxString::Format( " { key: \"%s\", type: \"double\", default: \"%f\"},\r\n",
key , vdefault );
}
void ShuttleGetDefinition::Define( wxString &var, const wxChar * key, const wxString vdefault, const wxString vmin, const wxString vmax, const wxString vscl )
{
Result += wxString::Format( " { key: \"%s\", type: \"string\", default: \"%s\"},\r\n",
key , vdefault );
}
void ShuttleGetDefinition::DefineEnum( wxString &var, const wxChar * key, const wxString vdefault, wxArrayString strings )
{
Result += wxString::Format( " { key: \"%s\", type: \"enum\", default: \"%s\",\r\n enum : [",
key , vdefault );
for( size_t i=0;i<strings.Count(); i++ )
Result += wxString::Format("%s\"%s\"", (i>0) ? ", ":"", strings[i] );
Result += "]\r\n },\r\n";
}
void ShuttleGetDefinition::DefineEnum( int&var, const wxChar * key, const int vdefault, wxArrayString strings )
{
Result += wxString::Format( " { key: \"%s\", type: \"enum\", default: \"%i\",\r\n enum : [",
key , vdefault );
for( size_t i=0;i<strings.Count(); i++ )
Result += wxString::Format("%s\"%s\"", (i>0) ? ", ":"",strings[i] );
Result += "]\r\n },\r\n";
}
#pragma warning( pop )

View File

@ -4,7 +4,6 @@
Shuttle.h
Dominic Mazzoni
James Crook
**********************************************************************/
@ -59,4 +58,134 @@ public:
bool ExchangeWithMaster(const wxString & Name) override;
};
class CommandAutomationParameters;
/**************************************************************************//**
\brief Shuttle that deals with parameters. This is a base class with lots of
pure virtual functions.
********************************************************************************/
class ShuttleParams : public Shuttle
{
public:
wxString mParams;
CommandAutomationParameters * mpEap;
ShuttleParams(){ mParams = wxT("") ;mpEap=NULL;}
virtual ~ShuttleParams() {}
bool ExchangeWithMaster(const wxString & Name) override;
ShuttleParams & Optional( bool & var ){ var = true;return *this;};
virtual void Define( bool & var, const wxChar * key, const bool vdefault, const bool vmin=false, const bool vmax=false, const bool vscl=false )=0;
virtual void Define( size_t & var, const wxChar * key, const int vdefault, const int vmin=0, const int vmax=100000, const int vscl=1 )=0;
virtual void Define( int & var, const wxChar * key, const int vdefault, const int vmin=0, const int vmax=100000, const int vscl=1 )=0;
virtual void Define( float & var, const wxChar * key, const float vdefault, const float vmin, const float vmax, const float vscl=1.0f )=0;
virtual void Define( double & var, const wxChar * key, const float vdefault, const float vmin, const float vmax, const float vscl=1.0f )=0;
virtual void Define( double & var, const wxChar * key, const double vdefault, const double vmin, const double vmax, const double vscl=1.0f )=0;
virtual void Define( wxString &var, const wxChar * key, const wxString vdefault, const wxString vmin="", const wxString vmax="", const wxString vscl="" )=0;
virtual void DefineEnum( wxString &var, const wxChar * key, const wxString vdefault, wxArrayString strings )=0;
virtual void DefineEnum( int &var, const wxChar * key, const int vdefault, wxArrayString strings )=0;
};
/**************************************************************************//**
\brief Shuttle that gets parameter values into a string.
********************************************************************************/
class ShuttleGetAutomation : public ShuttleParams
{
public:
void Define( bool & var, const wxChar * key, const bool vdefault, const bool vmin, const bool vmax, const bool vscl ) override;
void Define( int & var, const wxChar * key, const int vdefault, const int vmin, const int vmax, const int vscl ) override;
void Define( size_t & var, const wxChar * key, const int vdefault, const int vmin, const int vmax, const int vscl ) override;
void Define( float & var, const wxChar * key, const float vdefault, const float vmin, const float vmax, const float vscl ) override;
void Define( double & var, const wxChar * key, const float vdefault, const float vmin, const float vmax, const float vscl ) override;
void Define( double & var, const wxChar * key, const double vdefault, const double vmin, const double vmax, const double vscl ) override;
void Define( wxString &var, const wxChar * key, const wxString vdefault, const wxString vmin, const wxString vmax, const wxString vscl ) override;
void DefineEnum( wxString &var, const wxChar * key, const wxString vdefault, wxArrayString strings )override;
void DefineEnum( int &var, const wxChar * key, const int vdefault, wxArrayString strings )override;
};
/**************************************************************************//**
\brief Shuttle that sets parameters to a value (from a string)
********************************************************************************/
class ShuttleSetAutomation : public ShuttleParams
{
public:
ShuttleSetAutomation(){ bWrite = false; bOK = false;};
bool bOK;
bool bWrite;
void SetForValidating( CommandAutomationParameters * pEap){ mpEap=pEap; bOK=true;bWrite=false;};
void SetForWriting(CommandAutomationParameters * pEap){ mpEap=pEap;bOK=true;bWrite=true;};
void Define( bool & var, const wxChar * key, const bool vdefault, const bool vmin, const bool vmax, const bool vscl ) override;
void Define( int & var, const wxChar * key, const int vdefault, const int vmin, const int vmax, const int vscl ) override;
void Define( size_t & var, const wxChar * key, const int vdefault, const int vmin, const int vmax, const int vscl ) override;
void Define( float & var, const wxChar * key, const float vdefault, const float vmin, const float vmax, const float vscl ) override;
void Define( double & var, const wxChar * key, const float vdefault, const float vmin, const float vmax, const float vscl ) override;
void Define( double & var, const wxChar * key, const double vdefault, const double vmin, const double vmax, const double vscl ) override;
void Define( wxString &var, const wxChar * key, const wxString vdefault, const wxString vmin, const wxString vmax, const wxString vscl ) override;
void DefineEnum( wxString &var, const wxChar * key, const wxString vdefault, wxArrayString strings )override;
void DefineEnum( int &var, const wxChar * key, const int vdefault, wxArrayString strings )override;
};
/**************************************************************************//**
\brief Shuttle that retrieves a JSON format definition of a command's parameters.
********************************************************************************/
class ShuttleGetDefinition : public ShuttleParams
{
public:
wxString Result;
void Define( bool & var, const wxChar * key, const bool vdefault, const bool vmin, const bool vmax, const bool vscl ) override;
void Define( int & var, const wxChar * key, const int vdefault, const int vmin, const int vmax, const int vscl ) override;
void Define( size_t & var, const wxChar * key, const int vdefault, const int vmin, const int vmax, const int vscl ) override;
void Define( float & var, const wxChar * key, const float vdefault, const float vmin, const float vmax, const float vscl ) override;
void Define( double & var, const wxChar * key, const float vdefault, const float vmin, const float vmax, const float vscl ) override;
void Define( double & var, const wxChar * key, const double vdefault, const double vmin, const double vmax, const double vscl ) override;
void Define( wxString &var, const wxChar * key, const wxString vdefault, const wxString vmin, const wxString vmax, const wxString vscl ) override;
void DefineEnum( wxString &var, const wxChar * key, const wxString vdefault, wxArrayString strings )override;
void DefineEnum( int &var, const wxChar * key, const int vdefault, wxArrayString strings )override;
};
/**************************************************************************//**
\brief Shuttle that sets parameters to their default values.
********************************************************************************/
class ShuttleDefaults : public ShuttleParams
{
public:
wxString Result;
void Define( bool & var, const wxChar * WXUNUSED(key), const bool vdefault,
const bool WXUNUSED(vmin), const bool WXUNUSED(vmax), const bool WXUNUSED(vscl) )
override { var = vdefault;};
void Define( int & var, const wxChar * WXUNUSED(key), const int vdefault,
const int WXUNUSED(vmin), const int WXUNUSED(vmax), const int WXUNUSED(vscl) )
override { var = vdefault;};
void Define( size_t & var, const wxChar * WXUNUSED(key), const int vdefault,
const int WXUNUSED(vmin), const int WXUNUSED(vmax), const int WXUNUSED(vscl) )
override{ var = vdefault;};
void Define( float & var, const wxChar * WXUNUSED(key), const float vdefault,
const float WXUNUSED(vmin), const float WXUNUSED(vmax), const float WXUNUSED(vscl) )
override { var = vdefault;};
void Define( double & var, const wxChar * WXUNUSED(key), const float vdefault,
const float WXUNUSED(vmin), const float WXUNUSED(vmax), const float WXUNUSED(vscl) )
override { var = vdefault;};
void Define( double & var, const wxChar * WXUNUSED(key), const double vdefault,
const double WXUNUSED(vmin), const double WXUNUSED(vmax), const double WXUNUSED(vscl) )
override { var = vdefault;};
void Define( wxString &var, const wxChar * WXUNUSED(key), const wxString vdefault,
const wxString WXUNUSED(vmin), const wxString WXUNUSED(vmax), const wxString WXUNUSED(vscl) )
override { var = vdefault;};
void DefineEnum( wxString &var, const wxChar * WXUNUSED(key), const wxString vdefault,
wxArrayString WXUNUSED(strings) )
override { var = vdefault;};
void DefineEnum( int &var, const wxChar * WXUNUSED(key), const int vdefault,
wxArrayString WXUNUSED(strings) )
override { var = vdefault;};
};
#define SHUTTLE_PARAM( var, name ) \
Define( var, KEY_ ## name, DEF_ ## name, MIN_ ## name, MAX_ ## name, SCL_ ## name )
#define SHUTTLE_ENUM_PARAM( var, name, strings ) \
DefineEnum( var, KEY_ ## name, DEF_ ## name, strings )
#endif

View File

@ -369,6 +369,7 @@ public:
ShuttleGui(wxWindow * pParent,teShuttleMode ShuttleMode);
~ShuttleGui(void);
public:
ShuttleGui & Optional( bool & var ){ var = true;return *this;};
ShuttleGui & Id(int id );
// Prop() sets the proportion value, defined as in wxSizer::Add().
ShuttleGui & Prop( int iProp ){ ShuttleGuiBase::Prop(iProp); return *this;}; // Has to be here too, to return a ShuttleGui and not a ShuttleGuiBase.

View File

@ -40,6 +40,7 @@
#include "widgets/NumericTextCtrl.h"
#include "widgets/HelpSystem.h"
#include "widgets/ErrorDialog.h"
#include "commands/CommandContext.h"
#define TIMER_ID 7000

View File

@ -550,9 +550,9 @@ protected:
DECLARE_EVENT_TABLE()
// friending AutomationCommands allow automation to get sizes of the
// friending GetInfoCommand allow automation to get sizes of the
// tracks, track control panel and such.
friend class AutomationCommands;
friend class GetInfoCommand;
};
// See big pictorial comment in TrackPanel for explanation of these numbers

View File

@ -49,13 +49,13 @@ wxEvent *AppCommandEvent::Clone() const
}
/// Store a pointer to a command object
void AppCommandEvent::SetCommand(const CommandHolder &cmd)
void AppCommandEvent::SetCommand(const OldStyleCommandPointer &cmd)
{
wxASSERT(!mCommand);
mCommand = cmd;
}
CommandHolder AppCommandEvent::GetCommand()
OldStyleCommandPointer AppCommandEvent::GetCommand()
{
return mCommand;
}

View File

@ -22,13 +22,13 @@
DECLARE_EXPORTED_EVENT_TYPE(AUDACITY_DLL_API, wxEVT_APP_COMMAND_RECEIVED, -1);
class Command;
using CommandHolder = std::shared_ptr<Command>;
class OldStyleCommand;
using OldStyleCommandPointer = std::shared_ptr<OldStyleCommand>;
class AppCommandEvent final : public wxCommandEvent
{
private:
CommandHolder mCommand;
OldStyleCommandPointer mCommand;
public:
AppCommandEvent(wxEventType commandType = wxEVT_APP_COMMAND_RECEIVED, int id = 0);
@ -37,8 +37,8 @@ public:
~AppCommandEvent();
wxEvent *Clone() const override;
void SetCommand(const CommandHolder &cmd);
CommandHolder GetCommand();
void SetCommand(const OldStyleCommandPointer &cmd);
OldStyleCommandPointer GetCommand();
private:
DECLARE_DYNAMIC_CLASS(AppCommandEvent)

View File

@ -0,0 +1,342 @@
/**********************************************************************
Audacity: A Digital Audio Editor
AudacityCommand.cpp
James Crook
*******************************************************************//**
\class AudacityCommand
\brief Base class for command in Audacity.
*//****************************************************************//**
\class AudacityCommandDialog
\brief Default dialog used for commands. Is populated using
ShuttleGui.
*//*******************************************************************/
#include "../Audacity.h"
#include "AudacityCommand.h"
#include <algorithm>
#include <wx/defs.h>
#include <wx/hashmap.h>
#include <wx/sizer.h>
#include <wx/stockitem.h>
#include <wx/string.h>
#include <wx/tglbtn.h>
#include <wx/timer.h>
#include <wx/utils.h>
#include <wx/log.h>
#include "audacity/ConfigInterface.h"
#include "../AudacityException.h"
#include "../AudioIO.h"
#include "../LabelTrack.h"
#include "../Mix.h"
#include "../Prefs.h"
#include "../Project.h"
#include "../ShuttleGui.h"
#include "../WaveTrack.h"
#include "../toolbars/ControlToolBar.h"
#include "../widgets/AButton.h"
#include "../widgets/ProgressDialog.h"
#include "../ondemand/ODManager.h"
#include "../widgets/HelpSystem.h"
#include "../widgets/LinkingHtmlWindow.h"
#include "../widgets/ErrorDialog.h"
#include "../FileNames.h"
#include "../commands/CommandTargets.h"
#include "../Experimental.h"
#include "../commands/ScreenshotCommand.h"
#ifndef __AUDACITY_OLD_STD__
#include <unordered_map>
#endif
#include "../commands/CommandContext.h"
AudacityCommand::AudacityCommand()
{
mProgress = NULL;
mUIParent = NULL;
mUIDialog = NULL;
mUIDebug = false;
mIsBatch = false;
mNeedsInit = true;
}
AudacityCommand::~AudacityCommand()
{
if (mUIDialog)
mUIDialog->Close();
}
wxString AudacityCommand::GetPath(){ return BUILTIN_GENERIC_COMMAND_PREFIX + GetSymbol();}
wxString AudacityCommand::GetName(){ return GetSymbol();}
wxString AudacityCommand::GetVendor(){ return XO("Audacity");}
wxString AudacityCommand::GetVersion(){ return AUDACITY_VERSION_STRING;}
bool AudacityCommand::Apply() {
AudacityProject * pProj = GetActiveProject();
const CommandContext context( *pProj );
return Apply( context );
};
bool AudacityCommand::Init(){
if( !mNeedsInit )
return true;
mNeedsInit = false;
ShuttleDefaults DefaultSettingShuttle;
return DefineParams( DefaultSettingShuttle );
}
bool AudacityCommand::ShowInterface(wxWindow *parent, bool WXUNUSED(forceModal))
{
if (mUIDialog)
{
if ( mUIDialog->Close(true) )
mUIDialog = nullptr;
return false;
}
// mUIDialog is null
auto cleanup = valueRestorer( mUIDialog );
mUIDialog = CreateUI(parent, this);
if (!mUIDialog)
return false;
mUIDialog->Layout();
mUIDialog->Fit();
mUIDialog->SetMinSize(mUIDialog->GetSize());
// The Screenshot command might be popping this dialog up, just to capture it.
if( ScreenshotCommand::MayCapture( mUIDialog ) )
return false;
bool res = mUIDialog->ShowModal() != 0;
return res;
}
wxDialog *AudacityCommand::CreateUI(wxWindow *parent, AudacityCommand * WXUNUSED(client))
{
Destroy_ptr<AudacityCommandDialog> dlg { safenew AudacityCommandDialog{
parent, "Generic Dialog", this}};
if (dlg->Init())
{
// release() is safe because parent will own it
return dlg.release();
}
return NULL;
}
bool AudacityCommand::GetAutomationParameters(wxString & parms)
{
CommandAutomationParameters eap;
if (mUIDialog && !TransferDataFromWindow())
{
return false;
}
ShuttleGetAutomation S;
S.mpEap = &eap;
bool bResult = DefineParams( S );
wxASSERT_MSG( bResult, "You did not define DefineParameters() for this command" );
return eap.GetParameters(parms);
}
bool AudacityCommand::SetAutomationParameters(const wxString & parms)
{
wxString preset = parms;
CommandAutomationParameters eap(parms);
ShuttleSetAutomation S;
S.SetForWriting( &eap );
bool bResult = DefineParams( S );
wxASSERT_MSG( bResult, "You did not define DefineParameters() for this command" );
if (!S.bOK)
{
AudacityCommand::MessageBox(
wxString::Format(
_("%s: Could not load settings below. Default settings will be used.\n\n%s"),
GetTranslatedName(),
preset
)
);
// fror now always succeed, so that we can prompt the user.
return true;
}
return TransferDataToWindow();
}
bool AudacityCommand::DoAudacityCommand(wxWindow *parent,
const CommandContext & context,
bool shouldPrompt /* = true */)
{
// Note: Init may read parameters from preferences
if (!Init())
{
return false;
}
// Prompting will be bypassed when applying a command that has already
// been configured, e.g. repeating the last effect on a different selection.
// Prompting may call AudacityCommand::Preview
if (shouldPrompt && /*IsInteractive() && */!PromptUser(parent))
{
return false;
}
auto cleanup = finally( [&] {
End();
} );
bool returnVal = true;
bool skipFlag = CheckWhetherSkipAudacityCommand();
if (skipFlag == false)
{
auto name = GetTranslatedName();
ProgressDialog progress{
name,
wxString::Format(_("Applying %s..."), name),
pdlgHideStopButton
};
auto vr = valueRestorer( mProgress, &progress );
returnVal = Apply(context);
}
return returnVal;
}
// This is used from Chains.
bool AudacityCommand::PromptUser(wxWindow *parent)
{
return ShowInterface(parent, IsBatchProcessing());
}
bool AudacityCommand::TransferDataToWindow()
{
if (mUIParent && !mUIParent->TransferDataToWindow())
return false;
return true;
}
bool AudacityCommand::TransferDataFromWindow()
{
if (mUIParent && (!mUIParent->Validate() || !mUIParent->TransferDataFromWindow()))
return false;
return true;
}
int AudacityCommand::MessageBox(const wxString& message, long style, const wxString &titleStr)
{
wxString title;
if (titleStr.empty())
title = GetTranslatedName();
else
title = wxString::Format(_("%s: %s"), GetTranslatedName(), titleStr);
return AudacityMessageBox(message, title, style, mUIParent);
}
BEGIN_EVENT_TABLE(AudacityCommandDialog, wxDialogWrapper)
EVT_BUTTON(wxID_OK, AudacityCommandDialog::OnOk)
END_EVENT_TABLE()
AudacityCommandDialog::AudacityCommandDialog(wxWindow * parent,
const wxString & title,
AudacityCommand * pCommand,
int type,
int flags,
int additionalButtons)
: wxDialogWrapper(parent, wxID_ANY, title, wxDefaultPosition, wxDefaultSize, flags)
{
mType = type;
wxASSERT( pCommand );
mpCommand = pCommand;
mAdditionalButtons = additionalButtons;
}
bool AudacityCommandDialog::Init()
{
ShuttleGui S(this, eIsCreating);
S.SetBorder(5);
S.StartVerticalLay(true);
{
PopulateOrExchange(S);
long buttons = eOkButton;
S.AddStandardButtons(buttons|mAdditionalButtons);
}
S.EndVerticalLay();
Layout();
Fit();
SetMinSize(GetSize());
Center();
return true;
}
/// This is a virtual function which will be overridden to
/// provide the actual parameters that we want for each
/// kind of dialog.
void AudacityCommandDialog::PopulateOrExchange(ShuttleGui & S)
{
wxASSERT( mpCommand );
mpCommand->PopulateOrExchange( S );
}
bool AudacityCommandDialog::TransferDataToWindow()
{
ShuttleGui S(this, eIsSettingToDialog);
PopulateOrExchange(S);
return true;
}
bool AudacityCommandDialog::TransferDataFromWindow()
{
ShuttleGui S(this, eIsGettingFromDialog);
PopulateOrExchange(S);
return true;
}
bool AudacityCommandDialog::Validate()
{
return true;
}
void AudacityCommandDialog::OnOk(wxCommandEvent & WXUNUSED(evt))
{
// On wxGTK (wx2.8.12), the default action is still executed even if
// the button is disabled. This appears to affect all wxDialogs, not
// just our AudacityCommands dialogs. So, this is a only temporary workaround
// for legacy effects that disable the OK button. Hopefully this has
// been corrected in wx3.
if (FindWindow(wxID_OK)->IsEnabled() && Validate() && TransferDataFromWindow())
{
EndModal(true);
}
}
void AudacityCommandDialog::OnCancel(wxCommandEvent & WXUNUSED(evt))
{
EndModal(false);
}

View File

@ -0,0 +1,187 @@
/**********************************************************************
Audacity: A Digital Audio Editor
AudacityCommand.h
James Crook
**********************************************************************/
#ifndef __AUDACITY_COMMAND__
#define __AUDACITY_COMMAND__
#include "../Audacity.h"
#include "../MemoryX.h"
#include <set>
#include "../MemoryX.h"
#include <wx/bmpbuttn.h>
#include <wx/defs.h>
#include <wx/dynarray.h>
#include <wx/intl.h>
#include <wx/string.h>
#include <wx/tglbtn.h>
#include <wx/event.h> // for idle event.
class wxCheckBox;
class wxChoice;
class wxListBox;
class wxWindow;
#include "../Experimental.h"
#include "../SampleFormat.h"
#include "../SelectedRegion.h"
#include "../Shuttle.h"
#include "../Internat.h"
#include "../widgets/ProgressDialog.h"
#include "../include/audacity/IdentInterface.h"
#include "../include/audacity/EffectAutomationParameters.h" // for command automation
#include "../Track.h"
#include "../effects/Effect.h"
#include "../Registrar.h"
class ShuttleGui;
#define BUILTIN_GENERIC_COMMAND_PREFIX wxT("Built-in AudacityCommand: ")
class AudacityProject;
class CommandContext;
class AUDACITY_DLL_API AudacityCommand /* not final */ : public wxEvtHandler,
public CommandDefinitionInterface
{
public:
//std::unique_ptr<CommandOutputTarget> mOutput;
//CommandOutputTarget * mOutput;
public:
AudacityCommand();
virtual ~AudacityCommand();
// IdentInterface implementation
//These four can be defaulted....
wxString GetPath() override;
wxString GetName() override;
wxString GetVendor() override;
wxString GetVersion() override;
// virtual wxString GetFamily();
//These two must be implemented by instances.
virtual wxString GetSymbol()
{ wxFAIL_MSG( "Implement a Symbol for this command");return "FAIL";};
virtual wxString GetDescription()
{wxFAIL_MSG( "Implement a Description for this command");return "FAIL";};
// Name of page in the Audacity alpha manual
virtual wxString ManualPage(){ return wxEmptyString;};
virtual bool IsBatchProcessing(){ return mIsBatch;}
virtual void SetBatchProcessing(bool start){ mIsBatch = start;};
virtual bool Apply(const CommandContext & WXUNUSED(context) ) {return false;};
virtual bool Apply(); // redirects to the command context version.
bool ShowInterface(wxWindow *parent, bool forceModal = false);
virtual void SetHostUI(EffectUIHostInterface * WXUNUSED(host)){;};
bool PopulateUI(wxWindow *parent);
wxDialog *CreateUI(wxWindow *parent, AudacityCommand *client);
virtual bool GetAutomationParameters(wxString & parms);
virtual bool SetAutomationParameters(const wxString & parms);
bool DoAudacityCommand(wxWindow *parent, const CommandContext & context,bool shouldPrompt = true);
// Nonvirtual
// Display a message box, using effect's (translated) name as the prefix
// for the title.
enum : long { DefaultMessageBoxStyle = wxOK | wxCENTRE };
int MessageBox(const wxString& message,
long style = DefaultMessageBoxStyle,
const wxString& titleStr = wxString{});
//
// protected virtual methods
//
// Each subclass of AudacityCommand overrides one or more of these methods to
// do its processing.
//
//protected:
// Called once each time an effect is called. Perform any initialization;
// make sure that the command can be performed and
// return false otherwise
virtual bool Init();
// If necessary, open a dialog to get parameters from the user.
// This method will not always be called (for example if a user
// repeats a command using 'repeat last command') but if it is called,
// it will be called after Init.
virtual bool PromptUser(wxWindow *parent);
// Check whether command should be skipped
// Typically this is only useful in automation, for example
// detecting that zero noise reduction is to be done,
// or that normalisation is being done without Dc bias shift
// or amplitude modification
virtual bool CheckWhetherSkipAudacityCommand() { return false; }
// clean up any temporary memory, needed only per invocation of the
// effect, after either successful or failed or exception-aborted processing.
// Invoked inside a "finally" block so it must be no-throw.
virtual void End(){;};
virtual void PopulateOrExchange(ShuttleGui & WXUNUSED(S)){return;};
virtual bool TransferDataToWindow();
virtual bool TransferDataFromWindow();
protected:
ProgressDialog *mProgress; // Temporary pointer, NOT deleted in destructor.
// UI
wxDialog *mUIDialog;
wxWindow *mUIParent;
int mUIResultID;
private:
bool mIsBatch;
bool mUIDebug;
bool mNeedsInit;
};
// Base dialog for command dialog.
class AUDACITY_DLL_API AudacityCommandDialog /* not final */ : public wxDialogWrapper
{
public:
// constructors and destructors
AudacityCommandDialog(wxWindow * parent,
const wxString & title,
AudacityCommand * pCommand,
int type = 0,
int flags = wxDEFAULT_DIALOG_STYLE,
int additionalButtons = 0);
bool Init();// always returns true. The bool is for the future...
bool TransferDataToWindow() override;
bool TransferDataFromWindow() override;
bool Validate() override;
virtual void PopulateOrExchange(ShuttleGui & S);
virtual void OnOk(wxCommandEvent & evt);
virtual void OnCancel(wxCommandEvent & evt);
private:
int mType;
int mAdditionalButtons;
AudacityCommand * mpCommand;
DECLARE_EVENT_TABLE()
wxDECLARE_NO_COPY_CLASS(AudacityCommandDialog);
};
#endif

View File

@ -1,70 +0,0 @@
/**********************************************************************
Audacity - A Digital Audio Editor
Copyright 1999-2009 Audacity Team
License: wxWidgets
Dan Horgan
******************************************************************//**
\file AutomationCommands.h
\brief Contains declaration of AutomationCommands class.
\class AutomationCommands
\brief Command which outputs a list of available menu commands on the status
channel.
*//*******************************************************************/
#ifndef __GETALLMENUCOMMANDS__
#define __GETALLMENUCOMMANDS__
#include "Command.h"
#include "CommandType.h"
class wxMenuBar;
class wxPoint;
class AutomationCommandsType final : public CommandType
{
public:
AutomationCommandsType( const wxString & Name ) { mCustomName = Name;};
wxString mCustomName;
wxString BuildName() override;
void BuildSignature(CommandSignature &signature) override;
CommandHolder Create(std::unique_ptr<CommandOutputTarget> &&target) override;
};
class AutomationCommands final : public CommandImplementation
{
public:
AutomationCommands(CommandType &type,
std::unique_ptr<CommandOutputTarget> &&target)
: CommandImplementation(type, std::move(target))
{ mMode = type.BuildName();}
virtual ~AutomationCommands()
{ }
bool Apply(CommandExecutionContext context) override;
private:
wxString mMode;
bool SendMenus(CommandExecutionContext context);
bool SendMenusPlus(CommandExecutionContext context);
bool SendClips(CommandExecutionContext context);
bool SendKeycodes(CommandExecutionContext context);
bool SendBoxes(CommandExecutionContext context);
void ExploreMenu( wxMenu * pMenu, int Id, int depth );
void ExploreTrackPanel( CommandExecutionContext context,
wxPoint P, wxWindow * pWin, int Id, int depth );
void ExploreAdornments( CommandExecutionContext context,
wxPoint P, wxWindow * pWin, int Id, int depth );
void ExploreWindows( CommandExecutionContext context,
wxPoint P, wxWindow * pWin, int Id, int depth );
};
#endif /* End of include guard: __GETALLMENUCOMMANDS__ */

View File

@ -15,6 +15,7 @@
#include "../Audacity.h"
#include "BatchEvalCommand.h"
#include "CommandContext.h"
wxString BatchEvalCommandType::BuildName()
{
@ -31,12 +32,12 @@ void BatchEvalCommandType::BuildSignature(CommandSignature &signature)
signature.AddParameter(wxT("ChainName"), wxT(""), std::move(chainValidator));
}
CommandHolder BatchEvalCommandType::Create(std::unique_ptr<CommandOutputTarget> &&target)
OldStyleCommandPointer BatchEvalCommandType::Create(std::unique_ptr<CommandOutputTarget> &&target)
{
return std::make_shared<BatchEvalCommand>(*this, std::move(target));
return std::make_shared<BatchEvalCommand>(*this);
}
bool BatchEvalCommand::Apply(CommandExecutionContext WXUNUSED(context))
bool BatchEvalCommand::Apply(const CommandContext & context)
{
wxString chainName = GetString(wxT("ChainName"));
@ -52,11 +53,11 @@ bool BatchEvalCommand::Apply(CommandExecutionContext WXUNUSED(context))
// Create a Batch that will have just one command in it...
BatchCommands Batch;
bool bResult = Batch.ApplyCommand(cmdName, cmdParams);
bool bResult = Batch.ApplyCommand(cmdName, cmdParams, &context);
// Relay messages, if any.
wxString Message = Batch.GetMessage();
if( !Message.IsEmpty() )
Status( Message );
context.Status( Message );
return bResult;
}

View File

@ -31,19 +31,18 @@ class BatchEvalCommandType final : public CommandType
public:
wxString BuildName() override;
void BuildSignature(CommandSignature &signature) override;
CommandHolder Create(std::unique_ptr<CommandOutputTarget> &&target) override;
OldStyleCommandPointer Create(std::unique_ptr<CommandOutputTarget> &&target) override;
};
class BatchEvalCommand final : public CommandImplementation
{
public:
BatchEvalCommand(CommandType &type,
std::unique_ptr<CommandOutputTarget> &&target)
: CommandImplementation(type, std::move(target))
BatchEvalCommand(CommandType &type)
: CommandImplementation(type)
{ }
virtual ~BatchEvalCommand();
bool Apply(CommandExecutionContext context) override;
bool Apply(const CommandContext &context) override;
};
#endif /* End of include guard: __BATCHEVALCOMMAND__ */

View File

@ -10,7 +10,68 @@
\file Command.cpp
\brief Contains definitions for Command, DecoratedCommand,
ApplyAndSendResponse, and CommandImplementation classes
ApplyAndSendResponse, and CommandImplementation classes. These are
remnants of Dan Horgans external scripting commands. We now use
AudacityCommand and a shuttle system. This allows commands to be used
from within chains too, to have settings dialogs, using ShuttleGui and
without need for validators.
Here's the doxygen for the still-remaining going-away classes.
\class BatchEvalCommandType
\brief The <something>CommandType classes are classes which are going
away. They all provided a BuildSignature (what parameters they accept)
and Name, but that is now replaced by the AudacityCommand interface.
We in effect merge the <something>CommandType classes into the
<something>Command classes.
\class MessageCommandType
\brief The <something>CommandType classes are classes which are going
away. They all provided a BuildSignature (what parameters they accept)
and Name, but that is now replaced by the AudacityCommand interface.
We in effect merge the <something>CommandType classes into the
<something>Command classes.
\class BatchEvalCommand
\brief Command to make processing of chains available to scripting. It can either
make a one command chain, or invoke an existing chain. It will become redundant
when menu commands are integrated into scripting.
\class HelpCommand
\brief Command to get help about other commands.
\class MessageCommand
\brief Command to get a message response. Used for testing, and used internally
to create messages for forwarding.
******************************************************************//**
\class OldStyleCommand
\brief Abstract base class for command interface. This is the version
created by Dan Horgan. It was previously a factory for other command classes.
It created a separation between the type of a command and the command itself,
which is being removed. These Cmmands were managed by CommandDirectory.
\class OldStyleCommandPointer
\brief OldStyleCommandPointer is a unique_ptr to an OldStyleCommand.
\class DecoratedCommand
\brief DecoratedCommand is a decorator for command. It forwards functions
to the mCommand it holds.
\class ApplyAndSendResponse
\brief ApplyAndSendResponse is a DecoratoredCommand that performs the given
command and then outputs a status message according to the result. It
manages a CommandContext which is passed into its mCommand, so that result
messages are routed back to the right place.
\class CommandImplementation,
\brief is derived from OldStyleCommand. It validates and
applies the command. CommandImplementation::Apply() is overloaded in
classes derived from it.
*//*******************************************************************/
@ -29,28 +90,18 @@ ApplyAndSendResponse, and CommandImplementation classes
#include "CommandTargets.h"
#include "CommandDirectory.h"
bool Command::SetParameter(const wxString & WXUNUSED(paramName),
#include "CommandContext.h"
#include "../Project.h"
bool OldStyleCommand::SetParameter(const wxString & WXUNUSED(paramName),
const wxVariant & WXUNUSED(paramValue))
{
wxASSERT_MSG(false, wxT("Tried to set parameter for command which doesn't support parameters!"));
return false;
}
void DecoratedCommand::Progress(double completed)
{
mCommand->Progress(completed);
}
void DecoratedCommand::Status(const wxString &message)
{
mCommand->Status(message);
}
void DecoratedCommand::Error(const wxString &message)
{
mCommand->Error(message);
}
DecoratedCommand::~DecoratedCommand()
{
}
@ -71,10 +122,32 @@ bool DecoratedCommand::SetParameter(const wxString &paramName,
return mCommand->SetParameter(paramName, paramValue);
}
bool ApplyAndSendResponse::Apply(CommandExecutionContext context)
ApplyAndSendResponse::ApplyAndSendResponse(const OldStyleCommandPointer &cmd, std::unique_ptr<CommandOutputTarget> &target)
: DecoratedCommand(cmd),
mCtx( std::make_unique<CommandContext>( *GetActiveProject(), std::move(target) ) )
{
}
bool ApplyAndSendResponse::Apply(const CommandContext &context)
{
wxLogMessage( "Context was passed in, but was ignored. ApplyAndSendResponse has its own one");
return Apply();
}
bool ApplyAndSendResponse::Apply()
{
// ApplyAndSendResponse IS a command.
// It also HOLDS a command.
// Mostly its functions forward to the recipient.
// However it uses its OWN context, not the one of
// the command it holds.
auto result = GuardedCall<bool>(
[&] { return mCommand->Apply(context); }
[&] {
bool bResult = mCommand->Apply(*( mCtx.get()));
return bResult; }
);
wxString response = GetName();
// These three strings are deliberately not localised.
@ -88,18 +161,15 @@ bool ApplyAndSendResponse::Apply(CommandExecutionContext context)
{
response += wxT("Failed!");
}
Status(response);
mCtx->Status(response);
return result;
}
CommandImplementation::CommandImplementation(CommandType &type,
std::unique_ptr<CommandOutputTarget> &&output)
CommandImplementation::CommandImplementation(CommandType &type)
: mType(type),
mParams(type.GetSignature().GetDefaults()),
mSetParams(),
mOutput(std::move(output))
mSetParams()
{
wxASSERT(mOutput);
}
CommandImplementation::~CommandImplementation()
@ -170,22 +240,6 @@ wxString CommandImplementation::GetString(const wxString &paramName)
return v.GetString();
}
// Convenience methods for passing messages to the output target
void CommandImplementation::Progress(double completed)
{
mOutput->Progress(completed);
}
void CommandImplementation::Status(const wxString &status)
{
mOutput->Status(status);
}
void CommandImplementation::Error(const wxString &message)
{
mOutput->Error(message);
}
/// Get the name of the command
wxString CommandImplementation::GetName()
{
@ -201,18 +255,18 @@ CommandSignature &CommandImplementation::GetSignature()
bool CommandImplementation::SetParameter(const wxString &paramName, const wxVariant &paramValue)
{
wxASSERT(!paramValue.IsType(wxT("null")));
CommandContext context( * GetActiveProject());
ParamValueMap::iterator iter = mParams.find(paramName);
if (iter == mParams.end())
{
Error(paramName + wxT(" is not a parameter accepted by ") + GetName());
context.Error(paramName + wxT(" is not a parameter accepted by ") + GetName());
return false;
}
Validator &validator = mType.GetSignature().GetValidator(iter->first);
if (!validator.Validate(paramValue))
{
Error(wxT("Invalid value for parameter '")
context.Error(wxT("Invalid value for parameter '")
+ paramName + wxT("': should be ")
+ validator.GetDescription());
return false;
@ -221,12 +275,12 @@ bool CommandImplementation::SetParameter(const wxString &paramName, const wxVari
mSetParams[ paramName ] = true;
// (debug)
// Status(wxT("Set parameter ") + paramName + wxT(" to type ") + mParams[paramName].GetType() + wxT(", value ") + mParams[paramName].MakeString());
// context.Status(wxT("Set parameter ") + paramName + wxT(" to type ") + mParams[paramName].GetType() + wxT(", value ") + mParams[paramName].MakeString());
return true;
}
bool CommandImplementation::Apply(CommandExecutionContext WXUNUSED(context))
bool CommandImplementation::Apply(const CommandContext & WXUNUSED(context))
{
return true;
}

View File

@ -11,26 +11,6 @@
\file Command.h
\brief Contains declaration of Command base class.
\class CommandExecutionContext
\brief Represents a context to which a command may be applied.
\class Command
\brief Abstract base class for command interface. It implements
Command::SetParameter() and defers all other operations to derived classes.
That process may depend on certain parameters (determined by the command's
signature) and may produce output on various channels. Any process which is to
be controlled by a script should be separated out into its own Command class.
(And that class should be registered with the CommandDirectory).
\class ApplyAndSendResponse
\brief Decorator command that performs the given command and then
outputs a status message according to the result.
\class CommandImplementation,
\brief is derived from Command. It validates and
applies the command. CommandImplementation::Apply() is overloaded in
classes derived from it.
*//*******************************************************************/
@ -38,61 +18,40 @@ classes derived from it.
#define __COMMAND__
#include <wx/app.h>
#include "../Project.h"
#include "../MemoryX.h"
#include "CommandMisc.h"
#include "CommandSignature.h"
#include "CommandTargets.h"
#include "../commands/AudacityCommand.h"
class AudacityApp;
class CommandContext;
class CommandOutputTarget;
class CommandExecutionContext
{
public:
CommandExecutionContext(AudacityApp *WXUNUSED(app), AudacityProject *WXUNUSED(proj))
{
};
AudacityApp *GetApp() const
{
return (AudacityApp *) wxTheApp;
};
AudacityProject *GetProject() const
{
// TODO: Presumably, this would be different if running in a command context.
// So, if this command system is ever actually enabled, then this will need to
// be reviewed.
return GetActiveProject();
};
};
// Abstract base class for command interface.
class Command /* not final */
class OldStyleCommand /* not final */
{
public:
virtual void Progress(double completed) = 0;
virtual void Status(const wxString &message) = 0;
virtual void Error(const wxString &message) = 0;
virtual ~Command() { }
OldStyleCommand() {};
virtual ~OldStyleCommand() { }
virtual wxString GetName() = 0;
virtual CommandSignature &GetSignature() = 0;
virtual bool SetParameter(const wxString &paramName, const wxVariant &paramValue);
virtual bool Apply(CommandExecutionContext context) = 0;
virtual bool Apply()=0;
virtual bool Apply(const CommandContext &context) = 0;
};
using CommandHolder = std::shared_ptr<Command>;
using OldStyleCommandPointer = std::shared_ptr<OldStyleCommand>;
/// Command which wraps another command
class DecoratedCommand /* not final */ : public Command
/// It ISA command and HAS a command.
class DecoratedCommand /* not final */ : public OldStyleCommand
{
protected:
CommandHolder mCommand;
OldStyleCommandPointer mCommand;
public:
void Progress(double completed) override;
void Status(const wxString &message) override;
void Error(const wxString &message) override;
DecoratedCommand(const CommandHolder &cmd)
DecoratedCommand(const OldStyleCommandPointer &cmd)
: mCommand(cmd)
{
wxASSERT(cmd != NULL);
@ -108,14 +67,14 @@ public:
class ApplyAndSendResponse final : public DecoratedCommand
{
public:
ApplyAndSendResponse(const CommandHolder &cmd)
: DecoratedCommand(cmd)
{ }
ApplyAndSendResponse(const OldStyleCommandPointer &cmd, std::unique_ptr<CommandOutputTarget> &target);
bool Apply() override;
bool Apply(const CommandContext &context) override;// Error to use this.
std::unique_ptr<CommandContext> mCtx;
bool Apply(CommandExecutionContext context) override;
};
class CommandImplementation /* not final */ : public Command
class CommandImplementation /* not final */ : public OldStyleCommand
{
private:
CommandType &mType;
@ -127,8 +86,6 @@ private:
bool Valid(const wxString &paramName, const wxVariant &paramValue);
protected:
std::unique_ptr<CommandOutputTarget> mOutput;
// Convenience methods for allowing subclasses to access parameters
void TypeCheck(const wxString &typeName,
const wxString &paramName,
@ -141,15 +98,9 @@ protected:
wxString GetString(const wxString &paramName);
public:
// Convenience methods for passing messages to the output target
void Progress(double completed);
void Status(const wxString &status) override;
void Error(const wxString &message) override;
/// Constructor should not be called directly; only by a factory which
/// ensures name and params are set appropriately for the command.
CommandImplementation(CommandType &type,
std::unique_ptr<CommandOutputTarget> &&output);
CommandImplementation(CommandType &type);
virtual ~CommandImplementation();
@ -168,7 +119,8 @@ public:
/// Actually carry out the command. Return true if successful and false
/// otherwise.
bool Apply(CommandExecutionContext context) override;
bool Apply() { return false;};// No longer supported.
bool Apply(const CommandContext &context) override;
};
#endif /* End of include guard: __COMMAND__ */

View File

@ -29,6 +29,7 @@ system by constructing BatchCommandEval objects.
#include "Command.h"
#include "CommandTargets.h"
#include "ScriptCommandRelay.h"
#include "CommandContext.h"
CommandBuilder::CommandBuilder(const wxString &cmdString)
: mValid(false)
@ -56,7 +57,7 @@ const wxString &CommandBuilder::GetErrorMessage()
return mError;
}
CommandHolder CommandBuilder::GetCommand()
OldStyleCommandPointer CommandBuilder::GetCommand()
{
wxASSERT(mValid);
wxASSERT(mCommand);
@ -71,7 +72,7 @@ void CommandBuilder::Failure(const wxString &msg)
mValid = false;
}
void CommandBuilder::Success(const CommandHolder &cmd)
void CommandBuilder::Success(const OldStyleCommandPointer &cmd)
{
mCommand = cmd;
mValid = true;
@ -88,23 +89,27 @@ void CommandBuilder::BuildCommand(const wxString &cmdName,
scriptOutput,
scriptOutput);
#ifdef OLD_BATCH_SYSTEM
CommandType *factory = CommandDirectory::Get()->LookUp(cmdName);
if (factory == NULL)
{
// Fall back to hoping the Batch Command system can handle it
#endif
CommandType *type = CommandDirectory::Get()->LookUp(wxT("BatchCommand"));
wxASSERT(type != NULL);
mCommand = type->Create(std::move(output));
mCommand = type->Create(nullptr);
mCommand->SetParameter(wxT("CommandName"), cmdName);
mCommand->SetParameter(wxT("ParamString"), cmdParamsArg);
Success(std::make_shared<ApplyAndSendResponse>(mCommand));
auto aCommand = std::make_shared<ApplyAndSendResponse>(mCommand, output);
Success(aCommand);
return;
#ifdef OLD_BATCH_SYSTEM
}
CommandSignature &signature = factory->GetSignature();
mCommand = factory->Create(std::move(output));
mCommand = factory->Create(nullptr);
//mCommand->SetOutput( std::move(output) );
// Stage 2: set the parameters
ShuttleCli shuttle;
@ -172,8 +177,9 @@ void CommandBuilder::BuildCommand(const wxString &cmdName,
}
cmdParams = cmdParams.Mid(splitAt);
}
Success(std::make_shared<ApplyAndSendResponse>(mCommand));
auto aCommand = std::make_shared<ApplyAndSendResponse>(mCommand, output);
Success(aCommand);
#endif
}
void CommandBuilder::BuildCommand(const wxString &cmdStringArg)

View File

@ -19,8 +19,8 @@
#include "../MemoryX.h"
#include <wx/string.h>
class Command;
using CommandHolder = std::shared_ptr<Command>;
class OldStyleCommand;
using OldStyleCommandPointer = std::shared_ptr<OldStyleCommand>;
class wxString;
// CommandBuilder has the task of validating and interpreting a command string.
@ -30,11 +30,11 @@ class CommandBuilder
{
private:
bool mValid;
CommandHolder mCommand;
OldStyleCommandPointer mCommand;
wxString mError;
void Failure(const wxString &msg = wxEmptyString);
void Success(const CommandHolder &cmd);
void Success(const OldStyleCommandPointer &cmd);
void BuildCommand(const wxString &cmdName, const wxString &cmdParams);
void BuildCommand(const wxString &cmdString);
public:
@ -43,7 +43,7 @@ class CommandBuilder
const wxString &cmdParams);
~CommandBuilder();
bool WasValid();
CommandHolder GetCommand();
OldStyleCommandPointer GetCommand();
const wxString &GetErrorMessage();
};
#endif /* End of include guard: __COMMANDBUILDER__ */

View File

@ -0,0 +1,99 @@
/**********************************************************************
Audacity - A Digital Audio Editor
Copyright 1999-2017 Audacity Team
License: wxwidgets
Dan Horgan
James Crook
******************************************************************//**
\file CommandContext.cpp
\brief Contains definitions for CommandContext
\class CommandContext
\brief CommandContext provides addiitonal information to an
'Apply()' command. It provides the project, and provides output
channels for Error, Progress and Status. Status is used for general
messaging from a command back to its invoker.
*//*******************************************************************/
#include "../Audacity.h"
#include "Command.h"
#include <map>
#include <wx/string.h>
#include <wx/variant.h>
#include <wx/arrstr.h>
#include "../AudacityException.h"
#include "Validators.h"
#include "CommandType.h"
#include "CommandMisc.h"
#include "CommandBuilder.h"
#include "CommandTargets.h"
#include "CommandDirectory.h"
//#include "CommandContext.h"
#include "CommandContext.h"
#include "../Project.h"
CommandContext::CommandContext(
AudacityProject &p
, const wxEvent *e
, int ii
, const CommandParameter &param
)
: project{ p }
, pOutput( nullptr )
, pEvt{ e }
, index{ ii }
, parameter{ param }
{
}
CommandContext::CommandContext(
AudacityProject &p,
std::unique_ptr<CommandOutputTarget> target)
: project{ p }
// Revisit and use std_unique pointer for pOutput??
, pOutput( std::move( target) )
, pEvt{ nullptr }
, index{ 0 }
, parameter{ CommandParameter{}}
{
}
void CommandContext::Status( const wxString & message ) const
{
if( pOutput )
pOutput->Status( message );
else
{
wxLogDebug("Status:%s", message );
}
}
void CommandContext::Error( const wxString & message ) const
{
if( pOutput )
pOutput->Error( message );
else
{
wxLogDebug("Error:%s", message );
}
}
void CommandContext::Progress( double d ) const
{
if( pOutput )
pOutput->Progress( d );
}
AudacityApp * CommandContext::GetApp() const
{ return (AudacityApp *) wxTheApp;}
AudacityProject *CommandContext::GetProject() const
{ return GetActiveProject();}

View File

@ -0,0 +1,49 @@
/**********************************************************************
Audacity: A Digital Audio Editor
CommandContext.h
Created by Paul Licameli on 4/22/16.
**********************************************************************/
#ifndef __AUDACITY_COMMAND_CONTEXT__
#define __AUDACITY_COMMAND_CONTEXT__
#include <wx/string.h>
#include <wx/event.h>
#include "../MemoryX.h"
#include "Command.h"
class AudacityProject;
class AudacityApp;
class wxEvent;
class CommandOutputTarget;
using CommandParameter = wxString;
class CommandContext {
public:
CommandContext(
AudacityProject &p
, const wxEvent *e = nullptr
, int ii = 0
, const CommandParameter &param = CommandParameter{}
);
CommandContext(
AudacityProject &p,
std::unique_ptr<CommandOutputTarget> target);
virtual void Status( const wxString & WXUNUSED(message) ) const;
virtual void Error( const wxString & WXUNUSED(message) ) const;
virtual void Progress( double WXUNUSED(d) ) const;
AudacityProject &project;
std::unique_ptr<CommandOutputTarget> pOutput;
const wxEvent *pEvt;
int index;
CommandParameter parameter;
AudacityApp *GetApp() const;
AudacityProject *GetProject() const;
};
#endif

View File

@ -18,56 +18,49 @@ functions to look up a command by name.
#include "CommandDirectory.h"
#include "CommandMisc.h"
#include "ScreenshotCommand.h"
#include "BatchEvalCommand.h"
#include "ExecMenuCommand.h"
#include "AutomationCommands.h"
#include "MessageCommand.h"
#include "GetTrackInfoCommand.h"
#include "GetProjectInfoCommand.h"
#include "HelpCommand.h"
#include "SelectCommand.h"
#include "CompareAudioCommand.h"
#include "SetTrackInfoCommand.h"
#include "SetProjectInfoCommand.h"
#include "PreferenceCommands.h"
#include "ImportExportCommands.h"
#include "OpenSaveCommands.h"
#include "MessageCommand.h"
#include "BatchEvalCommand.h"
std::unique_ptr<CommandDirectory> CommandDirectory::mInstance;
CommandDirectory::CommandDirectory()
{
// Create the command map.
// Adding an entry here is the easiest way to register a Command class.
AddCommand(make_movable<ScreenshotCommandType>());
AddCommand(make_movable<BatchEvalCommandType>());
AddCommand(make_movable<ExecMenuCommandType>());
// First we have commands which return information
AddCommand(make_movable<MessageCommandType>());
AddCommand(make_movable<GetTrackInfoCommandType>());
AddCommand(make_movable<GetProjectInfoCommandType>());
AddCommand(make_movable<BatchEvalCommandType>());
// AutomationCommandsType will be renamed GenericCommand
// It can be customised in the constructor and so
// appear as many distinct commands.
AddCommand(make_movable<AutomationCommandsType>("GetAll"));
AddCommand(make_movable<AutomationCommandsType>("GetMenus"));
AddCommand(make_movable<AutomationCommandsType>("GetMenusPlus"));
AddCommand(make_movable<AutomationCommandsType>("GetBoxes"));
AddCommand(make_movable<AutomationCommandsType>("GetClips"));
AddCommand(make_movable<HelpCommandType>());
AddCommand(make_movable<SelectCommandType>());
AddCommand(make_movable<CompareAudioCommandType>());
AddCommand(make_movable<SetTrackInfoCommandType>());
AddCommand(make_movable<SetProjectInfoCommandType>());
// Legacy adapter commands that previously was needed to
// access menu items.
//AddCommand(make_movable<ExecMenuCommandType>());
// Not needed. Sets selected/solo/mute on multiple tracks.
//AddCommand(make_movable<SetProjectInfoCommandType>());
// Moved to AudacityCommand
// AddCommand(make_movable<OpenProjectCommandType>());
// AddCommand(make_movable<SaveProjectCommandType>());
// AddCommand(make_movable<ImportCommandType>());
// AddCommand(make_movable<ExportCommandType>());
// AddCommand(make_movable<HelpCommandType>());
// AddCommand(make_movable<GetInfoCommandType>("GetAll"));
// AddCommand(make_movable<GetInfoCommandType>("GetCommands"));
// AddCommand(make_movable<GetInfoCommandType>("GetMenus"));
// AddCommand(make_movable<GetInfoCommandType>("GetMenusPlus"));
// AddCommand(make_movable<GetInfoCommandType>("GetBoxes"));
// AddCommand(make_movable<GetInfoCommandType>("GetClips"));
// AddCommand(make_movable<GetTrackInfoCommandType>());
// AddCommand(make_movable<GetProjectInfoCommandType>());
// AddCommand(make_movable<CompareAudioCommandType>());
// AddCommand(make_movable<GetPreferenceCommandType>());
// AddCommand(make_movable<SetPreferenceCommandType>());
// AddCommand(make_movable<ScreenshotCommandType>());
// AddCommand(make_movable<SelectCommandType>());
// AddCommand(make_movable<SetTrackInfoCommandType>());
AddCommand(make_movable<SetPreferenceCommandType>());
AddCommand(make_movable<GetPreferenceCommandType>());
AddCommand(make_movable<ImportCommandType>());
AddCommand(make_movable<ExportCommandType>());
AddCommand(make_movable<OpenProjectCommandType>());
AddCommand(make_movable<SaveProjectCommandType>());
}
CommandDirectory::~CommandDirectory()

View File

@ -12,8 +12,10 @@
#include <wx/string.h>
#include <wx/event.h>
#include "../MemoryX.h"
#include "Command.h"
class AudacityProject;
class AudacityApp;
class wxEvtHandler;
// Base class for objects, to whose member functions, the CommandManager will
@ -33,32 +35,9 @@ using CommandHandlerObject = wxEvtHandler;
// of the handler object from the AudacityProject
using CommandHandlerFinder = CommandHandlerObject &(*)(AudacityProject&);
class wxEvent;
using CommandParameter = wxString;
struct CommandContext {
CommandContext(
AudacityProject &p
, const wxEvent *e = nullptr
, int ii = 0
, const CommandParameter &param = CommandParameter{}
)
: project{ p }
, pEvt{ e }
, index{ ii }
, parameter{ param }
{}
AudacityProject &project;
const wxEvent *pEvt;
int index;
CommandParameter parameter;
};
// Second of two function pointers registered with each command: a pointer
// to a member function of the handler object
using CommandFunctorPointer =
void (CommandHandlerObject::*)(const CommandContext &);
void (CommandHandlerObject::*)(const CommandContext &context );
#endif

View File

@ -23,10 +23,11 @@
#include "Command.h"
#include "AppCommandEvent.h"
#include "ScriptCommandRelay.h"
#include "../commands/CommandContext.h"
CommandHandler::CommandHandler(AudacityApp &app)
: mCurrentContext(std::make_unique<CommandExecutionContext>
(&app, GetActiveProject()))
CommandHandler::CommandHandler()
: mCurrentContext(std::make_unique<CommandContext>
(*GetActiveProject()))
{ }
CommandHandler::~CommandHandler()
@ -42,7 +43,7 @@ void CommandHandler::SetProject(AudacityProject *)
void CommandHandler::OnReceiveCommand(AppCommandEvent &event)
{
// First retrieve the actual command from the event 'envelope'.
CommandHolder cmd = event.GetCommand();
OldStyleCommandPointer cmd = event.GetCommand();
// JKC: In case the user changed the project, let us track that.
// This saves us the embarrassment (crash) of a NEW project

View File

@ -20,15 +20,15 @@
class AudacityApp;
class AudacityProject;
class AppCommandEvent;
class CommandExecutionContext;
class CommandContext;
class CommandHandler
{
private:
std::unique_ptr<CommandExecutionContext> mCurrentContext;
std::unique_ptr<CommandContext> mCurrentContext;
public:
CommandHandler(AudacityApp &app);
CommandHandler();
~CommandHandler();
// This should only be used during initialization

View File

@ -75,8 +75,10 @@ CommandManager. It holds the callback for one command.
*//******************************************************************/
#include "../AudacityHeaders.h"
#include "../Audacity.h"
#include "CommandManager.h"
#include "CommandContext.h"
#include <wx/defs.h>
#include <wx/eventfilter.h>
@ -806,9 +808,14 @@ void CommandManager::AddItem(const wxChar *name,
int checkmark,
const CommandParameter &parameter)
{
wxString cookedParameter;
if( parameter == "" )
cookedParameter = name;
else
cookedParameter = parameter;
CommandListEntry *entry =
NewIdentifier(name, label_in, accel, CurrentMenu(), finder, callback,
false, 0, 0, parameter);
false, 0, 0, cookedParameter);
int ID = entry->id;
wxString label = GetLabelWithDisabledAccel(entry);
@ -1492,7 +1499,7 @@ bool CommandManager::HandleCommandEntry(const CommandListEntry * entry,
return true;
}
CommandContext context{ *proj, evt, entry->index, entry->parameter };
const CommandContext context{ *proj, evt, entry->index, entry->parameter };
auto &handler = entry->finder(*proj);
(handler.*(entry->callback))(context);
@ -1529,7 +1536,7 @@ bool CommandManager::HandleMenuID(int id, CommandFlag flags, CommandMask mask)
/// HandleTextualCommand() allows us a limitted version of script/batch
/// behavior, since we can get from a string command name to the actual
/// code to run.
bool CommandManager::HandleTextualCommand(const wxString & Str, CommandFlag flags, CommandMask mask)
bool CommandManager::HandleTextualCommand(const wxString & Str, const CommandContext & context, CommandFlag flags, CommandMask mask)
{
if( Str.IsEmpty() )
return false;
@ -1559,9 +1566,9 @@ bool CommandManager::HandleTextualCommand(const wxString & Str, CommandFlag flag
const PluginDescriptor *plug = pm.GetFirstPlugin(PluginTypeEffect);
while (plug)
{
if (em.GetEffectIdentifier(plug->GetID()).IsSameAs(Str))
if (em.GetCommandIdentifier(plug->GetID()).IsSameAs(Str))
{
return proj->DoEffect(plug->GetID(), AudacityProject::OnEffectFlags::kConfigured);
return proj->DoEffect(plug->GetID(), context, AudacityProject::OnEffectFlags::kConfigured);
}
plug = pm.GetNextPlugin(PluginTypeEffect);
}

View File

@ -31,6 +31,8 @@
#include <unordered_map>
#endif
using CommandParameter = wxString;
struct MenuBarListEntry
{
MenuBarListEntry(const wxString &name_, wxMenuBar *menubar_)
@ -95,6 +97,7 @@ using CommandNameHash = std::unordered_map<wxString, CommandListEntry*>;
using CommandIDHash = std::unordered_map<int, CommandListEntry*>;
class AudacityProject;
class CommandContext;
class AUDACITY_DLL_API CommandManager final : public XMLTagHandler
{
@ -242,7 +245,7 @@ class AUDACITY_DLL_API CommandManager final : public XMLTagHandler
// Lyrics and MixerTrackCluster classes use it.
bool FilterKeyEvent(AudacityProject *project, const wxKeyEvent & evt, bool permit = false);
bool HandleMenuID(int id, CommandFlag flags, CommandMask mask);
bool HandleTextualCommand(const wxString & Str, CommandFlag flags, CommandMask mask);
bool HandleTextualCommand(const wxString & Str, const CommandContext & context, CommandFlag flags, CommandMask mask);
//
// Accessing

View File

@ -25,9 +25,9 @@ should be reference-counted.
#include "../MemoryX.h"
#include <wx/string.h>
#include <wx/statusbr.h>
//#include "../src/Project.h"
#include "../widgets/ProgressDialog.h"
#include "../commands/ResponseQueue.h"
#include "../src/Project.h"
#include "../widgets/ErrorDialog.h"
/// Interface for objects that can receive command progress information

View File

@ -31,7 +31,7 @@ CommandType::~CommandType()
{
}
const wxString &CommandType::GetName()
wxString CommandType::GetName()
{
if (mName.empty())
mName = BuildName();

View File

@ -19,14 +19,29 @@
#include "CommandMisc.h"
#include "CommandSignature.h"
#include "../MemoryX.h"
#include "../commands/AudacityCommand.h"
class Command;
using CommandHolder = std::shared_ptr<Command>;
class OldStyleCommand;
/**************************************************************//**
\class OldStyleCommand
\brief OldStyleCommand is the key class that allows us to carry
a converted (not textual) command from a non-GUI place to the GUI
thread. It contains the command AND the context that will be used
for its output.
\class OldStyleCommandPointer
\brief OldStyleCommandPointer is a shared_ptr to a OldStyleCommandPointer.
*******************************************************************/
using OldStyleCommandPointer = std::shared_ptr<OldStyleCommand>;
class CommandOutputTarget;
class CommandSignature;
class wxString;
class CommandType /* not final */
class CommandType : public AudacityCommand
{
private:
wxString mName;
@ -35,7 +50,7 @@ private:
public:
CommandType();
virtual ~CommandType();
const wxString &GetName();
wxString GetName() override;
CommandSignature &GetSignature();
wxString Describe();
@ -50,7 +65,7 @@ public:
virtual void BuildSignature(CommandSignature &signature) = 0;
// Create a command instance with the specified output target
virtual CommandHolder Create(std::unique_ptr<CommandOutputTarget> &&target) = 0;
virtual OldStyleCommandPointer Create(std::unique_ptr<CommandOutputTarget> &&target) = 0;
};
#endif /* End of include guard: __COMMANDTYPE__ */

View File

@ -5,6 +5,7 @@
License: wxwidgets
Dan Horgan
James Crook
******************************************************************//**
@ -19,35 +20,57 @@ threshold of difference in two selected tracks
#include "../Audacity.h"
#include "CompareAudioCommand.h"
#include "../MemoryX.h"
#include "../Project.h"
#include "Command.h"
#include "../WaveTrack.h"
#include "Command.h"
#include <float.h>
#include <wx/intl.h>
#include "../ShuttleGui.h"
#include "../widgets/ErrorDialog.h"
#include "../widgets/valnum.h"
#include "../SampleFormat.h"
#include "CommandContext.h"
extern void RegisterCompareAudio( Registrar & R){
R.AddCommand( make_movable<CompareAudioCommand>() );
// std::unique_ptr<CommandOutputTarget> &&target
// return std::make_shared<CompareAudioCommand>(*this, std::move(target));
wxString CompareAudioCommandType::BuildName()
{
return wxT("CompareAudio");
}
void CompareAudioCommandType::BuildSignature(CommandSignature &signature)
{
auto thresholdValidator = make_movable<DoubleValidator>();
signature.AddParameter(wxT("Threshold"), 0.0, std::move(thresholdValidator));
bool CompareAudioCommand::DefineParams( ShuttleParams & S ){
S.Define( errorThreshold, wxT("Threshold"), 0.0f, 0.0f, 0.01f, 1.0f );
return true;
}
CommandHolder CompareAudioCommandType::Create(std::unique_ptr<CommandOutputTarget> &&target)
bool CompareAudioCommand::Apply(){
return true;
}
void CompareAudioCommand::PopulateOrExchange(ShuttleGui & S)
{
return std::make_shared<CompareAudioCommand>(*this, std::move(target));
S.AddSpace(0, 5);
S.StartMultiColumn(2, wxALIGN_CENTER);
{
S.TieTextBox(_("Threshold:"),errorThreshold);
}
S.EndMultiColumn();
}
// Update member variables with project selection data (and validate)
bool CompareAudioCommand::GetSelection(AudacityProject &proj)
bool CompareAudioCommand::GetSelection(const CommandContext &context, AudacityProject &proj)
{
// Get the selected time interval
mT0 = proj.mViewInfo.selectedRegion.t0();
mT1 = proj.mViewInfo.selectedRegion.t1();
if (mT0 >= mT1)
{
Error(wxT("There is no selection!"));
context.Error(wxT("There is no selection!"));
return false;
}
@ -57,18 +80,18 @@ bool CompareAudioCommand::GetSelection(AudacityProject &proj)
mTrack0 = (WaveTrack*)(iter.First());
if (mTrack0 == NULL)
{
Error(wxT("No tracks selected! Select two tracks to compare."));
context.Error(wxT("No tracks selected! Select two tracks to compare."));
return false;
}
mTrack1 = (WaveTrack*)(iter.Next());
if (mTrack1 == NULL)
{
Error(wxT("Only one track selected! Select two tracks to compare."));
context.Error(wxT("Only one track selected! Select two tracks to compare."));
return false;
}
if (iter.Next() != NULL)
{
Status(wxT("More than two tracks selected - only the first two will be compared."));
context.Status(wxT("More than two tracks selected - only the first two will be compared."));
}
return true;
}
@ -83,9 +106,9 @@ inline int min(int a, int b)
return (a < b) ? a : b;
}
bool CompareAudioCommand::Apply(CommandExecutionContext context)
bool CompareAudioCommand::Apply(const CommandContext & context)
{
if (!GetSelection(*context.GetProject()))
if (!GetSelection(context, *context.GetProject()))
{
return false;
}
@ -93,11 +116,9 @@ bool CompareAudioCommand::Apply(CommandExecutionContext context)
wxString msg = wxT("Comparing tracks '");
msg += mTrack0->GetName() + wxT("' and '")
+ mTrack1->GetName() + wxT("'.");
Status(msg);
context.Status(msg);
long errorCount = 0;
double errorThreshold = GetDouble(wxT("Threshold"));
// Initialize buffers for track data to be analyzed
auto buffSize = std::min(mTrack0->GetMaxBlockSize(), mTrack1->GetMaxBlockSize());
@ -127,7 +148,7 @@ bool CompareAudioCommand::Apply(CommandExecutionContext context)
}
position += block;
Progress(
context.Progress(
(position - s0).as_double() /
length.as_double()
);
@ -135,8 +156,8 @@ bool CompareAudioCommand::Apply(CommandExecutionContext context)
// Output the results
double errorSeconds = mTrack0->LongSamplesToTime(errorCount);
Status(wxString::Format(wxT("%li"), errorCount));
Status(wxString::Format(wxT("%.4f"), errorSeconds));
Status(wxString::Format(wxT("Finished comparison: %li samples (%.3f seconds) exceeded the error threshold of %f."), errorCount, errorSeconds, errorThreshold));
context.Status(wxString::Format(wxT("%li"), errorCount));
context.Status(wxString::Format(wxT("%.4f"), errorSeconds));
context.Status(wxString::Format(wxT("Finished comparison: %li samples (%.3f seconds) exceeded the error threshold of %f."), errorCount, errorSeconds, errorThreshold));
return true;
}

View File

@ -5,6 +5,7 @@
License: wxwidgets
Dan Horgan
James Crook
******************************************************************//**
@ -22,32 +23,35 @@ classes
class WaveTrack;
class CompareAudioCommandType final : public CommandType
#define COMPARE_AUDIO_PLUGIN_SYMBOL XO("Compare Audio")
class CompareAudioCommand final : public AudacityCommand
{
public:
wxString BuildName() override;
void BuildSignature(CommandSignature &signature) override;
CommandHolder Create(std::unique_ptr<CommandOutputTarget> &&target) override;
};
// CommandDefinitionInterface overrides
wxString GetSymbol() override {return "Compare Audio";};
wxString GetDescription() override {return _("Compares a range on two tracks.");};
bool DefineParams( ShuttleParams & S ) override;
void PopulateOrExchange(ShuttleGui & S) override;
bool Apply() override;
// AudacityCommand overrides
wxString ManualPage() override {return wxT("Compare_Audio");};
bool Apply(const CommandContext &context) override;
class CompareAudioCommand final : public CommandImplementation
{
private:
double errorThreshold;
double mT0, mT1;
const WaveTrack *mTrack0;
const WaveTrack *mTrack1;
// Update member variables with project selection data (and validate)
bool GetSelection(AudacityProject &proj);
bool GetSelection(const CommandContext &context, AudacityProject &proj);
protected:
double CompareSample(double value1, double value2) /* not override */;
public:
CompareAudioCommand(CommandType &type, std::unique_ptr<CommandOutputTarget> &&target)
: CommandImplementation(type, std::move(target))
{ }
bool Apply(CommandExecutionContext context) override;
};
#endif /* End of include guard: __COMPAREAUDIOCOMMAND__ */

60
src/commands/Demo.cpp Normal file
View File

@ -0,0 +1,60 @@
/**********************************************************************
Audacity: A Digital Audio Editor
Demo.cpp
James Crook
*******************************************************************//**
\class DemoCommand
\brief An AudacityCommand that does nothing but provide
parameters. It is for development purposes.
*//****************************************************************//**
\class DemoDialog
\brief DemoDialog used with DemoCommand
*//*******************************************************************/
#include "../Audacity.h"
#include "Demo.h"
#include <float.h>
#include <wx/intl.h>
#include "../ShuttleGui.h"
#include "../widgets/ErrorDialog.h"
#include "../widgets/valnum.h"
#include "../SampleFormat.h"
#include "../commands/Command.h"
#include "../commands/CommandContext.h"
bool DemoCommand::DefineParams( ShuttleParams & S ){
S.Define( delay, wxT("Delay"), 1.0f, 0.001f, FLT_MAX, 1.0f );
S.Define( decay, wxT("Decay"), 0.5f, 0.0f, FLT_MAX, 1.0f );
return true;
}
bool DemoCommand::Apply(const CommandContext & context){
context.Status( "A Message");
return true;
}
void DemoCommand::PopulateOrExchange(ShuttleGui & S)
{
S.AddSpace(0, 5);
S.StartMultiColumn(2, wxALIGN_CENTER);
{
S.TieTextBox(_("Delay time (seconds):"),delay);
S.TieTextBox(_("Decay factor:"),decay);
}
S.EndMultiColumn();
}

43
src/commands/Demo.h Normal file
View File

@ -0,0 +1,43 @@
/**********************************************************************
Audacity: A Digital Audio Editor
Demo.h
James Crook
**********************************************************************/
#ifndef __AUDACITY_DEMO_COMMAND__
#define __AUDACITY_DEMO_COMMAND__
#include <wx/event.h>
#include <wx/string.h>
#include <wx/textctrl.h>
#include "AudacityCommand.h"
#include "../SampleFormat.h"
class ShuttleGui;
#define DEMO_PLUGIN_SYMBOL XO("Demo")
class DemoCommand final : public AudacityCommand
{
public:
// CommandDefinitionInterface overrides
wxString GetSymbol() override {return DEMO_PLUGIN_SYMBOL;};
wxString GetDescription() override {return _("Does the demo action.");};
bool DefineParams( ShuttleParams & S ) override;
void PopulateOrExchange(ShuttleGui & S) override;
bool Apply(const CommandContext & context) override;
// AudacityCommand overrides
wxString ManualPage() override {return wxT("Demo");};
private:
double delay;
double decay;
};
#endif // __AUDACITY_DEMO_COMMAND__

View File

@ -1,44 +0,0 @@
/**********************************************************************
Audacity - A Digital Audio Editor
Copyright 1999-2009 Audacity Team
License: wxWidgets
Dan Horgan
******************************************************************//**
\file ExecMenuCommand.cpp
\brief Contains definitions for ExecMenuCommand class.
*//*******************************************************************/
#include "ExecMenuCommand.h"
#include "CommandManager.h"
#include "../Project.h"
wxString ExecMenuCommandType::BuildName()
{
return wxT("MenuCommand");
}
void ExecMenuCommandType::BuildSignature(CommandSignature &signature)
{
auto menuCommandValidator = make_movable<DefaultValidator>();
signature.AddParameter(wxT("CommandName"), wxT(""), std::move(menuCommandValidator));
}
CommandHolder ExecMenuCommandType::Create(std::unique_ptr<CommandOutputTarget> &&target)
{
return std::make_shared<ExecMenuCommand>(*this, std::move(target));
}
bool ExecMenuCommand::Apply(CommandExecutionContext context)
{
CommandManager *cmdManager = context.GetProject()->GetCommandManager();
wxString cmdName = GetString(wxT("CommandName"));
auto cmdFlags = AlwaysEnabledFlag; // TODO ?
auto cmdMask = AlwaysEnabledFlag;
return cmdManager->HandleTextualCommand(cmdName, cmdFlags, cmdMask);
}

View File

@ -1,45 +0,0 @@
/**********************************************************************
Audacity - A Digital Audio Editor
Copyright 1999-2009 Audacity Team
License: wxWidgets
Dan Horgan
******************************************************************//**
\file ExecMenuCommand.h
\brief Contains declaration of ExecMenuCommand class.
\class ExecMenuCommand
\brief A command which asks the CommandManager to execute a menu command by
name.
*//*******************************************************************/
#ifndef __EXECMENUCOMMAND__
#define __EXECMENUCOMMAND__
#include "Command.h"
#include "CommandType.h"
class ExecMenuCommandType final : public CommandType
{
public:
wxString BuildName() override;
void BuildSignature(CommandSignature &signature) override;
CommandHolder Create(std::unique_ptr<CommandOutputTarget> &&target) override;
};
class ExecMenuCommand final : public CommandImplementation
{
public:
ExecMenuCommand(CommandType &type,
std::unique_ptr<CommandOutputTarget> &&target)
: CommandImplementation(type, std::move(target))
{ }
virtual ~ExecMenuCommand() { }
bool Apply(CommandExecutionContext context) override;
};
#endif /* End of include guard: __EXECMENUCOMMAND__ */

View File

@ -8,8 +8,8 @@
******************************************************************//**
\file AutomationCommands.cpp
\brief Contains definitions for AutomationCommands class.
\file GetInfoCommand.cpp
\brief Contains definitions for GetInfoCommand class.
This class now handles the GetAll script command, which can
- Get all keycodes
- Get all menus
@ -17,37 +17,96 @@ This class now handles the GetAll script command, which can
*//*******************************************************************/
#include "AutomationCommands.h"
#include "../Audacity.h"
#include "GetInfoCommand.h"
#include "../Project.h"
#include "CommandManager.h"
#include "../effects/EffectManager.h"
#include "../widgets/Overlay.h"
#include "../widgets/OverlayPanel.h"
#include "../TrackPanel.h"
#include "CommandContext.h"
wxString AutomationCommandsType::BuildName()
#include "SelectCommand.h"
#include "../Project.h"
#include "../Track.h"
#include "../ShuttleGui.h"
#include "CommandContext.h"
const int nTypes =5;
static const wxString kTypes[nTypes] =
{
return mCustomName;
XO("Commands"),
XO("Menus"),
XO("Clips"),
XO("Keycodes"),
XO("Boxes")
};
enum {
kCommands,
kMenus,
kClips,
kKeycodes,
kBoxes
};
const int nFormats =2;
static const wxString kFormats[nFormats] =
{
XO("JSON"),
XO("Other")
};
enum {
kJson =0*nTypes,
kOther =1*nTypes
};
bool GetInfoCommand::DefineParams( ShuttleParams & S ){
wxArrayString types( nTypes, kTypes );
wxArrayString formats( nFormats, kFormats );
S.DefineEnum( mInfoType, wxT("Type"), 0, types );
S.DefineEnum( mFormat, wxT("Format"), 0, formats );
return true;
}
void AutomationCommandsType::BuildSignature(CommandSignature &signature)
void GetInfoCommand::PopulateOrExchange(ShuttleGui & S)
{
auto infoTypeValidator = make_movable<OptionValidator>();
infoTypeValidator->AddOption(wxT("Menus"));
infoTypeValidator->AddOption(wxT("Menus+"));
infoTypeValidator->AddOption(wxT("Keycodes"));
infoTypeValidator->AddOption(wxT("Boxes"));
wxArrayString types( nTypes, kTypes );
wxArrayString formats( nFormats, kFormats );
S.AddSpace(0, 5);
signature.AddParameter(wxT("Type"), "Menus", std::move(infoTypeValidator));
S.StartMultiColumn(2, wxALIGN_CENTER);
{
S.TieChoice( _("Types:"), mInfoType, &types);
S.TieChoice( _("Formats:"), mFormat, &formats);
}
S.EndMultiColumn();
}
CommandHolder AutomationCommandsType::Create(std::unique_ptr<CommandOutputTarget> &&target)
bool GetInfoCommand::Apply(const CommandContext &context)
{
return std::make_shared<AutomationCommands>(*this, std::move(target));
switch( mInfoType + nTypes * mFormat ){
case kCommands + kJson : return SendCommandsAsJson( context);
case kCommands + kOther : return SendCommandsAsJson( context);
case kMenus + kJson : return SendMenusAsJson( context);
case kMenus + kOther : return SendMenus( context );
case kClips + kJson : return SendClips( context);
case kClips + kOther : return SendClips( context );
case kKeycodes + kJson : return SendKeycodes( context);
case kKeycodes + kOther : return SendKeycodes( context );
case kBoxes + kJson : return SendBoxesAsJson( context);
case kBoxes + kOther : return SendBoxesAsJson( context );
default:
context.Status( "Command options not recognised" );
}
return false;
}
void AutomationCommands::ExploreMenu( wxMenu * pMenu, int Id, int depth ){
void GetInfoCommand::ExploreMenu( const CommandContext &context, wxMenu * pMenu, int Id, int depth ){
Id;//compiler food.
if( !pMenu )
return;
@ -74,15 +133,15 @@ void AutomationCommands::ExploreMenu( wxMenu * pMenu, int Id, int depth ){
if (item->IsCheck() && item->IsChecked())
flags +=2;
Status( wxString::Format(" [ %2i, %2i, \"%s\", \"%s\" ],", depth, flags, Label,Accel ));
context.Status( wxString::Format(" [ %2i, %2i, \"%s\", \"%s\" ],", depth, flags, Label,Accel ));
if (item->IsSubMenu()) {
pMenu = item->GetSubMenu();
ExploreMenu( pMenu, item->GetId(), depth+1 );
ExploreMenu( context, pMenu, item->GetId(), depth+1 );
}
}
}
bool AutomationCommands::SendMenusPlus(CommandExecutionContext context)
bool GetInfoCommand::SendMenusAsJson(const CommandContext &context)
{
wxMenuBar * pBar = context.GetProject()->GetMenuBar();
if(!pBar ){
@ -93,20 +152,49 @@ bool AutomationCommands::SendMenusPlus(CommandExecutionContext context)
size_t cnt = pBar->GetMenuCount();
size_t i;
wxString Label;
Status( "AudacityMenus[" );
context.Status( "[" );
for(i=0;i<cnt;i++)
{
Label = pBar->GetMenuLabelText( i );
Status( wxString::Format(" [ %2i, %2i, \"%s\", \"%s\" ],", 0, 0, Label, "" ));
ExploreMenu( pBar->GetMenu( i ), pBar->GetId(), 1 );
context.Status( wxString::Format(" [ %2i, %2i, \"%s\", \"%s\" ],", 0, 0, Label, "" ));
ExploreMenu( context, pBar->GetMenu( i ), pBar->GetId(), 1 );
}
Status( "];" );
context.Status( "]" );
return true;
}
/**
Send the list of commands.
*/
bool GetInfoCommand::SendCommandsAsJson(const CommandContext &context )
{
PluginManager & pm = PluginManager::Get();
EffectManager & em = EffectManager::Get();
{
wxString out="";
wxString maybeComma="";
const PluginDescriptor *plug = pm.GetFirstPlugin(PluginTypeEffect | PluginTypeGeneric);
while (plug)
{
auto command = em.GetCommandIdentifier(plug->GetID());
if (!command.IsEmpty()){
// delayed sending of previous string, so we can maybe add a comma.
if( !out.IsEmpty() )
{
context.Status(out+maybeComma);
maybeComma = ",";
}
out = em.GetCommandDefinition( plug->GetID() );
}
plug = pm.GetNextPlugin(PluginTypeEffect | PluginTypeGeneric );
}
if( !out.IsEmpty() )
context.Status(out); // Last one does not have a comma.
}
return true;
}
bool AutomationCommands::SendMenus(CommandExecutionContext context)
bool GetInfoCommand::SendMenus(const CommandContext &context)
{
bool bShowStatus = true;
wxArrayString names;
@ -122,12 +210,12 @@ bool AutomationCommands::SendMenus(CommandExecutionContext context)
out += wxT("\t");
out += cmdManager->GetEnabled(name) ? wxT("Enabled") : wxT("Disabled");
}
Status(out);
context.Status(out);
}
return true;
}
bool AutomationCommands::SendClips(CommandExecutionContext context)
bool GetInfoCommand::SendClips(const CommandContext &context)
{
bool bShowStatus = true;
wxArrayString names;
@ -143,18 +231,18 @@ bool AutomationCommands::SendClips(CommandExecutionContext context)
out += wxT("\t");
out += cmdManager->GetEnabled(name) ? wxT("Enabled") : wxT("Disabled");
}
Status(out);
context.Status(out);
}
return true;
}
bool AutomationCommands::SendKeycodes(CommandExecutionContext WXUNUSED(context))
bool GetInfoCommand::SendKeycodes(const CommandContext &context)
{
Status("Keycodes");
context.Status("Keycodes");
return true;
}
void AutomationCommands::ExploreAdornments( CommandExecutionContext WXUNUSED(context),
void GetInfoCommand::ExploreAdornments( const CommandContext &context,
wxPoint WXUNUSED(P), wxWindow * pWin, int WXUNUSED(Id), int depth )
{
// Dang! wxMenuBar returns bogus screen rect.
@ -167,11 +255,11 @@ void AutomationCommands::ExploreAdornments( CommandExecutionContext WXUNUSED(con
wxSize s = pWin->GetWindowBorderSize();
wxRect R( 2,32, R1.GetWidth() - s.GetWidth() * 2 -16, 22 );
Status( wxString::Format(" [ %2i, %3i, %3i, %3i, %3i, \"%s\" ],",
context.Status( wxString::Format(" [ %2i, %3i, %3i, %3i, %3i, \"%s\" ],",
depth, R.GetLeft(), R.GetTop(), R.GetRight(), R.GetBottom(), "MenuBar" ));
}
void AutomationCommands::ExploreTrackPanel( CommandExecutionContext context,
void GetInfoCommand::ExploreTrackPanel( const CommandContext &context,
wxPoint P, wxWindow * pWin, int WXUNUSED(Id), int depth )
{
AudacityProject * pProj = context.GetProject();
@ -227,7 +315,7 @@ void AutomationCommands::ExploreTrackPanel( CommandExecutionContext context,
for (Overlay * pOverlay : pTP->mOverlays) {
auto R2(pOverlay->GetRectangle(trackRect.GetSize()).first);
Status( wxString::Format(" [ %2i, %3i, %3i, %3i, %3i, \"%s\" ],",
context.Status( wxString::Format(" [ %2i, %3i, %3i, %3i, %3i, \"%s\" ],",
depth, R2.GetLeft(), R2.GetTop(), R2.GetRight(), R2.GetBottom(), "Overthing" ));
}
}
@ -242,14 +330,14 @@ void AutomationCommands::ExploreTrackPanel( CommandExecutionContext context,
R.height -= (kTopMargin + kBottomMargin);
R.SetPosition( R.GetPosition() + P );
Status( wxString::Format(" [ %2i, %3i, %3i, %3i, %3i, \"%s\" ],",
context.Status( wxString::Format(" [ %2i, %3i, %3i, %3i, %3i, \"%s\" ],",
depth, R.GetLeft(), R.GetTop(), R.GetRight(), R.GetBottom(), "VRuler" ));
}
}
}
void AutomationCommands::ExploreWindows( CommandExecutionContext context,
void GetInfoCommand::ExploreWindows( const CommandContext &context,
wxPoint P, wxWindow * pWin, int Id, int depth )
{
Id;//Compiler food.
@ -278,59 +366,32 @@ void AutomationCommands::ExploreWindows( CommandExecutionContext context,
continue;
if( Name.IsEmpty() )
Name = wxString("*") + item->GetToolTipText();
Status( wxString::Format(" [ %2i, %3i, %3i, %3i, %3i, \"%s\" ],",
context.Status( wxString::Format(" [ %2i, %3i, %3i, %3i, %3i, \"%s\" ],",
depth, R.GetLeft(), R.GetTop(), R.GetRight(), R.GetBottom(), Name ));
ExploreWindows( context, P, item, item->GetId(), depth+1 );
}
}
bool AutomationCommands::SendBoxes(CommandExecutionContext context)
bool GetInfoCommand::SendBoxesAsJson(const CommandContext &context)
{
Status("Boxes");
context.Status("Boxes");
wxWindow * pWin = context.GetProject();
Status( "AudacityBoxes[" );
context.Status( "AudacityBoxes[" );
wxRect R = pWin->GetScreenRect();
//R.SetPosition( wxPoint(0,0) );
//wxString Name = pWin->GetName();
Status( wxString::Format(" [ %2i, %3i, %3i, %3i, %3i, \"%s\" ],",
context.Status( wxString::Format(" [ %2i, %3i, %3i, %3i, %3i, \"%s\" ],",
0, R.GetLeft(), R.GetTop(), R.GetRight(), R.GetBottom(), "Audacity Window" ));
ExploreAdornments( context, pWin->GetPosition()+wxSize( 6,-1), pWin, pWin->GetId(), 1 );
ExploreWindows( context, pWin->GetPosition()+wxSize( 6,-1), pWin, pWin->GetId(), 1 );
Status( "];" );
context.Status( "];" );
return true;
}
bool AutomationCommands::Apply(CommandExecutionContext context)
{
wxString mode = mMode;
bool bOK = false;
if (mode.IsSameAs(wxT("GetMenus")))
{
bOK = SendMenus( context );
}
if (mode.IsSameAs(wxT("GetMenusPlus")))
{
bOK = SendMenusPlus( context );
}
else if (mode.IsSameAs(wxT("GetClips")))
{
bOK = SendClips( context );
}
else if (mode.IsSameAs(wxT("GetKeycodes")))
{
bOK = SendKeycodes( context );
}
else if (mode.IsSameAs(wxT("GetBoxes")))
{
bOK = SendBoxes( context );
}
return bOK;
}

View File

@ -0,0 +1,66 @@
/**********************************************************************
Audacity - A Digital Audio Editor
Copyright 1999-2009 Audacity Team
License: wxWidgets
Dan Horgan
******************************************************************//**
\file GetInfoCommand.h
\brief Contains declaration of GetInfoCommand class.
\class GetInfoCommand
\brief Command which outputs a list of available menu commands on the status
channel.
*//*******************************************************************/
#ifndef __GET_INFO_COMMAND__
#define __GET_INFO_COMMAND__
#include "Command.h"
#include "CommandType.h"
class wxMenuBar;
class wxPoint;
#define GET_INFO_PLUGIN_SYMBOL XO("Get Info")
class GetInfoCommand : public AudacityCommand
{
public:
// CommandDefinitionInterface overrides
wxString GetSymbol() override {return GET_INFO_PLUGIN_SYMBOL;};
wxString GetDescription() override {return _("Gets information in JSON format.");};
bool DefineParams( ShuttleParams & S ) override;
void PopulateOrExchange(ShuttleGui & S) override;
// AudacityCommand overrides
wxString ManualPage() override {return wxT("Automation");};
bool Apply(const CommandContext &context) override;
public:
int mInfoType;
int mFormat;
private:
bool SendCommandsAsJson(const CommandContext & context);
bool SendMenus(const CommandContext & context);
bool SendMenusAsJson(const CommandContext & context);
bool SendClips(const CommandContext & context);
bool SendKeycodes(const CommandContext & context);
bool SendBoxesAsJson(const CommandContext & context);
void ExploreMenu( const CommandContext &context, wxMenu * pMenu, int Id, int depth );
void ExploreTrackPanel( const CommandContext & context,
wxPoint P, wxWindow * pWin, int Id, int depth );
void ExploreAdornments( const CommandContext & context,
wxPoint P, wxWindow * pWin, int Id, int depth );
void ExploreWindows( const CommandContext & context,
wxPoint P, wxWindow * pWin, int Id, int depth );
};
#endif /* End of include guard: __GET_INFO_COMMAND__ */

View File

@ -1,172 +0,0 @@
/**********************************************************************
Audacity - A Digital Audio Editor
Copyright 1999-2009 Audacity Team
License: wxwidgets
Marty Goddard
******************************************************************//**
\file GetProjectInfoCommand.cpp
\brief Definitions for GetProjectInfoCommand and GetProjectInfoCommandType classes
\class GetProjectInfoCommand
\brief Command that returns requested project information
*//*******************************************************************/
#include "GetProjectInfoCommand.h"
#include "../TrackPanel.h"
#include "../Project.h"
#include "../Track.h"
wxString GetProjectInfoCommandType::BuildName()
{
return wxT("GetProjectInfo");
}
void GetProjectInfoCommandType::BuildSignature(CommandSignature &signature)
{
auto infoTypeValidator = make_movable<OptionValidator>();
infoTypeValidator->AddOption(wxT("Name"));
infoTypeValidator->AddOption(wxT("NumberOfTracks"));
infoTypeValidator->AddOption(wxT("SelectedTracks"));
infoTypeValidator->AddOption(wxT("MuteTracks"));
infoTypeValidator->AddOption(wxT("SoloTracks"));
infoTypeValidator->AddOption(wxT("FocusedTrackID")); // returns the Track ID number of the track in focus
signature.AddParameter(wxT("Type"), wxT("Name"), std::move(infoTypeValidator));
}
CommandHolder GetProjectInfoCommandType::Create(std::unique_ptr<CommandOutputTarget> &&target)
{
return std::make_shared<GetProjectInfoCommand>(*this, std::move(target));
}
// *********************** Public Methods *******************
bool GetProjectInfoCommand::Apply(CommandExecutionContext context)
{
wxString mode = GetString(wxT("Type"));
TrackList *projTracks = context.GetProject()->GetTracks();
if (mode.IsSameAs(wxT("Name")))
{
Status(context.GetProject()->GetFileName());
}
else if (mode.IsSameAs(wxT("FocusedTrackID")))
{
SendFocusedTrackIndex(context);
}
else if (mode.IsSameAs(wxT("NumberOfTracks")))
{
SendNumberOfTracks(context);
}
else if (mode.IsSameAs(wxT("SelectedTracks")))
{
SendTracksInfo(projTracks, &GetProjectInfoCommand::testSelected);
}
else if (mode.IsSameAs(wxT("LinkedTracks")))
{
SendTracksInfo(projTracks, &GetProjectInfoCommand::testLinked);
}
else if (mode.IsSameAs(wxT("SoloTracks")))
{
SendTracksInfo(projTracks, &GetProjectInfoCommand::testSolo);
}
else if (mode.IsSameAs(wxT("MuteTracks")))
{
SendTracksInfo(projTracks, &GetProjectInfoCommand::testMute);
}
else
{
Error(wxT("Invalid info type!"));
return false;
}
return true;
}
//********************* Private Methods *******************************
int GetProjectInfoCommand::SendNumberOfTracks(CommandExecutionContext context)
{
int returnVal=0;
TrackListIterator iter(context.GetProject()->GetTracks());
Track *t = iter.First();
while (t)
{
returnVal++;
t = iter.Next();
}
wxString trackNumStr;
trackNumStr << returnVal; // convert to a string to send over named pipe
Status(trackNumStr);
return returnVal;
}
int GetProjectInfoCommand::SendFocusedTrackIndex(CommandExecutionContext context)
{
int returnVal=0;
int focusTrackIndex=0;
TrackPanel *panel = context.GetProject()->GetTrackPanel();
Track* focusedTrack = panel->GetFocusedTrack();
TrackListIterator iter(context.GetProject()->GetTracks());
Track *t = iter.First();
while (t)
{
if(t == focusedTrack) // when we've found the focused track, we know the trackIndex
{
returnVal = focusTrackIndex;
break;
}
focusTrackIndex++;
t = iter.Next();
}
wxString trackIndexStr;
trackIndexStr << returnVal; // convert to a string to send over named pipe
Status(trackIndexStr);
return returnVal;
}
void GetProjectInfoCommand::SendTracksInfo(TrackList *projTracks,
Getter functPtrToGetter)
{
wxString boolValueStr;
TrackListIterator iter(projTracks);
Track *trk = iter.First();
while (trk)
{
if( (this->*functPtrToGetter)(trk)) // Function Pointer to the desired parameter to Test
boolValueStr.Append(wxT("1"),1);
else
boolValueStr.Append(wxT("0"),1);
trk = iter.Next();
}
Status(boolValueStr);
}
bool GetProjectInfoCommand::testSelected(const Track * track) const
{
return track->GetSelected();
}
bool GetProjectInfoCommand::testLinked(const Track * track) const
{
return track->GetLinked();
}
bool GetProjectInfoCommand::testSolo(const Track * track) const
{
auto pt = dynamic_cast<const PlayableTrack *>(track);
return pt && pt->GetSolo();
}
bool GetProjectInfoCommand::testMute(const Track * track) const
{
auto pt = dynamic_cast<const PlayableTrack *>(track);
return pt && pt->GetMute();
}

View File

@ -1,66 +0,0 @@
/**********************************************************************
Audacity - A Digital Audio Editor
Copyright 1999-2009 Audacity Team
License: wxwidgets
Marty Goddard
******************************************************************//**
\file GetProjectInfoCommand.h
\brief Declarations of GetProjectInfoCommand and GetProjectInfoCommandType classes
*//*******************************************************************/
#ifndef __GETPROJECTINFOCOMMAND__
#define __GETPROJECTINFOCOMMAND__
#include "Command.h"
#include "CommandType.h"
class GetProjectInfoCommandType final : public CommandType
{
public:
wxString BuildName() override;
void BuildSignature(CommandSignature &signature) override;
CommandHolder Create(std::unique_ptr<CommandOutputTarget> &&target) override;
};
class GetProjectInfoCommand final : public CommandImplementation
{
public:
GetProjectInfoCommand(CommandType &type, std::unique_ptr<CommandOutputTarget> &&target)
: CommandImplementation(type, std::move(target))
{ }
virtual ~GetProjectInfoCommand()
{ }
bool Apply(CommandExecutionContext context) override;
private:
int SendNumberOfTracks(CommandExecutionContext context);
int SendFocusedTrackIndex(CommandExecutionContext context);
// Function pointer to get a particular (Boolean only) Track parameter
typedef bool (GetProjectInfoCommand::*Getter)(const Track *track) const;
// Uses the Function pointer to set a particular parameter within a loop of otherwise duplicate code
void SendTracksInfo(TrackList *projTracks, Getter);
// Functions pointed to for getting track parameters
bool testSelected(const Track * track) const;
bool testLinked(const Track * track) const;
bool testSolo(const Track * track) const;
bool testMute(const Track * track) const;
};
#endif /* End of include guard: __GETPROJECTINFOCOMMAND__ */

View File

@ -18,134 +18,78 @@
#include "../Audacity.h"
#include "GetTrackInfoCommand.h"
#include "../TrackPanel.h"
#include "../Project.h"
#include "../Track.h"
#include "../TrackPanel.h"
#include "../WaveTrack.h"
#include "../ShuttleGui.h"
#include "CommandContext.h"
wxString GetTrackInfoCommandType::BuildName()
const int nTypes =3;
static const wxString kTypes[nTypes] =
{
return wxT("GetTrackInfo");
XO("Tracks"),
XO("Clips"),
XO("Labels")
};
GetTrackInfoCommand::GetTrackInfoCommand()
{
mInfoType = 0;
}
void GetTrackInfoCommandType::BuildSignature(CommandSignature &signature)
{
auto trackIndexValidator = make_movable<IntValidator>();
signature.AddParameter(wxT("TrackIndex"), 0, std::move(trackIndexValidator));
auto infoTypeValidator = make_movable<OptionValidator>();
infoTypeValidator->AddOption(wxT("Name"));
infoTypeValidator->AddOption(wxT("StartTime"));
infoTypeValidator->AddOption(wxT("EndTime"));
infoTypeValidator->AddOption(wxT("Pan"));
infoTypeValidator->AddOption(wxT("Gain"));
infoTypeValidator->AddOption(wxT("Selected"));
infoTypeValidator->AddOption(wxT("Linked"));
infoTypeValidator->AddOption(wxT("Solo"));
infoTypeValidator->AddOption(wxT("Mute"));
infoTypeValidator->AddOption(wxT("Focused"));
signature.AddParameter(wxT("Type"), wxT("Name"), std::move(infoTypeValidator));
}
CommandHolder GetTrackInfoCommandType::Create(std::unique_ptr<CommandOutputTarget> &&target)
{
return std::make_shared<GetTrackInfoCommand>(*this, std::move(target));
}
//******************* Private Member Functions ********************************
void GetTrackInfoCommand::SendBooleanStatus(bool boolValue)
{
if(boolValue)
Status(wxT("1"));
else
Status(wxT("0"));
}
// ===================== Public Member Functions =================================
bool GetTrackInfoCommand::Apply(CommandExecutionContext context)
{
wxString mode = GetString(wxT("Type"));
long trackIndex = GetLong(wxT("TrackIndex"));
// Get the track indicated by the TrackIndex parameter
// (Note: this ought to be somewhere else)
long i = 0;
TrackListIterator iter(context.GetProject()->GetTracks());
Track *t = iter.First();
while (t && i != trackIndex)
{
t = iter.Next();
++i;
}
if (i != trackIndex || !t)
{
Error(wxT("TrackIndex was invalid."));
return false;
}
// Now get the particular desired item about the track of interest
if (mode.IsSameAs(wxT("Name")))
{
Status(t->GetName());
}
else if (mode.IsSameAs(wxT("StartTime")))
{
Status(wxString::Format(wxT("%f"), t->GetStartTime()));
}
else if (mode.IsSameAs(wxT("EndTime")))
{
Status(wxString::Format(wxT("%.17g"), t->GetEndTime()));
}
else if (mode.IsSameAs(wxT("Pan")))
{
if(t->GetKind() == Track::Wave)
Status(wxString::Format(wxT("%f"), static_cast<WaveTrack*>(t)->GetPan()));
}
else if (mode.IsSameAs(wxT("Gain")))
{
if(t->GetKind() == Track::Wave)
Status(wxString::Format(wxT("%f"), static_cast<WaveTrack*>(t)->GetGain()));
}
else if (mode.IsSameAs(wxT("Focused")))
{
TrackPanel *panel = context.GetProject()->GetTrackPanel();
SendBooleanStatus(panel->GetFocusedTrack() == t);
}
else if (mode.IsSameAs(wxT("Selected")))
{
SendBooleanStatus(t->GetSelected());
}
else if (mode.IsSameAs(wxT("Linked")))
{
SendBooleanStatus(t->GetLinked());
}
else if (mode.IsSameAs(wxT("Solo")))
{
auto pt = dynamic_cast<const PlayableTrack *>(t);
if (pt)
SendBooleanStatus(pt->GetSolo());
else
SendBooleanStatus(false);
}
else if (mode.IsSameAs(wxT("Mute")))
{
auto pt = dynamic_cast<const PlayableTrack *>(t);
if (pt)
SendBooleanStatus(pt->GetMute());
else
SendBooleanStatus(false);
}
else
{
Error(wxT("Invalid info type!"));
return false;
}
bool GetTrackInfoCommand::DefineParams( ShuttleParams & S ){
wxArrayString types( nTypes, kTypes );
S.DefineEnum( mInfoType, wxT("Type"), 0, types );
return true;
}
void GetTrackInfoCommand::PopulateOrExchange(ShuttleGui & S)
{
wxArrayString types( nTypes, kTypes );
S.AddSpace(0, 5);
S.StartMultiColumn(2, wxALIGN_CENTER);
{
S.TieChoice( _("Types:"), mInfoType, &types);
}
S.EndMultiColumn();
}
bool GetTrackInfoCommand::Apply(const CommandContext & context)
{
TrackList *projTracks = context.GetProject()->GetTracks();
TrackListIterator iter(projTracks);
Track *trk = iter.First();
wxString str = "[\n";
while (trk)
{
str += "{\n";
str += wxString::Format(" name:\"%s\",\n", trk->GetName() );
auto t = dynamic_cast<WaveTrack*>( trk );
if( t )
{
str += wxString::Format(" start:%g,\n", t->GetStartTime() );
str += wxString::Format(" end:%g,\n", t->GetEndTime() );
str += wxString::Format(" pan:%g,\n", t->GetPan() );
str += wxString::Format(" gain:%g,\n", t->GetGain() );
str += wxString::Format(" selected:%s,\n", t->GetSelected()?"True":"False" );
str += wxString::Format(" linked:%s,\n", t->GetLinked()?"True":"False" );
str += wxString::Format(" solo:%s,\n", t->GetSolo()?"True":"False" );
str += wxString::Format(" mute:%s,\n", t->GetMute()?"True":"False" );
}
TrackPanel *panel = context.GetProject()->GetTrackPanel();
Track * fTrack = panel->GetFocusedTrack();
str += wxString::Format(" focused:%s,\n", (trk == fTrack)?"True":"False" );
str += "},\n";
trk=iter.Next();
}
str += "]";
// Make it true JSON by removing excess commas.
str.Replace(",\n}","\n}");
str.Replace(",\n]","\n]");
context.Status( str );
return true;
}

View File

@ -19,27 +19,24 @@
#include "Command.h"
#include "CommandType.h"
class GetTrackInfoCommandType final : public CommandType
#define GET_TRACK_INFO_PLUGIN_SYMBOL XO("Get Track Info")
class GetTrackInfoCommand final : public AudacityCommand
{
public:
wxString BuildName() override;
void BuildSignature(CommandSignature &signature) override;
CommandHolder Create(std::unique_ptr<CommandOutputTarget> &&target) override;
};
GetTrackInfoCommand();
// CommandDefinitionInterface overrides
wxString GetSymbol() override {return GET_TRACK_INFO_PLUGIN_SYMBOL;};
wxString GetDescription() override {return _("Gets track values as JSON.");};
bool DefineParams( ShuttleParams & S ) override;
void PopulateOrExchange(ShuttleGui & S) override;
class GetTrackInfoCommand final : public CommandImplementation
{
// AudacityCommand overrides
wxString ManualPage() override {return wxT("Extra_Menu:_Tools#get_track_info");};
bool Apply(const CommandContext &context ) override;
public:
GetTrackInfoCommand(CommandType &type, std::unique_ptr<CommandOutputTarget> &&target)
: CommandImplementation(type, std::move(target))
{ }
virtual ~GetTrackInfoCommand()
{ }
bool Apply(CommandExecutionContext context) override;
private:
void SendBooleanStatus(bool BooleanValue);
int mInfoType;
};
#endif /* End of include guard: __GETTRACKINFOCOMMAND__ */

View File

@ -15,34 +15,35 @@
#include "../Audacity.h"
#include "HelpCommand.h"
#include "CommandDirectory.h"
#include <wx/string.h>
//#include "../Project.h"
//#include "../Track.h"
#include "../ShuttleGui.h"
#include "CommandContext.h"
#include "../effects/EffectManager.h"
wxString HelpCommandType::BuildName()
{
return wxT("Help");
}
void HelpCommandType::BuildSignature(CommandSignature &signature)
{
auto commandNameValidator = make_movable<DefaultValidator>();
signature.AddParameter(wxT("CommandName"), wxT("Help"), std::move(commandNameValidator));
}
CommandHolder HelpCommandType::Create(std::unique_ptr<CommandOutputTarget> &&target)
{
return std::make_shared<HelpCommand>(*this, std::move(target));
}
bool HelpCommand::Apply(CommandExecutionContext WXUNUSED(context))
{
wxString commandName = GetString(wxT("CommandName"));
CommandType *type = CommandDirectory::Get()->LookUp(commandName);
if (type == NULL)
{
Error(wxString::Format(wxT("Command '%s' does not exist!"), commandName));
return false;
}
Status(type->Describe());
bool HelpCommand::DefineParams( ShuttleParams & S ){
S.Define( mCommandName, wxT("Command"), "Help" );
return true;
}
void HelpCommand::PopulateOrExchange(ShuttleGui & S)
{
S.AddSpace(0, 5);
S.StartMultiColumn(2, wxALIGN_CENTER);
{
S.TieTextBox(_("Command:"),mCommandName);
}
S.EndMultiColumn();
}
bool HelpCommand::Apply(const CommandContext & context){
EffectManager & em = EffectManager::Get();
PluginID ID = em.GetEffectByIdentifier( mCommandName );
if( ID.IsEmpty() )
context.Status( "Command not found" );
else
context.Status( em.GetCommandDefinition( ID ));
return true;
}

View File

@ -22,20 +22,23 @@
#include "CommandType.h"
#include "Command.h"
class HelpCommandType final : public CommandType
#define HELP_PLUGIN_SYMBOL XO("Help")
class HelpCommand : public AudacityCommand
{
public:
wxString BuildName() override;
void BuildSignature(CommandSignature &signature) override;
CommandHolder Create(std::unique_ptr<CommandOutputTarget> &&target) override;
// CommandDefinitionInterface overrides
wxString GetSymbol() override {return HELP_PLUGIN_SYMBOL;};
wxString GetDescription() override {return _("Gives help on a command.");};
bool DefineParams( ShuttleParams & S ) override;
void PopulateOrExchange(ShuttleGui & S) override;
bool Apply(const CommandContext & context) override;
// AudacityCommand overrides
wxString ManualPage() override {return wxT("Help");};
public:
wxString mCommandName;
};
class HelpCommand final : public CommandImplementation
{
public:
HelpCommand(HelpCommandType &type, std::unique_ptr<CommandOutputTarget> &&target)
: CommandImplementation(type, std::move(target)) { }
bool Apply(CommandExecutionContext context) override;
};
#endif /* End of include guard: __HELPCOMMAND__ */

View File

@ -18,106 +18,79 @@
#include "../Project.h"
#include "../Track.h"
#include "../export/Export.h"
#include "../ShuttleGui.h"
#include "CommandContext.h"
// Import
wxString ImportCommandType::BuildName()
{
return wxT("Import");
bool ImportCommand::DefineParams( ShuttleParams & S ){
S.Define( mFileName, wxT("Filename"), "" );
return true;
}
void ImportCommandType::BuildSignature(CommandSignature &signature)
void ImportCommand::PopulateOrExchange(ShuttleGui & S)
{
auto filenameValidator = make_movable<DefaultValidator>();
signature.AddParameter(wxT("Filename"), wxT(""), std::move(filenameValidator));
S.AddSpace(0, 5);
S.StartMultiColumn(2, wxALIGN_CENTER);
{
S.TieTextBox(_("File Name:"),mFileName);
}
S.EndMultiColumn();
}
CommandHolder ImportCommandType::Create(std::unique_ptr<CommandOutputTarget> &&target)
{
return std::make_shared<ImportCommand>(*this, std::move(target));
bool ImportCommand::Apply(const CommandContext & context){
return context.GetProject()->Import(mFileName);
}
bool ImportCommand::Apply(CommandExecutionContext context)
{
wxString filename = GetString(wxT("Filename"));
return context.GetProject()->Import(filename);
bool ExportCommand::DefineParams( ShuttleParams & S ){
S.Define( mFileName, wxT("Filename"), "exported.wav" );
S.Define( mnChannels, wxT("NumChannels"), 1 );
return true;
}
ImportCommand::~ImportCommand()
{ }
// Export
wxString ExportCommandType::BuildName()
void ExportCommand::PopulateOrExchange(ShuttleGui & S)
{
return wxT("Export");
S.AddSpace(0, 5);
S.StartMultiColumn(2, wxALIGN_CENTER);
{
S.TieTextBox(_("File Name:"),mFileName);
S.TieTextBox(_("Number of Channels:"),mnChannels);
}
S.EndMultiColumn();
}
void ExportCommandType::BuildSignature(CommandSignature &signature)
bool ExportCommand::Apply(const CommandContext & context)
{
auto modeValidator = make_movable<OptionValidator>();
modeValidator->AddOption(wxT("All"));
modeValidator->AddOption(wxT("Selection"));
signature.AddParameter(wxT("Mode"), wxT("All"), std::move(modeValidator));
auto filenameValidator = make_movable<DefaultValidator>();
signature.AddParameter(wxT("Filename"), wxT("exported.wav"), std::move(filenameValidator));
auto channelsValidator = make_movable<IntValidator>();
signature.AddParameter(wxT("Channels"), 1, std::move(channelsValidator));
}
CommandHolder ExportCommandType::Create(std::unique_ptr<CommandOutputTarget> &&target)
{
return std::make_shared<ExportCommand>(*this, std::move(target));
}
bool ExportCommand::Apply(CommandExecutionContext context)
{
wxString mode = GetString(wxT("Mode"));
wxString filename = GetString(wxT("Filename"));
long numChannels = GetLong(wxT("Channels"));
bool selection = mode.IsSameAs(wxT("Selection"));
double t0, t1;
if (selection)
{
t0 = context.GetProject()->mViewInfo.selectedRegion.t0();
t1 = context.GetProject()->mViewInfo.selectedRegion.t1();
}
else
{
t0 = 0.0;
t1 = context.GetProject()->GetTracks()->GetEndTime();
}
t0 = context.GetProject()->mViewInfo.selectedRegion.t0();
t1 = context.GetProject()->mViewInfo.selectedRegion.t1();
// Find the extension and check it's valid
int splitAt = filename.Find(wxUniChar('.'), true);
int splitAt = mFileName.Find(wxUniChar('.'), true);
if (splitAt < 0)
{
Error(wxT("Export filename must have an extension!"));
context.Error(wxT("Export filename must have an extension!"));
return false;
}
wxString extension = filename.Mid(splitAt+1).MakeUpper();
wxString extension = mFileName.Mid(splitAt+1).MakeUpper();
Exporter exporter;
bool exportSuccess = exporter.Process(context.GetProject(),
std::max(0L, numChannels),
extension, filename,
selection, t0, t1);
std::max(0, mnChannels),
extension, mFileName,
true, t0, t1);
if (exportSuccess)
{
Status(wxString::Format(wxT("Exported to %s format: %s"),
extension, filename));
context.Status(wxString::Format(wxT("Exported to %s format: %s"),
extension, mFileName));
return true;
}
Error(wxString::Format(wxT("Could not export to %s format!"), extension));
context.Error(wxString::Format(wxT("Could not export to %s format!"), extension));
return false;
}
ExportCommand::~ExportCommand()
{ }

View File

@ -22,44 +22,39 @@
// Import
class ImportCommandType final : public CommandType
#define IMPORT_PLUGIN_SYMBOL XO("Import")
class ImportCommand : public AudacityCommand
{
public:
wxString BuildName() override;
void BuildSignature(CommandSignature &signature) override;
CommandHolder Create(std::unique_ptr<CommandOutputTarget> &&target) override;
// CommandDefinitionInterface overrides
wxString GetSymbol() override {return IMPORT_PLUGIN_SYMBOL;};
wxString GetDescription() override {return _("Imports from a file.");};
bool DefineParams( ShuttleParams & S ) override;
void PopulateOrExchange(ShuttleGui & S) override;
bool Apply(const CommandContext & context) override;
// AudacityCommand overrides
wxString ManualPage() override {return wxT("Import");};
public:
wxString mFileName;
};
class ImportCommand final : public CommandImplementation
#define EXPORT_PLUGIN_SYMBOL XO("Export")
class ExportCommand : public AudacityCommand
{
public:
ImportCommand(CommandType &type,
std::unique_ptr<CommandOutputTarget> &&target)
: CommandImplementation(type, std::move(target))
{ }
// CommandDefinitionInterface overrides
wxString GetSymbol() override {return EXPORT_PLUGIN_SYMBOL;};
wxString GetDescription() override {return _("Exports to a file.");};
bool DefineParams( ShuttleParams & S ) override;
void PopulateOrExchange(ShuttleGui & S) override;
bool Apply(const CommandContext & context) override;
virtual ~ImportCommand();
bool Apply(CommandExecutionContext context) override;
};
// Export
class ExportCommandType final : public CommandType
{
// AudacityCommand overrides
wxString ManualPage() override {return wxT("Export");};
public:
wxString BuildName() override;
void BuildSignature(CommandSignature &signature) override;
CommandHolder Create(std::unique_ptr<CommandOutputTarget> &&target) override;
};
class ExportCommand final : public CommandImplementation
{
public:
ExportCommand(CommandType &type,
std::unique_ptr<CommandOutputTarget> &&target)
: CommandImplementation(type, std::move(target))
{ }
virtual ~ExportCommand();
bool Apply(CommandExecutionContext context) override;
wxString mFileName;
int mnChannels;
};

View File

@ -0,0 +1,295 @@
/**********************************************************************
Audacity: A Digital Audio Editor
LoadCommands.cpp
Dominic Mazzoni
James Crook
/**************************************************************************//**
\class BuiltinCommandsModule
\brief Internal module to auto register all built in commands. It is closely
modelled on BuiltinEffectsModule
********************************************************************************/
#include "../Audacity.h"
#include "../Prefs.h"
#include "LoadCommands.h"
#include "../MemoryX.h"
#include "../effects/EffectManager.h"
#include "Demo.h"
#include "../Experimental.h"
#include "../commands/ScreenshotCommand.h"
#include "../commands/CompareAudioCommand.h"
#include "../commands/SetTrackInfoCommand.h"
#include "../commands/GetTrackInfoCommand.h"
#include "../commands/SelectCommand.h"
#include "../commands/PreferenceCommands.h"
#include "../commands/GetInfoCommand.h"
#include "../commands/HelpCommand.h"
#include "../commands/ImportExportCommands.h"
#include "../commands/OpenSaveCommands.h"
//
// Define the list of COMMANDs that will be autoregistered and how to instantiate each
//
#define COMMAND_LIST \
COMMAND( DEMO, DemoCommand, () ) \
COMMAND( SCREENSHOT, ScreenshotCommandType, () ) \
COMMAND( COMPARE_AUDIO, CompareAudioCommand, () ) \
COMMAND( GET_TRACK_INFO, GetTrackInfoCommand, () ) \
COMMAND( SET_TRACK_INFO, SetTrackInfoCommand, () ) \
COMMAND( SELECT, SelectCommand, () ) \
COMMAND( SELECT_TIME, SelectTimeCommand, () ) \
COMMAND( SELECT_TRACKS, SelectTracksCommand, () ) \
COMMAND( GET_PREFERENCE, GetPreferenceCommand, () ) \
COMMAND( SET_PREFERENCE, SetPreferenceCommand, () ) \
COMMAND( GET_INFO, GetInfoCommand, () ) \
COMMAND( HELP, HelpCommand, () ) \
COMMAND( IMPORT, ImportCommand, () ) \
COMMAND( EXPORT, ExportCommand, () ) \
COMMAND( OPEN_PROJECT, OpenProjectCommand, () ) \
COMMAND( SAVE_PROJECT, SaveProjectCommand, () ) \
//
// Define the list of COMMANDs that do not get autoregistered
//
#define EXCLUDE_LIST \
//
// Define the COMMAND() macro to generate enum names
//
#define COMMAND(n, i, args) ENUM_ ## n,
//
// Create the enum for the list of COMMANDs (will be used in a switch statement)
//
enum
{
COMMAND_LIST
EXCLUDE_LIST
};
//
// Redefine COMMAND() to add the COMMAND's name to an array
//
#undef COMMAND
#define COMMAND(n, i, args) n ## _PLUGIN_SYMBOL,
//
// Create the COMMAND name array
//
static const wxChar *kCOMMANDNames[] =
{
COMMAND_LIST
};
/*
//
// Create the COMMAND name array of excluded COMMANDs
//
static const wxChar *kExcludedNames[] =
{
EXCLUDE_LIST
};
*/
//
// Redefine COMMAND() to generate a case statement for the lookup switch
//
#undef COMMAND
#define COMMAND(n, i, args) case ENUM_ ## n: return std::make_unique<i> args;
// ============================================================================
// Module registration entry point
//
// This is the symbol that Audacity looks for when the module is built as a
// dynamic library.
//
// When the module is builtin to Audacity, we use the same function, but it is
// declared static so as not to clash with other builtin modules.
// ============================================================================
DECLARE_MODULE_ENTRY(AudacityModule)
{
// Create and register the importer
// Trust the module manager not to leak this
return safenew BuiltinCommandsModule(moduleManager, path);
}
// ============================================================================
// Register this as a builtin module
// ============================================================================
DECLARE_BUILTIN_MODULE(BuiltinsCommandBuiltin);
///////////////////////////////////////////////////////////////////////////////
//
// BuiltinCommandsModule
//
///////////////////////////////////////////////////////////////////////////////
BuiltinCommandsModule::BuiltinCommandsModule(ModuleManagerInterface *moduleManager,
const wxString *path)
{
mModMan = moduleManager;
if (path)
{
mPath = *path;
}
}
BuiltinCommandsModule::~BuiltinCommandsModule()
{
mPath.Clear();
}
// ============================================================================
// IdentInterface implementation
// ============================================================================
wxString BuiltinCommandsModule::GetPath()
{
return mPath;
}
wxString BuiltinCommandsModule::GetSymbol()
{
return XO("Builtin Commands");
}
wxString BuiltinCommandsModule::GetName()
{
return XO("Builtin Commands");
}
wxString BuiltinCommandsModule::GetVendor()
{
return XO("The Audacity Team");
}
wxString BuiltinCommandsModule::GetVersion()
{
// This "may" be different if this were to be maintained as a separate DLL
return AUDACITY_VERSION_STRING;
}
wxString BuiltinCommandsModule::GetDescription()
{
return _("Provides builtin commands to Audacity");
}
// ============================================================================
// ModuleInterface implementation
// ============================================================================
bool BuiltinCommandsModule::Initialize()
{
for (size_t i = 0; i < WXSIZEOF(kCOMMANDNames); i++)
{
wxLogDebug("Adding %s", kCOMMANDNames[i] );
mNames.Add(wxString(BUILTIN_GENERIC_COMMAND_PREFIX) + kCOMMANDNames[i]);
}
/*
for (size_t i = 0; i < WXSIZEOF(kExcludedNames); i++)
{
mNames.Add(wxString(BUILTIN_COMMAND_PREFIX) + kExcludedNames[i]);
}
*/
return true;
}
void BuiltinCommandsModule::Terminate()
{
// Nothing to do here
return;
}
bool BuiltinCommandsModule::AutoRegisterPlugins(PluginManagerInterface & pm)
{
wxString ignoredErrMsg;
for (size_t i = 0; i < WXSIZEOF(kCOMMANDNames); i++)
{
wxString path(wxString(BUILTIN_GENERIC_COMMAND_PREFIX) + kCOMMANDNames[i]);
if (!pm.IsPluginRegistered(path))
{
// No checking of error ?
// Uses Generic Registration, not Default.
// Registers as TypeGeneric, not TypeEffect.
DiscoverPluginsAtPath(path, ignoredErrMsg,
PluginManagerInterface::GenericRegistrationCallback);
}
}
// We still want to be called during the normal registration process
return false;
}
wxArrayString BuiltinCommandsModule::FindPluginPaths(PluginManagerInterface & WXUNUSED(pm))
{
return mNames;
}
unsigned BuiltinCommandsModule::DiscoverPluginsAtPath(
const wxString & path, wxString &errMsg,
const RegistrationCallback &callback)
{
errMsg.clear();
auto Command = Instantiate(path);
if (Command)
{
if (callback){
callback(this, Command.get());
}
return 1;
}
errMsg = _("Unknown built-in command name");
return 0;
}
bool BuiltinCommandsModule::IsPluginValid(const wxString & path, bool bFast)
{
// bFast is unused as checking in the list is fast.
bFast;
return mNames.Index(path) != wxNOT_FOUND;
}
IdentInterface *BuiltinCommandsModule::CreateInstance(const wxString & path)
{
// Acquires a resource for the application.
// Safety of this depends on complementary calls to DeleteInstance on the module manager side.
return Instantiate(path).release();
}
void BuiltinCommandsModule::DeleteInstance(IdentInterface *instance)
{
// Releases the resource.
std::unique_ptr < AudacityCommand > {
dynamic_cast<AudacityCommand *>(instance)
};
}
// ============================================================================
// BuiltinCommandsModule implementation
// ============================================================================
std::unique_ptr<AudacityCommand> BuiltinCommandsModule::Instantiate(const wxString & path)
{
wxASSERT(path.StartsWith(BUILTIN_GENERIC_COMMAND_PREFIX));
wxASSERT(mNames.Index(path) != wxNOT_FOUND);
switch (mNames.Index(path))
{
COMMAND_LIST;
EXCLUDE_LIST;
}
return nullptr;
}

View File

@ -0,0 +1,70 @@
/**********************************************************************
Audacity: A Digital Audio Editor
LoadCommands.h
Dominic Mazzoni
James Crook
**********************************************************************/
#include "audacity/ModuleInterface.h"
#include "audacity/EffectInterface.h"
#include "audacity/PluginInterface.h"
#include "AudacityCommand.h"
#include "../MemoryX.h"
///////////////////////////////////////////////////////////////////////////////
//
// BuiltinCommandsModule
//
///////////////////////////////////////////////////////////////////////////////
class BuiltinCommandsModule final : public ModuleInterface
{
public:
BuiltinCommandsModule(ModuleManagerInterface *moduleManager, const wxString *path);
virtual ~BuiltinCommandsModule();
// IdentInterface implementation
wxString GetPath() override;
wxString GetSymbol() override;
wxString GetName() override;
wxString GetVendor() override;
wxString GetVersion() override;
wxString GetDescription() override;
// ModuleInterface implementation
bool Initialize() override;
void Terminate() override;
wxArrayString FileExtensions() override { return {}; }
wxString InstallPath() override { return {}; }
bool AutoRegisterPlugins(PluginManagerInterface & pm) override;
wxArrayString FindPluginPaths(PluginManagerInterface & pm) override;
unsigned DiscoverPluginsAtPath(
const wxString & path, wxString &errMsg,
const RegistrationCallback &callback)
override;
bool IsPluginValid(const wxString & path, bool bFast) override;
IdentInterface *CreateInstance(const wxString & path) override;
void DeleteInstance(IdentInterface *instance) override;
private:
// BuiltinEffectModule implementation
std::unique_ptr<AudacityCommand> Instantiate(const wxString & path);
private:
ModuleManagerInterface *mModMan;
wxString mPath;
wxArrayString mNames;
};

View File

@ -16,6 +16,7 @@
#include "../Audacity.h"
#include "MessageCommand.h"
#include "CommandType.h"
#include "CommandContext.h"
wxString MessageCommandType::BuildName()
{
@ -28,14 +29,14 @@ void MessageCommandType::BuildSignature(CommandSignature &signature)
signature.AddParameter(wxT("MessageString"), wxT("Connected"), std::move(stringValidator));
}
CommandHolder MessageCommandType::Create(std::unique_ptr<CommandOutputTarget> &&target)
OldStyleCommandPointer MessageCommandType::Create(std::unique_ptr<CommandOutputTarget> &&target)
{
return std::make_shared<MessageCommand>(*this, std::move(target));
return std::make_shared<MessageCommand>(*this);
}
bool MessageCommand::Apply(CommandExecutionContext WXUNUSED(context))
bool MessageCommand::Apply(const CommandContext & context)
{
wxString message = GetString(wxT("MessageString"));
Status(message);
context.Status(message);
return true;
}

View File

@ -11,7 +11,7 @@
\file MessageCommand.h
\brief Contains definition of MessageCommand class.
*//***************************************************************//***
*//***************************************************************//**
\class MessageCommand
\brief Command to send a message (currently on the status channel)
@ -29,16 +29,15 @@ class MessageCommandType final : public CommandType
public:
wxString BuildName() override;
void BuildSignature(CommandSignature &signature) override;
CommandHolder Create(std::unique_ptr<CommandOutputTarget> &&target) override;
OldStyleCommandPointer Create(std::unique_ptr<CommandOutputTarget> &&target) override;
};
class MessageCommand final : public CommandImplementation
{
public:
MessageCommand(CommandType &type,
std::unique_ptr<CommandOutputTarget> &&target)
: CommandImplementation(type, std::move(target)) {}
bool Apply(CommandExecutionContext context) override;
MessageCommand(CommandType &type)
: CommandImplementation(type) {}
bool Apply(const CommandContext &context ) override;
};
#endif /* End of include guard: __MESSAGECOMMAND__ */

View File

@ -17,40 +17,39 @@
#include "OpenSaveCommands.h"
#include "../Project.h"
#include "../export/Export.h"
#include "../ShuttleGui.h"
#include "CommandContext.h"
// OpenProject
wxString OpenProjectCommandType::BuildName()
{
return wxT("OpenProject");
bool OpenProjectCommand::DefineParams( ShuttleParams & S ){
S.Define( mFileName, wxT("Filename"), "test.aup" );
S.Define( mbAddToHistory, wxT("AddToHistory"), false );
return true;
}
void OpenProjectCommandType::BuildSignature(CommandSignature &signature)
void OpenProjectCommand::PopulateOrExchange(ShuttleGui & S)
{
auto addToHistoryValidator = make_movable<BoolValidator>();
signature.AddParameter(wxT("AddToHistory"), true, std::move(addToHistoryValidator));
auto filenameValidator = make_movable<DefaultValidator>();
signature.AddParameter(wxT("Filename"), wxT(""), std::move(filenameValidator));
S.AddSpace(0, 5);
S.StartMultiColumn(2, wxALIGN_CENTER);
{
S.TieTextBox(_("File Name:"),mFileName);
S.TieCheckBox(_("Add to History"), mbAddToHistory );
}
S.EndMultiColumn();
}
CommandHolder OpenProjectCommandType::Create(std::unique_ptr<CommandOutputTarget> &&target)
{
return std::make_shared<OpenProjectCommand>(*this, std::move(target));
}
bool OpenProjectCommand::Apply(const CommandContext & context){
bool OpenProjectCommand::Apply(CommandExecutionContext context)
{
wxString fileName = GetString(wxT("Filename"));
bool addToHistory = GetBool(wxT("AddToHistory"));
wxString oldFileName = context.GetProject()->GetFileName();
if(fileName == wxEmptyString)
if(mFileName.IsEmpty())
{
auto project = context.GetProject();
project->OnOpen(*project);
}
else
{
context.GetProject()->OpenFile(fileName, addToHistory);
context.GetProject()->OpenFile(mFileName, mbAddToHistory);
}
const wxString &newFileName = context.GetProject()->GetFileName();
@ -60,43 +59,30 @@ bool OpenProjectCommand::Apply(CommandExecutionContext context)
return newFileName != wxEmptyString && newFileName != oldFileName;
}
OpenProjectCommand::~OpenProjectCommand()
{ }
// SaveProject
wxString SaveProjectCommandType::BuildName()
{
return wxT("SaveProject");
bool SaveProjectCommand::DefineParams( ShuttleParams & S ){
S.Define( mFileName, wxT("Filename"), "name.aup" );
S.Define( mbAddToHistory, wxT("AddToHistory"), false );
S.Define( mbCompress, wxT("Compress"), false );
return true;
}
void SaveProjectCommandType::BuildSignature(CommandSignature &signature)
void SaveProjectCommand::PopulateOrExchange(ShuttleGui & S)
{
auto saveCompressedValidator = make_movable<BoolValidator>();
auto addToHistoryValidator = make_movable<BoolValidator>();
S.AddSpace(0, 5);
signature.AddParameter(wxT("Compress"), false, std::move(saveCompressedValidator));
signature.AddParameter(wxT("AddToHistory"), true, std::move(addToHistoryValidator));
auto filenameValidator = make_movable<DefaultValidator>();
signature.AddParameter(wxT("Filename"), wxT(""), std::move(filenameValidator));
S.StartMultiColumn(2, wxALIGN_CENTER);
{
S.TieTextBox(_("File Name:"),mFileName);
S.TieCheckBox(_("Add to History:"), mbAddToHistory );
S.TieCheckBox(_("Compress:"), mbCompress );
}
S.EndMultiColumn();
}
CommandHolder SaveProjectCommandType::Create(std::unique_ptr<CommandOutputTarget> &&target)
bool SaveProjectCommand::Apply(const CommandContext &context)
{
return std::make_shared<SaveProjectCommand>(*this, std::move(target));
}
bool SaveProjectCommand::Apply(CommandExecutionContext context)
{
wxString fileName = GetString(wxT("Filename"));
bool saveCompressed = GetBool(wxT("Compress"));
bool addToHistory = GetBool(wxT("AddToHistory"));
if(fileName == wxEmptyString)
return context.GetProject()->SaveAs(saveCompressed);
if(mFileName.IsEmpty())
return context.GetProject()->SaveAs(mbCompress);
else
return context.GetProject()->SaveAs(fileName,saveCompressed,addToHistory);
return context.GetProject()->SaveAs(mFileName,mbCompress,mbAddToHistory);
}
SaveProjectCommand::~SaveProjectCommand()
{ }

View File

@ -20,46 +20,41 @@
#include "Command.h"
#include "CommandType.h"
// Open
#define OPEN_PROJECT_PLUGIN_SYMBOL XO("Open Project")
class OpenProjectCommandType final : public CommandType
class OpenProjectCommand : public AudacityCommand
{
public:
wxString BuildName() override;
void BuildSignature(CommandSignature &signature) override;
CommandHolder Create(std::unique_ptr<CommandOutputTarget> &&target) override;
// CommandDefinitionInterface overrides
wxString GetSymbol() override {return OPEN_PROJECT_PLUGIN_SYMBOL;};
wxString GetDescription() override {return _("Open a project.");};
bool DefineParams( ShuttleParams & S ) override;
void PopulateOrExchange(ShuttleGui & S) override;
bool Apply(const CommandContext & context) override;
// AudacityCommand overrides
wxString ManualPage() override {return wxT("Open");};
public:
wxString mFileName;
bool mbAddToHistory;
};
class OpenProjectCommand final : public CommandImplementation
#define SAVE_PROJECT_PLUGIN_SYMBOL XO("Save Project")
class SaveProjectCommand : public AudacityCommand
{
public:
OpenProjectCommand(CommandType &type,
std::unique_ptr<CommandOutputTarget> &&target)
: CommandImplementation(type, std::move(target))
{ }
// CommandDefinitionInterface overrides
wxString GetSymbol() override {return SAVE_PROJECT_PLUGIN_SYMBOL;};
wxString GetDescription() override {return _("Saves a project.");};
bool DefineParams( ShuttleParams & S ) override;
void PopulateOrExchange(ShuttleGui & S) override;
bool Apply(const CommandContext & context) override;
virtual ~OpenProjectCommand();
bool Apply(CommandExecutionContext context) override;
};
// Save
class SaveProjectCommandType final : public CommandType
{
// AudacityCommand overrides
wxString ManualPage() override {return wxT("Save");};
public:
wxString BuildName() override;
void BuildSignature(CommandSignature &signature) override;
CommandHolder Create(std::unique_ptr<CommandOutputTarget> &&target) override;
};
class SaveProjectCommand final : public CommandImplementation
{
public:
SaveProjectCommand(CommandType &type,
std::unique_ptr<CommandOutputTarget> &&target)
: CommandImplementation(type, std::move(target))
{ }
virtual ~SaveProjectCommand();
bool Apply(CommandExecutionContext context) override;
};
wxString mFileName;
bool mbAddToHistory;
bool mbCompress;
};

View File

@ -5,6 +5,7 @@
File License: wxWidgets
Dan Horgan
James Crook
******************************************************************//**
@ -17,66 +18,61 @@ SetPreferenceCommand classes
#include "../Audacity.h"
#include "PreferenceCommands.h"
#include "../Prefs.h"
#include "../ShuttleGui.h"
#include "../commands/CommandContext.h"
// GetPreference
wxString GetPreferenceCommandType::BuildName()
{
return wxT("GetPreference");
}
void GetPreferenceCommandType::BuildSignature(CommandSignature &signature)
{
auto prefNameValidator = make_movable<DefaultValidator>();
signature.AddParameter(wxT("PrefName"), wxT(""), std::move(prefNameValidator));
}
CommandHolder GetPreferenceCommandType::Create(std::unique_ptr<CommandOutputTarget> &&target)
{
return std::make_shared<GetPreferenceCommand>(*this, std::move(target));
}
bool GetPreferenceCommand::Apply(CommandExecutionContext WXUNUSED(context))
{
wxString prefName = GetString(wxT("PrefName"));
wxString prefValue;
if (!gPrefs->Read(prefName, &prefValue))
{
return false;
}
Status(prefValue);
bool GetPreferenceCommand::DefineParams( ShuttleParams & S ){
S.Define( mName, wxT("Name"), wxT("") );
return true;
}
GetPreferenceCommand::~GetPreferenceCommand()
{ }
// SetPreference
wxString SetPreferenceCommandType::BuildName()
void GetPreferenceCommand::PopulateOrExchange(ShuttleGui & S)
{
return wxT("SetPreference");
S.AddSpace(0, 5);
S.StartMultiColumn(2, wxALIGN_CENTER);
{
S.TieTextBox(_("Name:"),mName);
}
S.EndMultiColumn();
}
void SetPreferenceCommandType::BuildSignature(CommandSignature &signature)
bool GetPreferenceCommand::Apply(const CommandContext & context)
{
auto prefNameValidator = make_movable<DefaultValidator>();
signature.AddParameter(wxT("PrefName"), wxT(""), std::move(prefNameValidator));
auto prefValueValidator = make_movable<DefaultValidator>();
signature.AddParameter(wxT("PrefValue"), wxT(""), std::move(prefValueValidator));
wxString prefValue;
if (!gPrefs->Read(mName, &prefValue))
return false;
context.Status(prefValue);
return true;
}
CommandHolder SetPreferenceCommandType::Create(std::unique_ptr<CommandOutputTarget> &&target)
{
return std::make_shared<SetPreferenceCommand>(*this, std::move(target));
bool SetPreferenceCommand::DefineParams( ShuttleParams & S ){
S.Define( mName, wxT("Name"), wxT("") );
S.Define( mValue, wxT("Value"), wxT("") );
S.Define( mbReload, wxT("Reload"), false );
return true;
}
bool SetPreferenceCommand::Apply(CommandExecutionContext WXUNUSED(context))
void SetPreferenceCommand::PopulateOrExchange(ShuttleGui & S)
{
wxString prefName = GetString(wxT("PrefName"));
wxString prefValue = GetString(wxT("PrefValue"));
return (gPrefs->Write(prefName, prefValue) && gPrefs->Flush());
S.AddSpace(0, 5);
S.StartMultiColumn(2, wxALIGN_CENTER);
{
S.TieTextBox(_("Name:"),mName);
S.TieTextBox(_("Value:"),mValue);
S.TieCheckBox(_("Reload:"),mbReload);
}
S.EndMultiColumn();
}
bool SetPreferenceCommand::Apply(const CommandContext & WXUNUSED(context))
{
bool bOK = gPrefs->Write(mName, mValue) && gPrefs->Flush();
if( bOK && mbReload )
bOK = bOK; // Not yet implemented.
return bOK;
}
SetPreferenceCommand::~SetPreferenceCommand()
{ }

View File

@ -6,15 +6,16 @@
PreferenceCommands.h
Dan Horgan
James Crook
******************************************************************//**
\class SetPreferenceCommand
\brief Command for setting a preference to a given value
\class GetPreferenceCommand
\brief Command for getting the value of a preference
\class SetPreferenceCommand
\brief Command for setting a preference to a given value
*//*******************************************************************/
#ifndef __PREFERENCECOMMANDS__
@ -25,46 +26,43 @@
// GetPreference
class GetPreferenceCommandType final : public CommandType
#define GET_PREFERENCE_PLUGIN_SYMBOL XO("Get Preference")
#define SET_PREFERENCE_PLUGIN_SYMBOL XO("Set Preference")
class GetPreferenceCommand final : public AudacityCommand
{
public:
wxString BuildName() override;
void BuildSignature(CommandSignature &signature) override;
CommandHolder Create(std::unique_ptr<CommandOutputTarget> &&target) override;
};
// CommandDefinitionInterface overrides
wxString GetSymbol() override {return GET_PREFERENCE_PLUGIN_SYMBOL;};
wxString GetDescription() override {return _("Gets the value of a single preference.");};
bool DefineParams( ShuttleParams & S ) override;
void PopulateOrExchange(ShuttleGui & S) override;
bool Apply(const CommandContext & context) override;
class GetPreferenceCommand final : public CommandImplementation
{
public:
GetPreferenceCommand(CommandType &type,
std::unique_ptr<CommandOutputTarget> &&target)
: CommandImplementation(type, std::move(target))
{ }
// AudacityCommand overrides
wxString ManualPage() override {return wxT("Preferences");};
virtual ~GetPreferenceCommand();
bool Apply(CommandExecutionContext context) override;
wxString mName;
};
// SetPreference
class SetPreferenceCommandType final : public CommandType
class SetPreferenceCommand final : public AudacityCommand
{
public:
wxString BuildName() override;
void BuildSignature(CommandSignature &signature) override;
CommandHolder Create(std::unique_ptr<CommandOutputTarget> &&target) override;
};
// CommandDefinitionInterface overrides
wxString GetSymbol() override {return SET_PREFERENCE_PLUGIN_SYMBOL;};
wxString GetDescription() override {return _("Sets the value of a single preference.");};
bool DefineParams( ShuttleParams & S ) override;
void PopulateOrExchange(ShuttleGui & S) override;
bool Apply(const CommandContext & context) override;
class SetPreferenceCommand final : public CommandImplementation
{
public:
SetPreferenceCommand(CommandType &type,
std::unique_ptr<CommandOutputTarget> &&target)
: CommandImplementation(type, std::move(target))
{ }
// AudacityCommand overrides
wxString ManualPage() override {return wxT("Preferences");};
virtual ~SetPreferenceCommand();
bool Apply(CommandExecutionContext context) override;
wxString mName;
wxString mValue;
bool mbReload;
};
#endif /* End of include guard: __PREFERENCECOMMANDS__ */

View File

@ -6,20 +6,17 @@
Dominic Mazzoni
Dan Horgan
James Crook
******************************************************************//**
\class ScreenshotCommand
\brief Implements a command for capturing various areas of the screen or
project window.
project window. It's one big if-elseif switch statement with lots of
small calculations of rectangles.
*//*******************************************************************/
/* TODO: JKC: The screenshot code is very verbose and should be made
much shorter. It could work from a single list of function
names and functors.
*/
#include "../Audacity.h"
#include "ScreenshotCommand.h"
#include "CommandTargets.h"
@ -29,6 +26,7 @@ project window.
#include <wx/dcmemory.h>
#include <wx/settings.h>
#include <wx/bitmap.h>
#include <wx/valgen.h>
#include "../Track.h"
#include "../TrackPanel.h"
@ -44,62 +42,109 @@ project window.
#include "../toolbars/TranscriptionToolBar.h"
#include "../widgets/Ruler.h"
#include "../Prefs.h"
#include "../ShuttleGui.h"
#include "CommandContext.h"
#if defined(__WXMAC__) && !wxCHECK_VERSION(3, 0, 0)
//
// This is a temporary solution for capturing screenshots on
// OS X 10.6 or greater. This needs to go away once we move
// to wx3.
//
// (This was copied from wx3.1.0 source and hacked up a bit.)
//
#include <wx/mac/private.h>
#include <dlfcn.h>
typedef CGImageRef (*CGDisplayCreateImageFunc)(CGDirectDisplayID displayID);
static wxBitmap DoGetAsBitmap(const wxRect *subrect)
enum kCaptureTypes
{
CGRect cgbounds = CGDisplayBounds(CGMainDisplayID());
kwindow,
kfullwindow,
kwindowplus,
kfullscreen,
ktoolbars,
kmenus,
keffects,
kpreferences,
kselectionbar,
kspectralselection,
ktools,
ktransport,
kmixer,
kmeter,
kplaymeter,
krecordmeter,
kedit,
kdevice,
kscrub,
ktranscription,
ktrackpanel,
kruler,
ktracks,
kfirsttrack,
ksecondtrack,
kNumCaptureWhats
};
wxRect rect = subrect ? *subrect : wxRect(0, 0, cgbounds.size.width, cgbounds.size.height);
static const wxString kCaptureWhatStrings[kNumCaptureWhats] =
{
XO("Window"),
XO("Full_Window"),
XO("Window_Plus"),
XO("Fullscreen"),
XO("Toolbars"),
XO("Menus"),
XO("Effects"),
XO("Preferences"),
XO("Selectionbar"),
XO("Spectral_Selection"),
XO("Tools"),
XO("Transport"),
XO("Mixer"),
XO("Meter"),
XO("Play_Meter"),
XO("Record_Meter"),
XO("Edit"),
XO("Device"),
XO("Scrub"),
XO("Transcription"),
XO("Trackpanel"),
XO("Ruler"),
XO("Tracks"),
XO("First_Track"),
XO("Second_Track")
};
wxBitmap bmp(rect.GetSize().GetWidth(), rect.GetSize().GetHeight(), 32);
CGDisplayCreateImageFunc createImage =
(CGDisplayCreateImageFunc) dlsym(RTLD_NEXT, "CGDisplayCreateImage");
if (createImage == NULL)
{
return bmp;
}
enum kBackgrounds
{
kBlue,
kWhite,
kNone,
kNumBackgrounds
};
CGRect srcRect = CGRectMake(rect.x, rect.y, rect.width, rect.height);
static const wxString kBackgroundStrings[kNumBackgrounds] =
{
XO("Blue"),
XO("White"),
XO("None")
};
CGContextRef context = (CGContextRef)bmp.GetHBITMAP();
CGContextSaveGState(context);
bool ScreenshotCommandType::DefineParams( ShuttleParams & S ){
wxArrayString whats(kNumCaptureWhats, kCaptureWhatStrings);
wxArrayString backs(kNumBackgrounds, kBackgroundStrings);
S.Define( mPath, wxT("Path"), wxT(""), wxT(""), wxT(""), wxT(""));
S.DefineEnum( mWhat, wxT("CaptureWhat"), wxT("Window"), whats );
S.DefineEnum( mBack, wxT("Background"), wxT("None"), backs );
return true;
};
CGContextTranslateCTM( context, 0, cgbounds.size.height );
CGContextScaleCTM( context, 1, -1 );
void ScreenshotCommandType::PopulateOrExchange(ShuttleGui & S)
{
wxArrayString whats(kNumCaptureWhats, kCaptureWhatStrings);
wxArrayString backs(kNumBackgrounds, kBackgroundStrings);
S.AddSpace(0, 5);
if ( subrect )
srcRect = CGRectOffset( srcRect, -subrect->x, -subrect->y ) ;
CGImageRef image = NULL;
image = createImage(kCGDirectMainDisplay);
wxASSERT_MSG(image, wxT("wxScreenDC::GetAsBitmap - unable to get screenshot."));
CGContextDrawImage(context, srcRect, image);
CGImageRelease(image);
CGContextRestoreGState(context);
return bmp;
S.StartMultiColumn(2, wxALIGN_CENTER);
{
S.TieTextBox( _("Path:"), mPath);
S.TieChoice( _("Capture What:"), mWhat, &whats);
S.TieChoice( _("Background:"), mBack, &backs);
}
S.EndMultiColumn();
}
#endif
// static member variable.
void (*ScreenshotCommand::mIdleHandler)(wxIdleEvent& event) = NULL;
@ -114,9 +159,10 @@ void IdleHandler(wxIdleEvent& event){
wxWindow * pWin = dynamic_cast<wxWindow*>(event.GetEventObject());
wxASSERT( pWin );
pWin->Unbind(wxEVT_IDLE, IdleHandler);
CommandContext context( *GetActiveProject() );
// We have the relevant window, so go and capture it.
if( ScreenshotCommand::mpShooter )
ScreenshotCommand::mpShooter->CaptureWindowOnIdle( pWin );
ScreenshotCommand::mpShooter->CaptureWindowOnIdle( context, pWin );
}
@ -177,11 +223,16 @@ static void Yield()
}
}
void ScreenshotCommand::Capture(const wxString &filename,
wxWindow *window,
int x, int y, int width, int height,
bool ScreenshotCommand::Capture(
const CommandContext & context,
const wxString &filename,
wxWindow *window, wxRect r,
bool bg)
{
int width = r.width;
int height = r.height;
if( r.width == 0 )
return false;
if (window) {
if (window->IsTopLevel()) {
window->Raise();
@ -214,7 +265,7 @@ void ScreenshotCommand::Capture(const wxString &filename,
fullDC.SelectObject(wxNullBitmap);
#endif
wxRect r(x, y, width, height);
//wxRect r(x, y, width, height);
// Ensure within bounds (x/y are negative on Windows when maximized)
r.Intersect(wxRect(0, 0, screenW, screenH));
@ -245,18 +296,22 @@ void ScreenshotCommand::Capture(const wxString &filename,
// Save the final image
wxImage image = part.ConvertToImage();
::wxBell();
if (image.SaveFile(filename)) {
mOutput->Status( wxString::Format( _("Saved %s"), filename ) );
context.Status( wxString::Format( _("Saved %s"), filename ) );
}
else {
mOutput->Error(
context.Error(
wxString::Format( _("Error trying to save file: %s"), filename ) );
return false;
}
::wxBell();
return true;
}
void ScreenshotCommand::CaptureToolbar(ToolManager *man, int type, const wxString &name)
bool ScreenshotCommand::CaptureToolbar(
const CommandContext & context,
ToolManager *man, int type, const wxString &name)
{
bool visible = man->IsVisible(type);
if (!visible) {
@ -271,17 +326,20 @@ void ScreenshotCommand::CaptureToolbar(ToolManager *man, int type, const wxStrin
w->ClientToScreen(&x, &y);
w->GetParent()->ScreenToClient(&x, &y);
w->GetClientSize(&width, &height);
Capture(name, w, x, y, width, height);
bool result = Capture(context, name, w, wxRect(x, y, width, height));
if (!visible) {
man->ShowHide(type);
if (mIgnore)
mIgnore->Raise();
}
return result;
}
void ScreenshotCommand::CaptureDock(wxWindow *win, const wxString &fileName)
bool ScreenshotCommand::CaptureDock(
const CommandContext & context,
wxWindow *win, const wxString &mFileName)
{
int x = 0, y = 0;
int width, height;
@ -290,10 +348,12 @@ void ScreenshotCommand::CaptureDock(wxWindow *win, const wxString &fileName)
win->GetParent()->ScreenToClient(&x, &y);
win->GetClientSize(&width, &height);
Capture(fileName, win, x, y, width, height);
return Capture(context, mFileName, win, wxRect(x, y, width, height));
}
void ExploreMenu( wxMenu * pMenu, int Id, int depth ){
void ExploreMenu(
const CommandContext & context,
wxMenu * pMenu, int Id, int depth ){
Id;//compiler food.
if( !pMenu )
return;
@ -323,14 +383,16 @@ void ExploreMenu( wxMenu * pMenu, int Id, int depth ){
wxLogDebug("T.Add( %2i, %2i, 0, \"%s¬%s\" );", depth, flags, Label,Accel );
if (item->IsSubMenu()) {
pMenu = item->GetSubMenu();
ExploreMenu( pMenu, item->GetId(), depth+1 );
ExploreMenu( context, pMenu, item->GetId(), depth+1 );
}
}
}
void ScreenshotCommand::CaptureMenus(wxMenuBar*pBar, const wxString &fileName)
void ScreenshotCommand::CaptureMenus(
const CommandContext & context,
wxMenuBar*pBar, const wxString &mFileName)
{
fileName;//compiler food.
mFileName;//compiler food.
if(!pBar ){
wxLogDebug("No menus");
return;
@ -343,7 +405,7 @@ void ScreenshotCommand::CaptureMenus(wxMenuBar*pBar, const wxString &fileName)
{
Label = pBar->GetMenuLabelText( i );
wxLogDebug( "\nT.Add( 0, 0, 0, \"%s¬\" );", Label);
ExploreMenu( pBar->GetMenu( i ), pBar->GetId(), 1 );
ExploreMenu( context, pBar->GetMenu( i ), pBar->GetId(), 1 );
}
#if 0
@ -354,7 +416,7 @@ void ScreenshotCommand::CaptureMenus(wxMenuBar*pBar, const wxString &fileName)
win->GetParent()->ScreenToClient(&x, &y);
win->GetClientSize(&width, &height);
Capture(fileName, win, x, y, width, height);
Capture(mFileName, win, wxRect(x, y, width, height));
#endif
}
@ -369,7 +431,9 @@ bool ScreenshotCommand::MayCapture( wxDialog * pDlg )
return true;
}
void ScreenshotCommand::CaptureWindowOnIdle( wxWindow * pWin )
void ScreenshotCommand::CaptureWindowOnIdle(
const CommandContext & context,
wxWindow * pWin )
{
wxDialog * pDlg = dynamic_cast<wxDialog*>(pWin);
if( !pDlg ){
@ -393,20 +457,22 @@ void ScreenshotCommand::CaptureWindowOnIdle( wxWindow * pWin )
wxMilliSleep( 200 );
// JKC: The border of 7 pixels was determined from a trial capture and then measuring
// in the GIMP. I'm unsure where the border comes from.
Capture( Name, pDlg, (int)Pos.x+7, (int)Pos.y, (int)Siz.x-14, (int)Siz.y-7 );
Capture( context, Name, pDlg, wxRect((int)Pos.x+7, (int)Pos.y, (int)Siz.x-14, (int)Siz.y-7) );
// We've captured the dialog, so now dismiss the dialog.
wxCommandEvent Evt( wxEVT_BUTTON, wxID_CANCEL );
pDlg->GetEventHandler()->AddPendingEvent( Evt );
}
void ScreenshotCommand::CapturePreferences( AudacityProject * pProject, const wxString &fileName ){
fileName;//compiler food.
void ScreenshotCommand::CapturePreferences(
const CommandContext & context,
AudacityProject * pProject, const wxString &mFileName ){
mFileName;//compiler food.
CommandManager * pMan = pProject->GetCommandManager();
// Yucky static variables. Is there a better way? The problem is that we need the
// idle callback to know more about what to do.
mDirToWriteTo = fileName.BeforeLast('\\') + "\\";
mDirToWriteTo = mFileName.BeforeLast('\\') + "\\";
mpShooter = this;
const int nPrefsPages = 19;
@ -416,7 +482,8 @@ void ScreenshotCommand::CapturePreferences( AudacityProject * pProject, const wx
gPrefs->Write(wxT("/Prefs/PrefsCategory"), (long)i);
gPrefs->Flush();
wxString Command = "Preferences";
if( !pMan->HandleTextualCommand( Command, AlwaysEnabledFlag, AlwaysEnabledFlag ) )
const CommandContext context( *pProject );
if( !pMan->HandleTextualCommand( Command, context, AlwaysEnabledFlag, AlwaysEnabledFlag ) )
{
wxLogDebug("Command %s not found", Command );
}
@ -426,13 +493,15 @@ void ScreenshotCommand::CapturePreferences( AudacityProject * pProject, const wx
}
}
void ScreenshotCommand::CaptureEffects( AudacityProject * pProject, const wxString &fileName ){
fileName;//compiler food.
void ScreenshotCommand::CaptureEffects(
const CommandContext & context,
AudacityProject * pProject, const wxString &mFileName ){
mFileName;//compiler food.
CommandManager * pMan = pProject->GetCommandManager();
wxString Str;
// Yucky static variables. Is there a better way? The problem is that we need the
// idle callback to know more about what to do.
mDirToWriteTo = fileName.BeforeLast('\\') + "\\";
mDirToWriteTo = mFileName.BeforeLast('\\') + "\\";
mpShooter = this;
#define TRICKY_CAPTURE
@ -523,7 +592,8 @@ void ScreenshotCommand::CaptureEffects( AudacityProject * pProject, const wxStri
// The handler is cleared each time it is used.
SetIdleHandler( IdleHandler );
Str = EffectNames[i];
if( !pMan->HandleTextualCommand( Str, AlwaysEnabledFlag, AlwaysEnabledFlag ) )
const CommandContext context( *pProject );
if( !pMan->HandleTextualCommand( Str, context, AlwaysEnabledFlag, AlwaysEnabledFlag ) )
{
wxLogDebug("Command %s not found", Str);
}
@ -533,62 +603,6 @@ void ScreenshotCommand::CaptureEffects( AudacityProject * pProject, const wxStri
}
}
wxString ScreenshotCommandType::BuildName()
{
return wxT("Screenshot");
}
void ScreenshotCommandType::BuildSignature(CommandSignature &signature)
{
auto captureModeValidator = make_movable<OptionValidator>();
captureModeValidator->AddOption(wxT("window"));
captureModeValidator->AddOption(wxT("fullwindow"));
captureModeValidator->AddOption(wxT("windowplus"));
captureModeValidator->AddOption(wxT("fullscreen"));
captureModeValidator->AddOption(wxT("toolbars"));
captureModeValidator->AddOption(wxT("menus"));
captureModeValidator->AddOption(wxT("effects"));
captureModeValidator->AddOption(wxT("preferences"));
captureModeValidator->AddOption(wxT("selectionbar"));
captureModeValidator->AddOption(wxT("spectralselection"));
captureModeValidator->AddOption(wxT("tools"));
captureModeValidator->AddOption(wxT("transport"));
captureModeValidator->AddOption(wxT("mixer"));
captureModeValidator->AddOption(wxT("meter"));
captureModeValidator->AddOption(wxT("playmeter"));
captureModeValidator->AddOption(wxT("recordmeter"));
captureModeValidator->AddOption(wxT("edit"));
captureModeValidator->AddOption(wxT("device"));
captureModeValidator->AddOption(wxT("scrub"));
captureModeValidator->AddOption(wxT("transcription"));
captureModeValidator->AddOption(wxT("trackpanel"));
captureModeValidator->AddOption(wxT("ruler"));
captureModeValidator->AddOption(wxT("tracks"));
captureModeValidator->AddOption(wxT("firsttrack"));
captureModeValidator->AddOption(wxT("secondtrack"));
auto backgroundValidator = make_movable<OptionValidator>();
backgroundValidator->AddOption(wxT("Blue"));
backgroundValidator->AddOption(wxT("White"));
backgroundValidator->AddOption(wxT("None"));
auto filePathValidator = make_movable<DefaultValidator>();
signature.AddParameter(wxT("CaptureMode"),
wxT("fullscreen"),
std::move(captureModeValidator));
signature.AddParameter(wxT("Background"),
wxT("None"),
std::move(backgroundValidator));
signature.AddParameter(wxT("FilePath"), wxT(""), std::move(filePathValidator));
}
CommandHolder ScreenshotCommandType::Create(std::unique_ptr<CommandOutputTarget> &&target)
{
return std::make_shared<ScreenshotCommand>(*this, std::move(target));
}
wxString ScreenshotCommand::MakeFileName(const wxString &path, const wxString &basename)
{
wxFileName prefixPath;
@ -607,8 +621,110 @@ wxString ScreenshotCommand::MakeFileName(const wxString &path, const wxString &b
return filename;
}
bool ScreenshotCommand::Apply(CommandExecutionContext context)
void ScreenshotCommand::GetDerivedParams()
{
// Read the parameters that were passed in
mFilePath = mPath;
mCaptureMode = mWhat;
wxString background = mBack;
// Build a suitable filename
mFileName = MakeFileName(mFilePath, mCaptureMode);
if (background.IsSameAs(wxT("Blue")))
{
mBackground = true;
mBackColor = wxColour(51, 102, 153);
}
else if (background.IsSameAs(wxT("White")))
{
mBackground = true;
mBackColor = wxColour(255, 255, 255);
}
else
{
mBackground = false;
}
}
wxRect ScreenshotCommand::GetWindowRect(wxTopLevelWindow *w){
int x = 0, y = 0;
int width, height;
w->ClientToScreen(&x, &y);
w->GetClientSize(&width, &height);
return wxRect( x,y,width,height);
}
wxRect ScreenshotCommand::GetFullWindowRect(wxTopLevelWindow *w){
wxRect r = w->GetRect();
r.SetPosition(w->GetScreenPosition());
r = w->GetScreenRect();
#if defined(__WXGTK__)
// In wxGTK, we need to include decoration sizes
r.width += (wxSystemSettings::GetMetric(wxSYS_BORDER_X, w) * 2);
r.height += wxSystemSettings::GetMetric(wxSYS_CAPTION_Y, w) +
wxSystemSettings::GetMetric(wxSYS_BORDER_Y, w);
#endif
if (!mBackground && mCaptureMode.IsSameAs(wxT("Window_Plus")))
{
// background colour not selected but we want a background
wxRect b = GetBackgroundRect();
r.x = (r.x - b.x) >= 0 ? (r.x - b.x): 0;
r.y = (r.y - b.y) >= 0 ? (r.y - b.y): 0;
r.width += b.width;
r.height += b.height;
}
return r;
}
wxRect ScreenshotCommand::GetScreenRect(){
int width, height;
wxDisplaySize(&width, &height);
return wxRect( 0,0,width,height);
}
wxRect ScreenshotCommand::GetPanelRect(TrackPanel * panel){
//AdornedRulerPanel *ruler = panel->mRuler;
int h = panel->mRuler->GetRulerHeight();
int x = 0, y = -h;
int width, height;
panel->ClientToScreen(&x, &y);
panel->GetParent()->ScreenToClient(&x, &y);
panel->GetClientSize(&width, &height);
return wxRect(x, y, width, height + h);
}
wxRect ScreenshotCommand::GetRulerRect(AdornedRulerPanel *ruler){
int x = 0, y = 0;
int width, height;
ruler->ClientToScreen(&x, &y);
ruler->GetParent()->ScreenToClient(&x, &y);
ruler->GetClientSize(&width, &height);
height = ruler->GetRulerHeight();
return wxRect( x, y, width, height);
}
wxRect ScreenshotCommand::GetTracksRect(TrackPanel * panel){
int x = 0, y = 0;
int width, height;
panel->ClientToScreen(&x, &y);
panel->GetParent()->ScreenToClient(&x, &y);
panel->GetClientSize(&width, &height);
return wxRect( x, y, width, height);
}
wxRect ScreenshotCommand::GetTrackRect( AudacityProject * pProj, TrackPanel * panel, int n){
auto FindRectangle = []( TrackPanel &panel, Track &t )
{
// This rectangle omits the focus ring about the track, and
@ -642,233 +758,97 @@ bool ScreenshotCommand::Apply(CommandExecutionContext context)
return rect;
};
// Read the parameters that were passed in
wxString filePath = GetString(wxT("FilePath"));
wxString captureMode = GetString(wxT("CaptureMode"));
wxString background = GetString(wxT("Background"));
// Build a suitable filename
wxString fileName = MakeFileName(filePath, captureMode);
if (background.IsSameAs(wxT("Blue")))
{
mBackground = true;
mBackColor = wxColour(51, 102, 153);
}
else if (background.IsSameAs(wxT("White")))
{
mBackground = true;
mBackColor = wxColour(255, 255, 255);
}
else
{
mBackground = false;
TrackListIterator iter(pProj->GetTracks());
int count = 0;
for (auto t = iter.First(); t; t = iter.Next()) {
count += 1;
if( count > n )
{
wxRect r = FindRectangle( *panel, *t );
return r;
}
if( t->GetLinked() ){
t = iter.Next();
if( !t )
break;
}
}
return wxRect( 0,0,0,0);
}
wxString ScreenshotCommand::WindowFileName(AudacityProject * proj, wxTopLevelWindow *w){
if (w != proj && w->GetTitle() != wxT("")) {
mFileName = MakeFileName(mFilePath,
mCaptureMode + (wxT("-") + w->GetTitle() + wxT("-")));
}
return mFileName;
}
bool ScreenshotCommand::Apply(const CommandContext & context)
{
GetDerivedParams();
//Don't reset the toolbars to a known state.
//We wil lbe capturing variations of them.
//We will be capturing variations of them.
//context.GetProject()->GetToolManager()->Reset();
wxTopLevelWindow *w = GetFrontWindow(context.GetProject());
if (!w)
{
return false;
}
if (captureMode.IsSameAs(wxT("window")))
{
int x = 0, y = 0;
int width, height;
TrackPanel *panel = context.GetProject()->GetTrackPanel();
AdornedRulerPanel *ruler = panel->mRuler;
w->ClientToScreen(&x, &y);
w->GetClientSize(&width, &height);
if (w != context.GetProject() && w->GetTitle() != wxT("")) {
fileName = MakeFileName(filePath,
captureMode + (wxT("-") + w->GetTitle() + wxT("-")));
}
Capture(fileName, w, x, y, width, height);
}
else if (captureMode.IsSameAs(wxT("fullwindow"))
|| captureMode.IsSameAs(wxT("windowplus")))
{
wxRect r = w->GetRect();
r.SetPosition(w->GetScreenPosition());
r = w->GetScreenRect();
if (w != context.GetProject() && w->GetTitle() != wxT("")) {
fileName = MakeFileName(filePath,
captureMode + (wxT("-") + w->GetTitle() + wxT("-")));
}
#if defined(__WXGTK__)
// In wxGTK, we need to include decoration sizes
r.width += (wxSystemSettings::GetMetric(wxSYS_BORDER_X, w) * 2);
r.height += wxSystemSettings::GetMetric(wxSYS_CAPTION_Y, w) +
wxSystemSettings::GetMetric(wxSYS_BORDER_Y, w);
#endif
if (!mBackground && captureMode.IsSameAs(wxT("windowplus")))
{
// background colour not selected but we want a background
wxRect b = GetBackgroundRect();
r.x = (r.x - b.x) >= 0 ? (r.x - b.x): 0;
r.y = (r.y - b.y) >= 0 ? (r.y - b.y): 0;
r.width += b.width;
r.height += b.height;
}
Capture(fileName, w, r.x, r.y, r.width, r.height, true);
}
else if (captureMode.IsSameAs(wxT("fullscreen")))
{
int width, height;
wxDisplaySize(&width, &height);
Capture(fileName, w, 0, 0, width, height);
}
else if (captureMode.IsSameAs(wxT("toolbars")))
{
CaptureDock(context.GetProject()->GetToolManager()->GetTopDock(), fileName);
}
else if (captureMode.IsSameAs(wxT("menus")))
{
CaptureMenus(context.GetProject()->GetMenuBar(), fileName);
}
else if (captureMode.IsSameAs(wxT("effects")))
{
CaptureEffects(context.GetProject(), fileName);
}
else if (captureMode.IsSameAs(wxT("preferences")))
{
CapturePreferences(context.GetProject(), fileName);
}
else if (captureMode.IsSameAs(wxT("selectionbar")))
{
CaptureToolbar(context.GetProject()->GetToolManager(), SelectionBarID, fileName);
}
else if (captureMode.IsSameAs(wxT("spectralselection")))
{
CaptureToolbar(context.GetProject()->GetToolManager(), SpectralSelectionBarID, fileName);
}
else if (captureMode.IsSameAs(wxT("tools")))
{
CaptureToolbar(context.GetProject()->GetToolManager(), ToolsBarID, fileName);
}
else if (captureMode.IsSameAs(wxT("transport")))
{
CaptureToolbar(context.GetProject()->GetToolManager(), TransportBarID, fileName);
}
else if (captureMode.IsSameAs(wxT("mixer")))
{
CaptureToolbar(context.GetProject()->GetToolManager(), MixerBarID, fileName);
}
else if (captureMode.IsSameAs(wxT("meter")))
{
CaptureToolbar(context.GetProject()->GetToolManager(), MeterBarID, fileName);
}
else if (captureMode.IsSameAs(wxT("recordmeter")))
{
CaptureToolbar(context.GetProject()->GetToolManager(), RecordMeterBarID, fileName);
}
else if (captureMode.IsSameAs(wxT("playmeter")))
{
CaptureToolbar(context.GetProject()->GetToolManager(), PlayMeterBarID, fileName);
}
else if (captureMode.IsSameAs(wxT("edit")))
{
CaptureToolbar(context.GetProject()->GetToolManager(), EditBarID, fileName);
}
else if (captureMode.IsSameAs(wxT("device")))
{
CaptureToolbar(context.GetProject()->GetToolManager(), DeviceBarID, fileName);
}
else if (captureMode.IsSameAs(wxT("transcription")))
{
CaptureToolbar(context.GetProject()->GetToolManager(), TranscriptionBarID, fileName);
}
else if (captureMode.IsSameAs(wxT("scrub")))
{
CaptureToolbar(context.GetProject()->GetToolManager(), ScrubbingBarID, fileName);
}
else if (captureMode.IsSameAs(wxT("trackpanel")))
{
TrackPanel *panel = context.GetProject()->GetTrackPanel();
//AdornedRulerPanel *ruler = panel->mRuler;
int h = panel->mRuler->GetRulerHeight();
int x = 0, y = -h;
int width, height;
panel->ClientToScreen(&x, &y);
panel->GetParent()->ScreenToClient(&x, &y);
panel->GetClientSize(&width, &height);
Capture(fileName, panel, x, y, width, height + h);
}
else if (captureMode.IsSameAs(wxT("ruler")))
{
TrackPanel *panel = context.GetProject()->GetTrackPanel();
AdornedRulerPanel *ruler = panel->mRuler;
int x = 0, y = 0;
int width, height;
ruler->ClientToScreen(&x, &y);
ruler->GetParent()->ScreenToClient(&x, &y);
ruler->GetClientSize(&width, &height);
height = ruler->GetRulerHeight();
Capture(fileName, ruler, x, y, width, height);
}
else if (captureMode.IsSameAs(wxT("tracks")))
{
TrackPanel *panel = context.GetProject()->GetTrackPanel();
int x = 0, y = 0;
int width, height;
panel->ClientToScreen(&x, &y);
panel->GetParent()->ScreenToClient(&x, &y);
panel->GetClientSize(&width, &height);
Capture(fileName, panel, x, y, width, height);
}
else if (captureMode.IsSameAs(wxT("firsttrack")))
{
TrackPanel *panel = context.GetProject()->GetTrackPanel();
TrackListIterator iter(context.GetProject()->GetTracks());
Track * t = iter.First();
if (!t) {
return false;
}
wxRect r = FindRectangle( *panel, *t );
Capture(fileName, panel, r.x, r.y, r.width, r.height);
}
else if (captureMode.IsSameAs(wxT("secondtrack")))
{
TrackPanel *panel = context.GetProject()->GetTrackPanel();
TrackListIterator iter(context.GetProject()->GetTracks());
Track * t = iter.First();
if (!t) {
return false;
}
if (t->GetLinked()) {
t = iter.Next();
}
t = iter.Next();
if (!t) {
return false;
}
wxRect r = FindRectangle( *panel, *t );
Capture(fileName, panel, r.x, r.y, r.width, r.height);
}
if (mCaptureMode.IsSameAs(wxT("Window")))
return Capture(context, WindowFileName( context.GetProject(), w ) , w, GetWindowRect(w));
else if (mCaptureMode.IsSameAs(wxT("Fullwindow"))
|| mCaptureMode.IsSameAs(wxT("Window_Plus")))
return Capture(context, WindowFileName( context.GetProject(), w ) , w, GetFullWindowRect(w));
else if (mCaptureMode.IsSameAs(wxT("Fullscreen")))
return Capture(context, mFileName, w,GetScreenRect());
else if (mCaptureMode.IsSameAs(wxT("Toolbars")))
return CaptureDock(context, context.GetProject()->GetToolManager()->GetTopDock(), mFileName);
else if (mCaptureMode.IsSameAs(wxT("Menus")))
CaptureMenus(context, context.GetProject()->GetMenuBar(), mFileName);
else if (mCaptureMode.IsSameAs(wxT("Effects")))
CaptureEffects(context, context.GetProject(), mFileName);
else if (mCaptureMode.IsSameAs(wxT("Preferences")))
CapturePreferences(context, context.GetProject(), mFileName);
else if (mCaptureMode.IsSameAs(wxT("Selectionbar")))
return CaptureToolbar(context, context.GetProject()->GetToolManager(), SelectionBarID, mFileName);
else if (mCaptureMode.IsSameAs(wxT("Spectral__Selection")))
return CaptureToolbar(context, context.GetProject()->GetToolManager(), SpectralSelectionBarID, mFileName);
else if (mCaptureMode.IsSameAs(wxT("Tools")))
return CaptureToolbar(context, context.GetProject()->GetToolManager(), ToolsBarID, mFileName);
else if (mCaptureMode.IsSameAs(wxT("Transport")))
return CaptureToolbar(context, context.GetProject()->GetToolManager(), TransportBarID, mFileName);
else if (mCaptureMode.IsSameAs(wxT("Mixer")))
return CaptureToolbar(context, context.GetProject()->GetToolManager(), MixerBarID, mFileName);
else if (mCaptureMode.IsSameAs(wxT("Meter")))
return CaptureToolbar(context, context.GetProject()->GetToolManager(), MeterBarID, mFileName);
else if (mCaptureMode.IsSameAs(wxT("Recordmeter")))
return CaptureToolbar(context, context.GetProject()->GetToolManager(), RecordMeterBarID, mFileName);
else if (mCaptureMode.IsSameAs(wxT("Playmeter")))
return CaptureToolbar(context, context.GetProject()->GetToolManager(), PlayMeterBarID, mFileName);
else if (mCaptureMode.IsSameAs(wxT("Edit")))
return CaptureToolbar(context, context.GetProject()->GetToolManager(), EditBarID, mFileName);
else if (mCaptureMode.IsSameAs(wxT("Device")))
return CaptureToolbar(context, context.GetProject()->GetToolManager(), DeviceBarID, mFileName);
else if (mCaptureMode.IsSameAs(wxT("Transcription")))
return CaptureToolbar(context, context.GetProject()->GetToolManager(), TranscriptionBarID, mFileName);
else if (mCaptureMode.IsSameAs(wxT("Scrub")))
return CaptureToolbar(context, context.GetProject()->GetToolManager(), ScrubbingBarID, mFileName);
else if (mCaptureMode.IsSameAs(wxT("Trackpanel")))
return Capture(context, mFileName, panel, GetPanelRect(panel));
else if (mCaptureMode.IsSameAs(wxT("Ruler")))
return Capture(context, mFileName, ruler, GetRulerRect(ruler) );
else if (mCaptureMode.IsSameAs(wxT("Tracks")))
return Capture(context, mFileName, panel, GetTracksRect(panel));
else if (mCaptureMode.IsSameAs(wxT("Firsttrack")))
return Capture(context, mFileName, panel, GetTrackRect( context.GetProject(), panel, 0 ) );
else if (mCaptureMode.IsSameAs(wxT("Secondtrack")))
return Capture(context, mFileName, panel, GetTrackRect( context.GetProject(), panel, 1 ) );
else
{
// Invalid capture mode!
return false;
}
return true;
}

View File

@ -6,6 +6,7 @@
Dominic Mazzoni
Dan Horgan
James Crook
**********************************************************************/
@ -13,7 +14,7 @@
#define __SCREENSHOTCOMMAND__
#include "Command.h"
#include "CommandType.h"
#include "../commands/AudacityCommand.h"
#include <wx/colour.h>
class wxWindow;
@ -22,17 +23,39 @@ class wxCommandEvent;
class wxRect;
class ToolManager;
class CommandOutputTarget;
class TrackPanel;
class AdornedRulerPanel;
class AudacityProject;
class CommandContext;
class ScreenshotCommandType final : public CommandType
#define SCREENSHOT_PLUGIN_SYMBOL XO("Screenshot")
class ScreenshotCommandType : public AudacityCommand
{
public:
wxString BuildName() override;
void BuildSignature(CommandSignature &signature) override;
CommandHolder Create(std::unique_ptr<CommandOutputTarget> &&target) override;
// CommandDefinitionInterface overrides
wxString GetSymbol() override {return SCREENSHOT_PLUGIN_SYMBOL;};
wxString GetDescription() override {return _("Takes screenshots.");};
bool DefineParams( ShuttleParams & S ) override;
void PopulateOrExchange(ShuttleGui & S) override;
// AudacityCommand overrides
wxString ManualPage() override {return wxT("Help_Menu:_Tools#screenshot_tools");};
private:
wxString mWhat;
wxString mBack;
wxString mPath;
friend class ScreenshotCommand;
friend class ScreenFrame;
};
class ScreenshotCommand final : public CommandImplementation
class ScreenshotCommand final : public ScreenshotCommandType
{
public:
bool Apply(const CommandContext & context) override;
void GetDerivedParams();
private:
// May need to ignore the screenshot dialog
wxWindow *mIgnore;
@ -41,19 +64,32 @@ private:
wxColour mBackColor;
wxString mDirToWriteTo;
wxString mFilePath;
wxString mFileName;
wxString mCaptureMode;
wxString MakeFileName(const wxString &path, const wxString &basename);
wxRect GetBackgroundRect();
void CaptureToolbar(ToolManager *man, int type, const wxString &name);
void CaptureDock(wxWindow *win, const wxString &fileName);
void CaptureMenus(wxMenuBar*pBar, const wxString &fileName);
void CaptureEffects( AudacityProject * pProject, const wxString &fileName );
void CapturePreferences( AudacityProject * pProject, const wxString &fileName );
void Capture(const wxString &basename,
wxWindow *window,
int x, int y, int width, int height,
bool CaptureToolbar(const CommandContext & Context, ToolManager *man, int type, const wxString &name);
bool CaptureDock(const CommandContext & Context, wxWindow *win, const wxString &fileName);
void CaptureMenus(const CommandContext & Context, wxMenuBar*pBar, const wxString &fileName);
void CaptureEffects(const CommandContext & Context, AudacityProject * pProject, const wxString &fileName );
void CapturePreferences(const CommandContext & Context, AudacityProject * pProject, const wxString &fileName );
bool Capture(
const CommandContext & Context,
const wxString &basename,
wxWindow *window, wxRect rect,
bool bg = false);
wxRect GetWindowRect(wxTopLevelWindow *w);
wxRect GetFullWindowRect(wxTopLevelWindow *w);
wxRect GetScreenRect();
wxRect GetPanelRect(TrackPanel * panel);
wxRect GetRulerRect(AdornedRulerPanel *ruler);
wxRect GetTracksRect(TrackPanel * panel);
wxRect GetTrackRect( AudacityProject * pProj, TrackPanel * panel,int n);
wxString WindowFileName(AudacityProject * proj, wxTopLevelWindow *w);
public:
static ScreenshotCommand * mpShooter;
@ -61,16 +97,8 @@ public:
static void SetIdleHandler( void (*pHandler)(wxIdleEvent& event) ){mIdleHandler=pHandler;};
static bool MayCapture( wxDialog * pDlg );
void CaptureWindowOnIdle( wxWindow * pWin );
void CaptureWindowOnIdle( const CommandContext & context, wxWindow * pWin );
wxTopLevelWindow *GetFrontWindow(AudacityProject *project);
ScreenshotCommand(CommandType &type,
std::unique_ptr<CommandOutputTarget> &&output,
wxWindow *ignore = NULL)
: CommandImplementation(type, std::move(output)),
mIgnore(ignore),
mBackground(false)
{ }
bool Apply(CommandExecutionContext context);
};
#endif /* End of include guard: __SCREENSHOTCOMMAND__ */

View File

@ -51,7 +51,7 @@ void ScriptCommandRelay::Run()
}
/// Send a command to a project, to be applied in that context.
void ScriptCommandRelay::PostCommand(AudacityProject *project, const CommandHolder &cmd)
void ScriptCommandRelay::PostCommand(AudacityProject *project, const OldStyleCommandPointer &cmd)
{
wxASSERT(project != NULL);
wxASSERT(cmd != NULL);
@ -72,7 +72,7 @@ int ExecCommand(wxString *pIn, wxString *pOut)
{
AudacityProject *project = GetActiveProject();
project->SafeDisplayStatusMessage(wxT("Received script command"));
CommandHolder cmd = builder.GetCommand();
OldStyleCommandPointer cmd = builder.GetCommand();
ScriptCommandRelay::PostCommand(project, cmd);
*pOut = wxEmptyString;
@ -89,6 +89,7 @@ int ExecCommand(wxString *pIn, wxString *pOut)
wxString msg = ScriptCommandRelay::ReceiveResponse().GetMessage();
while (msg != wxT("\n"))
{
wxLogDebug( "Msg: %s", msg );
*pOut += msg + wxT("\n");
msg = ScriptCommandRelay::ReceiveResponse().GetMessage();
}

View File

@ -24,8 +24,8 @@ class ResponseQueue;
class Response;
class ResponseQueueTarget;
class AudacityProject;
class Command;
using CommandHolder = std::shared_ptr<Command>;
class OldStyleCommand;
using OldStyleCommandPointer = std::shared_ptr<OldStyleCommand>;
class wxString;
typedef int (*tpExecScriptServerFunc)( wxString * pIn, wxString * pOut);
@ -49,7 +49,7 @@ class ScriptCommandRelay
static void SetCommandHandler(CommandHandler &ch);
static void Run();
static void PostCommand(AudacityProject *project, const CommandHolder &cmd);
static void PostCommand(AudacityProject *project, const OldStyleCommandPointer &cmd);
static void SendResponse(const wxString &response);
static Response ReceiveResponse();
static std::shared_ptr<ResponseQueueTarget> GetResponseTarget();

View File

@ -5,145 +5,116 @@
License: wxwidgets
Dan Horgan
James Crook
******************************************************************//**
\file SelectCommand.cpp
\brief Definitions for SelectCommand and SelectCommandType classes
\brief Definitions for SelectCommand classes
\class SelectTimeCommand
\brief Command for changing the time selection
\class SelectTracksCommand
\brief Command for changing the selection of tracks
\class SelectCommand
\brief Command for changing the selection
\brief Command for changing both time and track selection.
*//*******************************************************************/
#include "../Audacity.h"
#include "SelectCommand.h"
#include <wx/string.h>
#include <float.h>
#include "SelectCommand.h"
#include "../Project.h"
#include "../Track.h"
#include "../ShuttleGui.h"
#include "CommandContext.h"
wxString SelectCommandType::BuildName()
{
return wxT("Select");
bool SelectTimeCommand::DefineParams( ShuttleParams & S ){
S.Define( mT0, wxT("StartTime"), 0.0, 0.0, (double)FLT_MAX);
S.Define( mT1, wxT("EndTime"), 0.0, 0.0, (double)FLT_MAX);
S.Define( mFromEnd, wxT("FromEnd"), false );
return true;
}
void SelectCommandType::BuildSignature(CommandSignature &signature)
void SelectTimeCommand::PopulateOrExchange(ShuttleGui & S)
{
auto modeValidator = make_movable<OptionValidator>();
modeValidator->AddOption(wxT("None"));
modeValidator->AddOption(wxT("All"));
modeValidator->AddOption(wxT("Range"));
modeValidator->AddOption(wxT("Name"));
signature.AddParameter(wxT("Mode"), wxT("All"), std::move(modeValidator));
S.AddSpace(0, 5);
auto startTimeValidator = make_movable<DoubleValidator>();
signature.AddParameter(wxT("StartTime"), 0.0, std::move(startTimeValidator));
auto endTimeValidator = make_movable<DoubleValidator>();
signature.AddParameter(wxT("EndTime"), 0.0, std::move(endTimeValidator));
auto firstTrackValidator = make_movable<IntValidator>();
signature.AddParameter(wxT("FirstTrack"), 0, std::move(firstTrackValidator));
auto lastTrackValidator = make_movable<IntValidator>();
signature.AddParameter(wxT("LastTrack"), 0, std::move(lastTrackValidator));
auto trackNameValidator = make_movable<DefaultValidator>();
signature.AddParameter(wxT("TrackName"), 0, std::move(trackNameValidator));
}
CommandHolder SelectCommandType::Create(std::unique_ptr<CommandOutputTarget> &&target)
{
return std::make_shared<SelectCommand>(*this, std::move(target));
}
bool SelectCommand::Apply(CommandExecutionContext context)
{
wxString mode = GetString(wxT("Mode"));
if (mode.IsSameAs(wxT("None")))
S.StartMultiColumn(2, wxALIGN_CENTER);
{
// select none
auto project = context.GetProject();
project->OnSelectNone(*project);
S.TieTextBox(_("Start Time:"),mT0);
S.TieTextBox(_("End Time:"),mT1);
S.TieCheckBox(_("From End:"), mFromEnd );
}
else if (mode.IsSameAs(wxT("All")))
S.EndMultiColumn();
}
bool SelectTimeCommand::Apply(const CommandContext & context){
context.GetProject()->mViewInfo.selectedRegion.setTimes(mT0, mT1);
return true;
}
const int nModes =3;
static const wxString kModes[nModes] =
{
XO("Set"),
XO("Add"),
XO("Remove")
};
bool SelectTracksCommand::DefineParams( ShuttleParams & S ){
wxArrayString modes( nModes, kModes );
S.Define( mFirstTrack, wxT("FirstTrack"), 0, 0, 100);
S.Define( mLastTrack, wxT("LastTrack"), 0, 0, 100);
S.DefineEnum( mMode, wxT("Mode"), 0, modes );
return true;
}
void SelectTracksCommand::PopulateOrExchange(ShuttleGui & S)
{
wxArrayString modes( nModes, kModes );
S.AddSpace(0, 5);
S.StartMultiColumn(2, wxALIGN_CENTER);
{
// select all
auto project = context.GetProject();
project->OnSelectAll(*project);
S.TieTextBox(_("First Track:"),mFirstTrack);
S.TieTextBox(_("Last Track:"),mLastTrack);
S.TieChoice( _("Mode:"), mMode, &modes);
}
else if (mode.IsSameAs(wxT("Range")))
{
// select range
double t0 = GetDouble(wxT("StartTime"));
double t1 = GetDouble(wxT("EndTime"));
S.EndMultiColumn();
}
TrackList *tracks = context.GetProject()->GetTracks();
bool SelectTracksCommand::Apply(const CommandContext &context)
{
int index = 0;
TrackList *tracks = context.GetProject()->GetTracks();
int last = wxMax( mFirstTrack, mLastTrack );
if (t0 < context.GetProject()->GetTracks()->GetMinOffset())
{
Error(wxT("Start time is before start of track!"));
return false;
}
// PRL: to do: only setting time boundaries of current selection.
// Should other fields be left alone, or rather
// defaulted, as in the second branch?
// Or should this command take more parameters?
#if 1
context.GetProject()->mViewInfo.selectedRegion.setTimes(t0, t1);
#else
context.GetProject()->mViewInfo.selectedRegion = SelectedRegion(t0, t1);
#endif
// select specified tracks
long firstTrack = GetLong(wxT("FirstTrack"));
long lastTrack = GetLong(wxT("LastTrack"));
if (firstTrack < 0)
{
Error(wxT("Trying to select a negatively numbered track!"));
return false;
}
if (lastTrack >= (long)tracks->size())
{
Error(wxT("Trying to select higher number track than exists!"));
return false;
}
int index = 0;
TrackListIterator iter(tracks);
Track *t = iter.First();
while (t) {
bool sel = firstTrack <= index && index <= lastTrack;
TrackListIterator iter(tracks);
Track *t = iter.First();
while (t) {
bool sel = mFirstTrack <= index && index <= last;
if( mMode == 0 ){ // Set
t->SetSelected(sel);
if (sel)
Status(wxT("Selected track '") + t->GetName() + wxT("'"));
t = iter.Next();
++index;
context.Status(wxT("Selected track '") + t->GetName() + wxT("'"));
}
wxASSERT(index >= lastTrack);
}
else if (mode.IsSameAs(wxT("Name")))
{
wxString name = GetString(wxT("TrackName"));
TrackList *tracks = context.GetProject()->GetTracks();
TrackListIterator iter(tracks);
Track *t = iter.First();
while (t) {
bool sel = t->GetName().IsSameAs(name);
else if( mMode == 1 && sel ){ // Add
t->SetSelected(sel);
if (sel)
Status(wxT("Selected track '") + t->GetName() + wxT("'"));
t = iter.Next();
context.Status(wxT("Added track '") + t->GetName() + wxT("'"));
}
}
else
{
Error(wxT("Invalid selection mode!"));
return false;
else if( mMode == 2 && sel ){ // Remove
t->SetSelected(!sel);
context.Status(wxT("Removed track '") + t->GetName() + wxT("'"));
}
t = iter.Next();
++index;
}
return true;
}

View File

@ -5,6 +5,7 @@
License: GPL v2 - see LICENSE.txt
Dan Horgan
James Crook
******************************************************************//**
@ -16,23 +17,75 @@
#ifndef __SELECTCOMMAND__
#define __SELECTCOMMAND__
#include "CommandType.h"
#include "Command.h"
class SelectCommandType final : public CommandType
//#include "../commands/AudacityCommand.h"
#define SELECT_TIME_PLUGIN_SYMBOL XO("Select Time")
#define SELECT_TRACKS_PLUGIN_SYMBOL XO("Select Tracks")
#define SELECT_PLUGIN_SYMBOL XO("Select")
class SelectTimeCommand : public AudacityCommand
{
public:
wxString BuildName() override;
void BuildSignature(CommandSignature &signature) override;
CommandHolder Create(std::unique_ptr<CommandOutputTarget> &&target) override;
// CommandDefinitionInterface overrides
wxString GetSymbol() override {return SELECT_TIME_PLUGIN_SYMBOL;};
wxString GetDescription() override {return _("Selects a time range.");};
bool DefineParams( ShuttleParams & S ) override;
void PopulateOrExchange(ShuttleGui & S) override;
bool Apply(const CommandContext & context) override;
// AudacityCommand overrides
wxString ManualPage() override {return wxT("Audio_Selection");};
double mT0;
double mT1;
bool mFromEnd;
};
class SelectCommand final : public CommandImplementation
class SelectTracksCommand : public AudacityCommand
{
public:
SelectCommand(SelectCommandType &type, std::unique_ptr<CommandOutputTarget> &&target)
: CommandImplementation(type, std::move(target)) { }
bool Apply(CommandExecutionContext context) override;
// CommandDefinitionInterface overrides
wxString GetSymbol() override {return SELECT_TRACKS_PLUGIN_SYMBOL;};
wxString GetDescription() override {return _("Selects a range of tracks.");};
bool DefineParams( ShuttleParams & S ) override;
void PopulateOrExchange(ShuttleGui & S) override;
bool Apply(const CommandContext & context) override;
// AudacityCommand overrides
wxString ManualPage() override {return wxT("Audio_Selection");};
int mFirstTrack;
int mLastTrack;
int mMode;
};
class SelectCommand : public AudacityCommand
{
public:
// CommandDefinitionInterface overrides
wxString GetSymbol() override {return SELECT_PLUGIN_SYMBOL;};
wxString GetDescription() override {return _("Selects Audio.");};
bool DefineParams( ShuttleParams & S ) override {
return mSelTime.DefineParams(S) && mSelTracks.DefineParams(S);
};
void PopulateOrExchange(ShuttleGui & S) override {
mSelTime.PopulateOrExchange(S);
mSelTracks.PopulateOrExchange(S);
};
bool Apply(const CommandContext & context) override {
return mSelTime.Apply(context) && mSelTracks.Apply(context);
}
// AudacityCommand overrides
wxString ManualPage() override {return wxT("Audio_Selection");};
private:
SelectTimeCommand mSelTime;
SelectTracksCommand mSelTracks;
};
#endif /* End of include guard: __SELECTCOMMAND__ */

View File

@ -1,111 +0,0 @@
/**********************************************************************
Audacity - A Digital Audio Editor
Copyright 1999-2009 Audacity Team
License: wxwidgets
Marty Goddard
******************************************************************//**
\file SetProjectInfoCommand.cpp
\brief Definitions for SetProjectInfoCommand and SetProjectInfoCommandType classes
\class SetProjectInfoCommand
\brief Command that returns requested project information
*//*******************************************************************/
#include "SetProjectInfoCommand.h"
#include "../Project.h"
#include "../Track.h"
// The following parameters have a boolean string, indicated by the kSetOfTracksStr
#define kSetOfTracksStr "TrackSet"
wxString SetProjectInfoCommandType::BuildName()
{
return wxT("SetProjectInfo");
}
void SetProjectInfoCommandType::BuildSignature(CommandSignature &signature)
{
auto infoTypeValidator = make_movable<OptionValidator>();
infoTypeValidator->AddOption(wxT("SelectedTracks"));
infoTypeValidator->AddOption(wxT("MuteTracks"));
infoTypeValidator->AddOption(wxT("SoloTracks"));
signature.AddParameter(wxT("Type"), wxT("SelectedTracks"), std::move(infoTypeValidator));
auto TracksSetValidator = make_movable<BoolArrayValidator>();
signature.AddParameter(wxT(kSetOfTracksStr), wxT("x"), std::move(TracksSetValidator));
}
CommandHolder SetProjectInfoCommandType::Create(std::unique_ptr<CommandOutputTarget> &&target)
{
return std::make_shared<SetProjectInfoCommand>(*this, std::move(target));
}
// *********************** Public Methods *******************
bool SetProjectInfoCommand::Apply(CommandExecutionContext context)
{
wxString mode = GetString(wxT("Type"));
wxString settingsString = GetString(wxT(kSetOfTracksStr));
if (mode.IsSameAs(wxT("SelectedTracks")))
SetAllTracksParam( context.GetProject()->GetTracks(), settingsString,
&SetProjectInfoCommand::setSelected);
else if (mode.IsSameAs(wxT("SoloTracks")))
SetAllTracksParam( context.GetProject()->GetTracks(), settingsString, &SetProjectInfoCommand::setSolo);
else if (mode.IsSameAs(wxT("MuteTracks")))
SetAllTracksParam( context.GetProject()->GetTracks(), settingsString, &SetProjectInfoCommand::setMute);
else
{
Error(wxT("Invalid info type!"));
return false;
}
return true;
}
// *********************** Private Methods *******************
void SetProjectInfoCommand::SetAllTracksParam(TrackList *projTracks, const wxString &boolValueStr, Setter functPtrToSetter)
{
unsigned int i=0;
TrackListIterator iter(projTracks);
Track *t = iter.First();
while (t && i<boolValueStr.Len())
{
if(boolValueStr[i] == '1')
(this->*functPtrToSetter)(t, true);
if(boolValueStr[i] == '0')
(this->*functPtrToSetter)(t, false);
i++;
t = iter.Next();
}
}
void SetProjectInfoCommand::setSelected(Track * trk, bool param) const
{
trk->SetSelected(param);
}
void SetProjectInfoCommand::setSolo(Track * trk, bool param) const
{
auto pt = dynamic_cast<PlayableTrack *>(trk);
if (pt)
pt->SetSolo(param);
}
void SetProjectInfoCommand::setMute(Track * trk, bool param) const
{
auto pt = dynamic_cast<PlayableTrack *>(trk);
if (pt)
pt->SetMute(param);
}

View File

@ -1,66 +0,0 @@
/**********************************************************************
Audacity - A Digital Audio Editor
Copyright 1999-2009 Audacity Team
License: wxwidgets
Marty Goddard
******************************************************************//**
\file SetProjectInfoCommand.h
\brief Declarations of SetProjectInfoCommand and SetProjectInfoCommandType classes
*//*******************************************************************/
#ifndef __SETPROJECTINFOCOMMAND__
#define __SETPROJECTINFOCOMMAND__
#include "Command.h"
#include "CommandType.h"
// Forward decls
class Track;
class TrackList;
class SetProjectInfoCommandType final : public CommandType
{
public:
wxString BuildName() override;
void BuildSignature(CommandSignature &signature) override;
CommandHolder Create(std::unique_ptr<CommandOutputTarget> &&target) override;
};
class SetProjectInfoCommand final : public CommandImplementation
{
public:
SetProjectInfoCommand(CommandType &type, std::unique_ptr<CommandOutputTarget> &&target)
: CommandImplementation(type, std::move(target))
{ }
virtual ~SetProjectInfoCommand()
{ }
bool Apply(CommandExecutionContext context) override;
private:
// Function pointer to set a particular Track parameter
typedef void (SetProjectInfoCommand::*Setter)(Track *trk, bool setting) const;
// Uses the Function pointer to set a particular parameter within a loop of otherwise duplicate code
void SetAllTracksParam(TrackList *projTracks, const wxString &boolValueStr, Setter functPtrToSetter);
// Function pointer to accessing a particular parameter within a loop of otherwise duplicate code
void setSelected(Track *trk, bool setting) const;
void setSolo(Track *trk, bool setting) const;
void setMute(Track *trk, bool setting) const;
};
#endif /* End of include guard: __SETPROJECTINFOCOMMAND__ */

View File

@ -5,6 +5,7 @@
License: wxwidgets
Dan Horgan
James Crook
******************************************************************//**
@ -12,7 +13,7 @@
\brief Definitions for SetTrackInfoCommand and SetTrackInfoCommandType classes
\class SetTrackInfoCommand
\brief Command that sets track information (currently name only)
\brief Command that sets track information , name, mute/sol etc.
*//*******************************************************************/
@ -22,80 +23,90 @@
#include "../Track.h"
#include "../TrackPanel.h"
#include "../WaveTrack.h"
#include "../ShuttleGui.h"
#include "CommandContext.h"
wxString SetTrackInfoCommandType::BuildName()
SetTrackInfoCommand::SetTrackInfoCommand()
{
return wxT("SetTrackInfo");
mTrackIndex = 0;
mTrackName = "unnamed";
mPan = 0.0f;
mGain = 1.0f;
bSelected = false;
bFocused = false;
bSolo = false;
bMute = false;
}
void SetTrackInfoCommandType::BuildSignature(CommandSignature &signature)
bool SetTrackInfoCommand::DefineParams( ShuttleParams & S ){
S.Define( mTrackIndex, wxT("TrackIndex"), 0, 0, 100 );
S.Optional( bHasTrackName ).Define( mTrackName, wxT("Name"), wxT("Unnamed") );
S.Optional( bHasPan ).Define( mPan, wxT("Pan"), 0.0, -1.0, 1.0);
S.Optional( bHasGain ).Define( mGain, wxT("Gain"), 1.0, 0.0, 10.0);
S.Optional( bHasSelected ).Define( bSelected, wxT("Selected"), false );
S.Optional( bHasFocused ).Define( bFocused, wxT("Focuseed"), false );
S.Optional( bHasSolo ).Define( bSolo, wxT("Solo"), false );
S.Optional( bHasMute ).Define( bMute, wxT("Mute"), false );
return true;
};
void SetTrackInfoCommand::PopulateOrExchange(ShuttleGui & S)
{
auto trackIndexValidator = make_movable<IntValidator>();
signature.AddParameter(wxT("TrackIndex"), 0, std::move(trackIndexValidator));
auto nameValidator = make_movable<DefaultValidator>();
signature.AddParameter(wxT("Name"), wxT("Unnamed"), std::move(nameValidator));
auto panValidator = make_movable<DoubleValidator>();
signature.AddParameter(wxT("Pan"), wxT("1.0"), std::move(panValidator));
auto gainValidator = make_movable<DoubleValidator>();
signature.AddParameter(wxT("Gain"), wxT("1.0"), std::move(gainValidator));
auto selectedValidator = make_movable<BoolValidator>();
signature.AddParameter(wxT("Selected"), wxT("True"), std::move(selectedValidator));
auto focusedValidator = make_movable<BoolValidator>();
signature.AddParameter(wxT("Focused"), wxT("True"), std::move(focusedValidator));
auto soloValidator = make_movable<BoolValidator>();
signature.AddParameter(wxT("Solo"), wxT("True"), std::move(soloValidator));
auto muteValidator = make_movable<BoolValidator>();
signature.AddParameter(wxT("Mute"), wxT("True"), std::move(muteValidator));
S.AddSpace(0, 5);
S.StartMultiColumn(2, wxALIGN_CENTER);
{
S.TieNumericTextBox( _("Track Index"), mTrackIndex );
S.Optional( bHasTrackName ).TieTextBox( _("Name"), mTrackName );
S.Optional( bHasPan ).TieSlider( _("Pan"), mPan, 1.0, -1.0);
S.Optional( bHasGain ).TieSlider( _("Gain"), mGain, 10.0, 0.0);
S.Optional( bHasSelected ).TieCheckBox( _("Selected"), bSelected );
S.Optional( bHasFocused ).TieCheckBox( _("Focused"), bFocused);
S.Optional( bHasSolo ).TieCheckBox( _("Solo"), bSolo);
S.Optional( bHasMute ).TieCheckBox( _("Mute"), bMute);
}
S.EndMultiColumn();
}
CommandHolder SetTrackInfoCommandType::Create(std::unique_ptr<CommandOutputTarget> &&target)
{
return std::make_shared<SetTrackInfoCommand>(*this, std::move(target));
}
bool SetTrackInfoCommand::Apply(CommandExecutionContext context)
bool SetTrackInfoCommand::Apply(const CommandContext & context)
{
//wxString mode = GetString(wxT("Type"));
long trackIndex = 0;
if( HasParam("TrackIndex") )
trackIndex = GetLong(wxT("TrackIndex"));
// (Note: track selection ought to be somewhere else)
long i = 0;
TrackListIterator iter(context.GetProject()->GetTracks());
Track *t = iter.First();
while (t && i != trackIndex)
while (t && i != mTrackIndex)
{
t = iter.Next();
++i;
}
if (i != trackIndex || !t)
if (i != mTrackIndex || !t)
{
Error(wxT("TrackIndex was invalid."));
context.Error(wxT("TrackIndex was invalid."));
return false;
}
auto wt = dynamic_cast<WaveTrack *>(t);
auto pt = dynamic_cast<PlayableTrack *>(t);
if( HasParam( "Name" ) )
t->SetName(GetString(wxT("Name")));
if( wt && HasParam( "Pan" ) )
wt->SetPan(GetDouble(wxT("Pan")));
if( wt && HasParam( "Gain" ) )
wt->SetGain(GetDouble(wxT("Gain")));
if( HasParam( "Selected" ) )
t->SetSelected(GetBool(wxT("Selected")));
if(HasParam("Focused"))
if( bHasTrackName )
t->SetName(mTrackName);
if( wt && bHasPan )
wt->SetPan(mPan);
if( wt && bHasGain )
wt->SetGain(mGain);
if( bHasSelected )
t->SetSelected(bSelected);
if( bHasFocused )
{
TrackPanel *panel = context.GetProject()->GetTrackPanel();
panel->SetFocusedTrack( t );
}
if( pt && HasParam( "Solo" ) )
pt->SetSolo(GetBool(wxT("Solo")));
if( pt && HasParam( "Mute" ) )
pt->SetMute(GetBool(wxT("Mute")));
if( pt && bHasSolo )
pt->SetSolo(bSolo);
if( pt && bHasMute )
pt->SetMute(bMute);
return true;
}

View File

@ -5,6 +5,7 @@
License: wxwidgets
Dan Horgan
James Crook
******************************************************************//**
@ -19,24 +20,42 @@
#include "Command.h"
#include "CommandType.h"
class SetTrackInfoCommandType final : public CommandType
#define SET_TRACK_INFO_PLUGIN_SYMBOL XO("Set Track Info")
class SetTrackInfoCommand : public AudacityCommand
{
public:
wxString BuildName() override;
void BuildSignature(CommandSignature &signature) override;
CommandHolder Create(std::unique_ptr<CommandOutputTarget> &&target) override;
};
SetTrackInfoCommand();
// CommandDefinitionInterface overrides
wxString GetSymbol() override {return SET_TRACK_INFO_PLUGIN_SYMBOL;};
wxString GetDescription() override {return _("Sets various values for a track.");};
bool DefineParams( ShuttleParams & S ) override;
void PopulateOrExchange(ShuttleGui & S) override;
// AudacityCommand overrides
wxString ManualPage() override {return wxT("Extra_Menu:_Tools#set_track_info");};
bool Apply(const CommandContext & context) override;
class SetTrackInfoCommand final : public CommandImplementation
{
public:
SetTrackInfoCommand(CommandType &type, std::unique_ptr<CommandOutputTarget> &&target)
: CommandImplementation(type, std::move(target))
{ }
virtual ~SetTrackInfoCommand()
{ }
int mTrackIndex;
wxString mTrackName;
double mPan;
double mGain;
bool bSelected;
bool bFocused;
bool bSolo;
bool bMute;
bool Apply(CommandExecutionContext context) override;
// For tracking optional parameters.
bool bHasTrackName;
bool bHasPan;
bool bHasGain;
bool bHasSelected;
bool bHasFocused;
bool bHasSolo;
bool bHasMute;
};
#endif /* End of include guard: __SETTRACKINFOCOMMAND__ */

View File

@ -95,7 +95,7 @@ wxString EffectAmplify::ManualPage()
return wxT("Amplify");
}
// EffectIdentInterface implementation
// EffectDefinitionInterface implementation
EffectType EffectAmplify::GetType()
{
@ -123,15 +123,19 @@ size_t EffectAmplify::ProcessBlock(float **inBlock, float **outBlock, size_t blo
return blockLen;
}
bool EffectAmplify::DefineParams( ShuttleParams & S ){
S.SHUTTLE_PARAM( mRatio, Ratio );
return true;
}
bool EffectAmplify::GetAutomationParameters(EffectAutomationParameters & parms)
bool EffectAmplify::GetAutomationParameters(CommandAutomationParameters & parms)
{
parms.WriteFloat(KEY_Ratio, mRatio);
return true;
}
bool EffectAmplify::SetAutomationParameters(EffectAutomationParameters & parms)
bool EffectAmplify::SetAutomationParameters(CommandAutomationParameters & parms)
{
ReadAndVerifyFloat(Ratio);

View File

@ -39,7 +39,7 @@ public:
wxString GetDescription() override;
wxString ManualPage() override;
// EffectIdentInterface implementation
// EffectDefinitionInterface implementation
EffectType GetType() override;
@ -48,8 +48,9 @@ public:
unsigned GetAudioInCount() override;
unsigned GetAudioOutCount() override;
size_t ProcessBlock(float **inBlock, float **outBlock, size_t blockLen) override;
bool GetAutomationParameters(EffectAutomationParameters & parms) override;
bool SetAutomationParameters(EffectAutomationParameters & parms) override;
bool DefineParams( ShuttleParams & S ) override;
bool GetAutomationParameters(CommandAutomationParameters & parms) override;
bool SetAutomationParameters(CommandAutomationParameters & parms) override;
bool LoadFactoryDefaults() override;
// Effect implementation

View File

@ -117,7 +117,7 @@ wxString EffectAutoDuck::ManualPage()
return wxT("Auto_Duck");
}
// EffectIdentInterface implementation
// EffectDefinitionInterface implementation
EffectType EffectAutoDuck::GetType()
{
@ -125,8 +125,18 @@ EffectType EffectAutoDuck::GetType()
}
// EffectClientInterface implementation
bool EffectAutoDuck::DefineParams( ShuttleParams & S ){
S.SHUTTLE_PARAM( mDuckAmountDb, DuckAmountDb);
S.SHUTTLE_PARAM( mInnerFadeDownLen, InnerFadeDownLen);
S.SHUTTLE_PARAM( mInnerFadeUpLen, InnerFadeUpLen);
S.SHUTTLE_PARAM( mOuterFadeDownLen, OuterFadeDownLen);
S.SHUTTLE_PARAM( mOuterFadeUpLen, OuterFadeUpLen);
S.SHUTTLE_PARAM( mThresholdDb, ThresholdDb);
S.SHUTTLE_PARAM( mMaximumPause, MaximumPause);
return true;
}
bool EffectAutoDuck::GetAutomationParameters(EffectAutomationParameters & parms)
bool EffectAutoDuck::GetAutomationParameters(CommandAutomationParameters & parms)
{
parms.Write(KEY_DuckAmountDb, mDuckAmountDb);
parms.Write(KEY_InnerFadeDownLen, mInnerFadeDownLen);
@ -139,7 +149,7 @@ bool EffectAutoDuck::GetAutomationParameters(EffectAutomationParameters & parms)
return true;
}
bool EffectAutoDuck::SetAutomationParameters(EffectAutomationParameters & parms)
bool EffectAutoDuck::SetAutomationParameters(CommandAutomationParameters & parms)
{
ReadAndVerifyDouble(DuckAmountDb);
ReadAndVerifyDouble(InnerFadeDownLen);

View File

@ -40,14 +40,15 @@ public:
wxString GetDescription() override;
wxString ManualPage() override;
// EffectIdentInterface implementation
// EffectDefinitionInterface implementation
EffectType GetType() override;
// EffectClientInterface implementation
bool GetAutomationParameters(EffectAutomationParameters & parms) override;
bool SetAutomationParameters(EffectAutomationParameters & parms) override;
bool DefineParams( ShuttleParams & S ) override;
bool GetAutomationParameters(CommandAutomationParameters & parms) override;
bool SetAutomationParameters(CommandAutomationParameters & parms) override;
// Effect implementation

View File

@ -94,7 +94,7 @@ wxString EffectBassTreble::ManualPage()
return wxT("Bass_and_Treble");
}
// EffectIdentInterface implementation
// EffectDefinitionInterface implementation
EffectType EffectBassTreble::GetType()
{
@ -169,8 +169,15 @@ size_t EffectBassTreble::RealtimeProcess(int group,
{
return InstanceProcess(mSlaves[group], inbuf, outbuf, numSamples);
}
bool EffectBassTreble::DefineParams( ShuttleParams & S ){
S.SHUTTLE_PARAM( mBass, Bass );
S.SHUTTLE_PARAM( mTreble, Treble );
S.SHUTTLE_PARAM( mGain, Gain );
S.SHUTTLE_PARAM( mLink, Link );
return true;
}
bool EffectBassTreble::GetAutomationParameters(EffectAutomationParameters & parms)
bool EffectBassTreble::GetAutomationParameters(CommandAutomationParameters & parms)
{
parms.Write(KEY_Bass, mBass);
parms.Write(KEY_Treble, mTreble);
@ -180,7 +187,7 @@ bool EffectBassTreble::GetAutomationParameters(EffectAutomationParameters & parm
return true;
}
bool EffectBassTreble::SetAutomationParameters(EffectAutomationParameters & parms)
bool EffectBassTreble::SetAutomationParameters(CommandAutomationParameters & parms)
{
ReadAndVerifyDouble(Bass);
ReadAndVerifyDouble(Treble);

Some files were not shown because too many files have changed in this diff Show More