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

◆ anonymous enum

anonymous enum
Enumerator
kAudacitySortByTime 
kAudacitySortByName 

Definition at line 455 of file TrackMenus.cpp.

Function Documentation

◆ alignLabels()

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

Definition at line 158 of file TrackMenus.cpp.

158 { static std::vector< ComponentInterfaceSymbol > symbols{
159 { wxT("StartToZero"), XXO("Start to &Zero") },
160 { wxT("StartToSelStart"), XXO("Start to &Cursor/Selection Start") },
161 { wxT("StartToSelEnd"), XXO("Start to Selection &End") },
162 { wxT("EndToSelStart"), XXO("End to Cu&rsor/Selection Start") },
163 { wxT("EndToSelEnd"), XXO("End to Selection En&d") },
164}; 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 168 of file TrackMenus.cpp.

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

References ProjectHistory::Get(), ViewInfo::Get(), TrackList::Get(), Viewport::Get(), ChannelGroup::GetEndTime(), ChannelGroup::GetStartTime(), SyncLock::IsSelectedOrSyncLockSelectedP(), 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 newTrack = ::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 (newTrack) {
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 if (!toNewTrack) {
70 // Beware iterator invalidation!
71 while (!trackRange.empty())
72 tracks.Remove(**trackRange.first++);
73 }
74
75 // Add new tracks
76 const bool stereo = newTrack->NChannels() > 1;
77 const auto firstName = newTrack->GetName();
78 tracks.Add(newTrack);
79 const auto pNewTrack = *tracks.Any<WaveTrack>().rbegin();
80
81 // Bug 2218, remember more things...
82 if (selectedCount >= 1)
83 pNewTrack->SetSelected(!toNewTrack);
84
85 // Permute the tracks as needed
86 // The new track appears after the old tracks (or where the old tracks
87 // had been) so that they are in the same sync-lock group
88 if (insertionPoint) {
89 std::vector<Track *> arr;
90 arr.reserve(tracks.Size());
91 size_t iBegin = 0, ii = 0;
92 for (const auto pTrack : tracks) {
93 arr.push_back(pTrack);
94 if (pTrack == insertionPoint)
95 iBegin = ii;
96 ++ii;
97 }
98 const auto end = arr.end(),
99 mid = end - 1;
100 std::rotate(arr.begin() + iBegin, mid, end);
101 tracks.Permute(arr);
102 }
103
104 // Smart history/undo message
105 if (selectedCount == 1) {
106 auto msg = XO("Rendered all audio in track '%s'").Format(firstName);
107 /* i18n-hint: Convert the audio into a more usable form, so apply
108 * panning and amplification and write to some external file.*/
109 ProjectHistory::Get( project ).PushState(msg, XO("Render"));
110 }
111 else {
112 auto msg = (stereo
113 ? XO("Mixed and rendered %d tracks into one new stereo track")
114 : XO("Mixed and rendered %d tracks into one new mono track")
115 )
116 .Format((int)selectedCount);
117 ProjectHistory::Get(project).PushState(msg, XO("Mix and Render"));
118 }
119
120 trackPanel.SetFocus();
121 TrackFocus::Get(project).Set(pNewTrack);
122 Viewport::Get(project).ShowTrack(*pNewTrack);
123 }
124}
#define _(s)
Definition: Internat.h:73
Track::Holder 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
const wxString & GetName() const
Name is always the same for all channels of a group.
Definition: Track.cpp:64
static TrackPanel & Get(AudacityProject &project)
Definition: TrackPanel.cpp:234
void ShowTrack(const Track &track)
Definition: Viewport.cpp:460
static WaveTrackFactory & Get(AudacityProject &project)
Definition: WaveTrack.cpp:3349
A Track that contains audio waveform data.
Definition: WaveTrack.h:203
size_t NChannels() const override
A constant property.
Definition: WaveTrack.cpp:532
PROJECT_RATE_API sampleFormat SampleFormatChoice()
const char * end(const char *str) noexcept
Definition: StringUtils.h:106
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 _, details::end(), TrackFocus::Get(), ProjectHistory::Get(), ProjectRate::Get(), TrackList::Get(), Viewport::Get(), WaveTrackFactory::Get(), TrackPanel::Get(), Track::GetName(), 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 126 of file TrackMenus.cpp.

127{
128 auto &tracks = TrackList::Get( project );
129
130 // count selected wave tracks
131 const auto range = tracks.Any< WaveTrack >();
132 const auto selectedRange = range + &Track::IsSelected;
133 auto count = selectedRange.size();
134
135 // iter through them, all if none selected.
136 for (auto left : count == 0 ? range : selectedRange )
137 left->SetPan( PanValue );
138
139 auto flags = UndoPush::NONE;
141 /*i18n-hint: One or more audio tracks have been panned*/
142 .PushState(XO("Panned audio track(s)"), XO("Pan Track"), flags);
143 flags = flags | UndoPush::CONSOLIDATE;
144}
size_t size() const
How many attachment pointers are in the Site.
Definition: ClientData.h:260
bool IsSelected() const
Definition: Track.cpp:258

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

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

References TrackList::Get(), Track::GetName(), kAudacitySortByName, kAudacitySortByTime, min(), project, size, tracks, and anonymous_namespace{CompressionMeterPanel.cpp}::w.

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

1270{
1271 static auto menu = std::shared_ptr{
1272 Menu( wxT("Track"), XXO("&Track"),
1273 Command( wxT("TrackPan"), XXO("Change P&an on Focused Track..."),
1274 OnTrackPan,
1275 TrackPanelHasFocus() | TracksExistFlag(), wxT("Shift+P") ),
1276 Command( wxT("TrackPanLeft"), XXO("Pan &Left on Focused Track"),
1278 TrackPanelHasFocus() | TracksExistFlag(), wxT("Alt+Shift+Left") ),
1279 Command( wxT("TrackPanRight"), XXO("Pan &Right on Focused Track"),
1281 TrackPanelHasFocus() | TracksExistFlag(), wxT("Alt+Shift+Right") ),
1282 Command( wxT("TrackGain"), XXO("Change Gai&n on Focused Track..."),
1284 TrackPanelHasFocus() | TracksExistFlag(), wxT("Shift+G") ),
1285 Command( wxT("TrackGainInc"), XXO("&Increase Gain on Focused Track"),
1287 TrackPanelHasFocus() | TracksExistFlag(), wxT("Alt+Shift+Up") ),
1288 Command( wxT("TrackGainDec"), XXO("&Decrease Gain on Focused Track"),
1290 TrackPanelHasFocus() | TracksExistFlag(), wxT("Alt+Shift+Down") ),
1291 Command( wxT("TrackMenu"), XXO("Op&en Menu on Focused Track..."),
1294 Options{ wxT("Shift+M") }.SkipKeyDown() ),
1295 Command( wxT("TrackMute"), XXO("M&ute/Unmute Focused Track"),
1297 TracksExistFlag() | TrackPanelHasFocus(), wxT("Shift+U") ),
1298 Command( wxT("TrackSolo"), XXO("&Solo/Unsolo Focused Track"),
1300 TracksExistFlag() | TrackPanelHasFocus(), wxT("Shift+S") ),
1301 Command( wxT("TrackClose"), XXO("Delete Fo&cused Track"),
1304 wxT("Shift+C") ),
1305 Command( wxT("TrackMoveUp"), XXO("Move Focused Track U&p"),
1308 Command( wxT("TrackMoveDown"), XXO("Move Focused Track Do&wn"),
1311 Command( wxT("TrackMoveTop"), XXO("Move Focused Track to T&op"),
1314 Command( wxT("TrackMoveBottom"), XXO("Move Focused Track to &Bottom"),
1317 ) };
1318 return menu;
1319}
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:930
void OnTrackMoveTop(const CommandContext &context)
void OnTrackPanRight(const CommandContext &context)
Definition: TrackMenus.cpp:956
void OnTrackMoveDown(const CommandContext &context)
void OnTrackGain(const CommandContext &context)
Definition: TrackMenus.cpp:969
void OnTrackMute(const CommandContext &context)
void OnTrackMenu(const CommandContext &context)
void OnTrackSolo(const CommandContext &context)
void OnTrackGainDec(const CommandContext &context)
Definition: TrackMenus.cpp:996
void OnTrackGainInc(const CommandContext &context)
Definition: TrackMenus.cpp:983
void OnTrackMoveUp(const CommandContext &context)
void OnTrackClose(const CommandContext &context)
void OnTrackPanLeft(const CommandContext &context)
Definition: TrackMenus.cpp:943

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

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

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

680{
681 auto &project = context.project;
682 const auto &settings = ProjectSettings::Get( project );
683 auto &tracks = TrackList::Get( project );
684
685 const auto solo = TracksBehaviorsSolo.ReadEnum();
686 const auto soloSimple = (solo == SoloBehaviorSimple);
687
688 auto iter = selected ? tracks.Selected<PlayableTrack>() : tracks.Any<PlayableTrack>();
689 for (auto pt : iter) {
690 pt->SetMute(mute);
691 if (soloSimple)
692 pt->SetSolo(false);
693 }
694
696}
EnumSetting< SoloBehavior > TracksBehaviorsSolo
@ SoloBehaviorSimple
Definition: PlayableTrack.h:70
static Settings & settings()
Definition: TrackInfo.cpp:51
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 744 of file TrackMenus.cpp.

745{
746 auto &project = context.project;
747
748 bool bMoveWith;
749 gPrefs->Read(wxT("/GUI/MoveSelectionWithTracks"), &bMoveWith, false);
750 DoAlign(project, context.index, bMoveWith);
751}
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:168

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

737{
738 auto &project = context.project;
739
741 context.index + kAlignLabelsCount(), false);
742}

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

560{
561 auto &project = context.project;
562 DoMixAndRender(project, false);
563}
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 565 of file TrackMenus.cpp.

566{
567 auto &project = context.project;
568 DoMixAndRender(project, true);
569}

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

762{
763 bool bMoveWith;
764 gPrefs->Read(wxT("/GUI/MoveSelectionWithTracks"), &bMoveWith, false);
765 gPrefs->Write(wxT("/GUI/MoveSelectionWithTracks"), !bMoveWith);
766 gPrefs->Flush();
767
768}
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 698 of file TrackMenus.cpp.

699{
700 MuteTracks(context, true, false);
701}
static void MuteTracks(const CommandContext &context, bool mute, bool selected)
Definition: TrackMenus.cpp:679

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

709{
710 MuteTracks(context, true, true);
711}

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

731{
732 auto &project = context.project;
733 DoPanTracks( project, 0.0);
734}
void DoPanTracks(AudacityProject &project, float PanValue)
Definition: TrackMenus.cpp:126

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

719{
720 auto &project = context.project;
721 DoPanTracks( project, -1.0);
722}

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

725{
726 auto &project = context.project;
727 DoPanTracks( project, 1.0);
728}

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

675{
677}
AUDACITY_DLL_API void DoRemoveTracks(AudacityProject &)

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

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

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

906{
907 auto &project = context.project;
909
911 .PushState(XO("Tracks sorted by name"), XO("Sort by Name"));
912}
void DoSortTracks(AudacityProject &project, int flags)
Definition: TrackMenus.cpp:460

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

897{
898 auto &project = context.project;
900
902 .PushState(XO("Tracks sorted by time"), XO("Sort by Time"));
903}

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

552{
554 EffectManager::Get().GetEffectByIdentifier(wxT("StereoToMono")),
555 context,
557}
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 914 of file TrackMenus.cpp.

915{
916 auto &project = context.project;
917 auto &trackPanel = TrackPanel::Get( project );
918
920 gPrefs->Flush();
921
922 // Toolbar, project sync-lock handled within
924
925 trackPanel.Refresh(false);
926}
BoolSetting SyncLockTracks
Definition: SyncLock.cpp:163
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 1041 of file TrackMenus.cpp.

1042{
1043 auto &project = context.project;
1044 auto &trackPanel = TrackPanel::Get( project );
1045
1046 const auto t = TrackFocus::Get( project ).Get();
1047 if (!t)
1048 return;
1049
1050 auto isAudioActive = ProjectAudioIO::Get( project ).IsAudioActive();
1051
1052 if (isAudioActive)
1053 {
1055 XO("Can't delete track with active audio"));
1056 wxBell();
1057 return;
1058 }
1059
1061
1062 trackPanel.UpdateViewIfNoTracks();
1063 trackPanel.Refresh(false);
1064}
Subclass & Get(const RegisteredFactory &key)
Get reference to an attachment, creating on demand if not present, down-cast it to Subclass.
Definition: ClientData.h:318
bool IsAudioActive() const
static ProjectAudioIO & Get(AudacityProject &project)
static ProjectStatus & Get(AudacityProject &project)
void Set(const TranslatableString &msg, StatusBarField field=MainStatusBarField())
AUDACITY_DLL_API 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 969 of file TrackMenus.cpp.

970{
971 auto &project = context.project;
972 auto &trackPanel = TrackPanel::Get( project );
973
975 const auto track = TrackFocus::Get( project ).Get();
976 if (track) track->TypeSwitch( [&](WaveTrack &wt) {
977 LWSlider *slider = WaveTrackControls::GainSlider( trackPanel, wt );
978 if (slider->ShowDialog())
979 SetTrackGain(project, &wt, slider);
980 });
981}
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:1119
static LWSlider * GainSlider(CellularPanel &panel, const WaveTrack &wt)
void SetTrackGain(AudacityProject &project, WaveTrack *wt, LWSlider *slider)
Definition: TrackMenus.cpp:519

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

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

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

984{
985 auto &project = context.project;
986 auto &trackPanel = TrackPanel::Get( project );
987
988 const auto track = TrackFocus::Get( project ).Get();
989 if (track) track->TypeSwitch( [&](WaveTrack &wt) {
990 LWSlider *slider = WaveTrackControls::GainSlider( trackPanel, wt );
991 slider->Increase(1);
992 SetTrackGain(project, &wt, slider);
993 });
994}
void Increase(float steps)
Definition: ASlider.cpp:1575

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

1010{
1011 auto &project = context.project;
1012 auto &trackPanel = TrackPanel::Get( project );
1013
1014 trackPanel.OnTrackMenu();
1015}

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

1106{
1107 auto &project = context.project;
1108 auto &trackPanel = TrackPanel::Get( project );
1109 auto &tracks = TrackList::Get( project );
1110
1111 const auto focusedTrack = TrackFocus::Get( project ).Get();
1112 if (focusedTrack && tracks.CanMoveDown(*focusedTrack)) {
1114 trackPanel.Refresh(false);
1115 }
1116}
AUDACITY_DLL_API 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 1079 of file TrackMenus.cpp.

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

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

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

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

1067{
1068 auto &project = context.project;
1069 auto &trackPanel = TrackPanel::Get( project );
1070 auto &tracks = TrackList::Get( project );
1071
1072 const auto focusedTrack = TrackFocus::Get( project ).Get();
1073 if (focusedTrack && tracks.CanMoveUp(*focusedTrack)) {
1075 trackPanel.Refresh(false);
1076 }
1077}

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

1018{
1019 auto &project = context.project;
1020
1021 // Use the temporary selection if it is specified, else the track focus
1022 auto track = context.temporarySelection.pTrack;
1023 if (!track)
1024 track = TrackFocus::Get( project ).Get();
1025
1026 if (track) track->TypeSwitch( [&](PlayableTrack &t) {
1028 });
1029}
TemporarySelection temporarySelection
AUDACITY_DLL_API void DoTrackMute(AudacityProject &project, Track &track, bool exclusive)
"exclusive" mute means mute the chosen track and unmute all others.

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

931{
932 auto &project = context.project;
933 auto &trackPanel = TrackPanel::Get( project );
934
935 const auto track = TrackFocus::Get( project ).Get();
936 if (track) track->TypeSwitch( [&](WaveTrack &wt) {
937 LWSlider *slider = WaveTrackControls::PanSlider( trackPanel, wt );
938 if (slider->ShowDialog())
939 SetTrackPan(project, &wt, slider);
940 });
941}
static LWSlider * PanSlider(CellularPanel &panel, const WaveTrack &wt)
void SetTrackPan(AudacityProject &project, WaveTrack *wt, LWSlider *slider)
Definition: TrackMenus.cpp:532

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

944{
945 auto &project = context.project;
946 auto &trackPanel = TrackPanel::Get( project );
947
948 const auto track = TrackFocus::Get( project ).Get();
949 if (track) track->TypeSwitch( [&](WaveTrack &wt) {
950 LWSlider *slider = WaveTrackControls::PanSlider( trackPanel, wt );
951 slider->Decrease(1);
952 SetTrackPan(project, &wt, slider);
953 });
954}

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

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

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

1032{
1033 auto &project = context.project;
1034
1035 const auto track = TrackFocus::Get( project ).Get();
1036 if (track) track->TypeSwitch( [&](PlayableTrack &t) {
1038 });
1039}
AUDACITY_DLL_API void DoTrackSolo(AudacityProject &project, Track &track, 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 703 of file TrackMenus.cpp.

704{
705 MuteTracks(context, false, false);
706}

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

714{
715 MuteTracks(context, false, true);
716}

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

520{
521 wxASSERT(wt);
522 float newValue = slider->Get();
523
524 wt->SetGain(newValue);
525
527 .PushState(XO("Adjusted gain"), XO("Gain"), UndoPush::CONSOLIDATE);
528
530}
float Get(bool convert=true)
Definition: ASlider.cpp:1550
void RefreshTrack(Track *trk, bool refreshbacking=true)
Definition: TrackPanel.cpp:768
void SetGain(float newGain)
Definition: WaveTrack.cpp:829

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

533{
534 wxASSERT(wt);
535 float newValue = slider->Get();
536
537 wt->SetPan(newValue);
538
540 .PushState(XO("Adjusted Pan"), XO("Pan"), UndoPush::CONSOLIDATE);
541
543}
void SetPan(float newPan)
Definition: WaveTrack.cpp:847

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

1123{
1124 // Tracks Menu (formerly Project Menu)
1125 static auto menu = std::shared_ptr{
1126 Menu( wxT("Tracks"), XXO("&Tracks"),
1127 Section( "Add",
1128 Menu( wxT("Add"), XXO("Add &New") )
1129 ),
1130
1132
1133 Section( "",
1134 Menu( wxT("Mix"), XXO("Mi&x"),
1135 // Delayed evaluation
1136 // Stereo to Mono is an oddball command that is also subject to control
1137 // by the plug-in manager, as if an effect. Decide whether to show or
1138 // hide it.
1139 [](AudacityProject&) -> std::unique_ptr<CommandItem> {
1140 const PluginID ID =
1141 EffectManager::Get().GetEffectByIdentifier(wxT("StereoToMono"));
1142 const PluginDescriptor *plug = PluginManager::Get().GetPlugin(ID);
1143 if (plug && plug->IsEnabled())
1144 return Command( wxT("Stereo to Mono"),
1145 XXO("Mix Stereo Down to &Mono"), OnStereoToMono,
1148 else
1149 return {};
1150 },
1151 Command( wxT("MixAndRender"), XXO("Mi&x and Render"),
1154 Command( wxT("MixAndRenderToNewTrack"),
1155 XXO("Mix and Render to Ne&w Track"),
1157 AudioIONotBusyFlag() | WaveTracksSelectedFlag(), wxT("Ctrl+Shift+M") )
1158 ),
1159
1160 Command( wxT("Resample"), XXO("&Resample..."), OnResample,
1162 ),
1163
1164 Section( "",
1165 Command( wxT("RemoveTracks"), XXO("Remo&ve Tracks"), OnRemoveTracks,
1167 ),
1168
1169 Section( "",
1170 Menu( wxT("Mute"), XXO("M&ute/Unmute"),
1171 Command( wxT("MuteAllTracks"), XXO("&Mute All Tracks"),
1172 OnMuteAllTracks, TracksExistFlag(), wxT("Ctrl+U") ),
1173 Command( wxT("UnmuteAllTracks"), XXO("&Unmute All Tracks"),
1174 OnUnmuteAllTracks, TracksExistFlag(), wxT("Ctrl+Shift+U") ),
1175 Command( wxT("MuteTracks"), XXO("Mut&e Tracks"),
1177 Command( wxT("UnmuteTracks"), XXO("U&nmute Tracks"),
1178 OnUnmuteSelectedTracks, EditableTracksSelectedFlag(), wxT("Ctrl+Alt+Shift+U") )
1179 ),
1180
1181 Menu( wxT("Pan"), XXO("&Pan"),
1182 // As Pan changes are not saved on Undo stack,
1183 // pan settings for all tracks
1184 // in the project could very easily be lost unless we
1185 // require the tracks to be selected.
1186 Command( wxT("PanLeft"), XXO("&Left"), OnPanLeft,
1188 Options{}.LongName( XO("Pan Left") ) ),
1189 Command( wxT("PanRight"), XXO("&Right"), OnPanRight,
1191 Options{}.LongName( XO("Pan Right") ) ),
1192 Command( wxT("PanCenter"), XXO("&Center"), OnPanCenter,
1194 Options{}.LongName( XO("Pan Center") ) )
1195 )
1196 ),
1197
1198 Section( "",
1199 Menu( wxT("Align"), XXO("&Align Tracks"), // XO("Just Move Tracks"),
1200 Section( "",
1201 // Mutual alignment of tracks independent of selection or zero
1202 CommandGroup(wxT("Align"),
1203 {
1204 { wxT("EndToEnd"), XXO("&Align End to End") },
1205 { wxT("Together"), XXO("Align &Together") },
1206 },
1208 ),
1209
1210 Section( "",
1211 // Alignment commands using selection or zero
1212 CommandGroup(wxT("Align"),
1213 alignLabels(),
1215 ),
1216
1217 Section( "",
1218 Command( wxT("MoveSelectionWithTracks"),
1219 XXO("&Move Selection with Tracks"),
1222 Options{}.CheckTest( wxT("/GUI/MoveSelectionWithTracks"), false ) )
1223 )
1224 ),
1225
1226 #if 0
1227 // TODO: Can these labels be made clearer?
1228 // Do we need this sub-menu at all?
1229 Menu( wxT("MoveSelectionAndTracks"), XO("Move Sele&ction and Tracks"), {
1230 CommandGroup(wxT("AlignMove"), alignLabels(),
1231 OnAlignMoveSel, AudioIONotBusyFlag() | EditableTracksSelectedFlag()),
1232 } ),
1233 #endif
1234
1236
1237 #ifdef EXPERIMENTAL_SCOREALIGN
1238 Command( wxT("ScoreAlign"), XXO("Synchronize MIDI with Audio"),
1239 OnScoreAlign,
1240 AudioIONotBusyFlag() | NoteTracksSelectedFlag() | WaveTracksSelectedFlag() ),
1241 #endif // EXPERIMENTAL_SCOREALIGN
1242
1244
1245 Menu( wxT("Sort"), XXO("S&ort Tracks"),
1246 Command( wxT("SortByTime"), XXO("By &Start Time"), OnSortTime,
1248 Options{}.LongName( XO("Sort by Time") ) ),
1249 Command( wxT("SortByName"), XXO("By &Name"), OnSortName,
1251 Options{}.LongName( XO("Sort by Name") ) )
1252 )
1253
1255 ),
1256
1257 Section( "",
1258 Command( wxT("SyncLock"), XXO("Keep tracks synchronized (Sync-&Lock)"),
1261 )
1262
1263 ) };
1264 return menu;
1265}
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:730
void OnUnmuteSelectedTracks(const CommandContext &context)
Definition: TrackMenus.cpp:713
void OnResample(const CommandContext &context)
Definition: TrackMenus.cpp:571
void OnMixAndRenderToNewTrack(const CommandContext &context)
Definition: TrackMenus.cpp:565
void OnSortName(const CommandContext &context)
Definition: TrackMenus.cpp:905
void OnPanRight(const CommandContext &context)
Definition: TrackMenus.cpp:724
void OnMixAndRender(const CommandContext &context)
Definition: TrackMenus.cpp:559
void OnMuteAllTracks(const CommandContext &context)
Definition: TrackMenus.cpp:698
void OnUnmuteAllTracks(const CommandContext &context)
Definition: TrackMenus.cpp:703
void OnRemoveTracks(const CommandContext &context)
Definition: TrackMenus.cpp:674
void OnPanLeft(const CommandContext &context)
Definition: TrackMenus.cpp:718
void OnMuteSelectedTracks(const CommandContext &context)
Definition: TrackMenus.cpp:708
void OnMoveSelectionWithTracks(const CommandContext &WXUNUSED(context))
Definition: TrackMenus.cpp:761
void OnSyncLock(const CommandContext &context)
Definition: TrackMenus.cpp:914
void OnAlignNoSync(const CommandContext &context)
Definition: TrackMenus.cpp:736
void OnAlign(const CommandContext &context)
Definition: TrackMenus.cpp:744
void OnStereoToMono(const CommandContext &context)
Definition: TrackMenus.cpp:551
void OnSortTime(const CommandContext &context)
Definition: TrackMenus.cpp:896
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 1267 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 1321 of file TrackMenus.cpp.