Audacity  2.2.2
Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
TimeTrackMenuTable Class Reference
Inheritance diagram for TimeTrackMenuTable:
PopupMenuTable TranslatableArray< std::vector< PopupMenuTableEntry > >

Static Public Member Functions

static TimeTrackMenuTableInstance ()
 
- Static Public Member Functions inherited from PopupMenuTable
static std::unique_ptr< MenuBuildMenu (wxEvtHandler *pParent, PopupMenuTable *pTable, void *pUserData=NULL)
 

Private Member Functions

 TimeTrackMenuTable ()
 
 DECLARE_POPUP_MENU (TimeTrackMenuTable)
 
void InitMenu (Menu *pMenu, void *pUserData) override
 
void DestroyMenu () override
 
void OnSetTimeTrackRange (wxCommandEvent &)
 
void OnTimeTrackLin (wxCommandEvent &)
 
void OnTimeTrackLog (wxCommandEvent &)
 
void OnTimeTrackLogInt (wxCommandEvent &)
 

Private Attributes

TrackControls::InitMenuDatampData
 

Additional Inherited Members

- Public Types inherited from PopupMenuTable
typedef PopupMenuTableEntry Entry
 
- Public Member Functions inherited from TranslatableArray< std::vector< PopupMenuTableEntry > >
 TranslatableArray ()
 
const std::vector
< PopupMenuTableEntry > & 
Get ()
 
- Protected Member Functions inherited from TranslatableArray< std::vector< PopupMenuTableEntry > >
virtual void Populate ()=0
 
void Invalidate (wxCommandEvent &evt)
 
- Protected Attributes inherited from TranslatableArray< std::vector< PopupMenuTableEntry > >
std::vector< PopupMenuTableEntrymContents
 

Detailed Description

Definition at line 39 of file TimeTrackControls.cpp.

Constructor & Destructor Documentation

TimeTrackMenuTable::TimeTrackMenuTable ( )
inlineprivate

Definition at line 41 of file TimeTrackControls.cpp.

41 : mpData(NULL) {}
TrackControls::InitMenuData * mpData

Member Function Documentation

TimeTrackMenuTable::DECLARE_POPUP_MENU ( TimeTrackMenuTable  )
private
void TimeTrackMenuTable::DestroyMenu ( )
inlineoverrideprivatevirtual

Implements PopupMenuTable.

Definition at line 60 of file TimeTrackControls.cpp.

References mpData.

61  {
62  mpData = nullptr;
63  }
TrackControls::InitMenuData * mpData
void TimeTrackMenuTable::InitMenu ( Menu pMenu,
void *  pUserData 
)
inlineoverrideprivatevirtual

Implements PopupMenuTable.

Definition at line 48 of file TimeTrackControls.cpp.

References TimeTrack::GetDisplayLog(), TimeTrack::GetInterpolateLog(), mpData, OnTimeTrackLinID, OnTimeTrackLogID, OnTimeTrackLogIntID, and TrackControls::InitMenuData::pTrack.

49  {
50  mpData = static_cast<TrackControls::InitMenuData*>(pUserData);
51  TimeTrack *const pTrack = static_cast<TimeTrack*>(mpData->pTrack);
52 
53  pMenu->Check(OnTimeTrackLogIntID, pTrack->GetInterpolateLog());
54 
55  auto isLog = pTrack->GetDisplayLog();
56  pMenu->Check(OnTimeTrackLinID, !isLog);
57  pMenu->Check(OnTimeTrackLogID, isLog);
58  }
bool GetDisplayLog() const
Definition: TimeTrack.h:133
bool GetInterpolateLog() const
Definition: TimeTrack.cpp:145
A kind of Track used to 'warp time'.
Definition: TimeTrack.h:29
TrackControls::InitMenuData * mpData
TimeTrackMenuTable & TimeTrackMenuTable::Instance ( )
static

Definition at line 73 of file TimeTrackControls.cpp.

Referenced by TimeTrackControls::GetMenuExtension().

74 {
75  static TimeTrackMenuTable instance;
76  return instance;
77 }
void TimeTrackMenuTable::OnSetTimeTrackRange ( wxCommandEvent &  )
private

Definition at line 79 of file TimeTrackControls.cpp.

References _(), GetActiveProject(), TimeTrack::GetRangeLower(), TimeTrack::GetRangeUpper(), mpData, TrackControls::InitMenuData::pTrack, AudacityProject::PushState(), RefreshCode::RefreshAll, TrackControls::InitMenuData::result, TimeTrack::SetRangeLower(), and TimeTrack::SetRangeUpper().

80 {
81  TimeTrack *const pTrack = static_cast<TimeTrack*>(mpData->pTrack);
82  if (pTrack) {
83  long lower = (long)(pTrack->GetRangeLower() * 100.0 + 0.5);
84  long upper = (long)(pTrack->GetRangeUpper() * 100.0 + 0.5);
85 
86  // MB: these lower/upper limits match the maximum allowed range of the time track
87  // envelope, but this is not strictly required
88  lower = wxGetNumberFromUser(_("Change lower speed limit (%) to:"),
89  _("Lower speed limit"),
90  _("Lower speed limit"),
91  lower,
92  10,
93  1000);
94 
95  upper = wxGetNumberFromUser(_("Change upper speed limit (%) to:"),
96  _("Upper speed limit"),
97  _("Upper speed limit"),
98  upper,
99  lower + 1,
100  1000);
101 
102  if (lower >= 10 && upper <= 1000 && lower < upper) {
103  AudacityProject *const project = ::GetActiveProject();
104  pTrack->SetRangeLower((double)lower / 100.0);
105  pTrack->SetRangeUpper((double)upper / 100.0);
106  project->PushState(wxString::Format(_("Set range to '%ld' - '%ld'"),
107  lower,
108  upper),
109  /* i18n-hint: (verb)*/
110  _("Set Range"));
112  }
113  }
114 }
void SetRangeUpper(double upper)
Definition: TimeTrack.h:131
double GetRangeLower() const
Definition: TimeTrack.h:127
AudacityProject provides the main window, with tools and tracks contained within it.
Definition: Project.h:176
A kind of Track used to 'warp time'.
Definition: TimeTrack.h:29
double GetRangeUpper() const
Definition: TimeTrack.h:128
TrackControls::InitMenuData * mpData
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom")).Raw()), OnMoveTrack)#define SET_TRACK_NAME_PLUGIN_SYMBOLclass SetTrackNameCommand:public AudacityCommand
void PushState(const wxString &desc, const wxString &shortDesc)
Definition: Project.cpp:4702
AUDACITY_DLL_API AudacityProject * GetActiveProject()
Definition: Project.cpp:308
void SetRangeLower(double lower)
Definition: TimeTrack.h:130
void TimeTrackMenuTable::OnTimeTrackLin ( wxCommandEvent &  )
private

Definition at line 116 of file TimeTrackControls.cpp.

References _(), GetActiveProject(), mpData, TrackControls::InitMenuData::pTrack, AudacityProject::PushState(), RefreshCode::RefreshAll, TrackControls::InitMenuData::result, TimeTrack::SetDisplayLog(), and RefreshCode::UpdateVRuler.

117 {
118  TimeTrack *const pTrack = static_cast<TimeTrack*>(mpData->pTrack);
119  pTrack->SetDisplayLog(false);
120  AudacityProject *const project = ::GetActiveProject();
121  project->PushState(_("Set time track display to linear"), _("Set Display"));
122 
123  using namespace RefreshCode;
125 }
void SetDisplayLog(bool displayLog)
Definition: TimeTrack.h:134
AudacityProject provides the main window, with tools and tracks contained within it.
Definition: Project.h:176
A kind of Track used to 'warp time'.
Definition: TimeTrack.h:29
TrackControls::InitMenuData * mpData
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom")).Raw()), OnMoveTrack)#define SET_TRACK_NAME_PLUGIN_SYMBOLclass SetTrackNameCommand:public AudacityCommand
void PushState(const wxString &desc, const wxString &shortDesc)
Definition: Project.cpp:4702
AUDACITY_DLL_API AudacityProject * GetActiveProject()
Definition: Project.cpp:308
void TimeTrackMenuTable::OnTimeTrackLog ( wxCommandEvent &  )
private

Definition at line 127 of file TimeTrackControls.cpp.

References _(), GetActiveProject(), mpData, TrackControls::InitMenuData::pTrack, AudacityProject::PushState(), RefreshCode::RefreshAll, TrackControls::InitMenuData::result, TimeTrack::SetDisplayLog(), and RefreshCode::UpdateVRuler.

128 {
129  TimeTrack *const pTrack = static_cast<TimeTrack*>(mpData->pTrack);
130  pTrack->SetDisplayLog(true);
131  AudacityProject *const project = ::GetActiveProject();
132  project->PushState(_("Set time track display to logarithmic"), _("Set Display"));
133 
134  using namespace RefreshCode;
136 }
void SetDisplayLog(bool displayLog)
Definition: TimeTrack.h:134
AudacityProject provides the main window, with tools and tracks contained within it.
Definition: Project.h:176
A kind of Track used to 'warp time'.
Definition: TimeTrack.h:29
TrackControls::InitMenuData * mpData
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom")).Raw()), OnMoveTrack)#define SET_TRACK_NAME_PLUGIN_SYMBOLclass SetTrackNameCommand:public AudacityCommand
void PushState(const wxString &desc, const wxString &shortDesc)
Definition: Project.cpp:4702
AUDACITY_DLL_API AudacityProject * GetActiveProject()
Definition: Project.cpp:308
void TimeTrackMenuTable::OnTimeTrackLogInt ( wxCommandEvent &  )
private

Definition at line 138 of file TimeTrackControls.cpp.

References _(), GetActiveProject(), TimeTrack::GetInterpolateLog(), mpData, TrackControls::InitMenuData::pTrack, AudacityProject::PushState(), RefreshCode::RefreshAll, TrackControls::InitMenuData::result, and TimeTrack::SetInterpolateLog().

139 {
140  TimeTrack *const pTrack = static_cast<TimeTrack*>(mpData->pTrack);
141  AudacityProject *const project = ::GetActiveProject();
142  if (pTrack->GetInterpolateLog()) {
143  pTrack->SetInterpolateLog(false);
144  project->PushState(_("Set time track interpolation to linear"), _("Set Interpolation"));
145  }
146  else {
147  pTrack->SetInterpolateLog(true);
148  project->PushState(_("Set time track interpolation to logarithmic"), _("Set Interpolation"));
149  }
151 }
bool GetInterpolateLog() const
Definition: TimeTrack.cpp:145
AudacityProject provides the main window, with tools and tracks contained within it.
Definition: Project.h:176
A kind of Track used to 'warp time'.
Definition: TimeTrack.h:29
TrackControls::InitMenuData * mpData
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom")).Raw()), OnMoveTrack)#define SET_TRACK_NAME_PLUGIN_SYMBOLclass SetTrackNameCommand:public AudacityCommand
void SetInterpolateLog(bool interpolateLog)
Definition: TimeTrack.cpp:150
void PushState(const wxString &desc, const wxString &shortDesc)
Definition: Project.cpp:4702
AUDACITY_DLL_API AudacityProject * GetActiveProject()
Definition: Project.cpp:308

Member Data Documentation

TrackControls::InitMenuData* TimeTrackMenuTable::mpData
private

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