diff --git a/src/LabelTrack.cpp b/src/LabelTrack.cpp index f5604c7d6..2741d55ee 100644 --- a/src/LabelTrack.cpp +++ b/src/LabelTrack.cpp @@ -33,8 +33,6 @@ for drawing different aspects of the label and its text box. #include "Experimental.h" -#include "tracks/labeltrack/ui/LabelTrackView.h" - #include #include #include @@ -475,12 +473,6 @@ auto LabelStruct::RegionRelation( } } -bool LabelTrack::HasSelection() const -{ - const auto selIndex = LabelTrackView::Get( *this ).GetSelectedIndex(); - return (selIndex >= 0 && selIndex < (int)mLabels.size()); -} - /// Export labels including label start and end-times. void LabelTrack::Export(wxTextFile & f) const { diff --git a/src/LabelTrack.h b/src/LabelTrack.h index 900a52ddb..47f9c9a36 100644 --- a/src/LabelTrack.h +++ b/src/LabelTrack.h @@ -127,9 +127,6 @@ public: void Import(wxTextFile & f); void Export(wxTextFile & f) const; - // Whether any label box is selected -- not, whether the track is selected. - bool HasSelection() const; - int GetNumLabels() const; const LabelStruct *GetLabel(int index) const; const LabelArray &GetLabels() const { return mLabels; } diff --git a/src/menus/EditMenus.cpp b/src/menus/EditMenus.cpp index ad74120da..8134a8ca9 100644 --- a/src/menus/EditMenus.cpp +++ b/src/menus/EditMenus.cpp @@ -47,7 +47,7 @@ bool DoPasteText(AudacityProject &project) for (auto pLabelTrack : tracks.Any()) { // Does this track have an active label? - if (pLabelTrack->HasSelection()) { + if (LabelTrackView::Get( *pLabelTrack ).HasSelection()) { // Yes, so try pasting into it auto &view = LabelTrackView::Get( *pLabelTrack ); diff --git a/src/tracks/labeltrack/ui/LabelGlyphHandle.cpp b/src/tracks/labeltrack/ui/LabelGlyphHandle.cpp index 85c7d7568..cfb5cdc8e 100644 --- a/src/tracks/labeltrack/ui/LabelGlyphHandle.cpp +++ b/src/tracks/labeltrack/ui/LabelGlyphHandle.cpp @@ -333,9 +333,10 @@ bool LabelGlyphHandle::HandleGlyphDragRelease MayAdjustLabel( hit, hit.mMouseOverLabelRight, +1, bAllowSwapping, fNewX ); } - if( pTrack->HasSelection() ) + const auto &view = LabelTrackView::Get( *pTrack ); + if( view.HasSelection() ) { - auto selIndex = LabelTrackView::Get( *pTrack ).GetSelectedIndex(); + auto selIndex = view.GetSelectedIndex(); //Set the selection region to be equal to //the NEW size of the label. *newSel = mLabels[ selIndex ].selectedRegion;