Audacity
3.2.0
modules
etc
mod-null
ModNullCallback.cpp
Go to the documentation of this file.
1
/**********************************************************************
2
3
Audacity: A Digital Audio Editor
4
5
ModNullCallback.cpp
6
7
James Crook
8
9
Audacity is free software.
10
This file is licensed under the wxWidgets license, see License.txt
11
12
********************************************************************/
/*****************************************************************/
/********************************************************************/
27
28
#include <wx/wx.h>
29
#include "
ModNullCallback.h
"
30
#include "
ModuleConstants.h
"
31
#include "
ShuttleGui.h
"
32
#include "
Project.h
"
33
#include "
MenuRegistry.h
"
34
#include "
CommonCommandFlags.h
"
35
36
/*
37
//#define ModuleDispatchName "ModuleDispatch"
38
See the example in this file. It has several cases/options in it.
39
*/
40
41
// derived from wxFrame as it needs to be some kind of event handler.
42
class
ModNullCallback
:
public
wxFrame
43
{
44
public
:
45
// Name these OnFuncXXX functions by whatever they will do.
46
void
OnFuncFirst
(
const
CommandContext
&);
47
void
OnFuncSecond
(
const
CommandContext
&);
48
};
49
50
void
ModNullCallback::OnFuncFirst
(
const
CommandContext
&)
51
{
52
int
k=32;
53
}
54
55
void
ModNullCallback::OnFuncSecond
(
const
CommandContext
&)
56
{
57
int
k=42;
58
}
59
ModNullCallback
*
pModNullCallback
=NULL;
60
61
#define ModNullFN(X) (&ModNullCallback:: X)
62
63
extern
"C"
{
64
65
static
CommandHandlerObject
&
ident
(
AudacityProject
&
project
)
66
{
67
// no specific command handler object ... use the project.
68
return
project
;
69
}
70
71
DEFINE_VERSION_CHECK
72
73
namespace
{
74
void
RegisterMenuItems
()
75
{
76
// Get here only after the module version check passes
77
using namespace
MenuRegistry
;
78
// We add two new commands into the Analyze menu.
79
static
AttachedItem
sAttachment
{
wxT
(
"Analyze"
),
80
(
FinderScope
(
ident
),
Section
(
wxT
(
"NullModule"
),
81
Command
(
82
_T(
"A New Command"
),
// internal name
83
XXO
(
"1st Experimental Command..."
),
//displayed name
84
ModNullFN
( OnFuncFirst ),
85
AudioIONotBusyFlag
() ),
86
Command
(
87
_T(
"Another New Command"
),
88
XXO
(
"2nd Experimental Command"
),
89
ModNullFN
( OnFuncSecond ),
90
AudioIONotBusyFlag
() )
91
) )
92
};
93
}
94
}
95
96
// This is the function that connects us to Audacity.
97
extern
int
DLL_API
ModuleDispatch
(
ModuleDispatchTypes
type);
98
int
ModuleDispatch
(
ModuleDispatchTypes
type)
99
{
100
switch
(type)
101
{
102
case
ModuleInitialize
:
103
RegisterMenuItems
();
104
break
;
105
case
AppInitialized
:
106
break
;
107
case
AppQuiting
:
108
break
;
109
default
:
110
break
;
111
}
112
113
return
1;
114
}
115
116
//Example code commented out.
117
#if 0
118
// This is an example function to hijack the main panel
119
int
DLL_API
MainPanelFunc(
int
ix)
120
{
121
ix=ix;
//compiler food
122
// If we wanted to hide Audacity's Project,
123
// we'd create a new wxFrame right here and return a pointer to it
124
// as our return result.
125
126
// Don't hijack the main panel, just return a NULL;
127
return
NULL;
128
}
129
#endif
130
131
}
// End extern "C"
wxT
wxT("CloseDown"))
CommandHandlerObject
wxEvtHandler CommandHandlerObject
Definition:
CommandFunctors.h:32
AudioIONotBusyFlag
const ReservedCommandFlag & AudioIONotBusyFlag()
Definition:
CommonCommandFlags.cpp:118
CommonCommandFlags.h
XXO
XXO("&Cut/Copy/Paste Toolbar")
MenuRegistry.h
ModuleDispatch
int DLL_API ModuleDispatch(ModuleDispatchTypes type)
Definition:
ModNullCallback.cpp:98
ModNullFN
#define ModNullFN(X)
Definition:
ModNullCallback.cpp:61
ident
static CommandHandlerObject & ident(AudacityProject &project)
Definition:
ModNullCallback.cpp:65
pModNullCallback
ModNullCallback * pModNullCallback
Definition:
ModNullCallback.cpp:59
ModNullCallback.h
ModuleConstants.h
DLL_API
#define DLL_API
Definition:
ModuleConstants.h:22
ModuleDispatchTypes
ModuleDispatchTypes
Definition:
ModuleConstants.h:27
AppInitialized
@ AppInitialized
Definition:
ModuleConstants.h:30
ModuleInitialize
@ ModuleInitialize
Definition:
ModuleConstants.h:28
AppQuiting
@ AppQuiting
Definition:
ModuleConstants.h:31
Project.h
ShuttleGui.h
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
MenuRegistry::FinderScope
Definition:
MenuRegistry.h:266
ModNullCallback
ModNullCallback is a class containing all the callback functions for this demonstartion module....
Definition:
ModNullCallback.cpp:43
ModNullCallback::OnFuncFirst
void OnFuncFirst(const CommandContext &)
Definition:
ModNullCallback.cpp:50
ModNullCallback::OnFuncSecond
void OnFuncSecond(const CommandContext &)
Definition:
ModNullCallback.cpp:55
Registry::RegisteredItem
Generates classes whose instances register items at construction.
Definition:
Registry.h:388
DEFINE_VERSION_CHECK
Definition:
ModNullCallback.cpp:73
DEFINE_VERSION_CHECK::RegisterMenuItems
void RegisterMenuItems()
Definition:
ModNullCallback.cpp:74
MenuRegistry
Definition:
MenuRegistry.cpp:19
MenuRegistry::Section
constexpr auto Section
Definition:
MenuRegistry.h:436
MenuRegistry::Command
constexpr auto Command
Definition:
MenuRegistry.h:456
anonymous_namespace{AdornedRulerPanel.cpp}::sAttachment
AttachedItem sAttachment
Definition:
AdornedRulerPanel.cpp:2856
Generated by
1.9.3