diff --git a/src/ShuttleGui.cpp b/src/ShuttleGui.cpp index fabef008e..bfa23a1e5 100644 --- a/src/ShuttleGui.cpp +++ b/src/ShuttleGui.cpp @@ -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 ); diff --git a/src/ShuttleGui.h b/src/ShuttleGui.h index 3e74ec829..48501a36c 100644 --- a/src/ShuttleGui.h +++ b/src/ShuttleGui.h @@ -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, diff --git a/src/commands/GetInfoCommand.cpp b/src/commands/GetInfoCommand.cpp index 3c7d5c471..f8b8671a6 100644 --- a/src/commands/GetInfoCommand.cpp +++ b/src/commands/GetInfoCommand.cpp @@ -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, diff --git a/src/prefs/DirectoriesPrefs.cpp b/src/prefs/DirectoriesPrefs.cpp index 232f72829..5b27c8239 100644 --- a/src/prefs/DirectoriesPrefs.cpp +++ b/src/prefs/DirectoriesPrefs.cpp @@ -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); diff --git a/src/prefs/EffectsPrefs.cpp b/src/prefs/EffectsPrefs.cpp index 709be0494..65836314e 100644 --- a/src/prefs/EffectsPrefs.cpp +++ b/src/prefs/EffectsPrefs.cpp @@ -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, diff --git a/src/prefs/MidiIOPrefs.cpp b/src/prefs/MidiIOPrefs.cpp index 512c60cb2..8e61a405c 100644 --- a/src/prefs/MidiIOPrefs.cpp +++ b/src/prefs/MidiIOPrefs.cpp @@ -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); } diff --git a/src/prefs/RecordingPrefs.cpp b/src/prefs/RecordingPrefs.cpp index ca6a70155..564a41993 100644 --- a/src/prefs/RecordingPrefs.cpp +++ b/src/prefs/RecordingPrefs.cpp @@ -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);