| 88 | } |
| 89 | |
| 90 | bool 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 | |
| 122 | namespace { |
| 123 | using namespace MenuRegistry; |
nothing calls this directly
no test coverage detected