1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-07-30 15:39:27 +02:00

Some preliminaries for improved management of preferences

This commit is contained in:
Paul Licameli 2019-11-28 13:31:41 -05:00
commit 5616137a8b
23 changed files with 346 additions and 320 deletions

View File

@ -1125,7 +1125,7 @@ void ShuttleGuiBase::DoDataShuttle( const wxString &Name, WrappedType & WrappedR
// they bind to (i.e. WrappedType).
// The type specific versions are much shorter and are later
// in this file.
wxCheckBox * ShuttleGuiBase::TieCheckBox(const wxString &Prompt, WrappedType & WrappedRef)
wxCheckBox * ShuttleGuiBase::DoTieCheckBox(const wxString &Prompt, WrappedType & WrappedRef)
{
HandleOptionality( Prompt );
// The Add function does a UseUpId(), so don't do it here in that case.
@ -1167,7 +1167,7 @@ wxCheckBox * ShuttleGuiBase::TieCheckBox(const wxString &Prompt, WrappedType & W
return pCheckBox;
}
wxCheckBox * ShuttleGuiBase::TieCheckBoxOnRight(const wxString &Prompt, WrappedType & WrappedRef)
wxCheckBox * ShuttleGuiBase::DoTieCheckBoxOnRight(const wxString &Prompt, WrappedType & WrappedRef)
{
HandleOptionality( Prompt );
// The Add function does a UseUpId(), so don't do it here in that case.
@ -1209,7 +1209,7 @@ wxCheckBox * ShuttleGuiBase::TieCheckBoxOnRight(const wxString &Prompt, WrappedT
return pCheckBox;
}
wxSpinCtrl * ShuttleGuiBase::TieSpinCtrl( const wxString &Prompt, WrappedType & WrappedRef, const int max, const int min )
wxSpinCtrl * ShuttleGuiBase::DoTieSpinCtrl( const wxString &Prompt, WrappedType & WrappedRef, const int max, const int min )
{
HandleOptionality( Prompt );
// The Add function does a UseUpId(), so don't do it here in that case.
@ -1252,7 +1252,7 @@ wxSpinCtrl * ShuttleGuiBase::TieSpinCtrl( const wxString &Prompt, WrappedType &
return pSpinCtrl;
}
wxTextCtrl * ShuttleGuiBase::TieTextBox( const wxString &Prompt, WrappedType & WrappedRef, const int nChars)
wxTextCtrl * ShuttleGuiBase::DoTieTextBox( const wxString &Prompt, WrappedType & WrappedRef, const int nChars)
{
HandleOptionality( Prompt );
// The Add function does a UseUpId(), so don't do it here in that case.
@ -1295,7 +1295,7 @@ wxTextCtrl * ShuttleGuiBase::TieTextBox( const wxString &Prompt, WrappedType & W
return pTextBox;
}
wxTextCtrl * ShuttleGuiBase::TieNumericTextBox( const wxString &Prompt, WrappedType & WrappedRef, const int nChars)
wxTextCtrl * ShuttleGuiBase::DoTieNumericTextBox( const wxString &Prompt, WrappedType & WrappedRef, const int nChars)
{
HandleOptionality( Prompt );
// The Add function does a UseUpId(), so don't do it here in that case.
@ -1338,7 +1338,7 @@ wxTextCtrl * ShuttleGuiBase::TieNumericTextBox( const wxString &Prompt, WrappedT
return pTextBox;
}
wxSlider * ShuttleGuiBase::TieSlider( const wxString &Prompt, WrappedType & WrappedRef, const int max, int min )
wxSlider * ShuttleGuiBase::DoTieSlider( const wxString &Prompt, WrappedType & WrappedRef, const int max, int min )
{
HandleOptionality( Prompt );
// The Add function does a UseUpId(), so don't do it here in that case.
@ -1385,7 +1385,7 @@ wxSlider * ShuttleGuiBase::TieSlider( const wxString &Prompt, WrappedType & Wrap
}
wxChoice * ShuttleGuiBase::TieChoice(
wxChoice * ShuttleGuiBase::DoTieChoice(
const wxString &Prompt,
WrappedType &WrappedRef,
const wxArrayStringEx &choices )
@ -1548,7 +1548,7 @@ void ShuttleGuiBase::EndRadioButtonGroup()
wxCheckBox * ShuttleGuiBase::TieCheckBox(const wxString &Prompt, bool &Var)
{
WrappedType WrappedRef( Var );
return TieCheckBox( Prompt, WrappedRef );
return DoTieCheckBox( Prompt, WrappedRef );
}
// See comment in AddCheckBoxOnRight() for why we have this variant.
@ -1558,55 +1558,55 @@ wxCheckBox * ShuttleGuiBase::TieCheckBoxOnRight(const wxString &Prompt, bool &Va
WrappedType WrappedRef( Var );
if( mShuttleMode == eIsCreating )
return AddCheckBoxOnRight( Prompt, WrappedRef.ReadAsString() == wxT("true") );
return TieCheckBox( Prompt, WrappedRef );
return DoTieCheckBox( Prompt, WrappedRef );
}
wxSpinCtrl * ShuttleGuiBase::TieSpinCtrl( const wxString &Prompt, int &Value, const int max, const int min )
{
WrappedType WrappedRef(Value);
return TieSpinCtrl( Prompt, WrappedRef, max, min );
return DoTieSpinCtrl( Prompt, WrappedRef, max, min );
}
wxTextCtrl * ShuttleGuiBase::TieTextBox( const wxString &Prompt, wxString &Selected, const int nChars)
{
WrappedType WrappedRef(Selected);
return TieTextBox( Prompt, WrappedRef, nChars );
return DoTieTextBox( Prompt, WrappedRef, nChars );
}
wxTextCtrl * ShuttleGuiBase::TieTextBox( const wxString &Prompt, int &Selected, const int nChars)
{
WrappedType WrappedRef( Selected );
return TieTextBox( Prompt, WrappedRef, nChars );
return DoTieTextBox( Prompt, WrappedRef, nChars );
}
wxTextCtrl * ShuttleGuiBase::TieTextBox( const wxString &Prompt, double &Value, const int nChars)
{
WrappedType WrappedRef( Value );
return TieTextBox( Prompt, WrappedRef, nChars );
return DoTieTextBox( Prompt, WrappedRef, nChars );
}
wxTextCtrl * ShuttleGuiBase::TieNumericTextBox( const wxString &Prompt, int &Value, const int nChars)
{
WrappedType WrappedRef( Value );
return TieNumericTextBox( Prompt, WrappedRef, nChars );
return DoTieNumericTextBox( Prompt, WrappedRef, nChars );
}
wxTextCtrl * ShuttleGuiBase::TieNumericTextBox( const wxString &Prompt, double &Value, const int nChars)
{
WrappedType WrappedRef( Value );
return TieNumericTextBox( Prompt, WrappedRef, nChars );
return DoTieNumericTextBox( Prompt, WrappedRef, nChars );
}
wxSlider * ShuttleGuiBase::TieSlider( const wxString &Prompt, int &pos, const int max, const int min )
{
WrappedType WrappedRef( pos );
return TieSlider( Prompt, WrappedRef, max, min );
return DoTieSlider( Prompt, WrappedRef, max, min );
}
wxSlider * ShuttleGuiBase::TieSlider( const wxString &Prompt, double &pos, const double max, const double min )
{
WrappedType WrappedRef( pos );
return TieSlider( Prompt, WrappedRef, max, min );
return DoTieSlider( Prompt, WrappedRef, max, min );
}
wxSlider * ShuttleGuiBase::TieSlider( const wxString &Prompt, float &pos, const float fMin, const float fMax)
@ -1636,7 +1636,7 @@ wxChoice * ShuttleGuiBase::TieChoice(
const wxArrayStringEx &choices )
{
WrappedType WrappedRef( Selected );
return TieChoice( Prompt, WrappedRef, choices );
return DoTieChoice( Prompt, WrappedRef, choices );
}
wxChoice * ShuttleGuiBase::TieChoice(
@ -1645,7 +1645,7 @@ wxChoice * ShuttleGuiBase::TieChoice(
const wxArrayStringEx &choices )
{
WrappedType WrappedRef( Selected );
return TieChoice( Prompt, WrappedRef, choices );
return DoTieChoice( Prompt, WrappedRef, choices );
}
//-----------------------------------------------------------------------//
@ -1751,16 +1751,15 @@ bool ShuttleGuiBase::DoStep( int iStep )
/// between gui and stack variable and stack variable and shuttle.
wxCheckBox * ShuttleGuiBase::TieCheckBox(
const wxString &Prompt,
const wxString &SettingName,
const bool bDefault)
const SettingSpec< bool > &Setting)
{
wxCheckBox * pCheck=NULL;
bool bValue=bDefault;
WrappedType WrappedRef( bValue );
if( DoStep(1) ) DoDataShuttle( SettingName, WrappedRef );
if( DoStep(2) ) pCheck = TieCheckBox( Prompt, WrappedRef );
if( DoStep(3) ) DoDataShuttle( SettingName, WrappedRef );
auto Value = Setting.GetDefault();
WrappedType WrappedRef( Value );
if( DoStep(1) ) DoDataShuttle( Setting.GetPath(), WrappedRef );
if( DoStep(2) ) pCheck = DoTieCheckBox( Prompt, WrappedRef );
if( DoStep(3) ) DoDataShuttle( Setting.GetPath(), WrappedRef );
return pCheck;
}
@ -1769,16 +1768,15 @@ wxCheckBox * ShuttleGuiBase::TieCheckBox(
/// between gui and stack variable and stack variable and shuttle.
wxCheckBox * ShuttleGuiBase::TieCheckBoxOnRight(
const wxString &Prompt,
const wxString &SettingName,
const bool bDefault)
const SettingSpec< bool > &Setting)
{
wxCheckBox * pCheck=NULL;
bool bValue=bDefault;
WrappedType WrappedRef( bValue );
if( DoStep(1) ) DoDataShuttle( SettingName, WrappedRef );
if( DoStep(2) ) pCheck = TieCheckBoxOnRight( Prompt, WrappedRef );
if( DoStep(3) ) DoDataShuttle( SettingName, WrappedRef );
auto Value = Setting.GetDefault();
WrappedType WrappedRef( Value );
if( DoStep(1) ) DoDataShuttle( Setting.GetPath(), WrappedRef );
if( DoStep(2) ) pCheck = DoTieCheckBoxOnRight( Prompt, WrappedRef );
if( DoStep(3) ) DoDataShuttle( Setting.GetPath(), WrappedRef );
return pCheck;
}
@ -1787,18 +1785,17 @@ wxCheckBox * ShuttleGuiBase::TieCheckBoxOnRight(
/// between gui and stack variable and stack variable and shuttle.
wxSlider * ShuttleGuiBase::TieSlider(
const wxString &Prompt,
const wxString &SettingName,
const int iDefault,
const SettingSpec< int > &Setting,
const int max,
const int min)
{
wxSlider * pSlider=NULL;
int iValue=iDefault;
WrappedType WrappedRef( iValue );
if( DoStep(1) ) DoDataShuttle( SettingName, WrappedRef );
if( DoStep(2) ) pSlider = TieSlider( Prompt, WrappedRef, max, min );
if( DoStep(3) ) DoDataShuttle( SettingName, WrappedRef );
auto Value = Setting.GetDefault();
WrappedType WrappedRef( Value );
if( DoStep(1) ) DoDataShuttle( Setting.GetPath(), WrappedRef );
if( DoStep(2) ) pSlider = DoTieSlider( Prompt, WrappedRef, max, min );
if( DoStep(3) ) DoDataShuttle( Setting.GetPath(), WrappedRef );
return pSlider;
}
@ -1807,18 +1804,17 @@ wxSlider * ShuttleGuiBase::TieSlider(
/// between gui and stack variable and stack variable and shuttle.
wxSpinCtrl * ShuttleGuiBase::TieSpinCtrl(
const wxString &Prompt,
const wxString &SettingName,
const int Value,
const SettingSpec< int > &Setting,
const int max,
const int min)
{
wxSpinCtrl * pSpinCtrl=NULL;
int iValue = Value;
WrappedType WrappedRef( iValue );
if( DoStep(1) ) DoDataShuttle( SettingName, WrappedRef );
if( DoStep(2) ) pSpinCtrl = TieSpinCtrl( Prompt, WrappedRef, max, min );
if( DoStep(3) ) DoDataShuttle( SettingName, WrappedRef );
auto Value = Setting.GetDefault();
WrappedType WrappedRef( Value );
if( DoStep(1) ) DoDataShuttle( Setting.GetPath(), WrappedRef );
if( DoStep(2) ) pSpinCtrl = DoTieSpinCtrl( Prompt, WrappedRef, max, min );
if( DoStep(3) ) DoDataShuttle( Setting.GetPath(), WrappedRef );
return pSpinCtrl;
}
@ -1827,17 +1823,34 @@ wxSpinCtrl * ShuttleGuiBase::TieSpinCtrl(
/// between gui and stack variable and stack variable and shuttle.
wxTextCtrl * ShuttleGuiBase::TieTextBox(
const wxString & Prompt,
const wxString & SettingName,
const wxString & Default,
const SettingSpec< wxString > &Setting,
const int nChars)
{
wxTextCtrl * pText=(wxTextCtrl*)NULL;
wxString Temp = Default;
WrappedType WrappedRef( Temp );
if( DoStep(1) ) DoDataShuttle( SettingName, WrappedRef );
if( DoStep(2) ) pText = TieTextBox( Prompt, WrappedRef, nChars );
if( DoStep(3) ) DoDataShuttle( SettingName, WrappedRef );
auto Value = Setting.GetDefault();
WrappedType WrappedRef( Value );
if( DoStep(1) ) DoDataShuttle( Setting.GetPath(), WrappedRef );
if( DoStep(2) ) pText = DoTieTextBox( Prompt, WrappedRef, nChars );
if( DoStep(3) ) DoDataShuttle( Setting.GetPath(), WrappedRef );
return pText;
}
/// Variant of the standard TieTextBox which does the two step exchange
/// between gui and stack variable and stack variable and shuttle.
/// This one does it for double values...
wxTextCtrl * ShuttleGuiBase::TieIntegerTextBox(
const wxString & Prompt,
const SettingSpec< int > &Setting,
const int nChars)
{
wxTextCtrl * pText=(wxTextCtrl*)NULL;
auto Value = Setting.GetDefault();
WrappedType WrappedRef( Value );
if( DoStep(1) ) DoDataShuttle( Setting.GetPath(), WrappedRef );
if( DoStep(2) ) pText = DoTieNumericTextBox( Prompt, WrappedRef, nChars );
if( DoStep(3) ) DoDataShuttle( Setting.GetPath(), WrappedRef );
return pText;
}
@ -1846,17 +1859,16 @@ wxTextCtrl * ShuttleGuiBase::TieTextBox(
/// This one does it for double values...
wxTextCtrl * ShuttleGuiBase::TieNumericTextBox(
const wxString & Prompt,
const wxString & SettingName,
const double & Default,
const SettingSpec< double > &Setting,
const int nChars)
{
wxTextCtrl * pText=(wxTextCtrl*)NULL;
double Temp = Default;
WrappedType WrappedRef( Temp );
if( DoStep(1) ) DoDataShuttle( SettingName, WrappedRef );
if( DoStep(2) ) pText = TieNumericTextBox( Prompt, WrappedRef, nChars );
if( DoStep(3) ) DoDataShuttle( SettingName, WrappedRef );
auto Value = Setting.GetDefault();
WrappedType WrappedRef( Value );
if( DoStep(1) ) DoDataShuttle( Setting.GetPath(), WrappedRef );
if( DoStep(2) ) pText = DoTieNumericTextBox( Prompt, WrappedRef, nChars );
if( DoStep(3) ) DoDataShuttle( Setting.GetPath(), WrappedRef );
return pText;
}
@ -1910,8 +1922,7 @@ wxChoice *ShuttleGuiBase::TieChoice(
/// if null, then use 0, 1, 2, ...
wxChoice * ShuttleGuiBase::TieNumberAsChoice(
const wxString &Prompt,
const wxString &SettingName,
const int Default,
const SettingSpec< int > &Setting,
const wxArrayStringEx & Choices,
const std::vector<int> * pInternalChoices)
{
@ -1925,6 +1936,7 @@ wxChoice * ShuttleGuiBase::TieNumberAsChoice(
for ( int ii = 0; ii < Choices.size(); ++ii )
InternalChoices.push_back( fn( ii ) );
const auto Default = Setting.GetDefault();
long defaultIndex;
if ( pInternalChoices )
defaultIndex = make_iterator_range( *pInternalChoices ).index( Default );
@ -1933,8 +1945,8 @@ wxChoice * ShuttleGuiBase::TieNumberAsChoice(
if ( defaultIndex < 0 || defaultIndex >= Choices.size() )
defaultIndex = -1;
ChoiceSetting Setting{
SettingName,
ChoiceSetting choiceSetting{
Setting.GetPath(),
{
ByColumns,
Choices,
@ -1943,7 +1955,7 @@ wxChoice * ShuttleGuiBase::TieNumberAsChoice(
defaultIndex
};
return ShuttleGuiBase::TieChoice( Prompt, Setting );
return ShuttleGuiBase::TieChoice( Prompt, choiceSetting );
}
//------------------------------------------------------------------//

View File

@ -15,6 +15,7 @@
#define SHUTTLE_GUI
#include "Audacity.h"
#include "audacity/Types.h"
#include <vector>
#include <wx/slider.h> // to inherit
@ -103,6 +104,20 @@ using wxStaticBoxWrapper = wxStaticBox;
using wxSliderWrapper = wxSlider;
#endif
template< typename T > class SettingSpec {
public:
SettingSpec( const RegistryPath &path, const T &defaultValue = {} )
: mPath{ path }, mDefaultValue{ defaultValue }
{}
const RegistryPath &GetPath() const { return mPath; }
const T &GetDefault() const { return mDefaultValue; }
private:
RegistryPath mPath;
T mDefaultValue;
};
class AUDACITY_DLL_API ShuttleGuiBase /* not final */
{
public:
@ -178,34 +193,25 @@ public:
void StartRadioButtonGroup( const ChoiceSetting &Setting );
void EndRadioButtonGroup();
void DoDataShuttle( const wxString &Name, WrappedType & WrappedRef );
bool DoStep( int iStep );
int TranslateToIndex( const wxString &Value, const wxArrayStringEx &Choices );
wxString TranslateFromIndex( const int nIn, const wxArrayStringEx &Choices );
//-- Tie functions both add controls and also read/write to them.
// The ones taking a 'WrappedType' are type-generic and are used by the type specific ones.
wxTextCtrl * TieTextBox( const wxString &Prompt, WrappedType & WrappedRef, const int nChars);
wxTextCtrl * TieTextBox( const wxString &Caption, wxString & Value, const int nChars=0);
wxTextCtrl * TieTextBox( const wxString &Prompt, int &Selected, const int nChars=0);
wxTextCtrl * TieTextBox( const wxString &Prompt, double &Value, const int nChars=0);
wxTextCtrl * TieNumericTextBox( const wxString &Prompt, WrappedType & WrappedRef, const int nChars);
wxTextCtrl * TieNumericTextBox( const wxString &Prompt, int &Value, const int nChars=0);
wxTextCtrl * TieNumericTextBox( const wxString &Prompt, double &Value, const int nChars=0);
wxCheckBox * TieCheckBox( const wxString &Prompt, WrappedType & WrappedRef );
wxCheckBox * TieCheckBox( const wxString &Prompt, bool & Var );
wxCheckBox * TieCheckBoxOnRight( const wxString & Prompt, WrappedType & WrappedRef );
wxCheckBox * TieCheckBoxOnRight( const wxString & Prompt, bool & Var );
wxChoice * TieChoice( const wxString &Prompt, WrappedType & WrappedRef, const wxArrayStringEx &choices );
wxChoice * TieChoice( const wxString &Prompt, wxString &Selected, const wxArrayStringEx &choices );
wxChoice * TieChoice( const wxString &Prompt, int &Selected, const wxArrayStringEx &choices );
wxSlider * TieSlider( const wxString &Prompt, WrappedType & WrappedRef, const int max, const int min = 0 );
wxSlider * TieSlider( const wxString &Prompt, int &pos, const int max, const int min = 0);
wxSlider * TieSlider( const wxString &Prompt, double &pos, const double max, const double min = 0.0);
wxSlider * TieSlider( const wxString &Prompt, float &pos, const float fMin, const float fMax);
@ -215,7 +221,6 @@ public:
// and as many times as there are values in the enumeration.
wxRadioButton * TieRadioButton();
wxSpinCtrl * TieSpinCtrl( const wxString &Prompt, WrappedType & WrappedRef, const int max, const int min = 0 );
wxSpinCtrl * TieSpinCtrl( const wxString &Prompt, int &Value, const int max, const int min = 0 );
@ -225,12 +230,10 @@ public:
// so it doesn't need an argument that is writeable.
virtual wxCheckBox * TieCheckBox(
const wxString &Prompt,
const wxString &SettingName,
const bool bDefault);
const SettingSpec< bool > &Setting);
virtual wxCheckBox * TieCheckBoxOnRight(
const wxString &Prompt,
const wxString &SettingName,
const bool bDefault);
const SettingSpec< bool > &Setting);
virtual wxChoice *TieChoice(
const wxString &Prompt,
@ -243,31 +246,30 @@ public:
// emitting scripting information about Preferences.
virtual wxChoice * TieNumberAsChoice(
const wxString &Prompt,
const wxString &SettingName,
const int Default,
const SettingSpec< int > &Setting,
const wxArrayStringEx & Choices,
const std::vector<int> * pInternalChoices = nullptr );
virtual wxTextCtrl * TieTextBox(
const wxString &Prompt,
const wxString &SettingName,
const wxString &Default,
const SettingSpec< wxString > &Setting,
const int nChars);
virtual wxTextCtrl * TieIntegerTextBox(
const wxString & Prompt,
const SettingSpec< int > &Setting,
const int nChars);
virtual wxTextCtrl * TieNumericTextBox(
const wxString & Prompt,
const wxString & SettingName,
const double & Default,
const SettingSpec< double > &Setting,
const int nChars);
virtual wxSlider * TieSlider(
const wxString & Prompt,
const wxString & SettingName,
const int iDefault,
const SettingSpec< int > &Setting,
const int max,
const int min = 0);
virtual wxSpinCtrl * TieSpinCtrl(
const wxString &Prompt,
const wxString &SettingName,
const int Value,
const SettingSpec< int > &Setting,
const int max,
const int min);
//-- End of variants.
@ -344,6 +346,15 @@ protected:
wxMenu * mpMenu;
private:
void DoDataShuttle( const wxString &Name, WrappedType & WrappedRef );
wxCheckBox * DoTieCheckBoxOnRight( const wxString & Prompt, WrappedType & WrappedRef );
wxTextCtrl * DoTieTextBox( const wxString &Prompt, WrappedType & WrappedRef, const int nChars);
wxTextCtrl * DoTieNumericTextBox( const wxString &Prompt, WrappedType & WrappedRef, const int nChars);
wxCheckBox * DoTieCheckBox( const wxString &Prompt, WrappedType & WrappedRef );
wxChoice * DoTieChoice( const wxString &Prompt, WrappedType & WrappedRef, const wxArrayStringEx & choices );
wxSlider * DoTieSlider( const wxString &Prompt, WrappedType & WrappedRef, const int max, const int min = 0 );
wxSpinCtrl * DoTieSpinCtrl( const wxString &Prompt, WrappedType & WrappedRef, const int max, const int min = 0 );
const ChoiceSetting *mpRadioSetting = nullptr;
wxString mRadioSettingName; /// The setting controlled by a group.
Maybe<WrappedType> mRadioValue; /// The wrapped value associated with the active radio button.

View File

@ -55,7 +55,7 @@ void SoundActivatedRecord::PopulateOrExchange(ShuttleGui & S)
S.StartMultiColumn(2, wxEXPAND);
S.SetStretchyCol(1);
dBRange = gPrefs->Read(ENV_DB_KEY, ENV_DB_RANGE);
S.TieSlider(_("Activation level (dB):"), wxT("/AudioIO/SilenceLevel"), -50, 0, -dBRange);
S.TieSlider(_("Activation level (dB):"), {wxT("/AudioIO/SilenceLevel"), -50}, 0, -dBRange);
S.EndMultiColumn();
}
S.EndVerticalLay();

View File

@ -200,40 +200,37 @@ public:
wxCheckBox * TieCheckBox(
const wxString &Prompt,
const wxString &SettingName,
const bool bDefault) override;
const SettingSpec< bool > &Setting) override;
wxCheckBox * TieCheckBoxOnRight(
const wxString &Prompt,
const wxString &SettingName,
const bool bDefault) override;
const SettingSpec< bool > &Setting) override;
wxChoice * TieNumberAsChoice(
const wxString &Prompt,
const wxString &SettingName,
const int Default,
const SettingSpec< int > &Setting,
const wxArrayStringEx & Choices,
const std::vector<int> * pInternalChoices) override;
wxTextCtrl * TieTextBox(
const wxString &Prompt,
const wxString &SettingName,
const wxString &Default,
const SettingSpec< wxString > &Setting,
const int nChars) override;
wxTextCtrl * TieIntegerTextBox(
const wxString & Prompt,
const SettingSpec< int > &Setting,
const int nChars) override;
wxTextCtrl * TieNumericTextBox(
const wxString & Prompt,
const wxString & SettingName,
const double & Default,
const SettingSpec< double > &Setting,
const int nChars) override;
wxSlider * TieSlider(
const wxString & Prompt,
const wxString & SettingName,
const int iDefault,
const SettingSpec< int > &Setting,
const int max,
const int min = 0) override;
wxSpinCtrl * TieSpinCtrl(
const wxString &Prompt,
const wxString &SettingName,
const int Value,
const SettingSpec< int > &Setting,
const int max,
const int min) override;
};
@ -251,34 +248,31 @@ ShuttleGuiGetDefinition::~ShuttleGuiGetDefinition(void)
wxCheckBox * ShuttleGuiGetDefinition::TieCheckBox(
const wxString &Prompt,
const wxString &SettingName,
const bool bDefault)
{
const SettingSpec< bool > &Setting)
{
StartStruct();
AddItem( SettingName, "id" );
AddItem( Setting.GetPath(), "id" );
AddItem( Prompt, "prompt" );
AddItem( "bool", "type" );
AddBool( bDefault, "default" );
AddBool( Setting.GetDefault(), "default" );
EndStruct();
return ShuttleGui::TieCheckBox( Prompt, SettingName, bDefault );
return ShuttleGui::TieCheckBox( Prompt, Setting );
}
wxCheckBox * ShuttleGuiGetDefinition::TieCheckBoxOnRight(
const wxString &Prompt,
const wxString &SettingName,
const bool bDefault)
const SettingSpec< bool > &Setting)
{
StartStruct();
AddItem( SettingName, "id" );
AddItem( Setting.GetPath(), "id" );
AddItem( Prompt, "prompt" );
AddItem( "bool", "type" );
AddBool( bDefault, "default" );
AddBool( Setting.GetDefault(), "default" );
EndStruct();
return ShuttleGui::TieCheckBoxOnRight( Prompt, SettingName, bDefault );
return ShuttleGui::TieCheckBoxOnRight( Prompt, Setting );
}
wxChoice * ShuttleGuiGetDefinition::TieNumberAsChoice(
const wxString &Prompt,
const wxString &SettingName,
const int Default,
const SettingSpec< int > &Setting,
const wxArrayStringEx & Choices,
const std::vector<int> * pInternalChoices)
{
@ -286,71 +280,80 @@ wxChoice * ShuttleGuiGetDefinition::TieNumberAsChoice(
// numbers, with an associated control that allows arbitrary entry of an
// "Other..."
StartStruct();
AddItem( SettingName, "id" );
AddItem( Setting.GetPath(), "id" );
AddItem( Prompt, "prompt" );
AddItem( "number", "type" ); // not "enum" !
AddItem( Default, "default" );
AddItem( Setting.GetDefault(), "default" );
EndStruct();
return ShuttleGui::TieNumberAsChoice(
Prompt, SettingName, Default, Choices, pInternalChoices );
Prompt, Setting, Choices, pInternalChoices );
}
wxTextCtrl * ShuttleGuiGetDefinition::TieTextBox(
const wxString &Prompt,
const wxString &SettingName,
const wxString &Default,
const int nChars)
const SettingSpec< wxString > &Setting,
const int nChars)
{
StartStruct();
AddItem( SettingName, "id" );
AddItem( Setting.GetPath(), "id" );
AddItem( Prompt, "prompt" );
AddItem( "string", "type" );
AddItem( Default, "default" );
AddItem( Setting.GetDefault(), "default" );
EndStruct();
return ShuttleGui::TieTextBox( Prompt, SettingName, Default, nChars );
return ShuttleGui::TieTextBox( Prompt, Setting, nChars );
}
wxTextCtrl * ShuttleGuiGetDefinition::TieIntegerTextBox(
const wxString & Prompt,
const SettingSpec< int > &Setting,
const int nChars)
{
StartStruct();
AddItem( Setting.GetPath(), "id" );
AddItem( Prompt, "prompt" );
AddItem( "number", "type" );
AddItem( Setting.GetDefault(), "default" );
EndStruct();
return ShuttleGui::TieIntegerTextBox( Prompt, Setting, nChars );
}
wxTextCtrl * ShuttleGuiGetDefinition::TieNumericTextBox(
const wxString & Prompt,
const wxString & SettingName,
const double & Default,
const int nChars)
const SettingSpec< double > &Setting,
const int nChars)
{
StartStruct();
AddItem( SettingName, "id" );
AddItem( Setting.GetPath(), "id" );
AddItem( Prompt, "prompt" );
AddItem( "number", "type" );
AddItem( Default, "default" );
AddItem( Setting.GetDefault(), "default" );
EndStruct();
return ShuttleGui::TieNumericTextBox( Prompt, SettingName, Default, nChars );
return ShuttleGui::TieNumericTextBox( Prompt, Setting, nChars );
}
wxSlider * ShuttleGuiGetDefinition::TieSlider(
const wxString & Prompt,
const wxString & SettingName,
const int iDefault,
const SettingSpec< int > &Setting,
const int max,
const int min)
{
StartStruct();
AddItem( SettingName, "id" );
AddItem( Setting.GetPath(), "id" );
AddItem( Prompt, "prompt" );
AddItem( "number", "type" );
AddItem( iDefault, "default" );
AddItem( Setting.GetDefault(), "default" );
EndStruct();
return ShuttleGui::TieSlider( Prompt, SettingName, iDefault, max, min );
return ShuttleGui::TieSlider( Prompt, Setting, max, min );
}
wxSpinCtrl * ShuttleGuiGetDefinition::TieSpinCtrl(
const wxString &Prompt,
const wxString &SettingName,
const int Value,
const SettingSpec< int > &Setting,
const int max,
const int min)
{
StartStruct();
AddItem( SettingName, "id" );
AddItem( Setting.GetPath(), "id" );
AddItem( Prompt, "prompt" );
AddItem( "number", "type" );
AddItem( Value, "default" );
AddItem( Setting.GetDefault(), "default" );
EndStruct();
return ShuttleGui::TieSpinCtrl( Prompt, SettingName, Value, max, min );
return ShuttleGui::TieSpinCtrl( Prompt, Setting, max, min );
}
}

View File

@ -126,8 +126,8 @@ void ExportCLOptions::PopulateOrExchange(ShuttleGui & S)
wxALIGN_CENTER_VERTICAL);
S.AddFixedText( {} );
S.TieCheckBox(_("Show output"),
wxT("/FileFormats/ExternalProgramShowOutput"),
false);
{wxT("/FileFormats/ExternalProgramShowOutput"),
false});
}
S.EndMultiColumn();
}

View File

@ -216,8 +216,8 @@ void ExportFFmpegAC3Options::PopulateOrExchange(ShuttleGui & S)
{
S.TieNumberAsChoice(
_("Bit Rate:"),
wxT("/FileFormats/AC3BitRate"),
160000,
{wxT("/FileFormats/AC3BitRate"),
160000},
AC3BitRateNames,
&AC3BitRateValues
);
@ -278,7 +278,7 @@ void ExportFFmpegAACOptions::PopulateOrExchange(ShuttleGui & S)
S.StartMultiColumn(2, wxCENTER);
{
S.SetStretchyCol(1);
S.Prop(1).TieSlider(_("Quality (kbps):"),wxT("/FileFormats/AACQuality"),160,320,98);
S.Prop(1).TieSlider(_("Quality (kbps):"), {wxT("/FileFormats/AACQuality"), 160},320, 98);
}
S.EndMultiColumn();
}
@ -367,8 +367,8 @@ void ExportFFmpegAMRNBOptions::PopulateOrExchange(ShuttleGui & S)
{
S.TieNumberAsChoice(
_("Bit Rate:"),
wxT("/FileFormats/AMRNBBitRate"),
12200,
{wxT("/FileFormats/AMRNBBitRate"),
12200},
AMRNBBitRateNames,
&AMRNBBitRateValues
);
@ -469,8 +469,8 @@ void ExportFFmpegWMAOptions::PopulateOrExchange(ShuttleGui & S)
{
S.TieNumberAsChoice(
_("Bit Rate:"),
wxT("/FileFormats/WMABitRate"),
128000,
{wxT("/FileFormats/WMABitRate"),
128000},
WMABitRateNames,
&WMABitRateValues
);
@ -1579,33 +1579,33 @@ void ExportFFmpegOptions::PopulateOrExchange(ShuttleGui & S)
{
S.StartMultiColumn(8, wxEXPAND);
{
mLanguageText = S.Id(FELanguageID).TieTextBox(_("Language:"), wxT("/FileFormats/FFmpegLanguage"), wxEmptyString, 9);
mLanguageText = S.Id(FELanguageID).TieTextBox(_("Language:"), {wxT("/FileFormats/FFmpegLanguage"), wxEmptyString}, 9);
mLanguageText->SetToolTip(_("ISO 639 3-letter language code\nOptional\nempty - automatic"));
S.AddSpace( 20,0 );
S.AddVariableText(_("Bit Reservoir"));
S.Id(FEBitReservoirID).TieCheckBox( {}, wxT("/FileFormats/FFmpegBitReservoir"), true);
S.Id(FEBitReservoirID).TieCheckBox( {}, {wxT("/FileFormats/FFmpegBitReservoir"), true});
S.AddSpace( 20,0 );
S.AddVariableText(_("VBL"));
S.Id(FEVariableBlockLenID).TieCheckBox( {}, wxT("/FileFormats/FFmpegVariableBlockLen"), true);
S.Id(FEVariableBlockLenID).TieCheckBox( {}, {wxT("/FileFormats/FFmpegVariableBlockLen"), true});
}
S.EndMultiColumn();
S.StartMultiColumn(4, wxALIGN_LEFT);
{
mTag = S.Id(FETagID).TieTextBox(_("Tag:"), wxT("/FileFormats/FFmpegTag"), wxEmptyString, 4);
mTag = S.Id(FETagID).TieTextBox(_("Tag:"), {wxT("/FileFormats/FFmpegTag"), wxEmptyString}, 4);
mTag->SetToolTip(_("Codec tag (FOURCC)\nOptional\nempty - automatic"));
mBitrateSpin = S.Id(FEBitrateID).TieSpinCtrl(_("Bit Rate:"), wxT("/FileFormats/FFmpegBitRate"), 0, 1000000, 0);
mBitrateSpin = S.Id(FEBitrateID).TieSpinCtrl(_("Bit Rate:"), {wxT("/FileFormats/FFmpegBitRate"), 0}, 1000000, 0);
mBitrateSpin->SetToolTip(_("Bit Rate (bits/second) - influences the resulting file size and quality\nSome codecs may only accept specific values (128k, 192k, 256k etc)\n0 - automatic\nRecommended - 192000"));
mQualitySpin = S.Id(FEQualityID).TieSpinCtrl(_("Quality:"), wxT("/FileFormats/FFmpegQuality"), 0, 500, -1);
mQualitySpin = S.Id(FEQualityID).TieSpinCtrl(_("Quality:"), {wxT("/FileFormats/FFmpegQuality"), 0}, 500, -1);
mQualitySpin->SetToolTip(_("Overall quality, used differently by different codecs\nRequired for vorbis\n0 - automatic\n-1 - off (use bitrate instead)"));
mSampleRateSpin = S.Id(FESampleRateID).TieSpinCtrl(_("Sample Rate:"), wxT("/FileFormats/FFmpegSampleRate"), 0, 200000, 0);
mSampleRateSpin = S.Id(FESampleRateID).TieSpinCtrl(_("Sample Rate:"), {wxT("/FileFormats/FFmpegSampleRate"), 0}, 200000, 0);
mSampleRateSpin->SetToolTip(_("Sample rate (Hz)\n0 - don't change sample rate"));
mCutoffSpin = S.Id(FECutoffID).TieSpinCtrl(_("Cutoff:"), wxT("/FileFormats/FFmpegCutOff"), 0, 10000000, 0);
mCutoffSpin = S.Id(FECutoffID).TieSpinCtrl(_("Cutoff:"), {wxT("/FileFormats/FFmpegCutOff"), 0}, 10000000, 0);
mCutoffSpin->SetToolTip(_("Audio cutoff bandwidth (Hz)\nOptional\n0 - automatic"));
mProfileChoice = S.Id(FEProfileID)
@ -1621,42 +1621,42 @@ void ExportFFmpegOptions::PopulateOrExchange(ShuttleGui & S)
{
S.StartMultiColumn(4, wxALIGN_LEFT);
{
mCompressionLevelSpin = S.Id(FECompLevelID).TieSpinCtrl(_("Compression:"), wxT("/FileFormats/FFmpegCompLevel"), 0, 10, -1);
mCompressionLevelSpin = S.Id(FECompLevelID).TieSpinCtrl(_("Compression:"), {wxT("/FileFormats/FFmpegCompLevel"), 0}, 10, -1);
mCompressionLevelSpin->SetToolTip(_("Compression level\nRequired for FLAC\n-1 - automatic\nmin - 0 (fast encoding, large output file)\nmax - 10 (slow encoding, small output file)"));
mFrameSizeSpin = S.Id(FEFrameSizeID).TieSpinCtrl(_("Frame:"), wxT("/FileFormats/FFmpegFrameSize"), 0, 65535, 0);
mFrameSizeSpin = S.Id(FEFrameSizeID).TieSpinCtrl(_("Frame:"), {wxT("/FileFormats/FFmpegFrameSize"), 0}, 65535, 0);
mFrameSizeSpin->SetToolTip(_("Frame size\nOptional\n0 - default\nmin - 16\nmax - 65535"));
mLPCCoeffsPrecisionSpin = S.Id(FELPCCoeffsID).TieSpinCtrl(_("LPC"), wxT("/FileFormats/FFmpegLPCCoefPrec"), 0, 15, 0);
mLPCCoeffsPrecisionSpin = S.Id(FELPCCoeffsID).TieSpinCtrl(_("LPC"), {wxT("/FileFormats/FFmpegLPCCoefPrec"), 0}, 15, 0);
mLPCCoeffsPrecisionSpin->SetToolTip(_("LPC coefficients precision\nOptional\n0 - default\nmin - 1\nmax - 15"));
mPredictionOrderMethodChoice = S.Id(FEPredOrderID)
.TieNumberAsChoice(
_("PdO Method:"),
wxT("/FileFormats/FFmpegPredOrderMethod"),
4, // Full search
{wxT("/FileFormats/FFmpegPredOrderMethod"),
4}, // Full search
PredictionOrderMethodNames
);
mPredictionOrderMethodChoice->SetSizeHints( 100,-1);
mPredictionOrderMethodChoice->SetToolTip(_("Prediction Order Method\nEstimate - fastest, lower compression\nLog search - slowest, best compression\nFull search - default"));
mMinPredictionOrderSpin = S.Id(FEMinPredID).TieSpinCtrl(_("Min. PdO"), wxT("/FileFormats/FFmpegMinPredOrder"), -1, 32, -1);
mMinPredictionOrderSpin = S.Id(FEMinPredID).TieSpinCtrl(_("Min. PdO"), {wxT("/FileFormats/FFmpegMinPredOrder"), -1}, 32, -1);
mMinPredictionOrderSpin->SetToolTip(_("Minimal prediction order\nOptional\n-1 - default\nmin - 0\nmax - 32 (with LPC) or 4 (without LPC)"));
mMaxPredictionOrderSpin = S.Id(FEMaxPredID).TieSpinCtrl(_("Max. PdO"), wxT("/FileFormats/FFmpegMaxPredOrder"), -1, 32, -1);
mMaxPredictionOrderSpin = S.Id(FEMaxPredID).TieSpinCtrl(_("Max. PdO"), {wxT("/FileFormats/FFmpegMaxPredOrder"), -1}, 32, -1);
mMaxPredictionOrderSpin->SetToolTip(_("Maximal prediction order\nOptional\n-1 - default\nmin - 0\nmax - 32 (with LPC) or 4 (without LPC)"));
mMinPartitionOrderSpin = S.Id(FEMinPartOrderID).TieSpinCtrl(_("Min. PtO"), wxT("/FileFormats/FFmpegMinPartOrder"), -1, 8, -1);
mMinPartitionOrderSpin = S.Id(FEMinPartOrderID).TieSpinCtrl(_("Min. PtO"), {wxT("/FileFormats/FFmpegMinPartOrder"), -1}, 8, -1);
mMinPartitionOrderSpin->SetToolTip(_("Minimal partition order\nOptional\n-1 - default\nmin - 0\nmax - 8"));
mMaxPartitionOrderSpin = S.Id(FEMaxPartOrderID).TieSpinCtrl(_("Max. PtO"), wxT("/FileFormats/FFmpegMaxPartOrder"), -1, 8, -1);
mMaxPartitionOrderSpin = S.Id(FEMaxPartOrderID).TieSpinCtrl(_("Max. PtO"), {wxT("/FileFormats/FFmpegMaxPartOrder"), -1}, 8, -1);
mMaxPartitionOrderSpin->SetToolTip(_("Maximal partition order\nOptional\n-1 - default\nmin - 0\nmax - 8"));
/* i18n-hint: Abbreviates "Linear Predictive Coding",
but this text needs to be kept very short */
S.AddVariableText(_("Use LPC"));
// PRL: This preference is not used anywhere!
S.Id(FEUseLPCID).TieCheckBox( {}, wxT("/FileFormats/FFmpegUseLPC"), true);
S.Id(FEUseLPCID).TieCheckBox( {}, {wxT("/FileFormats/FFmpegUseLPC"), true});
}
S.EndMultiColumn();
}
@ -1668,12 +1668,12 @@ void ExportFFmpegOptions::PopulateOrExchange(ShuttleGui & S)
/* i18n-hint: 'mux' is short for multiplexor, a device that selects between several inputs
'Mux Rate' is a parameter that has some bearing on compression ratio for MPEG
it has a hard to predict effect on the degree of compression */
mMuxRate = S.Id(FEMuxRateID).TieSpinCtrl(_("Mux Rate:"), wxT("/FileFormats/FFmpegMuxRate"), 0, 10000000, 0);
mMuxRate = S.Id(FEMuxRateID).TieSpinCtrl(_("Mux Rate:"), {wxT("/FileFormats/FFmpegMuxRate"), 0}, 10000000, 0);
mMuxRate->SetToolTip(_("Maximum bit rate of the multiplexed stream\nOptional\n0 - default"));
/* i18n-hint: 'Packet Size' is a parameter that has some bearing on compression ratio for MPEG
compression. It measures how big a chunk of audio is compressed in one piece. */
mPacketSize = S.Id(FEPacketSizeID).TieSpinCtrl(_("Packet Size:"), wxT("/FileFormats/FFmpegPacketSize"), 0, 10000000, 0);
mPacketSize = S.Id(FEPacketSizeID).TieSpinCtrl(_("Packet Size:"), {wxT("/FileFormats/FFmpegPacketSize"), 0}, 10000000, 0);
mPacketSize->SetToolTip(_("Packet size\nOptional\n0 - default"));
}
S.EndMultiColumn();

View File

@ -161,8 +161,8 @@ void ExportMP2Options::PopulateOrExchange(ShuttleGui & S)
{
S.TieNumberAsChoice(
_("Bit Rate:"),
wxT("/FileFormats/MP2Bitrate"),
160,
{wxT("/FileFormats/MP2Bitrate"),
160},
BitRateNames,
&BitRateValues
);

View File

@ -379,16 +379,14 @@ void ExportMP3Options::PopulateOrExchange(ShuttleGui & S)
mRate = S.Id(ID_QUALITY).TieNumberAsChoice(
_("Quality"),
wxT("/FileFormats/MP3Bitrate"),
defrate,
{ wxT("/FileFormats/MP3Bitrate"), defrate },
*choices,
codes
);
mMode = S.TieNumberAsChoice(
_("Variable Speed:"),
wxT("/FileFormats/MP3VarMode"),
ROUTINE_FAST,
{ wxT("/FileFormats/MP3VarMode"), ROUTINE_FAST },
varModeNames );
mMode->Enable(enable);

View File

@ -266,8 +266,8 @@ void ExportMultiple::PopulateOrExchange(ShuttleGui& S)
{
mDir = S.Id(DirID)
.TieTextBox(_("Folder:"),
wxT("/Export/MultiplePath"),
DefaultPath,
{wxT("/Export/MultiplePath"),
DefaultPath},
64);
S.Id(ChooseID).AddButton(_("Choose..."));
S.Id(CreateID).AddButton(_("Create"));
@ -395,8 +395,8 @@ void ExportMultiple::PopulateOrExchange(ShuttleGui& S)
S.StartHorizontalLay(wxEXPAND, false);
{
mOverwrite = S.Id(OverwriteID).TieCheckBox(_("Overwrite existing files"),
wxT("/Export/OverwriteExisting"),
false);
{wxT("/Export/OverwriteExisting"),
false});
}
S.EndHorizontalLay();

View File

@ -73,7 +73,7 @@ void BatchPrefs::PopulateOrExchange( ShuttleGui & S )
{
#ifdef __WXDEBUG__
S.TieCheckBox( _("&Don't apply effects in batch mode"),
wxT("/Batch/Debug"), false);
{wxT("/Batch/Debug"), false});
#endif
}
S.EndStatic();

View File

@ -186,15 +186,15 @@ void DevicePrefs::PopulateOrExchange(ShuttleGui & S)
// only show the following controls if we use Portaudio v19, because
// for Portaudio v18 we always use default buffer sizes
w = S.TieNumericTextBox(_("&Buffer length:"),
wxT("/AudioIO/LatencyDuration"),
DEFAULT_LATENCY_DURATION,
{wxT("/AudioIO/LatencyDuration"),
DEFAULT_LATENCY_DURATION},
9);
S.AddUnits(_("milliseconds"));
if( w ) w->SetName(w->GetName() + wxT(" ") + _("milliseconds"));
w = S.TieNumericTextBox(_("&Latency compensation:"),
wxT("/AudioIO/LatencyCorrection"),
DEFAULT_LATENCY_CORRECTION,
{wxT("/AudioIO/LatencyCorrection"),
DEFAULT_LATENCY_CORRECTION},
9);
S.AddUnits(_("milliseconds"));
if( w ) w->SetName(w->GetName() + wxT(" ") + _("milliseconds"));

View File

@ -104,8 +104,8 @@ void DirectoriesPrefs::PopulateOrExchange(ShuttleGui & S)
S.Id(TempDirID);
mTempDir = S.TieTextBox(_("&Location:"),
wxT("/Directories/TempDir"),
wxT(""),
{wxT("/Directories/TempDir"),
wxT("")},
30);
}
S.EndMultiColumn();
@ -130,7 +130,7 @@ void DirectoriesPrefs::PopulateOrExchange(ShuttleGui & S)
S.StartTwoColumn();
{
S.TieNumericTextBox(_("Mi&nimum Free Memory (MB):"),
S.TieIntegerTextBox(_("Mi&nimum Free Memory (MB):"),
wxT("/Directories/CacheLowMem"),
16,
9);

View File

@ -188,8 +188,8 @@ void EffectsPrefs::PopulateOrExchange(ShuttleGui & S)
{
S.TieCheckBox(
GetCustomTranslation( entry.prompt ),
entry.setting,
true
{entry.setting,
true}
);
}
}
@ -202,13 +202,14 @@ void EffectsPrefs::PopulateOrExchange(ShuttleGui & S)
wxChoice *c = S.TieChoice( _("S&ort or Group:"), EffectsGroupBy);
if( c ) c->SetMinSize(c->GetBestSize());
S.TieNumericTextBox(_("&Maximum effects per group (0 to disable):"),
wxT("/Effects/MaxPerGroup"),
S.TieIntegerTextBox(_("&Maximum effects per group (0 to disable):"),
{wxT("/Effects/MaxPerGroup"),
#if defined(__WXGTK__)
15,
15
#else
0,
0
#endif
},
5);
}
S.EndMultiColumn();

View File

@ -104,8 +104,8 @@ void ExtImportPrefs::PopulateOrExchange(ShuttleGui & S)
S.StartScroller();
S.TieCheckBox(_("A&ttempt to use filter in OpenFile dialog first"),
wxT("/ExtendedImport/OverrideExtendedImportByOpenFileDialogChoice"),
true);
{wxT("/ExtendedImport/OverrideExtendedImportByOpenFileDialogChoice"),
true});
S.StartStatic(_("Rules to choose import filters"), 1);
{
S.SetSizerProportion(1);

View File

@ -227,32 +227,32 @@ void GUIPrefs::PopulateOrExchange(ShuttleGui & S)
{
// Start wording of options with a verb, if possible.
S.TieCheckBox(_("Show 'How to Get &Help' at launch"),
wxT("/GUI/ShowSplashScreen"),
true);
{wxT("/GUI/ShowSplashScreen"),
true});
S.TieCheckBox(_("Show e&xtra menus"),
wxT("/GUI/ShowExtraMenus"),
false);
{wxT("/GUI/ShowExtraMenus"),
false});
#ifdef EXPERIMENTAL_THEME_PREFS
// We do not want to make this option mainstream. It's a
// convenience for developers.
S.TieCheckBox(_("Show alternative &styling (Mac vs PC)"),
wxT("/GUI/ShowMac"),
false);
{wxT("/GUI/ShowMac"),
false});
#endif
S.TieCheckBox(_("&Beep on completion of longer activities"),
wxT("/GUI/BeepOnCompletion"),
false);
{wxT("/GUI/BeepOnCompletion"),
false});
S.TieCheckBox(_("Re&tain labels if selection snaps to a label"),
wxT("/GUI/RetainLabels"),
false);
{wxT("/GUI/RetainLabels"),
false});
S.TieCheckBox(_("B&lend system and Audacity theme"),
wxT("/GUI/BlendThemes"),
true);
{wxT("/GUI/BlendThemes"),
true});
#ifndef __WXMAC__
/* i18n-hint: RTL stands for 'Right to Left' */
S.TieCheckBox(_("Use mostly Left-to-Right layouts in RTL languages"),
"/GUI/RtlWorkaround",
true);
{"/GUI/RtlWorkaround",
true});
#endif
}
S.EndStatic();

View File

@ -118,12 +118,12 @@ void ImportExportPrefs::PopulateOrExchange(ShuttleGui & S)
S.EndRadioButtonGroup();
S.TieCheckBox(_("S&how Metadata Tags editor before export"),
wxT("/AudioFiles/ShowId3Dialog"),
true);
{wxT("/AudioFiles/ShowId3Dialog"),
true});
/* i18n-hint 'blank space' is space on the tracks with no audio in it*/
S.TieCheckBox(_("&Ignore blank space at the beginning"),
wxT("/AudioFiles/SkipSilenceAtBeginning"),
false);
{wxT("/AudioFiles/SkipSilenceAtBeginning"),
false});
}
S.EndStatic();
#ifdef USE_MIDI

View File

@ -158,9 +158,9 @@ void MidiIOPrefs::PopulateOrExchange( ShuttleGui & S ) {
S.Id(PlayID);
mPlay = S.AddChoice(_("&Device:"),
{} );
mLatency = S.TieNumericTextBox(_("MIDI Synth L&atency (ms):"),
wxT("/MidiIO/SynthLatency"),
DEFAULT_SYNTH_LATENCY, 3);
mLatency = S.TieIntegerTextBox(_("MIDI Synth L&atency (ms):"),
{wxT("/MidiIO/SynthLatency"),
DEFAULT_SYNTH_LATENCY}, 3);
}
S.EndMultiColumn();
}

View File

@ -87,8 +87,8 @@ void PlaybackPrefs::PopulateOrExchange(ShuttleGui & S)
S.StartThreeColumn();
{
w = S.TieNumericTextBox(_("&Length:"),
wxT("/AudioIO/EffectsPreviewLen"),
6.0,
{wxT("/AudioIO/EffectsPreviewLen"),
6.0},
9);
S.AddUnits(_("seconds"));
if( w ) w->SetName(w->GetName() + wxT(" ") + _("seconds"));
@ -103,15 +103,15 @@ void PlaybackPrefs::PopulateOrExchange(ShuttleGui & S)
S.StartThreeColumn();
{
w = S.TieNumericTextBox(_("&Before cut region:"),
wxT("/AudioIO/CutPreviewBeforeLen"),
2.0,
{wxT("/AudioIO/CutPreviewBeforeLen"),
2.0},
9);
S.AddUnits(_("seconds"));
if( w ) w->SetName(w->GetName() + wxT(" ") + _("seconds"));
w = S.TieNumericTextBox(_("&After cut region:"),
wxT("/AudioIO/CutPreviewAfterLen"),
1.0,
{wxT("/AudioIO/CutPreviewAfterLen"),
1.0},
9);
S.AddUnits(_("seconds"));
if( w ) w->SetName(w->GetName() + wxT(" ") + _("seconds"));
@ -125,15 +125,15 @@ void PlaybackPrefs::PopulateOrExchange(ShuttleGui & S)
S.StartThreeColumn();
{
w = S.TieNumericTextBox(_("&Short period:"),
wxT("/AudioIO/SeekShortPeriod"),
1.0,
{wxT("/AudioIO/SeekShortPeriod"),
1.0},
9);
S.AddUnits(_("seconds"));
if( w ) w->SetName(w->GetName() + wxT(" ") + _("seconds"));
w = S.TieNumericTextBox(_("Lo&ng period:"),
wxT("/AudioIO/SeekLongPeriod"),
15.0,
{wxT("/AudioIO/SeekLongPeriod"),
15.0},
9);
S.AddUnits(_("seconds"));
if( w ) w->SetName(w->GetName() + wxT(" ") + _("seconds"));
@ -146,11 +146,11 @@ void PlaybackPrefs::PopulateOrExchange(ShuttleGui & S)
{
S.StartVerticalLay();
{
S.TieCheckBox(_("&Vari-Speed Play"), "/AudioIO/VariSpeedPlay", true);
S.TieCheckBox(_("&Micro-fades"), "/AudioIO/Microfades", false);
S.TieCheckBox(_("&Vari-Speed Play"), {"/AudioIO/VariSpeedPlay", true});
S.TieCheckBox(_("&Micro-fades"), {"/AudioIO/Microfades", false});
S.TieCheckBox(_("Always scrub un&pinned"),
UnpinnedScrubbingPreferenceKey(),
UnpinnedScrubbingPreferenceDefault());
{UnpinnedScrubbingPreferenceKey(),
UnpinnedScrubbingPreferenceDefault()});
}
S.EndVerticalLay();
}

View File

@ -154,8 +154,8 @@ void QualityPrefs::PopulateOrExchange(ShuttleGui & S)
S.Id(ID_SAMPLE_RATE_CHOICE);
// We make sure we have a pointer to it, so that we can drive it.
mSampleRates = S.TieNumberAsChoice( {},
wxT("/SamplingRate/DefaultProjectSampleRate"),
AudioIOBase::GetOptimalSupportedSampleRate(),
{wxT("/SamplingRate/DefaultProjectSampleRate"),
AudioIOBase::GetOptimalSupportedSampleRate()},
mSampleRateNames,
&mSampleRateLabels);

View File

@ -88,35 +88,36 @@ void RecordingPrefs::PopulateOrExchange(ShuttleGui & S)
{
// Start wording of options with a verb, if possible.
S.TieCheckBox(_("Play &other tracks while recording (overdub)"),
wxT("/AudioIO/Duplex"),
{wxT("/AudioIO/Duplex"),
#ifdef EXPERIMENTAL_DA
false);
false
#else
true);
true
#endif
});
//#if defined(__WXMAC__)
// Bug 388. Feature not supported on any Mac Hardware.
#if 0
S.TieCheckBox(_("Use &hardware to play other tracks"),
wxT("/AudioIO/Playthrough"),
false);
{wxT("/AudioIO/Playthrough"),
false});
#endif
S.TieCheckBox(_("&Software playthrough of input"),
wxT("/AudioIO/SWPlaythrough"),
false);
{wxT("/AudioIO/SWPlaythrough"),
false});
#if !defined(__WXMAC__)
//S.AddUnits(wxString(wxT(" ")) + _("(uncheck when recording computer playback)"));
#endif
S.TieCheckBox(_("Record on a new track"),
wxT("/GUI/PreferNewTrackRecord"),
false);
{wxT("/GUI/PreferNewTrackRecord"),
false});
/* i18n-hint: Dropout is a loss of a short sequence audio sample data from the recording */
S.TieCheckBox(_("Detect dropouts"),
WarningDialogKey(wxT("DropoutDetected")),
true);
{WarningDialogKey(wxT("DropoutDetected")),
true});
}
@ -125,8 +126,8 @@ void RecordingPrefs::PopulateOrExchange(ShuttleGui & S)
S.StartStatic(_("Sound Activated Recording"));
{
S.TieCheckBox(_("&Enable"),
wxT("/AudioIO/SoundActivatedRecord"),
false);
{wxT("/AudioIO/SoundActivatedRecord"),
false});
S.StartMultiColumn(2, wxEXPAND);
{
@ -134,8 +135,8 @@ void RecordingPrefs::PopulateOrExchange(ShuttleGui & S)
int dBRange = gPrefs->Read(ENV_DB_KEY, ENV_DB_RANGE);
S.TieSlider(_("Le&vel (dB):"),
wxT("/AudioIO/SilenceLevel"),
-50,
{wxT("/AudioIO/SilenceLevel"),
-50},
0,
-dBRange);
}
@ -154,12 +155,12 @@ void RecordingPrefs::PopulateOrExchange(ShuttleGui & S)
S.StartMultiColumn(3);
{
S.Id(UseCustomTrackNameID).TieCheckBox(_("Custom Track &Name"),
wxT("/GUI/TrackNames/RecordingNameCustom"),
mUseCustomTrackName ? true : false);
{wxT("/GUI/TrackNames/RecordingNameCustom"),
mUseCustomTrackName});
mToggleCustomName = S.TieTextBox( {},
wxT("/GUI/TrackNames/RecodingTrackName"),
_("Recorded_Audio"),
{wxT("/GUI/TrackNames/RecodingTrackName"),
_("Recorded_Audio")},
30);
if( mToggleCustomName ) {
mToggleCustomName->SetName(_("Custom name text"));
@ -172,16 +173,16 @@ void RecordingPrefs::PopulateOrExchange(ShuttleGui & S)
S.StartMultiColumn(3);
{
S.TieCheckBox(_("&Track Number"),
wxT("/GUI/TrackNames/TrackNumber"),
false);
{wxT("/GUI/TrackNames/TrackNumber"),
false});
S.TieCheckBox(_("System &Date"),
wxT("/GUI/TrackNames/DateStamp"),
false);
{wxT("/GUI/TrackNames/DateStamp"),
false});
S.TieCheckBox(_("System T&ime"),
wxT("/GUI/TrackNames/TimeStamp"),
false);
{wxT("/GUI/TrackNames/TimeStamp"),
false});
}
S.EndMultiColumn();
}
@ -193,8 +194,8 @@ void RecordingPrefs::PopulateOrExchange(ShuttleGui & S)
S.StartStatic(_("Automated Recording Level Adjustment"));
{
S.TieCheckBox(_("Enable Automated Recording Level Adjustment."),
wxT("/AudioIO/AutomatedInputLevelAdjustment"),
false);
{wxT("/AudioIO/AutomatedInputLevelAdjustment"),
false});
S.StartMultiColumn(2, wxEXPAND);
{
@ -202,14 +203,14 @@ void RecordingPrefs::PopulateOrExchange(ShuttleGui & S)
/* i18n-hint: Desired maximum (peak) volume for sound */
S.TieSlider(_("Target Peak:"),
wxT("/AudioIO/TargetPeak"),
AILA_DEF_TARGET_PEAK,
{wxT("/AudioIO/TargetPeak"),
AILA_DEF_TARGET_PEAK},
100,
0);
S.TieSlider(_("Within:"),
wxT("/AudioIO/DeltaPeakVolume"),
AILA_DEF_DELTA_PEAK,
{wxT("/AudioIO/DeltaPeakVolume"),
AILA_DEF_DELTA_PEAK},
100,
0);
}
@ -217,15 +218,15 @@ void RecordingPrefs::PopulateOrExchange(ShuttleGui & S)
S.StartThreeColumn();
{
S.TieNumericTextBox(_("Analysis Time:"),
wxT("/AudioIO/AnalysisTime"),
AILA_DEF_ANALYSIS_TIME,
S.TieIntegerTextBox(_("Analysis Time:"),
{wxT("/AudioIO/AnalysisTime"),
AILA_DEF_ANALYSIS_TIME},
9);
S.AddUnits(_("milliseconds (time of one analysis)"));
S.TieNumericTextBox(_("Number of consecutive analysis:"),
wxT("/AudioIO/NumberAnalysis"),
AILA_DEF_NUMBER_ANALYSIS,
S.TieIntegerTextBox(_("Number of consecutive analysis:"),
{wxT("/AudioIO/NumberAnalysis"),
AILA_DEF_NUMBER_ANALYSIS},
2);
S.AddUnits(_("0 means endless"));
}
@ -240,16 +241,16 @@ void RecordingPrefs::PopulateOrExchange(ShuttleGui & S)
S.StartThreeColumn();
{
auto w = S.TieNumericTextBox(_("Pre-ro&ll:"),
AUDIO_PRE_ROLL_KEY,
DEFAULT_PRE_ROLL_SECONDS,
{AUDIO_PRE_ROLL_KEY,
DEFAULT_PRE_ROLL_SECONDS},
9);
S.AddUnits(_("seconds"));
w->SetName(w->GetName() + wxT(" ") + _("seconds"));
}
{
auto w = S.TieNumericTextBox(_("Cross&fade:"),
AUDIO_ROLL_CROSSFADE_KEY,
DEFAULT_ROLL_CROSSFADE_MS,
{AUDIO_ROLL_CROSSFADE_KEY,
DEFAULT_ROLL_CROSSFADE_MS},
9);
S.AddUnits(_("milliseconds"));
w->SetName(w->GetName() + wxT(" ") + _("milliseconds"));

View File

@ -81,35 +81,35 @@ void TracksBehaviorsPrefs::PopulateOrExchange(ShuttleGui & S)
S.StartStatic(_("Behaviors"));
{
S.TieCheckBox(_("&Select all audio, if selection required"),
wxT("/GUI/SelectAllOnNone"),
false);
{wxT("/GUI/SelectAllOnNone"),
false});
/* i18n-hint: Cut-lines are lines that can expand to show the cut audio.*/
S.TieCheckBox(_("Enable cut &lines"),
wxT("/GUI/EnableCutLines"),
false);
{wxT("/GUI/EnableCutLines"),
false});
S.TieCheckBox(_("Enable &dragging selection edges"),
wxT("/GUI/AdjustSelectionEdges"),
true);
{wxT("/GUI/AdjustSelectionEdges"),
true});
S.TieCheckBox(_("Editing a clip can &move other clips"),
wxT("/GUI/EditClipCanMove"),
true);
{wxT("/GUI/EditClipCanMove"),
true});
S.TieCheckBox(_("\"Move track focus\" c&ycles repeatedly through tracks"),
wxT("/GUI/CircularTrackNavigation"),
false);
{wxT("/GUI/CircularTrackNavigation"),
false});
S.TieCheckBox(_("&Type to create a label"),
wxT("/GUI/TypeToCreateLabel"),
false);
{wxT("/GUI/TypeToCreateLabel"),
false});
S.TieCheckBox(_("Use dialog for the &name of a new label"),
wxT("/GUI/DialogForNameNewLabel"),
false);
{wxT("/GUI/DialogForNameNewLabel"),
false});
#ifdef EXPERIMENTAL_SCROLLING_LIMITS
S.TieCheckBox(_("Enable scrolling left of &zero"),
ScrollingPreferenceKey(),
ScrollingPreferenceDefault());
{ScrollingPreferenceKey(),
ScrollingPreferenceDefault()});
#endif
S.TieCheckBox(_("Advanced &vertical zooming"),
wxT("/GUI/VerticalZooming"),
false);
{wxT("/GUI/VerticalZooming"),
false});
S.AddSpace(10);

View File

@ -268,24 +268,24 @@ void TracksPrefs::PopulateOrExchange(ShuttleGui & S)
S.StartStatic(_("Display"));
{
S.TieCheckBox(_("Auto-&fit track height"),
wxT("/GUI/TracksFitVerticallyZoomed"),
false);
{wxT("/GUI/TracksFitVerticallyZoomed"),
false});
S.TieCheckBox(_("Sho&w audio track name as overlay"),
wxT("/GUI/ShowTrackNameInWaveform"),
false);
{wxT("/GUI/ShowTrackNameInWaveform"),
false});
#ifdef EXPERIMENTAL_HALF_WAVE
S.TieCheckBox(_("Use &half-wave display when collapsed"),
wxT("/GUI/CollapseToHalfWave"),
false);
{wxT("/GUI/CollapseToHalfWave"),
false});
#endif
#ifdef SHOW_PINNED_UNPINNED_IN_PREFS
S.TieCheckBox(_("&Pinned Recording/Playback head"),
PinnedHeadPreferenceKey(),
PinnedHeadPreferenceDefault());
{PinnedHeadPreferenceKey(),
PinnedHeadPreferenceDefault()});
#endif
S.TieCheckBox(_("A&uto-scroll if head unpinned"),
wxT("/GUI/AutoScroll"),
true);
{wxT("/GUI/AutoScroll"),
true});
S.AddSpace(10);
@ -306,8 +306,8 @@ void TracksPrefs::PopulateOrExchange(ShuttleGui & S)
sampleDisplaySetting );
S.TieTextBox(_("Default audio track &name:"),
wxT("/GUI/TrackNames/DefaultTrackName"),
_("Audio Track"),
{wxT("/GUI/TrackNames/DefaultTrackName"),
_("Audio Track")},
30);
}
S.EndMultiColumn();

View File

@ -70,27 +70,27 @@ void WarningsPrefs::PopulateOrExchange(ShuttleGui & S)
S.StartStatic(_("Show Warnings/Prompts for"));
{
S.TieCheckBox(_("Saving &projects"),
wxT("/Warnings/FirstProjectSave"),
true);
{wxT("/Warnings/FirstProjectSave"),
true});
S.TieCheckBox(_("Saving &empty project"),
wxT("/GUI/EmptyCanBeDirty"),
true);
{wxT("/GUI/EmptyCanBeDirty"),
true});
S.TieCheckBox(_("&Low disk space at launch or new project"),
wxT("/Warnings/DiskSpaceWarning"),
true);
{wxT("/Warnings/DiskSpaceWarning"),
true});
S.TieCheckBox(_("Mixing down to &mono during export"),
wxT("/Warnings/MixMono"),
true);
{wxT("/Warnings/MixMono"),
true});
S.TieCheckBox(_("Mixing down to &stereo during export"),
wxT("/Warnings/MixStereo"),
true);
{wxT("/Warnings/MixStereo"),
true});
S.TieCheckBox(_("Mixing down on export (&Custom FFmpeg or external program)"),
wxT("/Warnings/MixUnknownChannels"),
true);
{wxT("/Warnings/MixUnknownChannels"),
true});
#ifdef EXPERIMENTAL_OD_DATA
S.TieCheckBox(_("&Importing uncompressed audio files"),
wxT("/Warnings/CopyOrEditUncompressedDataAsk"),
true);
{wxT("/Warnings/CopyOrEditUncompressedDataAsk"),
true});
#endif
}
S.EndStatic();