Audacity
3.2.0
src
menus
ExtraMenus.cpp
Go to the documentation of this file.
1
#include "../CommonCommandFlags.h"
2
#include "
Prefs.h
"
3
#include "
Project.h
"
4
#include "
ProjectWindows.h
"
5
#include "
CommandContext.h
"
6
#include "../toolbars/ToolManager.h"
7
8
#include <wx/frame.h>
9
10
// helper functions and classes
11
namespace
{
12
13
// Menu handler functions
14
15
void
OnFullScreen
(
const
CommandContext
&context)
16
{
17
auto
&
project
= context.
project
;
18
auto
&window =
GetProjectFrame
(
project
);
19
20
bool
bChecked = !window.wxTopLevelWindow::IsFullScreen();
21
window.wxTopLevelWindow::ShowFullScreen(bChecked);
22
23
ToolManager::Get
(
project
).
ModifyToolbarMenus
(
project
);
24
}
25
26
// Menu definitions
27
28
using namespace
MenuRegistry
;
29
30
auto
ExtraMenu
()
31
{
32
static
const
auto
pred =
33
[]{
return
gPrefs
->
ReadBool
(
wxT
(
"/GUI/ShowExtraMenus"
),
false
); };
34
static
auto
menu = std::shared_ptr{
35
ConditionalItems
(
"Optional"
, pred,
36
Menu
(
"Extra"
,
XXO
(
"Ext&ra"
),
37
Section
(
"Part1"
),
38
Section
(
"Part2"
))
39
)
40
};
41
return
menu;
42
}
43
44
AttachedItem
sAttachment1
{
Indirect
(
ExtraMenu
()) };
45
46
// Under /MenuBar/Optional/Extra/Part2
47
auto
ExtraMiscItems
()
48
{
49
// Not a menu.
50
static
auto
items = std::shared_ptr{
51
Items
(
wxT
(
"Misc"
),
52
// Delayed evaluation
53
[](
AudacityProject
&) {
54
55
static
const
auto
key
=
56
#ifdef __WXMAC__
57
wxT
(
"Ctrl+/"
)
58
#else
59
wxT
(
"F11"
)
60
#endif
61
;
62
63
return
(
64
// Accel key is not bindable.
65
Command
(
wxT
(
"FullScreenOnOff"
),
XXO
(
"Enable &Full Screen"
),
66
OnFullScreen
,
67
AlwaysEnabledFlag
,
68
Options
{
key
}.CheckTest( [](
const
AudacityProject
&
project
) {
69
return
GetProjectFrame
(
project
)
70
.wxTopLevelWindow::IsFullScreen(); } ) )
71
);
72
}
73
) };
74
return
items;
75
}
76
77
AttachedItem
sAttachment2
{
Indirect
(
ExtraMiscItems
()),
78
Placement
{
wxT
(
"Optional/Extra/Part2"
), { OrderingHint::End } }
79
};
80
81
}
wxT
wxT("CloseDown"))
sAttachment1
AttachedItem sAttachment1
Definition:
BatchProcessDialog.cpp:1590
sAttachment2
AttachedItem sAttachment2
Definition:
BatchProcessDialog.cpp:1602
CommandContext.h
AlwaysEnabledFlag
constexpr CommandFlag AlwaysEnabledFlag
Definition:
CommandFlag.h:34
XXO
XXO("&Cut/Copy/Paste Toolbar")
key
static const AudacityProject::AttachedObjects::RegisteredFactory key
Definition:
NavigationMenus.cpp:547
gPrefs
audacity::BasicSettings * gPrefs
Definition:
Prefs.cpp:68
Prefs.h
Project.h
GetProjectFrame
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 ...
Definition:
ProjectWindows.cpp:71
ProjectWindows.h
accessors for certain important windows associated with each project
project
const auto project
Definition:
TestWaveTrackMaker.cpp:18
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
Registry::RegisteredItem
Generates classes whose instances register items at construction.
Definition:
Registry.h:388
ToolManager::Get
static ToolManager & Get(AudacityProject &project)
Definition:
ToolManager.cpp:339
ToolManager::ModifyToolbarMenus
static void ModifyToolbarMenus(AudacityProject &project)
Definition:
ToolManager.cpp:1541
audacity::BasicSettings::ReadBool
bool ReadBool(const wxString &key, bool defaultValue) const
Definition:
BasicSettings.cpp:80
MenuRegistry
Definition:
MenuRegistry.cpp:19
MenuRegistry::Section
constexpr auto Section
Definition:
MenuRegistry.h:436
MenuRegistry::Items
constexpr auto Items
Definition:
MenuRegistry.h:427
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
MenuRegistry::ConditionalItems
constexpr auto ConditionalItems
Definition:
MenuRegistry.h:454
Registry::Indirect
std::unique_ptr< detail::IndirectItem< Item > > Indirect(const std::shared_ptr< Item > &ptr)
A convenience function.
Definition:
Registry.h:175
anonymous_namespace{ExtraMenus.cpp}::ExtraMenu
auto ExtraMenu()
Definition:
ExtraMenus.cpp:30
anonymous_namespace{ExtraMenus.cpp}::OnFullScreen
void OnFullScreen(const CommandContext &context)
Definition:
ExtraMenus.cpp:15
anonymous_namespace{ExtraMenus.cpp}::ExtraMiscItems
auto ExtraMiscItems()
Definition:
ExtraMenus.cpp:47
MenuRegistry::Options
Definition:
MenuRegistry.h:37
Registry::Placement
Definition:
Registry.h:303
Generated by
1.9.3