mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-20 14:20:06 +02:00
Fix defaults for unchosen optional values.
Previously when using a scriptable via dialog the unchosen optional values from the dialog were still being used. Now unchosen options are reset to their default values, if they would be used.
This commit is contained in:
parent
975e95abad
commit
2f89c57b18
@ -81,6 +81,16 @@ void DragCommand::PopulateOrExchange(ShuttleGui & S)
|
||||
|
||||
bool DragCommand::Apply(const CommandContext & context)
|
||||
{
|
||||
// Defaults if no value...
|
||||
if( !bHasFromX )
|
||||
mFromX = 200.0;
|
||||
if( !bHasFromY )
|
||||
mFromY = 10;
|
||||
if( !bHasToX )
|
||||
mToX = 400;
|
||||
if( !bHasToY )
|
||||
mToY = 10;
|
||||
|
||||
wxWindow * pWin = context.GetProject();
|
||||
wxWindow * pWin1 = nullptr;
|
||||
wxMouseEvent Evt( wxEVT_MOTION );
|
||||
|
@ -88,6 +88,14 @@ bool SelectTimeCommand::Apply(const CommandContext & context){
|
||||
if( !bHasT0 && !bHasT1 )
|
||||
return true;
|
||||
|
||||
// Defaults if no value...
|
||||
if( !bHasT0 )
|
||||
mT0 = 0.0;
|
||||
if( !bHasT1 )
|
||||
mT1 = 0.0;
|
||||
if( !bHasRelativeSpec )
|
||||
mRelativeTo = 0;
|
||||
|
||||
AudacityProject * p = context.GetProject();
|
||||
double end = p->GetTracks()->GetEndTime();
|
||||
double t0;
|
||||
@ -148,6 +156,12 @@ bool SelectFrequenciesCommand::Apply(const CommandContext & context){
|
||||
if( !bHasBottom && !bHasTop )
|
||||
return true;
|
||||
|
||||
// Defaults if no value...
|
||||
if( !bHasTop )
|
||||
mTop = 0.0;
|
||||
if( !bHasBottom )
|
||||
mBottom = 0.0;
|
||||
|
||||
context.GetProject()->SSBL_ModifySpectralSelection(
|
||||
mBottom, mTop, false);// false for not done.
|
||||
return true;
|
||||
@ -195,6 +209,13 @@ bool SelectTracksCommand::Apply(const CommandContext &context)
|
||||
{
|
||||
int index = 0;
|
||||
TrackList *tracks = context.GetProject()->GetTracks();
|
||||
|
||||
// Defaults if no value...
|
||||
if( !bHasNumTracks )
|
||||
mNumTracks = 1.0;
|
||||
if( !bHasFirstTrack )
|
||||
mFirstTrack = 0.0;
|
||||
|
||||
// Stereo second tracks count as 0.5 of a track.
|
||||
double last = mFirstTrack+mNumTracks;
|
||||
double first = mFirstTrack;
|
||||
|
@ -77,6 +77,8 @@ bool SetClipCommand::ApplyInner( const CommandContext & context, Track * t )
|
||||
if( t->GetKind() != Track::Wave)
|
||||
return true;
|
||||
|
||||
// if no 'At' is specified, then any clip in any selected track will be set.
|
||||
|
||||
WaveTrack *waveTrack = static_cast<WaveTrack*>(t);
|
||||
wxASSERT( waveTrack );
|
||||
WaveClipPointers ptrs( waveTrack->SortedClipArray());
|
||||
|
@ -56,6 +56,10 @@ bool SetEnvelopeCommand::ApplyInner( const CommandContext & context, Track * t )
|
||||
if( (t->GetKind() != Track::Wave))
|
||||
return true;
|
||||
|
||||
// if no time is specified, then
|
||||
// - delete deletes any envelope in selected tracks.
|
||||
// - value is not set for any clip
|
||||
|
||||
WaveTrack *waveTrack = static_cast<WaveTrack*>(t);
|
||||
WaveClipPointers ptrs( waveTrack->SortedClipArray());
|
||||
for(auto it = ptrs.begin(); (it != ptrs.end()); it++ ){
|
||||
|
@ -109,7 +109,7 @@ bool SetTrackBase::Apply(const CommandContext & context )
|
||||
|
||||
bool SetTrackStatusCommand::DefineParams( ShuttleParams & S ){
|
||||
SetTrackBase::DefineParams( S );
|
||||
S.OptionalN( bHasTrackName ).Define( mTrackName, wxT("Name"), wxT("Unnamed") );
|
||||
S.OptionalN( bHasTrackName ).Define( mTrackName, wxT("Name"), _("Unnamed") );
|
||||
// There is also a select command. This is an alternative.
|
||||
S.OptionalN( bHasSelected ).Define( bSelected, wxT("Selected"), false );
|
||||
S.OptionalN( bHasFocused ).Define( bFocused, wxT("Focused"), false );
|
||||
|
Loading…
x
Reference in New Issue
Block a user