Audacity
3.2.0
src
menus
TimelineMenus.cpp
Go to the documentation of this file.
1
/* SPDX-License-Identifier: GPL-2.0-or-later */
2
/*!********************************************************************
3
4
Audacity: A Digital Audio Editor
5
6
TimelineMenus.cpp
7
8
Dmitry Vedenko
9
10
*/
11
#include "../AdornedRulerPanel.h"
12
13
#include "
Project.h
"
14
15
#include "
CommandManager.h
"
16
#include "
CommandContext.h
"
17
18
namespace
19
{
20
void
SetTimeDisplayMode
(
const
CommandContext
& context,
TimeDisplayMode
type)
21
{
22
auto
&
project
= context.
project
;
23
24
auto
&
ruler
=
AdornedRulerPanel::Get
(
project
);
25
ruler
.SetTimeDisplayMode(type);
26
27
CommandManager::Get
(
project
).
UpdateCheckmarks
();
28
}
29
30
void
OnSetMinutesSeconds
(
const
CommandContext
& context)
31
{
32
SetTimeDisplayMode
(context,
TimeDisplayMode::MinutesAndSeconds
);
33
}
34
35
void
OnSetBeatsAndMeasures
(
const
CommandContext
& context)
36
{
37
SetTimeDisplayMode
(context,
TimeDisplayMode::BeatsAndMeasures
);
38
}
39
40
TimeDisplayMode
GetTimeDisplayMode
(
const
AudacityProject
&
project
)
41
{
42
auto
& panel =
AdornedRulerPanel::Get
(
project
);
43
return
panel.GetTimeDisplayMode();
44
}
45
46
using namespace
MenuRegistry
;
47
48
auto
ExtraSelectionMenu
()
49
{
50
static
auto
menu = std::shared_ptr{
Menu
(
51
wxT
(
"Timeline"
),
XXO
(
"Tim&eline"
),
52
Command
(
53
wxT
(
"MinutesAndSeconds"
),
XXO
(
"Minutes and Seconds"
),
54
OnSetMinutesSeconds
,
AlwaysEnabledFlag
,
55
Options
{}.
CheckTest
(
56
[](
const
AudacityProject
&
project
) {
57
return
GetTimeDisplayMode
(
project
) ==
58
TimeDisplayMode::MinutesAndSeconds
;
59
})),
60
Command
(
61
wxT
(
"BeatsAndMeasures"
),
XXO
(
"Beats and Measures"
),
62
OnSetBeatsAndMeasures
,
AlwaysEnabledFlag
,
63
Options
{}.
CheckTest
(
64
[](
const
AudacityProject
&
project
) {
65
return
GetTimeDisplayMode
(
project
) ==
66
TimeDisplayMode::BeatsAndMeasures
;
67
}))) };
68
return
menu;
69
}
70
71
AttachedItem
sAttachment2
{
Indirect
(
ExtraSelectionMenu
()),
72
wxT
(
"View/Other/Toolbars"
) };
73
74
}
// namespace
wxT
wxT("CloseDown"))
sAttachment2
AttachedItem sAttachment2
Definition:
BatchProcessDialog.cpp:1602
CommandContext.h
AlwaysEnabledFlag
constexpr CommandFlag AlwaysEnabledFlag
Definition:
CommandFlag.h:34
CommandManager.h
XXO
XXO("&Cut/Copy/Paste Toolbar")
Project.h
project
const auto project
Definition:
TestWaveTrackMaker.cpp:18
TimeDisplayMode
TimeDisplayMode
Definition:
TimeDisplayMode.h:19
TimeDisplayMode::BeatsAndMeasures
@ BeatsAndMeasures
TimeDisplayMode::MinutesAndSeconds
@ MinutesAndSeconds
AdornedRulerPanel::Get
static AdornedRulerPanel & Get(AudacityProject &project)
Definition:
AdornedRulerPanel.cpp:1265
AudacityProject
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
CommandContext provides additional information to an 'Apply()' command. It provides the project,...
Definition:
CommandContext.h:37
CommandContext::project
AudacityProject & project
Definition:
CommandContext.h:71
CommandManager::Get
static CommandManager & Get(AudacityProject &project)
Definition:
CommandManager.cpp:110
CommandManager::UpdateCheckmarks
void UpdateCheckmarks()
Definition:
CommandManager.cpp:339
Registry::RegisteredItem
Generates classes whose instances register items at construction.
Definition:
Registry.h:388
MenuRegistry
Definition:
MenuRegistry.cpp:19
MenuRegistry::Command
constexpr auto Command
Definition:
MenuRegistry.h:456
MenuRegistry::Menu
constexpr auto Menu
Items will appear in a main toolbar menu or in a sub-menu.
Definition:
MenuRegistry.h:445
Registry::Indirect
std::unique_ptr< detail::IndirectItem< Item > > Indirect(const std::shared_ptr< Item > &ptr)
A convenience function.
Definition:
Registry.h:175
anonymous_namespace{TimeTrackVRulerControls.cpp}::ruler
Ruler & ruler()
Definition:
TimeTrackVRulerControls.cpp:43
anonymous_namespace{TimelineMenus.cpp}::OnSetBeatsAndMeasures
void OnSetBeatsAndMeasures(const CommandContext &context)
Definition:
TimelineMenus.cpp:35
anonymous_namespace{TimelineMenus.cpp}::GetTimeDisplayMode
TimeDisplayMode GetTimeDisplayMode(const AudacityProject &project)
Definition:
TimelineMenus.cpp:40
anonymous_namespace{TimelineMenus.cpp}::SetTimeDisplayMode
void SetTimeDisplayMode(const CommandContext &context, TimeDisplayMode type)
Definition:
TimelineMenus.cpp:20
anonymous_namespace{TimelineMenus.cpp}::ExtraSelectionMenu
auto ExtraSelectionMenu()
Definition:
TimelineMenus.cpp:48
anonymous_namespace{TimelineMenus.cpp}::OnSetMinutesSeconds
void OnSetMinutesSeconds(const CommandContext &context)
Definition:
TimelineMenus.cpp:30
MenuRegistry::Options
Definition:
MenuRegistry.h:37
MenuRegistry::Options::CheckTest
Options && CheckTest(const CheckFn &fn) &&
Definition:
MenuRegistry.h:74
Generated by
1.9.3