1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-09-19 17:40:51 +02:00

Separate function TieIntegerTextBox...

... For the cases in which there is an associated preference variable which
should be a whole number
This commit is contained in:
Paul Licameli 2019-04-01 08:30:06 -04:00
parent 7fbe97c5ca
commit 7675d51044
7 changed files with 49 additions and 6 deletions

View File

@ -1841,6 +1841,25 @@ wxTextCtrl * ShuttleGuiBase::TieTextBox(
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 wxString & SettingName,
const int & Default,
const int nChars)
{
wxTextCtrl * pText=(wxTextCtrl*)NULL;
auto Temp = Default;
WrappedType WrappedRef( Temp );
if( DoStep(1) ) DoDataShuttle( SettingName, WrappedRef );
if( DoStep(2) ) pText = DoTieNumericTextBox( Prompt, WrappedRef, nChars );
if( DoStep(3) ) DoDataShuttle( SettingName, 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...
@ -1852,7 +1871,7 @@ wxTextCtrl * ShuttleGuiBase::TieNumericTextBox(
{
wxTextCtrl * pText=(wxTextCtrl*)NULL;
double Temp = Default;
auto Temp = Default;
WrappedType WrappedRef( Temp );
if( DoStep(1) ) DoDataShuttle( SettingName, WrappedRef );
if( DoStep(2) ) pText = DoTieNumericTextBox( Prompt, WrappedRef, nChars );

View File

@ -243,6 +243,11 @@ public:
const wxString &SettingName,
const wxString &Default,
const int nChars);
virtual wxTextCtrl * TieIntegerTextBox(
const wxString & Prompt,
const wxString & SettingName,
const int & Default,
const int nChars);
virtual wxTextCtrl * TieNumericTextBox(
const wxString & Prompt,
const wxString & SettingName,

View File

@ -219,6 +219,11 @@ public:
const wxString &SettingName,
const wxString &Default,
const int nChars) override;
wxTextCtrl * TieIntegerTextBox(
const wxString & Prompt,
const wxString & SettingName,
const int & Default,
const int nChars) override;
wxTextCtrl * TieNumericTextBox(
const wxString & Prompt,
const wxString & SettingName,
@ -308,6 +313,20 @@ wxTextCtrl * ShuttleGuiGetDefinition::TieTextBox(
EndStruct();
return ShuttleGui::TieTextBox( Prompt, SettingName, Default, nChars );
}
wxTextCtrl * ShuttleGuiGetDefinition::TieIntegerTextBox(
const wxString & Prompt,
const wxString & SettingName,
const int & Default,
const int nChars)
{
StartStruct();
AddItem( SettingName, "id" );
AddItem( Prompt, "prompt" );
AddItem( "number", "type" );
AddItem( Default, "default" );
EndStruct();
return ShuttleGui::TieIntegerTextBox( Prompt, SettingName, Default, nChars );
}
wxTextCtrl * ShuttleGuiGetDefinition::TieNumericTextBox(
const wxString & Prompt,
const wxString & SettingName,

View File

@ -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

@ -202,7 +202,7 @@ 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):"),
S.TieIntegerTextBox(_("&Maximum effects per group (0 to disable):"),
wxT("/Effects/MaxPerGroup"),
#if defined(__WXGTK__)
15,

View File

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

View File

@ -217,13 +217,13 @@ void RecordingPrefs::PopulateOrExchange(ShuttleGui & S)
S.StartThreeColumn();
{
S.TieNumericTextBox(_("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:"),
S.TieIntegerTextBox(_("Number of consecutive analysis:"),
wxT("/AudioIO/NumberAnalysis"),
AILA_DEF_NUMBER_ANALYSIS,
2);