1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-07-16 00:27:42 +02:00

Bug1078: click and drag at the bottom of a stereo track control can resize it...

... just as it does for unlinked tracks.
This commit is contained in:
Paul Licameli 2015-07-13 09:00:56 -04:00
parent 0b711e1594
commit e553837832

View File

@ -5801,22 +5801,22 @@ bool TrackPanel::PopupFunc(Track * t, wxRect r, int x, int y)
/// update the track size. /// update the track size.
void TrackPanel::HandleResizeClick( wxMouseEvent & event ) void TrackPanel::HandleResizeClick( wxMouseEvent & event )
{ {
wxRect r; wxRect rTrack;
wxRect rLabel; wxRect rLabel;
// DM: Figure out what track is about to be resized // DM: Figure out what track is about to be resized
Track *t = FindTrack(event.m_x, event.m_y, false, false, &r); Track *track = FindTrack(event.m_x, event.m_y, false, false, &rTrack);
Track *label = FindTrack(event.m_x, event.m_y, true, true, &rLabel);
// If the click is at the bottom of a non-linked track label, we if (!track) {
// treat it as a normal resize. If the label is of a linked track, // This will only return unlinked tracks or left channels of stereo tracks
// we ignore the click. // or NULL:
track = FindTrack(event.m_x, event.m_y, true, true, &rLabel);
if (label && !label->GetLinked()) { // If stereo, get the right channel.
t = label; if (track && track->GetLinked())
track = track->GetLink();
} }
if (!t) { if (!track) {
return; return;
} }
@ -5865,34 +5865,34 @@ void TrackPanel::HandleResizeClick( wxMouseEvent & event )
} }
} }
#else // EXPERIMENTAL_OUTPUT_DISPLAY #else // EXPERIMENTAL_OUTPUT_DISPLAY
Track *prev = mTracks->GetPrev(t); Track *prev = mTracks->GetPrev(track);
Track *next = mTracks->GetNext(t); Track *next = mTracks->GetNext(track);
//STM: Determine whether we should rescale one or two tracks //STM: Determine whether we should rescale one or two tracks
if (prev && prev->GetLink() == t) { if (prev && prev->GetLink() == track) {
// mCapturedTrack is the lower track // mCapturedTrack is the lower track
mInitialTrackHeight = t->GetHeight(); mInitialTrackHeight = track->GetHeight();
mInitialActualHeight = t->GetActualHeight(); mInitialActualHeight = track->GetActualHeight();
mInitialMinimized = t->GetMinimized(); mInitialMinimized = track->GetMinimized();
mInitialUpperTrackHeight = prev->GetHeight(); mInitialUpperTrackHeight = prev->GetHeight();
mInitialUpperActualHeight = prev->GetActualHeight(); mInitialUpperActualHeight = prev->GetActualHeight();
SetCapturedTrack(t, IsResizingBelowLinkedTracks); SetCapturedTrack(track, IsResizingBelowLinkedTracks);
} }
else if (next && t->GetLink() == next) { else if (next && track->GetLink() == next) {
// mCapturedTrack is the upper track // mCapturedTrack is the upper track
mInitialTrackHeight = next->GetHeight(); mInitialTrackHeight = next->GetHeight();
mInitialActualHeight = next->GetActualHeight(); mInitialActualHeight = next->GetActualHeight();
mInitialMinimized = next->GetMinimized(); mInitialMinimized = next->GetMinimized();
mInitialUpperTrackHeight = t->GetHeight(); mInitialUpperTrackHeight = track->GetHeight();
mInitialUpperActualHeight = t->GetActualHeight(); mInitialUpperActualHeight = track->GetActualHeight();
SetCapturedTrack(t, IsResizingBetweenLinkedTracks); SetCapturedTrack(track, IsResizingBetweenLinkedTracks);
} }
else { else {
// DM: Save the initial mouse location and the initial height // DM: Save the initial mouse location and the initial height
mInitialTrackHeight = t->GetHeight(); mInitialTrackHeight = track->GetHeight();
mInitialActualHeight = t->GetActualHeight(); mInitialActualHeight = track->GetActualHeight();
mInitialMinimized = t->GetMinimized(); mInitialMinimized = track->GetMinimized();
SetCapturedTrack(t, IsResizing); SetCapturedTrack(track, IsResizing);
} }
#endif // EXPERIMENTAL_OUTPUT_DISPLAY #endif // EXPERIMENTAL_OUTPUT_DISPLAY
} }