Patch from 'Norm C' (n_badger42@hotmail.com) to remember default lengths of Silence and Tones generated.

This commit is contained in:
martynshaw99 2011-12-20 00:05:54 +00:00
parent 389235ceb2
commit e6c93bc1e5
2 changed files with 19 additions and 3 deletions

View File

@ -26,6 +26,7 @@
#include "Silence.h" #include "Silence.h"
#include "../WaveTrack.h" #include "../WaveTrack.h"
#include "../TimeDialog.h" #include "../TimeDialog.h"
#include "../Prefs.h"
bool EffectSilence::PromptUser() bool EffectSilence::PromptUser()
{ {
@ -37,9 +38,9 @@ bool EffectSilence::PromptUser()
// there is a selection: let's fit in there... // there is a selection: let's fit in there...
mDuration = mT1 - mT0; mDuration = mT1 - mT0;
dlog.SetFormatString(_("hh:mm:ss + samples")); dlog.SetFormatString(_("hh:mm:ss + samples"));
} else { } else {
// retrieve last used values // Retrieve last used values
gPrefs->Read(wxT("/Effects/SilenceGen/Duration"), &mDuration, 30L);
dlog.SetFormatString(_("seconds")); dlog.SetFormatString(_("seconds"));
} }
dlog.SetTimeValue(mDuration); dlog.SetTimeValue(mDuration);
@ -48,6 +49,11 @@ bool EffectSilence::PromptUser()
return false; return false;
mDuration = dlog.GetTimeValue(); mDuration = dlog.GetTimeValue();
/* Save last used values.
Save duration unless value was got from selection, so we save only
when user explicitly set up a value */
if (mT1 == mT0)
gPrefs->Write(wxT("/Effects/SilenceGen/Duration"), mDuration);
return true; return true;
} }

View File

@ -29,6 +29,7 @@ frequency changes smoothly during the tone.
#include "../Project.h" #include "../Project.h"
#include "../ShuttleGui.h" #include "../ShuttleGui.h"
#include "../WaveTrack.h" #include "../WaveTrack.h"
#include "../Prefs.h"
#include <wx/choice.h> #include <wx/choice.h>
#include <wx/intl.h> #include <wx/intl.h>
@ -79,7 +80,11 @@ bool EffectToneGen::PromptUser()
mDuration = mT1 - mT0; mDuration = mT1 - mT0;
dlog.isSelection= true; dlog.isSelection= true;
} }
else {
// Retrieve last used values
gPrefs->Read(wxT("/Effects/ToneGen/Duration"), &mDuration, 30L);
}
dlog.mbChirp = mbChirp; dlog.mbChirp = mbChirp;
dlog.waveform = waveform; dlog.waveform = waveform;
dlog.frequency[0] = frequency[0]; dlog.frequency[0] = frequency[0];
@ -114,6 +119,11 @@ bool EffectToneGen::PromptUser()
amplitude[1] = amplitude[0]; amplitude[1] = amplitude[0];
} }
mDuration = dlog.mDuration; mDuration = dlog.mDuration;
/* Save last used values.
Save duration unless value was got from selection, so we save only
when user explicitly set up a value */
if (mT1 == mT0)
gPrefs->Write(wxT("/Effects/ToneGen/Duration"), mDuration);
return true; return true;
} }