resposible for moving track-content-widgets to appropriate position after change of visible viewport ! \brief Move the trackContentWidget to a new place in time * * \param newPos The MIDI time to move to. */
| 1215 | * \param newPos The MIDI time to move to. |
| 1216 | */ |
| 1217 | void TrackContentWidget::changePosition( const MidiTime & newPos ) |
| 1218 | { |
| 1219 | if( m_trackView->trackContainerView() == gui->getBBEditor()->trackContainerView() ) |
| 1220 | { |
| 1221 | const int curBB = Engine::getBBTrackContainer()->currentBB(); |
| 1222 | setUpdatesEnabled( false ); |
| 1223 | |
| 1224 | // first show TCO for current BB... |
| 1225 | for( tcoViewVector::iterator it = m_tcoViews.begin(); |
| 1226 | it != m_tcoViews.end(); ++it ) |
| 1227 | { |
| 1228 | if( ( *it )->getTrackContentObject()-> |
| 1229 | startPosition().getTact() == curBB ) |
| 1230 | { |
| 1231 | ( *it )->move( 0, ( *it )->y() ); |
| 1232 | ( *it )->raise(); |
| 1233 | ( *it )->show(); |
| 1234 | } |
| 1235 | else |
| 1236 | { |
| 1237 | ( *it )->lower(); |
| 1238 | } |
| 1239 | } |
| 1240 | // ...then hide others to avoid flickering |
| 1241 | for( tcoViewVector::iterator it = m_tcoViews.begin(); |
| 1242 | it != m_tcoViews.end(); ++it ) |
| 1243 | { |
| 1244 | if( ( *it )->getTrackContentObject()-> |
| 1245 | startPosition().getTact() != curBB ) |
| 1246 | { |
| 1247 | ( *it )->hide(); |
| 1248 | } |
| 1249 | } |
| 1250 | setUpdatesEnabled( true ); |
| 1251 | return; |
| 1252 | } |
| 1253 | |
| 1254 | MidiTime pos = newPos; |
| 1255 | if( pos < 0 ) |
| 1256 | { |
| 1257 | pos = m_trackView->trackContainerView()->currentPosition(); |
| 1258 | } |
| 1259 | |
| 1260 | const int begin = pos; |
| 1261 | const int end = endPosition( pos ); |
| 1262 | const float ppt = m_trackView->trackContainerView()->pixelsPerTact(); |
| 1263 | |
| 1264 | setUpdatesEnabled( false ); |
| 1265 | for( tcoViewVector::iterator it = m_tcoViews.begin(); |
| 1266 | it != m_tcoViews.end(); ++it ) |
| 1267 | { |
| 1268 | TrackContentObjectView * tcov = *it; |
| 1269 | TrackContentObject * tco = tcov->getTrackContentObject(); |
| 1270 | |
| 1271 | tco->changeLength( tco->length() ); |
| 1272 | |
| 1273 | const int ts = tco->startPosition(); |
| 1274 | const int te = tco->endPosition()-3; |
no test coverage detected