1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-05-03 00:59:43 +02:00

Label track event handler does not directly use zoom (pps) values

This commit is contained in:
Paul-Licameli 2015-04-20 00:17:26 -04:00 committed by Paul Licameli
parent fe36b636cb
commit 1f9113f5cc
3 changed files with 8 additions and 7 deletions

View File

@ -1382,7 +1382,7 @@ static int Constrain( int value, int min, int max )
/// HandleMouse gets called with every mouse move or click.
///
bool LabelTrack::HandleMouse(const wxMouseEvent & evt,
wxRect & r, double h, double pps,
wxRect & r, const ZoomInfo &zoomInfo,
SelectedRegion *newSel)
{
if(evt.LeftUp())
@ -1454,7 +1454,7 @@ bool LabelTrack::HandleMouse(const wxMouseEvent & evt,
bool bLabelMoving = mbIsMoving;
bLabelMoving ^= evt.ShiftDown();
bLabelMoving |= mMouseOverLabelLeft==mMouseOverLabelRight;
double fNewX = h + x / pps;
double fNewX = zoomInfo.PositionToTime(x, 0);
if( bLabelMoving )
{
MayMoveLabel( mMouseOverLabelLeft, -1, fNewX );
@ -1552,7 +1552,7 @@ bool LabelTrack::HandleMouse(const wxMouseEvent & evt,
{
t = mLabels[mMouseOverLabelLeft]->getT0();
}
mxMouseDisplacement = (int)((((t-h) * pps) + r.x )-evt.m_x);
mxMouseDisplacement = zoomInfo.TimeToPosition(t, r.x) - evt.m_x;
return false;
}
@ -1584,7 +1584,7 @@ bool LabelTrack::HandleMouse(const wxMouseEvent & evt,
if (mSelIndex != -1) {
if (!OverTextBox(mLabels[mSelIndex], evt.m_x, evt.m_y))
mSelIndex = -1;
double t = h + (evt.m_x - r.x) / pps;
double t = zoomInfo.PositionToTime(evt.m_x, r.x);
*newSel = SelectedRegion(t, t);
}

View File

@ -36,6 +36,7 @@ class TrackList;
class AudacityProject;
class DirManager;
class TimeWarper;
class ZoomInfo;
class LabelStruct
@ -177,7 +178,7 @@ class AUDACITY_DLL_API LabelTrack : public Track
void SetWrongDragging(bool rightFlag) { mRightDragging = rightFlag; }
void SetDrawCursor(bool drawCursorFlag) { mDrawCursor = drawCursorFlag; }
bool HandleMouse(const wxMouseEvent & evt, wxRect & r, double h, double pps,
bool HandleMouse(const wxMouseEvent & evt, wxRect & r, const ZoomInfo &zoomInfo,
SelectedRegion *newSel);
bool CaptureKey(wxKeyEvent & event);

View File

@ -2750,7 +2750,7 @@ void TrackPanel::SelectionHandleClick(wxMouseEvent & event,
{
LabelTrack *lt = (LabelTrack *) pTrack;
if (lt->HandleMouse(event, r,//mCapturedRect,
mViewInfo->h, mViewInfo->zoom,
*mViewInfo,
&mViewInfo->selectedRegion)) {
MakeParentPushState(_("Modified Label"),
_("Label Edit"),
@ -6699,7 +6699,7 @@ bool TrackPanel::HandleLabelTrackMouseEvent(LabelTrack * lTrack, wxRect &r, wxMo
}
if (lTrack->HandleMouse(event, mCapturedRect,
mViewInfo->h, mViewInfo->zoom, &mViewInfo->selectedRegion)) {
*mViewInfo, &mViewInfo->selectedRegion)) {
MakeParentPushState(_("Modified Label"),
_("Label Edit"),