mirror of
https://github.com/cookiengineer/audacity
synced 2025-05-03 00:59:43 +02:00
pull out a function for vertical ruler wheel events
This commit is contained in:
parent
2e83a7e5a2
commit
5697f77a06
@ -6154,47 +6154,7 @@ void TrackPanel::HandleWheelRotation(wxMouseEvent & event)
|
||||
wxRect rect;
|
||||
Track *const pTrack = FindTrack(event.m_x, event.m_y, true, false, &rect);
|
||||
if (pTrack && event.m_x >= GetVRulerOffset()) {
|
||||
if (pTrack->GetKind() == Track::Wave) {
|
||||
WaveTrack *const wt = static_cast<WaveTrack*>(pTrack);
|
||||
if (event.CmdDown() &&
|
||||
wt->GetWaveformSettings().scaleType == WaveformSettings::stLogarithmic) {
|
||||
// Vary the bottom of the dB scale, but only if the midline is visible
|
||||
float min, max;
|
||||
wt->GetDisplayBounds(&min, &max);
|
||||
if (min < 0.0 && max > 0.0) {
|
||||
WaveformSettings &settings = wt->GetIndependentWaveformSettings();
|
||||
if (event.m_wheelRotation < 0)
|
||||
// Zoom out
|
||||
settings.NextLowerDBRange();
|
||||
else
|
||||
settings.NextHigherDBRange();
|
||||
|
||||
WaveTrack *const partner = static_cast<WaveTrack*>(wt->GetLink());
|
||||
if (partner) {
|
||||
WaveformSettings &settings = partner->GetIndependentWaveformSettings();
|
||||
if (event.m_wheelRotation < 0)
|
||||
// Zoom out
|
||||
settings.NextLowerDBRange();
|
||||
else
|
||||
settings.NextHigherDBRange();
|
||||
}
|
||||
}
|
||||
else
|
||||
return;
|
||||
}
|
||||
else {
|
||||
HandleWaveTrackVZoom(
|
||||
mTracks, rect, event.m_y, event.m_y,
|
||||
wt, false, (event.m_wheelRotation < 0),
|
||||
true);
|
||||
}
|
||||
UpdateVRuler(pTrack);
|
||||
Refresh(false);
|
||||
MakeParentModifyState(true);
|
||||
}
|
||||
else {
|
||||
// To do: time track? Note track?
|
||||
}
|
||||
HandleWheelRotationInVRuler(event, pTrack, rect);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -6302,6 +6262,53 @@ void TrackPanel::HandleWheelRotation(wxMouseEvent & event)
|
||||
}
|
||||
}
|
||||
|
||||
void TrackPanel::HandleWheelRotationInVRuler
|
||||
(wxMouseEvent &event, Track *pTrack, const wxRect &rect)
|
||||
{
|
||||
if (pTrack->GetKind() == Track::Wave) {
|
||||
WaveTrack *const wt = static_cast<WaveTrack*>(pTrack);
|
||||
if (event.CmdDown() &&
|
||||
wt->GetWaveformSettings().scaleType == WaveformSettings::stLogarithmic) {
|
||||
// Vary the bottom of the dB scale, but only if the midline is visible
|
||||
float min, max;
|
||||
wt->GetDisplayBounds(&min, &max);
|
||||
if (min < 0.0 && max > 0.0) {
|
||||
WaveformSettings &settings = wt->GetIndependentWaveformSettings();
|
||||
if (event.m_wheelRotation < 0)
|
||||
// Zoom out
|
||||
settings.NextLowerDBRange();
|
||||
else
|
||||
settings.NextHigherDBRange();
|
||||
|
||||
WaveTrack *const partner = static_cast<WaveTrack*>(wt->GetLink());
|
||||
if (partner) {
|
||||
WaveformSettings &settings = partner->GetIndependentWaveformSettings();
|
||||
if (event.m_wheelRotation < 0)
|
||||
// Zoom out
|
||||
settings.NextLowerDBRange();
|
||||
else
|
||||
settings.NextHigherDBRange();
|
||||
}
|
||||
}
|
||||
else
|
||||
return;
|
||||
}
|
||||
else {
|
||||
HandleWaveTrackVZoom(
|
||||
mTracks, rect, event.m_y, event.m_y,
|
||||
wt, false, (event.m_wheelRotation < 0),
|
||||
true);
|
||||
}
|
||||
UpdateVRuler(pTrack);
|
||||
Refresh(false);
|
||||
MakeParentModifyState(true);
|
||||
}
|
||||
else {
|
||||
// To do: time track? Note track?
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/// Filter captured keys typed into LabelTracks.
|
||||
void TrackPanel::OnCaptureKey(wxCommandEvent & event)
|
||||
{
|
||||
|
@ -437,6 +437,8 @@ protected:
|
||||
|
||||
// MM: Handle mouse wheel rotation
|
||||
virtual void HandleWheelRotation(wxMouseEvent & event);
|
||||
virtual void HandleWheelRotationInVRuler
|
||||
(wxMouseEvent &event, Track *pTrack, const wxRect &rect);
|
||||
|
||||
// Handle resizing.
|
||||
virtual void HandleResizeClick(wxMouseEvent & event);
|
||||
|
Loading…
x
Reference in New Issue
Block a user