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

#include <NoteTrackControls.h>

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

Public Member Functions

 NoteTrackControls (std::shared_ptr< Track > pTrack)
 
 ~NoteTrackControls ()
 
std::vector< UIHandlePtrHitTest (const TrackPanelMouseState &state, const AudacityProject *pProject) override
 
PopupMenuTableGetMenuExtension (Track *pTrack) override
 
const TCPLinesGetTCPLines () const override
 
- Public Member Functions inherited from CommonTrackControls
const TCPLinesGetTCPLines () const override
 
 TrackControls (std::shared_ptr< Track > pTrack)
 
- Public Member Functions inherited from TrackControls
 TrackControls (std::shared_ptr< Track > pTrack)
 
virtual ~TrackControls ()=0
 
virtual const TrackInfo::TCPLinesGetTCPLines () const =0
 
- Public Member Functions inherited from CommonTrackCell
 CommonTrackCell (const std::shared_ptr< Track > &pTrack)
 Construct from a track. More...
 
 ~CommonTrackCell ()
 
std::shared_ptr< TrackDoFindTrack () override
 
void Reparent (const std::shared_ptr< Track > &parent) override
 Object may be shared among tracks but hold a special back-pointer to one of them; reassign it. More...
 
- Public Member Functions inherited from CommonTrackPanelCell
 CommonTrackPanelCell ()
 
virtual ~CommonTrackPanelCell ()=0
 
HitTestPreview DefaultPreview (const TrackPanelMouseState &, const AudacityProject *) override
 
std::shared_ptr< TrackFindTrack ()
 
std::shared_ptr< const TrackFindTrack () const
 
virtual std::vector< MenuItemGetMenuItems (const wxRect &rect, const wxPoint *pPosition, AudacityProject *pProject)
 Return a list of items for DoContextMenu() (empties for separators) More...
 
- Public Member Functions inherited from TrackPanelCell
 TrackPanelCell ()=default
 
 TrackPanelCell (const TrackPanelCell &)=delete
 
TrackPanelCelloperator= (const TrackPanelCell &)=delete
 
virtual ~TrackPanelCell ()=0
 
virtual HitTestPreview DefaultPreview (const TrackPanelMouseState &state, const AudacityProject *pProject)
 
virtual std::vector< UIHandlePtrHitTest (const TrackPanelMouseState &state, const AudacityProject *pProject)=0
 
virtual unsigned HandleWheelRotation (const TrackPanelMouseEvent &event, AudacityProject *pProject)
 
virtual std::shared_ptr< TrackPanelCellContextMenuDelegate ()
 
virtual unsigned DoContextMenu (const wxRect &rect, wxWindow *pParent, const wxPoint *pPosition, AudacityProject *pProject)
 
virtual unsigned CaptureKey (wxKeyEvent &event, ViewInfo &viewInfo, wxWindow *pParent, AudacityProject *project)
 
virtual unsigned KeyDown (wxKeyEvent &event, ViewInfo &viewInfo, wxWindow *pParent, AudacityProject *project)
 
virtual unsigned KeyUp (wxKeyEvent &event, ViewInfo &viewInfo, wxWindow *pParent, AudacityProject *project)
 
virtual unsigned Char (wxKeyEvent &event, ViewInfo &viewInfo, wxWindow *pParent, AudacityProject *project)
 
virtual unsigned LoseFocus (AudacityProject *project)
 
- Public Member Functions inherited from TrackPanelNode
 TrackPanelNode ()
 
virtual ~TrackPanelNode ()=0
 
- Public Member Functions inherited from TrackPanelDrawable
virtual ~TrackPanelDrawable ()=0
 
virtual void Draw (TrackPanelDrawingContext &context, const wxRect &rect, unsigned iPass)
 
virtual wxRect DrawingArea (TrackPanelDrawingContext &context, const wxRect &rect, const wxRect &panelRect, unsigned iPass)
 
- Public Member Functions inherited from TrackAttachment
virtual ~TrackAttachment ()
 
virtual void CopyTo (Track &track) const
 Copy state, for undo/redo purposes. More...
 
virtual void Reparent (const std::shared_ptr< Track > &parent)
 Object may be shared among tracks but hold a special back-pointer to one of them; reassign it. More...
 
virtual void WriteXMLAttributes (XMLWriter &) const
 Serialize persistent attributes. More...
 
virtual bool HandleXMLAttribute (const std::string_view &attr, const XMLAttributeValueView &valueView)
 Deserialize an attribute, returning true if recognized. More...
 
- Public Member Functions inherited from ClientData::Base
virtual ~Base ()
 

Static Public Member Functions

static unsigned DefaultNoteTrackHeight ()
 
static void GetMidiControlsRect (const wxRect &rect, wxRect &dest)
 
static void GetVelocityRect (const wxPoint &topleft, wxRect &dest)
 
static LWSliderVelocitySlider (const wxRect &sliderRect, const NoteTrack *t, bool captured, wxWindow *pParent)
 
- Static Public Member Functions inherited from PlayableTrackControls
static const TCPLinesStaticNoteTCPLines ()
 
static const TCPLinesStaticWaveTCPLines ()
 
static void GetMuteSoloRect (const wxRect &rect, wxRect &dest, bool solo, const Track *pTrack)
 
static void GetEffectsRect (const wxRect &rect, wxRect &dest, const Track *pTrack)
 
- Static Public Member Functions inherited from TrackControls
static TrackControlsGet (Track &track)
 
static const TrackControlsGet (const Track &track)
 
- Static Public Member Functions inherited from TrackPanelDrawable
static wxRect MaximizeWidth (const wxRect &rect, const wxRect &panelRect)
 
static wxRect MaximizeHeight (const wxRect &rect, const wxRect &panelRect)
 

Private Member Functions

 NoteTrackControls (const NoteTrackControls &)=delete
 
NoteTrackControlsoperator= (const NoteTrackControls &)=delete
 

Static Private Member Functions

static void ReCreateVelocitySlider (struct ThemeChangeMessage)
 

Private Attributes

std::weak_ptr< MuteButtonHandlemMuteHandle
 
std::weak_ptr< SoloButtonHandlemSoloHandle
 
std::weak_ptr< NoteTrackButtonHandlemClickHandle
 
std::weak_ptr< VelocitySliderHandlemVelocityHandle
 

Additional Inherited Members

- Protected Member Functions inherited from CommonTrackControls
virtual std::vector< UIHandlePtrHitTest (const TrackPanelMouseState &state, const AudacityProject *) override=0
 
unsigned DoContextMenu (const wxRect &rect, wxWindow *pParent, const wxPoint *pPosition, AudacityProject *pProject) override
 
virtual PopupMenuTableGetMenuExtension (Track *pTrack)=0
 
void Draw (TrackPanelDrawingContext &context, const wxRect &rect, unsigned iPass) override
 
wxRect DrawingArea (TrackPanelDrawingContext &, const wxRect &rect, const wxRect &panelRect, unsigned iPass) override
 
- Protected Member Functions inherited from CommonTrackPanelCell
virtual std::shared_ptr< TrackDoFindTrack ()=0
 
unsigned DoContextMenu (const wxRect &rect, wxWindow *pParent, const wxPoint *pPosition, AudacityProject *pProject) override
 
unsigned HandleWheelRotation (const TrackPanelMouseEvent &event, AudacityProject *pProject) override
 
- Protected Attributes inherited from CommonTrackControls
std::weak_ptr< CloseButtonHandlemCloseHandle
 
std::weak_ptr< MenuButtonHandlemMenuHandle
 
std::weak_ptr< MinimizeButtonHandlemMinimizeHandle
 
std::weak_ptr< TrackSelectHandlemSelectHandle
 

Detailed Description

Definition at line 28 of file NoteTrackControls.h.

Constructor & Destructor Documentation

◆ NoteTrackControls() [1/2]

NoteTrackControls::NoteTrackControls ( const NoteTrackControls )
privatedelete

◆ NoteTrackControls() [2/2]

NoteTrackControls::NoteTrackControls ( std::shared_ptr< Track pTrack)
inlineexplicit

Definition at line 40 of file NoteTrackControls.h.

◆ ~NoteTrackControls()

NoteTrackControls::~NoteTrackControls ( )

Definition at line 33 of file NoteTrackControls.cpp.

34{
35}

Member Function Documentation

◆ DefaultNoteTrackHeight()

unsigned NoteTrackControls::DefaultNoteTrackHeight ( )
static

Definition at line 337 of file NoteTrackControls.cpp.

338{
340}
NoteTrackTCPLines noteTrackTCPLines
AUDACITY_DLL_API unsigned DefaultTrackHeight(const TCPLines &topLines)

References CommonTrackInfo::DefaultTrackHeight(), and noteTrackTCPLines.

Here is the call graph for this function:

◆ GetMenuExtension()

PopupMenuTable * NoteTrackControls::GetMenuExtension ( Track pTrack)
overridevirtual

Implements CommonTrackControls.

Definition at line 129 of file NoteTrackControls.cpp.

130{
131#if defined(USE_MIDI)
133#else
134 return NULL;
135#endif
136}
static NoteTrackMenuTable & Instance()

References NoteTrackMenuTable::Instance().

Here is the call graph for this function:

◆ GetMidiControlsRect()

void NoteTrackControls::GetMidiControlsRect ( const wxRect &  rect,
wxRect &  dest 
)
static

Definition at line 328 of file NoteTrackControls.cpp.

329{
331 auto results = TrackInfo::CalcItemY(
333 dest.y = rect.y + results.first;
334 dest.height = results.second;
335}
AUDACITY_DLL_API std::pair< int, int > CalcItemY(const TCPLines &lines, unsigned iItem)
Definition: TrackInfo.cpp:79
void GetMidiControlsHorizontalBounds(const wxRect &rect, wxRect &dest)

References TrackInfo::CalcItemY(), anonymous_namespace{NoteTrackControls.cpp}::GetMidiControlsHorizontalBounds(), TrackInfo::TCPLine::kItemMidiControlsRect, and noteTrackTCPLines.

Referenced by NoteTrackButtonHandle::HitTest().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetTCPLines()

const TCPLines & NoteTrackControls::GetTCPLines ( ) const
overridevirtual

Implements TrackControls.

Definition at line 342 of file NoteTrackControls.cpp.

343{
344 return noteTrackTCPLines;
345};

References noteTrackTCPLines.

◆ GetVelocityRect()

void NoteTrackControls::GetVelocityRect ( const wxPoint &  topleft,
wxRect &  dest 
)
static

Definition at line 320 of file NoteTrackControls.cpp.

321{
324 dest.y = topleft.y + results.first;
325 dest.height = results.second;
326}
AUDACITY_DLL_API void GetSliderHorizontalBounds(const wxPoint &topleft, wxRect &dest)

References TrackInfo::CalcItemY(), CommonTrackInfo::GetSliderHorizontalBounds(), TrackInfo::TCPLine::kItemVelocity, and noteTrackTCPLines.

Referenced by VelocitySliderHandle::HitTest(), and ReCreateVelocitySlider().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ HitTest()

std::vector< UIHandlePtr > NoteTrackControls::HitTest ( const TrackPanelMouseState state,
const AudacityProject pProject 
)
overridevirtual

Implements CommonTrackControls.

Definition at line 37 of file NoteTrackControls.cpp.

40{
41 // Hits are mutually exclusive, results single
42 std::vector<UIHandlePtr> results;
43 const wxMouseState &state = st.state;
44 const wxRect &rect = st.rect;
45 if (state.ButtonIsDown(wxMOUSE_BTN_ANY)) {
46 auto track = std::static_pointer_cast<NoteTrack>(FindTrack());
47 auto result = [&]{
48 UIHandlePtr result;
49 if (NULL != (result = MuteButtonHandle::HitTest(
50 mMuteHandle, state, rect, pProject, track)))
51 return result;
52
53 if (NULL != (result = SoloButtonHandle::HitTest(
54 mSoloHandle, state, rect, pProject, track)))
55 return result;
56 if (NULL != (result = VelocitySliderHandle::HitTest(
57 mVelocityHandle, state, rect, track)))
58 return result;
59 if (NULL != (result = NoteTrackButtonHandle::HitTest(
60 mClickHandle, state, rect, track)))
61 return result;
62 return result;
63 }();
64 if (result) {
65 results.push_back(result);
66 return results;
67 }
68 }
69
70 return PlayableTrackControls::HitTest(st, pProject);
71}
std::shared_ptr< UIHandle > UIHandlePtr
Definition: CellularPanel.h:28
virtual std::vector< UIHandlePtr > HitTest(const TrackPanelMouseState &state, const AudacityProject *) override=0
std::shared_ptr< Track > FindTrack()
static UIHandlePtr HitTest(std::weak_ptr< MuteButtonHandle > &holder, const wxMouseState &state, const wxRect &rect, const AudacityProject *pProject, const std::shared_ptr< Track > &pTrack)
static UIHandlePtr HitTest(std::weak_ptr< NoteTrackButtonHandle > &holder, const wxMouseState &state, const wxRect &rect, const std::shared_ptr< NoteTrack > &pTrack)
std::weak_ptr< NoteTrackButtonHandle > mClickHandle
std::weak_ptr< SoloButtonHandle > mSoloHandle
std::weak_ptr< VelocitySliderHandle > mVelocityHandle
std::weak_ptr< MuteButtonHandle > mMuteHandle
static UIHandlePtr HitTest(std::weak_ptr< SoloButtonHandle > &holder, const wxMouseState &state, const wxRect &rect, const AudacityProject *pProject, const std::shared_ptr< Track > &pTrack)
static UIHandlePtr HitTest(std::weak_ptr< VelocitySliderHandle > &holder, const wxMouseState &state, const wxRect &rect, const std::shared_ptr< Track > &pTrack)

References CommonTrackPanelCell::FindTrack(), CommonTrackControls::HitTest(), MuteButtonHandle::HitTest(), NoteTrackButtonHandle::HitTest(), SoloButtonHandle::HitTest(), VelocitySliderHandle::HitTest(), mClickHandle, mMuteHandle, mSoloHandle, mVelocityHandle, TrackPanelMouseState::rect, and TrackPanelMouseState::state.

Here is the call graph for this function:

◆ operator=()

NoteTrackControls & NoteTrackControls::operator= ( const NoteTrackControls )
privatedelete

◆ ReCreateVelocitySlider()

void NoteTrackControls::ReCreateVelocitySlider ( struct ThemeChangeMessage  message)
staticprivate

Definition at line 376 of file NoteTrackControls.cpp.

377{
378 if (message.appearance)
379 return;
380 wxPoint point{ 0, 0 };
381 wxRect sliderRect;
382 GetVelocityRect(point, sliderRect);
383
384 /* i18n-hint: Title of the Velocity slider, used to adjust the volume of note tracks */
385 gVelocity = std::make_unique<LWSlider>(nullptr, XO("Velocity"),
386 wxPoint(sliderRect.x, sliderRect.y),
387 wxSize(sliderRect.width, sliderRect.height),
388 VEL_SLIDER);
389 gVelocity->SetDefaultValue(0.0);
390 gVelocityCaptured = std::make_unique<LWSlider>(nullptr, XO("Velocity"),
391 wxPoint(sliderRect.x, sliderRect.y),
392 wxSize(sliderRect.width, sliderRect.height),
393 VEL_SLIDER);
394 gVelocityCaptured->SetDefaultValue(0.0);
395}
#define VEL_SLIDER
Definition: ASlider.h:37
XO("Cut/Copy/Paste")
static void GetVelocityRect(const wxPoint &topleft, wxRect &dest)
std::optional< PreferredSystemAppearance > appearance
Definition: Theme.h:111

References ThemeChangeMessage::appearance, GetVelocityRect(), anonymous_namespace{NoteTrackControls.cpp}::gVelocity, anonymous_namespace{NoteTrackControls.cpp}::gVelocityCaptured, VEL_SLIDER, and XO().

Referenced by VelocitySlider().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ VelocitySlider()

LWSlider * NoteTrackControls::VelocitySlider ( const wxRect &  sliderRect,
const NoteTrack t,
bool  captured,
wxWindow *  pParent 
)
static

Definition at line 356 of file NoteTrackControls.cpp.

358{
359 static std::once_flag flag;
360 std::call_once( flag, []{ ReCreateVelocitySlider({}); });
362
363 wxPoint pos = sliderRect.GetPosition();
364 float velocity = t ? t->GetVelocity() : 0.0;
365
366 gVelocity->Move(pos);
367 gVelocity->Set(velocity);
368 gVelocityCaptured->Move(pos);
369 gVelocityCaptured->Set(velocity);
370
371 auto slider = (captured ? gVelocityCaptured : gVelocity).get();
372 slider->SetParent( pParent );
373 return slider;
374}
THEME_API Theme theTheme
Definition: Theme.cpp:82
static std::once_flag flag
static void ReCreateVelocitySlider(struct ThemeChangeMessage)
float GetVelocity() const
Definition: NoteTrack.h:124
Subscription Subscribe(Callback callback)
Connect a callback to the Publisher; later-connected are called earlier.
Definition: Observer.h:199

References flag, NoteTrack::GetVelocity(), anonymous_namespace{NoteTrackControls.cpp}::gVelocity, anonymous_namespace{NoteTrackControls.cpp}::gVelocityCaptured, ReCreateVelocitySlider(), Observer::Publisher< Message, NotifyAll >::Subscribe(), anonymous_namespace{LinkUrlHandler.cpp}::subscription, and theTheme.

Referenced by VelocitySliderHandle::HitTest(), and anonymous_namespace{NoteTrackControls.cpp}::VelocitySliderDrawFunction().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ mClickHandle

std::weak_ptr<NoteTrackButtonHandle> NoteTrackControls::mClickHandle
private

Definition at line 35 of file NoteTrackControls.h.

Referenced by HitTest().

◆ mMuteHandle

std::weak_ptr<MuteButtonHandle> NoteTrackControls::mMuteHandle
private

Definition at line 33 of file NoteTrackControls.h.

Referenced by HitTest().

◆ mSoloHandle

std::weak_ptr<SoloButtonHandle> NoteTrackControls::mSoloHandle
private

Definition at line 34 of file NoteTrackControls.h.

Referenced by HitTest().

◆ mVelocityHandle

std::weak_ptr<VelocitySliderHandle> NoteTrackControls::mVelocityHandle
private

Definition at line 36 of file NoteTrackControls.h.

Referenced by HitTest().


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