1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-11-23 17:30:17 +01:00

Move declarations again, to LabelGlyphHandle; remove a friend

This commit is contained in:
Paul Licameli
2018-11-09 08:10:16 -05:00
parent 5eb5e24ab0
commit 6af9187003
4 changed files with 34 additions and 29 deletions

View File

@@ -1525,13 +1525,13 @@ auto LabelStruct::RegionRelation(
/// @iEdge - which edge is requested to move, -1 for left +1 for right.
/// @bAllowSwapping - if we can switch which edge is being dragged.
/// fNewTime - the NEW time for this edge of the label.
void LabelTrackView::MayAdjustLabel
void LabelGlyphHandle::MayAdjustLabel
( LabelTrackHit &hit, int iLabel, int iEdge, bool bAllowSwapping, double fNewTime)
{
if( iLabel < 0 )
return;
const auto pTrack = FindLabelTrack();
const auto pTrack = mpLT;
const auto &mLabels = pTrack->GetLabels();
auto labelStruct = mLabels[ iLabel ];
@@ -1559,12 +1559,12 @@ void LabelTrackView::MayAdjustLabel
}
// If the index is for a real label, adjust its left and right boundary.
void LabelTrackView::MayMoveLabel( int iLabel, int iEdge, double fNewTime)
void LabelGlyphHandle::MayMoveLabel( int iLabel, int iEdge, double fNewTime)
{
if( iLabel < 0 )
return;
const auto pTrack = FindLabelTrack();
const auto pTrack = mpLT;
const auto &mLabels = pTrack->GetLabels();
auto labelStruct = mLabels[ iLabel ];
labelStruct.MoveLabel( iEdge, fNewTime );
@@ -1584,12 +1584,12 @@ static int Constrain( int value, int min, int max )
return result;
}
bool LabelTrackView::HandleGlyphDragRelease
bool LabelGlyphHandle::HandleGlyphDragRelease
(LabelTrackHit &hit, const wxMouseEvent & evt,
wxRect & r, const ZoomInfo &zoomInfo,
SelectedRegion *newSel)
{
const auto pTrack = FindLabelTrack();
const auto pTrack = mpLT;
const auto &mLabels = pTrack->GetLabels();
if(evt.LeftUp())
{
@@ -1643,11 +1643,12 @@ bool LabelTrackView::HandleGlyphDragRelease
MayAdjustLabel( hit, hit.mMouseOverLabelRight, +1, bAllowSwapping, fNewX );
}
if( HasSelection() )
if( pTrack->HasSelection() )
{
auto selIndex = LabelTrackView::Get( *pTrack ).GetSelectedIndex();
//Set the selection region to be equal to
//the NEW size of the label.
*newSel = mLabels[mSelIndex].selectedRegion;
*newSel = mLabels[ selIndex ].selectedRegion;
}
pTrack->SortLabels();
}
@@ -1701,7 +1702,7 @@ void LabelTrackView::HandleTextDragRelease(const wxMouseEvent & evt)
return;
}
void LabelTrackView::HandleGlyphClick
void LabelGlyphHandle::HandleGlyphClick
(LabelTrackHit &hit, const wxMouseEvent & evt,
const wxRect & r, const ZoomInfo &zoomInfo,
SelectedRegion *WXUNUSED(newSel))
@@ -1709,8 +1710,8 @@ void LabelTrackView::HandleGlyphClick
if (evt.ButtonDown())
{
//OverGlyph sets mMouseOverLabel to be the chosen label.
const auto pTrack = FindLabelTrack();
OverGlyph(*pTrack, hit, evt.m_x, evt.m_y);
const auto pTrack = mpLT;
LabelTrackView::OverGlyph(*pTrack, hit, evt.m_x, evt.m_y);
hit.mIsAdjustingLabel = evt.Button(wxMOUSE_BTN_LEFT) &&
( hit.mEdge & 3 ) != 0;