mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-16 16:10:06 +02:00
Miscellaneous changes
This commit is contained in:
commit
172c8abe03
@ -84,7 +84,7 @@ public:
|
||||
// This function returns nonempty only when that is the case, and lists
|
||||
// the possible extensions of such files (an empty string in a nonempty
|
||||
// array means any file is a candidate).
|
||||
virtual FileExtensions GetFileExtensions() = 0;
|
||||
virtual const FileExtensions &GetFileExtensions() = 0;
|
||||
|
||||
// Returns empty, or else, where to copy a plug-in file or bundle.
|
||||
// Drag-and-drop is supported only if GetFileExtensions() returns nonempty and
|
||||
|
@ -46,9 +46,27 @@
|
||||
#include <type_traits>
|
||||
#include <vector>
|
||||
#include <wx/debug.h> // for wxASSERT
|
||||
#include <wx/string.h> // type used in inline function
|
||||
#include <wx/version.h> // for wxCHECK_VERSION
|
||||
|
||||
class wxString;
|
||||
|
||||
#if !wxCHECK_VERSION(3, 1, 0)
|
||||
// For using std::unordered_map on wxString
|
||||
namespace std
|
||||
{
|
||||
template<typename T> struct hash;
|
||||
template<> struct hash< wxString > {
|
||||
size_t operator () (const wxString &str) const // noexcept
|
||||
{
|
||||
auto stdstr = str.ToStdWstring(); // no allocations, a cheap fetch
|
||||
using Hasher = hash< decltype(stdstr) >;
|
||||
return Hasher{}( stdstr );
|
||||
}
|
||||
};
|
||||
}
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// TODO: I'd imagine this header may be replaced by other public headers. But,
|
||||
// to try and minimize more changes to the base code, we can use this
|
||||
|
@ -1829,9 +1829,8 @@ bool AudacityApp::InitTempDir()
|
||||
}
|
||||
|
||||
// Only want one page of the preferences
|
||||
DirectoriesPrefsFactory directoriesPrefsFactory;
|
||||
PrefsDialog::Factories factories;
|
||||
factories.push_back(&directoriesPrefsFactory);
|
||||
factories.push_back(DirectoriesPrefsFactory());
|
||||
GlobalPrefsDialog dialog(NULL, factories);
|
||||
dialog.ShowModal();
|
||||
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include <wx/mstream.h> // member variables
|
||||
|
||||
#include <unordered_map>
|
||||
#include "audacity/Types.h"
|
||||
|
||||
class wxFFile;
|
||||
class AudacityProject;
|
||||
|
@ -142,7 +142,6 @@ HistoryWindow::HistoryWindow(AudacityProject *parent, UndoManager *manager):
|
||||
S.EndVerticalLay();
|
||||
// ----------------------- End of main section --------------
|
||||
|
||||
DoUpdate();
|
||||
mList->SetMinSize(mList->GetSize());
|
||||
Fit();
|
||||
SetMinSize(GetSize());
|
||||
@ -182,6 +181,13 @@ void HistoryWindow::UpdateDisplay(wxEvent& e)
|
||||
DoUpdate();
|
||||
}
|
||||
|
||||
bool HistoryWindow::Show( bool show )
|
||||
{
|
||||
if ( show && !IsShown())
|
||||
DoUpdate();
|
||||
return wxDialogWrapper::Show();
|
||||
}
|
||||
|
||||
void HistoryWindow::DoUpdate()
|
||||
{
|
||||
int i;
|
||||
|
@ -29,6 +29,8 @@ class HistoryWindow final : public wxDialogWrapper {
|
||||
|
||||
void UpdateDisplay(wxEvent &e);
|
||||
|
||||
bool Show( bool show = true ) override;
|
||||
|
||||
private:
|
||||
void OnAudioIO(wxCommandEvent & evt);
|
||||
void DoUpdate();
|
||||
|
@ -33,6 +33,8 @@
|
||||
#include "Audacity.h"
|
||||
#include "Languages.h"
|
||||
|
||||
#include "audacity/Types.h"
|
||||
|
||||
#include <wx/defs.h>
|
||||
#include <wx/intl.h>
|
||||
#include <wx/textfile.h>
|
||||
|
@ -637,22 +637,6 @@ make_iterator_range( const Container &container )
|
||||
return { container.begin(), container.end() };
|
||||
}
|
||||
|
||||
#if !wxCHECK_VERSION(3, 1, 0)
|
||||
// For using std::unordered_map on wxString
|
||||
namespace std
|
||||
{
|
||||
template<typename T> struct hash;
|
||||
template<> struct hash< wxString > {
|
||||
size_t operator () (const wxString &str) const // noexcept
|
||||
{
|
||||
auto stdstr = str.ToStdWstring(); // no allocations, a cheap fetch
|
||||
using Hasher = hash< decltype(stdstr) >;
|
||||
return Hasher{}( stdstr );
|
||||
}
|
||||
};
|
||||
}
|
||||
#endif
|
||||
|
||||
// A utility function building a container of results
|
||||
template< typename Container, typename Iterator, typename Function >
|
||||
Container transform_range( Iterator first, Iterator last, Function &&fn )
|
||||
|
@ -509,8 +509,7 @@ void ModuleManager::FindAllPlugins(PluginIDs & providers, PluginPaths & paths)
|
||||
{
|
||||
PluginID providerID = modIDs[i];
|
||||
|
||||
ModuleInterface *module =
|
||||
static_cast<ModuleInterface *>(CreateProviderInstance(providerID, modPaths[i]));
|
||||
auto module = CreateProviderInstance(providerID, modPaths[i]);
|
||||
|
||||
if (!module)
|
||||
continue;
|
||||
@ -553,7 +552,7 @@ bool ModuleManager::RegisterEffectPlugin(const PluginID & providerID, const Plug
|
||||
return nFound > 0;
|
||||
}
|
||||
|
||||
ComponentInterface *ModuleManager::CreateProviderInstance(const PluginID & providerID,
|
||||
ModuleInterface *ModuleManager::CreateProviderInstance(const PluginID & providerID,
|
||||
const PluginPath & path)
|
||||
{
|
||||
if (path.empty() && mDynModules.find(providerID) != mDynModules.end())
|
||||
|
@ -102,7 +102,7 @@ public:
|
||||
bool RegisterEffectPlugin(const PluginID & provider, const PluginPath & path,
|
||||
wxString &errMsg);
|
||||
|
||||
ComponentInterface *CreateProviderInstance(const PluginID & provider, const PluginPath & path);
|
||||
ModuleInterface *CreateProviderInstance(const PluginID & provider, const PluginPath & path);
|
||||
ComponentInterface *CreateInstance(const PluginID & provider, const PluginPath & path);
|
||||
void DeleteInstance(const PluginID & provider, ComponentInterface *instance);
|
||||
|
||||
|
@ -1787,7 +1787,7 @@ bool PluginManager::DropFile(const wxString &fileName)
|
||||
continue;
|
||||
|
||||
const auto &ff = module->InstallPath();
|
||||
auto extensions = module->GetFileExtensions();
|
||||
const auto &extensions = module->GetFileExtensions();
|
||||
if ( !ff.empty() &&
|
||||
extensions.Index(src.GetExt(), false) != wxNOT_FOUND ) {
|
||||
wxString errMsg;
|
||||
|
@ -2392,170 +2392,3 @@ void ShuttleGuiBase::SetSizeHints( const wxArrayStringEx & items )
|
||||
|
||||
SetSizeHints( mpLastWind, items );
|
||||
}
|
||||
|
||||
/********************************* GetDefinition ******************************/
|
||||
|
||||
ShuttleGuiGetDefinition::ShuttleGuiGetDefinition(
|
||||
wxWindow * pParent,CommandMessageTarget & target )
|
||||
: ShuttleGui( pParent, eIsGettingMetadata ),
|
||||
CommandMessageTargetDecorator( target )
|
||||
{
|
||||
|
||||
}
|
||||
ShuttleGuiGetDefinition::~ShuttleGuiGetDefinition(void)
|
||||
{
|
||||
}
|
||||
|
||||
wxCheckBox * ShuttleGuiGetDefinition::TieCheckBox(
|
||||
const wxString &Prompt,
|
||||
const wxString &SettingName,
|
||||
const bool bDefault)
|
||||
{
|
||||
StartStruct();
|
||||
AddItem( SettingName, "id" );
|
||||
AddItem( Prompt, "prompt" );
|
||||
AddItem( "bool", "type" );
|
||||
AddBool( bDefault, "default" );
|
||||
EndStruct();
|
||||
return ShuttleGui::TieCheckBox( Prompt, SettingName, bDefault );
|
||||
}
|
||||
wxCheckBox * ShuttleGuiGetDefinition::TieCheckBoxOnRight(
|
||||
const wxString &Prompt,
|
||||
const wxString &SettingName,
|
||||
const bool bDefault)
|
||||
{
|
||||
StartStruct();
|
||||
AddItem( SettingName, "id" );
|
||||
AddItem( Prompt, "prompt" );
|
||||
AddItem( "bool", "type" );
|
||||
AddBool( bDefault, "default" );
|
||||
EndStruct();
|
||||
return ShuttleGui::TieCheckBoxOnRight( Prompt, SettingName, bDefault );
|
||||
}
|
||||
wxChoice * ShuttleGuiGetDefinition::TieChoice(
|
||||
const wxString &Prompt,
|
||||
const wxString &SettingName,
|
||||
const wxString &Default,
|
||||
const wxArrayStringEx &Choices,
|
||||
const wxArrayStringEx & InternalChoices )
|
||||
{
|
||||
StartStruct();
|
||||
AddItem( SettingName, "id" );
|
||||
AddItem( Prompt, "prompt" );
|
||||
AddItem( "enum", "type" );
|
||||
AddItem( Default, "default" );
|
||||
StartField( "enum" );
|
||||
StartArray();
|
||||
for( size_t i=0;i<Choices.size(); i++ )
|
||||
AddItem( InternalChoices[i] );
|
||||
EndArray();
|
||||
EndField();
|
||||
EndStruct();
|
||||
return ShuttleGui::TieChoice( Prompt, SettingName, Default, Choices, InternalChoices );
|
||||
}
|
||||
wxChoice * ShuttleGuiGetDefinition::TieChoice(
|
||||
const wxString &Prompt,
|
||||
const wxString &SettingName,
|
||||
const int Default,
|
||||
const wxArrayStringEx & Choices,
|
||||
const std::vector<int> & InternalChoices)
|
||||
{
|
||||
// Should no longer come here!
|
||||
// Choice controls in Preferences that really are exhaustive choices among
|
||||
// non-numerical options must now encode the internal choices as strings,
|
||||
// not numbers.
|
||||
wxASSERT(false);
|
||||
|
||||
// But if we do get here anyway, proceed sub-optimally as before.
|
||||
StartStruct();
|
||||
AddItem( SettingName, "id" );
|
||||
AddItem( Prompt, "prompt" );
|
||||
AddItem( "enum", "type" );
|
||||
AddItem( Default, "default" );
|
||||
StartField( "enum" );
|
||||
StartArray();
|
||||
for( size_t i=0;i<Choices.size(); i++ )
|
||||
AddItem( Choices[i] );
|
||||
EndArray();
|
||||
EndField();
|
||||
EndStruct();
|
||||
return ShuttleGui::TieChoice( Prompt, SettingName, Default, Choices, InternalChoices );
|
||||
}
|
||||
wxChoice * ShuttleGuiGetDefinition::TieNumberAsChoice(
|
||||
const wxString &Prompt,
|
||||
const wxString &SettingName,
|
||||
const int Default,
|
||||
const wxArrayStringEx & Choices,
|
||||
const std::vector<int> & InternalChoices)
|
||||
{
|
||||
// Come here for controls that present non-exhaustive choices among some
|
||||
// numbers, with an associated control that allows arbitrary entry of an
|
||||
// "Other..."
|
||||
StartStruct();
|
||||
AddItem( SettingName, "id" );
|
||||
AddItem( Prompt, "prompt" );
|
||||
AddItem( "number", "type" ); // not "enum" !
|
||||
AddItem( Default, "default" );
|
||||
EndStruct();
|
||||
return ShuttleGui::TieNumberAsChoice(
|
||||
Prompt, SettingName, Default, Choices, InternalChoices );
|
||||
}
|
||||
wxTextCtrl * ShuttleGuiGetDefinition::TieTextBox(
|
||||
const wxString &Prompt,
|
||||
const wxString &SettingName,
|
||||
const wxString &Default,
|
||||
const int nChars)
|
||||
{
|
||||
StartStruct();
|
||||
AddItem( SettingName, "id" );
|
||||
AddItem( Prompt, "prompt" );
|
||||
AddItem( "string", "type" );
|
||||
AddItem( Default, "default" );
|
||||
EndStruct();
|
||||
return ShuttleGui::TieTextBox( Prompt, SettingName, Default, nChars );
|
||||
}
|
||||
wxTextCtrl * ShuttleGuiGetDefinition::TieNumericTextBox(
|
||||
const wxString & Prompt,
|
||||
const wxString & SettingName,
|
||||
const double & Default,
|
||||
const int nChars)
|
||||
{
|
||||
StartStruct();
|
||||
AddItem( SettingName, "id" );
|
||||
AddItem( Prompt, "prompt" );
|
||||
AddItem( "number", "type" );
|
||||
AddItem( Default, "default" );
|
||||
EndStruct();
|
||||
return ShuttleGui::TieNumericTextBox( Prompt, SettingName, Default, nChars );
|
||||
}
|
||||
wxSlider * ShuttleGuiGetDefinition::TieSlider(
|
||||
const wxString & Prompt,
|
||||
const wxString & SettingName,
|
||||
const int iDefault,
|
||||
const int max,
|
||||
const int min)
|
||||
{
|
||||
StartStruct();
|
||||
AddItem( SettingName, "id" );
|
||||
AddItem( Prompt, "prompt" );
|
||||
AddItem( "number", "type" );
|
||||
AddItem( iDefault, "default" );
|
||||
EndStruct();
|
||||
return ShuttleGui::TieSlider( Prompt, SettingName, iDefault, max, min );
|
||||
}
|
||||
wxSpinCtrl * ShuttleGuiGetDefinition::TieSpinCtrl(
|
||||
const wxString &Prompt,
|
||||
const wxString &SettingName,
|
||||
const int Value,
|
||||
const int max,
|
||||
const int min)
|
||||
{
|
||||
StartStruct();
|
||||
AddItem( SettingName, "id" );
|
||||
AddItem( Prompt, "prompt" );
|
||||
AddItem( "number", "type" );
|
||||
AddItem( Value, "default" );
|
||||
EndStruct();
|
||||
return ShuttleGui::TieSpinCtrl( Prompt, SettingName, Value, max, min );
|
||||
}
|
||||
|
||||
|
@ -22,9 +22,6 @@
|
||||
|
||||
#include "WrappedType.h"
|
||||
|
||||
// For ShuttleGuiGetDefinitions.
|
||||
#include "commands/CommandTargets.h"
|
||||
|
||||
class ChoiceSetting;
|
||||
|
||||
class wxArrayStringEx;
|
||||
@ -443,68 +440,4 @@ public:
|
||||
teShuttleMode GetMode() { return mShuttleMode; };
|
||||
};
|
||||
|
||||
|
||||
/**************************************************************************//**
|
||||
\brief Shuttle that retrieves a JSON format definition of a command's parameters.
|
||||
********************************************************************************/
|
||||
class ShuttleGuiGetDefinition : public ShuttleGui, public CommandMessageTargetDecorator
|
||||
{
|
||||
public:
|
||||
ShuttleGuiGetDefinition(wxWindow * pParent,CommandMessageTarget & target );
|
||||
virtual ~ShuttleGuiGetDefinition();
|
||||
|
||||
wxCheckBox * TieCheckBox(
|
||||
const wxString &Prompt,
|
||||
const wxString &SettingName,
|
||||
const bool bDefault) override;
|
||||
wxCheckBox * TieCheckBoxOnRight(
|
||||
const wxString &Prompt,
|
||||
const wxString &SettingName,
|
||||
const bool bDefault) override;
|
||||
wxChoice * TieChoice(
|
||||
const wxString &Prompt,
|
||||
const wxString &SettingName,
|
||||
const wxString &Default,
|
||||
const wxArrayStringEx &Choices,
|
||||
const wxArrayStringEx & InternalChoices ) override;
|
||||
|
||||
// An assertion will be violated if this override is reached!
|
||||
wxChoice * TieChoice(
|
||||
const wxString &Prompt,
|
||||
const wxString &SettingName,
|
||||
const int Default,
|
||||
const wxArrayStringEx & Choices,
|
||||
const std::vector<int> & InternalChoices) override;
|
||||
|
||||
wxChoice * TieNumberAsChoice(
|
||||
const wxString &Prompt,
|
||||
const wxString &SettingName,
|
||||
const int Default,
|
||||
const wxArrayStringEx & Choices,
|
||||
const std::vector<int> & InternalChoices) override;
|
||||
|
||||
wxTextCtrl * TieTextBox(
|
||||
const wxString &Prompt,
|
||||
const wxString &SettingName,
|
||||
const wxString &Default,
|
||||
const int nChars) override;
|
||||
wxTextCtrl * TieNumericTextBox(
|
||||
const wxString & Prompt,
|
||||
const wxString & SettingName,
|
||||
const double & Default,
|
||||
const int nChars) override;
|
||||
wxSlider * TieSlider(
|
||||
const wxString & Prompt,
|
||||
const wxString & SettingName,
|
||||
const int iDefault,
|
||||
const int max,
|
||||
const int min = 0) override;
|
||||
wxSpinCtrl * TieSpinCtrl(
|
||||
const wxString &Prompt,
|
||||
const wxString &SettingName,
|
||||
const int Value,
|
||||
const int max,
|
||||
const int min) override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -39,6 +39,7 @@
|
||||
#include "widgets/wxPanelWrapper.h" // to inherit
|
||||
|
||||
#include <unordered_map>
|
||||
#include "audacity/Types.h"
|
||||
|
||||
class wxArrayString;
|
||||
class wxComboBox;
|
||||
|
@ -78,18 +78,18 @@ UndoManager::~UndoManager()
|
||||
|
||||
namespace {
|
||||
SpaceArray::value_type
|
||||
CalculateUsage(TrackList *tracks, Set *seen)
|
||||
CalculateUsage(const TrackList &tracks, Set *seen)
|
||||
{
|
||||
SpaceArray::value_type result = 0;
|
||||
|
||||
//TIMER_START( "CalculateSpaceUsage", space_calc );
|
||||
for (auto wt : tracks->Any< WaveTrack >())
|
||||
for (auto wt : tracks.Any< const WaveTrack >())
|
||||
{
|
||||
// Scan all clips within current track
|
||||
for(const auto &clip : wt->GetAllClips())
|
||||
{
|
||||
// Scan all blockfiles within current clip
|
||||
BlockArray *blocks = clip->GetSequenceBlockArray();
|
||||
auto blocks = clip->GetSequenceBlockArray();
|
||||
for (const auto &block : *blocks)
|
||||
{
|
||||
const auto &file = block.f;
|
||||
@ -137,12 +137,12 @@ void UndoManager::CalculateSpaceUsage()
|
||||
for (size_t nn = stack.size(); nn--;)
|
||||
{
|
||||
// Scan all tracks at current level
|
||||
auto tracks = stack[nn]->state.tracks.get();
|
||||
auto &tracks = *stack[nn]->state.tracks;
|
||||
space[nn] = CalculateUsage(tracks, &seen);
|
||||
}
|
||||
|
||||
mClipboardSpaceUsage = CalculateUsage
|
||||
(AudacityProject::GetClipboardTracks(), nullptr);
|
||||
mClipboardSpaceUsage = CalculateUsage(
|
||||
*AudacityProject::GetClipboardTracks(), nullptr);
|
||||
|
||||
//TIMER_STOP( space_calc );
|
||||
}
|
||||
|
@ -416,6 +416,11 @@ BlockArray* WaveClip::GetSequenceBlockArray()
|
||||
return &mSequence->GetBlockArray();
|
||||
}
|
||||
|
||||
const BlockArray* WaveClip::GetSequenceBlockArray() const
|
||||
{
|
||||
return &mSequence->GetBlockArray();
|
||||
}
|
||||
|
||||
double WaveClip::GetStartTime() const
|
||||
{
|
||||
// JS: mOffset is the minimum value and it is returned; no clipping to 0
|
||||
|
@ -238,6 +238,7 @@ public:
|
||||
Envelope* GetEnvelope() { return mEnvelope.get(); }
|
||||
const Envelope* GetEnvelope() const { return mEnvelope.get(); }
|
||||
BlockArray* GetSequenceBlockArray();
|
||||
const BlockArray* GetSequenceBlockArray() const;
|
||||
|
||||
// Get low-level access to the sequence. Whenever possible, don't use this,
|
||||
// but use more high-level functions inside WaveClip (or add them if you
|
||||
|
@ -374,7 +374,7 @@ private:
|
||||
const WaveClipConstHolders &GetClips() const
|
||||
{ return reinterpret_cast< const WaveClipConstHolders& >( mClips ); }
|
||||
|
||||
// Get access to all clips (in some unspecified sequence),
|
||||
// Get mutative access to all clips (in some unspecified sequence),
|
||||
// including those hidden in cutlines.
|
||||
class AllClipsIterator
|
||||
: public ValueIterator< WaveClip * >
|
||||
@ -400,12 +400,12 @@ private:
|
||||
AllClipsIterator &operator ++ ();
|
||||
|
||||
// Define == well enough to serve for loop termination test
|
||||
friend bool operator ==
|
||||
(const AllClipsIterator &a, const AllClipsIterator &b)
|
||||
friend bool operator == (
|
||||
const AllClipsIterator &a, const AllClipsIterator &b)
|
||||
{ return a.mStack.empty() == b.mStack.empty(); }
|
||||
|
||||
friend bool operator !=
|
||||
(const AllClipsIterator &a, const AllClipsIterator &b)
|
||||
friend bool operator != (
|
||||
const AllClipsIterator &a, const AllClipsIterator &b)
|
||||
{ return !( a == b ); }
|
||||
|
||||
private:
|
||||
@ -419,11 +419,49 @@ private:
|
||||
Stack mStack;
|
||||
};
|
||||
|
||||
// Get const access to all clips (in some unspecified sequence),
|
||||
// including those hidden in cutlines.
|
||||
class AllClipsConstIterator
|
||||
: public ValueIterator< const WaveClip * >
|
||||
{
|
||||
public:
|
||||
// Constructs an "end" iterator
|
||||
AllClipsConstIterator () {}
|
||||
|
||||
// Construct a "begin" iterator
|
||||
explicit AllClipsConstIterator( const WaveTrack &track )
|
||||
: mIter{ const_cast< WaveTrack& >( track ) }
|
||||
{}
|
||||
|
||||
const WaveClip *operator * () const
|
||||
{ return *mIter; }
|
||||
|
||||
AllClipsConstIterator &operator ++ ()
|
||||
{ ++mIter; return *this; }
|
||||
|
||||
// Define == well enough to serve for loop termination test
|
||||
friend bool operator == (
|
||||
const AllClipsConstIterator &a, const AllClipsConstIterator &b)
|
||||
{ return a.mIter == b.mIter; }
|
||||
|
||||
friend bool operator != (
|
||||
const AllClipsConstIterator &a, const AllClipsConstIterator &b)
|
||||
{ return !( a == b ); }
|
||||
|
||||
private:
|
||||
AllClipsIterator mIter;
|
||||
};
|
||||
|
||||
IteratorRange< AllClipsIterator > GetAllClips()
|
||||
{
|
||||
return { AllClipsIterator{ *this }, AllClipsIterator{ } };
|
||||
}
|
||||
|
||||
IteratorRange< AllClipsConstIterator > GetAllClips() const
|
||||
{
|
||||
return { AllClipsConstIterator{ *this }, AllClipsConstIterator{ } };
|
||||
}
|
||||
|
||||
// Create NEW clip and add it to this track. Returns a pointer
|
||||
// to the newly created clip.
|
||||
WaveClip* CreateClip();
|
||||
|
@ -1555,9 +1555,8 @@ bool CommandManager::HandleMenuID(int id, CommandFlag flags, CommandMask mask)
|
||||
#ifdef EXPERIMENTAL_EASY_CHANGE_KEY_BINDINGS
|
||||
if (::wxGetMouseState().ShiftDown()) {
|
||||
// Only want one page of the preferences
|
||||
KeyConfigPrefsFactory keyConfigPrefsFactory{ entry->name };
|
||||
PrefsDialog::Factories factories;
|
||||
factories.push_back(&keyConfigPrefsFactory);
|
||||
factories.push_back(KeyConfigPrefsFactory( entry->name ));
|
||||
GlobalPrefsDialog dialog(GetActiveProject(), factories);
|
||||
dialog.ShowModal();
|
||||
MenuCreator::RebuildAllMenuBars();
|
||||
|
@ -185,6 +185,237 @@ bool GetInfoCommand::SendMenus(const CommandContext &context)
|
||||
return true;
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
/**************************************************************************//**
|
||||
\brief Shuttle that retrieves a JSON format definition of a command's parameters.
|
||||
********************************************************************************/
|
||||
class ShuttleGuiGetDefinition : public ShuttleGui, public CommandMessageTargetDecorator
|
||||
{
|
||||
public:
|
||||
ShuttleGuiGetDefinition(wxWindow * pParent,CommandMessageTarget & target );
|
||||
virtual ~ShuttleGuiGetDefinition();
|
||||
|
||||
wxCheckBox * TieCheckBox(
|
||||
const wxString &Prompt,
|
||||
const wxString &SettingName,
|
||||
const bool bDefault) override;
|
||||
wxCheckBox * TieCheckBoxOnRight(
|
||||
const wxString &Prompt,
|
||||
const wxString &SettingName,
|
||||
const bool bDefault) override;
|
||||
wxChoice * TieChoice(
|
||||
const wxString &Prompt,
|
||||
const wxString &SettingName,
|
||||
const wxString &Default,
|
||||
const wxArrayStringEx &Choices,
|
||||
const wxArrayStringEx & InternalChoices ) override;
|
||||
|
||||
// An assertion will be violated if this override is reached!
|
||||
wxChoice * TieChoice(
|
||||
const wxString &Prompt,
|
||||
const wxString &SettingName,
|
||||
const int Default,
|
||||
const wxArrayStringEx & Choices,
|
||||
const std::vector<int> & InternalChoices) override;
|
||||
|
||||
wxChoice * TieNumberAsChoice(
|
||||
const wxString &Prompt,
|
||||
const wxString &SettingName,
|
||||
const int Default,
|
||||
const wxArrayStringEx & Choices,
|
||||
const std::vector<int> & InternalChoices) override;
|
||||
|
||||
wxTextCtrl * TieTextBox(
|
||||
const wxString &Prompt,
|
||||
const wxString &SettingName,
|
||||
const wxString &Default,
|
||||
const int nChars) override;
|
||||
wxTextCtrl * TieNumericTextBox(
|
||||
const wxString & Prompt,
|
||||
const wxString & SettingName,
|
||||
const double & Default,
|
||||
const int nChars) override;
|
||||
wxSlider * TieSlider(
|
||||
const wxString & Prompt,
|
||||
const wxString & SettingName,
|
||||
const int iDefault,
|
||||
const int max,
|
||||
const int min = 0) override;
|
||||
wxSpinCtrl * TieSpinCtrl(
|
||||
const wxString &Prompt,
|
||||
const wxString &SettingName,
|
||||
const int Value,
|
||||
const int max,
|
||||
const int min) override;
|
||||
};
|
||||
|
||||
ShuttleGuiGetDefinition::ShuttleGuiGetDefinition(
|
||||
wxWindow * pParent,CommandMessageTarget & target )
|
||||
: ShuttleGui( pParent, eIsGettingMetadata ),
|
||||
CommandMessageTargetDecorator( target )
|
||||
{
|
||||
|
||||
}
|
||||
ShuttleGuiGetDefinition::~ShuttleGuiGetDefinition(void)
|
||||
{
|
||||
}
|
||||
|
||||
wxCheckBox * ShuttleGuiGetDefinition::TieCheckBox(
|
||||
const wxString &Prompt,
|
||||
const wxString &SettingName,
|
||||
const bool bDefault)
|
||||
{
|
||||
StartStruct();
|
||||
AddItem( SettingName, "id" );
|
||||
AddItem( Prompt, "prompt" );
|
||||
AddItem( "bool", "type" );
|
||||
AddBool( bDefault, "default" );
|
||||
EndStruct();
|
||||
return ShuttleGui::TieCheckBox( Prompt, SettingName, bDefault );
|
||||
}
|
||||
wxCheckBox * ShuttleGuiGetDefinition::TieCheckBoxOnRight(
|
||||
const wxString &Prompt,
|
||||
const wxString &SettingName,
|
||||
const bool bDefault)
|
||||
{
|
||||
StartStruct();
|
||||
AddItem( SettingName, "id" );
|
||||
AddItem( Prompt, "prompt" );
|
||||
AddItem( "bool", "type" );
|
||||
AddBool( bDefault, "default" );
|
||||
EndStruct();
|
||||
return ShuttleGui::TieCheckBoxOnRight( Prompt, SettingName, bDefault );
|
||||
}
|
||||
wxChoice * ShuttleGuiGetDefinition::TieChoice(
|
||||
const wxString &Prompt,
|
||||
const wxString &SettingName,
|
||||
const wxString &Default,
|
||||
const wxArrayStringEx &Choices,
|
||||
const wxArrayStringEx & InternalChoices )
|
||||
{
|
||||
StartStruct();
|
||||
AddItem( SettingName, "id" );
|
||||
AddItem( Prompt, "prompt" );
|
||||
AddItem( "enum", "type" );
|
||||
AddItem( Default, "default" );
|
||||
StartField( "enum" );
|
||||
StartArray();
|
||||
for( size_t i=0;i<Choices.size(); i++ )
|
||||
AddItem( InternalChoices[i] );
|
||||
EndArray();
|
||||
EndField();
|
||||
EndStruct();
|
||||
return ShuttleGui::TieChoice( Prompt, SettingName, Default, Choices, InternalChoices );
|
||||
}
|
||||
wxChoice * ShuttleGuiGetDefinition::TieChoice(
|
||||
const wxString &Prompt,
|
||||
const wxString &SettingName,
|
||||
const int Default,
|
||||
const wxArrayStringEx & Choices,
|
||||
const std::vector<int> & InternalChoices)
|
||||
{
|
||||
// Should no longer come here!
|
||||
// Choice controls in Preferences that really are exhaustive choices among
|
||||
// non-numerical options must now encode the internal choices as strings,
|
||||
// not numbers.
|
||||
wxASSERT(false);
|
||||
|
||||
// But if we do get here anyway, proceed sub-optimally as before.
|
||||
StartStruct();
|
||||
AddItem( SettingName, "id" );
|
||||
AddItem( Prompt, "prompt" );
|
||||
AddItem( "enum", "type" );
|
||||
AddItem( Default, "default" );
|
||||
StartField( "enum" );
|
||||
StartArray();
|
||||
for( size_t i=0;i<Choices.size(); i++ )
|
||||
AddItem( Choices[i] );
|
||||
EndArray();
|
||||
EndField();
|
||||
EndStruct();
|
||||
return ShuttleGui::TieChoice( Prompt, SettingName, Default, Choices, InternalChoices );
|
||||
}
|
||||
wxChoice * ShuttleGuiGetDefinition::TieNumberAsChoice(
|
||||
const wxString &Prompt,
|
||||
const wxString &SettingName,
|
||||
const int Default,
|
||||
const wxArrayStringEx & Choices,
|
||||
const std::vector<int> & InternalChoices)
|
||||
{
|
||||
// Come here for controls that present non-exhaustive choices among some
|
||||
// numbers, with an associated control that allows arbitrary entry of an
|
||||
// "Other..."
|
||||
StartStruct();
|
||||
AddItem( SettingName, "id" );
|
||||
AddItem( Prompt, "prompt" );
|
||||
AddItem( "number", "type" ); // not "enum" !
|
||||
AddItem( Default, "default" );
|
||||
EndStruct();
|
||||
return ShuttleGui::TieNumberAsChoice(
|
||||
Prompt, SettingName, Default, Choices, InternalChoices );
|
||||
}
|
||||
wxTextCtrl * ShuttleGuiGetDefinition::TieTextBox(
|
||||
const wxString &Prompt,
|
||||
const wxString &SettingName,
|
||||
const wxString &Default,
|
||||
const int nChars)
|
||||
{
|
||||
StartStruct();
|
||||
AddItem( SettingName, "id" );
|
||||
AddItem( Prompt, "prompt" );
|
||||
AddItem( "string", "type" );
|
||||
AddItem( Default, "default" );
|
||||
EndStruct();
|
||||
return ShuttleGui::TieTextBox( Prompt, SettingName, Default, nChars );
|
||||
}
|
||||
wxTextCtrl * ShuttleGuiGetDefinition::TieNumericTextBox(
|
||||
const wxString & Prompt,
|
||||
const wxString & SettingName,
|
||||
const double & Default,
|
||||
const int nChars)
|
||||
{
|
||||
StartStruct();
|
||||
AddItem( SettingName, "id" );
|
||||
AddItem( Prompt, "prompt" );
|
||||
AddItem( "number", "type" );
|
||||
AddItem( Default, "default" );
|
||||
EndStruct();
|
||||
return ShuttleGui::TieNumericTextBox( Prompt, SettingName, Default, nChars );
|
||||
}
|
||||
wxSlider * ShuttleGuiGetDefinition::TieSlider(
|
||||
const wxString & Prompt,
|
||||
const wxString & SettingName,
|
||||
const int iDefault,
|
||||
const int max,
|
||||
const int min)
|
||||
{
|
||||
StartStruct();
|
||||
AddItem( SettingName, "id" );
|
||||
AddItem( Prompt, "prompt" );
|
||||
AddItem( "number", "type" );
|
||||
AddItem( iDefault, "default" );
|
||||
EndStruct();
|
||||
return ShuttleGui::TieSlider( Prompt, SettingName, iDefault, max, min );
|
||||
}
|
||||
wxSpinCtrl * ShuttleGuiGetDefinition::TieSpinCtrl(
|
||||
const wxString &Prompt,
|
||||
const wxString &SettingName,
|
||||
const int Value,
|
||||
const int max,
|
||||
const int min)
|
||||
{
|
||||
StartStruct();
|
||||
AddItem( SettingName, "id" );
|
||||
AddItem( Prompt, "prompt" );
|
||||
AddItem( "number", "type" );
|
||||
AddItem( Value, "default" );
|
||||
EndStruct();
|
||||
return ShuttleGui::TieSpinCtrl( Prompt, SettingName, Value, max, min );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
bool GetInfoCommand::SendPreferences(const CommandContext &context)
|
||||
{
|
||||
context.StartArray();
|
||||
|
@ -228,6 +228,12 @@ void BuiltinCommandsModule::Terminate()
|
||||
return;
|
||||
}
|
||||
|
||||
const FileExtensions &BuiltinCommandsModule::GetFileExtensions()
|
||||
{
|
||||
static FileExtensions empty;
|
||||
return empty;
|
||||
}
|
||||
|
||||
bool BuiltinCommandsModule::AutoRegisterPlugins(PluginManagerInterface & pm)
|
||||
{
|
||||
wxString ignoredErrMsg;
|
||||
|
@ -40,7 +40,7 @@ public:
|
||||
bool Initialize() override;
|
||||
void Terminate() override;
|
||||
|
||||
FileExtensions GetFileExtensions() override { return {}; }
|
||||
const FileExtensions &GetFileExtensions() override;
|
||||
FilePath InstallPath() override { return {}; }
|
||||
|
||||
bool AutoRegisterPlugins(PluginManagerInterface & pm) override;
|
||||
|
@ -293,6 +293,12 @@ void BuiltinEffectsModule::Terminate()
|
||||
return;
|
||||
}
|
||||
|
||||
const FileExtensions &BuiltinEffectsModule::GetFileExtensions()
|
||||
{
|
||||
static FileExtensions empty;
|
||||
return empty;
|
||||
}
|
||||
|
||||
bool BuiltinEffectsModule::AutoRegisterPlugins(PluginManagerInterface & pm)
|
||||
{
|
||||
wxString ignoredErrMsg;
|
||||
|
@ -39,7 +39,7 @@ public:
|
||||
bool Initialize() override;
|
||||
void Terminate() override;
|
||||
|
||||
FileExtensions GetFileExtensions() override { return {}; }
|
||||
const FileExtensions &GetFileExtensions() override;
|
||||
FilePath InstallPath() override { return {}; }
|
||||
|
||||
bool AutoRegisterPlugins(PluginManagerInterface & pm) override;
|
||||
|
@ -370,9 +370,10 @@ void VSTEffectsModule::Terminate()
|
||||
return;
|
||||
}
|
||||
|
||||
FileExtensions VSTEffectsModule::GetFileExtensions()
|
||||
const FileExtensions &VSTEffectsModule::GetFileExtensions()
|
||||
{
|
||||
return {{ _T("vst") }};
|
||||
static FileExtensions result{{ _T("vst") }};
|
||||
return result;
|
||||
}
|
||||
|
||||
FilePath VSTEffectsModule::InstallPath()
|
||||
|
@ -416,7 +416,7 @@ public:
|
||||
bool Initialize() override;
|
||||
void Terminate() override;
|
||||
|
||||
FileExtensions GetFileExtensions() override;
|
||||
const FileExtensions &GetFileExtensions() override;
|
||||
FilePath InstallPath() override;
|
||||
|
||||
bool AutoRegisterPlugins(PluginManagerInterface & pm) override;
|
||||
|
@ -137,9 +137,10 @@ wxString AudioUnitEffectsModule::GetDescription()
|
||||
// ModuleInterface implementation
|
||||
// ============================================================================
|
||||
|
||||
FileExtensions AudioUnitEffectsModule::GetFileExtensions()
|
||||
const FileExtensions &AudioUnitEffectsModule::GetFileExtensions()
|
||||
{
|
||||
return {{ _T("au") }};
|
||||
static FileExtensions result{{ _T("au") }};
|
||||
return result;
|
||||
}
|
||||
|
||||
bool AudioUnitEffectsModule::Initialize()
|
||||
|
@ -241,7 +241,7 @@ public:
|
||||
bool Initialize() override;
|
||||
void Terminate() override;
|
||||
|
||||
FileExtensions GetFileExtensions() override;
|
||||
const FileExtensions &GetFileExtensions() override;
|
||||
FilePath InstallPath() override { return {}; }
|
||||
|
||||
bool AutoRegisterPlugins(PluginManagerInterface & pm) override;
|
||||
|
@ -156,9 +156,9 @@ void LadspaEffectsModule::Terminate()
|
||||
return;
|
||||
}
|
||||
|
||||
FileExtensions LadspaEffectsModule::GetFileExtensions()
|
||||
const FileExtensions &LadspaEffectsModule::GetFileExtensions()
|
||||
{
|
||||
return {{
|
||||
static FileExtensions result{{
|
||||
|
||||
#ifdef __WXMSW__
|
||||
|
||||
@ -176,6 +176,7 @@ FileExtensions LadspaEffectsModule::GetFileExtensions()
|
||||
#endif
|
||||
|
||||
}};
|
||||
return result;
|
||||
}
|
||||
|
||||
FilePath LadspaEffectsModule::InstallPath()
|
||||
|
@ -222,7 +222,7 @@ public:
|
||||
bool Initialize() override;
|
||||
void Terminate() override;
|
||||
|
||||
FileExtensions GetFileExtensions() override;
|
||||
const FileExtensions &GetFileExtensions() override;
|
||||
FilePath InstallPath() override;
|
||||
|
||||
bool AutoRegisterPlugins(PluginManagerInterface & pm) override;
|
||||
|
@ -207,6 +207,12 @@ void LV2EffectsModule::Terminate()
|
||||
return;
|
||||
}
|
||||
|
||||
const FileExtensions &LV2EffectsModule::GetFileExtensions()
|
||||
{
|
||||
static FileExtensions empty;
|
||||
return empty;
|
||||
}
|
||||
|
||||
bool LV2EffectsModule::AutoRegisterPlugins(PluginManagerInterface & WXUNUSED(pm))
|
||||
{
|
||||
return false;
|
||||
|
@ -86,7 +86,7 @@ public:
|
||||
bool Initialize() override;
|
||||
void Terminate() override;
|
||||
|
||||
FileExtensions GetFileExtensions() override { return {}; }
|
||||
const FileExtensions &GetFileExtensions() override;
|
||||
FilePath InstallPath() override { return {}; }
|
||||
|
||||
bool AutoRegisterPlugins(PluginManagerInterface & pm) override;
|
||||
|
@ -156,9 +156,10 @@ void NyquistEffectsModule::Terminate()
|
||||
return;
|
||||
}
|
||||
|
||||
FileExtensions NyquistEffectsModule::GetFileExtensions()
|
||||
const FileExtensions &NyquistEffectsModule::GetFileExtensions()
|
||||
{
|
||||
return {{ _T("ny") }};
|
||||
static FileExtensions result{{ _T("ny") }};
|
||||
return result;
|
||||
}
|
||||
|
||||
FilePath NyquistEffectsModule::InstallPath()
|
||||
|
@ -37,7 +37,7 @@ public:
|
||||
bool Initialize() override;
|
||||
void Terminate() override;
|
||||
|
||||
FileExtensions GetFileExtensions() override;
|
||||
const FileExtensions &GetFileExtensions() override;
|
||||
FilePath InstallPath() override;
|
||||
|
||||
bool AutoRegisterPlugins(PluginManagerInterface & pm) override;
|
||||
|
@ -112,9 +112,10 @@ void VampEffectsModule::Terminate()
|
||||
return;
|
||||
}
|
||||
|
||||
FileExtensions VampEffectsModule::GetFileExtensions()
|
||||
const FileExtensions &VampEffectsModule::GetFileExtensions()
|
||||
{
|
||||
return {};
|
||||
static FileExtensions empty;
|
||||
return empty;
|
||||
}
|
||||
|
||||
bool VampEffectsModule::AutoRegisterPlugins(PluginManagerInterface & WXUNUSED(pm))
|
||||
|
@ -45,7 +45,7 @@ public:
|
||||
bool Initialize() override;
|
||||
void Terminate() override;
|
||||
|
||||
FileExtensions GetFileExtensions() override;
|
||||
const FileExtensions &GetFileExtensions() override;
|
||||
FilePath InstallPath() override { return {}; }
|
||||
|
||||
bool AutoRegisterPlugins(PluginManagerInterface & pm) override;
|
||||
|
@ -21,6 +21,7 @@ LRN
|
||||
#include "../FileNames.h"
|
||||
|
||||
#include <unordered_map>
|
||||
#include "audacity/Types.h"
|
||||
|
||||
class wxArrayStringEx;
|
||||
|
||||
|
@ -95,8 +95,9 @@ BatchPrefs::~BatchPrefs()
|
||||
{
|
||||
}
|
||||
|
||||
PrefsPanel *BatchPrefsFactory::operator () (wxWindow *parent, wxWindowID winid)
|
||||
PrefsPanel::Factory
|
||||
BatchPrefsFactory = [](wxWindow *parent, wxWindowID winid)
|
||||
{
|
||||
wxASSERT(parent); // to justify safenew
|
||||
return safenew BatchPrefs(parent, winid);
|
||||
}
|
||||
};
|
||||
|
@ -39,10 +39,6 @@ private:
|
||||
};
|
||||
|
||||
|
||||
/// A PrefsPanelFactory that creates one BatchPrefs panel.
|
||||
class BatchPrefsFactory final : public PrefsPanelFactory
|
||||
{
|
||||
public:
|
||||
PrefsPanel *operator () (wxWindow *parent, wxWindowID winid) override;
|
||||
};
|
||||
/// A PrefsPanel::Factory that creates one BatchPrefs panel.
|
||||
extern PrefsPanel::Factory BatchPrefsFactory;
|
||||
#endif
|
||||
|
@ -420,8 +420,10 @@ bool DevicePrefs::Commit()
|
||||
return true;
|
||||
}
|
||||
|
||||
PrefsPanel *DevicePrefsFactory::operator () (wxWindow *parent, wxWindowID winid)
|
||||
PrefsPanel::Factory
|
||||
DevicePrefsFactory = [](wxWindow *parent, wxWindowID winid)
|
||||
|
||||
{
|
||||
wxASSERT(parent); // to justify safenew
|
||||
return safenew DevicePrefs(parent, winid);
|
||||
}
|
||||
};
|
||||
|
@ -57,11 +57,7 @@ class DevicePrefs final : public PrefsPanel
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
/// A PrefsPanelFactory that creates one DevicePrefs panel.
|
||||
class DevicePrefsFactory final : public PrefsPanelFactory
|
||||
{
|
||||
public:
|
||||
PrefsPanel *operator () (wxWindow *parent, wxWindowID winid) override;
|
||||
};
|
||||
/// A PrefsPanel::Factory that creates one DevicePrefs panel.
|
||||
extern PrefsPanel::Factory DevicePrefsFactory;
|
||||
|
||||
#endif
|
||||
|
@ -287,8 +287,11 @@ bool DirectoriesPrefs::Commit()
|
||||
return true;
|
||||
}
|
||||
|
||||
PrefsPanel *DirectoriesPrefsFactory::operator () (wxWindow *parent, wxWindowID winid)
|
||||
PrefsPanel::Factory
|
||||
DirectoriesPrefsFactory() {
|
||||
return [](wxWindow *parent, wxWindowID winid)
|
||||
{
|
||||
wxASSERT(parent); // to justify safenew
|
||||
return safenew DirectoriesPrefs(parent, winid);
|
||||
};
|
||||
}
|
||||
|
@ -44,10 +44,7 @@ class DirectoriesPrefs final : public PrefsPanel
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
/// A PrefsPanelFactory that creates one DirectoriesPrefs panel.
|
||||
class DirectoriesPrefsFactory final : public PrefsPanelFactory
|
||||
{
|
||||
public:
|
||||
PrefsPanel *operator () (wxWindow *parent, wxWindowID winid) override;
|
||||
};
|
||||
/// A PrefsPanel::Factory that creates one DirectoriesPrefs panel.
|
||||
/// This one is used not only in the Preferences command.
|
||||
extern PrefsPanel::Factory DirectoriesPrefsFactory();
|
||||
#endif
|
||||
|
@ -200,8 +200,9 @@ bool EffectsPrefs::Commit()
|
||||
return true;
|
||||
}
|
||||
|
||||
PrefsPanel *EffectsPrefsFactory::operator () (wxWindow *parent, wxWindowID winid)
|
||||
PrefsPanel::Factory
|
||||
EffectsPrefsFactory = [](wxWindow *parent, wxWindowID winid)
|
||||
{
|
||||
wxASSERT(parent); // to justify safenew
|
||||
return safenew EffectsPrefs(parent, winid);
|
||||
}
|
||||
};
|
||||
|
@ -37,10 +37,6 @@ class EffectsPrefs final : public PrefsPanel
|
||||
void Populate();
|
||||
};
|
||||
|
||||
/// A PrefsPanelFactory that creates one EffectsPrefs panel.
|
||||
class EffectsPrefsFactory final : public PrefsPanelFactory
|
||||
{
|
||||
public:
|
||||
PrefsPanel *operator () (wxWindow *parent, wxWindowID winid) override;
|
||||
};
|
||||
/// A PrefsPanel::Factory that creates one EffectsPrefs panel.
|
||||
extern PrefsPanel::Factory EffectsPrefsFactory;
|
||||
#endif
|
||||
|
@ -822,8 +822,9 @@ void ExtImportPrefsDropTarget::OnLeave()
|
||||
{
|
||||
}
|
||||
|
||||
PrefsPanel *ExtImportPrefsFactory::operator () (wxWindow *parent, wxWindowID winid)
|
||||
PrefsPanel::Factory
|
||||
ExtImportPrefsFactory = [](wxWindow *parent, wxWindowID winid)
|
||||
{
|
||||
wxASSERT(parent); // to justify safenew
|
||||
return safenew ExtImportPrefs(parent, winid);
|
||||
}
|
||||
};
|
||||
|
@ -114,10 +114,6 @@ class ExtImportPrefs final : public PrefsPanel
|
||||
};
|
||||
|
||||
|
||||
/// A PrefsPanelFactory that creates one ExtImportPrefs panel.
|
||||
class ExtImportPrefsFactory final : public PrefsPanelFactory
|
||||
{
|
||||
public:
|
||||
PrefsPanel *operator () (wxWindow *parent, wxWindowID winid) override;
|
||||
};
|
||||
/// A PrefsPanel::Factory that creates one ExtImportPrefs panel.
|
||||
extern PrefsPanel::Factory ExtImportPrefsFactory;
|
||||
#endif
|
||||
|
@ -268,8 +268,9 @@ bool GUIPrefs::Commit()
|
||||
return true;
|
||||
}
|
||||
|
||||
PrefsPanel *GUIPrefsFactory::operator () (wxWindow *parent, wxWindowID winid)
|
||||
PrefsPanel::Factory
|
||||
GUIPrefsFactory = [](wxWindow *parent, wxWindowID winid)
|
||||
{
|
||||
wxASSERT(parent); // to justify safenew
|
||||
return safenew GUIPrefs(parent, winid);
|
||||
}
|
||||
};
|
||||
|
@ -53,10 +53,6 @@ class GUIPrefs final : public PrefsPanel
|
||||
wxArrayStringEx mRangeChoices;
|
||||
};
|
||||
|
||||
/// A PrefsPanelFactory that creates one GUIPrefs panel.
|
||||
class GUIPrefsFactory final : public PrefsPanelFactory
|
||||
{
|
||||
public:
|
||||
PrefsPanel *operator () (wxWindow *parent, wxWindowID winid) override;
|
||||
};
|
||||
/// A PrefsPanel::Factory that creates one GUIPrefs panel.
|
||||
extern PrefsPanel::Factory GUIPrefsFactory;
|
||||
#endif
|
||||
|
@ -128,8 +128,9 @@ bool ImportExportPrefs::Commit()
|
||||
return true;
|
||||
}
|
||||
|
||||
PrefsPanel *ImportExportPrefsFactory::operator () (wxWindow *parent, wxWindowID winid)
|
||||
PrefsPanel::Factory
|
||||
ImportExportPrefsFactory = [](wxWindow *parent, wxWindowID winid)
|
||||
{
|
||||
wxASSERT(parent); // to justify safenew
|
||||
return safenew ImportExportPrefs(parent, winid);
|
||||
}
|
||||
};
|
||||
|
@ -37,10 +37,6 @@ class ImportExportPrefs final : public PrefsPanel
|
||||
void Populate();
|
||||
};
|
||||
|
||||
/// A PrefsPanelFactory that creates one ImportExportPrefs panel.
|
||||
class ImportExportPrefsFactory final : public PrefsPanelFactory
|
||||
{
|
||||
public:
|
||||
PrefsPanel *operator () (wxWindow *parent, wxWindowID winid) override;
|
||||
};
|
||||
/// A PrefsPanel::Factory that creates one ImportExportPrefs panel.
|
||||
extern PrefsPanel::Factory ImportExportPrefsFactory;
|
||||
#endif
|
||||
|
@ -688,9 +688,13 @@ void KeyConfigPrefs::Cancel()
|
||||
return;
|
||||
}
|
||||
|
||||
PrefsPanel *KeyConfigPrefsFactory::operator () (wxWindow *parent, wxWindowID winid)
|
||||
PrefsPanel::Factory
|
||||
KeyConfigPrefsFactory( const CommandID &name )
|
||||
{
|
||||
return [=](wxWindow *parent, wxWindowID winid)
|
||||
{
|
||||
wxASSERT(parent); // to justify safenew
|
||||
auto result = safenew KeyConfigPrefs{ parent, winid, mName };
|
||||
auto result = safenew KeyConfigPrefs{ parent, winid, name };
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
@ -93,15 +93,9 @@ private:
|
||||
};
|
||||
|
||||
|
||||
/// A PrefsPanelFactory that creates one KeyConfigPrefs panel.
|
||||
class KeyConfigPrefsFactory final : public PrefsPanelFactory
|
||||
{
|
||||
public:
|
||||
KeyConfigPrefsFactory(const CommandID &name = {})
|
||||
: mName{ name } {}
|
||||
PrefsPanel *operator () (wxWindow *parent, wxWindowID winid) override;
|
||||
|
||||
private:
|
||||
CommandID mName;
|
||||
};
|
||||
/// A PrefsPanel::Factory that creates one KeyConfigPrefs panel.
|
||||
/// This factory can be parametrized by name, which specifies a command to be
|
||||
/// focused initially
|
||||
extern PrefsPanel::Factory KeyConfigPrefsFactory(
|
||||
const CommandID &name = {} );
|
||||
#endif
|
||||
|
@ -267,8 +267,9 @@ bool LibraryPrefs::Commit()
|
||||
return true;
|
||||
}
|
||||
|
||||
PrefsPanel *LibraryPrefsFactory::operator () (wxWindow *parent, wxWindowID winid)
|
||||
PrefsPanel::Factory
|
||||
LibraryPrefsFactory = [](wxWindow *parent, wxWindowID winid)
|
||||
{
|
||||
wxASSERT(parent); // to justify safenew
|
||||
return safenew LibraryPrefs(parent, winid);
|
||||
}
|
||||
};
|
||||
|
@ -50,10 +50,6 @@ class LibraryPrefs final : public PrefsPanel
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
/// A PrefsPanelFactory that creates one LibraryPrefs panel.
|
||||
class LibraryPrefsFactory final : public PrefsPanelFactory
|
||||
{
|
||||
public:
|
||||
PrefsPanel *operator () (wxWindow *parent, wxWindowID winid) override;
|
||||
};
|
||||
/// A PrefsPanel::Factory that creates one LibraryPrefs panel.
|
||||
extern PrefsPanel::Factory LibraryPrefsFactory;
|
||||
#endif
|
||||
|
@ -299,10 +299,11 @@ bool MidiIOPrefs::Validate()
|
||||
return true;
|
||||
}
|
||||
|
||||
PrefsPanel *MidiIOPrefsFactory::operator () (wxWindow *parent, wxWindowID winid)
|
||||
PrefsPanel::Factory
|
||||
MidiIOPrefsFactory = [](wxWindow *parent, wxWindowID winid)
|
||||
{
|
||||
wxASSERT(parent); // to justify safenew
|
||||
return safenew MidiIOPrefs(parent, winid);
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -68,12 +68,8 @@ class MidiIOPrefs final : public PrefsPanel
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
/// A PrefsPanelFactory that creates one MidiIOPrefs panel.
|
||||
class MidiIOPrefsFactory final : public PrefsPanelFactory
|
||||
{
|
||||
public:
|
||||
PrefsPanel *operator () (wxWindow *parent, wxWindowID winid) override;
|
||||
};
|
||||
/// A PrefsPanel::Factory that creates one MidiIOPrefs panel.
|
||||
extern PrefsPanel::Factory MidiIOPrefsFactory;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -180,8 +180,9 @@ void ModulePrefs::SetModuleStatus(const FilePath &fname, int iStatus){
|
||||
gPrefs->Flush();
|
||||
}
|
||||
|
||||
PrefsPanel *ModulePrefsFactory::operator () (wxWindow *parent, wxWindowID winid)
|
||||
PrefsPanel::Factory
|
||||
ModulePrefsFactory = [](wxWindow *parent, wxWindowID winid)
|
||||
{
|
||||
wxASSERT(parent); // to justify safenew
|
||||
return safenew ModulePrefs(parent, winid);
|
||||
}
|
||||
};
|
||||
|
@ -55,10 +55,6 @@ class ModulePrefs final : public PrefsPanel
|
||||
FilePaths mPaths;
|
||||
};
|
||||
|
||||
/// A PrefsPanelFactory that creates one ModulePrefs panel.
|
||||
class ModulePrefsFactory final : public PrefsPanelFactory
|
||||
{
|
||||
public:
|
||||
PrefsPanel *operator () (wxWindow *parent, wxWindowID winid) override;
|
||||
};
|
||||
/// A PrefsPanel::Factory that creates one ModulePrefs panel.
|
||||
extern PrefsPanel::Factory ModulePrefsFactory;
|
||||
#endif
|
||||
|
@ -218,8 +218,9 @@ bool MousePrefs::Commit()
|
||||
return true;
|
||||
}
|
||||
|
||||
PrefsPanel *MousePrefsFactory::operator () (wxWindow *parent, wxWindowID winid)
|
||||
PrefsPanel::Factory
|
||||
MousePrefsFactory = [](wxWindow *parent, wxWindowID winid)
|
||||
{
|
||||
wxASSERT(parent); // to justify safenew
|
||||
return safenew MousePrefs(parent, winid);
|
||||
}
|
||||
};
|
||||
|
@ -41,10 +41,6 @@ class MousePrefs final : public PrefsPanel
|
||||
wxListCtrl * mList;
|
||||
};
|
||||
|
||||
/// A PrefsPanelFactory that creates one MousePrefs panel.
|
||||
class MousePrefsFactory final : public PrefsPanelFactory
|
||||
{
|
||||
public:
|
||||
PrefsPanel *operator () (wxWindow *parent, wxWindowID winid) override;
|
||||
};
|
||||
/// A PrefsPanel::Factory that creates one MousePrefs panel.
|
||||
extern PrefsPanel::Factory MousePrefsFactory;
|
||||
#endif
|
||||
|
@ -183,9 +183,10 @@ bool PlaybackPrefs::Commit()
|
||||
return true;
|
||||
}
|
||||
|
||||
PrefsPanel *PlaybackPrefsFactory::operator () (wxWindow *parent, wxWindowID winid)
|
||||
PrefsPanel::Factory
|
||||
PlaybackPrefsFactory = [](wxWindow *parent, wxWindowID winid)
|
||||
{
|
||||
wxASSERT(parent); // to justify safenew
|
||||
return safenew PlaybackPrefs(parent, winid);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -39,11 +39,7 @@ class PlaybackPrefs final : public PrefsPanel
|
||||
};
|
||||
|
||||
|
||||
/// A PrefsPanelFactory that creates one PlaybackPrefs panel.
|
||||
class PlaybackPrefsFactory final : public PrefsPanelFactory
|
||||
{
|
||||
public:
|
||||
PrefsPanel *operator () (wxWindow *parent, wxWindowID winid) override;
|
||||
};
|
||||
/// A PrefsPanel::Factory that creates one PlaybackPrefs panel.
|
||||
extern PrefsPanel::Factory PlaybackPrefsFactory;
|
||||
|
||||
#endif
|
||||
|
@ -487,72 +487,42 @@ PrefsDialog::Factories
|
||||
{
|
||||
// To do, perhaps: create this table by registration, without including each PrefsPanel
|
||||
// class... and thus allowing a plug-in protocol
|
||||
static DevicePrefsFactory devicePrefsFactory;
|
||||
static PlaybackPrefsFactory playbackPrefsFactory;
|
||||
static RecordingPrefsFactory recordingPrefsFactory;
|
||||
#ifdef EXPERIMENTAL_MIDI_OUT
|
||||
static MidiIOPrefsFactory midiIOPrefsFactory;
|
||||
#endif
|
||||
static QualityPrefsFactory qualityPrefsFactory;
|
||||
static GUIPrefsFactory guiPrefsFactory;
|
||||
static TracksPrefsFactory tracksPrefsFactory;
|
||||
static ImportExportPrefsFactory importExportPrefsFactory;
|
||||
static ExtImportPrefsFactory extImportPrefsFactory;
|
||||
static ProjectsPrefsFactory projectsPrefsFactory;
|
||||
#if !defined(DISABLE_DYNAMIC_LOADING_FFMPEG) || !defined(DISABLE_DYNAMIC_LOADING_LAME)
|
||||
static LibraryPrefsFactory libraryPrefsFactory;
|
||||
#endif
|
||||
// static WaveformPrefsFactory waveformPrefsFactory;
|
||||
static TracksBehaviorsPrefsFactory tracksBehaviorsPrefsFactory;
|
||||
static SpectrumPrefsFactory spectrumPrefsFactory;
|
||||
static DirectoriesPrefsFactory directoriesPrefsFactory;
|
||||
static WarningsPrefsFactory warningsPrefsFactory;
|
||||
static EffectsPrefsFactory effectsPrefsFactory;
|
||||
#ifdef EXPERIMENTAL_THEME_PREFS
|
||||
static ThemePrefsFactory themePrefsFactory;
|
||||
#endif
|
||||
// static BatchPrefsFactory batchPrefsFactory;
|
||||
static KeyConfigPrefsFactory keyConfigPrefsFactory;
|
||||
static MousePrefsFactory mousePrefsFactory;
|
||||
#ifdef EXPERIMENTAL_MODULE_PREFS
|
||||
static ModulePrefsFactory modulePrefsFactory;
|
||||
#endif
|
||||
|
||||
static PrefsNode nodes[] = {
|
||||
&devicePrefsFactory,
|
||||
&playbackPrefsFactory,
|
||||
&recordingPrefsFactory,
|
||||
DevicePrefsFactory,
|
||||
PlaybackPrefsFactory,
|
||||
RecordingPrefsFactory,
|
||||
#ifdef EXPERIMENTAL_MIDI_OUT
|
||||
&midiIOPrefsFactory,
|
||||
MidiIOPrefsFactory,
|
||||
#endif
|
||||
&qualityPrefsFactory,
|
||||
&guiPrefsFactory,
|
||||
QualityPrefsFactory,
|
||||
GUIPrefsFactory,
|
||||
|
||||
// Group other page(s)
|
||||
PrefsNode(&tracksPrefsFactory, 2),
|
||||
// &waveformPrefsFactory,
|
||||
&tracksBehaviorsPrefsFactory,
|
||||
&spectrumPrefsFactory,
|
||||
PrefsNode(TracksPrefsFactory, 2),
|
||||
// WaveformPrefsFactory(),
|
||||
TracksBehaviorsPrefsFactory,
|
||||
SpectrumPrefsFactory(),
|
||||
|
||||
// Group one other page
|
||||
PrefsNode(&importExportPrefsFactory, 1),
|
||||
&extImportPrefsFactory,
|
||||
PrefsNode(ImportExportPrefsFactory, 1),
|
||||
ExtImportPrefsFactory,
|
||||
|
||||
&projectsPrefsFactory,
|
||||
ProjectsPrefsFactory,
|
||||
#if !defined(DISABLE_DYNAMIC_LOADING_FFMPEG) || !defined(DISABLE_DYNAMIC_LOADING_LAME)
|
||||
&libraryPrefsFactory,
|
||||
LibraryPrefsFactory,
|
||||
#endif
|
||||
&directoriesPrefsFactory,
|
||||
&warningsPrefsFactory,
|
||||
&effectsPrefsFactory,
|
||||
DirectoriesPrefsFactory(),
|
||||
WarningsPrefsFactory,
|
||||
EffectsPrefsFactory,
|
||||
#ifdef EXPERIMENTAL_THEME_PREFS
|
||||
&themePrefsFactory,
|
||||
ThemePrefsFactory,
|
||||
#endif
|
||||
// &batchPrefsFactory,
|
||||
&keyConfigPrefsFactory,
|
||||
&mousePrefsFactory,
|
||||
KeyConfigPrefsFactory(),
|
||||
MousePrefsFactory,
|
||||
#ifdef EXPERIMENTAL_MODULE_PREFS
|
||||
&modulePrefsFactory,
|
||||
ModulePrefsFactory,
|
||||
#endif
|
||||
};
|
||||
|
||||
@ -601,7 +571,7 @@ PrefsDialog::PrefsDialog
|
||||
it != end; ++it, ++iPage)
|
||||
{
|
||||
const PrefsNode &node = *it;
|
||||
PrefsPanelFactory &factory = *node.pFactory;
|
||||
const PrefsPanel::Factory &factory = node.factory;
|
||||
wxWindow *const w = factory(mCategories, wxID_ANY);
|
||||
if (stack.empty())
|
||||
// Parameters are: AddPage(page, name, IsSelected, imageId).
|
||||
@ -629,7 +599,7 @@ PrefsDialog::PrefsDialog
|
||||
|
||||
// Unique page, don't show the factory
|
||||
const PrefsNode &node = factories[0];
|
||||
PrefsPanelFactory &factory = *node.pFactory;
|
||||
const PrefsPanel::Factory &factory = node.factory;
|
||||
mUniquePage = factory(this, wxID_ANY);
|
||||
wxWindow * uniquePageWindow = S.Prop(1).AddWindow(mUniquePage, wxEXPAND);
|
||||
// We're not in the wxTreebook, so add the accelerator here
|
||||
|
@ -12,6 +12,7 @@
|
||||
#ifndef __AUDACITY_PREFS_DIALOG__
|
||||
#define __AUDACITY_PREFS_DIALOG__
|
||||
|
||||
#include <functional>
|
||||
#include <vector>
|
||||
#include "../widgets/wxPanelWrapper.h" // to inherit
|
||||
#include "../Internat.h"
|
||||
@ -19,7 +20,6 @@
|
||||
class wxTreebook;
|
||||
class wxTreeEvent;
|
||||
class PrefsPanel;
|
||||
class PrefsPanelFactory;
|
||||
class ShuttleGui;
|
||||
|
||||
#ifdef __GNUC__
|
||||
@ -33,14 +33,16 @@ class PrefsDialog /* not final */ : public wxDialogWrapper
|
||||
public:
|
||||
// An array of PrefsNode specifies the tree of pages in pre-order traversal.
|
||||
struct PrefsNode {
|
||||
PrefsPanelFactory * CONST pFactory;
|
||||
using Factory =
|
||||
std::function< PrefsPanel * (wxWindow *parent, wxWindowID winid) >;
|
||||
Factory factory;
|
||||
CONST int nChildren;
|
||||
bool expanded;
|
||||
|
||||
PrefsNode(PrefsPanelFactory *pFactory_,
|
||||
PrefsNode(const Factory &factory_,
|
||||
int nChildren_ = 0,
|
||||
bool expanded_ = true)
|
||||
: pFactory(pFactory_), nChildren(nChildren_), expanded(expanded_)
|
||||
: factory(factory_), nChildren(nChildren_), expanded(expanded_)
|
||||
{}
|
||||
};
|
||||
typedef std::vector<PrefsNode> Factories;
|
||||
|
@ -22,17 +22,12 @@ MousePrefs, QualityPrefs, SpectrumPrefs and ThemePrefs.
|
||||
To actually add the new panel, edit the PrefsDialog constructor
|
||||
to append the panel to its list of panels.
|
||||
|
||||
*******************************************************************//**
|
||||
|
||||
\class PrefsPanelFactory
|
||||
\brief Base class for factories such as GUIPrefsFactory that produce a
|
||||
PrefsPanel.
|
||||
|
||||
*//*******************************************************************/
|
||||
|
||||
#ifndef __AUDACITY_PREFS_PANEL__
|
||||
#define __AUDACITY_PREFS_PANEL__
|
||||
|
||||
#include <functional>
|
||||
#include "../widgets/wxPanelWrapper.h" // to inherit
|
||||
#include "../include/audacity/ComponentInterface.h"
|
||||
|
||||
@ -52,6 +47,11 @@ class ShuttleGui;
|
||||
class PrefsPanel /* not final */ : public wxPanelWrapper, ComponentInterface
|
||||
{
|
||||
public:
|
||||
// \brief Type alias for factories such as GUIPrefsFactory that produce a
|
||||
// PrefsPanel.
|
||||
using Factory =
|
||||
std::function< PrefsPanel * (wxWindow *parent, wxWindowID winid) >;
|
||||
|
||||
PrefsPanel(wxWindow * parent, wxWindowID winid, const wxString &title)
|
||||
: wxPanelWrapper(parent, winid)
|
||||
{
|
||||
@ -86,11 +86,4 @@ class PrefsPanel /* not final */ : public wxPanelWrapper, ComponentInterface
|
||||
virtual void Cancel();
|
||||
};
|
||||
|
||||
class PrefsPanelFactory /* not final */
|
||||
{
|
||||
public:
|
||||
// Precondition: parent != NULL
|
||||
virtual PrefsPanel *operator () (wxWindow *parent, wxWindowID winid) = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -99,8 +99,9 @@ bool ProjectsPrefs::Commit()
|
||||
return true;
|
||||
}
|
||||
|
||||
PrefsPanel *ProjectsPrefsFactory::operator () (wxWindow *parent, wxWindowID winid)
|
||||
PrefsPanel::Factory
|
||||
ProjectsPrefsFactory = [](wxWindow *parent, wxWindowID winid)
|
||||
{
|
||||
wxASSERT(parent); // to justify safenew
|
||||
return safenew ProjectsPrefs(parent, winid);
|
||||
}
|
||||
};
|
||||
|
@ -37,10 +37,6 @@ class ProjectsPrefs final : public PrefsPanel
|
||||
void Populate();
|
||||
};
|
||||
|
||||
/// A PrefsPanelFactory that creates one ProjectPrefs panel.
|
||||
class ProjectsPrefsFactory final : public PrefsPanelFactory
|
||||
{
|
||||
public:
|
||||
PrefsPanel *operator () (wxWindow *parent, wxWindowID winid) override;
|
||||
};
|
||||
/// A PrefsPanel::Factory that creates one ProjectPrefs panel.
|
||||
extern PrefsPanel::Factory ProjectsPrefsFactory;
|
||||
#endif
|
||||
|
@ -277,11 +277,12 @@ bool QualityPrefs::Commit()
|
||||
return true;
|
||||
}
|
||||
|
||||
PrefsPanel *QualityPrefsFactory::operator () (wxWindow *parent, wxWindowID winid)
|
||||
PrefsPanel::Factory
|
||||
QualityPrefsFactory = [](wxWindow *parent, wxWindowID winid)
|
||||
{
|
||||
wxASSERT(parent); // to justify safenew
|
||||
return safenew QualityPrefs(parent, winid);
|
||||
}
|
||||
};
|
||||
|
||||
sampleFormat QualityPrefs::SampleFormatChoice()
|
||||
{
|
||||
|
@ -59,10 +59,6 @@ class QualityPrefs final : public PrefsPanel
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
/// A PrefsPanelFactory that creates one QualityPrefs panel.
|
||||
class QualityPrefsFactory final : public PrefsPanelFactory
|
||||
{
|
||||
public:
|
||||
PrefsPanel *operator () (wxWindow *parent, wxWindowID winid) override;
|
||||
};
|
||||
/// A PrefsPanel::Factory that creates one QualityPrefs panel.
|
||||
extern PrefsPanel::Factory QualityPrefsFactory;
|
||||
#endif
|
||||
|
@ -305,8 +305,9 @@ void RecordingPrefs::OnToggleCustomName(wxCommandEvent & /* Evt */)
|
||||
mToggleCustomName->Enable(mUseCustomTrackName);
|
||||
}
|
||||
|
||||
PrefsPanel *RecordingPrefsFactory::operator () (wxWindow *parent, wxWindowID winid)
|
||||
PrefsPanel::Factory
|
||||
RecordingPrefsFactory = [](wxWindow *parent, wxWindowID winid)
|
||||
{
|
||||
wxASSERT(parent); // to justify safenew
|
||||
return safenew RecordingPrefs(parent, winid);
|
||||
}
|
||||
};
|
||||
|
@ -44,10 +44,6 @@ class RecordingPrefs final : public PrefsPanel
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
/// A PrefsPanelFactory that creates one RecordingPrefs panel.
|
||||
class RecordingPrefsFactory final : public PrefsPanelFactory
|
||||
{
|
||||
public:
|
||||
PrefsPanel *operator () (wxWindow *parent, wxWindowID winid) override;
|
||||
};
|
||||
/// A PrefsPanel::Factory that creates one RecordingPrefs panel.
|
||||
extern PrefsPanel::Factory RecordingPrefsFactory;
|
||||
#endif
|
||||
|
@ -575,13 +575,12 @@ BEGIN_EVENT_TABLE(SpectrumPrefs, PrefsPanel)
|
||||
|
||||
END_EVENT_TABLE()
|
||||
|
||||
SpectrumPrefsFactory::SpectrumPrefsFactory(WaveTrack *wt)
|
||||
: mWt(wt)
|
||||
PrefsPanel::Factory
|
||||
SpectrumPrefsFactory( WaveTrack *wt )
|
||||
{
|
||||
}
|
||||
|
||||
PrefsPanel *SpectrumPrefsFactory::operator () (wxWindow *parent, wxWindowID winid)
|
||||
return [=](wxWindow *parent, wxWindowID winid)
|
||||
{
|
||||
wxASSERT(parent); // to justify safenew
|
||||
return safenew SpectrumPrefs(parent, winid, mWt);
|
||||
return safenew SpectrumPrefs(parent, winid, wt);
|
||||
};
|
||||
}
|
||||
|
@ -105,14 +105,8 @@ class SpectrumPrefs final : public PrefsPanel
|
||||
bool mCommitted{};
|
||||
};
|
||||
|
||||
/// A PrefsPanelFactory that creates one SpectrumPrefs panel.
|
||||
class SpectrumPrefsFactory final : public PrefsPanelFactory
|
||||
{
|
||||
public:
|
||||
explicit SpectrumPrefsFactory(WaveTrack *wt = 0);
|
||||
PrefsPanel *operator () (wxWindow *parent, wxWindowID winid) override;
|
||||
|
||||
private:
|
||||
WaveTrack *const mWt;
|
||||
};
|
||||
/// A PrefsPanel::Factory that creates one SpectrumPrefs panel.
|
||||
/// This factory can be parametrized by a single track, to change settings
|
||||
/// non-globally
|
||||
extern PrefsPanel::Factory SpectrumPrefsFactory( WaveTrack *wt = 0 );
|
||||
#endif
|
||||
|
@ -216,8 +216,9 @@ bool ThemePrefs::Commit()
|
||||
return true;
|
||||
}
|
||||
|
||||
PrefsPanel *ThemePrefsFactory::operator () (wxWindow *parent, wxWindowID winid)
|
||||
PrefsPanel::Factory
|
||||
ThemePrefsFactory = [](wxWindow *parent, wxWindowID winid)
|
||||
{
|
||||
wxASSERT(parent); // to justify safenew
|
||||
return safenew ThemePrefs(parent, winid);
|
||||
}
|
||||
};
|
||||
|
@ -46,10 +46,6 @@ class ThemePrefs final : public PrefsPanel
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
/// A PrefsPanelFactory that creates one ThemePrefs panel.
|
||||
class ThemePrefsFactory final : public PrefsPanelFactory
|
||||
{
|
||||
public:
|
||||
PrefsPanel *operator () (wxWindow *parent, wxWindowID winid) override;
|
||||
};
|
||||
/// A PrefsPanel::Factory that creates one ThemePrefs panel.
|
||||
extern PrefsPanel::Factory ThemePrefsFactory;
|
||||
#endif
|
||||
|
@ -134,12 +134,9 @@ bool TracksBehaviorsPrefs::Commit()
|
||||
return true;
|
||||
}
|
||||
|
||||
TracksBehaviorsPrefsFactory::TracksBehaviorsPrefsFactory()
|
||||
{
|
||||
}
|
||||
|
||||
PrefsPanel *TracksBehaviorsPrefsFactory::operator () (wxWindow *parent, wxWindowID winid)
|
||||
PrefsPanel::Factory
|
||||
TracksBehaviorsPrefsFactory = [](wxWindow *parent, wxWindowID winid)
|
||||
{
|
||||
wxASSERT(parent); // to justify safenew
|
||||
return safenew TracksBehaviorsPrefs(parent, winid);
|
||||
}
|
||||
};
|
||||
|
@ -43,12 +43,6 @@ class TracksBehaviorsPrefs final : public PrefsPanel
|
||||
wxArrayStringEx mSoloChoices;
|
||||
};
|
||||
|
||||
/// A PrefsPanelFactory that creates one TracksBehaviorsPrefs panel.
|
||||
class TracksBehaviorsPrefsFactory final : public PrefsPanelFactory
|
||||
{
|
||||
public:
|
||||
explicit TracksBehaviorsPrefsFactory();
|
||||
PrefsPanel *operator () (wxWindow *parent, wxWindowID winid) override;
|
||||
|
||||
};
|
||||
/// A PrefsPanel::Factory that creates one TracksBehaviorsPrefs panel.
|
||||
extern PrefsPanel::Factory TracksBehaviorsPrefsFactory;
|
||||
#endif
|
||||
|
@ -406,8 +406,9 @@ bool TracksPrefs::Commit()
|
||||
return true;
|
||||
}
|
||||
|
||||
PrefsPanel *TracksPrefsFactory::operator () (wxWindow *parent, wxWindowID winid)
|
||||
PrefsPanel::Factory
|
||||
TracksPrefsFactory = [](wxWindow *parent, wxWindowID winid)
|
||||
{
|
||||
wxASSERT(parent); // to justify safenew
|
||||
return safenew TracksPrefs(parent, winid);
|
||||
}
|
||||
};
|
||||
|
@ -54,10 +54,6 @@ class TracksPrefs final : public PrefsPanel
|
||||
static int iPreferencePinned;
|
||||
};
|
||||
|
||||
/// A PrefsPanelFactory that creates one TracksPrefs panel.
|
||||
class TracksPrefsFactory final : public PrefsPanelFactory
|
||||
{
|
||||
public:
|
||||
PrefsPanel *operator () (wxWindow *parent, wxWindowID winid) override;
|
||||
};
|
||||
/// A PrefsPanel::Factory that creates one TracksPrefs panel.
|
||||
extern PrefsPanel::Factory TracksPrefsFactory;
|
||||
#endif
|
||||
|
@ -106,8 +106,9 @@ bool WarningsPrefs::Commit()
|
||||
return true;
|
||||
}
|
||||
|
||||
PrefsPanel *WarningsPrefsFactory::operator () (wxWindow *parent, wxWindowID winid)
|
||||
PrefsPanel::Factory
|
||||
WarningsPrefsFactory = [](wxWindow *parent, wxWindowID winid)
|
||||
{
|
||||
wxASSERT(parent); // to justify safenew
|
||||
return safenew WarningsPrefs(parent, winid);
|
||||
}
|
||||
};
|
||||
|
@ -37,10 +37,6 @@ class WarningsPrefs final : public PrefsPanel
|
||||
void PopulateOrExchange(ShuttleGui & S) override;
|
||||
};
|
||||
|
||||
/// A PrefsPanelFactory that creates one WarningPrefs panel.
|
||||
class WarningsPrefsFactory final : public PrefsPanelFactory
|
||||
{
|
||||
public:
|
||||
PrefsPanel *operator () (wxWindow *parent, wxWindowID winid) override;
|
||||
};
|
||||
/// A PrefsPanel::Factory that creates one WarningPrefs panel.
|
||||
extern PrefsPanel::Factory WarningsPrefsFactory;
|
||||
#endif
|
||||
|
@ -247,13 +247,12 @@ EVT_CHOICE(ID_RANGE, WaveformPrefs::OnControl)
|
||||
EVT_CHECKBOX(ID_DEFAULTS, WaveformPrefs::OnDefaults)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
WaveformPrefsFactory::WaveformPrefsFactory(WaveTrack *wt)
|
||||
: mWt(wt)
|
||||
PrefsPanel::Factory
|
||||
WaveformPrefsFactory(WaveTrack *wt)
|
||||
{
|
||||
}
|
||||
|
||||
PrefsPanel *WaveformPrefsFactory::operator () (wxWindow *parent, wxWindowID winid)
|
||||
return [=](wxWindow *parent, wxWindowID winid)
|
||||
{
|
||||
wxASSERT(parent); // to justify safenew
|
||||
return safenew WaveformPrefs(parent, winid, mWt);
|
||||
return safenew WaveformPrefs(parent, winid, wt);
|
||||
};
|
||||
}
|
||||
|
@ -63,14 +63,8 @@ private:
|
||||
bool mPopulating;
|
||||
};
|
||||
|
||||
/// A PrefsPanelFactory that creates one WaveformPrefs panel.
|
||||
class WaveformPrefsFactory final : public PrefsPanelFactory
|
||||
{
|
||||
public:
|
||||
explicit WaveformPrefsFactory(WaveTrack *wt = 0);
|
||||
PrefsPanel *operator () (wxWindow *parent, wxWindowID winid) override;
|
||||
|
||||
private:
|
||||
WaveTrack *const mWt;
|
||||
};
|
||||
/// A PrefsPanel::Factory that creates one WaveformPrefs panel.
|
||||
/// This factory can be parametrized by a single track, to change settings
|
||||
/// non-globally
|
||||
extern PrefsPanel::Factory WaveformPrefsFactory(WaveTrack *wt);
|
||||
#endif
|
||||
|
@ -781,13 +781,10 @@ void WaveTrackMenuTable::OnSpectrogramSettings(wxCommandEvent &)
|
||||
}
|
||||
|
||||
WaveTrack *const pTrack = static_cast<WaveTrack*>(mpData->pTrack);
|
||||
// WaveformPrefsFactory waveformFactory(pTrack);
|
||||
// TracksBehaviorsPrefsFactory tracksBehaviorsFactory();
|
||||
SpectrumPrefsFactory spectrumFactory(pTrack);
|
||||
|
||||
PrefsDialog::Factories factories;
|
||||
// factories.push_back(&waveformFactory);
|
||||
factories.push_back(&spectrumFactory);
|
||||
// factories.push_back(WaveformPrefsFactory( pTrack ));
|
||||
factories.push_back(SpectrumPrefsFactory( pTrack ));
|
||||
const int page =
|
||||
// (pTrack->GetDisplay() == WaveTrack::Spectrum) ? 1 :
|
||||
0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user