Merge pull request #1563 from DanWin/resize-cursor

Don't display resize cursor for non-resizable TCOs
This commit is contained in:
Tres Finocchiaro
2015-01-10 09:32:09 -05:00
10 changed files with 85 additions and 20 deletions

View File

@@ -54,6 +54,21 @@ AutomationPattern::AutomationPattern( AutomationTrack * _auto_track ) :
m_lastRecordedValue( 0 )
{
changeLength( MidiTime( 1, 0 ) );
if( getTrack() )
{
switch( getTrack()->trackContainer()->type() )
{
case TrackContainer::BBContainer:
setAutoResize( true );
break;
case TrackContainer::SongContainer:
// move down
default:
setAutoResize( false );
break;
}
}
}
@@ -72,6 +87,18 @@ AutomationPattern::AutomationPattern( const AutomationPattern & _pat_to_copy ) :
m_timeMap[it.key()] = it.value();
m_tangents[it.key()] = _pat_to_copy.m_tangents[it.key()];
}
switch( getTrack()->trackContainer()->type() )
{
case TrackContainer::BBContainer:
setAutoResize( true );
break;
case TrackContainer::SongContainer:
// move down
default:
setAutoResize( false );
break;
}
}

View File

@@ -42,6 +42,7 @@ BBTrackContainer::BBTrackContainer() :
// not change upon setCurrentBB()-call
connect( &m_bbComboBoxModel, SIGNAL( dataUnchanged() ),
this, SLOT( currentBBChanged() ) );
setType( BBContainer );
}

View File

@@ -114,6 +114,7 @@ Song::Song() :
this, SLOT( masterPitchChanged() ) );*/
qRegisterMetaType<Note>( "note" );
setType( SongContainer );
}

View File

@@ -248,7 +248,6 @@ TrackContentObjectView::TrackContentObjectView( TrackContentObject * _tco,
m_tco( _tco ),
m_trackView( _tv ),
m_action( NoAction ),
m_autoResize( false ),
m_initialMousePos( QPoint( 0, 0 ) ),
m_initialMouseGlobalPos( QPoint( 0, 0 ) ),
m_hint( NULL ),
@@ -656,7 +655,7 @@ void TrackContentObjectView::mousePressEvent( QMouseEvent * _me )
"a copy." ),
embed::getIconPixmap( "hint" ), 0 );
}
else if( m_autoResize == false )
else if( !m_tco->getAutoResize() )
{
m_action = Resize;
m_oldTime = m_tco->length();
@@ -846,7 +845,7 @@ void TrackContentObjectView::mouseMoveEvent( QMouseEvent * _me )
}
else
{
if( _me->x() > width() - RESIZE_GRIP_WIDTH && !_me->buttons() )
if( _me->x() > width() - RESIZE_GRIP_WIDTH && !_me->buttons() && !m_tco->getAutoResize() )
{
if( QApplication::overrideCursor() != NULL &&
QApplication::overrideCursor()->shape() !=
@@ -957,19 +956,6 @@ float TrackContentObjectView::pixelsPerTact()
/*! \brief Set whether this trackContentObjectView can resize.
*
* \param _e The boolean state of whether this track content object view
* is allowed to resize.
*/
void TrackContentObjectView::setAutoResizeEnabled( bool _e )
{
m_autoResize = _e;
}
/*! \brief Detect whether the mouse moved more than n pixels on screen.
*
* \param _me The QMouseEvent.

View File

@@ -54,7 +54,6 @@ AutomationPatternView::AutomationPatternView( AutomationPattern * _pattern,
setAttribute( Qt::WA_OpaquePaintEvent, true );
setFixedHeight( parentWidget()->height() - 2 );
setAutoResizeEnabled( false );
ToolTip::add( this, tr( "double-click to open this pattern in "
"automation editor" ) );

View File

@@ -58,6 +58,7 @@ BBTCO::BBTCO( Track * _track ) :
changeLength( MidiTime( t, 0 ) );
restoreJournallingState();
}
setAutoResize( false );
}

View File

@@ -66,6 +66,7 @@ Pattern::Pattern( InstrumentTrack * _instrument_track ) :
{
setName( _instrument_track->name() );
init();
setAutoResize( true );
}
@@ -83,6 +84,18 @@ Pattern::Pattern( const Pattern& other ) :
}
init();
switch( getTrack()->trackContainer()->type() )
{
case TrackContainer::BBContainer:
setAutoResize( true );
break;
case TrackContainer::SongContainer:
// move down
default:
setAutoResize( false );
break;
}
}
@@ -635,7 +648,6 @@ PatternView::PatternView( Pattern* pattern, TrackView* parent ) :
}
setFixedHeight( parentWidget()->height() - 2 );
setAutoResizeEnabled( false );
ToolTip::add( this,
tr( "double-click to open this pattern in piano-roll\n"

View File

@@ -62,6 +62,18 @@ SampleTCO::SampleTCO( Track * _track ) :
// change length of this TCO
connect( Engine::getSong(), SIGNAL( tempoChanged( bpm_t ) ),
this, SLOT( updateLength( bpm_t ) ) );
switch( getTrack()->trackContainer()->type() )
{
case TrackContainer::BBContainer:
setAutoResize( true );
break;
case TrackContainer::SongContainer:
// move down
default:
setAutoResize( false );
break;
}
}