1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-07-26 17:38:10 +02:00

Bug 1484 - No ctrl-click toggling; History for anchor (mLastPickedTrack)

This commit is contained in:
James Crook 2016-10-04 09:05:47 +01:00
parent ea1015596c
commit 44375c252a

View File

@ -1914,29 +1914,36 @@ void TrackPanel::ChangeSelectionOnShiftClick(Track * pTrack){
// We will either extend from the first or from the last. // We will either extend from the first or from the last.
Track* pExtendFrom= nullptr; Track* pExtendFrom= nullptr;
TrackListIterator iter(GetTracks()); if( mLastPickedTrack ){
for (Track *t = iter.First(); t; t = iter.Next()) { pExtendFrom = mLastPickedTrack;
const bool isSelected = t->GetSelected(); }
// Record first and last selected. else
if( isSelected ){ {
if( !pFirst ) TrackListIterator iter(GetTracks());
pFirst = t; for (Track *t = iter.First(); t; t = iter.Next()) {
pLast = t; const bool isSelected = t->GetSelected();
} // Record first and last selected.
// If our track is at or after the first, extend from the first. if( isSelected ){
if( t == pTrack ){ if( !pFirst )
pExtendFrom = pFirst; pFirst = t;
} pLast = t;
}
// If our track is at or after the first, extend from the first.
if( t == pTrack ){
pExtendFrom = pFirst;
}
}
// Our track was earlier than the first. Extend from the last.
if( !pExtendFrom )
pExtendFrom = pLast;
} }
// Our track was earlier than the first. Extend from the last.
if( !pExtendFrom )
pExtendFrom = pLast;
SelectNone(); SelectNone();
if( pExtendFrom ) if( pExtendFrom )
SelectRangeOfTracks(pTrack, pExtendFrom); SelectRangeOfTracks(pTrack, pExtendFrom);
else else
SelectTrack( pTrack, true ); SelectTrack( pTrack, true );
mLastPickedTrack = pExtendFrom;
} }
/// This method gets called when we're handling selection /// This method gets called when we're handling selection
@ -1986,13 +1993,13 @@ void TrackPanel::SelectionHandleClick(wxMouseEvent & event,
if( bShiftDown ) if( bShiftDown )
ChangeSelectionOnShiftClick( pTrack ); ChangeSelectionOnShiftClick( pTrack );
if( bCtrlDown ){ if( bCtrlDown ){
bool bIsSelected = pTrack->GetSelected(); //Commented out bIsSelected toggles, as in Track Control Panel.
//bool bIsSelected = true; //bool bIsSelected = pTrack->GetSelected();
// could set bIsSelected true here, but toggling is more technically correct. //Actual bIsSelected will always add.
// if we want to match behaviour in Track Control Panel. bool bIsSelected = false;
// Don't toggle away the last selected track. // Don't toggle away the last selected track.
if( !bIsSelected || GetSelectedTrackCount() > 1 ) if( !bIsSelected || GetSelectedTrackCount() > 1 )
SelectTrack( pTrack, !bIsSelected, false ); SelectTrack( pTrack, !bIsSelected, true );
} }
double value; double value;