mirror of
https://github.com/cookiengineer/audacity
synced 2025-05-03 17:19:43 +02:00
... those handles that force a simulated button-up when play interrupts drag, and can assume that pointers to tracks remain nonNULL and part of the current project state (not the undo history). Also pass shared_ptr to Track into more hit test routines.
64 lines
1.6 KiB
C++
64 lines
1.6 KiB
C++
/**********************************************************************
|
|
|
|
Audacity: A Digital Audio Editor
|
|
|
|
LabelTextHandle.h
|
|
|
|
Paul Licameli split from TrackPanel.cpp
|
|
|
|
**********************************************************************/
|
|
|
|
#ifndef __AUDACITY_LABEL_TEXT_HANDLE__
|
|
#define __AUDACITY_LABEL_TEXT_HANDLE__
|
|
|
|
#include "LabelDefaultClickHandle.h"
|
|
#include "../../../MemoryX.h"
|
|
#include "../../../SelectedRegion.h"
|
|
#include <wx/gdicmn.h>
|
|
|
|
class wxMouseEvent;
|
|
struct HitTestResult;
|
|
class LabelTrack;
|
|
class SelectionStateChanger;
|
|
|
|
class LabelTextHandle final : public LabelDefaultClickHandle
|
|
{
|
|
LabelTextHandle();
|
|
LabelTextHandle(const LabelTextHandle&) = delete;
|
|
LabelTextHandle &operator=(const LabelTextHandle&) = delete;
|
|
static LabelTextHandle& Instance();
|
|
|
|
static HitTestPreview HitPreview();
|
|
|
|
public:
|
|
static HitTestResult HitTest(
|
|
const wxMouseEvent &event, const std::shared_ptr<LabelTrack> &pLT);
|
|
|
|
virtual ~LabelTextHandle();
|
|
|
|
Result Click
|
|
(const TrackPanelMouseEvent &event, AudacityProject *pProject) override;
|
|
|
|
Result Drag
|
|
(const TrackPanelMouseEvent &event, AudacityProject *pProject) override;
|
|
|
|
HitTestPreview Preview
|
|
(const TrackPanelMouseEvent &event, const AudacityProject *pProject)
|
|
override;
|
|
|
|
Result Release
|
|
(const TrackPanelMouseEvent &event, AudacityProject *pProject,
|
|
wxWindow *pParent) override;
|
|
|
|
Result Cancel(AudacityProject *pProject) override;
|
|
|
|
private:
|
|
std::weak_ptr<LabelTrack> mpLT {};
|
|
int mLabelTrackStartXPos { -1 };
|
|
int mLabelTrackStartYPos { -1 };
|
|
SelectedRegion mSelectedRegion{};
|
|
std::unique_ptr<SelectionStateChanger> mChanger;
|
|
};
|
|
|
|
#endif
|