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

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 >
static Registry::BaseItemPtr Computed (const std::function< Registry::BaseItemPtr(Table &) > &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

NoteTrackControlsBase::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 Registry::GroupItemGetRegistry () const
const std::shared_ptr< Registry::GroupItem > & Get (void *pUserData)
void Clear ()
- Public Member Functions inherited from PopupMenuHandler
 PopupMenuHandler ()=default
 PopupMenuHandler (const PopupMenuHandler &)=delete
PopupMenuHandleroperator= (const PopupMenuHandler &)=delete
- Protected Member Functions inherited from PopupMenuTable
virtual void Populate ()=0
void Append (Registry::BaseItemPtr 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< Registry::GroupItemmTop
std::vector< Registry::GroupItem * > mStack
Identifier mId
TranslatableString mCaption
std::unique_ptr< Registry::GroupItemmRegistry

Detailed Description

Definition at line 79 of file NoteTrackControls.cpp.

Constructor & Destructor Documentation

◆ NoteTrackMenuTable()

NoteTrackMenuTable::NoteTrackMenuTable ( )

Definition at line 81 of file NoteTrackControls.cpp.

82  : PopupMenuTable{ "NoteTrack" }
83  {}

Member Function Documentation


NoteTrackMenuTable::DECLARE_POPUP_MENU ( NoteTrackMenuTable  )

◆ InitUserData()

void NoteTrackMenuTable::InitUserData ( void *  pUserData)

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 90 of file NoteTrackControls.cpp.

91  {
92  mpData = static_cast<NoteTrackControlsBase::InitMenuData*>(pUserData);
93  }

References mpData.

◆ Instance()

NoteTrackMenuTable & NoteTrackMenuTable::Instance ( )

Definition at line 100 of file NoteTrackControls.cpp.

101 {
102  static NoteTrackMenuTable instance;
103  return instance;
104 }

Referenced by NoteTrackControls::GetMenuExtension().

Here is the caller graph for this function:

◆ OnChangeOctave()

void NoteTrackMenuTable::OnChangeOctave ( wxCommandEvent &  event)

Scrolls the note track up or down by an octave.

Definition at line 112 of file NoteTrackControls.cpp.

113 {
114  NoteTrack *const pTrack = static_cast<NoteTrack*>(mpData->pTrack);
116  wxASSERT(event.GetId() == OnUpOctaveID
117  || event.GetId() == OnDownOctaveID);
119  const bool bDown = (OnDownOctaveID == event.GetId());
120  pTrack->ShiftNoteRange((bDown) ? -12 : 12);
122  AudacityProject *const project = &mpData->project;
123  ProjectHistory::Get( *project )
124  .ModifyState(false);
126 }

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

Here is the call graph for this function:

Member Data Documentation

◆ mpData

NoteTrackControlsBase::InitMenuData* NoteTrackMenuTable::mpData {}

Definition at line 95 of file NoteTrackControls.cpp.

Referenced by InitUserData(), and OnChangeOctave().

The documentation for this class was generated from the following file:
void ModifyState(bool bWantsAutoSave)
Definition: ProjectHistory.cpp:124
@ RefreshAll
Definition: RefreshCode.h:26
void ShiftNoteRange(int offset)
Shifts all notes vertically by the given pitch.
Definition: NoteTrack.cpp:1027
Definition: PopupMenuTable.h:115
Definition: NoteTrackControls.cpp:80
unsigned result
Definition: CommonTrackControls.h:39
@ OnUpOctaveID
Definition: NoteTrackControls.cpp:107
AudacityProject & project
Definition: CommonTrackControls.h:36
Definition: CommonTrackControls.h:34
NoteTrackControlsBase::InitMenuData * mpData
Definition: NoteTrackControls.cpp:95
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:92
Track * pTrack
Definition: CommonTrackControls.h:37
@ OnDownOctaveID
Definition: NoteTrackControls.cpp:108
static ProjectHistory & Get(AudacityProject &project)
Definition: ProjectHistory.cpp:26
A Track that is used for Midi notes. (Somewhat old code).
Definition: NoteTrack.h:67