1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-09-17 16:50:26 +02:00

Remove some unnecessary tests of WaveTrack::GetDisplay()...

... trust the hit-tests of the views to guarantee these conditions
This commit is contained in:
Paul Licameli 2019-07-07 21:24:20 -04:00
parent 3715c079b4
commit 99a1e5a11d
2 changed files with 0 additions and 24 deletions

View File

@ -120,10 +120,6 @@ UIHandlePtr SampleHandle::HitTest
/// editable sample
const auto wavetrack = pTrack.get();
const int displayType = wavetrack->GetDisplay();
if (WaveTrackViewConstants::Waveform != displayType)
return {}; // Not a wave, so return.
const double tt =
adjustTime(wavetrack, viewInfo.PositionToTime(state.m_x, rect.x));
if (!SampleResolutionTest(viewInfo, wavetrack, tt, rect.width))
@ -178,17 +174,6 @@ namespace {
(const wxMouseEvent &event,
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.
const double time = adjustTime(wt, viewInfo.PositionToTime(event.m_x, rect.x));
if (!SampleResolutionTest(viewInfo, wt, time, width))

View File

@ -98,12 +98,6 @@ UIHandlePtr EnvelopeHandle::WaveTrackHitTest
if (!envelope)
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
const bool dB = !wt->GetWaveformSettings().isLinear();
@ -188,9 +182,6 @@ UIHandle::Result EnvelopeHandle::Click
if (pTrack)
result = pTrack->TypeSwitch< decltype(RefreshNone) >(
[&](WaveTrack *wt) {
if (wt->GetDisplay() != WaveTrackViewConstants::Waveform)
return Cancelled;
if (!mEnvelope)
return Cancelled;