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, size_t iChannel)
 Construct from a track and a channel index. More...
 
 CommonTrackCell (ChannelGroup &group, size_t iChannel)
 Construct from a channel group and a channel index. 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...
 
size_t GetChannelIndex () const
 
std::shared_ptr< ChannelFindChannel ()
 May return null. More...
 
std::shared_ptr< const ChannelFindChannel () const
 May return null. 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 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< VelocitySliderHandle > mVelocityHandle
 

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< SelectButtonHandlemSelectButtonHandle
 
std::weak_ptr< TrackSelectHandlemSelectHandle
 

Detailed Description

Definition at line 36 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 48 of file NoteTrackControls.h.

49 : NoteTrackControlsBase( pTrack ) {}
CommonTrackControls NoteTrackControlsBase

◆ ~NoteTrackControls()

NoteTrackControls::~NoteTrackControls ( )

Definition at line 33 of file NoteTrackControls.cpp.

34{
35}

Member Function Documentation

◆ DefaultNoteTrackHeight()

unsigned NoteTrackControls::DefaultNoteTrackHeight ( )
static

Definition at line 343 of file NoteTrackControls.cpp.

344{
346}
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 131 of file NoteTrackControls.cpp.

132{
133#if defined(USE_MIDI)
135#else
136 return NULL;
137#endif
138}
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 334 of file NoteTrackControls.cpp.

335{
337 auto results = TrackInfo::CalcItemY(
339 dest.y = rect.y + results.first;
340 dest.height = results.second;
341}
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 348 of file NoteTrackControls.cpp.

349{
350 return noteTrackTCPLines;
351};

References noteTrackTCPLines.

◆ GetVelocityRect()

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

Definition at line 326 of file NoteTrackControls.cpp.

327{
330 dest.y = topleft.y + results.first;
331 dest.height = results.second;
332}
AUDACITY_DLL_API void GetSliderHorizontalBounds(const wxPoint &topleft, wxRect &dest)

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

Referenced by 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#ifdef EXPERIMENTAL_MIDI_OUT
57 if (NULL != (result = VelocitySliderHandle::HitTest(
58 mVelocityHandle, state, rect, track)))
59 return result;
60 if (NULL != (result = NoteTrackButtonHandle::HitTest(
61 mClickHandle, state, rect, track)))
62 return result;
63#endif
64 return result;
65 }();
66 if (result) {
67 results.push_back(result);
68 return results;
69 }
70 }
71
72 return NoteTrackControlsBase::HitTest(st, pProject);
73}
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)
bool HitTest(const RectangleArgs &args, const wxPoint &mousePos)

References CommonTrackPanelCell::FindTrack(), LowlitClipButton::HitTest(), CommonTrackControls::HitTest(), MuteButtonHandle::HitTest(), NoteTrackButtonHandle::HitTest(), SoloButtonHandle::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 386 of file NoteTrackControls.cpp.

387{
388 if (message.appearance)
389 return;
390#ifdef EXPERIMENTAL_MIDI_OUT
391 wxPoint point{ 0, 0 };
392 wxRect sliderRect;
393 GetVelocityRect(point, sliderRect);
394
395 /* i18n-hint: Title of the Velocity slider, used to adjust the volume of note tracks */
396 gVelocity = std::make_unique<LWSlider>(nullptr, XO("Velocity"),
397 wxPoint(sliderRect.x, sliderRect.y),
398 wxSize(sliderRect.width, sliderRect.height),
399 VEL_SLIDER);
400 gVelocity->SetDefaultValue(0.0);
401 gVelocityCaptured = std::make_unique<LWSlider>(nullptr, XO("Velocity"),
402 wxPoint(sliderRect.x, sliderRect.y),
403 wxSize(sliderRect.width, sliderRect.height),
404 VEL_SLIDER);
405 gVelocityCaptured->SetDefaultValue(0.0);
406#endif
407}
#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:112

References ThemeChangeMessage::appearance, GetVelocityRect(), VEL_SLIDER, and XO().

Here is the call graph for this function:

◆ VelocitySlider()

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

Member Data Documentation

◆ mClickHandle

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

Definition at line 43 of file NoteTrackControls.h.

Referenced by HitTest().

◆ mMuteHandle

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

Definition at line 41 of file NoteTrackControls.h.

Referenced by HitTest().

◆ mSoloHandle

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

Definition at line 42 of file NoteTrackControls.h.

Referenced by HitTest().

◆ mVelocityHandle

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

Definition at line 44 of file NoteTrackControls.h.

Referenced by HitTest().


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