mirror of
https://github.com/cookiengineer/audacity
synced 2025-08-16 08:34:10 +02:00
Fix for http://bugzilla.audacityteam.org/show_bug.cgi?id=792 "Right end of selection cannot be adjusted with a mouse when left end is behind zero" by Paul Licameli.
This commit is contained in:
parent
fe722df653
commit
30500b2e85
@ -581,6 +581,9 @@ TrackPanel::TrackPanel(wxWindow * parent, wxWindowID id,
|
|||||||
|
|
||||||
mLastF0 = mLastF1 = SelectedRegion::UndefinedFrequency;
|
mLastF0 = mLastF1 = SelectedRegion::UndefinedFrequency;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
mSelStartValid = false;
|
||||||
|
mSelStart = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
TrackPanel::~TrackPanel()
|
TrackPanel::~TrackPanel()
|
||||||
@ -1684,7 +1687,7 @@ void TrackPanel::HandleCenterFrequencyClick
|
|||||||
{
|
{
|
||||||
if (shiftDown) {
|
if (shiftDown) {
|
||||||
// Disable time selection
|
// Disable time selection
|
||||||
mSelStart = -1;
|
mSelStartValid = false;
|
||||||
mFreqSelTrack = static_cast<WaveTrack*>(pTrack);
|
mFreqSelTrack = static_cast<WaveTrack*>(pTrack);
|
||||||
mFreqSelPin = value;
|
mFreqSelPin = value;
|
||||||
mFreqSelMode = FREQ_SEL_DRAG_CENTER;
|
mFreqSelMode = FREQ_SEL_DRAG_CENTER;
|
||||||
@ -1696,7 +1699,7 @@ void TrackPanel::HandleCenterFrequencyClick
|
|||||||
// Turn center snapping on (the only way to do this)
|
// Turn center snapping on (the only way to do this)
|
||||||
mFreqSelMode = FREQ_SEL_SNAPPING_CENTER;
|
mFreqSelMode = FREQ_SEL_SNAPPING_CENTER;
|
||||||
// Disable time selection
|
// Disable time selection
|
||||||
mSelStart = -1;
|
mSelStartValid = false;
|
||||||
StartSnappingFreqSelection(wt);
|
StartSnappingFreqSelection(wt);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -2126,6 +2129,7 @@ void TrackPanel::SelectionHandleClick(wxMouseEvent & event,
|
|||||||
// (also exit frequency snapping)
|
// (also exit frequency snapping)
|
||||||
mFreqSelMode = FREQ_SEL_INVALID;
|
mFreqSelMode = FREQ_SEL_INVALID;
|
||||||
#endif
|
#endif
|
||||||
|
mSelStartValid = true;
|
||||||
mSelStart = value;
|
mSelStart = value;
|
||||||
ExtendSelection(event.m_x, r.x, pTrack);
|
ExtendSelection(event.m_x, r.x, pTrack);
|
||||||
break;
|
break;
|
||||||
@ -2141,7 +2145,7 @@ void TrackPanel::SelectionHandleClick(wxMouseEvent & event,
|
|||||||
? FREQ_SEL_BOTTOM_FREE : FREQ_SEL_TOP_FREE;
|
? FREQ_SEL_BOTTOM_FREE : FREQ_SEL_TOP_FREE;
|
||||||
|
|
||||||
// Drag frequency only, not time:
|
// Drag frequency only, not time:
|
||||||
mSelStart = -1;
|
mSelStartValid = false;
|
||||||
ExtendFreqSelection(event.m_y, r.y, r.height);
|
ExtendFreqSelection(event.m_y, r.y, r.height);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -2218,7 +2222,7 @@ void TrackPanel::SelectionHandleClick(wxMouseEvent & event,
|
|||||||
mFreqSelTrack = static_cast<WaveTrack*>(pTrack);
|
mFreqSelTrack = static_cast<WaveTrack*>(pTrack);
|
||||||
mFreqSelPin = mViewInfo->selectedRegion.fc();
|
mFreqSelPin = mViewInfo->selectedRegion.fc();
|
||||||
// Do not adjust time boundaries
|
// Do not adjust time boundaries
|
||||||
mSelStart = -1;
|
mSelStartValid = false;
|
||||||
ExtendFreqSelection(event.m_y, r.y, r.height);
|
ExtendFreqSelection(event.m_y, r.y, r.height);
|
||||||
UpdateSelectionDisplay();
|
UpdateSelectionDisplay();
|
||||||
// Frequency selection doesn't persist (yet?), so skip this:
|
// Frequency selection doesn't persist (yet?), so skip this:
|
||||||
@ -2244,6 +2248,7 @@ void TrackPanel::SelectionHandleClick(wxMouseEvent & event,
|
|||||||
// Disable frequency selection
|
// Disable frequency selection
|
||||||
mFreqSelMode = FREQ_SEL_INVALID;
|
mFreqSelMode = FREQ_SEL_INVALID;
|
||||||
#endif
|
#endif
|
||||||
|
mSelStartValid = true;
|
||||||
mSelStart = value;
|
mSelStart = value;
|
||||||
break;
|
break;
|
||||||
#ifdef EXPERIMENTAL_SPECTRAL_EDITING
|
#ifdef EXPERIMENTAL_SPECTRAL_EDITING
|
||||||
@ -2252,7 +2257,7 @@ void TrackPanel::SelectionHandleClick(wxMouseEvent & event,
|
|||||||
case SBWidth:
|
case SBWidth:
|
||||||
startNewSelection = false;
|
startNewSelection = false;
|
||||||
// Disable time selection
|
// Disable time selection
|
||||||
mSelStart = -1;
|
mSelStartValid = false;
|
||||||
mFreqSelTrack = static_cast<const WaveTrack*>(pTrack);
|
mFreqSelTrack = static_cast<const WaveTrack*>(pTrack);
|
||||||
mFreqSelPin = value;
|
mFreqSelPin = value;
|
||||||
mFreqSelMode =
|
mFreqSelMode =
|
||||||
@ -2310,6 +2315,7 @@ void TrackPanel::SelectionHandleClick(wxMouseEvent & event,
|
|||||||
|
|
||||||
if (startNewSelection) { // mouse is not at an edge, but after
|
if (startNewSelection) { // mouse is not at an edge, but after
|
||||||
// quantization, we could be indicating the selection edge
|
// quantization, we could be indicating the selection edge
|
||||||
|
mSelStartValid = true;
|
||||||
mSelStart = PositionToTime(event.m_x, r.x);
|
mSelStart = PositionToTime(event.m_x, r.x);
|
||||||
mStretchStart = nt->NearestBeatTime(mSelStart, ¢erBeat);
|
mStretchStart = nt->NearestBeatTime(mSelStart, ¢erBeat);
|
||||||
if (within(qBeat0, centerBeat, 0.1)) {
|
if (within(qBeat0, centerBeat, 0.1)) {
|
||||||
@ -2335,7 +2341,7 @@ void TrackPanel::SelectionHandleClick(wxMouseEvent & event,
|
|||||||
mStretchMode = stretchCenter;
|
mStretchMode = stretchCenter;
|
||||||
mStretchLeftBeats = qBeat1 - centerBeat;
|
mStretchLeftBeats = qBeat1 - centerBeat;
|
||||||
mStretchRightBeats = centerBeat - qBeat0;
|
mStretchRightBeats = centerBeat - qBeat0;
|
||||||
} else if (mViewInfo->selectedRegion.t1() == mSelStart) {
|
} else if (mSelStartValid && mViewInfo->selectedRegion.t1() == mSelStart) {
|
||||||
// note that at this point, mSelStart is at the opposite
|
// note that at this point, mSelStart is at the opposite
|
||||||
// end of the selection from the cursor. If the cursor is
|
// end of the selection from the cursor. If the cursor is
|
||||||
// over sel0, then mSelStart is at sel1.
|
// over sel0, then mSelStart is at sel1.
|
||||||
@ -2400,6 +2406,7 @@ void TrackPanel::SelectionHandleClick(wxMouseEvent & event,
|
|||||||
/// Reset our selection markers.
|
/// Reset our selection markers.
|
||||||
void TrackPanel::StartSelection(int mouseXCoordinate, int trackLeftEdge)
|
void TrackPanel::StartSelection(int mouseXCoordinate, int trackLeftEdge)
|
||||||
{
|
{
|
||||||
|
mSelStartValid = true;
|
||||||
mSelStart = mViewInfo->h + ((mouseXCoordinate - trackLeftEdge)
|
mSelStart = mViewInfo->h + ((mouseXCoordinate - trackLeftEdge)
|
||||||
/ mViewInfo->zoom);
|
/ mViewInfo->zoom);
|
||||||
|
|
||||||
@ -2427,7 +2434,7 @@ void TrackPanel::StartSelection(int mouseXCoordinate, int trackLeftEdge)
|
|||||||
void TrackPanel::ExtendSelection(int mouseXCoordinate, int trackLeftEdge,
|
void TrackPanel::ExtendSelection(int mouseXCoordinate, int trackLeftEdge,
|
||||||
Track *pTrack)
|
Track *pTrack)
|
||||||
{
|
{
|
||||||
if (mSelStart < 0)
|
if (!mSelStartValid)
|
||||||
// Must be dragging frequency bounds only.
|
// Must be dragging frequency bounds only.
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -2925,7 +2932,7 @@ void TrackPanel::SelectionHandleDrag(wxMouseEvent & event, Track *clickedTrack)
|
|||||||
const int minimumSizedSelection = 5; //measured in pixels
|
const int minimumSizedSelection = 5; //measured in pixels
|
||||||
|
|
||||||
// Might be dragging frequency bounds only, test
|
// Might be dragging frequency bounds only, test
|
||||||
if (mSelStart >= 0) {
|
if (mSelStartValid) {
|
||||||
wxInt64 SelStart=TimeToPosition( mSelStart, r.x); //cvt time to pixels.
|
wxInt64 SelStart=TimeToPosition( mSelStart, r.x); //cvt time to pixels.
|
||||||
// Abandon this drag if selecting < 5 pixels.
|
// Abandon this drag if selecting < 5 pixels.
|
||||||
if (wxLongLong(SelStart-x).Abs() < minimumSizedSelection
|
if (wxLongLong(SelStart-x).Abs() < minimumSizedSelection
|
||||||
@ -3569,6 +3576,7 @@ void TrackPanel::StartSlide(wxMouseEvent & event)
|
|||||||
mMouseClickX = event.m_x;
|
mMouseClickX = event.m_x;
|
||||||
mMouseClickY = event.m_y;
|
mMouseClickY = event.m_y;
|
||||||
|
|
||||||
|
mSelStartValid = true;
|
||||||
mSelStart = mViewInfo->h + ((event.m_x - r.x) / mViewInfo->zoom);
|
mSelStart = mViewInfo->h + ((event.m_x - r.x) / mViewInfo->zoom);
|
||||||
|
|
||||||
if (mSnapManager)
|
if (mSnapManager)
|
||||||
|
@ -559,6 +559,7 @@ protected:
|
|||||||
|
|
||||||
wxLongLong mLastSelectionAdjustment;
|
wxLongLong mLastSelectionAdjustment;
|
||||||
|
|
||||||
|
bool mSelStartValid;
|
||||||
double mSelStart;
|
double mSelStart;
|
||||||
|
|
||||||
#ifdef EXPERIMENTAL_SPECTRAL_EDITING
|
#ifdef EXPERIMENTAL_SPECTRAL_EDITING
|
||||||
|
Loading…
x
Reference in New Issue
Block a user