Audacity
3.2.0
src
menus
ExtraMenus.cpp
Go to the documentation of this file.
1
#include "../CommonCommandFlags.h"
2
#include "../Menus.h"
3
#include "
Prefs.h
"
4
#include "
Project.h
"
5
#include "
ProjectWindows.h
"
6
#include "../commands/CommandContext.h"
7
#include "../commands/CommandManager.h"
8
#include "../toolbars/ToolManager.h"
9
10
#include <wx/frame.h>
11
12
// helper functions and classes
13
namespace
{
14
15
// Menu handler functions
16
17
void
OnFullScreen
(
const
CommandContext
&context)
18
{
19
auto
&
project
= context.
project
;
20
auto
&window =
GetProjectFrame
(
project
);
21
22
bool
bChecked = !window.wxTopLevelWindow::IsFullScreen();
23
window.wxTopLevelWindow::ShowFullScreen(bChecked);
24
25
ToolManager::Get
(
project
).
ModifyToolbarMenus
(
project
);
26
}
27
28
// Menu definitions
29
30
using namespace
MenuTable
;
31
32
BaseItemSharedPtr
ExtraMenu
()
33
{
34
static
const
auto
pred =
35
[]{
return
gPrefs
->
ReadBool
(
wxT
(
"/GUI/ShowExtraMenus"
),
false
); };
36
static
auto
menu = std::shared_ptr{
37
ConditionalItems
(
"Optional"
, pred,
38
Menu
(
"Extra"
,
XXO
(
"Ext&ra"
),
39
Section
(
"Part1"
),
40
Section
(
"Part2"
))
41
)
42
};
43
return
menu;
44
}
45
46
AttachedItem
sAttachment1
{
47
wxT
(
""
),
48
Indirect
(
ExtraMenu
())
49
};
50
51
// Under /MenuBar/Optional/Extra/Part2
52
BaseItemSharedPtr
ExtraMiscItems
()
53
{
54
using
Options
=
CommandManager::Options
;
55
56
// Not a menu.
57
static
BaseItemSharedPtr
items{
58
Items
(
wxT
(
"Misc"
),
59
// Delayed evaluation
60
[](
AudacityProject
&
project
) {
61
62
static
const
auto
key
=
63
#ifdef __WXMAC__
64
wxT
(
"Ctrl+/"
)
65
#else
66
wxT
(
"F11"
)
67
#endif
68
;
69
70
return
(
71
// Accel key is not bindable.
72
Command
(
wxT
(
"FullScreenOnOff"
),
XXO
(
"Enable &Full Screen"
),
73
OnFullScreen
,
74
AlwaysEnabledFlag
,
75
Options
{
key
}.CheckTest( [](
const
AudacityProject
&
project
) {
76
return
GetProjectFrame
(
project
)
77
.wxTopLevelWindow::IsFullScreen(); } ) )
78
);
79
}
80
) };
81
return
items;
82
}
83
84
AttachedItem
sAttachment2
{
85
Placement
{
wxT
(
"Optional/Extra/Part2"
), { OrderingHint::End } },
86
Indirect
(
ExtraMiscItems
())
87
};
88
89
}
wxT
wxT("CloseDown"))
sAttachment1
AttachedItem sAttachment1
Definition:
BatchProcessDialog.cpp:1575
sAttachment2
AttachedItem sAttachment2
Definition:
BatchProcessDialog.cpp:1590
AlwaysEnabledFlag
constexpr CommandFlag AlwaysEnabledFlag
Definition:
CommandFlag.h:34
key
static const AudacityProject::AttachedObjects::RegisteredFactory key
Definition:
CommandManager.cpp:200
XXO
XXO("&Cut/Copy/Paste Toolbar")
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:34
CommandContext::project
AudacityProject & project
Definition:
CommandContext.h:64
ToolManager::Get
static ToolManager & Get(AudacityProject &project)
Definition:
ToolManager.cpp:339
ToolManager::ModifyToolbarMenus
static void ModifyToolbarMenus(AudacityProject &project)
Definition:
ToolManager.cpp:1542
audacity::BasicSettings::ReadBool
bool ReadBool(const wxString &key, bool defaultValue) const
Definition:
BasicSettings.cpp:80
MenuTable
Definition:
CommandManager.h:423
MenuTable::Section
constexpr auto Section
Definition:
CommandManager.h:658
MenuTable::Menu
constexpr auto Menu
Items will appear in a main toolbar menu or in a sub-menu.
Definition:
CommandManager.h:667
MenuTable::Items
constexpr auto Items
Definition:
CommandManager.h:649
MenuTable::Command
constexpr auto Command
Definition:
CommandManager.h:678
MenuTable::ConditionalItems
constexpr auto ConditionalItems
Definition:
CommandManager.h:676
Registry::Indirect
std::unique_ptr< detail::IndirectItem< Item > > Indirect(const std::shared_ptr< Item > &ptr)
A convenience function.
Definition:
Registry.h:113
Registry::BaseItemSharedPtr
std::shared_ptr< BaseItem > BaseItemSharedPtr
Definition:
Registry.h:78
anonymous_namespace{AdornedRulerPanel.cpp}::Options
CommandManager::Options Options
Definition:
AdornedRulerPanel.cpp:2919
anonymous_namespace{ExtraMenus.cpp}::OnFullScreen
void OnFullScreen(const CommandContext &context)
Definition:
ExtraMenus.cpp:17
anonymous_namespace{ExtraMenus.cpp}::ExtraMenu
BaseItemSharedPtr ExtraMenu()
Definition:
ExtraMenus.cpp:32
anonymous_namespace{ExtraMenus.cpp}::ExtraMiscItems
BaseItemSharedPtr ExtraMiscItems()
Definition:
ExtraMenus.cpp:52
MenuTable::AttachedItem
Definition:
CommandManager.h:696
Registry::Placement
Definition:
Registry.h:234
Generated by
1.9.3