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

Static Public Member Functions

static TrackMenuTableInstance ()
 
- 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

 TrackMenuTable ()
 
 DECLARE_POPUP_MENU (TrackMenuTable)
 
void OnSetName (wxCommandEvent &)
 
void OnMoveTrack (wxCommandEvent &event)
 
void InitUserData (void *pUserData) override
 Called before the menu items are appended. More...
 
void UpdatePrefs () override
 
- Private Member Functions inherited from PrefsListener
 PrefsListener ()
 
virtual ~PrefsListener ()
 
virtual void UpdatePrefs ()=0
 
virtual void UpdateSelectedPrefs (int id)
 

Private Attributes

CommonTrackControls::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
 
- Static Private Member Functions inherited from PrefsListener
static void Broadcast (int id=0)
 Call this static function to notify all PrefsListener objects. More...
 

Detailed Description

Definition at line 78 of file CommonTrackControls.cpp.

Constructor & Destructor Documentation

◆ TrackMenuTable()

TrackMenuTable::TrackMenuTable ( )
inlineprivate

Definition at line 82 of file CommonTrackControls.cpp.

83 : PopupMenuTable{ "Track" }
84 {}

Member Function Documentation

◆ DECLARE_POPUP_MENU()

TrackMenuTable::DECLARE_POPUP_MENU ( TrackMenuTable  )
private

◆ InitUserData()

void TrackMenuTable::InitUserData ( void *  pUserData)
overrideprivatevirtual

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 111 of file CommonTrackControls.cpp.

112{
113 mpData = static_cast<CommonTrackControls::InitMenuData*>(pUserData);
114}
CommonTrackControls::InitMenuData * mpData

References mpData.

◆ Instance()

TrackMenuTable & TrackMenuTable::Instance ( )
static

Definition at line 105 of file CommonTrackControls.cpp.

106{
107 static TrackMenuTable instance;
108 return instance;
109}

Referenced by CommonTrackControls::DoContextMenu().

Here is the caller graph for this function:

◆ OnMoveTrack()

void TrackMenuTable::OnMoveTrack ( wxCommandEvent &  event)
private

Definition at line 240 of file CommonTrackControls.cpp.

241{
244 switch (event.GetId()) {
245 default:
246 wxASSERT(false);
247 case OnMoveUpID:
248 choice = TrackUtilities::OnMoveUpID; break;
249 case OnMoveDownID:
250 choice = TrackUtilities::OnMoveDownID; break;
251 case OnMoveTopID:
252 choice = TrackUtilities::OnMoveTopID; break;
253 case OnMoveBottomID:
254 choice = TrackUtilities::OnMoveBottomID; break;
255 }
256
258
259 // MoveTrack already refreshed TrackPanel, which means repaint will happen.
260 // This is a harmless redundancy:
262}
@ OnMoveBottomID
@ OnMoveDownID
@ OnMoveTopID
@ OnMoveUpID
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
AUDACITY_DLL_API void DoMoveTrack(AudacityProject &project, Track &target, MoveChoice choice)
Move a track up, down, to top or to bottom.

References TrackUtilities::DoMoveTrack(), mpData, OnMoveBottomID, TrackUtilities::OnMoveBottomID, OnMoveDownID, TrackUtilities::OnMoveDownID, OnMoveTopID, TrackUtilities::OnMoveTopID, OnMoveUpID, TrackUtilities::OnMoveUpID, project, CommonTrackControls::InitMenuData::project, RefreshCode::RefreshAll, CommonTrackControls::InitMenuData::result, and CommonTrackControls::InitMenuData::track.

Here is the call graph for this function:

◆ OnSetName()

void TrackMenuTable::OnSetName ( wxCommandEvent &  )
private

Definition at line 216 of file CommonTrackControls.cpp.

217{
218 auto &track = mpData->track;
219 AudacityProject *const proj = &mpData->project;
220 const wxString oldName = track.GetName();
221
223 Command.mName = oldName;
224 // Bug 1837 : We need an OK/Cancel result if we are to enter a blank string.
225 bool bResult = Command.PromptUser(*proj);
226 if (bResult)
227 {
228 wxString newName = Command.mName;
229 track.SetName(newName);
230
231 ProjectHistory::Get( *proj )
232 .PushState(
233 XO("Renamed '%s' to '%s'").Format( oldName, newName ),
234 XO("Name Change"));
235
237 }
238}
XO("Cut/Copy/Paste")
Abstract base class used in importing a file.
void PushState(const TranslatableString &desc, const TranslatableString &shortDesc)
static ProjectHistory & Get(AudacityProject &project)
constexpr auto Command
Definition: MenuRegistry.h:456

References MenuRegistry::Command, ProjectHistory::Get(), mpData, CommonTrackControls::InitMenuData::project, ProjectHistory::PushState(), RefreshCode::RefreshAll, CommonTrackControls::InitMenuData::result, CommonTrackControls::InitMenuData::track, and XO().

Here is the call graph for this function:

◆ UpdatePrefs()

void TrackMenuTable::UpdatePrefs ( )
inlineoverrideprivatevirtual

Implements PrefsListener.

Definition at line 98 of file CommonTrackControls.cpp.

99 {
100 // Because labels depend on keyboard preferences
102 }

References PopupMenuTable::Clear().

Here is the call graph for this function:

Member Data Documentation

◆ mpData

CommonTrackControls::InitMenuData* TrackMenuTable::mpData {}
private

Definition at line 96 of file CommonTrackControls.cpp.

Referenced by InitUserData(), OnMoveTrack(), and OnSetName().


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