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 wxRect &rect, 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 GetEffectsButtonRect (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 336 of file NoteTrackControls.cpp.

337{
339}
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 326 of file NoteTrackControls.cpp.

327{
328 const auto rect = wxRect(rect_).Deflate(CommonTrackInfo::Margin);
330 const auto results = TrackInfo::CalcItemY(
332 dest.y = rect.y + results.first;
333 dest.height = results.second;
334}
static constexpr auto Margin
AUDACITY_DLL_API std::pair< int, int > CalcItemY(const TCPLines &lines, unsigned iItem)
Definition: TrackInfo.cpp:61
void GetMidiControlsHorizontalBounds(const wxRect &rect, wxRect &dest)

References TrackInfo::CalcItemY(), anonymous_namespace{NoteTrackControls.cpp}::GetMidiControlsHorizontalBounds(), TrackInfo::TCPLine::kItemMidiControlsRect, CommonTrackInfo::Margin, 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 341 of file NoteTrackControls.cpp.

342{
343 return noteTrackTCPLines;
344};

References noteTrackTCPLines.

◆ GetVelocityRect()

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

Definition at line 317 of file NoteTrackControls.cpp.

318{
319 const auto rect = wxRect(rect_).Deflate(CommonTrackInfo::Margin);
321 const auto results = CalcItemY( noteTrackTCPLines, TCPLine::kItemVelocity );
322 dest.y = rect.y + results.first;
323 dest.height = results.second;
324}
AUDACITY_DLL_API void GetSliderHorizontalBounds(const wxRect &rect, wxRect &dest)

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

Referenced by VelocitySliderHandle::HitTest().

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 375 of file NoteTrackControls.cpp.

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

References ThemeChangeMessage::appearance, anonymous_namespace{NoteTrackControls.cpp}::gVelocity, anonymous_namespace{NoteTrackControls.cpp}::gVelocityCaptured, kTrackInfoSliderHeight, kTrackInfoSliderWidth, 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 355 of file NoteTrackControls.cpp.

357{
358 static std::once_flag flag;
359 std::call_once( flag, []{ ReCreateVelocitySlider({}); });
361
362 wxPoint pos = sliderRect.GetPosition();
363 float velocity = t ? t->GetVelocity() : 0.0;
364
365 gVelocity->Move(pos);
366 gVelocity->Set(velocity);
367 gVelocityCaptured->Move(pos);
368 gVelocityCaptured->Set(velocity);
369
370 auto slider = (captured ? gVelocityCaptured : gVelocity).get();
371 slider->SetParent( pParent );
372 return slider;
373}
THEME_API Theme theTheme
Definition: Theme.cpp:82
static std::once_flag flag
static void ReCreateVelocitySlider(struct ThemeChangeMessage)
float GetVelocity() const
Definition: NoteTrack.h:125
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: