mirror of
https://github.com/cookiengineer/audacity
synced 2025-11-03 07:33:49 +01:00
Remove some unnecessary tests of WaveTrack::GetDisplay()...
... trust the hit-tests of the views to guarantee these conditions
This commit is contained in:
@@ -120,10 +120,6 @@ UIHandlePtr SampleHandle::HitTest
|
|||||||
/// editable sample
|
/// editable sample
|
||||||
const auto wavetrack = pTrack.get();
|
const auto wavetrack = pTrack.get();
|
||||||
|
|
||||||
const int displayType = wavetrack->GetDisplay();
|
|
||||||
if (WaveTrackViewConstants::Waveform != displayType)
|
|
||||||
return {}; // Not a wave, so return.
|
|
||||||
|
|
||||||
const double tt =
|
const double tt =
|
||||||
adjustTime(wavetrack, viewInfo.PositionToTime(state.m_x, rect.x));
|
adjustTime(wavetrack, viewInfo.PositionToTime(state.m_x, rect.x));
|
||||||
if (!SampleResolutionTest(viewInfo, wavetrack, tt, rect.width))
|
if (!SampleResolutionTest(viewInfo, wavetrack, tt, rect.width))
|
||||||
@@ -178,17 +174,6 @@ namespace {
|
|||||||
(const wxMouseEvent &event,
|
(const wxMouseEvent &event,
|
||||||
const wxRect &rect, const ViewInfo &viewInfo, WaveTrack *wt, int width)
|
const wxRect &rect, const ViewInfo &viewInfo, WaveTrack *wt, int width)
|
||||||
{
|
{
|
||||||
//Get out of here if we shouldn't be drawing right now:
|
|
||||||
//If we aren't displaying the waveform, Display a message dialog
|
|
||||||
const int display = wt->GetDisplay();
|
|
||||||
if (WaveTrackViewConstants::Waveform != display)
|
|
||||||
{
|
|
||||||
AudacityMessageBox(_(
|
|
||||||
"To use Draw, choose 'Waveform' or 'Waveform (dB)' in the Track Dropdown Menu."),
|
|
||||||
_("Draw Tool"));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
//If we aren't zoomed in far enough, show a message dialog.
|
//If we aren't zoomed in far enough, show a message dialog.
|
||||||
const double time = adjustTime(wt, viewInfo.PositionToTime(event.m_x, rect.x));
|
const double time = adjustTime(wt, viewInfo.PositionToTime(event.m_x, rect.x));
|
||||||
if (!SampleResolutionTest(viewInfo, wt, time, width))
|
if (!SampleResolutionTest(viewInfo, wt, time, width))
|
||||||
|
|||||||
@@ -98,12 +98,6 @@ UIHandlePtr EnvelopeHandle::WaveTrackHitTest
|
|||||||
if (!envelope)
|
if (!envelope)
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
const int displayType = wt->GetDisplay();
|
|
||||||
// Not an envelope hit, unless we're using a type of wavetrack display
|
|
||||||
// suitable for envelopes operations, ie one of the Wave displays.
|
|
||||||
if (displayType != WaveTrackViewConstants::Waveform)
|
|
||||||
return {}; // No envelope, not a hit, so return.
|
|
||||||
|
|
||||||
// Get envelope point, range 0.0 to 1.0
|
// Get envelope point, range 0.0 to 1.0
|
||||||
const bool dB = !wt->GetWaveformSettings().isLinear();
|
const bool dB = !wt->GetWaveformSettings().isLinear();
|
||||||
|
|
||||||
@@ -188,9 +182,6 @@ UIHandle::Result EnvelopeHandle::Click
|
|||||||
if (pTrack)
|
if (pTrack)
|
||||||
result = pTrack->TypeSwitch< decltype(RefreshNone) >(
|
result = pTrack->TypeSwitch< decltype(RefreshNone) >(
|
||||||
[&](WaveTrack *wt) {
|
[&](WaveTrack *wt) {
|
||||||
if (wt->GetDisplay() != WaveTrackViewConstants::Waveform)
|
|
||||||
return Cancelled;
|
|
||||||
|
|
||||||
if (!mEnvelope)
|
if (!mEnvelope)
|
||||||
return Cancelled;
|
return Cancelled;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user