| 420 | } |
| 421 | |
| 422 | void OnCutLabels(const CommandContext &context) |
| 423 | { |
| 424 | auto &project = context.project; |
| 425 | auto &tracks = TrackList::Get(project); |
| 426 | auto &selectedRegion = ViewInfo::Get(project).selectedRegion; |
| 427 | |
| 428 | if (selectedRegion.isPoint()) |
| 429 | return; |
| 430 | |
| 431 | // Because of grouping the copy may need to operate on different tracks than |
| 432 | // the clear, so we do these actions separately. |
| 433 | auto copyfunc = [&](Track &track, double t0, double t1) { |
| 434 | Track::Holder result; |
| 435 | track.TypeSwitch( [&](WaveTrack &wt) { result = wt.Copy(t0, t1); } ); |
| 436 | return result; |
| 437 | }; |
| 438 | EditClipboardByLabel(project, tracks, selectedRegion, copyfunc); |
| 439 | |
| 440 | bool enableCutlines = gPrefs->ReadBool(wxT( "/GUI/EnableCutLines"), false); |
| 441 | auto editfunc = [&](Track &track, double t0, double t1) { |
| 442 | track.TypeSwitch( |
| 443 | [&](WaveTrack &t) { |
| 444 | if (enableCutlines) |
| 445 | t.ClearAndAddCutLine(t0, t1); |
| 446 | else |
| 447 | t.Clear(t0, t1); |
| 448 | }, |
| 449 | [&](Track &t) { |
| 450 | t.Clear(t0, t1); |
| 451 | } |
| 452 | ); |
| 453 | }; |
| 454 | EditByLabel(project, tracks, selectedRegion, editfunc); |
| 455 | |
| 456 | selectedRegion.collapseToT0(); |
| 457 | |
| 458 | ProjectHistory::Get(project).PushState( |
| 459 | /* i18n-hint: (verb) past tense. Audacity has just cut the labeled audio |
| 460 | regions.*/ |
| 461 | XO("Cut labeled audio regions to clipboard"), |
| 462 | /* i18n-hint: (verb)*/ |
| 463 | XO("Cut Labeled Audio")); |
| 464 | } |
| 465 | |
| 466 | void OnDeleteLabels(const CommandContext &context) |
| 467 | { |
nothing calls this directly
no test coverage detected