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

Functions

void OnNewWaveTrack (const CommandContext &context)
 
void OnNewStereoTrack (const CommandContext &context)
 

Variables

AttachedItem sAttachment
 

Function Documentation

◆ OnNewStereoTrack()

void anonymous_namespace{WaveTrackMenuItems.cpp}::OnNewStereoTrack ( const CommandContext context)

Definition at line 51 of file WaveTrackMenuItems.cpp.

52{
53 auto &project = context.project;
54 auto &tracks = TrackList::Get( project );
55 auto &trackFactory = WaveTrackFactory::Get( project );
56
57 auto defaultFormat = QualitySettings::SampleFormatChoice();
58 auto rate = ProjectRate::Get(project).GetRate();
59
61
62 tracks.Add(trackFactory.Create(2, defaultFormat, rate));
63 auto &newTrack = **tracks.rbegin();
64 newTrack.SetSelected(true);
65 newTrack.SetName(tracks.MakeUniqueTrackName(WaveTrack::GetDefaultAudioTrackNamePreference()));
66
68 .PushState(XO("Created new stereo audio track"), XO("New Track"));
69
70 TrackFocus::Get(project).Set(&newTrack);
72}
XO("Cut/Copy/Paste")
const auto tracks
const auto project
AudacityProject & project
void PushState(const TranslatableString &desc, const TranslatableString &shortDesc)
static ProjectHistory & Get(AudacityProject &project)
static ProjectRate & Get(AudacityProject &project)
Definition: ProjectRate.cpp:28
double GetRate() const
Definition: ProjectRate.cpp:53
Track * Get()
Definition: TrackFocus.cpp:156
static TrackList & Get(AudacityProject &project)
Definition: Track.cpp:314
void ShowTrack(const Track &track)
Definition: Viewport.cpp:460
static Viewport & Get(AudacityProject &project)
Definition: Viewport.cpp:33
static WaveTrackFactory & Get(AudacityProject &project)
Definition: WaveTrack.cpp:3376
static wxString GetDefaultAudioTrackNamePreference()
Definition: WaveTrack.cpp:373
PROJECT_RATE_API sampleFormat SampleFormatChoice()
void SelectNone(AudacityProject &project)

References TrackFocus::Get(), ProjectHistory::Get(), ProjectRate::Get(), TrackList::Get(), Viewport::Get(), WaveTrackFactory::Get(), WaveTrack::GetDefaultAudioTrackNamePreference(), ProjectRate::GetRate(), CommandContext::project, project, ProjectHistory::PushState(), QualitySettings::SampleFormatChoice(), SelectUtilities::SelectNone(), Viewport::ShowTrack(), tracks, and XO().

Here is the call graph for this function:

◆ OnNewWaveTrack()

void anonymous_namespace{WaveTrackMenuItems.cpp}::OnNewWaveTrack ( const CommandContext context)

Definition at line 27 of file WaveTrackMenuItems.cpp.

28{
29 auto &project = context.project;
30 auto &tracks = TrackList::Get( project );
31 auto &trackFactory = WaveTrackFactory::Get( project );
32
33 auto defaultFormat = QualitySettings::SampleFormatChoice();
34
35 auto rate = ProjectRate::Get(project).GetRate();
36
37 auto track = trackFactory.Create(defaultFormat, rate);
38 track->SetName(tracks.MakeUniqueTrackName(WaveTrack::GetDefaultAudioTrackNamePreference()));
39 tracks.Add(track);
41
42 track->SetSelected(true);
43
45 .PushState(XO("Created new audio track"), XO("New Track"));
46
47 TrackFocus::Get(project).Set(track.get());
49}

References TrackFocus::Get(), ProjectHistory::Get(), ProjectRate::Get(), TrackList::Get(), Viewport::Get(), WaveTrackFactory::Get(), WaveTrack::GetDefaultAudioTrackNamePreference(), ProjectRate::GetRate(), CommandContext::project, project, ProjectHistory::PushState(), QualitySettings::SampleFormatChoice(), SelectUtilities::SelectNone(), Viewport::ShowTrack(), tracks, and XO().

Here is the call graph for this function:

Variable Documentation

◆ sAttachment

AttachedItem anonymous_namespace{WaveTrackMenuItems.cpp}::sAttachment
Initial value:
{
Items( "",
Command( wxT("NewMonoTrack"), XXO("&Mono Track"), OnNewWaveTrack,
AudioIONotBusyFlag(), wxT("Ctrl+Shift+N") ),
Command( wxT("NewStereoTrack"), XXO("&Stereo Track"),
),
wxT("Tracks/Add/Add")
}
wxT("CloseDown"))
const ReservedCommandFlag & AudioIONotBusyFlag()
XXO("&Cut/Copy/Paste Toolbar")
constexpr auto Items
Definition: MenuRegistry.h:427
constexpr auto Command
Definition: MenuRegistry.h:456
void OnNewWaveTrack(const CommandContext &context)
void OnNewStereoTrack(const CommandContext &context)

Definition at line 74 of file WaveTrackMenuItems.cpp.