mirror of
https://github.com/LMMS/lmms.git
synced 2026-03-19 14:38:22 -04:00
Merge pull request #1563 from DanWin/resize-cursor
Don't display resize cursor for non-resizable TCOs
This commit is contained in:
@@ -121,6 +121,16 @@ public:
|
||||
return m_length;
|
||||
}
|
||||
|
||||
inline void setAutoResize( const bool _r )
|
||||
{
|
||||
m_autoResize = _r;
|
||||
}
|
||||
|
||||
inline const bool getAutoResize() const
|
||||
{
|
||||
return m_autoResize;
|
||||
}
|
||||
|
||||
virtual void movePosition( const MidiTime & _pos );
|
||||
virtual void changeLength( const MidiTime & _length );
|
||||
|
||||
@@ -165,6 +175,7 @@ private:
|
||||
|
||||
BoolModel m_mutedModel;
|
||||
BoolModel m_soloModel;
|
||||
bool m_autoResize;
|
||||
|
||||
bool m_selectViewOnCreate;
|
||||
|
||||
@@ -216,7 +227,6 @@ protected:
|
||||
virtual void mouseMoveEvent( QMouseEvent * _me );
|
||||
virtual void mouseReleaseEvent( QMouseEvent * _me );
|
||||
|
||||
void setAutoResizeEnabled( bool _e = false );
|
||||
float pixelsPerTact();
|
||||
|
||||
inline TrackView * getTrackView()
|
||||
@@ -248,7 +258,6 @@ private:
|
||||
TrackContentObject * m_tco;
|
||||
TrackView * m_trackView;
|
||||
Actions m_action;
|
||||
bool m_autoResize;
|
||||
QPoint m_initialMousePos;
|
||||
QPoint m_initialMouseGlobalPos;
|
||||
|
||||
|
||||
@@ -42,6 +42,11 @@ class EXPORT TrackContainer : public Model, public JournallingObject
|
||||
Q_OBJECT
|
||||
public:
|
||||
typedef QVector<Track *> TrackList;
|
||||
enum TrackContainerTypes
|
||||
{
|
||||
BBContainer,
|
||||
SongContainer
|
||||
} ;
|
||||
|
||||
TrackContainer();
|
||||
virtual ~TrackContainer();
|
||||
@@ -78,6 +83,16 @@ public:
|
||||
return "trackcontainer";
|
||||
}
|
||||
|
||||
inline void setType( TrackContainerTypes newType )
|
||||
{
|
||||
m_TrackContainerType = newType;
|
||||
}
|
||||
|
||||
inline TrackContainerTypes type() const
|
||||
{
|
||||
return m_TrackContainerType;
|
||||
}
|
||||
|
||||
|
||||
signals:
|
||||
void trackAdded( Track * _track );
|
||||
@@ -88,6 +103,8 @@ protected:
|
||||
private:
|
||||
TrackList m_tracks;
|
||||
|
||||
TrackContainerTypes m_TrackContainerType;
|
||||
|
||||
|
||||
friend class TrackContainerView;
|
||||
friend class Track;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -42,6 +42,7 @@ BBTrackContainer::BBTrackContainer() :
|
||||
// not change upon setCurrentBB()-call
|
||||
connect( &m_bbComboBoxModel, SIGNAL( dataUnchanged() ),
|
||||
this, SLOT( currentBBChanged() ) );
|
||||
setType( BBContainer );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -114,6 +114,7 @@ Song::Song() :
|
||||
this, SLOT( masterPitchChanged() ) );*/
|
||||
|
||||
qRegisterMetaType<Note>( "note" );
|
||||
setType( SongContainer );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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" ) );
|
||||
|
||||
@@ -58,6 +58,7 @@ BBTCO::BBTCO( Track * _track ) :
|
||||
changeLength( MidiTime( t, 0 ) );
|
||||
restoreJournallingState();
|
||||
}
|
||||
setAutoResize( false );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user