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

Method Clear

libraries/lib-label-track/LabelTrack.cpp:220–242  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

218}
219
220void LabelTrack::Clear(double b, double e)
221{
222 // May DELETE labels, so use subscripts to iterate
223 for (size_t i = 0; i < mLabels.size(); ++i) {
224 auto &labelStruct = mLabels[i];
225 LabelStruct::TimeRelations relation =
226 labelStruct.RegionRelation(b, e, this);
227 if (relation == LabelStruct::BEFORE_LABEL)
228 labelStruct.selectedRegion.move(- (e-b));
229 else if (relation == LabelStruct::SURROUNDS_LABEL) {
230 DeleteLabel( i );
231 --i;
232 }
233 else if (relation == LabelStruct::ENDS_IN_LABEL)
234 labelStruct.selectedRegion.setTimes(
235 b,
236 labelStruct.getT1() - (e - b));
237 else if (relation == LabelStruct::BEGINS_IN_LABEL)
238 labelStruct.selectedRegion.setT1(b);
239 else if (relation == LabelStruct::WITHIN_LABEL)
240 labelStruct.selectedRegion.moveT1( - (e-b));
241 }
242}
243
244#if 0
245//used when we want to use clear only on the labels

Callers

nothing calls this directly

Calls 5

RegionRelationMethod · 0.80
moveMethod · 0.80
setTimesMethod · 0.80
setT1Method · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected