From d153afb11c7dca4020eab7a9fe6b170a16c60fa6 Mon Sep 17 00:00:00 2001 From: James Crook Date: Tue, 27 Mar 2018 22:23:43 +0100 Subject: [PATCH] Allow SetLabel to make a selection too. The 'Selected' option previously only selected the text. --- src/commands/SetLabelCommand.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/commands/SetLabelCommand.cpp b/src/commands/SetLabelCommand.cpp index 2c2d12772..d269c304a 100644 --- a/src/commands/SetLabelCommand.cpp +++ b/src/commands/SetLabelCommand.cpp @@ -65,6 +65,7 @@ bool SetLabelCommand::Apply(const CommandContext & context) // this code could be put in subroutines/reduced. //wxString mode = GetString(wxT("Type")); + AudacityProject * p = context.GetProject(); TrackList *tracks = context.GetProject()->GetTracks(); TrackListIterator iter(tracks); Track *t = iter.First(); @@ -107,7 +108,12 @@ bool SetLabelCommand::Apply(const CommandContext & context) // Only one label can be selected. if( bHasSelected ){ if( mbSelected ) + { labelTrack->mSelIndex = nn-1; + double t0 = pLabel->selectedRegion.t0(); + double t1 = pLabel->selectedRegion.t1(); + p->mViewInfo.selectedRegion.setTimes( t0, t1); + } else if( labelTrack->mSelIndex == (nn-1) ) labelTrack->mSelIndex = -1; }