MCPcopy Create free account
hub / github.com/audacity/audacity / Apply

Method Apply

src/commands/SetClipCommand.cpp:90–120  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

88}
89
90bool SetClipCommand::Apply(const CommandContext& context)
91{
92 for(const auto track : TrackList::Get(context.project))
93 {
94 if(!track->GetSelected())
95 continue;
96
97 // if no 'At' is specified, then any clip in any selected track will be set.
98 track->TypeSwitch([&](WaveTrack &waveTrack) {
99 for (const auto &interval : waveTrack.Intervals()) {
100 if(!bHasContainsTime ||
101 (interval->Start() <= mContainsTime &&
102 interval->End() >= mContainsTime ))
103 {
104 // Inside this IF is where we actually apply the command
105 if (bHasColour) {
106 for (const auto channel : interval->Channels())
107 WaveColorAttachment::Get(*channel).SetColorIndex(mColour);
108 }
109 // No validation of overlap yet. We assume the user is sensible!
110 if( bHasT0 )
111 interval->SetPlayStartTime(mT0);
112 // \todo Use SetClip to move a clip between tracks too.
113 if( bHasName )
114 interval->SetName(mName);
115 }
116 }
117 } );
118 }
119 return true;
120}
121
122namespace {
123using namespace MenuRegistry;

Callers

nothing calls this directly

Calls 9

GetFunction · 0.85
IntervalsMethod · 0.80
ChannelsMethod · 0.80
SetPlayStartTimeMethod · 0.80
GetSelectedMethod · 0.45
StartMethod · 0.45
EndMethod · 0.45
SetColorIndexMethod · 0.45
SetNameMethod · 0.45

Tested by

no test coverage detected