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());
73 const auto &nt =
static_cast<const NoteTrack&
>(
76 const auto rect = state.
rect;
79 auto left = zoomInfo.TimeToPosition(nt.GetStartTime(), rect.x);
80 auto right = zoomInfo.TimeToPosition(
81 nt.GetStartTime() + nt.GetSeq().get_real_dur(), rect.x);
82 auto headerRect = wxRect(left, rect.y, right - left, rect.height);
84 auto px = state.
state.m_x;
85 auto py = state.
state.m_y;
87 if (px >= headerRect.GetLeft() && px <= headerRect.GetRight() &&
88 py >= headerRect.GetTop() && py <= headerRect.GetBottom())
94 const auto currentTool =
settings.GetTool();
113 const auto &pendingTracks = *artist->pPendingTracks;
118 const auto &nt =
static_cast<const NoteTrack&
>(
119 pendingTracks.SubstitutePendingChangedTrack(*track));
124 const auto& zoomInfo = *artist->pZoomInfo;
125 auto left = zoomInfo.TimeToPosition(nt.GetStartTime(), rect.x);
126 auto right = zoomInfo.TimeToPosition(
127 nt.GetStartTime() + nt.GetSeq().get_real_dur(), rect.x);
128 auto clipRect = wxRect(left, rect.y, right - left + 1, rect.height);
134 auto highlight = selected ||
135 (px >= clipRect.GetLeft() && px <= clipRect.GetRight() &&
136 py >= clipRect.GetTop() && py <= clipRect.GetBottom());
139 wxDCClipper clipper(context.
dc, rect);
140 context.
dc.SetTextBackground(wxTransparentColor);
142 context.
dc.SetFont(wxFont(wxFontInfo()));
153 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
A Track that is used for Midi notes. (Somewhat old code).
Track & SubstitutePendingChangedTrack(Track &track) const
static PendingTracks & Get(AudacityProject &project)
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 void DrawBackgroundWithSelection(TrackPanelDrawingContext &context, const wxRect &rect, const Channel &channel, const wxBrush &selBrush, const wxBrush &unselBrush, bool useSelection=true, bool useBeatsAlternateColor=false)
Helper: draws background with selection rect.
AUDACITY_DLL_API bool DrawClipTitle(wxDC &dc, const wxRect &affordanceRect, const wxString &title)
AUDACITY_DLL_API wxRect DrawClipAffordance(wxDC &dc, const wxRect &clipRect, bool highlight=false, bool selected=false)