Fix song-editor regressions and BB-editor bugs from #3487 (#4008)

* Fix TCO copy with Ctrl + Dragging
* Fix text float display in song editor
* avoids override cursor in BBEditor for sampletracks at left side
This commit is contained in:
Hyunjin Song
2017-11-29 14:31:13 +09:00
committed by GitHub
parent 4ff5eba0f9
commit 6de7cb6a87

View File

@@ -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();
@@ -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,29 +823,35 @@ 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 )
{
QVector<TrackContentObjectView *> tcoViews;
if( m_action == CopySelection )
{
// Collect all selected TCOs
QVector<selectableObject *> so =
m_trackView->trackContainerView()->selectedObjects();
for( auto it = so.begin(); it != so.end(); ++it )
{
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;
// 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 )
{
TrackContentObjectView * tcov =
dynamic_cast<TrackContentObjectView *>( *it );
if( tcov != NULL )
{
tcoViews.push_back( tcov );
}
}
// 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<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() !=