1
0
mirror of https://github.com/cookiengineer/audacity synced 2026-04-05 22:07:42 +02:00

Define Setting classes, bundling config path with settings value...

... the intention being, that no string literal for a path, or its default
value, shall ever occur twice in the code, relying on long-distance coincidence
of literal values.  Instead, a named Setting object is constructed once, then
read and written.

For now, the Tie... functions in ShuttleGuiBase will take references to
implicitly constructed temporary Setting objects.  But all should later be
made static objects, and the constructors made explicit.
This commit is contained in:
Paul Licameli
2019-04-03 11:27:15 -04:00
parent b6c7b744f8
commit 5fef82dccf
9 changed files with 240 additions and 52 deletions

View File

@@ -1815,7 +1815,7 @@ bool ShuttleGuiBase::DoStep( int iStep )
/// between gui and stack variable and stack variable and shuttle.
wxCheckBox * ShuttleGuiBase::TieCheckBox(
const TranslatableString &Prompt,
const SettingSpec< bool > &Setting)
const BoolSetting &Setting)
{
wxCheckBox * pCheck=NULL;
@@ -1832,7 +1832,7 @@ wxCheckBox * ShuttleGuiBase::TieCheckBox(
/// between gui and stack variable and stack variable and shuttle.
wxCheckBox * ShuttleGuiBase::TieCheckBoxOnRight(
const TranslatableString &Prompt,
const SettingSpec< bool > &Setting)
const BoolSetting & Setting)
{
wxCheckBox * pCheck=NULL;
@@ -1849,7 +1849,7 @@ wxCheckBox * ShuttleGuiBase::TieCheckBoxOnRight(
/// between gui and stack variable and stack variable and shuttle.
wxSlider * ShuttleGuiBase::TieSlider(
const TranslatableString &Prompt,
const SettingSpec< int > &Setting,
const IntSetting & Setting,
const int max,
const int min)
{
@@ -1868,7 +1868,7 @@ wxSlider * ShuttleGuiBase::TieSlider(
/// between gui and stack variable and stack variable and shuttle.
wxSpinCtrl * ShuttleGuiBase::TieSpinCtrl(
const TranslatableString &Prompt,
const SettingSpec< int > &Setting,
const IntSetting &Setting,
const int max,
const int min)
{
@@ -1887,7 +1887,7 @@ wxSpinCtrl * ShuttleGuiBase::TieSpinCtrl(
/// between gui and stack variable and stack variable and shuttle.
wxTextCtrl * ShuttleGuiBase::TieTextBox(
const TranslatableString & Prompt,
const SettingSpec< wxString > &Setting,
const StringSetting & Setting,
const int nChars)
{
wxTextCtrl * pText=(wxTextCtrl*)NULL;
@@ -1905,7 +1905,7 @@ wxTextCtrl * ShuttleGuiBase::TieTextBox(
/// This one does it for double values...
wxTextCtrl * ShuttleGuiBase::TieIntegerTextBox(
const TranslatableString & Prompt,
const SettingSpec< int > &Setting,
const IntSetting &Setting,
const int nChars)
{
wxTextCtrl * pText=(wxTextCtrl*)NULL;
@@ -1923,7 +1923,7 @@ wxTextCtrl * ShuttleGuiBase::TieIntegerTextBox(
/// This one does it for double values...
wxTextCtrl * ShuttleGuiBase::TieNumericTextBox(
const TranslatableString & Prompt,
const SettingSpec< double > &Setting,
const DoubleSetting & Setting,
const int nChars)
{
wxTextCtrl * pText=(wxTextCtrl*)NULL;
@@ -1984,7 +1984,7 @@ wxChoice *ShuttleGuiBase::TieChoice(
/// if null, then use 0, 1, 2, ...
wxChoice * ShuttleGuiBase::TieNumberAsChoice(
const TranslatableString &Prompt,
const SettingSpec< int > &Setting,
const IntSetting & Setting,
const TranslatableStrings & Choices,
const std::vector<int> * pInternalChoices,
int iNoMatchSelector)