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

52{
53 mpData = static_cast<CommonTrackControls::InitMenuData*>(pUserData);
54}
CommonTrackControls::InitMenuData * mpData

References mpData.

◆ Instance()

TimeTrackMenuTable & TimeTrackMenuTable::Instance ( )
static

Definition at line 45 of file TimeTrackControls.cpp.

46{
47 static TimeTrackMenuTable instance;
48 return instance;
49}

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

Here is the caller graph for this function:

◆ OnSetTimeTrackRange()

void TimeTrackMenuTable::OnSetTimeTrackRange ( wxCommandEvent &  )
private

Definition at line 56 of file TimeTrackControls.cpp.

57{
58 auto &track = static_cast<TimeTrack&>(mpData->track);
59 long lower = (long)(track.GetRangeLower() * 100.0 + 0.5);
60 long upper = (long)(track.GetRangeUpper() * 100.0 + 0.5);
61
62 // MB: these lower/upper limits match the maximum allowed range of the time track
63 // envelope, but this is not strictly required
64
65 wxDialogWrapper dlg(mpData->pParent, wxID_ANY, XO("Change Speed Limits"));
66 dlg.SetName();
68 wxSpinCtrl *scLower;
69 wxSpinCtrl *scUpper;
70
71 S.StartVerticalLay(true);
72 {
73 S.StartStatic(XO("Change speed limit (%) to:"),1);
74 {
75 S.StartMultiColumn(2, wxEXPAND);
76 {
77
78 S.SetStretchyCol(1);
79
80 S.AddPrompt(XXO("Lower Speed Limit"));
81 scLower = safenew wxSpinCtrl(S.GetParent(), wxID_ANY,
82 wxT(""),
83 wxDefaultPosition,
84 wxDefaultSize,
85 wxSP_ARROW_KEYS,
87 S
88 .Name(XO("Lower Speed Limit"))
89 .Position( wxALIGN_LEFT | wxALL )
90 .AddWindow(scLower);
91
92 S.AddPrompt(XXO("Upper Speed Limit"));
93 scUpper = safenew wxSpinCtrl(S.GetParent(), wxID_ANY,
94 wxT(""),
95 wxDefaultPosition,
96 wxDefaultSize,
97 wxSP_ARROW_KEYS,
99 S
100 .Name(XO("Upper Speed Limit"))
101 .Position( wxALIGN_LEFT | wxALL )
102 .AddWindow(scUpper);
103
104 }
105 S.EndMultiColumn();
106 }
107 S.EndStatic();
108 S.AddStandardButtons();
109 }
110 S.EndVerticalLay();
111
112 dlg.Layout();
113 dlg.Fit();
114 dlg.CenterOnParent();
115 if (dlg.ShowModal() == wxID_CANCEL)
116 return;
117
118 while(scLower->GetValue() >= scUpper->GetValue()) {
120 XO("Upper Speed Limit must be greater than the Lower Speed Limit"),
121 XO("Invalid Limits"),
122 wxOK | wxICON_ERROR,
123 mpData->pParent);
124
125 if (dlg.ShowModal() == wxID_CANCEL)
126 return;
127 }
128
129 lower = scLower->GetValue();
130 upper = scUpper->GetValue();
131
132 if (lower >= TimeTrackControls::kRangeMin &&
135 track.SetRangeLower((double)lower / 100.0);
136 track.SetRangeUpper((double)upper / 100.0);
138 .PushState(XO("Set range to '%ld' - '%ld'").Format( lower, upper ),
139 /* i18n-hint: (verb)*/
140 XO("Set Range"));
142 }
143}
wxT("CloseDown"))
int AudacityMessageBox(const TranslatableString &message, const TranslatableString &caption, long style, wxWindow *parent, int x, int y)
XO("Cut/Copy/Paste")
XXO("&Cut/Copy/Paste Toolbar")
#define safenew
Definition: MemoryX.h:10
@ eIsCreating
Definition: ShuttleGui.h:37
const auto project
#define S(N)
Definition: ToChars.cpp:64
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)
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:640
static const int kRangeMin
static const int kRangeMax
A kind of Track used to 'warp time'.
Definition: TimeTrack.h:24

References AudacityMessageBox(), eIsCreating, ProjectHistory::Get(), TimeTrackControls::kRangeMax, TimeTrackControls::kRangeMin, mpData, CommonTrackControls::InitMenuData::pParent, project, CommonTrackControls::InitMenuData::project, ProjectHistory::PushState(), RefreshCode::RefreshAll, CommonTrackControls::InitMenuData::result, S, safenew, wxDialogWrapper::SetName(), CommonTrackControls::InitMenuData::track, wxT(), XO(), and XXO().

Here is the call graph for this function:

◆ OnTimeTrackLin()

void TimeTrackMenuTable::OnTimeTrackLin ( wxCommandEvent &  )
private

Definition at line 145 of file TimeTrackControls.cpp.

146{
147 auto &track = static_cast<TimeTrack&>(mpData->track);
148 track.SetDisplayLog(false);
151 .PushState(XO("Set time track display to linear"), XO("Set Display"));
152
153 using namespace RefreshCode;
155}
void SetDisplayLog(bool displayLog)
Definition: TimeTrack.h:96
Namespace containing an enum 'what to do on a refresh?'.
Definition: RefreshCode.h:16

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

Here is the call graph for this function:

◆ OnTimeTrackLog()

void TimeTrackMenuTable::OnTimeTrackLog ( wxCommandEvent &  )
private

Definition at line 157 of file TimeTrackControls.cpp.

158{
159 auto &track = static_cast<TimeTrack&>(mpData->track);
160 track.SetDisplayLog(true);
163 .PushState(XO("Set time track display to logarithmic"), XO("Set Display"));
164
165 using namespace RefreshCode;
167}

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

Here is the call graph for this function:

◆ OnTimeTrackLogInt()

void TimeTrackMenuTable::OnTimeTrackLogInt ( wxCommandEvent &  )
private

Definition at line 169 of file TimeTrackControls.cpp.

170{
171 auto &track = static_cast<TimeTrack&>(mpData->track);
173 if (track.GetInterpolateLog()) {
174 track.SetInterpolateLog(false);
176 .PushState(XO("Set time track interpolation to linear"), XO("Set Interpolation"));
177 }
178 else {
179 track.SetInterpolateLog(true);
180 ProjectHistory::Get( *project ).
181 PushState(XO("Set time track interpolation to logarithmic"), XO("Set Interpolation"));
182 }
184}

References ProjectHistory::Get(), mpData, project, CommonTrackControls::InitMenuData::project, ProjectHistory::PushState(), RefreshCode::RefreshAll, CommonTrackControls::InitMenuData::result, CommonTrackControls::InitMenuData::track, 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: