1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-08-15 16:14:11 +02:00
2020-01-03 10:09:46 -05:00

75 lines
2.0 KiB
C++

/**********************************************************************
Audacity: A Digital Audio Editor
CutlineHandle.h
Paul Licameli
**********************************************************************/
#ifndef __AUDACITY_CUTLINE_HANDLE__
#define __AUDACITY_CUTLINE_HANDLE__
#include "../../../../UIHandle.h"
#include "../../../../WaveTrackLocation.h"
class wxMouseEvent;
class wxMouseState;
class WaveTrack;
class CutlineHandle final : public UIHandle
{
CutlineHandle(const CutlineHandle&) = delete;
static HitTestPreview HitPreview(bool cutline, bool unsafe);
public:
explicit CutlineHandle
( const std::shared_ptr<WaveTrack> &pTrack,
WaveTrackLocation location );
CutlineHandle &operator=(const CutlineHandle&) = default;
static UIHandlePtr HitAnywhere
(const AudacityProject *pProject, bool cutline, UIHandlePtr ptr);
static UIHandlePtr HitTest
(std::weak_ptr<CutlineHandle> &holder,
const wxMouseState &state, const wxRect &rect,
const AudacityProject *pProject,
const std::shared_ptr<WaveTrack> &pTrack);
virtual ~CutlineHandle();
const WaveTrackLocation &GetLocation() { return mLocation; }
std::shared_ptr<WaveTrack> GetTrack() { return mpTrack; }
void Enter(bool forward, AudacityProject *) override;
Result Click
(const TrackPanelMouseEvent &event, AudacityProject *pProject) override;
Result Drag
(const TrackPanelMouseEvent &event, AudacityProject *pProject) override;
HitTestPreview Preview
(const TrackPanelMouseState &state, const AudacityProject *pProject)
override;
Result Release
(const TrackPanelMouseEvent &event, AudacityProject *pProject,
wxWindow *pParent) override;
Result Cancel(AudacityProject *pProject) override;
bool StopsOnKeystroke() override { return true; }
private:
std::shared_ptr<WaveTrack> mpTrack{};
enum Operation { Merge, Expand, Remove };
Operation mOperation{ Merge };
double mStartTime{}, mEndTime{};
WaveTrackLocation mLocation {};
};
#endif