Commit 5805cafb authored by Cyril Deguet's avatar Cyril Deguet

* ctrl_tree.cpp: (un)folding of a playlist item is no triggered

by a simple click (was a double click before) which is more
natural
parent 89acb8f5
...@@ -395,6 +395,15 @@ void CtrlTree::handleEvent( EvtGeneric &rEvent ) ...@@ -395,6 +395,15 @@ void CtrlTree::handleEvent( EvtGeneric &rEvent )
} }
else if( rEvent.getAsString().find( "mouse:left:down" ) != else if( rEvent.getAsString().find( "mouse:left:down" ) !=
string::npos ) string::npos )
{
it = findItemAtPos(yPos);
if( it->size() && xPos > (it->depth() - 1) * itemImageWidth()
&& xPos < it->depth() * itemImageWidth() )
{
// Fold/unfold the item
it->m_expanded = !it->m_expanded;
}
else
{ {
// Unselect any previously selected item // Unselect any previously selected item
for( it = m_rTree.begin(); it != m_rTree.end(); for( it = m_rTree.begin(); it != m_rTree.end();
...@@ -403,31 +412,24 @@ void CtrlTree::handleEvent( EvtGeneric &rEvent ) ...@@ -403,31 +412,24 @@ void CtrlTree::handleEvent( EvtGeneric &rEvent )
it->m_selected = false; it->m_selected = false;
} }
// Select the new item // Select the new item
it = findItemAtPos(yPos);
if( it != m_rTree.end() ) if( it != m_rTree.end() )
{ {
it->m_selected = true; it->m_selected = true;
m_pLastSelected = &*it; m_pLastSelected = &*it;
} }
} }
}
else if( rEvent.getAsString().find( "mouse:left:dblclick" ) != else if( rEvent.getAsString().find( "mouse:left:dblclick" ) !=
string::npos ) string::npos )
{ {
it = findItemAtPos(yPos); it = findItemAtPos(yPos);
if( it != m_rTree.end() ) if( it != m_rTree.end() )
{
if( it->size() && xPos < it->depth() * itemImageWidth() )
{
it->m_expanded = !it->m_expanded;
}
else
{ {
// Execute the action associated to this item // Execute the action associated to this item
m_rTree.action( &*it ); m_rTree.action( &*it );
} }
} }
}
// Redraw the control // Redraw the control
makeImage(); makeImage();
......
...@@ -88,8 +88,6 @@ void Playtree::action( VarTree *pItem ) ...@@ -88,8 +88,6 @@ void Playtree::action( VarTree *pItem )
void Playtree::onChange() void Playtree::onChange()
{ {
/* FIXME : updateTree could be a nice idea so we don't have to
* start from scratch each time the playlist changes */
buildTree(); buildTree();
notify(); notify();
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment