17#include "../../../../HitTestResult.h"
20#include "../../../../RefreshCode.h"
22#include "../../../../TrackPanelMouseEvent.h"
26#include "../../../../../images/Cursors.h"
29 const std::shared_ptr<WaveTrack> &pTrack,
33 , mLocations{ move(locations) }
34 , mLocation{ location }
40#ifdef EXPERIMENTAL_TRACK_PANEL_HIGHLIGHTING
47 static auto disabledCursor =
48 ::MakeCursor(wxCURSOR_NO_ENTRY, DisabledCursorXpm, 16, 16);
49 static wxCursor arrowCursor{ wxCURSOR_ARROW };
50 return {
XO(
"Left-Click to expand, Right-Click to remove"),
51 (unsafe ? &*disabledCursor : &arrowCursor) };
57 const wxRect &rect,
const wxMouseState &state,
60 for (
auto loc: locations) {
62 if (x >= 0 && x < rect.width)
66 locRect.x = (int)(rect.x + x) - locRect.width / 2;
68 locRect.height = rect.height;
69 if (locRect.Contains(state.m_x, state.m_y))
83 std::weak_ptr<CutlineHandle> &holder,
84 const wxMouseState &state,
const wxRect &rect,
86 std::shared_ptr<WaveTrack> pTrack)
89 if (!pTrack->GetOwner())
91 auto iter = pTrack->GetOwner()->Find(pTrack.get());
94 pTrack = (*iter)->SharedPointer<
WaveTrack>();
102 if (!
IsOverCutline(locations, viewInfo, rect, state, &location))
106 std::make_shared<CutlineHandle>(pTrack, move(locations), location);
133 const wxMouseEvent &
event = evt.
event;
148 if (event.LeftDown())
152 mEndTime = viewInfo.selectedRegion.t1();
155 double cutlineStart = 0, cutlineEnd = 0;
157 viewInfo.selectedRegion.setTimes(cutlineStart, cutlineEnd);
159 else if (event.RightDown())
std::shared_ptr< UIHandle > UIHandlePtr
const int kPixelTolerance
std::unique_ptr< wxCursor > MakeCursor(int WXUNUSED(CursorId), const char *const pXpm[36], int HotX, int HotY)
std::shared_ptr< Subclass > AssignUIHandlePtr(std::weak_ptr< Subclass > &holder, const std::shared_ptr< Subclass > &pNew)
WaveTrackLocations FindWaveTrackLocations(const WaveTrack &track)
std::vector< WaveTrackLocation > WaveTrackLocations
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
CutlineHandle(const CutlineHandle &)=delete
std::shared_ptr< const Channel > FindChannel() const override
Result Release(const TrackPanelMouseEvent &event, AudacityProject *pProject, wxWindow *pParent) override
WaveTrackLocation mLocation
HitTestPreview Preview(const TrackPanelMouseState &state, AudacityProject *pProject) override
std::shared_ptr< WaveTrack > mpTrack
static UIHandlePtr HitTest(std::weak_ptr< CutlineHandle > &holder, const wxMouseState &state, const wxRect &rect, const AudacityProject *pProject, std::shared_ptr< WaveTrack > pTrack)
Result Drag(const TrackPanelMouseEvent &event, AudacityProject *pProject) override
static HitTestPreview HitPreview(bool unsafe)
void Enter(bool forward, AudacityProject *) override
bool HandlesRightClick() override
Whether the handle has any special right-button handling.
Result Click(const TrackPanelMouseEvent &event, AudacityProject *pProject) override
Result Cancel(AudacityProject *pProject) override
bool setTimes(double t0, double t1)
bool IsAudioActive() const
static ProjectAudioIO & Get(AudacityProject &project)
void PushState(const TranslatableString &desc, const TranslatableString &shortDesc)
static ProjectHistory & Get(AudacityProject &project)
NotifyingSelectedRegion selectedRegion
static ViewInfo & Get(AudacityProject &project)
A Track that contains audio waveform data.
int64 TimeToPosition(double time, int64 origin=0, bool ignoreFisheye=false) const
STM: Converts a project time to screen x position.
Namespace containing an enum 'what to do on a refresh?'.
bool IsOverCutline(const WaveTrackLocations &locations, const ViewInfo &viewInfo, const wxRect &rect, const wxMouseState &state, WaveTrackLocation *pmLocation)