17#include "../../../../HitTestResult.h"
20#include "../../../../RefreshCode.h"
22#include "../../../../TrackPanelMouseEvent.h"
27#include "../../../../../images/Cursors.h"
30 const std::shared_ptr<WaveTrack> &pTrack,
34 , mLocations{ move(locations) }
35 , mLocation{ location }
41#ifdef EXPERIMENTAL_TRACK_PANEL_HIGHLIGHTING
48 static auto disabledCursor =
49 ::MakeCursor(wxCURSOR_NO_ENTRY, DisabledCursorXpm, 16, 16);
50 static wxCursor arrowCursor{ wxCURSOR_ARROW };
51 return {
XO(
"Left-Click to expand, Right-Click to remove"),
52 (unsafe ? &*disabledCursor : &arrowCursor) };
58 const wxRect &rect,
const wxMouseState &state,
61 for (
auto loc: locations) {
63 if (x >= 0 && x < rect.width)
67 locRect.x = (int)(rect.x + x) - locRect.width / 2;
69 locRect.height = rect.height;
70 if (locRect.Contains(state.m_x, state.m_y))
84 std::weak_ptr<CutlineHandle> &holder,
85 const wxMouseState &state,
const wxRect &rect,
87 std::shared_ptr<WaveTrack> pTrack)
95 if (!
IsOverCutline(locations, viewInfo, rect, state, &location))
99 std::make_shared<CutlineHandle>(pTrack, move(locations), location);
126 const wxMouseEvent &
event = evt.
event;
141 if (event.LeftDown())
145 mEndTime = viewInfo.selectedRegion.t1();
148 double cutlineStart = 0, cutlineEnd = 0;
151 viewInfo.selectedRegion.setTimes(cutlineStart, cutlineEnd);
153 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
Result Release(const TrackPanelMouseEvent &event, AudacityProject *pProject, wxWindow *pParent) override
std::shared_ptr< const Track > FindTrack() const 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)
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?'.
WAVE_TRACK_API void ExpandCutLine(WaveTrack &track, double cutLinePosition, double *cutlineStart=nullptr, double *cutlineEnd=nullptr)
WAVE_TRACK_API bool RemoveCutLine(WaveTrack &track, double cutLinePosition)
Remove cut line, without expanding the audio in it.
bool IsOverCutline(const WaveTrackLocations &locations, const ViewInfo &viewInfo, const wxRect &rect, const wxMouseState &state, WaveTrackLocation *pmLocation)