void CtrlTree::onUpdate( Subject<VarTree> &rTree )
{
- // Invalidate the position when the tree is updated
- m_lastPos = m_rTree.begin();
-
autoScroll();
m_pLastSelected = NULL;
}
void CtrlTree::autoScroll()
{
- fprintf( stderr, "Autoscroll start\n");
// Find the current playing stream
int playIndex = 0;
VarTree::Iterator it;
for( it = m_rTree.begin(); it != m_rTree.end();
it = m_rTree.getNextVisibleItem( it ) )
{
- fprintf (stderr, "Checking playindex is %i\n", playIndex);
if( it->m_playing ) break;
playIndex++;
}
- fprintf (stderr, "broke playIndex\n");
if( it == m_rTree.end() ) return;
for( it = m_rTree.begin(); it != m_rTree.end();
it = m_rTree.getNextVisibleItem( it ) )
{
- fprintf (stderr, "Testing, lastPos is %i\n", lastPosIndex );
if( it == m_lastPos ) break;
lastPosIndex++;
}
if( it == m_rTree.end() ) return;
- fprintf( stderr, "I have %i visible\n", maxItems() );
if( it != m_rTree.end()
&& ( playIndex < lastPosIndex
|| playIndex > lastPosIndex + maxItems() ) )
{
- fprintf( stderr, "Need to scroll\n");
// Scroll to have the playing stream visible
VarPercent &rVarPos = m_rTree.getPositionVar();
rVarPos.set( 1.0 - (double)playIndex / (double)m_rTree.visibleItems() );
}
else
{
- fprintf( stderr, "No need to scroll\n");
makeImage();
notifyLayout();
}
bgColor = ( bgColor == m_bgColor1 ? m_bgColor2 : m_bgColor1 );
}
}
-// fprintf( stderr, "done\n");
int bitmapWidth = itemImageWidth();
playlist_t *p_playlist = (playlist_t*)pObj;
pThis->updateStreamName(p_playlist);
- // Create a playlist notify command
+ // Create a playlist notify command (for old style playlist)
CmdNotifyPlaylist *pCmd = new CmdNotifyPlaylist( pThis->getIntf() );
- // Create a playtree notify command
+ // Create a playtree notify command (for new style playtree)
CmdPlaytreeChanged *pCmdTree = new CmdPlaytreeChanged( pThis->getIntf() );
// Push the command in the asynchronous command queue
playlist_t *p_playlist = (playlist_t*)pObj;
pThis->updateStreamName(p_playlist);
- // Create a playlist notify command
+ // Create a playlist notify command (old style playlist)
// TODO: selective update
CmdNotifyPlaylist *pCmd = new CmdNotifyPlaylist( pThis->getIntf() );
- // Create a playtree notify command
- CmdPlaytreeChanged *pCmdTree = new CmdPlaytreeChanged( pThis->getIntf() );
-
- // Push the command in the asynchronous command queue
pQueue->push( CmdGenericPtr( pCmd ) );
- pQueue->push( CmdGenericPtr( pCmdTree ) );
+ // Create two playtree notify commands: one for old item, one for new
+ CmdPlaytreeUpdate *pCmdTree = new CmdPlaytreeUpdate( pThis->getIntf(),
+ oldVal.i_int );
+ pQueue->push( CmdGenericPtr( pCmdTree ) , true );
+ pCmdTree = new CmdPlaytreeUpdate( pThis->getIntf(), newVal.i_int );
+ pQueue->push( CmdGenericPtr( pCmdTree ) , true );
return VLC_SUCCESS;
}