Audacity 3.2.0
TimeTrackMenuItems.cpp
Go to the documentation of this file.
1/**********************************************************************
2
3Audacity: A Digital Audio Editor
4
5@file TimeTrackMenuItems.cpp
6@brief Injects menu items using TimeTrack but not the views of it
7
8Paul Licameli split from TrackMenus.cpp
9
10**********************************************************************/
11
12#include "CommonCommandFlags.h"
13#include "CommandContext.h"
14#include "ProjectHistory.h"
15
16#include "SelectUtilities.h"
17#include "TimeTrack.h"
18#include "TrackFocus.h"
19#include "Viewport.h"
20#include "CommandContext.h"
21#include "MenuRegistry.h"
22#include "AudacityMessageBox.h"
23
24namespace {
25using namespace MenuRegistry;
26
27void OnNewTimeTrack(const CommandContext &context)
28{
29 auto &project = context.project;
30 auto &tracks = TrackList::Get( project );
31
32 auto t = tracks.AddToHead(std::make_shared<TimeTrack>());
33
35
36 t->SetSelected(true);
37
39 .PushState(XO("Created new time track"), XO("New Track"));
40
43}
44
46{
48 [](const AudacityProject &project){
49 return TrackList::Get(project).Any<const TimeTrack>().empty();
50 }
51 };
52 return flag;
53}
54
56 Command( wxT("NewTimeTrack"), XXO("&Time Track"),
58 ),
59 wxT("Tracks/Add/Add")
60};
61
62}
wxT("CloseDown"))
const ReservedCommandFlag & AudioIONotBusyFlag()
XO("Cut/Copy/Paste")
XXO("&Cut/Copy/Paste Toolbar")
const auto tracks
const auto project
static std::once_flag flag
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:90
CommandContext provides additional information to an 'Apply()' command. It provides the project,...
AudacityProject & project
void PushState(const TranslatableString &desc, const TranslatableString &shortDesc)
static ProjectHistory & Get(AudacityProject &project)
Generates classes whose instances register items at construction.
Definition: Registry.h:388
A kind of Track used to 'warp time'.
Definition: TimeTrack.h:24
Track * Get()
Definition: TrackFocus.cpp:156
auto Any() -> TrackIterRange< TrackType >
Definition: Track.h:950
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
constexpr auto Command
Definition: MenuRegistry.h:456
void SelectNone(AudacityProject &project)
const ReservedCommandFlag & TimeTrackDoesNotExistFlag()
void OnNewTimeTrack(const CommandContext &context)