1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-29 14:48:39 +02:00

LabelTrack::HandleClick rearranged

This commit is contained in:
Paul Licameli 2016-06-29 19:29:22 -04:00
parent 7060dc4088
commit 815d75b305

View File

@ -1535,11 +1535,10 @@ void LabelTrack::HandleClick(const wxMouseEvent & evt,
if (mLabels[mSelIndex]->changeInitialMouseXPos)
mInitialCursorPos = mCurrentCursorPos;
mDrawCursor = true;
}
// reset the highlight indicator
wxRect highlightedRect;
if (mSelIndex != -1) {
{
int xpos1, xpos2;
CalcHighlightXs(&xpos1, &xpos2);
@ -1567,7 +1566,7 @@ void LabelTrack::HandleClick(const wxMouseEvent & evt,
}
// disable displaying if right button is down outside text box
if (mSelIndex != -1 && evt.RightDown()
if (evt.RightDown()
&& !highlightedRect.Contains(evt.m_x, evt.m_y))
mDragXPos = -1;
@ -1577,18 +1576,20 @@ void LabelTrack::HandleClick(const wxMouseEvent & evt,
// Check for a click outside of the selected label's text box; in this
// case PasteSelectedText() will start a NEW label at the click
// location
if (mSelIndex != -1) {
if (!OverTextBox(mLabels[mSelIndex], evt.m_x, evt.m_y))
mSelIndex = -1;
double t = zoomInfo.PositionToTime(evt.m_x, r.x);
*newSel = SelectedRegion(t, t);
}
#endif
}
#if defined(__WXGTK__) && (HAVE_GTK)
if (evt.MiddleDown()) {
// Paste text, making a NEW label if none is selected.
wxTheClipboard->UsePrimarySelection(true);
PasteSelectedText(newSel->t0(), newSel->t1());
wxTheClipboard->UsePrimarySelection(false);
return;
}
#endif
}