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
// Table of menu factories.
35
static
BaseItemSharedPtr
extraItems{
Items
( wxEmptyString,
36
Section
(
"Part1"
),
37
Section
(
"Part2"
)
38
) };
39
40
static
const
auto
pred =
41
[]{
return
gPrefs
->ReadBool(
wxT
(
"/GUI/ShowExtraMenus"
),
false
); };
42
static
BaseItemSharedPtr
menu{
43
ConditionalItems
(
wxT
(
"Optional"
),
44
pred,
Menu
(
wxT
(
"Extra"
),
XXO
(
"Ext&ra"
), extraItems ) )
45
};
46
return
menu;
47
}
48
49
AttachedItem
sAttachment1
{
50
wxT
(
""
),
51
Shared
(
ExtraMenu
() )
52
};
53
54
// Under /MenuBar/Optional/Extra/Part2
55
BaseItemSharedPtr
ExtraMiscItems
()
56
{
57
using
Options
=
CommandManager::Options
;
58
59
// Not a menu.
60
static
BaseItemSharedPtr
items{
61
Items
(
wxT
(
"Misc"
),
62
// Delayed evaluation
63
[](
AudacityProject
&project ) {
64
65
static
const
auto
key
=
66
#ifdef __WXMAC__
67
wxT
(
"Ctrl+/"
)
68
#else
69
wxT
(
"F11"
)
70
#endif
71
;
72
73
return
(
74
// Accel key is not bindable.
75
Command
(
wxT
(
"FullScreenOnOff"
),
XXO
(
"&Full Screen (on/off)"
),
76
OnFullScreen
,
77
AlwaysEnabledFlag
,
78
Options
{
key
}.CheckTest( [](
const
AudacityProject
&project ) {
79
return
GetProjectFrame
( project )
80
.wxTopLevelWindow::IsFullScreen(); } ) )
81
);
82
}
83
) };
84
return
items;
85
}
86
87
AttachedItem
sAttachment2
{
88
Placement
{
wxT
(
"Optional/Extra/Part2"
), { OrderingHint::End } },
89
Shared
(
ExtraMiscItems
() )
90
};
91
92
}
wxT
wxT("CloseDown"))
sAttachment1
AttachedItem sAttachment1
Definition:
BatchProcessDialog.cpp:1578
sAttachment2
AttachedItem sAttachment2
Definition:
BatchProcessDialog.cpp:1593
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
FileConfig * gPrefs
Definition:
Prefs.cpp:70
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
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:1558
MenuTable
Definition:
CommandManager.h:418
MenuTable::Menu
std::unique_ptr< MenuItem > Menu(const Identifier &internalName, const TranslatableString &title, Args &&... args)
Definition:
CommandManager.h:659
MenuTable::Section
std::unique_ptr< MenuPart > Section(const Identifier &internalName, Args &&... args)
Definition:
CommandManager.h:647
MenuTable::ConditionalItems
std::unique_ptr< ConditionalGroupItem > ConditionalItems(const Identifier &internalName, ConditionalGroupItem::Condition condition, Args &&... args)
Definition:
CommandManager.h:675
MenuTable::Items
std::unique_ptr< MenuItems > Items(const Identifier &internalName, Args &&... args)
Definition:
CommandManager.h:636
MenuTable::Command
std::unique_ptr< CommandItem > Command(const CommandID &name, const TranslatableString &label_in, void(Handler::*pmf)(const CommandContext &), CommandFlag flags, const CommandManager::Options &options={}, CommandHandlerFinder finder=FinderScope::DefaultFinder())
Definition:
CommandManager.h:714
PluginSettings::Shared
@ Shared
Definition:
PluginInterface.h:56
Registry::BaseItemSharedPtr
std::shared_ptr< BaseItem > BaseItemSharedPtr
Definition:
Registry.h:72
anonymous_namespace{AdornedRulerPanel.cpp}::Options
CommandManager::Options Options
Definition:
AdornedRulerPanel.cpp:2894
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:55
MenuTable::AttachedItem
Definition:
CommandManager.h:779
Registry::Placement
Definition:
Registry.h:219
Generated by
1.9.3