mirror of
https://github.com/cookiengineer/audacity
synced 2025-08-08 08:01:19 +02:00
Distinct status bar message for Time track envelope edit
This commit is contained in:
parent
5f8cde43fa
commit
17c964e392
@ -82,7 +82,7 @@ std::vector<UIHandlePtr> WaveTrack::DetailedHitTest
|
||||
case envelopeTool: {
|
||||
auto envelope = GetEnvelopeAtX( st.state.m_x );
|
||||
result = EnvelopeHandle::HitAnywhere(
|
||||
mEnvelopeHandle, envelope);
|
||||
mEnvelopeHandle, envelope, false);
|
||||
break;
|
||||
}
|
||||
case drawTool:
|
||||
|
@ -41,28 +41,11 @@ void EnvelopeHandle::Enter(bool)
|
||||
EnvelopeHandle::~EnvelopeHandle()
|
||||
{}
|
||||
|
||||
HitTestPreview EnvelopeHandle::HitPreview
|
||||
(const AudacityProject *pProject, bool unsafe)
|
||||
{
|
||||
static auto disabledCursor =
|
||||
::MakeCursor(wxCURSOR_NO_ENTRY, DisabledCursorXpm, 16, 16);
|
||||
static auto envelopeCursor =
|
||||
::MakeCursor(wxCURSOR_ARROW, EnvCursorXpm, 16, 16);
|
||||
// TODO: this message isn't appropriate for time track
|
||||
auto message = _("Click and drag to edit the amplitude envelope");
|
||||
|
||||
return {
|
||||
message,
|
||||
(unsafe
|
||||
? &*disabledCursor
|
||||
: &*envelopeCursor)
|
||||
};
|
||||
}
|
||||
|
||||
UIHandlePtr EnvelopeHandle::HitAnywhere
|
||||
(std::weak_ptr<EnvelopeHandle> &holder, Envelope *envelope)
|
||||
(std::weak_ptr<EnvelopeHandle> &holder, Envelope *envelope, bool timeTrack)
|
||||
{
|
||||
auto result = std::make_shared<EnvelopeHandle>( envelope );
|
||||
result->mTimeTrack = timeTrack;
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -96,7 +79,8 @@ UIHandlePtr EnvelopeHandle::TimeTrackHitTest
|
||||
float zoomMin, zoomMax;
|
||||
GetTimeTrackData( *pProject, *tt, dBRange, dB, zoomMin, zoomMax);
|
||||
return EnvelopeHandle::HitEnvelope
|
||||
(holder, state, rect, pProject, envelope, zoomMin, zoomMax, dB, dBRange);
|
||||
(holder, state, rect, pProject, envelope, zoomMin, zoomMax, dB, dBRange,
|
||||
true);
|
||||
}
|
||||
|
||||
UIHandlePtr EnvelopeHandle::WaveTrackHitTest
|
||||
@ -126,14 +110,14 @@ UIHandlePtr EnvelopeHandle::WaveTrackHitTest
|
||||
const float dBRange = wt->GetWaveformSettings().dBRange;
|
||||
|
||||
return EnvelopeHandle::HitEnvelope
|
||||
(holder, state, rect, pProject, envelope, zoomMin, zoomMax, dB, dBRange);
|
||||
(holder, state, rect, pProject, envelope, zoomMin, zoomMax, dB, dBRange, false);
|
||||
}
|
||||
|
||||
UIHandlePtr EnvelopeHandle::HitEnvelope
|
||||
(std::weak_ptr<EnvelopeHandle> &holder,
|
||||
const wxMouseState &state, const wxRect &rect, const AudacityProject *pProject,
|
||||
Envelope *envelope, float zoomMin, float zoomMax,
|
||||
bool dB, float dBRange)
|
||||
bool dB, float dBRange, bool timeTrack)
|
||||
{
|
||||
const ViewInfo &viewInfo = pProject->GetViewInfo();
|
||||
|
||||
@ -179,7 +163,7 @@ UIHandlePtr EnvelopeHandle::HitEnvelope
|
||||
if (distance >= yTolerance)
|
||||
return {};
|
||||
|
||||
return HitAnywhere(holder, envelope);
|
||||
return HitAnywhere(holder, envelope, timeTrack);
|
||||
}
|
||||
|
||||
UIHandle::Result EnvelopeHandle::Click
|
||||
@ -258,7 +242,23 @@ HitTestPreview EnvelopeHandle::Preview
|
||||
(const TrackPanelMouseState &, const AudacityProject *pProject)
|
||||
{
|
||||
const bool unsafe = pProject->IsAudioActive();
|
||||
return HitPreview(pProject, unsafe);
|
||||
static auto disabledCursor =
|
||||
::MakeCursor(wxCURSOR_NO_ENTRY, DisabledCursorXpm, 16, 16);
|
||||
static auto envelopeCursor =
|
||||
::MakeCursor(wxCURSOR_ARROW, EnvCursorXpm, 16, 16);
|
||||
|
||||
wxString message;
|
||||
if (mTimeTrack)
|
||||
message = _("Click and drag to warp playback time");
|
||||
else
|
||||
message = _("Click and drag to edit the amplitude envelope");
|
||||
|
||||
return {
|
||||
message,
|
||||
(unsafe
|
||||
? &*disabledCursor
|
||||
: &*envelopeCursor)
|
||||
};
|
||||
}
|
||||
|
||||
UIHandle::Result EnvelopeHandle::Release
|
||||
|
@ -28,15 +28,13 @@ class EnvelopeHandle final : public UIHandle
|
||||
{
|
||||
EnvelopeHandle(const EnvelopeHandle&) = delete;
|
||||
EnvelopeHandle &operator=(const EnvelopeHandle&) = delete;
|
||||
static HitTestPreview HitPreview
|
||||
(const AudacityProject *pProject, bool unsafe);
|
||||
|
||||
static UIHandlePtr HitEnvelope
|
||||
(std::weak_ptr<EnvelopeHandle> &holder,
|
||||
const wxMouseState &state, const wxRect &rect,
|
||||
const AudacityProject *pProject,
|
||||
Envelope *envelope, float zoomMin, float zoomMax,
|
||||
bool dB, float dBRange);
|
||||
bool dB, float dBRange, bool timeTrack);
|
||||
|
||||
public:
|
||||
explicit EnvelopeHandle( Envelope *pEnvelope );
|
||||
@ -44,7 +42,8 @@ public:
|
||||
virtual ~EnvelopeHandle();
|
||||
|
||||
static UIHandlePtr HitAnywhere
|
||||
(std::weak_ptr<EnvelopeHandle> &holder, Envelope *envelope);
|
||||
(std::weak_ptr<EnvelopeHandle> &holder, Envelope *envelope,
|
||||
bool timeTrack);
|
||||
static UIHandlePtr TimeTrackHitTest
|
||||
(std::weak_ptr<EnvelopeHandle> &holder,
|
||||
const wxMouseState &state, const wxRect &rect,
|
||||
@ -88,6 +87,8 @@ private:
|
||||
Envelope *mEnvelope{};
|
||||
std::unique_ptr<EnvelopeEditor> mEnvelopeEditor;
|
||||
std::unique_ptr<EnvelopeEditor> mEnvelopeEditorRight;
|
||||
|
||||
bool mTimeTrack{};
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user