mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-18 17:10:05 +02:00
Label track event handler does not directly use zoom (pps) values
This commit is contained in:
parent
fe36b636cb
commit
1f9113f5cc
@ -1382,7 +1382,7 @@ static int Constrain( int value, int min, int max )
|
|||||||
/// HandleMouse gets called with every mouse move or click.
|
/// HandleMouse gets called with every mouse move or click.
|
||||||
///
|
///
|
||||||
bool LabelTrack::HandleMouse(const wxMouseEvent & evt,
|
bool LabelTrack::HandleMouse(const wxMouseEvent & evt,
|
||||||
wxRect & r, double h, double pps,
|
wxRect & r, const ZoomInfo &zoomInfo,
|
||||||
SelectedRegion *newSel)
|
SelectedRegion *newSel)
|
||||||
{
|
{
|
||||||
if(evt.LeftUp())
|
if(evt.LeftUp())
|
||||||
@ -1454,7 +1454,7 @@ bool LabelTrack::HandleMouse(const wxMouseEvent & evt,
|
|||||||
bool bLabelMoving = mbIsMoving;
|
bool bLabelMoving = mbIsMoving;
|
||||||
bLabelMoving ^= evt.ShiftDown();
|
bLabelMoving ^= evt.ShiftDown();
|
||||||
bLabelMoving |= mMouseOverLabelLeft==mMouseOverLabelRight;
|
bLabelMoving |= mMouseOverLabelLeft==mMouseOverLabelRight;
|
||||||
double fNewX = h + x / pps;
|
double fNewX = zoomInfo.PositionToTime(x, 0);
|
||||||
if( bLabelMoving )
|
if( bLabelMoving )
|
||||||
{
|
{
|
||||||
MayMoveLabel( mMouseOverLabelLeft, -1, fNewX );
|
MayMoveLabel( mMouseOverLabelLeft, -1, fNewX );
|
||||||
@ -1552,7 +1552,7 @@ bool LabelTrack::HandleMouse(const wxMouseEvent & evt,
|
|||||||
{
|
{
|
||||||
t = mLabels[mMouseOverLabelLeft]->getT0();
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1584,7 +1584,7 @@ bool LabelTrack::HandleMouse(const wxMouseEvent & evt,
|
|||||||
if (mSelIndex != -1) {
|
if (mSelIndex != -1) {
|
||||||
if (!OverTextBox(mLabels[mSelIndex], evt.m_x, evt.m_y))
|
if (!OverTextBox(mLabels[mSelIndex], evt.m_x, evt.m_y))
|
||||||
mSelIndex = -1;
|
mSelIndex = -1;
|
||||||
double t = h + (evt.m_x - r.x) / pps;
|
double t = zoomInfo.PositionToTime(evt.m_x, r.x);
|
||||||
*newSel = SelectedRegion(t, t);
|
*newSel = SelectedRegion(t, t);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,6 +36,7 @@ class TrackList;
|
|||||||
class AudacityProject;
|
class AudacityProject;
|
||||||
class DirManager;
|
class DirManager;
|
||||||
class TimeWarper;
|
class TimeWarper;
|
||||||
|
class ZoomInfo;
|
||||||
|
|
||||||
|
|
||||||
class LabelStruct
|
class LabelStruct
|
||||||
@ -177,7 +178,7 @@ class AUDACITY_DLL_API LabelTrack : public Track
|
|||||||
void SetWrongDragging(bool rightFlag) { mRightDragging = rightFlag; }
|
void SetWrongDragging(bool rightFlag) { mRightDragging = rightFlag; }
|
||||||
void SetDrawCursor(bool drawCursorFlag) { mDrawCursor = drawCursorFlag; }
|
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);
|
SelectedRegion *newSel);
|
||||||
|
|
||||||
bool CaptureKey(wxKeyEvent & event);
|
bool CaptureKey(wxKeyEvent & event);
|
||||||
|
@ -2750,7 +2750,7 @@ void TrackPanel::SelectionHandleClick(wxMouseEvent & event,
|
|||||||
{
|
{
|
||||||
LabelTrack *lt = (LabelTrack *) pTrack;
|
LabelTrack *lt = (LabelTrack *) pTrack;
|
||||||
if (lt->HandleMouse(event, r,//mCapturedRect,
|
if (lt->HandleMouse(event, r,//mCapturedRect,
|
||||||
mViewInfo->h, mViewInfo->zoom,
|
*mViewInfo,
|
||||||
&mViewInfo->selectedRegion)) {
|
&mViewInfo->selectedRegion)) {
|
||||||
MakeParentPushState(_("Modified Label"),
|
MakeParentPushState(_("Modified Label"),
|
||||||
_("Label Edit"),
|
_("Label Edit"),
|
||||||
@ -6699,7 +6699,7 @@ bool TrackPanel::HandleLabelTrackMouseEvent(LabelTrack * lTrack, wxRect &r, wxMo
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (lTrack->HandleMouse(event, mCapturedRect,
|
if (lTrack->HandleMouse(event, mCapturedRect,
|
||||||
mViewInfo->h, mViewInfo->zoom, &mViewInfo->selectedRegion)) {
|
*mViewInfo, &mViewInfo->selectedRegion)) {
|
||||||
|
|
||||||
MakeParentPushState(_("Modified Label"),
|
MakeParentPushState(_("Modified Label"),
|
||||||
_("Label Edit"),
|
_("Label Edit"),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user