diff --git a/src/core/Track.cpp b/src/core/Track.cpp index 816cbafdf83..209be3a4999 100644 --- a/src/core/Track.cpp +++ b/src/core/Track.cpp @@ -728,8 +728,17 @@ void TrackContentObjectView::mousePressEvent( QMouseEvent * me ) } else { + gui->songEditor()->m_editor->selectAllTcos( false ); + m_tco->addJournalCheckPoint(); + + // move or resize + m_tco->setJournalling( false ); + + setInitialMousePos( me->pos() ); + SampleTCO * sTco = dynamic_cast( m_tco ); - if( me->x() < RESIZE_GRIP_WIDTH && sTco ) + if( me->x() < RESIZE_GRIP_WIDTH && sTco + && !m_tco->getAutoResize() ) { m_action = ResizeLeft; m_oldTime = m_tco->startPosition(); @@ -753,25 +762,24 @@ void TrackContentObjectView::mousePressEvent( QMouseEvent * me ) QApplication::setOverrideCursor( c ); s_textFloat->setTitle( tr( "Current length" ) ); } + // s_textFloat->reparent( this ); + // setup text-float as if TCO was already moved/resized + mouseMoveEvent( me ); + s_textFloat->show(); } + + delete m_hint; + QString hint = m_action == Move || m_action == MoveSelection + ? tr( "Press <%1> and drag to make a copy." ) + : tr( "Press <%1> for free resizing." ); + m_hint = TextFloat::displayMessage( tr( "Hint" ), hint.arg( + #ifdef LMMS_BUILD_APPLE + "⌘"), + #else + "Ctrl"), + #endif + embed::getIconPixmap( "hint" ), 0 ); } - delete m_hint; - QString hint = m_action == Move ? tr( "Press <%1> and drag to make " - "a copy." ) - : tr( "Press <%1> for free " - "resizing." ); - m_hint = TextFloat::displayMessage( tr( "Hint" ), - hint.arg( - #ifdef LMMS_BUILD_APPLE - "⌘"), - #else - "Ctrl"), - #endif - embed::getIconPixmap( "hint" ), 0 ); -// s_textFloat->reparent( this ); - // setup text-float as if TCO was already moved/resized - mouseMoveEvent( me ); - s_textFloat->show(); } else if( me->button() == Qt::RightButton ) { @@ -815,28 +823,34 @@ void TrackContentObjectView::mousePressEvent( QMouseEvent * me ) */ void TrackContentObjectView::mouseMoveEvent( QMouseEvent * me ) { - if( m_action == CopySelection ) + if( m_action == CopySelection || m_action == ToggleSelected ) { if( mouseMovedDistance( me, 2 ) == true ) { - // Clear the action here because mouseReleaseEvent will not get - // triggered once we go into drag. - m_action = NoAction; - - // Collect all selected TCOs QVector tcoViews; - QVector so = - m_trackView->trackContainerView()->selectedObjects(); - for( QVector::iterator it = so.begin(); - it != so.end(); ++it ) + if( m_action == CopySelection ) { - TrackContentObjectView * tcov = - dynamic_cast( *it ); - if( tcov != NULL ) + // Collect all selected TCOs + QVector so = + m_trackView->trackContainerView()->selectedObjects(); + for( auto it = so.begin(); it != so.end(); ++it ) { - tcoViews.push_back( tcov ); + TrackContentObjectView * tcov = + dynamic_cast( *it ); + if( tcov != NULL ) + { + tcoViews.push_back( tcov ); + } } } + else + { + gui->songEditor()->m_editor->selectAllTcos( false ); + tcoViews.push_back( this ); + } + // Clear the action here because mouseReleaseEvent will not get + // triggered once we go into drag. + m_action = NoAction; // Write the TCOs to the DataFile for copying DataFile dataFile = createTCODataFiles( tcoViews ); @@ -973,7 +987,7 @@ void TrackContentObjectView::mouseMoveEvent( QMouseEvent * me ) { SampleTCO * sTco = dynamic_cast( m_tco ); if( ( me->x() > width() - RESIZE_GRIP_WIDTH && !me->buttons() && !m_tco->getAutoResize() ) - || ( me->x() < RESIZE_GRIP_WIDTH && !me->buttons() && sTco ) ) + || ( me->x() < RESIZE_GRIP_WIDTH && !me->buttons() && sTco && !m_tco->getAutoResize() ) ) { if( QApplication::overrideCursor() != NULL && QApplication::overrideCursor()->shape() !=