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

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 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
 
- 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 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 }

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) {
78  AudacityProject *const project = &mpData->project;
79  pTrack->SetRangeLower((double)lower / 100.0);
80  pTrack->SetRangeUpper((double)upper / 100.0);
81  ProjectHistory::Get( *project )
82  .PushState(XO("Set range to '%ld' - '%ld'").Format( lower, upper ),
83  /* i18n-hint: (verb)*/
84  XO("Set Range"));
86  }
87  }
88 }

References _, ProjectHistory::Get(), TimeTrack::GetRangeLower(), TimeTrack::GetRangeUpper(), TimeTrackControls::kRangeMax, TimeTrackControls::kRangeMin, mpData, 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);
94  AudacityProject *const project = &mpData->project;
95  ProjectHistory::Get( *project )
96  .PushState(XO("Set time track display to linear"), XO("Set Display"));
97 
98  using namespace RefreshCode;
100 }

References ProjectHistory::Get(), mpData, 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);
106  AudacityProject *const project = &mpData->project;
107  ProjectHistory::Get( *project )
108  .PushState(XO("Set time track display to logarithmic"), XO("Set Display"));
109 
110  using namespace RefreshCode;
112 }

References ProjectHistory::Get(), mpData, 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);
117  AudacityProject *const project = &mpData->project;
118  if (pTrack->GetInterpolateLog()) {
119  pTrack->SetInterpolateLog(false);
120  ProjectHistory::Get( *project )
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 }

References ProjectHistory::Get(), TimeTrack::GetInterpolateLog(), mpData, 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:
TimeTrack::GetRangeLower
double GetRangeLower() const
Definition: TimeTrack.cpp:116
TimeTrackMenuTable::mpData
CommonTrackControls::InitMenuData * mpData
Definition: TimeTrackControls.h:54
RefreshCode::RefreshAll
@ RefreshAll
Definition: RefreshCode.h:26
PopupMenuTable
Definition: PopupMenuTable.h:115
TimeTrack::GetRangeUpper
double GetRangeUpper() const
Definition: TimeTrack.cpp:121
Format
Abstract base class used in importing a file.
XO
#define XO(s)
Definition: Internat.h:31
CommonTrackControls::InitMenuData::result
unsigned result
Definition: CommonTrackControls.h:39
CommonTrackControls::InitMenuData::project
AudacityProject & project
Definition: CommonTrackControls.h:36
TimeTrack::GetInterpolateLog
bool GetInterpolateLog() const
Definition: TimeTrack.cpp:233
TimeTrack::SetDisplayLog
void SetDisplayLog(bool displayLog)
Definition: TimeTrack.h:95
TimeTrackMenuTable
Definition: TimeTrackControls.h:40
TimeTrackControls::kRangeMax
static const int kRangeMax
Definition: TimeTrackControls.h:34
RefreshCode::UpdateVRuler
@ UpdateVRuler
Definition: RefreshCode.h:30
CommonTrackControls::InitMenuData
Definition: CommonTrackControls.h:34
ProjectHistory::PushState
void PushState(const TranslatableString &desc, const TranslatableString &shortDesc)
Definition: ProjectHistory.cpp:90
_
#define _(s)
Definition: Internat.h:75
AudacityProject
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:92
TimeTrack::SetInterpolateLog
void SetInterpolateLog(bool interpolateLog)
Definition: TimeTrack.cpp:238
TimeTrack::SetRangeLower
void SetRangeLower(double lower)
Definition: TimeTrack.cpp:126
RefreshCode
Namespace containing an enum 'what to do on a refresh?'.
Definition: RefreshCode.h:16
CommonTrackControls::InitMenuData::pTrack
Track * pTrack
Definition: CommonTrackControls.h:37
TimeTrack::SetRangeUpper
void SetRangeUpper(double upper)
Definition: TimeTrack.cpp:131
TimeTrack
A kind of Track used to 'warp time'.
Definition: TimeTrack.h:24
ProjectHistory::Get
static ProjectHistory & Get(AudacityProject &project)
Definition: ProjectHistory.cpp:26
TimeTrackControls::kRangeMin
static const int kRangeMin
Definition: TimeTrackControls.h:33