15#include "../../../ui/AffordanceHandle.h"
16#include "../../../ui/SelectHandle.h"
17#include "../../../ui/ChannelView.h"
22#include "../../../../TrackArt.h"
23#include "../../../../TrackArtist.h"
24#include "../../../../TrackPanelMouseEvent.h"
25#include "../../../../TrackPanelDrawingContext.h"
32#include "../../../../ProjectSettings.h"
33#include "../../../../RefreshCode.h"
42 static UIHandlePtr HitAnywhere(std::weak_ptr<NoteTrackAffordanceHandle>& holder,
const std::shared_ptr<Track>& pTrack)
44 return AssignUIHandlePtr(holder, std::make_shared<NoteTrackAffordanceHandle>(pTrack));
68 std::vector<UIHandlePtr> results;
70 auto track = std::static_pointer_cast<NoteTrack>(
FindTrack());
71 const auto nt = std::static_pointer_cast<const NoteTrack>(track->SubstitutePendingChangedTrack());
73 const auto rect = state.
rect;
76 auto left = zoomInfo.TimeToPosition(nt->GetStartTime(), rect.x);
77 auto right = zoomInfo.TimeToPosition(nt->GetStartTime() + nt->GetSeq().get_real_dur(), rect.x);
78 auto headerRect = wxRect(left, rect.y, right - left, rect.height);
80 auto px = state.
state.m_x;
81 auto py = state.
state.m_y;
83 if (px >= headerRect.GetLeft() && px <= headerRect.GetRight() &&
84 py >= headerRect.GetTop() && py <= headerRect.GetBottom())
90 const auto currentTool =
settings.GetTool();
107 const auto nt = std::static_pointer_cast<const NoteTrack>(
FindTrack()->SubstitutePendingChangedTrack());
112 const auto& zoomInfo = *artist->pZoomInfo;
113 auto left = zoomInfo.TimeToPosition(nt->GetStartTime(), rect.x);
114 auto right = zoomInfo.TimeToPosition(nt->GetStartTime() + nt->GetSeq().get_real_dur(), rect.x);
115 auto clipRect = wxRect(left, rect.y, right - left + 1, rect.height);
121 auto highlight = selected ||
122 (px >= clipRect.GetLeft() && px <= clipRect.GetRight() &&
123 py >= clipRect.GetTop() && py <= clipRect.GetBottom());
126 wxDCClipper clipper(context.
dc, rect);
127 context.
dc.SetTextBackground(wxTransparentColor);
129 context.
dc.SetFont(wxFont(wxFontInfo()));
140 return handle->Clicked();
std::shared_ptr< UIHandle > UIHandlePtr
static Settings & settings()
std::shared_ptr< Subclass > AssignUIHandlePtr(std::weak_ptr< Subclass > &holder, const std::shared_ptr< Subclass > &pNew)
static wxBrush labelSelectedBrush
static wxBrush labelUnselectedBrush
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
static ChannelView & Get(Channel &channel)
std::shared_ptr< Track > FindTrack()
NoteTrackAffordanceControls(const std::shared_ptr< Track > &pTrack)
std::weak_ptr< NoteTrackAffordanceHandle > mAffordanceHandle
void Draw(TrackPanelDrawingContext &context, const wxRect &rect, unsigned iPass) override
std::weak_ptr< SelectHandle > mSelectHandle
std::vector< UIHandlePtr > HitTest(const TrackPanelMouseState &state, const AudacityProject *pProject) override
NoteTrackAffordanceHandle(const std::shared_ptr< Track > &track)
static UIHandlePtr HitAnywhere(std::weak_ptr< NoteTrackAffordanceHandle > &holder, const std::shared_ptr< Track > &pTrack)
UIHandle::Result SelectAt(const TrackPanelMouseEvent &event, AudacityProject *pProject) override
void ModifyState(bool bWantsAutoSave)
static ProjectHistory & Get(AudacityProject &project)
static ProjectSettings & Get(AudacityProject &project)
static UIHandlePtr HitTest(std::weak_ptr< SelectHandle > &holder, const TrackPanelMouseState &state, const AudacityProject *pProject, const std::shared_ptr< ChannelView > &pChannelView)
static void SelectTrackLength(ViewInfo &viewInfo, Track &track, bool syncLocked)
bool IsSyncLocked() const
static SyncLockState & Get(AudacityProject &project)
wxColour & Colour(int iIndex)
std::shared_ptr< Track > GetTrack() const
static TrackArtist * Get(TrackPanelDrawingContext &)
Abstract base class for an object holding data associated with points on a time axis.
std::shared_ptr< Subclass > Lock(const std::weak_ptr< Subclass > &wTrack)
static TrackList & Get(AudacityProject &project)
static ViewInfo & Get(AudacityProject &project)
AUDACITY_DLL_API wxRect DrawClipAffordance(wxDC &dc, const wxRect &affordanceRect, bool highlight=false, bool selected=false)
AUDACITY_DLL_API void DrawBackgroundWithSelection(TrackPanelDrawingContext &context, const wxRect &rect, const Track *track, const wxBrush &selBrush, const wxBrush &unselBrush, bool useSelection=true)
AUDACITY_DLL_API bool DrawClipTitle(wxDC &dc, const wxRect &titleRect, const wxString &title)