Audacity 3.2.0
Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
TimeTrackMenuTable Class Reference

#include <TimeTrackControls.h>

Inheritance diagram for TimeTrackMenuTable:
[legend]
Collaboration diagram for TimeTrackMenuTable:
[legend]

Static Public Member Functions

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

Protected Member Functions

void InitUserData (void *pUserData) override
 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 ()
 

Private Member Functions

 TimeTrackMenuTable ()
 
 DECLARE_POPUP_MENU (TimeTrackMenuTable)
 
void OnSetTimeTrackRange (wxCommandEvent &)
 
void OnTimeTrackLin (wxCommandEvent &)
 
void OnTimeTrackLog (wxCommandEvent &)
 
void OnTimeTrackLogInt (wxCommandEvent &)
 

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...
 
- 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 39 of file TimeTrackControls.h.

Constructor & Destructor Documentation

◆ TimeTrackMenuTable()

TimeTrackMenuTable::TimeTrackMenuTable ( )
inlineprivate

Definition at line 41 of file TimeTrackControls.h.

42 : PopupMenuTable{ "TimeTrack" }
43 {}

Member Function Documentation

◆ DECLARE_POPUP_MENU()

TimeTrackMenuTable::DECLARE_POPUP_MENU ( TimeTrackMenuTable  )
private

◆ InitUserData()

void TimeTrackMenuTable::InitUserData ( void *  pUserData)
overrideprotectedvirtual

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 47 of file TimeTrackControls.cpp.

48{
49 mpData = static_cast<CommonTrackControls::InitMenuData*>(pUserData);
50}
CommonTrackControls::InitMenuData * mpData

References mpData.

◆ Instance()

TimeTrackMenuTable & TimeTrackMenuTable::Instance ( )
static

Definition at line 41 of file TimeTrackControls.cpp.

42{
43 static TimeTrackMenuTable instance;
44 return instance;
45}

Referenced by TimeTrackControls::GetMenuExtension(), and TimeTrackVZoomHandle::Release().

Here is the caller graph for this function:

◆ OnSetTimeTrackRange()

void TimeTrackMenuTable::OnSetTimeTrackRange ( wxCommandEvent &  )
private

Definition at line 52 of file TimeTrackControls.cpp.

53{
54 TimeTrack *const pTrack = static_cast<TimeTrack*>(mpData->pTrack);
55 if (pTrack) {
56 long lower = (long)(pTrack->GetRangeLower() * 100.0 + 0.5);
57 long upper = (long)(pTrack->GetRangeUpper() * 100.0 + 0.5);
58
59 // MB: these lower/upper limits match the maximum allowed range of the time track
60 // envelope, but this is not strictly required
61 lower = wxGetNumberFromUser(_("Change lower speed limit (%) to:"),
62 _("Lower speed limit"),
63 _("Lower speed limit"),
64 lower,
67
68 upper = wxGetNumberFromUser(_("Change upper speed limit (%) to:"),
69 _("Upper speed limit"),
70 _("Upper speed limit"),
71 upper,
72 lower + 1,
74
75 if (lower >= TimeTrackControls::kRangeMin &&
77 lower < upper) {
79 pTrack->SetRangeLower((double)lower / 100.0);
80 pTrack->SetRangeUpper((double)upper / 100.0);
82 .PushState(XO("Set range to '%ld' - '%ld'").Format( lower, upper ),
83 /* i18n-hint: (verb)*/
84 XO("Set Range"));
86 }
87 }
88}
XO("Cut/Copy/Paste")
#define _(s)
Definition: Internat.h:73
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
Abstract base class used in importing a file.
void PushState(const TranslatableString &desc, const TranslatableString &shortDesc)
static ProjectHistory & Get(AudacityProject &project)
static const int kRangeMin
static const int kRangeMax
A kind of Track used to 'warp time'.
Definition: TimeTrack.h:24
void SetRangeLower(double lower)
Definition: TimeTrack.cpp:122
double GetRangeLower() const
Definition: TimeTrack.cpp:112
double GetRangeUpper() const
Definition: TimeTrack.cpp:117
void SetRangeUpper(double upper)
Definition: TimeTrack.cpp:127

References _, ProjectHistory::Get(), TimeTrack::GetRangeLower(), TimeTrack::GetRangeUpper(), TimeTrackControls::kRangeMax, TimeTrackControls::kRangeMin, mpData, project, CommonTrackControls::InitMenuData::project, CommonTrackControls::InitMenuData::pTrack, ProjectHistory::PushState(), RefreshCode::RefreshAll, CommonTrackControls::InitMenuData::result, TimeTrack::SetRangeLower(), TimeTrack::SetRangeUpper(), and XO().

Here is the call graph for this function:

◆ OnTimeTrackLin()

void TimeTrackMenuTable::OnTimeTrackLin ( wxCommandEvent &  )
private

Definition at line 90 of file TimeTrackControls.cpp.

91{
92 TimeTrack *const pTrack = static_cast<TimeTrack*>(mpData->pTrack);
93 pTrack->SetDisplayLog(false);
96 .PushState(XO("Set time track display to linear"), XO("Set Display"));
97
98 using namespace RefreshCode;
100}
void SetDisplayLog(bool displayLog)
Definition: TimeTrack.h:95
Namespace containing an enum 'what to do on a refresh?'.
Definition: RefreshCode.h:16

References ProjectHistory::Get(), mpData, project, CommonTrackControls::InitMenuData::project, CommonTrackControls::InitMenuData::pTrack, ProjectHistory::PushState(), RefreshCode::RefreshAll, CommonTrackControls::InitMenuData::result, TimeTrack::SetDisplayLog(), RefreshCode::UpdateVRuler, and XO().

Here is the call graph for this function:

◆ OnTimeTrackLog()

void TimeTrackMenuTable::OnTimeTrackLog ( wxCommandEvent &  )
private

Definition at line 102 of file TimeTrackControls.cpp.

103{
104 TimeTrack *const pTrack = static_cast<TimeTrack*>(mpData->pTrack);
105 pTrack->SetDisplayLog(true);
108 .PushState(XO("Set time track display to logarithmic"), XO("Set Display"));
109
110 using namespace RefreshCode;
112}

References ProjectHistory::Get(), mpData, project, CommonTrackControls::InitMenuData::project, CommonTrackControls::InitMenuData::pTrack, ProjectHistory::PushState(), RefreshCode::RefreshAll, CommonTrackControls::InitMenuData::result, TimeTrack::SetDisplayLog(), RefreshCode::UpdateVRuler, and XO().

Here is the call graph for this function:

◆ OnTimeTrackLogInt()

void TimeTrackMenuTable::OnTimeTrackLogInt ( wxCommandEvent &  )
private

Definition at line 114 of file TimeTrackControls.cpp.

115{
116 TimeTrack *const pTrack = static_cast<TimeTrack*>(mpData->pTrack);
118 if (pTrack->GetInterpolateLog()) {
119 pTrack->SetInterpolateLog(false);
121 .PushState(XO("Set time track interpolation to linear"), XO("Set Interpolation"));
122 }
123 else {
124 pTrack->SetInterpolateLog(true);
125 ProjectHistory::Get( *project ).
126 PushState(XO("Set time track interpolation to logarithmic"), XO("Set Interpolation"));
127 }
129}
void SetInterpolateLog(bool interpolateLog)
Definition: TimeTrack.cpp:250
bool GetInterpolateLog() const
Definition: TimeTrack.cpp:245

References ProjectHistory::Get(), TimeTrack::GetInterpolateLog(), mpData, project, CommonTrackControls::InitMenuData::project, CommonTrackControls::InitMenuData::pTrack, ProjectHistory::PushState(), RefreshCode::RefreshAll, CommonTrackControls::InitMenuData::result, TimeTrack::SetInterpolateLog(), and XO().

Here is the call graph for this function:

Member Data Documentation

◆ mpData

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

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