diff --git a/ChangeLog b/ChangeLog index f9016e3f9..1deac189a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,18 @@ 2008-06-25 Tobias Doerffel + * include/track.h: + * include/pattern.h: + * include/bb_track.h: + * src/tracks/bb_track.cpp: + * src/tracks/pattern.cpp: + * src/core/track.cpp: + name-property in trackContentObject-class + + * include/automation_pattern.h: + * src/core/automation_pattern.cpp: + - added submenu for removing connections + - made automation-pattern rename working + * src/core/automation_pattern.cpp: fixed loading song-global automation diff --git a/include/bb_track.h b/include/bb_track.h index f2edd67b5..46a75c25b 100644 --- a/include/bb_track.h +++ b/include/bb_track.h @@ -58,7 +58,6 @@ public: private: - QString m_name; unsigned int m_color; diff --git a/include/pattern.h b/include/pattern.h index 5bb7d5f74..b26532d61 100644 --- a/include/pattern.h +++ b/include/pattern.h @@ -91,19 +91,6 @@ public: void checkType( void ); - // pattern-name functions - inline const QString & name( void ) const - { - return( m_name ); - } - - inline void setName( const QString & _name ) - { - m_name = _name; - emit dataChanged(); - } - - // functions which are part of freezing-feature inline bool freezing( void ) const { @@ -163,7 +150,6 @@ private: instrumentTrack * m_instrumentTrack; PatternTypes m_patternType; - QString m_name; // data-stuff noteVector m_notes; diff --git a/include/track.h b/include/track.h index bb88af7d4..7b43ab081 100644 --- a/include/track.h +++ b/include/track.h @@ -66,20 +66,35 @@ class trackContentObject : public model, public journallingObject Q_OBJECT public: trackContentObject( track * _track ); -// trackContentObject( const trackContentObject & _copy ); virtual ~trackContentObject(); + inline track * getTrack( void ) { return( m_track ); } + + inline const QString & name( void ) const + { + return( m_name ); + } + + inline void setName( const QString & _name ) + { + m_name = _name; + emit dataChanged(); + } + + inline const midiTime & startPosition( void ) const { return( m_startPosition ); } + inline midiTime endPosition( void ) const { return( m_startPosition + m_length ); } + inline const midiTime & length( void ) const { return( m_length ); @@ -96,7 +111,6 @@ public: virtual trackContentObjectView * createView( trackView * _tv ) = 0; - protected: virtual void undoStep( journalEntry & _je ); virtual void redoStep( journalEntry & _je ); @@ -124,6 +138,8 @@ private: } ; track * m_track; + QString m_name; + midiTime m_startPosition; midiTime m_length; diff --git a/src/core/track.cpp b/src/core/track.cpp index f57242e6d..e02daf9d7 100644 --- a/src/core/track.cpp +++ b/src/core/track.cpp @@ -109,6 +109,7 @@ textFloat * trackContentObjectView::s_textFloat = NULL; trackContentObject::trackContentObject( track * _track ) : model( _track ), m_track( _track ), + m_name( QString::null ), m_startPosition(), m_length(), m_mutedModel( FALSE, this ) @@ -968,9 +969,9 @@ void trackContentWidget::changePosition( const midiTime & _new_pos ) // first show TCO for current BB... for( tcoViewVector::iterator it = m_tcoViews.begin(); - it != m_tcoViews.end(); ++it ) + it != m_tcoViews.end(); ++it ) { - if( ( *it )->getTrackContentObject()-> + if( ( *it )->getTrackContentObject()-> startPosition().getTact() == cur_bb ) { ( *it )->move( 0, ( *it )->y() ); @@ -986,8 +987,8 @@ void trackContentWidget::changePosition( const midiTime & _new_pos ) for( tcoViewVector::iterator it = m_tcoViews.begin(); it != m_tcoViews.end(); ++it ) { - if( ( *it )->getTrackContentObject()-> - startPosition().getTact() != cur_bb ) + if( ( *it )->getTrackContentObject()-> + startPosition().getTact() != cur_bb ) { ( *it )->hide(); } diff --git a/src/tracks/bb_track.cpp b/src/tracks/bb_track.cpp index 4e38a4acf..01733eff9 100644 --- a/src/tracks/bb_track.cpp +++ b/src/tracks/bb_track.cpp @@ -51,10 +51,6 @@ bbTrack::infoMap bbTrack::s_infoMap; bbTCO::bbTCO( track * _track, unsigned int _color ) : trackContentObject( _track ), - m_name(/* ( dynamic_cast( _track ) != NULL ) ? - dynamic_cast( _track )->trackLabel()->text() : - QString( "" )*/ - "" ), m_color( _color > 0 ? _color : qRgb( 64, 128, 255 ) ) { tact t = engine::getBBTrackContainer()->lengthOfBB( @@ -79,7 +75,7 @@ bbTCO::~bbTCO() void bbTCO::saveSettings( QDomDocument & _doc, QDomElement & _this ) { - _this.setAttribute( "name", m_name ); + _this.setAttribute( "name", name() ); if( _this.parentNode().nodeName() == "clipboard" ) { _this.setAttribute( "pos", -1 ); @@ -98,7 +94,7 @@ void bbTCO::saveSettings( QDomDocument & _doc, QDomElement & _this ) void bbTCO::loadSettings( const QDomElement & _this ) { - m_name = _this.attribute( "name" ); + setName( _this.attribute( "name" ) ); if( _this.attribute( "pos" ).toInt() >= 0 ) { movePosition( _this.attribute( "pos" ).toInt() ); @@ -216,7 +212,7 @@ void bbTCOView::paintEvent( QPaintEvent * ) p.setFont( pointSize<7>( p.font() ) ); p.setPen( QColor( 0, 0, 0 ) ); - p.drawText( 2, p.fontMetrics().height() - 1, m_bbTCO->m_name ); + p.drawText( 2, p.fontMetrics().height() - 1, m_bbTCO->name() ); if( m_bbTCO->isMuted() ) { @@ -243,9 +239,9 @@ void bbTCOView::resetName( void ) { if( dynamic_cast( getTrackView() ) != NULL ) { - m_bbTCO->m_name = + m_bbTCO->setName( dynamic_cast( getTrackView() )-> - trackLabel()->text(); + trackLabel()->text() ); } } @@ -254,8 +250,10 @@ void bbTCOView::resetName( void ) void bbTCOView::changeName( void ) { - renameDialog rename_dlg( m_bbTCO->m_name ); + QString s = m_bbTCO->name(); + renameDialog rename_dlg( s ); rename_dlg.exec(); + m_bbTCO->setName( s ); } diff --git a/src/tracks/pattern.cpp b/src/tracks/pattern.cpp index 6ffb48a05..d9f1a009d 100644 --- a/src/tracks/pattern.cpp +++ b/src/tracks/pattern.cpp @@ -66,12 +66,12 @@ pattern::pattern( instrumentTrack * _instrument_track ) : trackContentObject( _instrument_track ), m_instrumentTrack( _instrument_track ), m_patternType( BeatPattern ), - m_name( _instrument_track->name() ), m_steps( midiTime::stepsPerTact() ), m_frozenPattern( NULL ), m_freezing( FALSE ), m_freezeAborted( FALSE ) { + setName( _instrument_track->name() ); init(); } @@ -82,7 +82,6 @@ pattern::pattern( const pattern & _pat_to_copy ) : trackContentObject( _pat_to_copy.m_instrumentTrack ), m_instrumentTrack( _pat_to_copy.m_instrumentTrack ), m_patternType( _pat_to_copy.m_patternType ), - m_name( "" ), m_steps( _pat_to_copy.m_steps ), m_frozenPattern( NULL ), m_freezeAborted( FALSE ) @@ -324,7 +323,7 @@ void pattern::checkType( void ) void pattern::saveSettings( QDomDocument & _doc, QDomElement & _this ) { _this.setAttribute( "type", m_patternType ); - _this.setAttribute( "name", m_name ); + _this.setAttribute( "name", name() ); // as the target of copied/dragged pattern is always an existing // pattern, we must not store actual position, instead we store -1 // which tells loadSettings() not to mess around with position @@ -362,7 +361,7 @@ void pattern::loadSettings( const QDomElement & _this ) m_patternType = static_cast( _this.attribute( "type" ).toInt() ); - m_name = _this.attribute( "name" ); + setName( _this.attribute( "name" ) ); if( _this.attribute( "pos" ).toInt() >= 0 ) { movePosition( _this.attribute( "pos" ).toInt() );