Audacity 3.2.0
Enumerations | Functions | Variables
anonymous_namespace{TrackMenus.cpp} Namespace Reference

Enumerations

enum  {
  kAlignStartZero = 0 , kAlignStartSelStart , kAlignStartSelEnd , kAlignEndSelStart ,
  kAlignEndSelEnd , kAlignEndToEnd , kAlignTogether
}
 
enum  { kAudacitySortByTime = (1 << 1) , kAudacitySortByName = (1 << 2) }
 

Functions

void DoMixAndRender (AudacityProject &project, bool toNewTrack)
 
void DoPanTracks (AudacityProject &project, float PanValue)
 
static const std::vector< ComponentInterfaceSymbol > & alignLabels ()
 
const size_t kAlignLabelsCount ()
 
void DoAlign (AudacityProject &project, int index, bool moveSel)
 
void DoSortTracks (AudacityProject &project, int flags)
 
void SetTrackGain (AudacityProject &project, WaveTrack *wt, LWSlider *slider)
 
void SetTrackPan (AudacityProject &project, WaveTrack *wt, LWSlider *slider)
 
void OnStereoToMono (const CommandContext &context)
 
void OnMixAndRender (const CommandContext &context)
 
void OnMixAndRenderToNewTrack (const CommandContext &context)
 
void OnResample (const CommandContext &context)
 
void OnRemoveTracks (const CommandContext &context)
 
static void MuteTracks (const CommandContext &context, bool mute, bool selected)
 
void OnMuteAllTracks (const CommandContext &context)
 
void OnUnmuteAllTracks (const CommandContext &context)
 
void OnMuteSelectedTracks (const CommandContext &context)
 
void OnUnmuteSelectedTracks (const CommandContext &context)
 
void OnPanLeft (const CommandContext &context)
 
void OnPanRight (const CommandContext &context)
 
void OnPanCenter (const CommandContext &context)
 
void OnAlignNoSync (const CommandContext &context)
 
void OnAlign (const CommandContext &context)
 
void OnMoveSelectionWithTracks (const CommandContext &WXUNUSED(context))
 
void OnSortTime (const CommandContext &context)
 
void OnSortName (const CommandContext &context)
 
void OnSyncLock (const CommandContext &context)
 
void OnTrackPan (const CommandContext &context)
 
void OnTrackPanLeft (const CommandContext &context)
 
void OnTrackPanRight (const CommandContext &context)
 
void OnTrackGain (const CommandContext &context)
 
void OnTrackGainInc (const CommandContext &context)
 
void OnTrackGainDec (const CommandContext &context)
 
void OnTrackMenu (const CommandContext &context)
 
void OnTrackMute (const CommandContext &context)
 
void OnTrackSolo (const CommandContext &context)
 
void OnTrackClose (const CommandContext &context)
 
void OnTrackMoveUp (const CommandContext &context)
 
void OnTrackMoveDown (const CommandContext &context)
 
void OnTrackMoveTop (const CommandContext &context)
 
void OnTrackMoveBottom (const CommandContext &context)
 
BaseItemSharedPtr TracksMenu ()
 
BaseItemSharedPtr ExtraTrackMenu ()
 

Variables

AttachedItem sAttachment1
 
AttachedItem sAttachment2
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
kAlignStartZero 
kAlignStartSelStart 
kAlignStartSelEnd 
kAlignEndSelStart 
kAlignEndSelEnd 
kAlignEndToEnd 
kAlignTogether 

Definition at line 177 of file TrackMenus.cpp.

◆ anonymous enum

anonymous enum
Enumerator
kAudacitySortByTime 
kAudacitySortByName 

Definition at line 496 of file TrackMenus.cpp.

Function Documentation

◆ alignLabels()

static const std::vector< ComponentInterfaceSymbol > & anonymous_namespace{TrackMenus.cpp}::alignLabels ( )
static

Definition at line 189 of file TrackMenus.cpp.

189 { static std::vector< ComponentInterfaceSymbol > symbols{
190 { wxT("StartToZero"), XXO("Start to &Zero") },
191 { wxT("StartToSelStart"), XXO("Start to &Cursor/Selection Start") },
192 { wxT("StartToSelEnd"), XXO("Start to Selection &End") },
193 { wxT("EndToSelStart"), XXO("End to Cu&rsor/Selection Start") },
194 { wxT("EndToSelEnd"), XXO("End to Selection En&d") },
195}; return symbols; }
wxT("CloseDown"))
XXO("&Cut/Copy/Paste Toolbar")

References wxT(), and XXO().

Referenced by kAlignLabelsCount(), and TracksMenu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DoAlign()

void anonymous_namespace{TrackMenus.cpp}::DoAlign ( AudacityProject project,
int  index,
bool  moveSel 
)

Definition at line 199 of file TrackMenus.cpp.

201{
202 auto &tracks = TrackList::Get( project );
203 auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
204 auto &window = ProjectWindow::Get( project );
205
206 TranslatableString action, shortAction;
207 double delta = 0.0;
208 double newPos = -1.0;
209
210 auto channelRange = tracks.Selected< AudioTrack >();
211 auto trackRange = tracks.SelectedLeaders< AudioTrack >();
212
213 auto FindOffset = []( const Track *pTrack ) {
214 return TrackList::Channels(pTrack).min( &Track::GetOffset ); };
215
216 auto firstTrackOffset = [&]{ return FindOffset( *trackRange.begin() ); };
217 auto minOffset = [&]{ return trackRange.min( FindOffset ); };
218 auto avgOffset = [&]{
219 return trackRange.sum( FindOffset ) /
220 std::max( size_t(1), trackRange.size() ); };
221
222 auto maxEndOffset = [&]{
223 return std::max(0.0, channelRange.max( &Track::GetEndTime ) ); };
224
225 switch(index) {
226 case kAlignStartZero:
227 delta = -minOffset();
228 action = moveSel
229 /* i18n-hint: In this and similar messages describing editing actions,
230 the starting or ending points of tracks are re-"aligned" to other
231 times, and the time selection may be "moved" too. The first
232 noun -- "start" in this example -- is the object of a verb (not of
233 an implied preposition "from"). */
234 ? XO("Aligned/Moved start to zero")
235 : XO("Aligned start to zero");
236 shortAction = moveSel
237 /* i18n-hint: This and similar messages give shorter descriptions of
238 the aligning and moving editing actions */
239 ? XO("Align/Move Start")
240 : XO("Align Start");
241 break;
243 delta = selectedRegion.t0() - minOffset();
244 action = moveSel
245 ? XO("Aligned/Moved start to cursor/selection start")
246 : XO("Aligned start to cursor/selection start");
247 shortAction = moveSel
248 ? XO("Align/Move Start")
249 : XO("Align Start");
250 break;
252 delta = selectedRegion.t1() - minOffset();
253 action = moveSel
254 ? XO("Aligned/Moved start to selection end")
255 : XO("Aligned start to selection end");
256 shortAction = moveSel
257 ? XO("Align/Move Start")
258 : XO("Align Start");
259 break;
261 delta = selectedRegion.t0() - maxEndOffset();
262 action = moveSel
263 ? XO("Aligned/Moved end to cursor/selection start")
264 : XO("Aligned end to cursor/selection start");
265 shortAction =
266 moveSel
267 ? XO("Align/Move End")
268 : XO("Align End");
269 break;
270 case kAlignEndSelEnd:
271 delta = selectedRegion.t1() - maxEndOffset();
272 action = moveSel
273 ? XO("Aligned/Moved end to selection end")
274 : XO("Aligned end to selection end");
275 shortAction =
276 moveSel
277 ? XO("Align/Move End")
278 : XO("Align End");
279 break;
280 // index set in alignLabelsNoSync
281 case kAlignEndToEnd:
282 newPos = firstTrackOffset();
283 action = moveSel
284 ? XO("Aligned/Moved end to end")
285 : XO("Aligned end to end");
286 shortAction =
287 moveSel
288 ? XO("Align/Move End to End")
289 : XO("Align End to End");
290 break;
291 case kAlignTogether:
292 newPos = avgOffset();
293 action = moveSel
294 ? XO("Aligned/Moved together")
295 : XO("Aligned together");
296 shortAction =
297 moveSel
298 ? XO("Align/Move Together")
299 : XO("Align Together");
300 }
301
302 if ((unsigned)index >= kAlignLabelsCount()) {
303 // This is an alignLabelsNoSync command.
304 for (auto t : tracks.SelectedLeaders< AudioTrack >()) {
305 // This shifts different tracks in different ways, so no sync-lock
306 // move.
307 // Only align Wave and Note tracks end to end.
308 auto channels = TrackList::Channels(t);
309
310 auto trackStart = channels.min( &Track::GetStartTime );
311 auto trackEnd = channels.max( &Track::GetEndTime );
312
313 for (auto channel : channels)
314 // Move the track
315 channel->SetOffset(newPos + channel->GetStartTime() - trackStart);
316
317 if (index == kAlignEndToEnd)
318 newPos += (trackEnd - trackStart);
319 }
320 if (index == kAlignEndToEnd)
321 window.DoZoomFit();
322 }
323
324 if (delta != 0.0) {
325 // For a fixed-distance shift move sync-lock selected tracks also.
326 for (auto t : tracks.Any()
328 t->SetOffset(t->GetOffset() + delta);
329 }
330
331 if (moveSel)
332 selectedRegion.move(delta);
333
334 ProjectHistory::Get( project ).PushState(action, shortAction);
335}
XO("Cut/Copy/Paste")
Track subclass holding data representing sound (as notes, or samples, or ...)
Definition: Track.h:897
size_t size() const
How many attachment pointers are in the Site.
Definition: ClientData.h:251
void PushState(const TranslatableString &desc, const TranslatableString &shortDesc)
static ProjectHistory & Get(AudacityProject &project)
static ProjectWindow & Get(AudacityProject &project)
static bool IsSelectedOrSyncLockSelected(const Track *pTrack)
Definition: SyncLock.cpp:73
Abstract base class for an object holding data associated with points on a time axis.
Definition: Track.h:225
virtual double GetStartTime() const =0
virtual double GetOffset() const =0
virtual double GetEndTime() const =0
static TrackList & Get(AudacityProject &project)
Definition: Track.cpp:486
static auto Channels(TrackType *pTrack) -> TrackIterRange< TrackType >
Definition: Track.h:1541
Holds a msgid for the translation catalog; may also bind format arguments.
NotifyingSelectedRegion selectedRegion
Definition: ViewInfo.h:217
static ViewInfo & Get(AudacityProject &project)
Definition: ViewInfo.cpp:234

References TrackList::Channels(), ProjectHistory::Get(), ViewInfo::Get(), TrackList::Get(), ProjectWindow::Get(), Track::GetEndTime(), Track::GetOffset(), Track::GetStartTime(), SyncLock::IsSelectedOrSyncLockSelected(), kAlignEndSelEnd, kAlignEndSelStart, kAlignEndToEnd, kAlignLabelsCount(), kAlignStartSelEnd, kAlignStartSelStart, kAlignStartZero, kAlignTogether, ProjectHistory::PushState(), ViewInfo::selectedRegion, ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::size(), and XO().

Referenced by OnAlign(), and OnAlignNoSync().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DoMixAndRender()

void anonymous_namespace{TrackMenus.cpp}::DoMixAndRender ( AudacityProject project,
bool  toNewTrack 
)

Definition at line 48 of file TrackMenus.cpp.

50{
51 auto &tracks = TrackList::Get( project );
52 auto &trackFactory = WaveTrackFactory::Get( project );
53 auto rate = ProjectRate::Get(project).GetRate();
54 auto defaultFormat = QualitySettings::SampleFormatChoice();
55 auto &trackPanel = TrackPanel::Get( project );
56 auto &window = ProjectWindow::Get( project );
57
58 auto trackRange = tracks.Selected< WaveTrack >();
59 WaveTrack::Holder uNewLeft, uNewRight;
60 ::MixAndRender(trackRange.Filter<const WaveTrack>(),
61 Mixer::WarpOptions{ tracks },
62 tracks.MakeUniqueTrackName(_("Mix")),
63 &trackFactory, rate, defaultFormat, 0.0, 0.0, uNewLeft, uNewRight);
64
65 if (uNewLeft) {
66 // Remove originals, get stats on what tracks were mixed
67
68 // But before removing, determine the first track after the removal
69 auto last = *trackRange.rbegin();
70 auto insertionPoint = * ++ tracks.Find( last );
71
72 auto selectedCount = (trackRange + &Track::IsLeader).size();
73 wxString firstName;
74 int firstColour = -1;
75 if (selectedCount > 0) {
76 firstName = (*trackRange.begin())->GetName();
77 firstColour = (*trackRange.begin())->GetWaveColorIndex();
78 }
79 if (!toNewTrack) {
80 // Beware iterator invalidation!
81 for (auto &it = trackRange.first, &end = trackRange.second; it != end;)
82 tracks.Remove( *it++ );
83 }
84
85 // Add NEW tracks
86
87 auto pNewLeft = tracks.Add( uNewLeft );
88 decltype(pNewLeft) pNewRight{};
89 if (uNewRight)
90 {
91 pNewRight = tracks.Add(uNewRight);
92 tracks.MakeMultiChannelTrack(*pNewLeft, 2, true);
93 }
94
95 // If we're just rendering (not mixing), keep the track name the same
96 if (selectedCount==1) {
97 pNewLeft->SetName(firstName);
98 if (pNewRight) {
99 pNewRight->SetName(firstName);
100 }
101 }
102
103 // Bug 2218, remember more things...
104 if (selectedCount>=1) {
105 pNewLeft->SetWaveColorIndex(firstColour);
106 pNewLeft->SetSelected(!toNewTrack);
107 if (pNewRight) {
108 pNewRight->SetWaveColorIndex(firstColour);
109 pNewRight->SetSelected(!toNewTrack);
110 }
111 }
112
113 // Permute the tracks as needed
114 // The new track appears after the old tracks (or where the old tracks
115 // had been) so that they are in the same sync-lock group
116 if (insertionPoint)
117 {
118 std::vector<TrackNodePointer> arr;
119 arr.reserve( tracks.size() );
120 size_t begin = 0, ii = 0;
121 for (auto iter = tracks.ListOfTracks::begin(),
122 end = tracks.ListOfTracks::end(); iter != end; ++iter) {
123 arr.push_back( {iter, &tracks} );
124 if ( iter->get() == insertionPoint )
125 begin = ii;
126 ++ii;
127 }
128 auto mid = arr.end();
129 std::advance( mid, -TrackList::Channels( pNewLeft ).size() );
130 std::rotate( arr.begin() + begin, mid, arr.end() );
131 tracks.Permute( arr );
132 }
133
134 // Smart history/undo message
135 if (selectedCount==1) {
136 auto msg = XO("Rendered all audio in track '%s'").Format( firstName );
137 /* i18n-hint: Convert the audio into a more usable form, so apply
138 * panning and amplification and write to some external file.*/
139 ProjectHistory::Get( project ).PushState(msg, XO("Render"));
140 }
141 else {
142 auto msg = (pNewRight
143 ? XO("Mixed and rendered %d tracks into one new stereo track")
144 : XO("Mixed and rendered %d tracks into one new mono track")
145 )
146 .Format( (int)selectedCount );
147 ProjectHistory::Get( project ).PushState(msg, XO("Mix and Render"));
148 }
149
150 trackPanel.SetFocus();
151 TrackFocus::Get( project ).Set( pNewLeft );
152 pNewLeft->EnsureVisible();
153 }
154}
#define _(s)
Definition: Internat.h:75
void MixAndRender(const TrackIterRange< const WaveTrack > &trackRange, const Mixer::WarpOptions &warpOptions, const wxString &newTrackName, WaveTrackFactory *trackFactory, double rate, sampleFormat format, double startTime, double endTime, WaveTrack::Holder &uLeft, WaveTrack::Holder &uRight)
Mixes together all input tracks, applying any envelopes, amplitude gain, panning, and real-time effec...
Abstract base class used in importing a file.
static ProjectRate & Get(AudacityProject &project)
Definition: ProjectRate.cpp:28
double GetRate() const
Definition: ProjectRate.cpp:53
Track * Get()
void EnsureVisible(bool modifyState=false)
Definition: Track.cpp:97
bool IsLeader() const
Definition: Track.cpp:405
static TrackPanel & Get(AudacityProject &project)
Definition: TrackPanel.cpp:230
static WaveTrackFactory & Get(AudacityProject &project)
Definition: WaveTrack.cpp:2797
A Track that contains audio waveform data.
Definition: WaveTrack.h:57
std::shared_ptr< WaveTrack > Holder
Definition: WaveTrack.h:106
auto end(const Ptr< Type, BaseDeleter > &p)
Enables range-for.
Definition: PackedArray.h:159
auto begin(const Ptr< Type, BaseDeleter > &p)
Enables range-for.
Definition: PackedArray.h:150
PROJECT_RATE_API sampleFormat SampleFormatChoice()
Immutable structure is an argument to Mixer's constructor.
Definition: MixerOptions.h:54

References _, PackedArray::begin(), TrackList::Channels(), PackedArray::end(), Track::EnsureVisible(), TrackFocus::Get(), ProjectHistory::Get(), ProjectRate::Get(), TrackList::Get(), ProjectWindow::Get(), TrackPanel::Get(), WaveTrackFactory::Get(), ProjectRate::GetRate(), Track::IsLeader(), MixAndRender(), ProjectHistory::PushState(), QualitySettings::SampleFormatChoice(), size, and XO().

Referenced by OnMixAndRender(), and OnMixAndRenderToNewTrack().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DoPanTracks()

void anonymous_namespace{TrackMenus.cpp}::DoPanTracks ( AudacityProject project,
float  PanValue 
)

Definition at line 156 of file TrackMenus.cpp.

157{
158 auto &tracks = TrackList::Get( project );
159 auto &window = ProjectWindow::Get( project );
160
161 // count selected wave tracks
162 const auto range = tracks.Any< WaveTrack >();
163 const auto selectedRange = range + &Track::IsSelected;
164 auto count = selectedRange.size();
165
166 // iter through them, all if none selected.
167 for (auto left : count == 0 ? range : selectedRange )
168 left->SetPan( PanValue );
169
170 auto flags = UndoPush::NONE;
171 ProjectHistory::Get( project )
172 /*i18n-hint: One or more audio tracks have been panned*/
173 .PushState(XO("Panned audio track(s)"), XO("Pan Track"), flags);
174 flags = flags | UndoPush::CONSOLIDATE;
175}
bool IsSelected() const
Definition: Track.cpp:402

References CONSOLIDATE, ProjectHistory::Get(), TrackList::Get(), ProjectWindow::Get(), Track::IsSelected(), NONE, ProjectHistory::PushState(), ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::size(), and XO().

Referenced by OnPanCenter(), OnPanLeft(), and OnPanRight().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DoSortTracks()

void anonymous_namespace{TrackMenus.cpp}::DoSortTracks ( AudacityProject project,
int  flags 
)

Definition at line 501 of file TrackMenus.cpp.

502{
503 auto GetTime = [](const Track *t) {
504 return t->TypeSwitch< double >(
505 [&](const WaveTrack* w) {
506 auto stime = w->GetEndTime();
507
508 int ndx;
509 for (ndx = 0; ndx < w->GetNumClips(); ndx++) {
510 const auto c = w->GetClipByIndex(ndx);
511 if (c->GetPlaySamplesCount() == 0)
512 continue;
513 stime = std::min(stime, c->GetPlayStartTime());
514 }
515 return stime;
516 },
517 [&](const LabelTrack* l) {
518 return l->GetStartTime();
519 }
520 );
521 };
522
523 size_t ndx = 0;
524 // This one place outside of TrackList where we must use undisguised
525 // std::list iterators! Avoid this elsewhere!
526 std::vector<TrackNodePointer> arr;
527 auto &tracks = TrackList::Get( project );
528 arr.reserve(tracks.size());
529
530 // First find the permutation.
531 // This routine, very unusually, deals with the underlying stl list
532 // iterators, not with TrackIter! Dangerous!
533 for (auto iter = tracks.ListOfTracks::begin(),
534 end = tracks.ListOfTracks::end(); iter != end; ++iter) {
535 const auto &track = *iter;
536 if ( !track->IsLeader() )
537 // keep channels contiguous
538 ndx++;
539 else {
540 auto size = arr.size();
541 for (ndx = 0; ndx < size;) {
542 Track &arrTrack = **arr[ndx].first;
543 auto channels = TrackList::Channels(&arrTrack);
544 if(flags & kAudacitySortByName) {
545 //do case insensitive sort - cmpNoCase returns less than zero if
546 // the string is 'less than' its argument
547 //also if we have case insensitive equality, then we need to sort
548 // by case as well
549 //We sort 'b' before 'B' accordingly. We uncharacteristically
550 // use greater than for the case sensitive
551 //compare because 'b' is greater than 'B' in ascii.
552 auto cmpValue = track->GetName().CmpNoCase(arrTrack.GetName());
553 if ( cmpValue < 0 ||
554 ( 0 == cmpValue &&
555 track->GetName().CompareTo(arrTrack.GetName()) > 0 ) )
556 break;
557 }
558 //sort by time otherwise
559 else if(flags & kAudacitySortByTime) {
560 auto time1 = TrackList::Channels(track.get()).min( GetTime );
561
562 //get candidate's (from sorted array) time
563 auto time2 = channels.min( GetTime );
564
565 if (time1 < time2)
566 break;
567 }
568 ndx += channels.size();
569 }
570 }
571 arr.insert(arr.begin() + ndx, TrackNodePointer{iter, &tracks});
572 }
573
574 // Now apply the permutation
575 tracks.Permute(arr);
576}
int min(int a, int b)
std::pair< ListOfTracks::iterator, ListOfTracks * > TrackNodePointer
Pairs a std::list iterator and a pointer to a list, for comparison purposes.
Definition: Track.h:48
A LabelTrack is a Track that holds labels (LabelStruct).
Definition: LabelTrack.h:87
wxString GetName() const
Definition: Track.h:466

References TrackList::Channels(), PackedArray::end(), TrackList::Get(), Track::GetName(), kAudacitySortByName, kAudacitySortByTime, min(), and size.

Referenced by OnSortName(), and OnSortTime().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ExtraTrackMenu()

BaseItemSharedPtr anonymous_namespace{TrackMenus.cpp}::ExtraTrackMenu ( )

Definition at line 1348 of file TrackMenus.cpp.

1349{
1351 static BaseItemSharedPtr menu{
1352 Menu( wxT("Track"), XXO("&Track"),
1353 Command( wxT("TrackPan"), XXO("Change P&an on Focused Track..."),
1354 OnTrackPan,
1355 TrackPanelHasFocus() | TracksExistFlag(), wxT("Shift+P") ),
1356 Command( wxT("TrackPanLeft"), XXO("Pan &Left on Focused Track"),
1358 TrackPanelHasFocus() | TracksExistFlag(), wxT("Alt+Shift+Left") ),
1359 Command( wxT("TrackPanRight"), XXO("Pan &Right on Focused Track"),
1361 TrackPanelHasFocus() | TracksExistFlag(), wxT("Alt+Shift+Right") ),
1362 Command( wxT("TrackGain"), XXO("Change Gai&n on Focused Track..."),
1364 TrackPanelHasFocus() | TracksExistFlag(), wxT("Shift+G") ),
1365 Command( wxT("TrackGainInc"), XXO("&Increase Gain on Focused Track"),
1367 TrackPanelHasFocus() | TracksExistFlag(), wxT("Alt+Shift+Up") ),
1368 Command( wxT("TrackGainDec"), XXO("&Decrease Gain on Focused Track"),
1370 TrackPanelHasFocus() | TracksExistFlag(), wxT("Alt+Shift+Down") ),
1371 Command( wxT("TrackMenu"), XXO("Op&en Menu on Focused Track..."),
1374 Options{ wxT("Shift+M") }.SkipKeyDown() ),
1375 Command( wxT("TrackMute"), XXO("M&ute/Unmute Focused Track"),
1377 TracksExistFlag() | TrackPanelHasFocus(), wxT("Shift+U") ),
1378 Command( wxT("TrackSolo"), XXO("&Solo/Unsolo Focused Track"),
1380 TracksExistFlag() | TrackPanelHasFocus(), wxT("Shift+S") ),
1381 Command( wxT("TrackClose"), XXO("&Close Focused Track"),
1384 wxT("Shift+C") ),
1385 Command( wxT("TrackMoveUp"), XXO("Move Focused Track U&p"),
1388 Command( wxT("TrackMoveDown"), XXO("Move Focused Track Do&wn"),
1391 Command( wxT("TrackMoveTop"), XXO("Move Focused Track to T&op"),
1394 Command( wxT("TrackMoveBottom"), XXO("Move Focused Track to &Bottom"),
1397 ) };
1398 return menu;
1399}
const ReservedCommandFlag & AudioIONotBusyFlag()
const ReservedCommandFlag & TracksExistFlag()
const ReservedCommandFlag & TrackPanelHasFocus()
std::unique_ptr< MenuItem > Menu(const Identifier &internalName, const TranslatableString &title, Args &&... args)
std::unique_ptr< CommandItem > Command(const CommandID &name, const TranslatableString &label_in, void(Handler::*pmf)(const CommandContext &), CommandFlag flags, const CommandManager::Options &options={}, CommandHandlerFinder finder=FinderScope::DefaultFinder())
std::shared_ptr< BaseItem > BaseItemSharedPtr
Definition: Registry.h:72
void OnTrackMoveBottom(const CommandContext &context)
void OnTrackPan(const CommandContext &context)
Definition: TrackMenus.cpp:999
void OnTrackMoveTop(const CommandContext &context)
void OnTrackPanRight(const CommandContext &context)
void OnTrackMoveDown(const CommandContext &context)
void OnTrackGain(const CommandContext &context)
void OnTrackMute(const CommandContext &context)
void OnTrackMenu(const CommandContext &context)
void OnTrackSolo(const CommandContext &context)
void OnTrackGainDec(const CommandContext &context)
void OnTrackGainInc(const CommandContext &context)
void OnTrackMoveUp(const CommandContext &context)
void OnTrackClose(const CommandContext &context)
void OnTrackPanLeft(const CommandContext &context)

References AudioIONotBusyFlag(), MenuTable::Command(), MenuTable::Menu(), OnTrackClose(), OnTrackGain(), OnTrackGainDec(), OnTrackGainInc(), OnTrackMenu(), OnTrackMoveBottom(), OnTrackMoveDown(), OnTrackMoveTop(), OnTrackMoveUp(), OnTrackMute(), OnTrackPan(), OnTrackPanLeft(), OnTrackPanRight(), OnTrackSolo(), TrackPanelHasFocus(), TracksExistFlag(), wxT(), and XXO().

Here is the call graph for this function:

◆ kAlignLabelsCount()

const size_t anonymous_namespace{TrackMenus.cpp}::kAlignLabelsCount ( )

Definition at line 197 of file TrackMenus.cpp.

197{ return alignLabels().size(); }
static const std::vector< ComponentInterfaceSymbol > & alignLabels()
Definition: TrackMenus.cpp:189

References alignLabels().

Referenced by DoAlign(), and OnAlignNoSync().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MuteTracks()

static void anonymous_namespace{TrackMenus.cpp}::MuteTracks ( const CommandContext context,
bool  mute,
bool  selected 
)
static

Definition at line 744 of file TrackMenus.cpp.

745{
746 auto &project = context.project;
747 const auto &settings = ProjectSettings::Get( project );
748 auto &tracks = TrackList::Get( project );
749 auto &window = ProjectWindow::Get( project );
750
751 auto soloSimple = settings.IsSoloSimple();
752 auto soloNone = settings.IsSoloNone();
753
754 auto iter = selected ? tracks.Selected<PlayableTrack>() : tracks.Any<PlayableTrack>();
755 for (auto pt : iter)
756 {
757 pt->SetMute(mute);
758 if (soloSimple || soloNone)
759 pt->SetSolo(false);
760 }
761
762 ProjectHistory::Get( project ).ModifyState(true);
763}
static Settings & settings()
Definition: TrackInfo.cpp:87
AudacityProject & project
AudioTrack subclass that can also be audibly replayed by the program.
Definition: Track.h:916
void SetMute(bool m)
Definition: Track.cpp:338
void ModifyState(bool bWantsAutoSave)
static ProjectSettings & Get(AudacityProject &project)
bool Any() const
Definition: Track.cpp:399

References Track::Any(), ProjectHistory::Get(), TrackList::Get(), ProjectSettings::Get(), ProjectWindow::Get(), ProjectHistory::ModifyState(), CommandContext::project, PlayableTrack::SetMute(), and settings().

Referenced by OnMuteAllTracks(), OnMuteSelectedTracks(), OnUnmuteAllTracks(), and OnUnmuteSelectedTracks().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnAlign()

void anonymous_namespace{TrackMenus.cpp}::OnAlign ( const CommandContext context)

Definition at line 811 of file TrackMenus.cpp.

812{
813 auto &project = context.project;
814
815 bool bMoveWith;
816 gPrefs->Read(wxT("/GUI/MoveSelectionWithTracks"), &bMoveWith, false);
817 DoAlign(project, context.index, bMoveWith);
818}
FileConfig * gPrefs
Definition: Prefs.cpp:70
void DoAlign(AudacityProject &project, int index, bool moveSel)
Definition: TrackMenus.cpp:200

References DoAlign(), gPrefs, CommandContext::index, CommandContext::project, and wxT().

Referenced by TracksMenu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnAlignNoSync()

void anonymous_namespace{TrackMenus.cpp}::OnAlignNoSync ( const CommandContext context)

Definition at line 803 of file TrackMenus.cpp.

804{
805 auto &project = context.project;
806
807 DoAlign(project,
808 context.index + kAlignLabelsCount(), false);
809}

References DoAlign(), CommandContext::index, kAlignLabelsCount(), and CommandContext::project.

Referenced by TracksMenu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnMixAndRender()

void anonymous_namespace{TrackMenus.cpp}::OnMixAndRender ( const CommandContext context)

Definition at line 620 of file TrackMenus.cpp.

621{
622 auto &project = context.project;
623 DoMixAndRender(project, false);
624}
void DoMixAndRender(AudacityProject &project, bool toNewTrack)
Definition: TrackMenus.cpp:49

References DoMixAndRender(), and CommandContext::project.

Referenced by TracksMenu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnMixAndRenderToNewTrack()

void anonymous_namespace{TrackMenus.cpp}::OnMixAndRenderToNewTrack ( const CommandContext context)

Definition at line 626 of file TrackMenus.cpp.

627{
628 auto &project = context.project;
629 DoMixAndRender(project, true);
630}

References DoMixAndRender(), and CommandContext::project.

Referenced by TracksMenu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnMoveSelectionWithTracks()

void anonymous_namespace{TrackMenus.cpp}::OnMoveSelectionWithTracks ( const CommandContext WXUNUSEDcontext)

Definition at line 828 of file TrackMenus.cpp.

829{
830 bool bMoveWith;
831 gPrefs->Read(wxT("/GUI/MoveSelectionWithTracks"), &bMoveWith, false);
832 gPrefs->Write(wxT("/GUI/MoveSelectionWithTracks"), !bMoveWith);
833 gPrefs->Flush();
834
835}
virtual bool Flush(bool bCurrentOnly=false) wxOVERRIDE
Definition: FileConfig.cpp:143

References FileConfig::Flush(), gPrefs, and wxT().

Referenced by TracksMenu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnMuteAllTracks()

void anonymous_namespace{TrackMenus.cpp}::OnMuteAllTracks ( const CommandContext context)

Definition at line 765 of file TrackMenus.cpp.

766{
767 MuteTracks(context, true, false);
768}
static void MuteTracks(const CommandContext &context, bool mute, bool selected)
Definition: TrackMenus.cpp:744

References MuteTracks().

Referenced by TracksMenu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnMuteSelectedTracks()

void anonymous_namespace{TrackMenus.cpp}::OnMuteSelectedTracks ( const CommandContext context)

Definition at line 775 of file TrackMenus.cpp.

776{
777 MuteTracks(context, true, true);
778}

References MuteTracks().

Referenced by TracksMenu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnPanCenter()

void anonymous_namespace{TrackMenus.cpp}::OnPanCenter ( const CommandContext context)

Definition at line 797 of file TrackMenus.cpp.

798{
799 auto &project = context.project;
800 DoPanTracks( project, 0.0);
801}
void DoPanTracks(AudacityProject &project, float PanValue)
Definition: TrackMenus.cpp:156

References DoPanTracks(), and CommandContext::project.

Referenced by TracksMenu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnPanLeft()

void anonymous_namespace{TrackMenus.cpp}::OnPanLeft ( const CommandContext context)

Definition at line 785 of file TrackMenus.cpp.

786{
787 auto &project = context.project;
788 DoPanTracks( project, -1.0);
789}

References DoPanTracks(), and CommandContext::project.

Referenced by TracksMenu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnPanRight()

void anonymous_namespace{TrackMenus.cpp}::OnPanRight ( const CommandContext context)

Definition at line 791 of file TrackMenus.cpp.

792{
793 auto &project = context.project;
794 DoPanTracks( project, 1.0);
795}

References DoPanTracks(), and CommandContext::project.

Referenced by TracksMenu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnRemoveTracks()

void anonymous_namespace{TrackMenus.cpp}::OnRemoveTracks ( const CommandContext context)

Definition at line 739 of file TrackMenus.cpp.

740{
742}
void DoRemoveTracks(AudacityProject &project)

References TrackUtilities::DoRemoveTracks(), and CommandContext::project.

Referenced by TracksMenu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnResample()

void anonymous_namespace{TrackMenus.cpp}::OnResample ( const CommandContext context)

Definition at line 632 of file TrackMenus.cpp.

633{
634 auto &project = context.project;
635 auto projectRate = ProjectRate::Get(project).GetRate();
636 auto &tracks = TrackList::Get( project );
637 auto &undoManager = UndoManager::Get( project );
638 auto &window = ProjectWindow::Get( project );
639
640 int newRate;
641
642 while (true)
643 {
644 wxDialogWrapper dlg(&window, wxID_ANY, XO("Resample"));
645 ShuttleGui S(&dlg, eIsCreating);
646 wxString rate;
647 wxComboBox *cb;
648
649 rate.Printf(wxT("%ld"), lrint(projectRate));
650
651 wxArrayStringEx rates{
652 wxT("8000") ,
653 wxT("11025") ,
654 wxT("16000") ,
655 wxT("22050") ,
656 wxT("32000") ,
657 wxT("44100") ,
658 wxT("48000") ,
659 wxT("88200") ,
660 wxT("96000") ,
661 wxT("176400") ,
662 wxT("192000") ,
663 wxT("352800") ,
664 wxT("384000") ,
665 };
666
667 S.StartVerticalLay(true);
668 {
669 S.AddSpace(-1, 15);
670
671 S.StartHorizontalLay(wxCENTER, false);
672 {
673 cb = S.AddCombo(XXO("New sample rate (Hz):"),
674 rate,
675 rates);
676 }
677 S.EndHorizontalLay();
678
679 S.AddSpace(-1, 15);
680
681 S.AddStandardButtons();
682 }
683 S.EndVerticalLay();
684
685 dlg.Layout();
686 dlg.Fit();
687 dlg.Center();
688
689 if (dlg.ShowModal() != wxID_OK)
690 {
691 return; // user cancelled dialog
692 }
693
694 long lrate;
695 if (cb->GetValue().ToLong(&lrate) && lrate >= 1 && lrate <= 1000000)
696 {
697 newRate = (int)lrate;
698 break;
699 }
700
702 XO("The entered value is invalid"),
703 XO("Error"),
704 wxICON_ERROR,
705 &window);
706 }
707
708 int ndx = 0;
709 auto flags = UndoPush::NONE;
710 for (auto wt : tracks.Selected< WaveTrack >())
711 {
712 auto msg = XO("Resampling track %d").Format( ++ndx );
713
714 using namespace BasicUI;
715 auto progress = MakeProgress(XO("Resample"), msg);
716
717 // The resampling of a track may be stopped by the user. This might
718 // leave a track with multiple clips in a partially resampled state.
719 // But the thrown exception will cause rollback in the application
720 // level handler.
721
722 wt->Resample(newRate, progress.get());
723
724 // Each time a track is successfully, completely resampled,
725 // commit that to the undo stack. The second and later times,
726 // consolidate.
727
729 XO("Resampled audio track(s)"), XO("Resample Track"), flags);
730 flags = flags | UndoPush::CONSOLIDATE;
731 }
732
733 undoManager.StopConsolidating();
734
735 // Need to reset
736 window.FinishAutoScroll();
737}
int AudacityMessageBox(const TranslatableString &message, const TranslatableString &caption, long style, wxWindow *parent, int x, int y)
@ eIsCreating
Definition: ShuttleGui.h:39
#define S(N)
Definition: ToChars.cpp:64
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:628
static UndoManager & Get(AudacityProject &project)
Definition: UndoManager.cpp:67
Extend wxArrayString with move operations and construction and insertion fromstd::initializer_list.
#define lrint(dbl)
Definition: float_cast.h:169
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:284

References AudacityMessageBox(), CONSOLIDATE, eIsCreating, ProjectHistory::Get(), UndoManager::Get(), ProjectRate::Get(), TrackList::Get(), ProjectWindow::Get(), ProjectRate::GetRate(), lrint, BasicUI::MakeProgress(), NONE, CommandContext::project, ProjectHistory::PushState(), S, wxT(), XO(), and XXO().

Referenced by TracksMenu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnSortName()

void anonymous_namespace{TrackMenus.cpp}::OnSortName ( const CommandContext context)

Definition at line 972 of file TrackMenus.cpp.

973{
974 auto &project = context.project;
976
977 ProjectHistory::Get( project )
978 .PushState(XO("Tracks sorted by name"), XO("Sort by Name"));
979}
void DoSortTracks(AudacityProject &project, int flags)
Definition: TrackMenus.cpp:501

References DoSortTracks(), ProjectHistory::Get(), kAudacitySortByName, CommandContext::project, ProjectHistory::PushState(), and XO().

Referenced by TracksMenu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnSortTime()

void anonymous_namespace{TrackMenus.cpp}::OnSortTime ( const CommandContext context)

Definition at line 963 of file TrackMenus.cpp.

964{
965 auto &project = context.project;
967
968 ProjectHistory::Get( project )
969 .PushState(XO("Tracks sorted by time"), XO("Sort by Time"));
970}

References DoSortTracks(), ProjectHistory::Get(), kAudacitySortByTime, CommandContext::project, ProjectHistory::PushState(), and XO().

Referenced by TracksMenu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnStereoToMono()

void anonymous_namespace{TrackMenus.cpp}::OnStereoToMono ( const CommandContext context)

Definition at line 612 of file TrackMenus.cpp.

613{
615 EffectManager::Get().GetEffectByIdentifier(wxT("StereoToMono")),
616 context,
618}
static EffectManager & Get()
AUDACITY_DLL_API bool DoEffect(const PluginID &ID, const CommandContext &context, unsigned flags)
'Repeat Last Effect'.
Definition: EffectUI.cpp:1241

References EffectUI::DoEffect(), EffectManager::Get(), EffectManager::kConfigured, and wxT().

Referenced by TracksMenu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnSyncLock()

void anonymous_namespace{TrackMenus.cpp}::OnSyncLock ( const CommandContext context)

Definition at line 981 of file TrackMenus.cpp.

982{
983 auto &project = context.project;
984 auto &trackPanel = TrackPanel::Get( project );
985
986 bool bSyncLockTracks;
987 gPrefs->Read(wxT("/GUI/SyncLockTracks"), &bSyncLockTracks, false);
988 gPrefs->Write(wxT("/GUI/SyncLockTracks"), !bSyncLockTracks);
989 gPrefs->Flush();
990
991 // Toolbar, project sync-lock handled within
993
994 trackPanel.Refresh(false);
995}
static void ModifyAllProjectToolbarMenus()

References FileConfig::Flush(), TrackPanel::Get(), gPrefs, ToolManager::ModifyAllProjectToolbarMenus(), CommandContext::project, and wxT().

Referenced by TracksMenu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnTrackClose()

void anonymous_namespace{TrackMenus.cpp}::OnTrackClose ( const CommandContext context)

Definition at line 1110 of file TrackMenus.cpp.

1111{
1112 auto &project = context.project;
1113 auto &trackPanel = TrackPanel::Get( project );
1114
1115 const auto t = TrackFocus::Get( project ).Get();
1116 if (!t)
1117 return;
1118
1119 auto isAudioActive = ProjectAudioIO::Get( project ).IsAudioActive();
1120
1121 if (isAudioActive)
1122 {
1123 ProjectStatus::Get( project ).Set(
1124 XO("Can't delete track with active audio"));
1125 wxBell();
1126 return;
1127 }
1128
1130
1131 trackPanel.UpdateViewIfNoTracks();
1132 trackPanel.Refresh(false);
1133}
Subclass & Get(const RegisteredFactory &key)
Get reference to an attachment, creating on demand if not present, down-cast it to Subclass.
Definition: ClientData.h:309
bool IsAudioActive() const
static ProjectAudioIO & Get(AudacityProject &project)
static ProjectStatus & Get(AudacityProject &project)
void Set(const TranslatableString &msg, StatusBarField field=mainStatusBarField)
void DoRemoveTrack(AudacityProject &project, Track *toRemove)

References TrackUtilities::DoRemoveTrack(), TrackFocus::Get(), ProjectAudioIO::Get(), ProjectStatus::Get(), TrackPanel::Get(), ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::Get(), ProjectAudioIO::IsAudioActive(), CommandContext::project, ProjectStatus::Set(), and XO().

Referenced by ExtraTrackMenu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnTrackGain()

void anonymous_namespace{TrackMenus.cpp}::OnTrackGain ( const CommandContext context)

This will pop up the track gain dialog for specified track

Definition at line 1038 of file TrackMenus.cpp.

1039{
1040 auto &project = context.project;
1041 auto &trackPanel = TrackPanel::Get( project );
1042
1044 const auto track = TrackFocus::Get( project ).Get();
1045 if (track) track->TypeSwitch( [&](WaveTrack *wt) {
1046 LWSlider *slider = WaveTrackControls::GainSlider( trackPanel, *wt );
1047 if (slider->ShowDialog())
1048 SetTrackGain(project, wt, slider);
1049 });
1050}
Lightweight version of ASlider. In other words it does not have a window permanently associated with ...
Definition: ASlider.h:64
bool ShowDialog()
Definition: ASlider.cpp:1122
static LWSlider * GainSlider(CellularPanel &panel, const WaveTrack &wt)
void SetTrackGain(AudacityProject &project, WaveTrack *wt, LWSlider *slider)
Definition: TrackMenus.cpp:578

References WaveTrackControls::GainSlider(), TrackFocus::Get(), TrackPanel::Get(), ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::Get(), CommandContext::project, SetTrackGain(), and LWSlider::ShowDialog().

Referenced by ExtraTrackMenu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnTrackGainDec()

void anonymous_namespace{TrackMenus.cpp}::OnTrackGainDec ( const CommandContext context)

Definition at line 1065 of file TrackMenus.cpp.

1066{
1067 auto &project = context.project;
1068 auto &trackPanel = TrackPanel::Get( project );
1069
1070 const auto track = TrackFocus::Get( project ).Get();
1071 if (track) track->TypeSwitch( [&](WaveTrack *wt) {
1072 LWSlider *slider = WaveTrackControls::GainSlider( trackPanel, *wt );
1073 slider->Decrease(1);
1074 SetTrackGain(project, wt, slider);
1075 });
1076}
void Decrease(float steps)
Definition: ASlider.cpp:1603

References LWSlider::Decrease(), WaveTrackControls::GainSlider(), TrackFocus::Get(), TrackPanel::Get(), ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::Get(), CommandContext::project, and SetTrackGain().

Referenced by ExtraTrackMenu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnTrackGainInc()

void anonymous_namespace{TrackMenus.cpp}::OnTrackGainInc ( const CommandContext context)

Definition at line 1052 of file TrackMenus.cpp.

1053{
1054 auto &project = context.project;
1055 auto &trackPanel = TrackPanel::Get( project );
1056
1057 const auto track = TrackFocus::Get( project ).Get();
1058 if (track) track->TypeSwitch( [&](WaveTrack *wt) {
1059 LWSlider *slider = WaveTrackControls::GainSlider( trackPanel, *wt );
1060 slider->Increase(1);
1061 SetTrackGain(project, wt, slider);
1062 });
1063}
void Increase(float steps)
Definition: ASlider.cpp:1580

References WaveTrackControls::GainSlider(), TrackFocus::Get(), TrackPanel::Get(), ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::Get(), LWSlider::Increase(), CommandContext::project, and SetTrackGain().

Referenced by ExtraTrackMenu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnTrackMenu()

void anonymous_namespace{TrackMenus.cpp}::OnTrackMenu ( const CommandContext context)

Definition at line 1078 of file TrackMenus.cpp.

1079{
1080 auto &project = context.project;
1081 auto &trackPanel = TrackPanel::Get( project );
1082
1083 trackPanel.OnTrackMenu();
1084}

References TrackPanel::Get(), and CommandContext::project.

Referenced by ExtraTrackMenu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnTrackMoveBottom()

void anonymous_namespace{TrackMenus.cpp}::OnTrackMoveBottom ( const CommandContext context)

Definition at line 1174 of file TrackMenus.cpp.

1175{
1176 auto &project = context.project;
1177 auto &trackPanel = TrackPanel::Get( project );
1178 auto &tracks = TrackList::Get( project );
1179
1180 const auto focusedTrack = TrackFocus::Get( project ).Get();
1181 if (tracks.CanMoveDown(focusedTrack)) {
1182 DoMoveTrack(project, focusedTrack, TrackUtilities::OnMoveBottomID);
1183 trackPanel.Refresh(false);
1184 }
1185}
void DoMoveTrack(AudacityProject &project, Track *target, MoveChoice choice)
Move a track up, down, to top or to bottom.

References TrackUtilities::DoMoveTrack(), TrackFocus::Get(), TrackList::Get(), TrackPanel::Get(), ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::Get(), TrackUtilities::OnMoveBottomID, and CommandContext::project.

Referenced by ExtraTrackMenu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnTrackMoveDown()

void anonymous_namespace{TrackMenus.cpp}::OnTrackMoveDown ( const CommandContext context)

Definition at line 1148 of file TrackMenus.cpp.

1149{
1150 auto &project = context.project;
1151 auto &trackPanel = TrackPanel::Get( project );
1152 auto &tracks = TrackList::Get( project );
1153
1154 const auto focusedTrack = TrackFocus::Get( project ).Get();
1155 if (tracks.CanMoveDown(focusedTrack)) {
1156 DoMoveTrack(project, focusedTrack, TrackUtilities::OnMoveDownID);
1157 trackPanel.Refresh(false);
1158 }
1159}

References TrackUtilities::DoMoveTrack(), TrackFocus::Get(), TrackList::Get(), TrackPanel::Get(), ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::Get(), TrackUtilities::OnMoveDownID, and CommandContext::project.

Referenced by ExtraTrackMenu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnTrackMoveTop()

void anonymous_namespace{TrackMenus.cpp}::OnTrackMoveTop ( const CommandContext context)

Definition at line 1161 of file TrackMenus.cpp.

1162{
1163 auto &project = context.project;
1164 auto &trackPanel = TrackPanel::Get( project );
1165 auto &tracks = TrackList::Get( project );
1166
1167 const auto focusedTrack = TrackFocus::Get( project ).Get();
1168 if (tracks.CanMoveUp(focusedTrack)) {
1169 DoMoveTrack(project, focusedTrack, TrackUtilities::OnMoveTopID);
1170 trackPanel.Refresh(false);
1171 }
1172}

References TrackUtilities::DoMoveTrack(), TrackFocus::Get(), TrackList::Get(), TrackPanel::Get(), ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::Get(), TrackUtilities::OnMoveTopID, and CommandContext::project.

Referenced by ExtraTrackMenu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnTrackMoveUp()

void anonymous_namespace{TrackMenus.cpp}::OnTrackMoveUp ( const CommandContext context)

Definition at line 1135 of file TrackMenus.cpp.

1136{
1137 auto &project = context.project;
1138 auto &trackPanel = TrackPanel::Get( project );
1139 auto &tracks = TrackList::Get( project );
1140
1141 const auto focusedTrack = TrackFocus::Get( project ).Get();
1142 if (tracks.CanMoveUp(focusedTrack)) {
1143 DoMoveTrack(project, focusedTrack, TrackUtilities::OnMoveUpID);
1144 trackPanel.Refresh(false);
1145 }
1146}

References TrackUtilities::DoMoveTrack(), TrackFocus::Get(), TrackList::Get(), TrackPanel::Get(), ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::Get(), TrackUtilities::OnMoveUpID, and CommandContext::project.

Referenced by ExtraTrackMenu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnTrackMute()

void anonymous_namespace{TrackMenus.cpp}::OnTrackMute ( const CommandContext context)

Definition at line 1086 of file TrackMenus.cpp.

1087{
1088 auto &project = context.project;
1089
1090 // Use the temporary selection if it is specified, else the track focus
1091 auto track = context.temporarySelection.pTrack;
1092 if (!track)
1093 track = TrackFocus::Get( project ).Get();
1094
1095 if (track) track->TypeSwitch( [&](PlayableTrack *t) {
1096 TrackUtilities::DoTrackMute(project, t, false);
1097 });
1098}
TemporarySelection temporarySelection
void DoTrackMute(AudacityProject &project, Track *t, bool exclusive)

References TrackUtilities::DoTrackMute(), TrackFocus::Get(), ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::Get(), CommandContext::project, TemporarySelection::pTrack, and CommandContext::temporarySelection.

Referenced by ExtraTrackMenu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnTrackPan()

void anonymous_namespace{TrackMenus.cpp}::OnTrackPan ( const CommandContext context)

The following methods operate controls on specified tracks, This will pop up the track panning dialog for specified track

Definition at line 999 of file TrackMenus.cpp.

1000{
1001 auto &project = context.project;
1002 auto &trackPanel = TrackPanel::Get( project );
1003
1004 const auto track = TrackFocus::Get( project ).Get();
1005 if (track) track->TypeSwitch( [&](WaveTrack *wt) {
1006 LWSlider *slider = WaveTrackControls::PanSlider( trackPanel, *wt );
1007 if (slider->ShowDialog())
1008 SetTrackPan(project, wt, slider);
1009 });
1010}
static LWSlider * PanSlider(CellularPanel &panel, const WaveTrack &wt)
void SetTrackPan(AudacityProject &project, WaveTrack *wt, LWSlider *slider)
Definition: TrackMenus.cpp:592

References TrackFocus::Get(), TrackPanel::Get(), ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::Get(), WaveTrackControls::PanSlider(), CommandContext::project, SetTrackPan(), and LWSlider::ShowDialog().

Referenced by ExtraTrackMenu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnTrackPanLeft()

void anonymous_namespace{TrackMenus.cpp}::OnTrackPanLeft ( const CommandContext context)

Definition at line 1012 of file TrackMenus.cpp.

1013{
1014 auto &project = context.project;
1015 auto &trackPanel = TrackPanel::Get( project );
1016
1017 const auto track = TrackFocus::Get( project ).Get();
1018 if (track) track->TypeSwitch( [&](WaveTrack *wt) {
1019 LWSlider *slider = WaveTrackControls::PanSlider( trackPanel, *wt );
1020 slider->Decrease(1);
1021 SetTrackPan(project, wt, slider);
1022 });
1023}

References LWSlider::Decrease(), TrackFocus::Get(), TrackPanel::Get(), ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::Get(), WaveTrackControls::PanSlider(), CommandContext::project, and SetTrackPan().

Referenced by ExtraTrackMenu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnTrackPanRight()

void anonymous_namespace{TrackMenus.cpp}::OnTrackPanRight ( const CommandContext context)

Definition at line 1025 of file TrackMenus.cpp.

1026{
1027 auto &project = context.project;
1028 auto &trackPanel = TrackPanel::Get( project );
1029
1030 const auto track = TrackFocus::Get( project ).Get();
1031 if (track) track->TypeSwitch( [&](WaveTrack *wt) {
1032 LWSlider *slider = WaveTrackControls::PanSlider( trackPanel, *wt );
1033 slider->Increase(1);
1034 SetTrackPan(project, wt, slider);
1035 });
1036}

References TrackFocus::Get(), TrackPanel::Get(), ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::Get(), LWSlider::Increase(), WaveTrackControls::PanSlider(), CommandContext::project, and SetTrackPan().

Referenced by ExtraTrackMenu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnTrackSolo()

void anonymous_namespace{TrackMenus.cpp}::OnTrackSolo ( const CommandContext context)

Definition at line 1100 of file TrackMenus.cpp.

1101{
1102 auto &project = context.project;
1103
1104 const auto track = TrackFocus::Get( project ).Get();
1105 if (track) track->TypeSwitch( [&](PlayableTrack *t) {
1106 TrackUtilities::DoTrackSolo(project, t, false);
1107 });
1108}
void DoTrackSolo(AudacityProject &project, Track *t, bool exclusive)

References TrackUtilities::DoTrackSolo(), TrackFocus::Get(), ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::Get(), and CommandContext::project.

Referenced by ExtraTrackMenu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnUnmuteAllTracks()

void anonymous_namespace{TrackMenus.cpp}::OnUnmuteAllTracks ( const CommandContext context)

Definition at line 770 of file TrackMenus.cpp.

771{
772 MuteTracks(context, false, false);
773}

References MuteTracks().

Referenced by TracksMenu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnUnmuteSelectedTracks()

void anonymous_namespace{TrackMenus.cpp}::OnUnmuteSelectedTracks ( const CommandContext context)

Definition at line 780 of file TrackMenus.cpp.

781{
782 MuteTracks(context, false, true);
783}

References MuteTracks().

Referenced by TracksMenu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetTrackGain()

void anonymous_namespace{TrackMenus.cpp}::SetTrackGain ( AudacityProject project,
WaveTrack wt,
LWSlider slider 
)

Definition at line 578 of file TrackMenus.cpp.

579{
580 wxASSERT(wt);
581 float newValue = slider->Get();
582
583 for (auto channel : TrackList::Channels(wt))
584 channel->SetGain(newValue);
585
586 ProjectHistory::Get( project )
587 .PushState(XO("Adjusted gain"), XO("Gain"), UndoPush::CONSOLIDATE);
588
589 TrackPanel::Get( project ).RefreshTrack(wt);
590}
float Get(bool convert=true)
Definition: ASlider.cpp:1555
void RefreshTrack(Track *trk, bool refreshbacking=true)
Definition: TrackPanel.cpp:748

References TrackList::Channels(), CONSOLIDATE, ProjectHistory::Get(), TrackPanel::Get(), LWSlider::Get(), ProjectHistory::PushState(), TrackPanel::RefreshTrack(), and XO().

Referenced by OnTrackGain(), OnTrackGainDec(), and OnTrackGainInc().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetTrackPan()

void anonymous_namespace{TrackMenus.cpp}::SetTrackPan ( AudacityProject project,
WaveTrack wt,
LWSlider slider 
)

Definition at line 592 of file TrackMenus.cpp.

593{
594 wxASSERT(wt);
595 float newValue = slider->Get();
596
597 for (auto channel : TrackList::Channels(wt))
598 channel->SetPan(newValue);
599
600 ProjectHistory::Get( project )
601 .PushState(XO("Adjusted Pan"), XO("Pan"), UndoPush::CONSOLIDATE);
602
603 TrackPanel::Get( project ).RefreshTrack(wt);
604}

References TrackList::Channels(), CONSOLIDATE, ProjectHistory::Get(), TrackPanel::Get(), LWSlider::Get(), ProjectHistory::PushState(), TrackPanel::RefreshTrack(), and XO().

Referenced by OnTrackPan(), OnTrackPanLeft(), and OnTrackPanRight().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ TracksMenu()

BaseItemSharedPtr anonymous_namespace{TrackMenus.cpp}::TracksMenu ( )

Definition at line 1191 of file TrackMenus.cpp.

1192{
1193 // Tracks Menu (formerly Project Menu)
1195
1196 static BaseItemSharedPtr menu{
1197 Menu( wxT("Tracks"), XXO("&Tracks"),
1198 Section( "Add",
1199 Menu( wxT("Add"), XXO("Add &New") )
1200 ),
1201
1203
1204 Section( "",
1205 Menu( wxT("Mix"), XXO("Mi&x"),
1206 // Delayed evaluation
1207 // Stereo to Mono is an oddball command that is also subject to control
1208 // by the plug-in manager, as if an effect. Decide whether to show or
1209 // hide it.
1211 const PluginID ID =
1212 EffectManager::Get().GetEffectByIdentifier(wxT("StereoToMono"));
1213 const PluginDescriptor *plug = PluginManager::Get().GetPlugin(ID);
1214 if (plug && plug->IsEnabled())
1215 return Command( wxT("Stereo to Mono"),
1216 XXO("Mix Stereo Down to &Mono"), OnStereoToMono,
1219 else
1220 return {};
1221 },
1222 Command( wxT("MixAndRender"), XXO("Mi&x and Render"),
1225 Command( wxT("MixAndRenderToNewTrack"),
1226 XXO("Mix and Render to Ne&w Track"),
1228 AudioIONotBusyFlag() | WaveTracksSelectedFlag(), wxT("Ctrl+Shift+M") )
1229 ),
1230
1231 Command( wxT("Resample"), XXO("&Resample..."), OnResample,
1233 ),
1234
1235 Section( "",
1236 Command( wxT("RemoveTracks"), XXO("Remo&ve Tracks"), OnRemoveTracks,
1238 ),
1239
1240 Section( "",
1241 Menu( wxT("Mute"), XXO("M&ute/Unmute"),
1242 Command( wxT("MuteAllTracks"), XXO("&Mute All Tracks"),
1243 OnMuteAllTracks, TracksExistFlag(), wxT("Ctrl+U") ),
1244 Command( wxT("UnmuteAllTracks"), XXO("&Unmute All Tracks"),
1245 OnUnmuteAllTracks, TracksExistFlag(), wxT("Ctrl+Shift+U") ),
1246 Command( wxT("MuteTracks"), XXO("Mut&e Tracks"),
1248 Command( wxT("UnmuteTracks"), XXO("U&nmute Tracks"),
1249 OnUnmuteSelectedTracks, EditableTracksSelectedFlag(), wxT("Ctrl+Alt+Shift+U") )
1250 ),
1251
1252 Menu( wxT("Pan"), XXO("&Pan"),
1253 // As Pan changes are not saved on Undo stack,
1254 // pan settings for all tracks
1255 // in the project could very easily be lost unless we
1256 // require the tracks to be selected.
1257 Command( wxT("PanLeft"), XXO("&Left"), OnPanLeft,
1259 Options{}.LongName( XO("Pan Left") ) ),
1260 Command( wxT("PanRight"), XXO("&Right"), OnPanRight,
1262 Options{}.LongName( XO("Pan Right") ) ),
1263 Command( wxT("PanCenter"), XXO("&Center"), OnPanCenter,
1265 Options{}.LongName( XO("Pan Center") ) )
1266 )
1267 ),
1268
1269 Section( "",
1270 Menu( wxT("Align"), XXO("&Align Tracks"), // XO("Just Move Tracks"),
1271 Section( "",
1272 // Mutual alignment of tracks independent of selection or zero
1273 CommandGroup(wxT("Align"),
1274 {
1275 { wxT("EndToEnd"), XXO("&Align End to End") },
1276 { wxT("Together"), XXO("Align &Together") },
1277 },
1279 ),
1280
1281 Section( "",
1282 // Alignment commands using selection or zero
1283 CommandGroup(wxT("Align"),
1284 alignLabels(),
1286 ),
1287
1288 Section( "",
1289 Command( wxT("MoveSelectionWithTracks"),
1290 XXO("&Move Selection with Tracks (on/off)"),
1293 Options{}.CheckTest( wxT("/GUI/MoveSelectionWithTracks"), false ) )
1294 )
1295 ),
1296
1297 #if 0
1298 // TODO: Can these labels be made clearer?
1299 // Do we need this sub-menu at all?
1300 Menu( wxT("MoveSelectionAndTracks"), XO("Move Sele&ction and Tracks"), {
1301 CommandGroup(wxT("AlignMove"), alignLabels(),
1302 OnAlignMoveSel, AudioIONotBusyFlag() | EditableTracksSelectedFlag()),
1303 } ),
1304 #endif
1305
1307
1308 #ifdef EXPERIMENTAL_SCOREALIGN
1309 Command( wxT("ScoreAlign"), XXO("Synchronize MIDI with Audio"),
1310 OnScoreAlign,
1311 AudioIONotBusyFlag() | NoteTracksSelectedFlag() | WaveTracksSelectedFlag() ),
1312 #endif // EXPERIMENTAL_SCOREALIGN
1313
1315
1316 Menu( wxT("Sort"), XXO("S&ort Tracks"),
1317 Command( wxT("SortByTime"), XXO("By &Start Time"), OnSortTime,
1319 Options{}.LongName( XO("Sort by Time") ) ),
1320 Command( wxT("SortByName"), XXO("By &Name"), OnSortName,
1322 Options{}.LongName( XO("Sort by Name") ) )
1323 )
1324
1326 )
1327
1328#ifdef EXPERIMENTAL_SYNC_LOCK
1329 ,
1330
1331 Section( "",
1332 Command( wxT("SyncLock"), XXO("Sync-&Lock Tracks (on/off)"),
1334 Options{}.CheckTest( wxT("/GUI/SyncLockTracks"), false ) )
1335 )
1336
1337#endif
1338
1339 ) };
1340 return menu;
1341}
constexpr CommandFlag AlwaysEnabledFlag
Definition: CommandFlag.h:34
const ReservedCommandFlag & StereoRequiredFlag()
const ReservedCommandFlag & EditableTracksSelectedFlag()
const ReservedCommandFlag & AnyTracksSelectedFlag()
const ReservedCommandFlag & WaveTracksSelectedFlag()
wxString PluginID
Definition: EffectManager.h:30
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:90
const PluginID & GetEffectByIdentifier(const CommandID &strTarget)
bool IsEnabled() const
const PluginDescriptor * GetPlugin(const PluginID &ID) const
static PluginManager & Get()
std::unique_ptr< MenuPart > Section(const Identifier &internalName, Args &&... args)
std::unique_ptr< CommandGroupItem > CommandGroup(const Identifier &name, std::vector< ComponentInterfaceSymbol > items, void(Handler::*pmf)(const CommandContext &), CommandFlag flags, bool isEffect=false, CommandHandlerFinder finder=FinderScope::DefaultFinder())
std::unique_ptr< BaseItem > BaseItemPtr
Definition: Registry.h:71
void OnPanCenter(const CommandContext &context)
Definition: TrackMenus.cpp:797
void OnUnmuteSelectedTracks(const CommandContext &context)
Definition: TrackMenus.cpp:780
void OnResample(const CommandContext &context)
Definition: TrackMenus.cpp:632
void OnMixAndRenderToNewTrack(const CommandContext &context)
Definition: TrackMenus.cpp:626
void OnSortName(const CommandContext &context)
Definition: TrackMenus.cpp:972
void OnPanRight(const CommandContext &context)
Definition: TrackMenus.cpp:791
void OnMixAndRender(const CommandContext &context)
Definition: TrackMenus.cpp:620
void OnMuteAllTracks(const CommandContext &context)
Definition: TrackMenus.cpp:765
void OnUnmuteAllTracks(const CommandContext &context)
Definition: TrackMenus.cpp:770
void OnRemoveTracks(const CommandContext &context)
Definition: TrackMenus.cpp:739
void OnPanLeft(const CommandContext &context)
Definition: TrackMenus.cpp:785
void OnMuteSelectedTracks(const CommandContext &context)
Definition: TrackMenus.cpp:775
void OnMoveSelectionWithTracks(const CommandContext &WXUNUSED(context))
Definition: TrackMenus.cpp:828
void OnSyncLock(const CommandContext &context)
Definition: TrackMenus.cpp:981
void OnAlignNoSync(const CommandContext &context)
Definition: TrackMenus.cpp:803
void OnAlign(const CommandContext &context)
Definition: TrackMenus.cpp:811
void OnStereoToMono(const CommandContext &context)
Definition: TrackMenus.cpp:612
void OnSortTime(const CommandContext &context)
Definition: TrackMenus.cpp:963
Options && CheckTest(const CheckFn &fn) &&
Options && LongName(const TranslatableString &value) &&

References alignLabels(), AlwaysEnabledFlag, AnyTracksSelectedFlag(), AudioIONotBusyFlag(), CommandManager::Options::CheckTest(), MenuTable::Command(), MenuTable::CommandGroup(), EditableTracksSelectedFlag(), PluginManager::Get(), EffectManager::Get(), EffectManager::GetEffectByIdentifier(), PluginManager::GetPlugin(), PluginDescriptor::IsEnabled(), CommandManager::Options::LongName(), MenuTable::Menu(), OnAlign(), OnAlignNoSync(), OnMixAndRender(), OnMixAndRenderToNewTrack(), OnMoveSelectionWithTracks(), OnMuteAllTracks(), OnMuteSelectedTracks(), OnPanCenter(), OnPanLeft(), OnPanRight(), OnRemoveTracks(), OnResample(), OnSortName(), OnSortTime(), OnStereoToMono(), OnSyncLock(), OnUnmuteAllTracks(), OnUnmuteSelectedTracks(), MenuTable::Section(), StereoRequiredFlag(), TracksExistFlag(), WaveTracksSelectedFlag(), wxT(), XO(), and XXO().

Here is the call graph for this function:

Variable Documentation

◆ sAttachment1

AttachedItem anonymous_namespace{TrackMenus.cpp}::sAttachment1
Initial value:

Definition at line 1343 of file TrackMenus.cpp.

◆ sAttachment2

AttachedItem anonymous_namespace{TrackMenus.cpp}::sAttachment2
Initial value:
{
wxT("Optional/Extra/Part2"),
}

Definition at line 1401 of file TrackMenus.cpp.