Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 47 additions & 33 deletions src/core/Track.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<SampleTCO*>( 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();
Expand All @@ -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 )
{
Expand Down Expand Up @@ -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<TrackContentObjectView *> tcoViews;
QVector<selectableObject *> so =
m_trackView->trackContainerView()->selectedObjects();
for( QVector<selectableObject *>::iterator it = so.begin();
it != so.end(); ++it )
if( m_action == CopySelection )
{
TrackContentObjectView * tcov =
dynamic_cast<TrackContentObjectView *>( *it );
if( tcov != NULL )
// Collect all selected TCOs
QVector<selectableObject *> so =
m_trackView->trackContainerView()->selectedObjects();
for( auto it = so.begin(); it != so.end(); ++it )
{
tcoViews.push_back( tcov );
TrackContentObjectView * tcov =
dynamic_cast<TrackContentObjectView *>( *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 );
Expand Down Expand Up @@ -973,7 +987,7 @@ void TrackContentObjectView::mouseMoveEvent( QMouseEvent * me )
{
SampleTCO * sTco = dynamic_cast<SampleTCO*>( 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() !=
Expand Down