Audacity 3.2.0
Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
NoteTrackMenuTable Class Reference
Inheritance diagram for NoteTrackMenuTable:
[legend]
Collaboration diagram for NoteTrackMenuTable:
[legend]

Static Public Member Functions

static NoteTrackMenuTableInstance ()
 
- Static Public Member Functions inherited from PopupMenuTable
static std::unique_ptr< PopupMenuBuildMenu (PopupMenuTable *pTable, void *pUserData=NULL)
 
static void ExtendMenu (PopupMenu &menu, PopupMenuTable &otherTable)
 
template<typename Table , typename Factory >
static auto Adapt (const Factory &factory)
 

Private Member Functions

 NoteTrackMenuTable ()
 
 DECLARE_POPUP_MENU (NoteTrackMenuTable)
 
void InitUserData (void *pUserData) override
 Called before the menu items are appended. More...
 
void OnChangeOctave (wxCommandEvent &)
 Scrolls the note track up or down by an octave. More...
 

Private Attributes

PlayableTrackControls::InitMenuDatampData {}
 

Additional Inherited Members

- Public Types inherited from PopupMenuTable
using Entry = PopupMenuTableEntry
 
- Public Member Functions inherited from PopupMenuTable
 PopupMenuTable (const Identifier &id, const TranslatableString &caption={})
 
const IdentifierId () const
 
const TranslatableStringCaption () const
 
const auto * GetRegistry () const
 
const auto & Get (void *pUserData)
 
void Clear ()
 
- Public Member Functions inherited from PopupMenuHandler
 PopupMenuHandler ()=default
 
 PopupMenuHandler (const PopupMenuHandler &)=delete
 
PopupMenuHandleroperator= (const PopupMenuHandler &)=delete
 
virtual void InitUserData (void *pUserData)=0
 Called before the menu items are appended. More...
 
- Protected Member Functions inherited from PopupMenuTable
virtual void Populate ()=0
 
template<typename Ptr >
void Append (Ptr pItem)
 
void Append (const Identifier &stringId, PopupMenuTableEntry::Type type, int id, const TranslatableString &string, wxCommandEventFunction memFn, const PopupMenuTableEntry::InitFunction &init)
 
void AppendItem (const Identifier &stringId, int id, const TranslatableString &string, wxCommandEventFunction memFn, const PopupMenuTableEntry::InitFunction &init={})
 
void AppendRadioItem (const Identifier &stringId, int id, const TranslatableString &string, wxCommandEventFunction memFn, const PopupMenuTableEntry::InitFunction &init={})
 
void AppendCheckItem (const Identifier &stringId, int id, const TranslatableString &string, wxCommandEventFunction memFn, const PopupMenuTableEntry::InitFunction &init={})
 
void BeginSection (const Identifier &name)
 
void EndSection ()
 
- Static Protected Member Functions inherited from PopupMenuTable
static TranslatableString MakeLabel (const TranslatableString &label, bool useExtra, const TranslatableString &extra)
 
- Protected Attributes inherited from PopupMenuTable
std::shared_ptr< PopupSubMenumTop
 
std::vector< PopupMenuGroupItem * > mStack
 
Identifier mId
 
TranslatableString mCaption
 
std::unique_ptr< PopupMenuGroupItemmRegistry
 

Detailed Description

Definition at line 73 of file NoteTrackControls.cpp.

Constructor & Destructor Documentation

◆ NoteTrackMenuTable()

NoteTrackMenuTable::NoteTrackMenuTable ( )
inlineprivate

Definition at line 75 of file NoteTrackControls.cpp.

76 : PopupMenuTable{ "NoteTrack" }
77 {}

Member Function Documentation

◆ DECLARE_POPUP_MENU()

NoteTrackMenuTable::DECLARE_POPUP_MENU ( NoteTrackMenuTable  )
private

◆ InitUserData()

void NoteTrackMenuTable::InitUserData ( void *  pUserData)
inlineoverrideprivatevirtual

Called before the menu items are appended.

Store context data, if needed. May be called more than once before the menu opens. Pointer remains valid for the duration of any callback, if PopupMenuTable::BuildMenu() is called and the result's Popup() is called before any other menus are built.

Implements PopupMenuHandler.

Definition at line 84 of file NoteTrackControls.cpp.

85 {
86 mpData = static_cast<PlayableTrackControls::InitMenuData*>(pUserData);
87 }
PlayableTrackControls::InitMenuData * mpData

References mpData.

◆ Instance()

NoteTrackMenuTable & NoteTrackMenuTable::Instance ( )
static

Definition at line 94 of file NoteTrackControls.cpp.

95{
96 static NoteTrackMenuTable instance;
97 return instance;
98}

Referenced by NoteTrackControls::GetMenuExtension().

Here is the caller graph for this function:

◆ OnChangeOctave()

void NoteTrackMenuTable::OnChangeOctave ( wxCommandEvent &  event)
private

Scrolls the note track up or down by an octave.

Definition at line 106 of file NoteTrackControls.cpp.

107{
108 auto &track = static_cast<NoteTrack&>(mpData->track);
109
110 wxASSERT(event.GetId() == OnUpOctaveID
111 || event.GetId() == OnDownOctaveID);
112
113 const bool bDown = (OnDownOctaveID == event.GetId());
114 NoteTrackRange::Get(track).ShiftNoteRange((bDown) ? -12 : 12);
115
118 .ModifyState(false);
120}
@ OnUpOctaveID
@ OnDownOctaveID
const auto project
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:90
A Track that is used for Midi notes. (Somewhat old code).
Definition: NoteTrack.h:78
static NoteTrackRange & Get(const NoteTrack &track)
Allow mutative access to attached data of a const track.
void ShiftNoteRange(int offset)
Shifts all notes vertically by the given pitch.
void ModifyState(bool bWantsAutoSave)
static ProjectHistory & Get(AudacityProject &project)

References ProjectHistory::Get(), NoteTrackRange::Get(), ProjectHistory::ModifyState(), mpData, OnDownOctaveID, OnUpOctaveID, project, CommonTrackControls::InitMenuData::project, RefreshCode::RefreshAll, CommonTrackControls::InitMenuData::result, NoteTrackRange::ShiftNoteRange(), and CommonTrackControls::InitMenuData::track.

Here is the call graph for this function:

Member Data Documentation

◆ mpData

PlayableTrackControls::InitMenuData* NoteTrackMenuTable::mpData {}
private

Definition at line 89 of file NoteTrackControls.cpp.

Referenced by InitUserData(), and OnChangeOctave().


The documentation for this class was generated from the following file: