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)
 
auto TracksMenu ()
 
auto ExtraTrackMenu ()
 

Variables

AttachedItem sAttachment1 { Indirect(TracksMenu()) }
 
AttachedItem sAttachment2
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
kAlignStartZero 
kAlignStartSelStart 
kAlignStartSelEnd 
kAlignEndSelStart 
kAlignEndSelEnd 
kAlignEndToEnd 
kAlignTogether 

Definition at line 158 of file TrackMenus.cpp.

◆ anonymous enum

anonymous enum
Enumerator
kAudacitySortByTime 
kAudacitySortByName 

Definition at line 467 of file TrackMenus.cpp.

Function Documentation

◆ alignLabels()

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

Definition at line 170 of file TrackMenus.cpp.

170 { static std::vector< ComponentInterfaceSymbol > symbols{
171 { wxT("StartToZero"), XXO("Start to &Zero") },
172 { wxT("StartToSelStart"), XXO("Start to &Cursor/Selection Start") },
173 { wxT("StartToSelEnd"), XXO("Start to Selection &End") },
174 { wxT("EndToSelStart"), XXO("End to Cu&rsor/Selection Start") },
175 { wxT("EndToSelEnd"), XXO("End to Selection En&d") },
176}; 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 180 of file TrackMenus.cpp.

181{
182 auto &tracks = TrackList::Get( project );
183 auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
184 auto &viewport = Viewport::Get(project);
185
186 TranslatableString action, shortAction;
187 double delta = 0.0;
188 double newPos = -1.0;
189
190 auto trackRange = tracks.Selected<AudioTrack>();
191
192 auto FindOffset =
193 [](const Track *pTrack) { return pTrack->GetStartTime(); };
194
195 auto firstTrackOffset = [&]{ return FindOffset( *trackRange.begin() ); };
196 auto minOffset = [&]{ return trackRange.min( FindOffset ); };
197 auto avgOffset = [&]{
198 return trackRange.sum( FindOffset ) /
199 std::max( size_t(1), trackRange.size() ); };
200
201 auto maxEndOffset = [&]{
202 return std::max(0.0, trackRange.max(&Track::GetEndTime)); };
203
204 switch(index) {
205 case kAlignStartZero:
206 delta = -minOffset();
207 action = moveSel
208 /* i18n-hint: In this and similar messages describing editing actions,
209 the starting or ending points of tracks are re-"aligned" to other
210 times, and the time selection may be "moved" too. The first
211 noun -- "start" in this example -- is the object of a verb (not of
212 an implied preposition "from"). */
213 ? XO("Aligned/Moved start to zero")
214 : XO("Aligned start to zero");
215 shortAction = moveSel
216 /* i18n-hint: This and similar messages give shorter descriptions of
217 the aligning and moving editing actions */
218 ? XO("Align/Move Start")
219 : XO("Align Start");
220 break;
222 delta = selectedRegion.t0() - minOffset();
223 action = moveSel
224 ? XO("Aligned/Moved start to cursor/selection start")
225 : XO("Aligned start to cursor/selection start");
226 shortAction = moveSel
227 ? XO("Align/Move Start")
228 : XO("Align Start");
229 break;
231 delta = selectedRegion.t1() - minOffset();
232 action = moveSel
233 ? XO("Aligned/Moved start to selection end")
234 : XO("Aligned start to selection end");
235 shortAction = moveSel
236 ? XO("Align/Move Start")
237 : XO("Align Start");
238 break;
240 delta = selectedRegion.t0() - maxEndOffset();
241 action = moveSel
242 ? XO("Aligned/Moved end to cursor/selection start")
243 : XO("Aligned end to cursor/selection start");
244 shortAction =
245 moveSel
246 ? XO("Align/Move End")
247 : XO("Align End");
248 break;
249 case kAlignEndSelEnd:
250 delta = selectedRegion.t1() - maxEndOffset();
251 action = moveSel
252 ? XO("Aligned/Moved end to selection end")
253 : XO("Aligned end to selection end");
254 shortAction =
255 moveSel
256 ? XO("Align/Move End")
257 : XO("Align End");
258 break;
259 // index set in alignLabelsNoSync
260 case kAlignEndToEnd:
261 newPos = firstTrackOffset();
262 action = moveSel
263 ? XO("Aligned/Moved end to end")
264 : XO("Aligned end to end");
265 shortAction =
266 moveSel
267 ? XO("Align/Move End to End")
268 : XO("Align End to End");
269 break;
270 case kAlignTogether:
271 newPos = avgOffset();
272 action = moveSel
273 ? XO("Aligned/Moved together")
274 : XO("Aligned together");
275 shortAction =
276 moveSel
277 ? XO("Align/Move Together")
278 : XO("Align Together");
279 }
280
281 if ((unsigned)index >= kAlignLabelsCount()) {
282 // This is an alignLabelsNoSync command.
283 for (auto t : tracks.Selected<AudioTrack>()) {
284 // This shifts different tracks in different ways, so no sync-lock
285 // move.
286 // Only align Wave and Note tracks end to end.
287 t->MoveTo(newPos);
288 if (index == kAlignEndToEnd)
289 newPos += (t->GetEndTime() - t->GetStartTime());
290 }
291 if (index == kAlignEndToEnd)
292 viewport.ZoomFitHorizontally();
293 }
294
295 if (delta != 0.0) {
296 // For a fixed-distance shift move sync-lock selected tracks also.
297 for (auto t : tracks.Any()
299 t->MoveTo(t->GetStartTime() + delta);
300 }
301
302 if (moveSel)
303 selectedRegion.move(delta);
304
305 ProjectHistory::Get( project ).PushState(action, shortAction);
306}
XO("Cut/Copy/Paste")
const auto tracks
const auto project
Track subclass holding data representing sound (as notes, or samples, or ...)
Definition: PlayableTrack.h:21
double GetEndTime() const
Get the maximum of End() values of intervals, or 0 when none.
Definition: Channel.cpp:135
double GetStartTime() const
Get the minimum of Start() values of intervals, or 0 when none.
Definition: Channel.cpp:124
void PushState(const TranslatableString &desc, const TranslatableString &shortDesc)
static ProjectHistory & Get(AudacityProject &project)
static bool IsSelectedOrSyncLockSelected(const Track *pTrack)
Definition: SyncLock.cpp:112
Abstract base class for an object holding data associated with points on a time axis.
Definition: Track.h:122
static TrackList & Get(AudacityProject &project)
Definition: Track.cpp:347
Holds a msgid for the translation catalog; may also bind format arguments.
NotifyingSelectedRegion selectedRegion
Definition: ViewInfo.h:215
static ViewInfo & Get(AudacityProject &project)
Definition: ViewInfo.cpp:235
static Viewport & Get(AudacityProject &project)
Definition: Viewport.cpp:32

References ProjectHistory::Get(), ViewInfo::Get(), TrackList::Get(), Viewport::Get(), ChannelGroup::GetEndTime(), ChannelGroup::GetStartTime(), SyncLock::IsSelectedOrSyncLockSelected(), kAlignEndSelEnd, kAlignEndSelStart, kAlignEndToEnd, kAlignLabelsCount(), kAlignStartSelEnd, kAlignStartSelStart, kAlignStartZero, kAlignTogether, project, ProjectHistory::PushState(), ViewInfo::selectedRegion, tracks, 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 47 of file TrackMenus.cpp.

48{
50 auto &trackFactory = WaveTrackFactory::Get(project);
51 auto rate = ProjectRate::Get(project).GetRate();
52 auto defaultFormat = QualitySettings::SampleFormatChoice();
53 auto &trackPanel = TrackPanel::Get(project);
54
55 auto trackRange = tracks.Selected<WaveTrack>();
56 auto newTracks = ::MixAndRender(trackRange.Filter<const WaveTrack>(),
57 Mixer::WarpOptions{ tracks.GetOwner() },
58 tracks.MakeUniqueTrackName(_("Mix")),
59 &trackFactory, rate, defaultFormat, 0.0, 0.0);
60
61 if (newTracks) {
62 // Remove originals, get stats on what tracks were mixed
63
64 // But before removing, determine the first track after the removal
65 auto last = *trackRange.rbegin();
66 auto insertionPoint = * ++ tracks.Find(last);
67
68 auto selectedCount = trackRange.size();
69 wxString firstName;
70 int firstColour = -1;
71 if (selectedCount > 0) {
72 firstName = (*trackRange.begin())->GetName();
73 firstColour = (*trackRange.begin())->GetWaveColorIndex();
74 }
75 if (!toNewTrack) {
76 // Beware iterator invalidation!
77 while (!trackRange.empty())
78 // Range iterates over leaders only
79 tracks.Remove(**trackRange.first++);
80 }
81
82 // Add new tracks
83 const bool stereo = newTracks->NChannels() > 1;
84 tracks.Append(std::move(*newTracks));
85 const auto pNewTrack = *tracks.Any<WaveTrack>().rbegin();
86
87 // If we're just rendering (not mixing), keep the track name the same
88 if (selectedCount == 1)
89 pNewTrack->SetName(firstName);
90
91 // Bug 2218, remember more things...
92 if (selectedCount >= 1) {
93 pNewTrack->SetSelected(!toNewTrack);
94 pNewTrack->SetWaveColorIndex(firstColour);
95 }
96
97 // Permute the tracks as needed
98 // The new track appears after the old tracks (or where the old tracks
99 // had been) so that they are in the same sync-lock group
100 if (insertionPoint) {
101 std::vector<Track *> arr;
102 arr.reserve(tracks.Size());
103 size_t iBegin = 0, ii = 0;
104 for (const auto pTrack : tracks) {
105 arr.push_back(pTrack);
106 if (pTrack == insertionPoint)
107 iBegin = ii;
108 ++ii;
109 }
110 const auto end = arr.end(),
111 mid = end - 1;
112 std::rotate(arr.begin() + iBegin, mid, end);
113 tracks.Permute(arr);
114 }
115
116 // Smart history/undo message
117 if (selectedCount==1) {
118 auto msg = XO("Rendered all audio in track '%s'").Format( firstName );
119 /* i18n-hint: Convert the audio into a more usable form, so apply
120 * panning and amplification and write to some external file.*/
121 ProjectHistory::Get( project ).PushState(msg, XO("Render"));
122 }
123 else {
124 auto msg = (stereo
125 ? XO("Mixed and rendered %d tracks into one new stereo track")
126 : XO("Mixed and rendered %d tracks into one new mono track")
127 )
128 .Format((int)selectedCount);
129 ProjectHistory::Get(project).PushState(msg, XO("Mix and Render"));
130 }
131
132 trackPanel.SetFocus();
133 TrackFocus::Get(project).Set(pNewTrack);
134 Viewport::Get(project).ShowTrack(*pNewTrack);
135 }
136}
#define _(s)
Definition: Internat.h:73
TrackListHolder MixAndRender(const TrackIterRange< const WaveTrack > &trackRange, const Mixer::WarpOptions &warpOptions, const wxString &newTrackName, WaveTrackFactory *trackFactory, double rate, sampleFormat format, double startTime, double endTime)
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()
Definition: TrackFocus.cpp:156
static TrackPanel & Get(AudacityProject &project)
Definition: TrackPanel.cpp:233
void ShowTrack(const Track &track)
Definition: Viewport.cpp:454
static WaveTrackFactory & Get(AudacityProject &project)
Definition: WaveTrack.cpp:4516
A Track that contains audio waveform data.
Definition: WaveTrack.h:227
size_t NChannels() const override
May report more than one only when this is a leader track.
Definition: WaveTrack.cpp:836
auto end(const Ptr< Type, BaseDeleter > &p)
Enables range-for.
Definition: PackedArray.h:159
PROJECT_RATE_API sampleFormat SampleFormatChoice()
void rotate(const float *oldPhase, const float *newPhase, std::complex< float > *dst, int32_t n)
Definition: VectorOps.h:140
Immutable structure is an argument to Mixer's constructor.
Definition: MixerOptions.h:56

References _, PackedArray::end(), TrackFocus::Get(), ProjectHistory::Get(), ProjectRate::Get(), TrackList::Get(), Viewport::Get(), WaveTrackFactory::Get(), TrackPanel::Get(), ProjectRate::GetRate(), MixAndRender(), WaveTrack::NChannels(), project, ProjectHistory::PushState(), staffpad::vo::rotate(), QualitySettings::SampleFormatChoice(), Viewport::ShowTrack(), tracks, 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 138 of file TrackMenus.cpp.

139{
140 auto &tracks = TrackList::Get( project );
141
142 // count selected wave tracks
143 const auto range = tracks.Any< WaveTrack >();
144 const auto selectedRange = range + &Track::IsSelected;
145 auto count = selectedRange.size();
146
147 // iter through them, all if none selected.
148 for (auto left : count == 0 ? range : selectedRange )
149 left->SetPan( PanValue );
150
151 auto flags = UndoPush::NONE;
153 /*i18n-hint: One or more audio tracks have been panned*/
154 .PushState(XO("Panned audio track(s)"), XO("Pan Track"), flags);
155 flags = flags | UndoPush::CONSOLIDATE;
156}
size_t size() const
How many attachment pointers are in the Site.
Definition: ClientData.h:259
bool IsSelected() const
Definition: Track.cpp:288

References CONSOLIDATE, ProjectHistory::Get(), TrackList::Get(), Track::IsSelected(), NONE, project, ProjectHistory::PushState(), ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::size(), tracks, 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 472 of file TrackMenus.cpp.

473{
474 auto GetTime = [](const Track &t) {
475 return t.TypeSwitch<double>(
476 [&](const WaveTrack &w) {
477 auto stime = w.GetEndTime();
478
479 int ndx;
480 for (ndx = 0; ndx < w.GetNumClips(); ndx++) {
481 const auto c = w.GetClipByIndex(ndx);
482 if (c->GetVisibleSampleCount() == 0)
483 continue;
484 stime = std::min(stime, c->GetPlayStartTime());
485 }
486 return stime;
487 },
488 [&](const LabelTrack& l) {
489 return l.GetStartTime();
490 }
491 );
492 };
493
494 std::vector<Track *> arr;
496 arr.reserve(tracks.Size());
497
498 // First find the permutation.
499 for (const auto pTrack : tracks) {
500 auto &track = *pTrack;
501 const auto size = arr.size();
502 size_t ndx = 0;
503 for (; ndx < size; ++ndx) {
504 Track &arrTrack = *arr[ndx];
505 if (flags & kAudacitySortByName) {
506 //do case insensitive sort - cmpNoCase returns less than zero if
507 // the string is 'less than' its argument
508 //also if we have case insensitive equality, then we need to sort
509 // by case as well
510 //We sort 'b' before 'B' accordingly. We uncharacteristically
511 // use greater than for the case sensitive
512 //compare because 'b' is greater than 'B' in ascii.
513 auto cmpValue = track.GetName().CmpNoCase(arrTrack.GetName());
514 if (cmpValue < 0 ||
515 (0 == cmpValue &&
516 track.GetName().CompareTo(arrTrack.GetName()) > 0))
517 break;
518 }
519 //sort by time otherwise
520 else if (flags & kAudacitySortByTime)
521 if (GetTime(track) < GetTime(arrTrack))
522 break;
523 }
524 arr.insert(arr.begin() + ndx, &track);
525 }
526
527 // Now apply the permutation
528 tracks.Permute(arr);
529}
int min(int a, int b)
A LabelTrack is a Track that holds labels (LabelStruct).
Definition: LabelTrack.h:87
const wxString & GetName() const
Name is always the same for all channels of a group.
Definition: Track.cpp:56

References TrackList::Get(), Track::GetName(), kAudacitySortByName, kAudacitySortByTime, min(), project, size, and tracks.

Referenced by OnSortName(), and OnSortTime().

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

◆ ExtraTrackMenu()

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

Definition at line 1281 of file TrackMenus.cpp.

1282{
1283 static auto menu = std::shared_ptr{
1284 Menu( wxT("Track"), XXO("&Track"),
1285 Command( wxT("TrackPan"), XXO("Change P&an on Focused Track..."),
1286 OnTrackPan,
1287 TrackPanelHasFocus() | TracksExistFlag(), wxT("Shift+P") ),
1288 Command( wxT("TrackPanLeft"), XXO("Pan &Left on Focused Track"),
1290 TrackPanelHasFocus() | TracksExistFlag(), wxT("Alt+Shift+Left") ),
1291 Command( wxT("TrackPanRight"), XXO("Pan &Right on Focused Track"),
1293 TrackPanelHasFocus() | TracksExistFlag(), wxT("Alt+Shift+Right") ),
1294 Command( wxT("TrackGain"), XXO("Change Gai&n on Focused Track..."),
1296 TrackPanelHasFocus() | TracksExistFlag(), wxT("Shift+G") ),
1297 Command( wxT("TrackGainInc"), XXO("&Increase Gain on Focused Track"),
1299 TrackPanelHasFocus() | TracksExistFlag(), wxT("Alt+Shift+Up") ),
1300 Command( wxT("TrackGainDec"), XXO("&Decrease Gain on Focused Track"),
1302 TrackPanelHasFocus() | TracksExistFlag(), wxT("Alt+Shift+Down") ),
1303 Command( wxT("TrackMenu"), XXO("Op&en Menu on Focused Track..."),
1306 Options{ wxT("Shift+M") }.SkipKeyDown() ),
1307 Command( wxT("TrackMute"), XXO("M&ute/Unmute Focused Track"),
1309 TracksExistFlag() | TrackPanelHasFocus(), wxT("Shift+U") ),
1310 Command( wxT("TrackSolo"), XXO("&Solo/Unsolo Focused Track"),
1312 TracksExistFlag() | TrackPanelHasFocus(), wxT("Shift+S") ),
1313 Command( wxT("TrackClose"), XXO("&Close Focused Track"),
1316 wxT("Shift+C") ),
1317 Command( wxT("TrackMoveUp"), XXO("Move Focused Track U&p"),
1320 Command( wxT("TrackMoveDown"), XXO("Move Focused Track Do&wn"),
1323 Command( wxT("TrackMoveTop"), XXO("Move Focused Track to T&op"),
1326 Command( wxT("TrackMoveBottom"), XXO("Move Focused Track to &Bottom"),
1329 ) };
1330 return menu;
1331}
const ReservedCommandFlag & AudioIONotBusyFlag()
const ReservedCommandFlag & TracksExistFlag()
const ReservedCommandFlag & TrackPanelHasFocus()
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
void OnTrackMoveBottom(const CommandContext &context)
void OnTrackPan(const CommandContext &context)
Definition: TrackMenus.cpp:942
void OnTrackMoveTop(const CommandContext &context)
void OnTrackPanRight(const CommandContext &context)
Definition: TrackMenus.cpp:968
void OnTrackMoveDown(const CommandContext &context)
void OnTrackGain(const CommandContext &context)
Definition: TrackMenus.cpp:981
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)
Definition: TrackMenus.cpp:995
void OnTrackMoveUp(const CommandContext &context)
void OnTrackClose(const CommandContext &context)
void OnTrackPanLeft(const CommandContext &context)
Definition: TrackMenus.cpp:955

References AudioIONotBusyFlag(), MenuRegistry::Command, MenuRegistry::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 178 of file TrackMenus.cpp.

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

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 691 of file TrackMenus.cpp.

692{
693 auto &project = context.project;
694 const auto &settings = ProjectSettings::Get( project );
695 auto &tracks = TrackList::Get( project );
696
697 const auto solo = TracksBehaviorsSolo.ReadEnum();
698 const auto soloSimple = (solo == SoloBehaviorSimple);
699
700 auto iter = selected ? tracks.Selected<PlayableTrack>() : tracks.Any<PlayableTrack>();
701 for (auto pt : iter) {
702 pt->SetMute(mute);
703 if (soloSimple)
704 pt->SetSolo(false);
705 }
706
708}
EnumSetting< SoloBehavior > TracksBehaviorsSolo
@ SoloBehaviorSimple
Definition: PlayableTrack.h:70
static Settings & settings()
Definition: TrackInfo.cpp:69
AudacityProject & project
AudioTrack subclass that can also be audibly replayed by the program.
Definition: PlayableTrack.h:40
void SetMute(bool m)
void ModifyState(bool bWantsAutoSave)
static ProjectSettings & Get(AudacityProject &project)

References ProjectHistory::Get(), TrackList::Get(), ProjectSettings::Get(), ProjectHistory::ModifyState(), CommandContext::project, project, PlayableTrack::SetMute(), settings(), SoloBehaviorSimple, tracks, and TracksBehaviorsSolo.

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 756 of file TrackMenus.cpp.

757{
758 auto &project = context.project;
759
760 bool bMoveWith;
761 gPrefs->Read(wxT("/GUI/MoveSelectionWithTracks"), &bMoveWith, false);
762 DoAlign(project, context.index, bMoveWith);
763}
audacity::BasicSettings * gPrefs
Definition: Prefs.cpp:68
virtual bool Read(const wxString &key, bool *value) const =0
void DoAlign(AudacityProject &project, int index, bool moveSel)
Definition: TrackMenus.cpp:180

References DoAlign(), gPrefs, CommandContext::index, CommandContext::project, project, audacity::BasicSettings::Read(), 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 748 of file TrackMenus.cpp.

749{
750 auto &project = context.project;
751
753 context.index + kAlignLabelsCount(), false);
754}

References DoAlign(), CommandContext::index, kAlignLabelsCount(), CommandContext::project, and 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 571 of file TrackMenus.cpp.

572{
573 auto &project = context.project;
574 DoMixAndRender(project, false);
575}
void DoMixAndRender(AudacityProject &project, bool toNewTrack)
Definition: TrackMenus.cpp:47

References DoMixAndRender(), CommandContext::project, and 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 577 of file TrackMenus.cpp.

578{
579 auto &project = context.project;
580 DoMixAndRender(project, true);
581}

References DoMixAndRender(), CommandContext::project, and 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 773 of file TrackMenus.cpp.

774{
775 bool bMoveWith;
776 gPrefs->Read(wxT("/GUI/MoveSelectionWithTracks"), &bMoveWith, false);
777 gPrefs->Write(wxT("/GUI/MoveSelectionWithTracks"), !bMoveWith);
778 gPrefs->Flush();
779
780}
virtual bool Flush() noexcept=0
virtual bool Write(const wxString &key, bool value)=0

References audacity::BasicSettings::Flush(), gPrefs, audacity::BasicSettings::Read(), audacity::BasicSettings::Write(), 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 710 of file TrackMenus.cpp.

711{
712 MuteTracks(context, true, false);
713}
static void MuteTracks(const CommandContext &context, bool mute, bool selected)
Definition: TrackMenus.cpp:691

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 720 of file TrackMenus.cpp.

721{
722 MuteTracks(context, true, true);
723}

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 742 of file TrackMenus.cpp.

743{
744 auto &project = context.project;
745 DoPanTracks( project, 0.0);
746}
void DoPanTracks(AudacityProject &project, float PanValue)
Definition: TrackMenus.cpp:138

References DoPanTracks(), CommandContext::project, and 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 730 of file TrackMenus.cpp.

731{
732 auto &project = context.project;
733 DoPanTracks( project, -1.0);
734}

References DoPanTracks(), CommandContext::project, and 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 736 of file TrackMenus.cpp.

737{
738 auto &project = context.project;
739 DoPanTracks( project, 1.0);
740}

References DoPanTracks(), CommandContext::project, and 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 686 of file TrackMenus.cpp.

687{
689}
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 583 of file TrackMenus.cpp.

584{
585 auto &project = context.project;
586 auto projectRate = ProjectRate::Get(project).GetRate();
588 auto &undoManager = UndoManager::Get(project);
589 auto &viewport = Viewport::Get(project);
590 auto &window = GetProjectFrame(project);
591
592 int newRate;
593
594 while (true) {
595 wxDialogWrapper dlg(&window, wxID_ANY, XO("Resample"));
596 ShuttleGui S(&dlg, eIsCreating);
597 wxString rate;
598 wxComboBox *cb;
599
600 rate.Printf(wxT("%ld"), lrint(projectRate));
601
602 wxArrayStringEx rates{
603 wxT("8000") ,
604 wxT("11025") ,
605 wxT("16000") ,
606 wxT("22050") ,
607 wxT("32000") ,
608 wxT("44100") ,
609 wxT("48000") ,
610 wxT("88200") ,
611 wxT("96000") ,
612 wxT("176400") ,
613 wxT("192000") ,
614 wxT("352800") ,
615 wxT("384000") ,
616 };
617
618 S.StartVerticalLay(true);
619 {
620 S.AddSpace(-1, 15);
621
622 S.StartHorizontalLay(wxCENTER, false);
623 {
624 cb = S.AddCombo(XXO("New sample rate (Hz):"),
625 rate,
626 rates);
627 }
628 S.EndHorizontalLay();
629
630 S.AddSpace(-1, 15);
631
632 S.AddStandardButtons();
633 }
634 S.EndVerticalLay();
635
636 dlg.Layout();
637 dlg.Fit();
638 dlg.Center();
639
640 if (dlg.ShowModal() != wxID_OK)
641 return; // user cancelled dialog
642
643 long lrate;
644 if (cb->GetValue().ToLong(&lrate) && lrate >= 1 && lrate <= 1000000) {
645 newRate = (int)lrate;
646 break;
647 }
648
650 XO("The entered value is invalid"),
651 XO("Error"),
652 wxICON_ERROR,
653 &window);
654 }
655
656 int ndx = 0;
657 auto flags = UndoPush::NONE;
658 for (auto wt : tracks.Selected<WaveTrack>()) {
659 auto msg = XO("Resampling track %d").Format(++ndx);
660
661 using namespace BasicUI;
662 auto progress = MakeProgress(XO("Resample"), msg);
663
664 // The resampling of a track may be stopped by the user. This might
665 // leave a track with multiple clips in a partially resampled state.
666 // But the thrown exception will cause rollback in the application
667 // level handler.
668
669 wt->Resample(newRate, progress.get());
670
671 // Each time a track is successfully, completely resampled,
672 // commit that to the undo stack. The second and later times,
673 // consolidate.
674
676 XO("Resampled audio track(s)"), XO("Resample Track"), flags);
677 flags = flags | UndoPush::CONSOLIDATE;
678 }
679
680 undoManager.StopConsolidating();
681
682 // Need to reset
683 viewport.DoScroll();
684}
int AudacityMessageBox(const TranslatableString &message, const TranslatableString &caption, long style, wxWindow *parent, int x, int y)
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 ...
@ eIsCreating
Definition: ShuttleGui.h:37
#define S(N)
Definition: ToChars.cpp:64
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:630
static UndoManager & Get(AudacityProject &project)
Definition: UndoManager.cpp:71
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:292

References AudacityMessageBox(), CONSOLIDATE, eIsCreating, ProjectHistory::Get(), UndoManager::Get(), ProjectRate::Get(), TrackList::Get(), Viewport::Get(), GetProjectFrame(), ProjectRate::GetRate(), lrint, BasicUI::MakeProgress(), NONE, CommandContext::project, project, ProjectHistory::PushState(), S, tracks, 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 917 of file TrackMenus.cpp.

918{
919 auto &project = context.project;
921
923 .PushState(XO("Tracks sorted by name"), XO("Sort by Name"));
924}
void DoSortTracks(AudacityProject &project, int flags)
Definition: TrackMenus.cpp:472

References DoSortTracks(), ProjectHistory::Get(), kAudacitySortByName, CommandContext::project, 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 908 of file TrackMenus.cpp.

909{
910 auto &project = context.project;
912
914 .PushState(XO("Tracks sorted by time"), XO("Sort by Time"));
915}

References DoSortTracks(), ProjectHistory::Get(), kAudacitySortByTime, CommandContext::project, 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 563 of file TrackMenus.cpp.

564{
566 EffectManager::Get().GetEffectByIdentifier(wxT("StereoToMono")),
567 context,
569}
static EffectManager & Get()
AUDACITY_DLL_API bool DoEffect(const PluginID &ID, const CommandContext &context, unsigned flags)
'Repeat Last Effect'.
Definition: EffectUI.cpp:1148

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 926 of file TrackMenus.cpp.

927{
928 auto &project = context.project;
929 auto &trackPanel = TrackPanel::Get( project );
930
932 gPrefs->Flush();
933
934 // Toolbar, project sync-lock handled within
936
937 trackPanel.Refresh(false);
938}
BoolSetting SyncLockTracks
Definition: SyncLock.cpp:173
bool Toggle()
Write the negation of the previous value, and then return the current value.
Definition: Prefs.cpp:555
static void ModifyAllProjectToolbarMenus()

References audacity::BasicSettings::Flush(), TrackPanel::Get(), gPrefs, ToolManager::ModifyAllProjectToolbarMenus(), CommandContext::project, project, SyncLockTracks, and BoolSetting::Toggle().

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 1053 of file TrackMenus.cpp.

1054{
1055 auto &project = context.project;
1056 auto &trackPanel = TrackPanel::Get( project );
1057
1058 const auto t = TrackFocus::Get( project ).Get();
1059 if (!t)
1060 return;
1061
1062 auto isAudioActive = ProjectAudioIO::Get( project ).IsAudioActive();
1063
1064 if (isAudioActive)
1065 {
1067 XO("Can't delete track with active audio"));
1068 wxBell();
1069 return;
1070 }
1071
1073
1074 trackPanel.UpdateViewIfNoTracks();
1075 trackPanel.Refresh(false);
1076}
Subclass & Get(const RegisteredFactory &key)
Get reference to an attachment, creating on demand if not present, down-cast it to Subclass.
Definition: ClientData.h:317
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, 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 981 of file TrackMenus.cpp.

982{
983 auto &project = context.project;
984 auto &trackPanel = TrackPanel::Get( project );
985
987 const auto track = TrackFocus::Get( project ).Get();
988 if (track) track->TypeSwitch( [&](WaveTrack &wt) {
989 LWSlider *slider = WaveTrackControls::GainSlider( trackPanel, wt );
990 if (slider->ShowDialog())
991 SetTrackGain(project, &wt, slider);
992 });
993}
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:1120
static LWSlider * GainSlider(CellularPanel &panel, const WaveTrack &wt)
void SetTrackGain(AudacityProject &project, WaveTrack *wt, LWSlider *slider)
Definition: TrackMenus.cpp:531

References WaveTrackControls::GainSlider(), TrackFocus::Get(), TrackPanel::Get(), ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::Get(), CommandContext::project, 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 1008 of file TrackMenus.cpp.

1009{
1010 auto &project = context.project;
1011 auto &trackPanel = TrackPanel::Get( project );
1012
1013 const auto track = TrackFocus::Get( project ).Get();
1014 if (track) track->TypeSwitch( [&](WaveTrack &wt) {
1015 LWSlider *slider = WaveTrackControls::GainSlider( trackPanel, wt );
1016 slider->Decrease(1);
1017 SetTrackGain(project, &wt, slider);
1018 });
1019}
void Decrease(float steps)
Definition: ASlider.cpp:1601

References LWSlider::Decrease(), WaveTrackControls::GainSlider(), TrackFocus::Get(), TrackPanel::Get(), ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::Get(), CommandContext::project, 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 995 of file TrackMenus.cpp.

996{
997 auto &project = context.project;
998 auto &trackPanel = TrackPanel::Get( project );
999
1000 const auto track = TrackFocus::Get( project ).Get();
1001 if (track) track->TypeSwitch( [&](WaveTrack &wt) {
1002 LWSlider *slider = WaveTrackControls::GainSlider( trackPanel, wt );
1003 slider->Increase(1);
1004 SetTrackGain(project, &wt, slider);
1005 });
1006}
void Increase(float steps)
Definition: ASlider.cpp:1578

References WaveTrackControls::GainSlider(), TrackFocus::Get(), TrackPanel::Get(), ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::Get(), LWSlider::Increase(), CommandContext::project, 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 1021 of file TrackMenus.cpp.

1022{
1023 auto &project = context.project;
1024 auto &trackPanel = TrackPanel::Get( project );
1025
1026 trackPanel.OnTrackMenu();
1027}

References TrackPanel::Get(), CommandContext::project, and 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 1117 of file TrackMenus.cpp.

1118{
1119 auto &project = context.project;
1120 auto &trackPanel = TrackPanel::Get( project );
1121 auto &tracks = TrackList::Get( project );
1122
1123 const auto focusedTrack = TrackFocus::Get( project ).Get();
1124 if (tracks.CanMoveDown(focusedTrack)) {
1126 trackPanel.Refresh(false);
1127 }
1128}
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, CommandContext::project, project, and tracks.

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 1091 of file TrackMenus.cpp.

1092{
1093 auto &project = context.project;
1094 auto &trackPanel = TrackPanel::Get( project );
1095 auto &tracks = TrackList::Get( project );
1096
1097 const auto focusedTrack = TrackFocus::Get( project ).Get();
1098 if (tracks.CanMoveDown(focusedTrack)) {
1100 trackPanel.Refresh(false);
1101 }
1102}

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

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 1104 of file TrackMenus.cpp.

1105{
1106 auto &project = context.project;
1107 auto &trackPanel = TrackPanel::Get( project );
1108 auto &tracks = TrackList::Get( project );
1109
1110 const auto focusedTrack = TrackFocus::Get( project ).Get();
1111 if (tracks.CanMoveUp(focusedTrack)) {
1113 trackPanel.Refresh(false);
1114 }
1115}

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

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 1078 of file TrackMenus.cpp.

1079{
1080 auto &project = context.project;
1081 auto &trackPanel = TrackPanel::Get( project );
1082 auto &tracks = TrackList::Get( project );
1083
1084 const auto focusedTrack = TrackFocus::Get( project ).Get();
1085 if (tracks.CanMoveUp(focusedTrack)) {
1087 trackPanel.Refresh(false);
1088 }
1089}

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

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 1029 of file TrackMenus.cpp.

1030{
1031 auto &project = context.project;
1032
1033 // Use the temporary selection if it is specified, else the track focus
1034 auto track = context.temporarySelection.pTrack;
1035 if (!track)
1036 track = TrackFocus::Get( project ).Get();
1037
1038 if (track) track->TypeSwitch( [&](PlayableTrack &t) {
1040 });
1041}
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, 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 942 of file TrackMenus.cpp.

943{
944 auto &project = context.project;
945 auto &trackPanel = TrackPanel::Get( project );
946
947 const auto track = TrackFocus::Get( project ).Get();
948 if (track) track->TypeSwitch( [&](WaveTrack &wt) {
949 LWSlider *slider = WaveTrackControls::PanSlider( trackPanel, wt );
950 if (slider->ShowDialog())
951 SetTrackPan(project, &wt, slider);
952 });
953}
static LWSlider * PanSlider(CellularPanel &panel, const WaveTrack &wt)
void SetTrackPan(AudacityProject &project, WaveTrack *wt, LWSlider *slider)
Definition: TrackMenus.cpp:544

References TrackFocus::Get(), TrackPanel::Get(), ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::Get(), WaveTrackControls::PanSlider(), CommandContext::project, 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 955 of file TrackMenus.cpp.

956{
957 auto &project = context.project;
958 auto &trackPanel = TrackPanel::Get( project );
959
960 const auto track = TrackFocus::Get( project ).Get();
961 if (track) track->TypeSwitch( [&](WaveTrack &wt) {
962 LWSlider *slider = WaveTrackControls::PanSlider( trackPanel, wt );
963 slider->Decrease(1);
964 SetTrackPan(project, &wt, slider);
965 });
966}

References LWSlider::Decrease(), TrackFocus::Get(), TrackPanel::Get(), ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::Get(), WaveTrackControls::PanSlider(), CommandContext::project, 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 968 of file TrackMenus.cpp.

969{
970 auto &project = context.project;
971 auto &trackPanel = TrackPanel::Get( project );
972
973 const auto track = TrackFocus::Get( project ).Get();
974 if (track) track->TypeSwitch( [&](WaveTrack &wt) {
975 LWSlider *slider = WaveTrackControls::PanSlider( trackPanel, wt );
976 slider->Increase(1);
977 SetTrackPan(project, &wt, slider);
978 });
979}

References TrackFocus::Get(), TrackPanel::Get(), ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::Get(), LWSlider::Increase(), WaveTrackControls::PanSlider(), CommandContext::project, 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 1043 of file TrackMenus.cpp.

1044{
1045 auto &project = context.project;
1046
1047 const auto track = TrackFocus::Get( project ).Get();
1048 if (track) track->TypeSwitch( [&](PlayableTrack &t) {
1050 });
1051}
void DoTrackSolo(AudacityProject &project, Track *t, bool exclusive)

References TrackUtilities::DoTrackSolo(), TrackFocus::Get(), ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::Get(), CommandContext::project, and 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 715 of file TrackMenus.cpp.

716{
717 MuteTracks(context, false, false);
718}

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 725 of file TrackMenus.cpp.

726{
727 MuteTracks(context, false, true);
728}

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 531 of file TrackMenus.cpp.

532{
533 wxASSERT(wt);
534 float newValue = slider->Get();
535
536 wt->SetGain(newValue);
537
539 .PushState(XO("Adjusted gain"), XO("Gain"), UndoPush::CONSOLIDATE);
540
542}
float Get(bool convert=true)
Definition: ASlider.cpp:1553
void RefreshTrack(Track *trk, bool refreshbacking=true)
Definition: TrackPanel.cpp:764
void SetGain(float newGain)
Definition: WaveTrack.cpp:1165

References CONSOLIDATE, ProjectHistory::Get(), TrackPanel::Get(), LWSlider::Get(), project, ProjectHistory::PushState(), TrackPanel::RefreshTrack(), WaveTrack::SetGain(), 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 544 of file TrackMenus.cpp.

545{
546 wxASSERT(wt);
547 float newValue = slider->Get();
548
549 wt->SetPan(newValue);
550
552 .PushState(XO("Adjusted Pan"), XO("Pan"), UndoPush::CONSOLIDATE);
553
555}
void SetPan(float newPan)
Definition: WaveTrack.cpp:1183

References CONSOLIDATE, ProjectHistory::Get(), TrackPanel::Get(), LWSlider::Get(), project, ProjectHistory::PushState(), TrackPanel::RefreshTrack(), WaveTrack::SetPan(), 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()

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

Definition at line 1134 of file TrackMenus.cpp.

1135{
1136 // Tracks Menu (formerly Project Menu)
1137 static auto menu = std::shared_ptr{
1138 Menu( wxT("Tracks"), XXO("&Tracks"),
1139 Section( "Add",
1140 Menu( wxT("Add"), XXO("Add &New") )
1141 ),
1142
1144
1145 Section( "",
1146 Menu( wxT("Mix"), XXO("Mi&x"),
1147 // Delayed evaluation
1148 // Stereo to Mono is an oddball command that is also subject to control
1149 // by the plug-in manager, as if an effect. Decide whether to show or
1150 // hide it.
1151 [](AudacityProject&) -> std::unique_ptr<CommandItem> {
1152 const PluginID ID =
1153 EffectManager::Get().GetEffectByIdentifier(wxT("StereoToMono"));
1154 const PluginDescriptor *plug = PluginManager::Get().GetPlugin(ID);
1155 if (plug && plug->IsEnabled())
1156 return Command( wxT("Stereo to Mono"),
1157 XXO("Mix Stereo Down to &Mono"), OnStereoToMono,
1160 else
1161 return {};
1162 },
1163 Command( wxT("MixAndRender"), XXO("Mi&x and Render"),
1166 Command( wxT("MixAndRenderToNewTrack"),
1167 XXO("Mix and Render to Ne&w Track"),
1169 AudioIONotBusyFlag() | WaveTracksSelectedFlag(), wxT("Ctrl+Shift+M") )
1170 ),
1171
1172 Command( wxT("Resample"), XXO("&Resample..."), OnResample,
1174 ),
1175
1176 Section( "",
1177 Command( wxT("RemoveTracks"), XXO("Remo&ve Tracks"), OnRemoveTracks,
1179 ),
1180
1181 Section( "",
1182 Menu( wxT("Mute"), XXO("M&ute/Unmute"),
1183 Command( wxT("MuteAllTracks"), XXO("&Mute All Tracks"),
1184 OnMuteAllTracks, TracksExistFlag(), wxT("Ctrl+U") ),
1185 Command( wxT("UnmuteAllTracks"), XXO("&Unmute All Tracks"),
1186 OnUnmuteAllTracks, TracksExistFlag(), wxT("Ctrl+Shift+U") ),
1187 Command( wxT("MuteTracks"), XXO("Mut&e Tracks"),
1189 Command( wxT("UnmuteTracks"), XXO("U&nmute Tracks"),
1190 OnUnmuteSelectedTracks, EditableTracksSelectedFlag(), wxT("Ctrl+Alt+Shift+U") )
1191 ),
1192
1193 Menu( wxT("Pan"), XXO("&Pan"),
1194 // As Pan changes are not saved on Undo stack,
1195 // pan settings for all tracks
1196 // in the project could very easily be lost unless we
1197 // require the tracks to be selected.
1198 Command( wxT("PanLeft"), XXO("&Left"), OnPanLeft,
1200 Options{}.LongName( XO("Pan Left") ) ),
1201 Command( wxT("PanRight"), XXO("&Right"), OnPanRight,
1203 Options{}.LongName( XO("Pan Right") ) ),
1204 Command( wxT("PanCenter"), XXO("&Center"), OnPanCenter,
1206 Options{}.LongName( XO("Pan Center") ) )
1207 )
1208 ),
1209
1210 Section( "",
1211 Menu( wxT("Align"), XXO("&Align Tracks"), // XO("Just Move Tracks"),
1212 Section( "",
1213 // Mutual alignment of tracks independent of selection or zero
1214 CommandGroup(wxT("Align"),
1215 {
1216 { wxT("EndToEnd"), XXO("&Align End to End") },
1217 { wxT("Together"), XXO("Align &Together") },
1218 },
1220 ),
1221
1222 Section( "",
1223 // Alignment commands using selection or zero
1224 CommandGroup(wxT("Align"),
1225 alignLabels(),
1227 ),
1228
1229 Section( "",
1230 Command( wxT("MoveSelectionWithTracks"),
1231 XXO("&Move Selection with Tracks"),
1234 Options{}.CheckTest( wxT("/GUI/MoveSelectionWithTracks"), false ) )
1235 )
1236 ),
1237
1238 #if 0
1239 // TODO: Can these labels be made clearer?
1240 // Do we need this sub-menu at all?
1241 Menu( wxT("MoveSelectionAndTracks"), XO("Move Sele&ction and Tracks"), {
1242 CommandGroup(wxT("AlignMove"), alignLabels(),
1243 OnAlignMoveSel, AudioIONotBusyFlag() | EditableTracksSelectedFlag()),
1244 } ),
1245 #endif
1246
1248
1249 #ifdef EXPERIMENTAL_SCOREALIGN
1250 Command( wxT("ScoreAlign"), XXO("Synchronize MIDI with Audio"),
1251 OnScoreAlign,
1252 AudioIONotBusyFlag() | NoteTracksSelectedFlag() | WaveTracksSelectedFlag() ),
1253 #endif // EXPERIMENTAL_SCOREALIGN
1254
1256
1257 Menu( wxT("Sort"), XXO("S&ort Tracks"),
1258 Command( wxT("SortByTime"), XXO("By &Start Time"), OnSortTime,
1260 Options{}.LongName( XO("Sort by Time") ) ),
1261 Command( wxT("SortByName"), XXO("By &Name"), OnSortName,
1263 Options{}.LongName( XO("Sort by Name") ) )
1264 )
1265
1267 ),
1268
1269 Section( "",
1270 Command( wxT("SyncLock"), XXO("Keep tracks synchronized (Sync-&Lock)"),
1273 )
1274
1275 ) };
1276 return menu;
1277}
wxString PluginID
constexpr CommandFlag AlwaysEnabledFlag
Definition: CommandFlag.h:34
const ReservedCommandFlag & StereoRequiredFlag()
const ReservedCommandFlag & EditableTracksSelectedFlag()
const ReservedCommandFlag & AnyTracksSelectedFlag()
const ReservedCommandFlag & WaveTracksSelectedFlag()
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()
constexpr auto Section
Definition: MenuRegistry.h:436
constexpr auto CommandGroup
Definition: MenuRegistry.h:458
void OnPanCenter(const CommandContext &context)
Definition: TrackMenus.cpp:742
void OnUnmuteSelectedTracks(const CommandContext &context)
Definition: TrackMenus.cpp:725
void OnResample(const CommandContext &context)
Definition: TrackMenus.cpp:583
void OnMixAndRenderToNewTrack(const CommandContext &context)
Definition: TrackMenus.cpp:577
void OnSortName(const CommandContext &context)
Definition: TrackMenus.cpp:917
void OnPanRight(const CommandContext &context)
Definition: TrackMenus.cpp:736
void OnMixAndRender(const CommandContext &context)
Definition: TrackMenus.cpp:571
void OnMuteAllTracks(const CommandContext &context)
Definition: TrackMenus.cpp:710
void OnUnmuteAllTracks(const CommandContext &context)
Definition: TrackMenus.cpp:715
void OnRemoveTracks(const CommandContext &context)
Definition: TrackMenus.cpp:686
void OnPanLeft(const CommandContext &context)
Definition: TrackMenus.cpp:730
void OnMuteSelectedTracks(const CommandContext &context)
Definition: TrackMenus.cpp:720
void OnMoveSelectionWithTracks(const CommandContext &WXUNUSED(context))
Definition: TrackMenus.cpp:773
void OnSyncLock(const CommandContext &context)
Definition: TrackMenus.cpp:926
void OnAlignNoSync(const CommandContext &context)
Definition: TrackMenus.cpp:748
void OnAlign(const CommandContext &context)
Definition: TrackMenus.cpp:756
void OnStereoToMono(const CommandContext &context)
Definition: TrackMenus.cpp:563
void OnSortTime(const CommandContext &context)
Definition: TrackMenus.cpp:908
Options && CheckTest(const CheckFn &fn) &&
Definition: MenuRegistry.h:74
Options && LongName(const TranslatableString &value) &&
Definition: MenuRegistry.h:54

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

Here is the call graph for this function:

Variable Documentation

◆ sAttachment1

AttachedItem anonymous_namespace{TrackMenus.cpp}::sAttachment1 { Indirect(TracksMenu()) }

Definition at line 1279 of file TrackMenus.cpp.

◆ sAttachment2

AttachedItem anonymous_namespace{TrackMenus.cpp}::sAttachment2
Initial value:
wxT("Optional/Extra/Part2")
}
std::unique_ptr< detail::IndirectItem< Item > > Indirect(const std::shared_ptr< Item > &ptr)
A convenience function.
Definition: Registry.h:175

Definition at line 1333 of file TrackMenus.cpp.