Audacity 3.2.0
EditMenus.cpp
Go to the documentation of this file.
1#include "../AdornedRulerPanel.h"
2#include "../Clipboard.h"
3#include "../CommonCommandFlags.h"
4#include "../LabelTrack.h"
5#include "../MenuCreator.h"
6#include "NoteTrack.h"
7#include "Project.h"
8#include "ProjectHistory.h"
9#include "ProjectRate.h"
11#include "../ProjectWindows.h"
12#include "../ProjectWindows.h"
13#include "../SelectUtilities.h"
14#include "SyncLock.h"
15#include "TempoChange.h"
16#include "../TrackPanel.h"
17#include "TrackFocus.h"
18#include "UndoManager.h"
19#include "ViewInfo.h"
20#include "WaveTrack.h"
21#include "WaveTrackUtilities.h"
22#include "TimeStretching.h"
23#include "WaveClip.h"
24#include "SampleBlock.h"
25#include "CommandContext.h"
26#include "TimeWarper.h"
27#include "../prefs/PrefsDialog.h"
28#include "../prefs/TracksBehaviorsPrefs.h"
29#include "../tracks/labeltrack/ui/LabelTrackView.h"
30#include "../tracks/playabletrack/wavetrack/ui/WaveChannelView.h"
31#include "AudacityMessageBox.h"
32#include "../AudioPasteDialog.h"
33#include "BasicUI.h"
34#include "Sequence.h"
35#include "UserException.h"
36#include "Viewport.h"
37
38#include <wx/frame.h>
39
40// private helper classes and functions
41namespace {
42
43// Handle text paste. Return true if did paste.
44// (This was formerly the first part of overly-long OnPaste.)
46{
47 auto &tracks = TrackList::Get( project );
48 auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
49 auto &viewport = Viewport::Get(project);
50
51 // Paste into the active label (if any)
52 for (auto pLabelTrack : tracks.Any<LabelTrack>()) {
53 // Does this track have an active label?
54 if (LabelTrackView::Get( *pLabelTrack ).GetTextEditIndex(project) != -1) {
55
56 // Yes, so try pasting into it
57 auto &view = LabelTrackView::Get( *pLabelTrack );
58 if (view.PasteSelectedText( project, selectedRegion.t0(),
59 selectedRegion.t1() ))
60 {
62 .PushState(XO("Pasted text from the clipboard"), XO("Paste"));
63
64 // Make sure caret is in view
65 int x;
66 if (view.CalcCursorX( project, &x )) {
67 viewport.ScrollIntoView(x);
68 }
69
70 return true;
71 }
72 }
73 }
74
75 //Presumably, there might be not more than one track
76 //that expects text input
77 for (auto wt : tracks.Any<WaveTrack>()) {
78 auto& view = WaveChannelView::GetFirst(*wt);
79 if (view.PasteText(project)) {
80 auto &trackPanel = TrackPanel::Get(project);
81 trackPanel.Refresh(false);
82 return true;
83 }
84 }
85
86 return false;
87}
88
89wxULongLong EstimateCopyBytesCount(const TrackList& src, const TrackList& dst)
90{
91 wxULongLong result{};
92 for (auto waveTrack : src.Any<const WaveTrack>()) {
93 const auto samplesCount =
95 result += samplesCount.as_long_long() *
96 SAMPLE_SIZE(waveTrack->GetSampleFormat());
97 }
98 return result;
99}
100
101BlockArray::size_type EstimateCopiedBlocks(const TrackList& src, const TrackList& dst)
102{
103 BlockArray::size_type result{};
104 for (const auto waveTrack : src.Any<const WaveTrack>())
105 result += WaveTrackUtilities::CountBlocks(*waveTrack);
106 return result;
107}
108
109std::shared_ptr<TrackList> DuplicateDiscardTrimmed(const TrackList& src) {
110 auto result = TrackList::Create(nullptr);
111 for (auto track : src) {
112 const auto pTrack =
113 track->Copy(track->GetStartTime(), track->GetEndTime(), false);
114 pTrack->MoveTo(track->GetStartTime());
115 if (const auto waveTrack = dynamic_cast<WaveTrack*>(pTrack.get()))
117 result->Add(pTrack);
118 }
119 return result;
120}
121
122// Create and paste into NEW tracks.
123// Simplified version of DoPaste, used when there is no selection
124// on tracks
125// (This was formerly the second part of overly-long OnPaste.)
126void DoPasteNothingSelected(AudacityProject &project, const TrackList& src, double t0, double t1)
127{
128 auto &tracks = TrackList::Get( project );
129 auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
130 auto &viewInfo = ViewInfo::Get( project );
131
132 assert(tracks.Selected().empty());
133
134 Track* pFirstNewTrack = NULL;
135 for (auto pClip : src) {
136 auto pNewTrack = pClip->PasteInto(project, tracks);
137 if (!pFirstNewTrack)
138 pFirstNewTrack = pNewTrack.get();
139 pNewTrack->SetSelected(true);
140 }
141
142 // Select some pasted samples, which is probably impossible to get right
143 // with various project and track sample rates.
144 // So do it at the sample rate of the project
145 const double projRate = ProjectRate::Get( project ).GetRate();
146 const double projTempo = ProjectTimeSignature::Get(project).GetTempo();
147 const double srcTempo =
148 pFirstNewTrack ? GetProjectTempo(*pFirstNewTrack).value_or(projTempo) :
149 projTempo;
150 // Apply adequate stretching to the selection. A selection of 10 seconds of
151 // audio in project A should become 5 seconds in project B if tempo in B is
152 // twice as fast.
153 const double quantT0 = QUANTIZED_TIME(t0 * srcTempo / projTempo, projRate);
154 const double quantT1 = QUANTIZED_TIME(t1 * srcTempo / projTempo, projRate);
155 selectedRegion.setTimes(
156 0.0, // anywhere else and this should be
157 // half a sample earlier
158 quantT1 - quantT0);
159
161 .PushState(XO("Pasted from the clipboard"), XO("Paste"));
162
163 if (pFirstNewTrack) {
164 TrackFocus::Get(project).Set(pFirstNewTrack);
165 Viewport::Get(project).ShowTrack(*pFirstNewTrack);
166 }
167}
168
169bool HasHiddenData(const TrackList& trackList)
170{
171 const auto range = trackList.Any<const WaveTrack>();
172 return std::any_of(range.begin(), range.end(),
173 [](const WaveTrack *pTrack){
174 return WaveTrackUtilities::HasHiddenData(*pTrack);
175 });
176}
177
178// Menu handler functions
179
180void OnUndo(const CommandContext &context)
181{
182 auto &project = context.project;
183 auto &tracks = TrackList::Get( project );
184 auto &trackPanel = TrackPanel::Get( project );
185 auto &undoManager = UndoManager::Get( project );
186
187 if (!ProjectHistory::Get( project ).UndoAvailable()) {
188 AudacityMessageBox( XO("Nothing to undo") );
189 return;
190 }
191
192 // can't undo while dragging
193 if (trackPanel.IsMouseCaptured()) {
194 return;
195 }
196
197 undoManager.Undo(
198 [&]( const UndoStackElem &elem ){
200
201 auto t = *tracks.Selected().begin();
202 if (!t)
203 t = *tracks.begin();
204 TrackFocus::Get(project).Set(t);
205 if (t)
207}
208
209void OnRedo(const CommandContext &context)
210{
211 auto &project = context.project;
212 auto &tracks = TrackList::Get( project );
213 auto &trackPanel = TrackPanel::Get( project );
214 auto &undoManager = UndoManager::Get( project );
215
216 if (!ProjectHistory::Get( project ).RedoAvailable()) {
217 AudacityMessageBox( XO("Nothing to redo") );
218 return;
219 }
220 // Can't redo whilst dragging
221 if (trackPanel.IsMouseCaptured()) {
222 return;
223 }
224
225 undoManager.Redo(
226 [&]( const UndoStackElem &elem ){
228
229 auto t = *tracks.Selected().begin();
230 if (!t)
231 t = *tracks.begin();
232 TrackFocus::Get(project).Set(t);
233 if (t)
235}
236
237void OnCut(const CommandContext &context)
238{
239 auto &project = context.project;
240 auto &tracks = TrackList::Get( project );
241 auto &trackPanel = TrackPanel::Get( project );
242 auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
244
245 // This doesn't handle cutting labels, it handles
246 // cutting the _text_ inside of labels, i.e. if you're
247 // in the middle of editing the label text and select "Cut".
248
249 for (auto lt : tracks.Selected<LabelTrack>()) {
250 auto &view = LabelTrackView::Get( *lt );
251 if (view.CutSelectedText( context.project )) {
252 trackPanel.Refresh(false);
253 return;
254 }
255 }
256
257 //Presumably, there might be not more than one track
258 //that expects text input
259 for (auto wt : tracks.Any<WaveTrack>()) {
260 auto& view = WaveChannelView::GetFirst(*wt);
261 if (view.CutSelectedText(context.project)) {
262 trackPanel.Refresh(false);
263 return;
264 }
265 }
266
267 auto &clipboard = Clipboard::Get();
268 clipboard.Clear();
269
270 auto pNewClipboard = TrackList::Create( nullptr );
271 auto &newClipboard = *pNewClipboard;
272
273 tracks.Selected().Visit(
274#if defined(USE_MIDI)
275 [&](NoteTrack &n) {
276 // Since portsmf has a built-in cut operator, we use that instead
277 auto dest = n.Cut(selectedRegion.t0(), selectedRegion.t1());
278 newClipboard.Add(dest);
279 },
280#endif
281 [&](Track &n) {
282 if (n.SupportsBasicEditing()) {
283 auto dest = n.Copy(selectedRegion.t0(), selectedRegion.t1());
284 newClipboard.Add(dest);
285 }
286 }
287 );
288
289 // Survived possibility of exceptions. Commit changes to the clipboard now.
290 clipboard.Assign(
291 std::move( newClipboard ),
292 selectedRegion.t0(),
293 selectedRegion.t1(),
294 project.shared_from_this()
295 );
296
297 // Proceed to change the project. If this throws, the project will be
298 // rolled back by the top level handler.
299
301#if defined(USE_MIDI)
302 [](NoteTrack&) {
303 //if NoteTrack, it was cut, so do not clear anything
304
305 // PRL: But what if it was sync lock selected only, not selected?
306 },
307#endif
308 [&](auto &&fallthrough){ return [&](WaveTrack &wt) {
309 if (gPrefs->Read(wxT("/GUI/EnableCutLines"), (long)0))
310 wt.ClearAndAddCutLine(selectedRegion.t0(), selectedRegion.t1());
311 else
312 fallthrough();
313 }; },
314 [&](Track &n) {
315 if (n.SupportsBasicEditing())
316 n.Clear(selectedRegion.t0(), selectedRegion.t1());
317 }
318 );
319
320 selectedRegion.collapseToT0();
321
323 .PushState(XO("Cut to the clipboard"), XO("Cut"));
324
325 // Bug 1663
326 //mRuler->ClearPlayRegion();
327 ruler.DrawOverlays( true );
328}
329
330void OnDelete(const CommandContext &context)
331{
332 auto &project = context.project;
333 auto &tracks = TrackList::Get( project );
334 auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
335
336 for (auto n : tracks) {
337 if (!n->SupportsBasicEditing())
338 continue;
340 n->Clear(selectedRegion.t0(), selectedRegion.t1());
341 }
342 }
343
344 double seconds = selectedRegion.duration();
345
346 selectedRegion.collapseToT0();
347
349 XO("Deleted %.2f seconds at t=%.2f")
350 .Format( seconds, selectedRegion.t0()),
351 XO("Delete"));
352}
353
354
355void OnCopy(const CommandContext &context)
356{
357 auto &project = context.project;
358 auto &tracks = TrackList::Get( project );
359 auto &trackPanel = TrackPanel::Get( project );
360 auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
361
362 for (auto lt : tracks.Selected<LabelTrack>()) {
363 auto &view = LabelTrackView::Get( *lt );
364 if (view.CopySelectedText( context.project )) {
365 //trackPanel.Refresh(false);
366 return;
367 }
368 }
369 //Presumably, there might be not more than one track
370 //that expects text input
371 for (auto wt : tracks.Any<WaveTrack>()) {
372 auto& view = WaveChannelView::GetFirst(*wt);
373 if (view.CopySelectedText(context.project)) {
374 return;
375 }
376 }
377
378 auto &clipboard = Clipboard::Get();
379 clipboard.Clear();
380
381 auto pNewClipboard = TrackList::Create( nullptr );
382 auto &newClipboard = *pNewClipboard;
383
384 for (auto n : tracks.Selected()) {
385 if (n->SupportsBasicEditing()) {
386 auto dest = n->Copy(selectedRegion.t0(), selectedRegion.t1());
387 newClipboard.Add(dest);
388 }
389 }
390
391 // Survived possibility of exceptions. Commit changes to the clipboard now.
392 clipboard.Assign( std::move( newClipboard ),
393 selectedRegion.t0(), selectedRegion.t1(), project.shared_from_this() );
394
395 //Make sure the menus/toolbar states get updated
396 trackPanel.Refresh(false);
397}
398
399std::pair<double, double> FindSelection(const CommandContext &context)
400{
401 double sel0 = 0.0, sel1 = 0.0;
402
403#if 0
404 // Use the overriding selection if any was given in the context
405 if (auto *pRegion = context.temporarySelection.pSelectedRegion) {
406 auto &selectedRegion = *pRegion;
407 sel0 = selectedRegion.t0();
408 sel1 = selectedRegion.t1();
409 }
410 else
411#endif
412 {
413 auto &selectedRegion = ViewInfo::Get(context.project).selectedRegion;
414 sel0 = selectedRegion.t0();
415 sel1 = selectedRegion.t1();
416 }
417
418 return { sel0, sel1 };
419}
420
421std::shared_ptr<const TrackList> FindSourceTracks(const CommandContext &context)
422{
423 auto &project = context.project;
424 auto &window = GetProjectFrame(project);
426 const auto &clipboard = Clipboard::Get();
427 auto discardTrimmed = false;
428 if (&context.project != &*clipboard.Project().lock()) {
429 const auto waveClipCopyPolicy = TracksBehaviorsAudioTrackPastePolicy.Read();
430 if (waveClipCopyPolicy == wxT("Ask") &&
431 HasHiddenData(clipboard.GetTracks()))
432 {
433 AudioPasteDialog audioPasteDialog(
434 &window,
435 EstimateCopyBytesCount(clipboard.GetTracks(), tracks)
436 );
437 const auto result = audioPasteDialog.ShowModal();
438 if(result == wxID_CANCEL)
439 return {};
440 discardTrimmed =
442 }
443 else if(waveClipCopyPolicy == wxT("Discard"))
444 discardTrimmed = true;
445 }
446
447 std::shared_ptr<const TrackList> srcTracks;
448 if(discardTrimmed)
449 srcTracks = DuplicateDiscardTrimmed(clipboard.GetTracks());
450 else
451 srcTracks = clipboard.GetTracks().shared_from_this();
452
453 return srcTracks;
454}
455
457 const CommandContext &context, const TrackList &srcTracks)
458{
459 auto &project = context.project;
461 auto &trackFactory = WaveTrackFactory::Get(project);
462 auto &pSampleBlockFactory = trackFactory.GetSampleBlockFactory();
463 return pSampleBlockFactory->Subscribe([
464 toCopy = EstimateCopiedBlocks(srcTracks, tracks),
465 nCopied = 0,
466 copyStartTime = std::chrono::system_clock::now(),
467 progressDialog = std::shared_ptr<BasicUI::ProgressDialog>()]
468 (const SampleBlockCreateMessage&) mutable {
469 using namespace std::chrono;
470 constexpr auto ProgressDialogShowDelay = milliseconds { 100 };
471 ++nCopied;
472 if(!progressDialog) {
473 if(duration_cast<milliseconds>(system_clock::now() - copyStartTime) >= ProgressDialogShowDelay)
474 progressDialog = BasicUI::MakeProgress(XO("Paste clip"), XO("Pasting clip contents, please wait"), 0);
475 }
476 else {
477 progressDialog->Poll(nCopied, toCopy);
478 }
479 });
480}
481
483bool FitsInto(const Track &src, const Track &dst)
484{
485 if (!src.SameKindAs(dst))
486 return false;
487 // Mono can "fit" into stereo, by duplication of the channel
488 // Otherwise non-wave tracks always have just one "channel"
489 // Future: Fit stereo into mono too, using mix-down
490 return src.NChannels() <= dst.NChannels();
491}
492
493// First, destination track; second, source
494using Correspondence = std::vector<std::pair<Track*, const Track*>>;
495
497 TrackList &dstTracks, const TrackList &srcTracks)
498{
499 Correspondence result;
500 auto dstRange = dstTracks.Selected();
501 if (dstRange.size() == 1)
502 // Special rule when only one track is selected interprets the user's
503 // intent as pasting into that track and following ones
504 dstRange = dstTracks.Any().StartingWith(*dstRange.begin());
505 auto srcRange = srcTracks.Any();
506 while (!(dstRange.empty() || srcRange.empty())) {
507 auto &dst = **dstRange.begin();
508 auto &src = **srcRange.begin();
509 if (!FitsInto(src, dst)) {
510 // Skip selected track of inappropriate type and try again
511 ++dstRange.first;
512 continue;
513 }
514 result.emplace_back(&dst, &src);
515 ++srcRange.first;
516 ++dstRange.first;
517 }
518
519 if (!srcRange.empty())
520 // Could not fit all source tracks into the selected tracks
521 return {};
522 else
523 return result;
524}
525
526void OnPaste(const CommandContext &context)
527{
528 auto &project = context.project;
529
530 // Handle text paste first.
531 if (DoPasteText(project))
532 return;
533
534 const auto &clipboard = Clipboard::Get();
535 if (clipboard.GetTracks().empty())
536 return;
537
538 const auto srcTracks = FindSourceTracks(context);
539 if (!srcTracks)
540 // user cancelled
541 return;
542
543 auto notificationScope = NotificationScope(context, *srcTracks);
544
546 // If nothing's selected, we just insert new tracks.
547 if (!tracks.Selected()) {
549 project, *srcTracks, clipboard.T0(), clipboard.T1());
550 return;
551 }
552
553 // Otherwise, paste into the selected tracks.
554 double t0, t1;
555 std::tie(t0, t1) = FindSelection(context);
556 auto newT1 = t0 + clipboard.Duration();
557 const auto isSyncLocked = SyncLockState::Get(project).IsSyncLocked();
558
559 Track *ff = nullptr;
560 bool bPastedSomething = false;
561
562 // Find tracks to paste in
563 auto correspondence = FindCorrespondence(tracks, *srcTracks);
564 if (correspondence.empty()) {
565 if (tracks.Selected().size() == 1)
567"The content you are trying to paste will span across more tracks than you "
568"currently have available. Add more tracks and try again.")
569 );
570 else
572"There are not enough tracks selected to accommodate your copied content. "
573"Select additional tracks and try again.")
574 );
575 return;
576 }
577 auto iPair = correspondence.begin();
578 const auto endPair = correspondence.cend();
579
580 // Outer loop by sync-lock groups
581 auto next = tracks.begin();
582 for (auto range = tracks.Any(); !range.empty();
583 // Skip to next sync lock group
584 range.first = next
585 ) {
586 if (iPair == endPair)
587 // Nothing more to paste
588 break;
589 auto group = SyncLock::Group(**range.first);
590 next = tracks.Find(*group.rbegin());
591 ++next;
592
593 if (!group.contains(iPair->first))
594 // Nothing to paste into this group
595 continue;
596
597 // Inner loop over the sync-lock group by tracks
598 for (auto member : group) {
599 if (iPair == endPair || member != iPair->first) {
600 if (isSyncLocked) {
601 // Track is not pasted into but must be adjusted
602 if (t1 != newT1 && t1 <= member->GetEndTime()) {
603 member->SyncLockAdjust(t1, newT1);
604 bPastedSomething = true;
605 }
606 }
607 }
608 else {
609 // Remember first pasted-into track, to focus it
610 if (!ff)
611 ff = member;
612 // Do the pasting!
613 const auto src = (iPair++)->second;
614 member->TypeSwitch(
615 [&](WaveTrack &wn){
616 bPastedSomething = true;
617 // For correct remapping of preserved split lines:
618 PasteTimeWarper warper{ t1, t0 + src->GetEndTime() };
619 const auto newClipOnPaste =
620 gPrefs->ReadBool(wxT("/GUI/PasteAsNewClips"), false);
621 // The new-clip-on-paste behavior means: not merging the
622 // clipboard data with data at the selection borders; not
623 // reproducing boundaries within the selected region in the
624 // new clip; preserving the data underneath by trimming
625 // (rather than deleting).
626 // The legacy behavior is the opposite.
627 const auto merge = newClipOnPaste ? false : true;
628 const auto preserveExistingBoundaries = newClipOnPaste ? false : true;
629 auto clearByTrimming = newClipOnPaste ? true : false;
630 wn.ClearAndPaste(
631 t0, t1, *static_cast<const WaveTrack*>(src),
632 preserveExistingBoundaries, merge, &warper,
633 clearByTrimming);
634 },
635 [&](LabelTrack &ln){
636 // Per Bug 293, users expect labels to move on a paste into
637 // a label track.
638 ln.Clear(t0, t1);
639
640 ln.ShiftLabelsOnInsert( clipboard.Duration(), t0 );
641
642 bPastedSomething |= ln.PasteOver(t0, *src);
643 },
644 [&](Track &t){
645 bPastedSomething = true;
646 t.Clear(t0, t1);
647 t.Paste(t0, *src);
648 }
649 );
650 }
651 }
652 }
653
654 // TODO: What if we clicked past the end of the track?
655
656 if (bPastedSomething) {
658 .setTimes( t0, t0 + clipboard.Duration() );
659
661 .PushState(XO("Pasted from the clipboard"), XO("Paste"));
662
663 if (ff) {
664 TrackFocus::Get(project).Set(ff);
666 }
667 }
668}
669
670void OnDuplicate(const CommandContext &context)
671{
672 auto &project = context.project;
674 auto &selectedRegion = ViewInfo::Get(project).selectedRegion;
675
676 // This iteration is unusual because we add to the list inside the loop
677 auto range = tracks.Selected();
678 auto last = *range.rbegin();
679 for (auto n : range) {
680 if (!n->SupportsBasicEditing())
681 continue;
682
683 // Make copies not for clipboard but for direct addition to the project
684 auto dest = n->Copy(selectedRegion.t0(), selectedRegion.t1(), false);
685 dest->MoveTo(std::max(selectedRegion.t0(), n->GetStartTime()));
686 tracks.Add(dest);
687
688 // This break is really needed, else we loop infinitely
689 if (n == last)
690 break;
691 }
692
694 .PushState(XO("Duplicated"), XO("Duplicate"));
695}
696
697void OnSplitCut(const CommandContext &context)
698{
699 auto &project = context.project;
701 auto &selectedRegion = ViewInfo::Get(project).selectedRegion;
702
703 auto &clipboard = Clipboard::Get();
704 clipboard.Clear();
705
706 auto pNewClipboard = TrackList::Create(nullptr);
707 auto &newClipboard = *pNewClipboard;
708
709 tracks.Selected().Visit(
710 [&](WaveTrack &n) {
711 auto track = n.SplitCut(selectedRegion.t0(), selectedRegion.t1());
712 newClipboard.Add(track);
713 },
714 [&](Track &n) {
715 if (n.SupportsBasicEditing()) {
716 auto dest = n.Copy(selectedRegion.t0(), selectedRegion.t1());
717 n.Silence(selectedRegion.t0(), selectedRegion.t1());
718 newClipboard.Add(dest);
719 }
720 }
721 );
722
723 // Survived possibility of exceptions. Commit changes to the clipboard now.
724 clipboard.Assign(std::move(newClipboard),
725 selectedRegion.t0(), selectedRegion.t1(), project.shared_from_this());
726
728 .PushState(XO("Split-cut to the clipboard"), XO("Split Cut"));
729}
730
731void OnSplitDelete(const CommandContext &context)
732{
733 auto &project = context.project;
735 auto &selectedRegion = ViewInfo::Get(project).selectedRegion;
736
737 tracks.Selected().Visit(
738 [&](WaveTrack &wt) {
739 wt.SplitDelete(selectedRegion.t0(), selectedRegion.t1());
740 },
741 [&](Track &n) {
742 if (n.SupportsBasicEditing())
743 n.Silence(selectedRegion.t0(), selectedRegion.t1());
744 }
745 );
746
748 XO("Split-deleted %.2f seconds at t=%.2f")
749 .Format(selectedRegion.duration(), selectedRegion.t0()),
750 XO("Split Delete"));
751}
752
753void OnSilence(const CommandContext &context)
754{
755 auto &project = context.project;
757 auto &selectedRegion = ViewInfo::Get(project).selectedRegion;
758
759 const auto selectedWaveTracks = tracks.Selected<WaveTrack>();
761 [&](const ProgressReporter& parent) {
763 selectedWaveTracks.begin(), selectedWaveTracks.end(),
764 [&](WaveTrack* n, const ProgressReporter& child) {
765 n->Silence(selectedRegion.t0(), selectedRegion.t1(), child);
766 },
767 parent);
768 });
769
771 XO("Silenced selected tracks for %.2f seconds at %.2f")
772 .Format(selectedRegion.duration(), selectedRegion.t0()),
773 /* i18n-hint: verb */
774 XC("Silence", "command"));
775}
776
777void OnTrim(const CommandContext &context)
778{
779 auto &project = context.project;
780 auto &tracks = TrackList::Get( project );
781 auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
782
783 if (selectedRegion.isPoint())
784 return;
785
786 tracks.Selected().Visit( [&](WaveTrack &wt) {
787 //Hide the section before the left selector
788 wt.Trim(selectedRegion.t0(), selectedRegion.t1());
789 } );
790
792 XO("Trim selected audio tracks from %.2f seconds to %.2f seconds")
793 .Format( selectedRegion.t0(), selectedRegion.t1() ),
794 XO("Trim Audio"));
795}
796
797void OnSplit(const CommandContext &context)
798{
799 auto &project = context.project;
801 auto [sel0, sel1] = FindSelection(context);
802 if (auto *pTrack = context.temporarySelection.pTrack) {
803 if (auto pWaveTrack = dynamic_cast<WaveTrack*>(pTrack))
804 pWaveTrack->Split(sel0, sel1);
805 else
806 // Did nothing, don't push history
807 return;
808 }
809 else
810 for (auto wt : tracks.Selected<WaveTrack>())
811 wt->Split(sel0, sel1);
812
813 ProjectHistory::Get( project ).PushState(XO("Split"), XO("Split"));
814#if 0
815//ANSWER-ME: Do we need to keep this commented out OnSplit() code?
816// This whole section no longer used...
817 /*
818 * Previous (pre-multiclip) implementation of "Split" command
819 * This does work only when a range is selected!
820 *
821 TrackListIterator iter(tracks);
822
823 Track *n = iter.First();
824 Track *dest;
825
826 TrackList newTracks;
827
828 while (n) {
829 if (n->GetSelected()) {
830 double sel0 = selectedRegion.t0();
831 double sel1 = selectedRegion.t1();
832
833 dest = n->Copy(sel0, sel1);
834 dest->Init(*n);
835 dest->MoveTo(std::max(sel0, n->GetOffset()));
836
837 if (sel1 >= n->GetEndTime())
838 n->Clear(sel0, sel1);
839 else if (sel0 <= n->GetOffset()) {
840 n->Clear(sel0, sel1);
841 n->MoveTo(sel1);
842 } else
843 n->Silence(sel0, sel1);
844
845 newTracks.Add(dest);
846 }
847 n = iter.Next();
848 }
849
850 TrackListIterator nIter(&newTracks);
851 n = nIter.First();
852 while (n) {
853 tracks->Add(n);
854 n = nIter.Next();
855 }
856
857 PushState(XO("Split"), XO("Split"));
858 */
859#endif
860}
861
862void OnSplitNew(const CommandContext &context)
863{
864 auto &project = context.project;
866 auto &selectedRegion = ViewInfo::Get(project).selectedRegion;
867
868 // This iteration is unusual because we add to the list inside the loop
869 auto range = tracks.Selected();
870 auto last = *range.rbegin();
871 for (auto track : range) {
872 track->TypeSwitch(
873 [&](WaveTrack &wt) {
874 // Clips must be aligned to sample positions or the NEW clip will
875 // not fit in the gap where it came from
876 const double newt0 = wt.SnapToSample(selectedRegion.t0());
877 const double newt1 = wt.SnapToSample(selectedRegion.t1());
878 // Fix issue 2846 by calling copy with forClipboard = false.
879 // This avoids creating the blank placeholder clips
880 const auto dest = wt.Copy(newt0, newt1, false);
881 if (dest) {
882 // The copy function normally puts the clip at time 0
883 // This offset lines it up with the original track's timing
884 dest->MoveTo(newt0);
885 tracks.Add(dest);
886 }
887 wt.SplitDelete(newt0, newt1);
888 }
889#if 0
890 ,
891 // LL: For now, just skip all non-wave tracks since the other do not
892 // yet support proper splitting.
893 [&](Track &n) {
894 dest = n.Cut(viewInfo.selectedRegion.t0(),
895 viewInfo.selectedRegion.t1());
896 if (dest) {
897 dest->MoveTo(std::max(0, n.GetOffset()));
898 tracks.Add(dest);
899 }
900 }
901#endif
902 );
903 if (track == last)
904 break;
905 }
906
908 .PushState(XO("Split to new track"), XO("Split New"));
909}
910
911void OnJoin(const CommandContext &context)
912{
913 auto &project = context.project;
915 auto &selectedRegion = ViewInfo::Get(project).selectedRegion;
916 const auto selectedTracks = tracks.Selected<WaveTrack>();
918 [&](const ProgressReporter& reportProgress) {
919 using namespace BasicUI;
921 selectedTracks.begin(), selectedTracks.end(),
922 [&](WaveTrack* wt, const ProgressReporter& childProgress) {
923 wt->Join(
924 selectedRegion.t0(), selectedRegion.t1(), childProgress);
925 },
926 reportProgress);
927 });
928
930 XO("Joined %.2f seconds at t=%.2f")
931 .Format(selectedRegion.duration(), selectedRegion.t0()),
932 XO("Join"));
933}
934
935void OnDisjoin(const CommandContext &context)
936{
937 auto &project = context.project;
939 auto &selectedRegion = ViewInfo::Get(project).selectedRegion;
940
941 for (auto wt : tracks.Selected<WaveTrack>())
942 wt->Disjoin(selectedRegion.t0(), selectedRegion.t1());
943
945 XO("Detached %.2f seconds at t=%.2f")
946 .Format(selectedRegion.duration(), selectedRegion.t0()),
947 XO("Detach"));
948}
949
950void OnPreferences(const CommandContext &context)
951{
952 auto &project = context.project;
953
954 GlobalPrefsDialog dialog(&GetProjectFrame(project) /* parent */, &project );
955
956 if (!dialog.ShowModal()) {
957 // Canceled
958 return;
959 }
960
961 // LL: Moved from PrefsDialog since wxWidgets on OSX can't deal with
962 // rebuilding the menus while the PrefsDialog is still in the modal
963 // state.
964 for (auto p : AllProjects{}) {
966// TODO: The comment below suggests this workaround is obsolete.
967#if defined(__WXGTK__)
968 // Workaround for:
969 //
970 // http://bugzilla.audacityteam.org/show_bug.cgi?id=458
971 //
972 // This workaround should be removed when Audacity updates to wxWidgets
973 // 3.x which has a fix.
974 auto &window = GetProjectFrame( *p );
975 wxRect r = window.GetRect();
976 window.SetSize(wxSize(1,1));
977 window.SetSize(r.GetSize());
978#endif
979 }
980}
981
982// Legacy functions, not used as of version 2.3.0
983
984#if 0
985void OnPasteOver(const CommandContext &context)
986{
987 auto &project = context.project;
988 auto &selectedRegion = project.GetViewInfo().selectedRegion;
989
990 if((AudacityProject::msClipT1 - AudacityProject::msClipT0) > 0.0)
991 {
992 selectedRegion.setT1(
993 selectedRegion.t0() +
994 (AudacityProject::msClipT1 - AudacityProject::msClipT0));
995 // MJS: pointless, given what we do in OnPaste?
996 }
997 OnPaste(context);
998
999 return;
1000}
1001#endif
1002
1003// Menu definitions
1004
1007 [](const AudacityProject &project){
1008 auto range = TrackList::Get(project).Any<const LabelTrack>()
1009 + [&](const LabelTrack *pTrack){
1010 return LabelTrackView::Get( *pTrack ).IsTextSelected(
1011 // unhappy const_cast because track focus might be set
1012 const_cast<AudacityProject&>(project)
1013 );
1014 };
1015 if ( !range.empty() )
1016 return true;
1017
1018 if (
1020 &&
1022 )
1023 return true;
1024
1025 return false;
1026 },
1028}; return flag; }
1029
1032 [](const AudacityProject &project)
1033 {
1035 return false;
1036
1037 const auto &viewInfo = ViewInfo::Get(project);
1038 if(viewInfo.selectedRegion.isPoint())
1039 return false;
1040
1041 const auto selectedTracks = TrackList::Get(project).Selected<const WaveTrack>();
1042 for (const auto track : selectedTracks)
1043 {
1044 const auto selectedClips =
1046 viewInfo.selectedRegion.t0(), viewInfo.selectedRegion.t1());
1047 if(selectedClips.size() > 1)
1048 return true;
1049 }
1050 return false;
1051 },
1053}; return flag; }
1054
1055using namespace MenuRegistry;
1057{
1058 static const auto NotBusyTimeAndTracksFlags =
1060
1061 // The default shortcut key for Redo is different on different platforms.
1062 static constexpr auto redoKey =
1063#ifdef __WXMSW__
1064 wxT("Ctrl+Y")
1065#else
1066 wxT("Ctrl+Shift+Z")
1067#endif
1068 ;
1069
1070 // The default shortcut key for Preferences is different on different
1071 // platforms.
1072 static constexpr auto prefKey =
1073#ifdef __WXMAC__
1074 wxT("Ctrl+,")
1075#else
1076 wxT("Ctrl+P")
1077#endif
1078 ;
1079
1080 static auto menu = std::shared_ptr{
1081 Menu( wxT("Edit"), XXO("&Edit"),
1082 Section( "UndoRedo",
1083 Command( wxT("Undo"), XXO("&Undo"), OnUndo,
1084 AudioIONotBusyFlag() | UndoAvailableFlag(), wxT("Ctrl+Z") ),
1085
1086 Command( wxT("Redo"), XXO("&Redo"), OnRedo,
1087 AudioIONotBusyFlag() | RedoAvailableFlag(), redoKey ),
1088
1089 MenuCreator::Special( wxT("UndoItemsUpdateStep"),
1090 [](AudacityProject &project, wxMenu&) {
1091 // Change names in the CommandManager as a side-effect
1093 })
1094 ),
1095
1096 Section( "Basic",
1097 // Basic Edit commands
1098 /* i18n-hint: (verb)*/
1099 Command( wxT("Cut"), XXO("Cu&t"), OnCut,
1101 wxT("Ctrl+X") ),
1102 Command( wxT("Delete"), XXO("&Delete"), OnDelete,
1104 wxT("Ctrl+K") ),
1105 /* i18n-hint: (verb)*/
1106 Command( wxT("Copy"), XXO("&Copy"), OnCopy,
1107 AudioIONotBusyFlag() | CutCopyAvailableFlag(), wxT("Ctrl+C") ),
1108 /* i18n-hint: (verb)*/
1109 Command( wxT("Paste"), XXO("&Paste"), OnPaste,
1110 AudioIONotBusyFlag(), wxT("Ctrl+V") ),
1111 /* i18n-hint: (verb)*/
1112 Command( wxT("Duplicate"), XXO("Duplic&ate"), OnDuplicate,
1113 NotBusyTimeAndTracksFlags, wxT("Ctrl+D") ),
1114
1115 Section( "",
1116 Menu( wxT("RemoveSpecial"), XXO("R&emove Special"),
1117 Section( "",
1118 /* i18n-hint: (verb) Do a special kind of cut*/
1119 Command( wxT("SplitCut"), XXO("Spl&it Cut"), OnSplitCut,
1120 NotBusyTimeAndTracksFlags,
1121 Options{ wxT("Ctrl+Alt+X") } ),
1122 /* i18n-hint: (verb) Do a special kind of DELETE*/
1123 Command( wxT("SplitDelete"), XXO("Split D&elete"), OnSplitDelete,
1124 NotBusyTimeAndTracksFlags,
1125 Options{ wxT("Ctrl+Alt+K") } )
1126 ),
1127
1128 Section( "",
1129 /* i18n-hint: (verb)*/
1130 Command( wxT("Silence"), XXO("Silence Audi&o"), OnSilence,
1132 wxT("Ctrl+L") ),
1133 /* i18n-hint: (verb)*/
1134 Command( wxT("Trim"), XXO("Tri&m Audio"), OnTrim,
1136 Options{ wxT("Ctrl+T") } )
1137 )
1138 )
1139 )
1140 ),
1141
1142
1143 Section( "Other",
1145
1146 Menu( wxT("Clip"), XXO("Audi&o Clips"),
1147 Section( "",
1148 /* i18n-hint: (verb) It's an item on a menu. */
1149 Command( wxT("Split"), XXO("Sp&lit"), OnSplit,
1151 Options{ wxT("Ctrl+I") } ),
1152 Command( wxT("SplitNew"), XXO("Split Ne&w"), OnSplitNew,
1154 Options{ wxT("Ctrl+Alt+I") } )
1155 ),
1156
1157 Section( "",
1158 /* i18n-hint: (verb)*/
1159 Command( wxT("Join"), XXO("&Join"), OnJoin,
1160 JoinClipsAvailableFlag(), wxT("Ctrl+J") ),
1161 Command( wxT("Disjoin"), XXO("Detac&h at Silences"), OnDisjoin,
1162 NotBusyTimeAndTracksFlags, wxT("Ctrl+Alt+J") )
1163 )
1164 )
1165
1166 ),
1167
1168 // Note that on Mac, the Preferences menu item is specially handled in
1169 // CommandManager (assigned a special wxWidgets id) so that it does
1170 // not appear in the Edit menu but instead under Audacity, consistent with
1171 // MacOS conventions.
1172 Section( "Preferences",
1173 Command( wxT("Preferences"), XXO("Pre&ferences"), OnPreferences,
1174 AudioIONotBusyFlag(), prefKey )
1175 )
1176
1177 ) };
1178 return menu;
1179}
1180
1182
1184{
1185 static const auto flags =
1187 static auto menu = std::shared_ptr{
1188 Menu( wxT("Edit"), XXO("&Edit"),
1189 Command( wxT("DeleteKey"), XXO("&Delete Key"), OnDelete,
1190 (flags | NoAutoSelect()),
1191 wxT("Backspace") ),
1192 Command( wxT("DeleteKey2"), XXO("Delete Key&2"), OnDelete,
1193 (flags | NoAutoSelect()),
1194 wxT("Delete") )
1195 ) };
1196 return menu;
1197}
1198
1203 (flagsRqd & NoAutoSelect()).none() )
1205};
1206
1208 []{ return TracksExistFlag(); },
1209 []{ return EditableTracksSelectedFlag(); },
1211 selectAll
1212}};
1213
1214// Including time tracks.
1216 []{ return TracksExistFlag(); },
1217 []{ return AnyTracksSelectedFlag(); },
1219 selectAll
1220}};
1221
1223 []{ return WaveTracksExistFlag(); },
1226 selectAll
1227}};
1228
1229// Also enable select for the noise reduction case.
1231 []{ return WaveTracksExistFlag(); },
1234 selectAll
1235}};
1236
1238 wxT("Optional/Extra/Part1")
1239};
1240
1241}
wxT("CloseDown"))
int AudacityMessageBox(const TranslatableString &message, const TranslatableString &caption, long style, wxWindow *parent, int x, int y)
Toolkit-neutral facade for basic user interface services.
AttachedItem sAttachment1
AttachedItem sAttachment2
std::bitset< NCommandFlags > CommandFlag
Definition: CommandFlag.h:30
const ReservedCommandFlag & NoAutoSelect()
const ReservedCommandFlag & NoiseReductionTimeSelectedFlag()
bool EditableTracksSelectedPred(const AudacityProject &project)
const ReservedCommandFlag & AudioIONotBusyFlag()
const ReservedCommandFlag & UndoAvailableFlag()
const ReservedCommandFlag & RedoAvailableFlag()
bool AudioIOBusyPred(const AudacityProject &project)
const ReservedCommandFlag & TimeSelectedFlag()
const ReservedCommandFlag & EditableTracksSelectedFlag()
const ReservedCommandFlag & AnyTracksSelectedFlag()
const ReservedCommandFlag & TracksExistFlag()
const ReservedCommandFlag & WaveTracksExistFlag()
const ReservedCommandFlag & WaveTracksSelectedFlag()
bool TimeSelectedPred(const AudacityProject &project)
@ none
Definition: Dither.h:20
XO("Cut/Copy/Paste")
XXO("&Cut/Copy/Paste Toolbar")
#define XC(s, c)
Definition: Internat.h:37
#define QUANTIZED_TIME(time, rate)
Definition: MemoryX.h:336
audacity::BasicSettings * gPrefs
Definition: Prefs.cpp:68
an object holding per-project preferred sample rate
AUDACITY_DLL_API wxFrame & GetProjectFrame(AudacityProject &project)
Get the top-level window associated with the project (as a wxFrame only, when you do not need to use ...
#define SAMPLE_SIZE(SampleFormat)
Definition: SampleFormat.h:52
const std::optional< double > & GetProjectTempo(const ChannelGroup &group)
Definition: TempoChange.cpp:48
const auto tracks
const auto project
Contains declarations for TimeWarper, IdentityTimeWarper, ShiftTimeWarper, LinearTimeWarper,...
std::function< void(double)> ProgressReporter
Definition: Track.h:48
ChoiceSetting TracksBehaviorsAudioTrackPastePolicy
An AudacityException with no visible message.
static std::once_flag flag
static AdornedRulerPanel & Get(AudacityProject &project)
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:90
virtual size_t NChannels() const =0
Report the number of channels.
wxString Read() const
Definition: Prefs.cpp:388
static Clipboard & Get()
Definition: Clipboard.cpp:28
CommandContext provides additional information to an 'Apply()' command. It provides the project,...
TemporarySelection temporarySelection
AudacityProject & project
static CommandManager & Get(AudacityProject &project)
Abstract base class used in importing a file.
A LabelTrack is a Track that holds labels (LabelStruct).
Definition: LabelTrack.h:95
static LabelTrackView & Get(LabelTrack &)
bool IsTextSelected(AudacityProject &project) const
int GetTextEditIndex(AudacityProject &project) const
static constexpr auto Special
Definition: MenuCreator.h:36
void RebuildMenuBar()
static MenuCreator & Get(AudacityProject &project)
Definition: MenuCreator.cpp:91
A Track that is used for Midi notes. (Somewhat old code).
Definition: NoteTrack.h:78
Track::Holder Cut(double t0, double t1) override
Create tracks and modify this track.
Definition: NoteTrack.cpp:320
void Clear(double t0, double t1) override
Definition: NoteTrack.cpp:397
Track::Holder Copy(double t0, double t1, bool forClipboard=true) const override
Create new tracks and don't modify this track.
Definition: NoteTrack.cpp:350
double duration() const
Definition: ViewInfo.h:41
bool setTimes(double t0, double t1)
Definition: ViewInfo.cpp:51
double t0() const
Definition: ViewInfo.h:35
Unit slope but with either a jump (pasting more) or a flat interval (pasting less)
Definition: TimeWarper.h:181
int ShowModal() override
void PushState(const TranslatableString &desc, const TranslatableString &shortDesc)
void PopState(const UndoState &state, bool doAutosave=true)
static ProjectHistory & Get(AudacityProject &project)
static ProjectRate & Get(AudacityProject &project)
Definition: ProjectRate.cpp:28
double GetRate() const
Definition: ProjectRate.cpp:53
static ProjectTimeSignature & Get(AudacityProject &project)
Generates classes whose instances register items at construction.
Definition: Registry.h:388
static TrackIterRange< Track > Group(Track &track)
Definition: SyncLock.cpp:150
static bool IsSelectedOrSyncLockSelectedP(const Track *pTrack)
Definition: SyncLock.h:61
static bool IsSelectedOrSyncLockSelected(const Track &track)
Definition: SyncLock.cpp:104
bool IsSyncLocked() const
Definition: SyncLock.cpp:44
static SyncLockState & Get(AudacityProject &project)
Definition: SyncLock.cpp:27
Track * Get()
Definition: TrackFocus.cpp:156
Abstract base class for an object holding data associated with points on a time axis.
Definition: Track.h:110
virtual void SetSelected(bool s)
Definition: Track.cpp:83
virtual Holder PasteInto(AudacityProject &project, TrackList &list) const =0
bool SameKindAs(const Track &track) const
Definition: Track.h:373
virtual bool SupportsBasicEditing() const
Whether this track type implements cut-copy-paste; by default, true.
Definition: Track.cpp:797
R TypeSwitch(const Functions &...functions)
Definition: Track.h:381
A flat linked list of tracks supporting Add, Remove, Clear, and Contains, serialization of the list o...
Definition: Track.h:850
static TrackListHolder Create(AudacityProject *pOwner)
Definition: Track.cpp:330
auto Any() -> TrackIterRange< TrackType >
Definition: Track.h:950
static TrackList & Get(AudacityProject &project)
Definition: Track.cpp:314
auto Selected() -> TrackIterRange< TrackType >
Definition: Track.h:967
static TrackPanel & Get(AudacityProject &project)
Definition: TrackPanel.cpp:234
static UndoManager & Get(AudacityProject &project)
Definition: UndoManager.cpp:71
NotifyingSelectedRegion selectedRegion
Definition: ViewInfo.h:215
static ViewInfo & Get(AudacityProject &project)
Definition: ViewInfo.cpp:235
void ShowTrack(const Track &track)
Definition: Viewport.cpp:456
static Viewport & Get(AudacityProject &project)
Definition: Viewport.cpp:33
static WaveChannelView & GetFirst(WaveTrack &wt)
Get the view of the first channel.
static WaveTrackFactory & Get(AudacityProject &project)
Definition: WaveTrack.cpp:3349
A Track that contains audio waveform data.
Definition: WaveTrack.h:203
void SplitDelete(double t0, double t1)
Definition: WaveTrack.cpp:1503
void Silence(double t0, double t1, ProgressReporter reportProgress) override
Definition: WaveTrack.cpp:1979
void Trim(double t0, double t1)
Definition: WaveTrack.cpp:957
Holder SplitCut(double t0, double t1)
Definition: WaveTrack.cpp:943
void ClearAndPaste(double t0, double t1, const WaveTrack &src, bool preserve=true, bool merge=true, const TimeWarper *effectWarper=nullptr, bool clearByTrimming=false)
Definition: WaveTrack.cpp:1196
Track::Holder Copy(double t0, double t1, bool forClipboard=true) const override
Create new tracks and don't modify this track.
Definition: WaveTrack.cpp:1073
double SnapToSample(double t) const
bool ReadBool(const wxString &key, bool defaultValue) const
virtual bool Read(const wxString &key, bool *value) const =0
std::function< void(double)> ProgressReporter
Definition: BasicUI.h:25
void SplitProgress(ItType first, ItType last, FnType action, ProgressReporter parent)
Helper for the update of a task's progress bar when this task is made of a range's subtasks.
Definition: BasicUI.h:331
std::unique_ptr< ProgressDialog > MakeProgress(const TranslatableString &title, const TranslatableString &message, unsigned flags=(ProgressShowStop|ProgressShowCancel), const TranslatableString &remainingLabelText={})
Create and display a progress dialog.
Definition: BasicUI.h:294
constexpr auto Section
Definition: MenuRegistry.h:436
constexpr auto Command
Definition: MenuRegistry.h:456
constexpr auto Menu
Items will appear in a main toolbar menu or in a sub-menu.
Definition: MenuRegistry.h:445
MENUS_API void Visit(Visitor< Traits > &visitor, AudacityProject &project)
std::unique_ptr< detail::IndirectItem< Item > > Indirect(const std::shared_ptr< Item > &ptr)
A convenience function.
Definition: Registry.h:175
void DoSelectAllAudio(AudacityProject &project)
WAVE_TRACK_API void WithClipRenderingProgress(std::function< void(const ProgressReporter &)> action, TranslatableString title=defaultStretchRenderingTitle)
WAVE_TRACK_API size_t CountBlocks(const WaveTrack &track)
WAVE_TRACK_API sampleCount GetSequenceSamplesCount(const WaveTrack &track)
WAVE_TRACK_API void DiscardTrimmed(WaveTrack &track)
Remove hidden audio from all clips.
WAVE_TRACK_API WaveTrack::IntervalConstHolders GetClipsIntersecting(const WaveTrack &track, double t0, double t1)
std::shared_ptr< const TrackList > FindSourceTracks(const CommandContext &context)
Definition: EditMenus.cpp:421
Correspondence FindCorrespondence(TrackList &dstTracks, const TrackList &srcTracks)
Definition: EditMenus.cpp:496
wxULongLong EstimateCopyBytesCount(const TrackList &src, const TrackList &dst)
Definition: EditMenus.cpp:89
BlockArray::size_type EstimateCopiedBlocks(const TrackList &src, const TrackList &dst)
Definition: EditMenus.cpp:101
void OnDisjoin(const CommandContext &context)
Definition: EditMenus.cpp:935
void DoPasteNothingSelected(AudacityProject &project, const TrackList &src, double t0, double t1)
Definition: EditMenus.cpp:126
bool DoPasteText(AudacityProject &project)
Definition: EditMenus.cpp:45
void OnRedo(const CommandContext &context)
Definition: EditMenus.cpp:209
void OnJoin(const CommandContext &context)
Definition: EditMenus.cpp:911
RegisteredMenuItemEnabler selectWaveTracks
Definition: EditMenus.cpp:1222
std::shared_ptr< TrackList > DuplicateDiscardTrimmed(const TrackList &src)
Definition: EditMenus.cpp:109
bool FitsInto(const Track &src, const Track &dst)
Whether the source track may be pasted into the destination track.
Definition: EditMenus.cpp:483
RegisteredMenuItemEnabler selectTracks
Definition: EditMenus.cpp:1207
void OnDelete(const CommandContext &context)
Definition: EditMenus.cpp:330
auto NotificationScope(const CommandContext &context, const TrackList &srcTracks)
Definition: EditMenus.cpp:456
void OnPaste(const CommandContext &context)
Definition: EditMenus.cpp:526
const ReservedCommandFlag & CutCopyAvailableFlag()
Definition: EditMenus.cpp:1006
void OnSplit(const CommandContext &context)
Definition: EditMenus.cpp:797
std::pair< double, double > FindSelection(const CommandContext &context)
Definition: EditMenus.cpp:399
void OnSilence(const CommandContext &context)
Definition: EditMenus.cpp:753
RegisteredMenuItemEnabler selectWaveTracks2
Definition: EditMenus.cpp:1230
const ReservedCommandFlag & JoinClipsAvailableFlag()
Definition: EditMenus.cpp:1031
void OnTrim(const CommandContext &context)
Definition: EditMenus.cpp:777
void OnSplitDelete(const CommandContext &context)
Definition: EditMenus.cpp:731
std::vector< std::pair< Track *, const Track * > > Correspondence
Definition: EditMenus.cpp:494
void OnCopy(const CommandContext &context)
Definition: EditMenus.cpp:355
void OnUndo(const CommandContext &context)
Definition: EditMenus.cpp:180
void OnSplitCut(const CommandContext &context)
Definition: EditMenus.cpp:697
void OnPreferences(const CommandContext &context)
Definition: EditMenus.cpp:950
void OnDuplicate(const CommandContext &context)
Definition: EditMenus.cpp:670
RegisteredMenuItemEnabler selectAnyTracks
Definition: EditMenus.cpp:1215
bool HasHiddenData(const TrackList &trackList)
Definition: EditMenus.cpp:169
void OnSplitNew(const CommandContext &context)
Definition: EditMenus.cpp:862
void OnCut(const CommandContext &context)
Definition: EditMenus.cpp:237
CommandFlagOptions && DisableDefaultMessage() &&
Definition: CommandFlag.h:53
SelectedRegion * pSelectedRegion
Holds one item with description and time range for the UndoManager.
Definition: UndoManager.h:117
UndoState state
Definition: UndoManager.h:128